@relayprotocol/relay-svm-wallet-adapter 21.0.2 → 21.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,15 +36,26 @@ const adaptSolanaWallet = (walletAddress, chainId, connection, signAndSendTransa
36
36
  programId: new web3_js_1.PublicKey(i.programId),
37
37
  data: Buffer.from(i.data, 'hex')
38
38
  })) ?? [];
39
+ const addressLookupTableAddresses = stepItem?.data?.addressLookupTableAddresses ?? [];
40
+ const resolvedLookupTables = await Promise.all(addressLookupTableAddresses.map((address) => connection
41
+ .getAddressLookupTable(new web3_js_1.PublicKey(address))
42
+ .then((res) => res.value)));
43
+ const addressLookupTableAccounts = resolvedLookupTables.filter((table) => table !== null);
44
+ const missingLookupTables = addressLookupTableAddresses.filter((_, i) => !resolvedLookupTables[i]);
45
+ if (missingLookupTables.length > 0) {
46
+ client.log([
47
+ 'Skipping address lookup tables that could not be resolved on the current chain',
48
+ missingLookupTables,
49
+ _chainId
50
+ ], relay_sdk_1.LogLevel.Warn);
51
+ }
39
52
  const messageV0 = new web3_js_1.TransactionMessage({
40
53
  payerKey: new web3_js_1.PublicKey(payerKey ?? walletAddress),
41
54
  instructions,
42
55
  recentBlockhash: await connection
43
56
  .getLatestBlockhash()
44
57
  .then((b) => b.blockhash)
45
- }).compileToV0Message(await Promise.all(stepItem?.data?.addressLookupTableAddresses?.map(async (address) => await connection
46
- .getAddressLookupTable(new web3_js_1.PublicKey(address))
47
- .then((res) => res.value)) ?? []));
58
+ }).compileToV0Message(addressLookupTableAccounts);
48
59
  const transaction = new web3_js_1.VersionedTransaction(messageV0);
49
60
  const signature = await signAndSendTransaction(transaction, undefined, instructions, stepItem.data.instructions);
