From e58e04e6e3f8ad44d36409196017e05a29448d20 Mon Sep 17 00:00:00 2001 From: tomiir Date: Mon, 9 Sep 2024 08:44:06 -0600 Subject: [PATCH 1/5] chore: use shared gh token (#2809) Co-authored-by: Enes --- .github/workflows/ui_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui_tests.yml b/.github/workflows/ui_tests.yml index 40d87633ba..fdd9dbfbd9 100644 --- a/.github/workflows/ui_tests.yml +++ b/.github/workflows/ui_tests.yml @@ -54,7 +54,7 @@ jobs: labels: playwright count: 5 secrets: - GITHUB_PAT: ${{ secrets.RELEASE_TOKEN }} + GITHUB_PAT: ${{ secrets.RELEASE_TOKEN_V2 }} TF_API_TOKEN: ${{ secrets.TFC_INFRA_TOKEN }} ui_tests: From 07a931c633d2ec44138471c6fe5d1e3735d35865 Mon Sep 17 00:00:00 2001 From: tomiir Date: Mon, 9 Sep 2024 09:11:15 -0600 Subject: [PATCH 2/5] chore: add input secrets to setup workflow (#2822) Co-authored-by: Enes --- .github/workflows/ui_tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ui_tests.yml b/.github/workflows/ui_tests.yml index fdd9dbfbd9..5e02c4bcbe 100644 --- a/.github/workflows/ui_tests.yml +++ b/.github/workflows/ui_tests.yml @@ -36,6 +36,10 @@ on: secrets: NEXT_PUBLIC_PROJECT_ID: required: true + RELEASE_TOKEN_V2: + required: true + TFC_INFRA_TOKEN: + required: true TESTS_NEXTAUTH_SECRET: required: false TESTS_MAILSAC_API_KEY: From 348b15c13770e53eda01188562d37f8da03a2e0a Mon Sep 17 00:00:00 2001 From: Felipe Mendes Date: Mon, 9 Sep 2024 13:25:43 -0300 Subject: [PATCH 3/5] fix: remove deprecated params from sign transaction wc rpc request (#2816) --- apps/laboratory/next.config.mjs | 2 +- .../Solana/SolanaSignJupiterSwapTest.tsx | 122 ++++++++++++++++++ .../src/components/Solana/SolanaTests.tsx | 14 ++ .../web3js/providers/WalletConnectProvider.ts | 14 +- .../tests/WalletConnectProvider.test.ts | 40 ------ 5 files changed, 139 insertions(+), 53 deletions(-) create mode 100644 apps/laboratory/src/components/Solana/SolanaSignJupiterSwapTest.tsx diff --git a/apps/laboratory/next.config.mjs b/apps/laboratory/next.config.mjs index d93cf2747a..81435953fb 100644 --- a/apps/laboratory/next.config.mjs +++ b/apps/laboratory/next.config.mjs @@ -11,7 +11,7 @@ const cspHeader = ` style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src * 'self' data: blob: https://walletconnect.org https://walletconnect.com https://secure.walletconnect.com https://secure.walletconnect.org https://tokens-data.1inch.io https://tokens.1inch.io https://ipfs.io https://lab.web3modal.com; font-src 'self' https://fonts.gstatic.com; - connect-src 'self' https://react-wallet.walletconnect.com https://rpc.walletconnect.com https://rpc.walletconnect.org https://relay.walletconnect.com https://relay.walletconnect.org wss://relay.walletconnect.com wss://relay.walletconnect.org https://pulse.walletconnect.com https://pulse.walletconnect.org https://api.web3modal.com https://api.web3modal.org wss://www.walletlink.org https://o1095249.ingest.sentry.io; + connect-src 'self' https://react-wallet.walletconnect.com https://rpc.walletconnect.com https://rpc.walletconnect.org https://relay.walletconnect.com https://relay.walletconnect.org wss://relay.walletconnect.com wss://relay.walletconnect.org https://pulse.walletconnect.com https://pulse.walletconnect.org https://api.web3modal.com https://api.web3modal.org wss://www.walletlink.org https://o1095249.ingest.sentry.io https://quote-api.jup.ag; frame-src 'self' https://verify.walletconnect.com https://verify.walletconnect.org https://secure.walletconnect.com https://secure.walletconnect.org ${ process.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL || '' }; diff --git a/apps/laboratory/src/components/Solana/SolanaSignJupiterSwapTest.tsx b/apps/laboratory/src/components/Solana/SolanaSignJupiterSwapTest.tsx new file mode 100644 index 0000000000..087da33757 --- /dev/null +++ b/apps/laboratory/src/components/Solana/SolanaSignJupiterSwapTest.tsx @@ -0,0 +1,122 @@ +import { useState } from 'react' +import { Button, Stack, Text, Spacer } from '@chakra-ui/react' +import { PublicKey, VersionedTransaction } from '@solana/web3.js' + +import { useWeb3ModalAccount, useWeb3ModalProvider } from '@web3modal/solana/react' + +import { solana } from '../../utils/ChainsUtil' +import { useChakraToast } from '../Toast' +import bs58 from 'bs58' + +export function SolanaSignJupiterSwapTest() { + const toast = useChakraToast() + const { chainId } = useWeb3ModalAccount() + const { walletProvider, connection } = useWeb3ModalProvider() + const [loading, setLoading] = useState(false) + + async function onSignVersionedTransaction() { + try { + setLoading(true) + if (!walletProvider?.publicKey) { + throw Error('user is disconnected') + } + + if (!connection) { + throw Error('no connection set') + } + + const transaction = await createJupiterSwapTransaction({ + publicKey: walletProvider.publicKey + }) + const signedTransaction = await walletProvider.signTransaction(transaction) + const signature = signedTransaction.signatures[0] + + if (!signature) { + throw Error('Empty signature') + } + + toast({ + title: 'Success', + description: bs58.encode(signature), + type: 'success' + }) + } catch (err) { + toast({ + title: 'Error', + description: (err as Error).message, + type: 'error' + }) + } finally { + setLoading(false) + } + } + + if (chainId === solana.chainId) { + return ( + + Switch to Solana Devnet or Testnet to test this feature + + ) + } + + return ( + + + + + ) +} + +type CreateJupiterSwapTransactionParams = { + publicKey: PublicKey +} + +async function createJupiterSwapTransaction({ publicKey }: CreateJupiterSwapTransactionParams) { + const qs = new URLSearchParams({ + inputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', + outputMint: 'So11111111111111111111111111111111111111112', + amount: '100000', + slippageBps: '300', + swapMode: 'ExactIn', + onlyDirectRoutes: 'false', + asLegacyTransaction: 'false', + maxAccounts: '64', + minimizeSlippage: 'false' + }) + + const quoteResponse = await ( + await fetch(`https://quote-api.jup.ag/v6/quote?${qs.toString()}`) + ).json() + const swapResponse = await ( + await fetch('https://quote-api.jup.ag/v6/swap', { + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + userPublicKey: publicKey.toString(), + wrapAndUnwrapSol: true, + prioritizationFeeLamports: { + priorityLevelWithMaxLamports: { + maxLamports: 4000000, + global: false, + priorityLevel: 'high' + } + }, + asLegacyTransaction: false, + dynamicComputeUnitLimit: true, + allowOptimizedWrappedSolTokenAccount: false, + quoteResponse, + dynamicSlippage: { maxBps: 300 } + }), + method: 'POST' + }) + ).json() + + return VersionedTransaction.deserialize(Buffer.from(swapResponse.swapTransaction, 'base64')) +} diff --git a/apps/laboratory/src/components/Solana/SolanaTests.tsx b/apps/laboratory/src/components/Solana/SolanaTests.tsx index 0414d51e28..844a6e12c9 100644 --- a/apps/laboratory/src/components/Solana/SolanaTests.tsx +++ b/apps/laboratory/src/components/Solana/SolanaTests.tsx @@ -18,6 +18,7 @@ import { SolanaWriteContractTest } from './SolanaWriteContractTest' import { solana, solanaDevnet, solanaTestnet } from '../../utils/ChainsUtil' import { SolanaSignAndSendTransaction } from './SolanaSignAndSendTransactionTest' import { SolanaSignAllTransactionsTest } from './SolanaSignAllTransactionsTest' +import { SolanaSignJupiterSwapTest } from './SolanaSignJupiterSwapTest' export function SolanaTests() { const { isConnected, currentChain } = useWeb3ModalAccount() @@ -83,6 +84,19 @@ export function SolanaTests() { + + + + Sign Jupiter Swap Transaction + + + ℹ️ + + + + + + {(currentChain?.chainId === solanaTestnet.chainId || currentChain?.chainId === solanaDevnet.chainId) && ( } spacing="4"> diff --git a/packages/base/adapters/solana/web3js/providers/WalletConnectProvider.ts b/packages/base/adapters/solana/web3js/providers/WalletConnectProvider.ts index cc12dc8b78..60eb696962 100644 --- a/packages/base/adapters/solana/web3js/providers/WalletConnectProvider.ts +++ b/packages/base/adapters/solana/web3js/providers/WalletConnectProvider.ts @@ -12,7 +12,6 @@ import { Connection, PublicKey, Transaction, - TransactionMessage, VersionedTransaction, type SendOptions } from '@solana/web3.js' @@ -284,18 +283,9 @@ export class WalletConnectProvider extends ProviderEventEmitter implements Provi * This is a deprecated method that is used to support older versions of the * WalletConnect RPC API. It should be removed in the future */ - private getRawRPCParams(_transaction: AnyTransaction) { - let transaction = _transaction - + private getRawRPCParams(transaction: AnyTransaction) { if (isVersionedTransaction(transaction)) { - const instructions = TransactionMessage.decompile(transaction.message).instructions - const legacyMessage = new TransactionMessage({ - payerKey: new PublicKey(this.getAccount(true).publicKey), - recentBlockhash: transaction.message.recentBlockhash, - instructions: [...instructions] - }).compileToLegacyMessage() - - transaction = Transaction.populate(legacyMessage) + return {} } return { diff --git a/packages/base/adapters/solana/web3js/tests/WalletConnectProvider.test.ts b/packages/base/adapters/solana/web3js/tests/WalletConnectProvider.test.ts index 1400a9460b..79876bf81a 100644 --- a/packages/base/adapters/solana/web3js/tests/WalletConnectProvider.test.ts +++ b/packages/base/adapters/solana/web3js/tests/WalletConnectProvider.test.ts @@ -100,26 +100,6 @@ describe('WalletConnectProvider specific tests', () => { { method: 'solana_signTransaction', params: { - feePayer: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP', - instructions: [ - { - data: '3Bxs4NN8M2Yn4TLb', - keys: [ - { - isSigner: true, - isWritable: true, - pubkey: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP' - }, - { - isSigner: true, - isWritable: true, - pubkey: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP' - } - ], - programId: '11111111111111111111111111111111' - } - ], - recentBlockhash: 'EZySCpmzXRuUtM95P2JGv9SitqYph6Nv6HaYBK7a8PKJ', transaction: 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQABAhY+loQT/3nqQuE+Gw4GLiTIklVzYfSLz1r9WQ1FedoGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADJmlOhYicUv7MMXLfh/CK3nuxRET//L6xrgHRfdADXpQEBAgAADAIAAACAlpgAAAAAAAA=', pubkey: TestConstants.accounts[0].address @@ -301,26 +281,6 @@ describe('WalletConnectProvider specific tests', () => { { method: 'solana_signTransaction', params: { - feePayer: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP', - instructions: [ - { - data: '3Bxs4NN8M2Yn4TLb', - keys: [ - { - isSigner: true, - isWritable: true, - pubkey: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP' - }, - { - isSigner: true, - isWritable: true, - pubkey: '2VqKhjZ766ZN3uBtBpb7Ls3cN4HrocP1rzxzekhVEgoP' - } - ], - programId: '11111111111111111111111111111111' - } - ], - recentBlockhash: 'EZySCpmzXRuUtM95P2JGv9SitqYph6Nv6HaYBK7a8PKJ', transaction: 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQABAhY+loQT/3nqQuE+Gw4GLiTIklVzYfSLz1r9WQ1FedoGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADJmlOhYicUv7MMXLfh/CK3nuxRET//L6xrgHRfdADXpQEBAgAADAIAAACAlpgAAAAAAAA=', pubkey: TestConstants.accounts[0].address From 44b9bd170ea4a4bc48e4cce981db826893e4f4b2 Mon Sep 17 00:00:00 2001 From: Ignacio Santise <25931366+ignaciosantise@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:37:32 -0300 Subject: [PATCH 4/5] chore: changed android and ios links for react native sample apps (#2825) --- .../.well-known/apple-app-site-association | 8 ++++---- .../public/.well-known/assetlinks.json | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/apps/laboratory/public/.well-known/apple-app-site-association b/apps/laboratory/public/.well-known/apple-app-site-association index 2205860cfb..49054e29ac 100644 --- a/apps/laboratory/public/.well-known/apple-app-site-association +++ b/apps/laboratory/public/.well-known/apple-app-site-association @@ -23,25 +23,25 @@ { "appID": "W5R8AG9K22.com.walletconnect.web3modal.rnsample", "paths": [ - "/rn_appkit*" + "/rn_appkit" ] }, { "appID": "W5R8AG9K22.com.walletconnect.web3modal.rnsample.internal", "paths": [ - "/rn_appkit*" + "/rn_appkit_internal" ] }, { "appID": "W5R8AG9K22.com.walletconnect.web3wallet.rnsample", "paths": [ - "/rn_walletkit*" + "/rn_walletkit" ] }, { "appID": "W5R8AG9K22.com.walletconnect.web3wallet.rnsample.internal", "paths": [ - "/rn_walletkit*" + "/rn_walletkit_internal" ] }, { diff --git a/apps/laboratory/public/.well-known/assetlinks.json b/apps/laboratory/public/.well-known/assetlinks.json index 3a340eb37a..68d578c809 100644 --- a/apps/laboratory/public/.well-known/assetlinks.json +++ b/apps/laboratory/public/.well-known/assetlinks.json @@ -109,6 +109,16 @@ ] } }, + { + "relation": ["delegate_permission/common.handle_all_urls"], + "target": { + "namespace": "android_app", + "package_name": "com.walletconnect.web3wallet.rnsample.debug", + "sha256_cert_fingerprints": [ + "3D:87:31:1C:66:8B:A0:CB:F9:F1:D5:28:3B:DF:2E:4F:CB:19:EA:AB:B4:B7:CE:C4:D9:E1:E0:6D:32:FB:C6:56" + ] + } + }, { "relation": ["delegate_permission/common.handle_all_urls"], "target": { @@ -129,6 +139,16 @@ ] } }, + { + "relation": ["delegate_permission/common.handle_all_urls"], + "target": { + "namespace": "android_app", + "package_name": "com.walletconnect.web3modal.rnsample.debug", + "sha256_cert_fingerprints": [ + "3D:87:31:1C:66:8B:A0:CB:F9:F1:D5:28:3B:DF:2E:4F:CB:19:EA:AB:B4:B7:CE:C4:D9:E1:E0:6D:32:FB:C6:56" + ] + } + }, { "relation": ["delegate_permission/common.handle_all_urls"], "target": { From ff38a6a46a8f60a5fa46738afe6ad5ec16b24238 Mon Sep 17 00:00:00 2001 From: Ignacio Santise <25931366+ignaciosantise@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:34:47 -0300 Subject: [PATCH 5/5] chore: changed order of links (#2826) --- .../.well-known/apple-app-site-association | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/laboratory/public/.well-known/apple-app-site-association b/apps/laboratory/public/.well-known/apple-app-site-association index 49054e29ac..ef6f0f256c 100644 --- a/apps/laboratory/public/.well-known/apple-app-site-association +++ b/apps/laboratory/public/.well-known/apple-app-site-association @@ -20,12 +20,6 @@ "/web3modal_example*" ] }, - { - "appID": "W5R8AG9K22.com.walletconnect.web3modal.rnsample", - "paths": [ - "/rn_appkit" - ] - }, { "appID": "W5R8AG9K22.com.walletconnect.web3modal.rnsample.internal", "paths": [ @@ -33,9 +27,9 @@ ] }, { - "appID": "W5R8AG9K22.com.walletconnect.web3wallet.rnsample", + "appID": "W5R8AG9K22.com.walletconnect.web3modal.rnsample", "paths": [ - "/rn_walletkit" + "/rn_appkit" ] }, { @@ -44,6 +38,12 @@ "/rn_walletkit_internal" ] }, + { + "appID": "W5R8AG9K22.com.walletconnect.web3wallet.rnsample", + "paths": [ + "/rn_walletkit" + ] + }, { "appID": "W5R8AG9K22.com.walletconnect.flutterwallet", "paths": [