50
61
  const transactionSignature = signature?.signature;
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":";;;AAAA,6CASwB;AACxB,wDAKiC;AAEjC,MAAM,sBAAsB,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AAM,CAAC,CAAA;YAExC,MAAM,EAAE,SAAS,EAAE,oBAAoB,EAAE,GACvC,MAAM,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAA;YAElD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;gBACjD,SAAS,EAAE,SAAS;gBACpB,oBAAoB,EAAE,oBAAoB;gBAC1C,SAAS,EAAE,MAAM;aAClB,CAAC,CAAA;YAEF,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAA;YAC5D,CAAC;YAED,OAAO;gBACL,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE;gBACzC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;gBAChC,MAAM;aACP,CAAA;QACH,CAAC;QACD,WAAW,EAAE,CAAC,OAAe,EAAE,EAAE;YAC/B,QAAQ,GAAG,OAAO,CAAA;YAClB,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAA;QACpC,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AA5GY,QAAA,iBAAiB,qBA4G7B","sourcesContent":["import {\n AddressLookupTableAccount,\n Connection,\n PublicKey,\n TransactionInstruction,\n TransactionMessage,\n VersionedTransaction,\n type SendOptions,\n type TransactionSignature\n} from '@solana/web3.js'\nimport {\n LogLevel,\n getClient,\n type AdaptedWallet,\n type TransactionStepItem\n} from '@relayprotocol/relay-sdk'\n\nconst BASE58_SIGNATURE_REGEX = /^[1-9A-HJ-NP-Za-km-z]+$/\n\nconst assertBase58TransactionSignature = (\n signature: TransactionSignature | undefined\n) => {\n if (\n typeof signature !== 'string' ||\n signature.length === 0 ||\n !BASE58_SIGNATURE_REGEX.test(signature)\n ) {\n throw new Error('Invalid Solana signature: expected base58.')\n }\n}\n\n/**\n * Adapts a Solana wallet to work with the Relay SDK\n * @param walletAddress - The public key address of the Solana wallet\n * @param chainId - The chain ID for the Solana network (Relay uses 792703809)\n * @param connection - The Solana web3.js Connection instance for interacting with the network\n * @param signAndSendTransaction - Function to sign and send a transaction, returning a promise with a base58 encoded transaction signature\n * @param payerKey - Optional public key of the account that will pay for transaction fees (defaults to walletAddress)\n * @returns An AdaptedWallet object that conforms to the Relay SDK interface\n */\nexport const adaptSolanaWallet = (\n walletAddress: string,\n chainId: number,\n connection: Connection,\n signAndSendTransaction: (\n transaction: VersionedTransaction,\n options?: SendOptions,\n instructions?: TransactionInstruction[],\n rawInstructions?: TransactionStepItem['data']['instructions']\n ) => Promise<{\n signature: TransactionSignature\n }>,\n payerKey?: string\n): AdaptedWallet => {\n let _chainId = chainId\n const getChainId = async () => {\n return _chainId\n }\n\n return {\n vmType: 'svm',\n getChainId,\n address: async () => {\n return walletAddress\n },\n handleSignMessageStep: async () => {\n throw new Error('Message signing not implemented for Solana')\n },\n handleSendTransactionStep: async (_chainId, stepItem) => {\n const client = getClient()\n\n const instructions =\n stepItem?.data?.instructions?.map(\n (i) =>\n new TransactionInstruction({\n keys: i.keys.map((k) => ({\n isSigner: k.isSigner,\n isWritable: k.isWritable,\n pubkey: new PublicKey(k.pubkey)\n })),\n programId: new PublicKey(i.programId),\n data: Buffer.from(i.data, 'hex')\n })\n ) ?? []\n\n const messageV0 = new TransactionMessage({\n payerKey: new PublicKey(payerKey ?? walletAddress),\n instructions,\n recentBlockhash: await connection\n .getLatestBlockhash()\n .then((b) => b.blockhash)\n }).compileToV0Message(\n await Promise.all(\n stepItem?.data?.addressLookupTableAddresses?.map(\n async (address: string) =>\n await connection\n .getAddressLookupTable(new PublicKey(address))\n .then((res) => res.value as AddressLookupTableAccount)\n ) ?? []\n )\n )\n\n const transaction = new VersionedTransaction(messageV0)\n const signature = await signAndSendTransaction(\n transaction,\n undefined,\n instructions,\n stepItem.data.instructions\n )\n const transactionSignature = signature?.signature\n assertBase58TransactionSignature(transactionSignature)\n\n client.log(\n ['Transaction Signature obtained', signature],\n LogLevel.Verbose\n )\n\n return transactionSignature\n },\n handleConfirmTransactionStep: async (txHash) => {\n // Solana doesn't have a concept of replaced transactions\n // So we don't need to handle onReplaced and onCancelled\n assertBase58TransactionSignature(txHash)\n\n const { blockhash, lastValidBlockHeight } =\n await connection.getLatestBlockhash('confirmed')\n\n const result = await connection.confirmTransaction({\n blockhash: blockhash,\n lastValidBlockHeight: lastValidBlockHeight,\n signature: txHash\n })\n\n if (result.value.err) {\n throw new Error(`Transaction failed: ${result.value.err}`)\n }\n\n return {\n blockHash: result.context.slot.toString(),\n blockNumber: result.context.slot,\n txHash\n }\n },\n switchChain: (chainId: number) => {\n _chainId = chainId\n return new Promise((res) => res())\n }\n }\n}\n"]}
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":";;;AAAA,6CASwB;AACxB,wDAKiC;AAEjC,MAAM,sBAAsB,GAAG,yBAAyB,CAAA;AAExD,MAAM,gCAAgC,GAAG,CACvC,SAA2C,EAC3C,EAAE;IACF,IACE,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,CAAC,MAAM,KAAK,CAAC;QACtB,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,EACvC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;IAC/D,CAAC;AACH,CAAC,CAAA;AAWM,MAAM,iBAAiB,GAAG,CAC/B,aAAqB,EACrB,OAAe,EACf,UAAsB,EACtB,sBAOE,EACF,QAAiB,EACF,EAAE;IACjB,IAAI,QAAQ,GAAG,OAAO,CAAA;IACtB,MAAM,UAAU,GAAG,KAAK,IAAI,EAAE;QAC5B,OAAO,QAAQ,CAAA;IACjB,CAAC,CAAA;IAED,OAAO;QACL,MAAM,EAAE,KAAK;QACb,UAAU;QACV,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,OAA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AAkB,CAAC,WAAW,CAAC,CAAA;YAElD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;gBACjD,SAAS,EAAE,SAAS;gBACpB,oBAAoB,EAAE,oBAAoB;gBAC1C,SAAS,EAAE,MAAM;aAClB,CAAC,CAAA;YAEF,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAA;YAC5D,CAAC;YAED,OAAO;gBACL,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE;gBACzC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;gBAChC,MAAM;aACP,CAAA;QACH,CAAC;QACD,WAAW,EAAE,CAAC,OAAe,EAAE,EAAE;YAC/B,QAAQ,GAAG,OAAO,CAAA;YAClB,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAA;QACpC,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAtIY,QAAA,iBAAiB,qBAsI7B","sourcesContent":["import {\n AddressLookupTableAccount,\n Connection,\n PublicKey,\n TransactionInstruction,\n TransactionMessage,\n VersionedTransaction,\n type SendOptions,\n type TransactionSignature\n} from '@solana/web3.js'\nimport {\n LogLevel,\n getClient,\n type AdaptedWallet,\n type TransactionStepItem\n} from '@relayprotocol/relay-sdk'\n\nconst BASE58_SIGNATURE_REGEX = /^[1-9A-HJ-NP-Za-km-z]+$/\n\nconst assertBase58TransactionSignature = (\n signature: TransactionSignature | undefined\n) => {\n if (\n typeof signature !== 'string' ||\n signature.length === 0 ||\n !BASE58_SIGNATURE_REGEX.test(signature)\n ) {\n throw new Error('Invalid Solana signature: expected base58.')\n }\n}\n\n/**\n * Adapts a Solana wallet to work with the Relay SDK\n * @param walletAddress - The public key address of the Solana wallet\n * @param chainId - The chain ID for the Solana network (Relay uses 792703809)\n * @param connection - The Solana web3.js Connection instance for interacting with the network\n * @param signAndSendTransaction - Function to sign and send a transaction, returning a promise with a base58 encoded transaction signature\n * @param payerKey - Optional public key of the account that will pay for transaction fees (defaults to walletAddress)\n * @returns An AdaptedWallet object that conforms to the Relay SDK interface\n */\nexport const adaptSolanaWallet = (\n walletAddress: string,\n chainId: number,\n connection: Connection,\n signAndSendTransaction: (\n transaction: VersionedTransaction,\n options?: SendOptions,\n instructions?: TransactionInstruction[],\n rawInstructions?: TransactionStepItem['data']['instructions']\n ) => Promise<{\n signature: TransactionSignature\n }>,\n payerKey?: string\n): AdaptedWallet => {\n let _chainId = chainId\n const getChainId = async () => {\n return _chainId\n }\n\n return {\n vmType: 'svm',\n getChainId,\n address: async () => {\n return walletAddress\n },\n handleSignMessageStep: async () => {\n throw new Error('Message signing not implemented for Solana')\n },\n handleSendTransactionStep: async (_chainId, stepItem) => {\n const client = getClient()\n\n const instructions =\n stepItem?.data?.instructions?.map(\n (i) =>\n new TransactionInstruction({\n keys: i.keys.map((k) => ({\n isSigner: k.isSigner,\n isWritable: k.isWritable,\n pubkey: new PublicKey(k.pubkey)\n })),\n programId: new PublicKey(i.programId),\n data: Buffer.from(i.data, 'hex')\n })\n ) ?? []\n\n const addressLookupTableAddresses =\n stepItem?.data?.addressLookupTableAddresses ?? []\n\n const resolvedLookupTables = await Promise.all(\n addressLookupTableAddresses.map((address: string) =>\n connection\n .getAddressLookupTable(new PublicKey(address))\n .then((res) => res.value)\n )\n )\n\n // A lookup table address returned by the API may not exist on the\n // connected chain (e.g. a Solana mainnet table referenced in an Eclipse\n // swap). Passing null into compileToV0Message crashes in\n // extractTableLookup before the wallet ever prompts, so skip any table\n // that can't be resolved and compile without it — lookup tables only\n // compress the message, the transaction is still valid without them.\n const addressLookupTableAccounts = resolvedLookupTables.filter(\n (table): table is AddressLookupTableAccount => table !== null\n )\n\n const missingLookupTables = addressLookupTableAddresses.filter(\n (_, i) => !resolvedLookupTables[i]\n )\n if (missingLookupTables.length > 0) {\n client.log(\n [\n 'Skipping address lookup tables that could not be resolved on the current chain',\n missingLookupTables,\n _chainId\n ],\n LogLevel.Warn\n )\n }\n\n const messageV0 = new TransactionMessage({\n payerKey: new PublicKey(payerKey ?? walletAddress),\n instructions,\n recentBlockhash: await connection\n .getLatestBlockhash()\n .then((b) => b.blockhash)\n }).compileToV0Message(addressLookupTableAccounts)\n\n const transaction = new VersionedTransaction(messageV0)\n const signature = await signAndSendTransaction(\n transaction,\n undefined,\n instructions,\n stepItem.data.instructions\n )\n const transactionSignature = signature?.signature\n assertBase58TransactionSignature(transactionSignature)\n\n client.log(\n ['Transaction Signature obtained', signature],\n LogLevel.Verbose\n )\n\n return transactionSignature\n },\n handleConfirmTransactionStep: async (txHash) => {\n // Solana doesn't have a concept of replaced transactions\n // So we don't need to handle onReplaced and onCancelled\n assertBase58TransactionSignature(txHash)\n\n const { blockhash, lastValidBlockHeight } =\n await connection.getLatestBlockhash('confirmed')\n\n const result = await connection.confirmTransaction({\n blockhash: blockhash,\n lastValidBlockHeight: lastValidBlockHeight,\n signature: txHash\n })\n\n if (result.value.err) {\n throw new Error(`Transaction failed: ${result.value.err}`)\n }\n\n return {\n blockHash: result.context.slot.toString(),\n blockNumber: result.context.slot,\n txHash\n }\n },\n switchChain: (chainId: number) => {\n _chainId = chainId\n return new Promise((res) => res())\n }\n }\n}\n"]}