@dynamic-labs-sdk/evm 1.2.0 → 1.3.0
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.
- package/dist/{addEIP6963Extension-BrxoI3fh.cjs → addEIP6963Extension-6q4uKJ2S.cjs} +3 -3
- package/dist/{addEIP6963Extension-BrxoI3fh.cjs.map → addEIP6963Extension-6q4uKJ2S.cjs.map} +1 -1
- package/dist/{addEIP6963Extension-CTfW3lKP.esm.js → addEIP6963Extension-CSo4PZ83.esm.js} +3 -3
- package/dist/{addEIP6963Extension-CTfW3lKP.esm.js.map → addEIP6963Extension-CSo4PZ83.esm.js.map} +1 -1
- package/dist/{addWaasEvmExtension-DnfMMvBS.esm.js → addWaasEvmExtension-DTmPsJ-R.esm.js} +3 -3
- package/dist/{addWaasEvmExtension-DnfMMvBS.esm.js.map → addWaasEvmExtension-DTmPsJ-R.esm.js.map} +1 -1
- package/dist/{addWaasEvmExtension-CTYf_o8f.cjs → addWaasEvmExtension-FyQx6Qlo.cjs} +3 -3
- package/dist/{addWaasEvmExtension-CTYf_o8f.cjs.map → addWaasEvmExtension-FyQx6Qlo.cjs.map} +1 -1
- package/dist/baseAccount/createBaseAccountEvmWalletProvider/createBaseAccountEvmWalletProvider.d.ts.map +1 -1
- package/dist/baseAccount.cjs +4 -26
- package/dist/baseAccount.cjs.map +1 -1
- package/dist/baseAccount.esm.js +5 -27
- package/dist/baseAccount.esm.js.map +1 -1
- package/dist/baseAccount.native.esm.js +3 -25
- package/dist/baseAccount.native.esm.js.map +1 -1
- package/dist/{createWalletClientForWalletAccount-DBAhi3L-.cjs → createWalletClientForWalletAccount-CKBR4V6M.cjs} +2 -2
- package/dist/{createWalletClientForWalletAccount-DBAhi3L-.cjs.map → createWalletClientForWalletAccount-CKBR4V6M.cjs.map} +1 -1
- package/dist/{createWalletClientForWalletAccount-CMD5kLVs.esm.js → createWalletClientForWalletAccount-DRs8Ja_I.esm.js} +2 -2
- package/dist/{createWalletClientForWalletAccount-CMD5kLVs.esm.js.map → createWalletClientForWalletAccount-DRs8Ja_I.esm.js.map} +1 -1
- package/dist/{createWalletProviderFromEIP1193Provider-B_XDSRZ9.cjs → createWalletProviderFromEIP1193Provider-D-6PlGdy.cjs} +2 -2
- package/dist/{createWalletProviderFromEIP1193Provider-B_XDSRZ9.cjs.map → createWalletProviderFromEIP1193Provider-D-6PlGdy.cjs.map} +1 -1
- package/dist/{createWalletProviderFromEIP1193Provider-ChSmbI-a.esm.js → createWalletProviderFromEIP1193Provider-p3Aa46Bi.esm.js} +2 -2
- package/dist/{createWalletProviderFromEIP1193Provider-ChSmbI-a.esm.js.map → createWalletProviderFromEIP1193Provider-p3Aa46Bi.esm.js.map} +1 -1
- package/dist/eip6963.cjs +4 -4
- package/dist/eip6963.esm.js +4 -4
- package/dist/eip6963.native.esm.js +1 -1
- package/dist/{evmTransferAmount-C4vCjuss.esm.js → evmTransferAmount-BJswh1ID.esm.js} +2 -2
- package/dist/{evmTransferAmount-C4vCjuss.esm.js.map → evmTransferAmount-BJswh1ID.esm.js.map} +1 -1
- package/dist/{evmTransferAmount-DJCA1p9e.cjs → evmTransferAmount-CkF4KIge.cjs} +2 -2
- package/dist/{evmTransferAmount-DJCA1p9e.cjs.map → evmTransferAmount-CkF4KIge.cjs.map} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.esm.js +5 -5
- package/dist/index.native.esm.js +1 -1
- package/dist/metamask/createMetaMaskEvmWalletProvider/createMetaMaskEvmWalletProvider.d.ts +19 -0
- package/dist/metamask/createMetaMaskEvmWalletProvider/createMetaMaskEvmWalletProvider.d.ts.map +1 -0
- package/dist/metamask/createMetaMaskEvmWalletProvider/index.d.ts +3 -0
- package/dist/metamask/createMetaMaskEvmWalletProvider/index.d.ts.map +1 -0
- package/dist/metamask/metamask.types.d.ts +42 -0
- package/dist/metamask/metamask.types.d.ts.map +1 -0
- package/dist/metamask/utils/clearMetaMaskEvmSessionStorage/clearMetaMaskEvmSessionStorage.d.ts +34 -0
- package/dist/metamask/utils/clearMetaMaskEvmSessionStorage/clearMetaMaskEvmSessionStorage.d.ts.map +1 -0
- package/dist/metamask/utils/clearMetaMaskEvmSessionStorage/index.d.ts +2 -0
- package/dist/metamask/utils/clearMetaMaskEvmSessionStorage/index.d.ts.map +1 -0
- package/dist/metamask/utils/createMetaMaskEvmController/createMetaMaskEvmController.d.ts +36 -0
- package/dist/metamask/utils/createMetaMaskEvmController/createMetaMaskEvmController.d.ts.map +1 -0
- package/dist/metamask/utils/createMetaMaskEvmController/index.d.ts +2 -0
- package/dist/metamask/utils/createMetaMaskEvmController/index.d.ts.map +1 -0
- package/dist/metamask/utils/getOrCreateMetaMaskEvmController/getOrCreateMetaMaskEvmController.d.ts +27 -0
- package/dist/metamask/utils/getOrCreateMetaMaskEvmController/getOrCreateMetaMaskEvmController.d.ts.map +1 -0
- package/dist/metamask/utils/getOrCreateMetaMaskEvmController/index.d.ts +2 -0
- package/dist/metamask/utils/getOrCreateMetaMaskEvmController/index.d.ts.map +1 -0
- package/dist/metamask/utils/getSupportedNetworks/getSupportedNetworks.d.ts +6 -0
- package/dist/metamask/utils/getSupportedNetworks/getSupportedNetworks.d.ts.map +1 -0
- package/dist/metamask/utils/getSupportedNetworks/index.d.ts +2 -0
- package/dist/metamask/utils/getSupportedNetworks/index.d.ts.map +1 -0
- package/dist/metamask/utils/isConnectShapedResponse/index.d.ts +3 -0
- package/dist/metamask/utils/isConnectShapedResponse/index.d.ts.map +1 -0
- package/dist/metamask/utils/isConnectShapedResponse/isConnectShapedResponse.d.ts +21 -0
- package/dist/metamask/utils/isConnectShapedResponse/isConnectShapedResponse.d.ts.map +1 -0
- package/dist/metamask/utils/subscribeMetaMaskEvmFacadeListener/index.d.ts +3 -0
- package/dist/metamask/utils/subscribeMetaMaskEvmFacadeListener/index.d.ts.map +1 -0
- package/dist/metamask/utils/subscribeMetaMaskEvmFacadeListener/subscribeMetaMaskEvmFacadeListener.d.ts +40 -0
- package/dist/metamask/utils/subscribeMetaMaskEvmFacadeListener/subscribeMetaMaskEvmFacadeListener.d.ts.map +1 -0
- package/dist/{package-AXj9tSuC.native.esm.js → package-DGj3wg-e.native.esm.js} +2 -2
- package/dist/package-DGj3wg-e.native.esm.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/getEvmNetworksData/getEvmNetworksData.d.ts +13 -0
- package/dist/utils/getEvmNetworksData/getEvmNetworksData.d.ts.map +1 -0
- package/dist/utils/getEvmNetworksData/index.d.ts +2 -0
- package/dist/utils/getEvmNetworksData/index.d.ts.map +1 -0
- package/dist/viem.cjs +1 -1
- package/dist/viem.esm.js +1 -1
- package/dist/viem.native.esm.js +1 -1
- package/dist/waas.cjs +3 -3
- package/dist/waas.esm.js +3 -3
- package/dist/waas.native.esm.js +1 -1
- package/dist/walletConnect/connectAndVerifyWithWalletConnectEvm/connectAndVerifyWithWalletConnectEvm.d.ts +1 -1
- package/dist/walletConnect/connectAndVerifyWithWalletConnectEvm/connectAndVerifyWithWalletConnectEvm.d.ts.map +1 -1
- package/dist/walletConnect.cjs +5 -5
- package/dist/walletConnect.cjs.map +1 -1
- package/dist/walletConnect.esm.js +6 -6
- package/dist/walletConnect.esm.js.map +1 -1
- package/dist/walletConnect.native.esm.js +5 -5
- package/dist/walletConnect.native.esm.js.map +1 -1
- package/dist/windowInjected.cjs +3 -3
- package/dist/windowInjected.esm.js +3 -3
- package/dist/windowInjected.native.esm.js +1 -1
- package/package.json +6 -5
- package/dist/baseAccount/utils/getBaseAccountAppMetadata/getBaseAccountAppMetadata.d.ts +0 -19
- package/dist/baseAccount/utils/getBaseAccountAppMetadata/getBaseAccountAppMetadata.d.ts.map +0 -1
- package/dist/package-AXj9tSuC.native.esm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evmTransferAmount-DJCA1p9e.cjs","names":["BaseError","InvalidParamError","createPublicClientFromNetworkData","createWalletClientForWalletAccount","erc20Abi","createPublicClientFromNetworkData","erc20Abi","createPublicClientFromNetworkData","InvalidParamError","createWalletClientForWalletAccount","gasParams: Record<string, bigint>","InvalidParamError","createPublicClientFromNetworkData","createWalletClientForWalletAccount","erc20Abi"],"sources":["../src/errors/RpcError.ts","../src/utils/fetchEvmBalance/fetchEvmBalance.ts","../src/utils/createEvmNetworkProvider/createEvmNetworkProvider.ts","../src/registerEvmNetworkProviderBuilder/registerEvmNetworkProviderBuilder.ts","../src/utils/isEvmWalletAccount/isEvmWalletAccount.ts","../src/utils/evmConfirmTransaction/evmConfirmTransaction.ts","../src/utils/approveErc20/approveErc20.ts","../src/utils/getErc20Allowance/getErc20Allowance.ts","../src/utils/approveErc20IfRequiredAndWaitReceipt/approveErc20IfRequiredAndWaitReceipt.ts","../src/utils/evmExecuteSwapTransaction/evmExecuteSwapTransaction.ts","../src/utils/evmTransferAmount/evmTransferAmount.ts"],"sourcesContent":["import { BaseError, type BaseErrorParameters } from '@dynamic-labs-sdk/client';\n\nexport type RpcErrorParameters = Pick<BaseErrorParameters, 'shortMessage'> &\n Partial<Omit<BaseErrorParameters, 'shortMessage'>>;\n\nexport class RpcError extends BaseError {\n constructor(args: RpcErrorParameters) {\n super({\n cause: args.cause ?? null,\n code: args.code ?? 'rpc_error',\n details: args.details,\n docsUrl: args.docsUrl ?? null,\n metaMessages: args.metaMessages,\n name: args.name ?? 'RpcError',\n shortMessage: args.shortMessage,\n });\n }\n}\n","import type { DynamicClient, NetworkData } from '@dynamic-labs-sdk/client';\nimport { getCore } from '@dynamic-labs-sdk/client/core';\n\nimport { RpcError } from '../../errors/RpcError';\n\ntype FetchEvmBalanceParams = {\n address: string;\n networkData: NetworkData;\n};\n\n/** @not-instrumented */\nexport const fetchEvmBalance = async (\n { address, networkData }: FetchEvmBalanceParams,\n client: DynamicClient\n): Promise<string | null> => {\n const rpcUrl = networkData.rpcUrls.http[0];\n const core = getCore(client);\n\n try {\n // Perform a POST request to the RPC URL with the JSON-RPC payload\n const response = await core.fetch(rpcUrl, {\n /**\n * The JSON-RPC method 'eth_getBalance' takes the address and a block tag ('latest' is the most recent)\n * See EIP-1474: https://eips.ethereum.org/EIPS/eip-1474\n * See eth_getBalance spec: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance\n */\n body: JSON.stringify({\n id: Math.floor(Date.now() + Math.random() * 1000),\n jsonrpc: '2.0',\n method: 'eth_getBalance',\n params: [address, 'latest'],\n }),\n\n headers: {\n 'Content-Type': 'application/json',\n },\n\n method: 'POST',\n });\n\n // Check if the network response was successful\n if (!response.ok) {\n throw new RpcError({\n code: 'http_error',\n shortMessage: `HTTP error! status: ${response.status}`,\n });\n }\n\n const data = await response.json();\n\n // Check for a JSON-RPC error in the response\n if (data.error) {\n throw new RpcError({\n cause: data.error instanceof Error ? data.error : undefined,\n code: 'json_rpc_error',\n shortMessage: `RPC Error: ${data.error.message}`,\n });\n }\n\n // The result is a hexadecimal string representing the balance in Wei\n const balanceWeiHex = data.result;\n\n // Convert the hexadecimal string to a BigInt\n const balanceWei = BigInt(balanceWeiHex);\n\n // Convert the balance from Wei to Ether (1 Ether = 10^18 Wei)\n // We use a BigInt for the conversion to maintain precision with large numbers\n const oneEther = BigInt(1e18);\n\n // Perform the division and return the result as a number\n // Note: This conversion can lose precision for very small amounts, but is generally fine for display purposes.\n const balanceEther = Number(balanceWei) / Number(oneEther);\n\n return balanceEther.toString();\n } catch (error) {\n if (error instanceof Error) {\n throw new RpcError({\n cause: error,\n code: 'rpc_error',\n shortMessage: `Failed to fetch balance for address ${address}`,\n });\n }\n\n throw error;\n }\n};\n","import type { DynamicClient, NetworkData } from '@dynamic-labs-sdk/client';\nimport { createBaseNetworkProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { EvmNetworkProvider } from '../../EvmNetworkProvider';\nimport { fetchEvmBalance } from '../fetchEvmBalance';\n\n/** @not-instrumented */\nexport const createEvmNetworkProvider = (\n networkData: NetworkData,\n client: DynamicClient\n): EvmNetworkProvider => ({\n ...createBaseNetworkProvider('EVM', networkData),\n\n getBalance: async ({ address }) => ({\n balance: await fetchEvmBalance(\n {\n address,\n networkData,\n },\n client\n ),\n }),\n});\n","import { type DynamicClient } from '@dynamic-labs-sdk/client';\nimport { getNetworkProviderBuilderRegistry } from '@dynamic-labs-sdk/client/core';\n\nimport { createEvmNetworkProvider } from '../utils/createEvmNetworkProvider';\n\n/** @not-instrumented */\nexport const registerEvmNetworkProviderBuilder = (\n client: DynamicClient\n): void => {\n const networkProviderBuilderRegistry =\n getNetworkProviderBuilderRegistry(client);\n\n /**\n * If the Ethereum network provider builder is already registered, return.\n */\n if (networkProviderBuilderRegistry.get().get('EVM')) {\n return;\n }\n\n networkProviderBuilderRegistry.register({\n builder: (networkData) => createEvmNetworkProvider(networkData, client),\n chain: 'EVM',\n });\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { EvmWalletAccount } from '../../EvmWalletAccount.types';\n\n/**\n * Type guard function to check if a wallet account is an EVM wallet account.\n *\n * @param walletAccount - The wallet account to check.\n * @returns True if the wallet account is an EVM wallet account, false otherwise.\n * @not-instrumented\n */\nexport const isEvmWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is EvmWalletAccount => walletAccount.chain === 'EVM';\n","import {\n type DynamicClient,\n InvalidParamError,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport type { ConfirmTransactionParams } from '@dynamic-labs-sdk/client/core';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\n\nimport { createPublicClientFromNetworkData } from '../../viem/createPublicClientFromNetworkData';\nimport { isEvmWalletAccount } from '../isEvmWalletAccount';\n\n/**\n * Waits for an EVM transaction to be confirmed on-chain.\n *\n * @param params.transactionHash - The transaction hash to wait for.\n * @param params.walletAccount - The EVM wallet account used to resolve the active network.\n * @param client - The Dynamic client instance.\n * @not-instrumented\n */\nexport const evmConfirmTransaction = async (\n { transactionHash, walletAccount }: ConfirmTransactionParams,\n client: DynamicClient\n): Promise<void> => {\n if (!isEvmWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not an EVM wallet account');\n }\n\n const { networkData } = await getActiveNetworkData({ walletAccount }, client);\n\n assertDefined(\n networkData,\n `No network data found for wallet account ${walletAccount.address}`\n );\n\n const publicClient = createPublicClientFromNetworkData({ networkData });\n\n await publicClient.waitForTransactionReceipt({\n hash: transactionHash as `0x${string}`,\n });\n};\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { encodeFunctionData, erc20Abi } from 'viem';\n\nimport type { EvmWalletAccount } from '../../EvmWalletAccount.types';\nimport { createWalletClientForWalletAccount } from '../../viem/createWalletClientForWalletAccount';\n\ntype ApproveErc20Params = {\n amount: bigint;\n spenderAddress: string;\n tokenAddress: string;\n walletAccount: EvmWalletAccount;\n};\n\n/**\n * Sends an ERC-20 `approve` transaction, granting a spender an allowance\n * to transfer tokens on behalf of the wallet account.\n *\n * Encodes the `approve(spender, amount)` call using viem's `encodeFunctionData`\n * and sends it through the wallet account's viem wallet client.\n *\n * @param params.amount - The amount to approve in the token's smallest unit.\n * @param params.spenderAddress - The address being granted the allowance.\n * @param params.tokenAddress - The ERC-20 token contract address.\n * @param params.walletAccount - The EVM wallet account sending the approval.\n * @param client - The Dynamic client instance.\n * @returns The approval transaction hash.\n * @not-instrumented\n */\nexport const approveErc20 = async (\n { amount, spenderAddress, tokenAddress, walletAccount }: ApproveErc20Params,\n client: DynamicClient\n): Promise<{ transactionHash: string }> => {\n const walletClient = await createWalletClientForWalletAccount(\n { walletAccount },\n client\n );\n\n const data = encodeFunctionData({\n abi: erc20Abi,\n args: [spenderAddress as `0x${string}`, amount],\n functionName: 'approve',\n });\n\n const hash = await walletClient.sendTransaction({\n data,\n to: tokenAddress as `0x${string}`,\n });\n\n return { transactionHash: hash };\n};\n","import {\n type DynamicClient,\n type NetworkData,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport { erc20Abi } from 'viem';\n\nimport type { EvmWalletAccount } from '../../EvmWalletAccount.types';\nimport { createPublicClientFromNetworkData } from '../../viem/createPublicClientFromNetworkData';\n\ntype GetErc20AllowanceParams = {\n networkData?: NetworkData;\n ownerAddress: string;\n spenderAddress: string;\n tokenAddress: string;\n walletAccount: EvmWalletAccount;\n};\n\n/**\n * Reads the current ERC-20 token allowance granted by an owner to a spender.\n *\n * Uses a viem public client derived from the wallet account's active network\n * to call the `allowance(owner, spender)` method on the token contract.\n *\n * @param params.tokenAddress - The ERC-20 token contract address.\n * @param params.ownerAddress - The address that granted the allowance.\n * @param params.spenderAddress - The address allowed to spend the tokens.\n * @param params.walletAccount - The EVM wallet account used to resolve the active network.\n * @param [params.networkData] - The network data to use for the public client. If not provided, the active network data will be used.\n * @param client - The Dynamic client instance.\n * @returns The current allowance as a bigint in the token's smallest unit.\n * @not-instrumented\n */\nexport const getErc20Allowance = async (\n {\n networkData,\n ownerAddress,\n spenderAddress,\n tokenAddress,\n walletAccount,\n }: GetErc20AllowanceParams,\n client: DynamicClient\n): Promise<bigint> => {\n if (!networkData) {\n const activeNetworkData = await getActiveNetworkData(\n { walletAccount },\n client\n );\n networkData = activeNetworkData.networkData;\n }\n\n assertDefined(\n networkData,\n `No network data found for wallet account ${walletAccount.address}`\n );\n\n const publicClient = createPublicClientFromNetworkData({ networkData });\n\n return publicClient.readContract({\n abi: erc20Abi,\n address: tokenAddress as `0x${string}`,\n args: [ownerAddress as `0x${string}`, spenderAddress as `0x${string}`],\n functionName: 'allowance',\n });\n};\n","import {\n type DynamicClient,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport type { TransactionReceipt } from 'viem';\n\nimport type { EvmWalletAccount } from '../../EvmWalletAccount.types';\nimport { createPublicClientFromNetworkData } from '../../viem/createPublicClientFromNetworkData';\nimport { approveErc20 } from '../approveErc20';\nimport { getErc20Allowance } from '../getErc20Allowance';\n\ntype ApproveErc20IfRequiredAndWaitReceiptParams = {\n amount: string;\n spenderAddress: string;\n tokenAddress: string;\n walletAccount: EvmWalletAccount;\n};\n\n/**\n * Approves an ERC-20 token if the current allowance is insufficient and waits for the transaction receipt.\n *\n * @param params.amount - The amount of tokens to approve.\n * @param params.ownerAddress - The address that granted the allowance.\n * @param params.spenderAddress - The address allowed to spend the tokens.\n * @param params.tokenAddress - The ERC-20 token contract address.\n * @param params.walletAccount - The EVM wallet account used to resolve the active network.\n * @param client - The Dynamic client instance.\n * @returns The transaction receipt if an approval was sent, otherwise undefined.\n * @not-instrumented\n */\nexport const approveErc20IfRequiredAndWaitReceipt = async (\n {\n amount,\n spenderAddress,\n tokenAddress,\n walletAccount,\n }: ApproveErc20IfRequiredAndWaitReceiptParams,\n client: DynamicClient\n): Promise<{ receipt: TransactionReceipt } | undefined> => {\n const { networkData } = await getActiveNetworkData({ walletAccount }, client);\n\n assertDefined(\n networkData,\n `No network data found for wallet account ${walletAccount.address}`\n );\n\n const currentAllowance = await getErc20Allowance(\n {\n networkData,\n ownerAddress: walletAccount.address,\n spenderAddress,\n tokenAddress,\n walletAccount,\n },\n client\n );\n\n const approvalAmount = BigInt(amount);\n\n if (currentAllowance >= approvalAmount) {\n return undefined;\n }\n\n const result = await approveErc20(\n {\n amount: approvalAmount,\n spenderAddress,\n tokenAddress,\n walletAccount,\n },\n client\n );\n const approvalTransactionHash = result.transactionHash;\n\n const publicClient = createPublicClientFromNetworkData({ networkData });\n\n const receipt = await publicClient.waitForTransactionReceipt({\n hash: approvalTransactionHash as `0x${string}`,\n });\n\n return { receipt };\n};\n","import {\n type DynamicClient,\n InvalidParamError,\n} from '@dynamic-labs-sdk/client';\nimport type {\n ExecuteSwapTransactionParams,\n ExecuteSwapTransactionResult,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { createWalletClientForWalletAccount } from '../../viem/createWalletClientForWalletAccount';\nimport { approveErc20IfRequiredAndWaitReceipt } from '../approveErc20IfRequiredAndWaitReceipt';\nimport { isEvmWalletAccount } from '../isEvmWalletAccount';\n\n/**\n * Executes an EVM checkout transaction by handling optional ERC-20 approval\n * and sending the main swap transaction on-chain.\n *\n * 1. Validates that the wallet account is an EVM wallet account\n * 2. If the signing payload includes an `evmApproval`, checks the current\n * ERC-20 allowance and sends an approve transaction when insufficient\n * 3. Sends the main transaction using the viem wallet client\n *\n * @param params.signingPayload - The chain-aware signing payload containing `evmTransaction` and optional `evmApproval`.\n * @param params.walletAccount - The wallet account used to sign and send transactions.\n * @param params.onStepChange - Optional callback invoked with `'approval'` or `'transaction'` as each step begins.\n * @param client - The Dynamic client instance.\n * @returns The main transaction hash and, if an approval was sent, the approval transaction hash.\n * @not-instrumented\n */\nexport const evmExecuteSwapTransaction = async (\n { onStepChange, signingPayload, walletAccount }: ExecuteSwapTransactionParams,\n client: DynamicClient\n): Promise<ExecuteSwapTransactionResult> => {\n if (!isEvmWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not an EVM wallet account');\n }\n\n const { evmTransaction, evmApproval } = signingPayload;\n\n if (!evmTransaction) {\n throw new InvalidParamError(\n 'Signing payload is missing EVM transaction data'\n );\n }\n\n if (evmApproval) {\n onStepChange?.('approval');\n\n await approveErc20IfRequiredAndWaitReceipt(\n {\n amount: evmApproval.amount,\n spenderAddress: evmApproval.spenderAddress,\n tokenAddress: evmApproval.tokenAddress,\n walletAccount,\n },\n client\n );\n }\n\n onStepChange?.('transaction');\n\n const walletClient = await createWalletClientForWalletAccount(\n { walletAccount },\n client\n );\n\n // sendTransaction expects gasPrice or maxFeePerGas and maxPriorityFeePerGas\n let gasParams: Record<string, bigint> = {};\n if (evmTransaction.maxFeePerGas && evmTransaction.maxPriorityFeePerGas) {\n gasParams = {\n maxFeePerGas: BigInt(evmTransaction.maxFeePerGas),\n maxPriorityFeePerGas: BigInt(evmTransaction.maxPriorityFeePerGas),\n };\n } else {\n gasParams = {\n ...(evmTransaction.gasPrice && {\n gasPrice: BigInt(evmTransaction.gasPrice),\n }),\n };\n }\n\n const transactionHash = await walletClient.sendTransaction({\n data: evmTransaction.data as `0x${string}`,\n to: evmTransaction.to as `0x${string}`,\n value: evmTransaction.value ? BigInt(evmTransaction.value) : 0n,\n ...(evmTransaction.gasLimit && { gas: BigInt(evmTransaction.gasLimit) }),\n ...gasParams,\n ...(evmTransaction.nonce && { nonce: evmTransaction.nonce }),\n });\n\n return { transactionHash };\n};\n","import {\n type DynamicClient,\n InvalidParamError,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport type { TransferAmountParams } from '@dynamic-labs-sdk/client/core';\nimport { encodeFunctionData, erc20Abi, parseEther, parseUnits } from 'viem';\n\nimport { createPublicClientFromNetworkData } from '../../viem/createPublicClientFromNetworkData';\nimport { createWalletClientForWalletAccount } from '../../viem/createWalletClientForWalletAccount';\nimport { isEvmWalletAccount } from '../isEvmWalletAccount';\n\nconst DEFAULT_DECIMALS = 18;\n\n/** @not-instrumented */\nexport const evmTransferAmount = async (\n { amount, recipient, token, walletAccount }: TransferAmountParams,\n client: DynamicClient\n): Promise<{ transactionHash: string }> => {\n if (!isEvmWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not an EVM wallet account');\n }\n\n const { networkData } = await getActiveNetworkData({ walletAccount }, client);\n\n assertDefined(\n networkData,\n `No network data found for wallet account ${walletAccount.address}`\n );\n\n const publicClient = createPublicClientFromNetworkData({ networkData });\n const nonce = await publicClient.getTransactionCount({\n address: walletAccount.address as `0x${string}`,\n });\n\n const walletClient = await createWalletClientForWalletAccount(\n { walletAccount },\n client\n );\n\n // non-native token transfers\n if (token) {\n const decimals = token.decimals ?? DEFAULT_DECIMALS;\n\n const data = encodeFunctionData({\n abi: erc20Abi,\n args: [recipient as `0x${string}`, parseUnits(amount, decimals)],\n functionName: 'transfer',\n });\n\n const hash = await walletClient.sendTransaction({\n data,\n nonce,\n to: token.address as `0x${string}`,\n });\n\n return { transactionHash: hash };\n }\n\n // native token transfers\n const hash = await walletClient.sendTransaction({\n nonce,\n to: recipient as `0x${string}`,\n value: parseEther(amount),\n });\n\n return { transactionHash: hash };\n};\n"],"mappings":";;;;;;AAKA,IAAa,WAAb,cAA8BA,mCAAU;CACtC,YAAY,MAA0B;AACpC,QAAM;GACJ,OAAO,KAAK,SAAS;GACrB,MAAM,KAAK,QAAQ;GACnB,SAAS,KAAK;GACd,SAAS,KAAK,WAAW;GACzB,cAAc,KAAK;GACnB,MAAM,KAAK,QAAQ;GACnB,cAAc,KAAK;GACpB,CAAC;;;;;;;ACJN,MAAa,kBAAkB,OAC7B,EAAE,SAAS,eACX,WAC2B;CAC3B,MAAM,SAAS,YAAY,QAAQ,KAAK;CACxC,MAAM,kDAAe,OAAO;AAE5B,KAAI;EAEF,MAAM,WAAW,MAAM,KAAK,MAAM,QAAQ;GAMxC,MAAM,KAAK,UAAU;IACnB,IAAI,KAAK,MAAM,KAAK,KAAK,GAAG,KAAK,QAAQ,GAAG,IAAK;IACjD,SAAS;IACT,QAAQ;IACR,QAAQ,CAAC,SAAS,SAAS;IAC5B,CAAC;GAEF,SAAS,EACP,gBAAgB,oBACjB;GAED,QAAQ;GACT,CAAC;AAGF,MAAI,CAAC,SAAS,GACZ,OAAM,IAAI,SAAS;GACjB,MAAM;GACN,cAAc,uBAAuB,SAAS;GAC/C,CAAC;EAGJ,MAAM,OAAO,MAAM,SAAS,MAAM;AAGlC,MAAI,KAAK,MACP,OAAM,IAAI,SAAS;GACjB,OAAO,KAAK,iBAAiB,QAAQ,KAAK,QAAQ;GAClD,MAAM;GACN,cAAc,cAAc,KAAK,MAAM;GACxC,CAAC;EAIJ,MAAM,gBAAgB,KAAK;EAG3B,MAAM,aAAa,OAAO,cAAc;EAIxC,MAAM,WAAW,OAAO,kBAAK;AAM7B,UAFqB,OAAO,WAAW,GAAG,OAAO,SAAS,EAEtC,UAAU;UACvB,OAAO;AACd,MAAI,iBAAiB,MACnB,OAAM,IAAI,SAAS;GACjB,OAAO;GACP,MAAM;GACN,cAA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;EACjD,sBAAsB,OAAO,eAAe,qBAAqB;EAClE;KAED,aAAY,EACV,GAAI,eAAe,YAAY,EAC7B,UAAU,OAAO,eAAe,SAAS,EAC1C,EACF;AAYH,QAAO,EAAE,iBATe,MAAM,aAAa,gBAAgB;EACzD,MAAM,eAAe;EACrB,IAAI,eAAe;EACnB,OAAO,eAAe,QAAQ,OAAO,eAAe,MAAM,GAAG;EAC7D,GAAI,eAAe,YAAY,EAAE,KAAK,OAAO,eAAe,SAAS,EAAE;EACvE,GAAG;EACH,GAAI,eAAe,SAAS,EAAE,OAAO,eAAe,OAAO;EAC5D,CAAC,EAEwB;;;;;AC7E5B,MAAM,mBAAmB;;AAGzB,MAAa,oBAAoB,OAC/B,EAAE,QAAQ,WAAW,OAAO,iBAC5B,WACyC;AACzC,KAAI,CAAC,mBAAmB,cAAc,CACpC,OAAM,IAAIC,2CAAkB,8CAA8C;CAG5E,MAAM,EAAE,gBAAgB,yDAA2B,EAAE,eAAe,EAAE,OAAO;AAE7E,kDACE,aACA,4CAA4C,cAAc,UAC3D;CAGD,MAAM,QAAQ,MADOC,6EAAkC,EAAE,aAAa,CAAC,CACtC,oBAAoB,EACnD,SAAS,cAAc,SACxB,CAAC;CAEF,MAAM,eAAe,MAAMC,8EACzB,EAAE,eAAe,EACjB,OACD;AAGD,KAAI,OAAO;EAGT,MAAM,oCAA0B;GAC9B,KAAKC;GACL,MAAM,CAAC,gCAAuC,QAJ/B,MAAM,YAAY,iBAI8B,CAAC;GAChE,cAAc;GACf,CAAC;AAQF,SAAO,EAAE,iBANI,MAAM,aAAa,gBAAgB;GAC9C;GACA;GACA,IAAI,MAAM;GACX,CAAC,EAE8B;;AAUlC,QAAO,EAAE,iBANI,MAAM,aAAa,gBAAgB;EAC9C;EACA,IAAI;EACJ,4BAAkB,OAAO;EAC1B,CAAC,EAE8B"}
|
|
1
|
+
{"version":3,"file":"evmTransferAmount-CkF4KIge.cjs","names":["BaseError","InvalidParamError","createPublicClientFromNetworkData","createWalletClientForWalletAccount","erc20Abi","createPublicClientFromNetworkData","erc20Abi","createPublicClientFromNetworkData","InvalidParamError","createWalletClientForWalletAccount","gasParams: Record<string, bigint>","InvalidParamError","createPublicClientFromNetworkData","createWalletClientForWalletAccount","erc20Abi"],"sources":["../src/errors/RpcError.ts","../src/utils/fetchEvmBalance/fetchEvmBalance.ts","../src/utils/createEvmNetworkProvider/createEvmNetworkProvider.ts","../src/registerEvmNetworkProviderBuilder/registerEvmNetworkProviderBuilder.ts","../src/utils/isEvmWalletAccount/isEvmWalletAccount.ts","../src/utils/evmConfirmTransaction/evmConfirmTransaction.ts","../src/utils/approveErc20/approveErc20.ts","../src/utils/getErc20Allowance/getErc20Allowance.ts","../src/utils/approveErc20IfRequiredAndWaitReceipt/approveErc20IfRequiredAndWaitReceipt.ts","../src/utils/evmExecuteSwapTransaction/evmExecuteSwapTransaction.ts","../src/utils/evmTransferAmount/evmTransferAmount.ts"],"sourcesContent":["import { BaseError, type BaseErrorParameters } from '@dynamic-labs-sdk/client';\n\nexport type RpcErrorParameters = Pick<BaseErrorParameters, 'shortMessage'> &\n Partial<Omit<BaseErrorParameters, 'shortMessage'>>;\n\nexport class RpcError extends BaseError {\n constructor(args: RpcErrorParameters) {\n super({\n cause: args.cause ?? null,\n code: args.code ?? 'rpc_error',\n details: args.details,\n docsUrl: args.docsUrl ?? null,\n metaMessages: args.metaMessages,\n name: args.name ?? 'RpcError',\n shortMessage: args.shortMessage,\n });\n }\n}\n","import type { DynamicClient, NetworkData } from '@dynamic-labs-sdk/client';\nimport { getCore } from '@dynamic-labs-sdk/client/core';\n\nimport { RpcError } from '../../errors/RpcError';\n\ntype FetchEvmBalanceParams = {\n address: string;\n networkData: NetworkData;\n};\n\n/** @not-instrumented */\nexport const fetchEvmBalance = async (\n { address, networkData }: FetchEvmBalanceParams,\n client: DynamicClient\n): Promise<string | null> => {\n const rpcUrl = networkData.rpcUrls.http[0];\n const core = getCore(client);\n\n try {\n // Perform a POST request to the RPC URL with the JSON-RPC payload\n const response = await core.fetch(rpcUrl, {\n /**\n * The JSON-RPC method 'eth_getBalance' takes the address and a block tag ('latest' is the most recent)\n * See EIP-1474: https://eips.ethereum.org/EIPS/eip-1474\n * See eth_getBalance spec: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance\n */\n body: JSON.stringify({\n id: Math.floor(Date.now() + Math.random() * 1000),\n jsonrpc: '2.0',\n method: 'eth_getBalance',\n params: [address, 'latest'],\n }),\n\n headers: {\n 'Content-Type': 'application/json',\n },\n\n method: 'POST',\n });\n\n // Check if the network response was successful\n if (!response.ok) {\n throw new RpcError({\n code: 'http_error',\n shortMessage: `HTTP error! status: ${response.status}`,\n });\n }\n\n const data = await response.json();\n\n // Check for a JSON-RPC error in the response\n if (data.error) {\n throw new RpcError({\n cause: data.error instanceof Error ? data.error : undefined,\n code: 'json_rpc_error',\n shortMessage: `RPC Error: ${data.error.message}`,\n });\n }\n\n // The result is a hexadecimal string representing the balance in Wei\n const balanceWeiHex = data.result;\n\n // Convert the hexadecimal string to a BigInt\n const balanceWei = BigInt(balanceWeiHex);\n\n // Convert the balance from Wei to Ether (1 Ether = 10^18 Wei)\n // We use a BigInt for the conversion to maintain precision with large numbers\n const oneEther = BigInt(1e18);\n\n // Perform the division and return the result as a number\n // Note: This conversion can lose precision for very small amounts, but is generally fine for display purposes.\n const balanceEther = Number(balanceWei) / Number(oneEther);\n\n return balanceEther.toString();\n } catch (error) {\n if (error instanceof Error) {\n throw new RpcError({\n cause: error,\n code: 'rpc_error',\n shortMessage: `Failed to fetch balance for address ${address}`,\n });\n }\n\n throw error;\n }\n};\n","import type { DynamicClient, NetworkData } from '@dynamic-labs-sdk/client';\nimport { createBaseNetworkProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { EvmNetworkProvider } from '../../EvmNetworkProvider';\nimport { fetchEvmBalance } from '../fetchEvmBalance';\n\n/** @not-instrumented */\nexport const createEvmNetworkProvider = (\n networkData: NetworkData,\n client: DynamicClient\n): EvmNetworkProvider => ({\n ...createBaseNetworkProvider('EVM', networkData),\n\n getBalance: async ({ address }) => ({\n balance: await fetchEvmBalance(\n {\n address,\n networkData,\n },\n client\n ),\n }),\n});\n","import { type DynamicClient } from '@dynamic-labs-sdk/client';\nimport { getNetworkProviderBuilderRegistry } from '@dynamic-labs-sdk/client/core';\n\nimport { createEvmNetworkProvider } from '../utils/createEvmNetworkProvider';\n\n/** @not-instrumented */\nexport const registerEvmNetworkProviderBuilder = (\n client: DynamicClient\n): void => {\n const networkProviderBuilderRegistry =\n getNetworkProviderBuilderRegistry(client);\n\n /**\n * If the Ethereum network provider builder is already registered, return.\n */\n if (networkProviderBuilderRegistry.get().get('EVM')) {\n return;\n }\n\n networkProviderBuilderRegistry.register({\n builder: (networkData) => createEvmNetworkProvider(networkData, client),\n chain: 'EVM',\n });\n};\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { EvmWalletAccount } from '../../EvmWalletAccount.types';\n\n/**\n * Type guard function to check if a wallet account is an EVM wallet account.\n *\n * @param walletAccount - The wallet account to check.\n * @returns True if the wallet account is an EVM wallet account, false otherwise.\n * @not-instrumented\n */\nexport const isEvmWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is EvmWalletAccount => walletAccount.chain === 'EVM';\n","import {\n type DynamicClient,\n InvalidParamError,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport type { ConfirmTransactionParams } from '@dynamic-labs-sdk/client/core';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\n\nimport { createPublicClientFromNetworkData } from '../../viem/createPublicClientFromNetworkData';\nimport { isEvmWalletAccount } from '../isEvmWalletAccount';\n\n/**\n * Waits for an EVM transaction to be confirmed on-chain.\n *\n * @param params.transactionHash - The transaction hash to wait for.\n * @param params.walletAccount - The EVM wallet account used to resolve the active network.\n * @param client - The Dynamic client instance.\n * @not-instrumented\n */\nexport const evmConfirmTransaction = async (\n { transactionHash, walletAccount }: ConfirmTransactionParams,\n client: DynamicClient\n): Promise<void> => {\n if (!isEvmWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not an EVM wallet account');\n }\n\n const { networkData } = await getActiveNetworkData({ walletAccount }, client);\n\n assertDefined(\n networkData,\n `No network data found for wallet account ${walletAccount.address}`\n );\n\n const publicClient = createPublicClientFromNetworkData({ networkData });\n\n await publicClient.waitForTransactionReceipt({\n hash: transactionHash as `0x${string}`,\n });\n};\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { encodeFunctionData, erc20Abi } from 'viem';\n\nimport type { EvmWalletAccount } from '../../EvmWalletAccount.types';\nimport { createWalletClientForWalletAccount } from '../../viem/createWalletClientForWalletAccount';\n\ntype ApproveErc20Params = {\n amount: bigint;\n spenderAddress: string;\n tokenAddress: string;\n walletAccount: EvmWalletAccount;\n};\n\n/**\n * Sends an ERC-20 `approve` transaction, granting a spender an allowance\n * to transfer tokens on behalf of the wallet account.\n *\n * Encodes the `approve(spender, amount)` call using viem's `encodeFunctionData`\n * and sends it through the wallet account's viem wallet client.\n *\n * @param params.amount - The amount to approve in the token's smallest unit.\n * @param params.spenderAddress - The address being granted the allowance.\n * @param params.tokenAddress - The ERC-20 token contract address.\n * @param params.walletAccount - The EVM wallet account sending the approval.\n * @param client - The Dynamic client instance.\n * @returns The approval transaction hash.\n * @not-instrumented\n */\nexport const approveErc20 = async (\n { amount, spenderAddress, tokenAddress, walletAccount }: ApproveErc20Params,\n client: DynamicClient\n): Promise<{ transactionHash: string }> => {\n const walletClient = await createWalletClientForWalletAccount(\n { walletAccount },\n client\n );\n\n const data = encodeFunctionData({\n abi: erc20Abi,\n args: [spenderAddress as `0x${string}`, amount],\n functionName: 'approve',\n });\n\n const hash = await walletClient.sendTransaction({\n data,\n to: tokenAddress as `0x${string}`,\n });\n\n return { transactionHash: hash };\n};\n","import {\n type DynamicClient,\n type NetworkData,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport { erc20Abi } from 'viem';\n\nimport type { EvmWalletAccount } from '../../EvmWalletAccount.types';\nimport { createPublicClientFromNetworkData } from '../../viem/createPublicClientFromNetworkData';\n\ntype GetErc20AllowanceParams = {\n networkData?: NetworkData;\n ownerAddress: string;\n spenderAddress: string;\n tokenAddress: string;\n walletAccount: EvmWalletAccount;\n};\n\n/**\n * Reads the current ERC-20 token allowance granted by an owner to a spender.\n *\n * Uses a viem public client derived from the wallet account's active network\n * to call the `allowance(owner, spender)` method on the token contract.\n *\n * @param params.tokenAddress - The ERC-20 token contract address.\n * @param params.ownerAddress - The address that granted the allowance.\n * @param params.spenderAddress - The address allowed to spend the tokens.\n * @param params.walletAccount - The EVM wallet account used to resolve the active network.\n * @param [params.networkData] - The network data to use for the public client. If not provided, the active network data will be used.\n * @param client - The Dynamic client instance.\n * @returns The current allowance as a bigint in the token's smallest unit.\n * @not-instrumented\n */\nexport const getErc20Allowance = async (\n {\n networkData,\n ownerAddress,\n spenderAddress,\n tokenAddress,\n walletAccount,\n }: GetErc20AllowanceParams,\n client: DynamicClient\n): Promise<bigint> => {\n if (!networkData) {\n const activeNetworkData = await getActiveNetworkData(\n { walletAccount },\n client\n );\n networkData = activeNetworkData.networkData;\n }\n\n assertDefined(\n networkData,\n `No network data found for wallet account ${walletAccount.address}`\n );\n\n const publicClient = createPublicClientFromNetworkData({ networkData });\n\n return publicClient.readContract({\n abi: erc20Abi,\n address: tokenAddress as `0x${string}`,\n args: [ownerAddress as `0x${string}`, spenderAddress as `0x${string}`],\n functionName: 'allowance',\n });\n};\n","import {\n type DynamicClient,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport type { TransactionReceipt } from 'viem';\n\nimport type { EvmWalletAccount } from '../../EvmWalletAccount.types';\nimport { createPublicClientFromNetworkData } from '../../viem/createPublicClientFromNetworkData';\nimport { approveErc20 } from '../approveErc20';\nimport { getErc20Allowance } from '../getErc20Allowance';\n\ntype ApproveErc20IfRequiredAndWaitReceiptParams = {\n amount: string;\n spenderAddress: string;\n tokenAddress: string;\n walletAccount: EvmWalletAccount;\n};\n\n/**\n * Approves an ERC-20 token if the current allowance is insufficient and waits for the transaction receipt.\n *\n * @param params.amount - The amount of tokens to approve.\n * @param params.ownerAddress - The address that granted the allowance.\n * @param params.spenderAddress - The address allowed to spend the tokens.\n * @param params.tokenAddress - The ERC-20 token contract address.\n * @param params.walletAccount - The EVM wallet account used to resolve the active network.\n * @param client - The Dynamic client instance.\n * @returns The transaction receipt if an approval was sent, otherwise undefined.\n * @not-instrumented\n */\nexport const approveErc20IfRequiredAndWaitReceipt = async (\n {\n amount,\n spenderAddress,\n tokenAddress,\n walletAccount,\n }: ApproveErc20IfRequiredAndWaitReceiptParams,\n client: DynamicClient\n): Promise<{ receipt: TransactionReceipt } | undefined> => {\n const { networkData } = await getActiveNetworkData({ walletAccount }, client);\n\n assertDefined(\n networkData,\n `No network data found for wallet account ${walletAccount.address}`\n );\n\n const currentAllowance = await getErc20Allowance(\n {\n networkData,\n ownerAddress: walletAccount.address,\n spenderAddress,\n tokenAddress,\n walletAccount,\n },\n client\n );\n\n const approvalAmount = BigInt(amount);\n\n if (currentAllowance >= approvalAmount) {\n return undefined;\n }\n\n const result = await approveErc20(\n {\n amount: approvalAmount,\n spenderAddress,\n tokenAddress,\n walletAccount,\n },\n client\n );\n const approvalTransactionHash = result.transactionHash;\n\n const publicClient = createPublicClientFromNetworkData({ networkData });\n\n const receipt = await publicClient.waitForTransactionReceipt({\n hash: approvalTransactionHash as `0x${string}`,\n });\n\n return { receipt };\n};\n","import {\n type DynamicClient,\n InvalidParamError,\n} from '@dynamic-labs-sdk/client';\nimport type {\n ExecuteSwapTransactionParams,\n ExecuteSwapTransactionResult,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { createWalletClientForWalletAccount } from '../../viem/createWalletClientForWalletAccount';\nimport { approveErc20IfRequiredAndWaitReceipt } from '../approveErc20IfRequiredAndWaitReceipt';\nimport { isEvmWalletAccount } from '../isEvmWalletAccount';\n\n/**\n * Executes an EVM checkout transaction by handling optional ERC-20 approval\n * and sending the main swap transaction on-chain.\n *\n * 1. Validates that the wallet account is an EVM wallet account\n * 2. If the signing payload includes an `evmApproval`, checks the current\n * ERC-20 allowance and sends an approve transaction when insufficient\n * 3. Sends the main transaction using the viem wallet client\n *\n * @param params.signingPayload - The chain-aware signing payload containing `evmTransaction` and optional `evmApproval`.\n * @param params.walletAccount - The wallet account used to sign and send transactions.\n * @param params.onStepChange - Optional callback invoked with `'approval'` or `'transaction'` as each step begins.\n * @param client - The Dynamic client instance.\n * @returns The main transaction hash and, if an approval was sent, the approval transaction hash.\n * @not-instrumented\n */\nexport const evmExecuteSwapTransaction = async (\n { onStepChange, signingPayload, walletAccount }: ExecuteSwapTransactionParams,\n client: DynamicClient\n): Promise<ExecuteSwapTransactionResult> => {\n if (!isEvmWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not an EVM wallet account');\n }\n\n const { evmTransaction, evmApproval } = signingPayload;\n\n if (!evmTransaction) {\n throw new InvalidParamError(\n 'Signing payload is missing EVM transaction data'\n );\n }\n\n if (evmApproval) {\n onStepChange?.('approval');\n\n await approveErc20IfRequiredAndWaitReceipt(\n {\n amount: evmApproval.amount,\n spenderAddress: evmApproval.spenderAddress,\n tokenAddress: evmApproval.tokenAddress,\n walletAccount,\n },\n client\n );\n }\n\n onStepChange?.('transaction');\n\n const walletClient = await createWalletClientForWalletAccount(\n { walletAccount },\n client\n );\n\n // sendTransaction expects gasPrice or maxFeePerGas and maxPriorityFeePerGas\n let gasParams: Record<string, bigint> = {};\n if (evmTransaction.maxFeePerGas && evmTransaction.maxPriorityFeePerGas) {\n gasParams = {\n maxFeePerGas: BigInt(evmTransaction.maxFeePerGas),\n maxPriorityFeePerGas: BigInt(evmTransaction.maxPriorityFeePerGas),\n };\n } else {\n gasParams = {\n ...(evmTransaction.gasPrice && {\n gasPrice: BigInt(evmTransaction.gasPrice),\n }),\n };\n }\n\n const transactionHash = await walletClient.sendTransaction({\n data: evmTransaction.data as `0x${string}`,\n to: evmTransaction.to as `0x${string}`,\n value: evmTransaction.value ? BigInt(evmTransaction.value) : 0n,\n ...(evmTransaction.gasLimit && { gas: BigInt(evmTransaction.gasLimit) }),\n ...gasParams,\n ...(evmTransaction.nonce && { nonce: evmTransaction.nonce }),\n });\n\n return { transactionHash };\n};\n","import {\n type DynamicClient,\n InvalidParamError,\n getActiveNetworkData,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport type { TransferAmountParams } from '@dynamic-labs-sdk/client/core';\nimport { encodeFunctionData, erc20Abi, parseEther, parseUnits } from 'viem';\n\nimport { createPublicClientFromNetworkData } from '../../viem/createPublicClientFromNetworkData';\nimport { createWalletClientForWalletAccount } from '../../viem/createWalletClientForWalletAccount';\nimport { isEvmWalletAccount } from '../isEvmWalletAccount';\n\nconst DEFAULT_DECIMALS = 18;\n\n/** @not-instrumented */\nexport const evmTransferAmount = async (\n { amount, recipient, token, walletAccount }: TransferAmountParams,\n client: DynamicClient\n): Promise<{ transactionHash: string }> => {\n if (!isEvmWalletAccount(walletAccount)) {\n throw new InvalidParamError('Wallet account is not an EVM wallet account');\n }\n\n const { networkData } = await getActiveNetworkData({ walletAccount }, client);\n\n assertDefined(\n networkData,\n `No network data found for wallet account ${walletAccount.address}`\n );\n\n const publicClient = createPublicClientFromNetworkData({ networkData });\n const nonce = await publicClient.getTransactionCount({\n address: walletAccount.address as `0x${string}`,\n });\n\n const walletClient = await createWalletClientForWalletAccount(\n { walletAccount },\n client\n );\n\n // non-native token transfers\n if (token) {\n const decimals = token.decimals ?? DEFAULT_DECIMALS;\n\n const data = encodeFunctionData({\n abi: erc20Abi,\n args: [recipient as `0x${string}`, parseUnits(amount, decimals)],\n functionName: 'transfer',\n });\n\n const hash = await walletClient.sendTransaction({\n data,\n nonce,\n to: token.address as `0x${string}`,\n });\n\n return { transactionHash: hash };\n }\n\n // native token transfers\n const hash = await walletClient.sendTransaction({\n nonce,\n to: recipient as `0x${string}`,\n value: parseEther(amount),\n });\n\n return { transactionHash: hash };\n};\n"],"mappings":";;;;;;AAKA,IAAa,WAAb,cAA8BA,mCAAU;CACtC,YAAY,MAA0B;AACpC,QAAM;GACJ,OAAO,KAAK,SAAS;GACrB,MAAM,KAAK,QAAQ;GACnB,SAAS,KAAK;GACd,SAAS,KAAK,WAAW;GACzB,cAAc,KAAK;GACnB,MAAM,KAAK,QAAQ;GACnB,cAAc,KAAK;GACpB,CAAC;;;;;;;ACJN,MAAa,kBAAkB,OAC7B,EAAE,SAAS,eACX,WAC2B;CAC3B,MAAM,SAAS,YAAY,QAAQ,KAAK;CACxC,MAAM,kDAAe,OAAO;AAE5B,KAAI;EAEF,MAAM,WAAW,MAAM,KAAK,MAAM,QAAQ;GAMxC,MAAM,KAAK,UAAU;IACnB,IAAI,KAAK,MAAM,KAAK,KAAK,GAAG,KAAK,QAAQ,GAAG,IAAK;IACjD,SAAS;IACT,QAAQ;IACR,QAAQ,CAAC,SAAS,SAAS;IAC5B,CAAC;GAEF,SAAS,EACP,gBAAgB,oBACjB;GAED,QAAQ;GACT,CAAC;AAGF,MAAI,CAAC,SAAS,GACZ,OAAM,IAAI,SAAS;GACjB,MAAM;GACN,cAAc,uBAAuB,SAAS;GAC/C,CAAC;EAGJ,MAAM,OAAO,MAAM,SAAS,MAAM;AAGlC,MAAI,KAAK,MACP,OAAM,IAAI,SAAS;GACjB,OAAO,KAAK,iBAAiB,QAAQ,KAAK,QAAQ;GAClD,MAAM;GACN,cAAc,cAAc,KAAK,MAAM;GACxC,CAAC;EAIJ,MAAM,gBAAgB,KAAK;EAG3B,MAAM,aAAa,OAAO,cAAc;EAIxC,MAAM,WAAW,OAAO,kBAAK;AAM7B,UAFqB,OAAO,WAAW,GAAG,OAAO,SAAS,EAEtC,UAAU;UACvB,OAAO;AACd,MAAI,iBAAiB,MACnB,OAAM,IAAI,SAAS;GACjB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createWalletClientForWalletAccount = require('./createWalletClientForWalletAccount-
|
|
2
|
-
const require_evmTransferAmount = require('./evmTransferAmount-
|
|
3
|
-
require('./createWalletProviderFromEIP1193Provider-
|
|
4
|
-
const require_addEIP6963Extension = require('./addEIP6963Extension-
|
|
5
|
-
const require_addWaasEvmExtension = require('./addWaasEvmExtension-
|
|
1
|
+
const require_createWalletClientForWalletAccount = require('./createWalletClientForWalletAccount-CKBR4V6M.cjs');
|
|
2
|
+
const require_evmTransferAmount = require('./evmTransferAmount-CkF4KIge.cjs');
|
|
3
|
+
require('./createWalletProviderFromEIP1193Provider-D-6PlGdy.cjs');
|
|
4
|
+
const require_addEIP6963Extension = require('./addEIP6963Extension-6q4uKJ2S.cjs');
|
|
5
|
+
const require_addWaasEvmExtension = require('./addWaasEvmExtension-FyQx6Qlo.cjs');
|
|
6
6
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
7
7
|
let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
|
|
8
8
|
let _dynamic_labs_sdk_client_core = require("@dynamic-labs-sdk/client/core");
|
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as version, i as name, n as createPublicClientFromNetworkData, r as mapNetworkDataToViemChain, t as createWalletClientForWalletAccount } from "./createWalletClientForWalletAccount-
|
|
2
|
-
import { i as isEvmWalletAccount, o as RpcError } from "./evmTransferAmount-
|
|
3
|
-
import "./createWalletProviderFromEIP1193Provider-
|
|
4
|
-
import { t as addEIP6963Extension } from "./addEIP6963Extension-
|
|
5
|
-
import { t as addWaasEvmExtension } from "./addWaasEvmExtension-
|
|
1
|
+
import { a as version, i as name, n as createPublicClientFromNetworkData, r as mapNetworkDataToViemChain, t as createWalletClientForWalletAccount } from "./createWalletClientForWalletAccount-DRs8Ja_I.esm.js";
|
|
2
|
+
import { i as isEvmWalletAccount, o as RpcError } from "./evmTransferAmount-BJswh1ID.esm.js";
|
|
3
|
+
import "./createWalletProviderFromEIP1193Provider-p3Aa46Bi.esm.js";
|
|
4
|
+
import { t as addEIP6963Extension } from "./addEIP6963Extension-CSo4PZ83.esm.js";
|
|
5
|
+
import { t as addWaasEvmExtension } from "./addWaasEvmExtension-DTmPsJ-R.esm.js";
|
|
6
6
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
7
7
|
import { BaseError, FeeEstimationFailedError, InvalidParamError, SimulationFailedError, getActiveNetworkData, getDefaultClient, getNetworksData } from "@dynamic-labs-sdk/client";
|
|
8
8
|
import { assertDefined, createApiClient, createRuntimeServiceAccessKey, getCore, getDefaultClient as getDefaultClient$1 } from "@dynamic-labs-sdk/client/core";
|
package/dist/index.native.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as version, t as name } from "./package-
|
|
1
|
+
import { n as version, t as name } from "./package-DGj3wg-e.native.esm.js";
|
|
2
2
|
import { n as createPublicClientFromNetworkData, r as mapNetworkDataToViemChain, t as createWalletClientForWalletAccount } from "./createWalletClientForWalletAccount-BotF25Kn.native.esm.js";
|
|
3
3
|
import { t as addEIP6963Extension } from "./addEIP6963Extension-C_IKf5DD.native.esm.js";
|
|
4
4
|
import { i as isEvmWalletAccount, o as RpcError } from "./evmTransferAmount-BY0rW4dg.native.esm.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
import type { EvmWalletProvider } from '../../EvmWalletProvider.types';
|
|
4
|
+
export type CreateMetaMaskEvmWalletProviderParams = {
|
|
5
|
+
walletProviderType?: WalletProviderEnum;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Builds an `EvmWalletProvider` backed by `@metamask/connect-evm`,
|
|
9
|
+
* adapting the SDK's provider to the Dynamic `EIP1193Provider` contract
|
|
10
|
+
* (`disconnect` → `disconnected` event bridge, `removeAllListeners`
|
|
11
|
+
* shim, and unwrapping the `{ accounts, chainId }` response from
|
|
12
|
+
* `eth_requestAccounts` / `wallet_requestPermissions`). Defaults
|
|
13
|
+
* `walletProviderType` to `QrCode`; `addMetaMaskEvmExtension` upgrades
|
|
14
|
+
* it to `BrowserExtension` once EIP-6963 `io.metamask` is announced.
|
|
15
|
+
*
|
|
16
|
+
* @not-instrumented
|
|
17
|
+
*/
|
|
18
|
+
export declare const createMetaMaskEvmWalletProvider: ({ walletProviderType, }: CreateMetaMaskEvmWalletProviderParams, client: DynamicClient) => EvmWalletProvider;
|
|
19
|
+
//# sourceMappingURL=createMetaMaskEvmWalletProvider.d.ts.map
|
package/dist/metamask/createMetaMaskEvmWalletProvider/createMetaMaskEvmWalletProvider.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMetaMaskEvmWalletProvider.d.ts","sourceRoot":"","sources":["../../../src/metamask/createMetaMaskEvmWalletProvider/createMetaMaskEvmWalletProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAMhE,OAAO,KAAK,EAIV,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAOvC,MAAM,MAAM,qCAAqC,GAAG;IAClD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAOF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,4BAGvC,qCAAqC,UAChC,aAAa,KACpB,iBA0GF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/metamask/createMetaMaskEvmWalletProvider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,YAAY,EAAE,qCAAqC,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { MetamaskConnectEVM } from '@metamask/connect-evm';
|
|
2
|
+
export type DisplayUriListener = (uri: string) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Per-Dynamic-client wrapper around `@metamask/connect-evm`. Owns the SDK
|
|
5
|
+
* instance and the bookkeeping required to surface the SDK's `display_uri`
|
|
6
|
+
* event to multiple Dynamic-side consumers without races: a cache of the
|
|
7
|
+
* latest URI plus a small listener registry.
|
|
8
|
+
*
|
|
9
|
+
* Returned by `createMetaMaskEvmController` and cached per Dynamic client by
|
|
10
|
+
* `getOrCreateMetaMaskEvmController`.
|
|
11
|
+
*/
|
|
12
|
+
export type MetaMaskEvmController = {
|
|
13
|
+
/**
|
|
14
|
+
* Drops the cached `display_uri` value without touching the SDK. Used
|
|
15
|
+
* by `disconnectMetaMaskEvm` to make sure a torn-down pairing's URI is
|
|
16
|
+
* not replayed to late subscribers — the SDK's own `disconnect` event
|
|
17
|
+
* handler is best-effort and may not fire (or may not fire
|
|
18
|
+
* synchronously) when we abort a pairing that the wallet never
|
|
19
|
+
* accepted.
|
|
20
|
+
*/
|
|
21
|
+
clearCachedDisplayUri: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* The latest URI captured by `eventHandlers.displayUri`, or `undefined`
|
|
24
|
+
* if no pairing URI has been emitted yet (or the SDK routed to the
|
|
25
|
+
* browser extension instead of the QR / deep-link transport, or a
|
|
26
|
+
* pairing session just completed).
|
|
27
|
+
*/
|
|
28
|
+
getLatestDisplayUri: () => string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Subscribes a listener for `display_uri` events. The listener is
|
|
31
|
+
* invoked immediately with the cached URI when one is already available
|
|
32
|
+
* — so consumers that subscribe after the SDK has already started the
|
|
33
|
+
* pairing flow do not need to coordinate timing with the connection
|
|
34
|
+
* call. Returns a function that removes the listener.
|
|
35
|
+
*/
|
|
36
|
+
onDisplayUri: (listener: DisplayUriListener) => () => void;
|
|
37
|
+
/**
|
|
38
|
+
* The underlying `@metamask/connect-evm` SDK instance.
|
|
39
|
+
*/
|
|
40
|
+
sdk: MetamaskConnectEVM;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=metamask.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metamask.types.d.ts","sourceRoot":"","sources":["../../src/metamask/metamask.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;;;;OAOG;IACH,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAElC;;;;;OAKG;IACH,mBAAmB,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAE9C;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,MAAM,IAAI,CAAC;IAE3D;;OAEG;IACH,GAAG,EAAE,kBAAkB,CAAC;CACzB,CAAC"}
|
package/dist/metamask/utils/clearMetaMaskEvmSessionStorage/clearMetaMaskEvmSessionStorage.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deletes the `@metamask/connect-evm` SDK's IndexedDB-backed session
|
|
3
|
+
* storage. Without this, the SDK's auto-recovery path picks up the
|
|
4
|
+
* transport descriptor that a previous (now-dead) pairing left behind
|
|
5
|
+
* on the page; it then spends the default 10-second resume timeout
|
|
6
|
+
* trying to revive the relay session before falling back to issuing a
|
|
7
|
+
* fresh pairing URI. From a user's perspective, that surfaces as: the
|
|
8
|
+
* QR fallback shows a skeleton for ten seconds on every page reload
|
|
9
|
+
* that follows an abandoned pairing.
|
|
10
|
+
*
|
|
11
|
+
* Clearing the database on controller construction skips that resume
|
|
12
|
+
* round-trip entirely: the SDK starts with no stored transport, so the
|
|
13
|
+
* very first connect call emits a fresh `display_uri` synchronously.
|
|
14
|
+
*
|
|
15
|
+
* Safe to call when:
|
|
16
|
+
* - The database does not yet exist (the first call after a fresh
|
|
17
|
+
* install). `indexedDB.deleteDatabase` resolves with no error in that
|
|
18
|
+
* case.
|
|
19
|
+
* - The database is held open by another tab. The delete request will
|
|
20
|
+
* block; this helper resolves anyway after a `blocked` event so the
|
|
21
|
+
* caller is never stuck — the storage is reset on the next tab close.
|
|
22
|
+
* - `indexedDB` is not available (SSR / non-browser worker). The
|
|
23
|
+
* function resolves immediately with no error; callers don't need to
|
|
24
|
+
* guard their own usage.
|
|
25
|
+
*
|
|
26
|
+
* Headless-only: this is invoked from
|
|
27
|
+
* `createMetaMaskEvmController`, which only ever runs in a browser. The
|
|
28
|
+
* `typeof` guard is defensive in case a consumer imports the module
|
|
29
|
+
* directly in a non-browser context.
|
|
30
|
+
*
|
|
31
|
+
* @not-instrumented
|
|
32
|
+
*/
|
|
33
|
+
export declare const clearMetaMaskEvmSessionStorage: () => Promise<void>;
|
|
34
|
+
//# sourceMappingURL=clearMetaMaskEvmSessionStorage.d.ts.map
|
package/dist/metamask/utils/clearMetaMaskEvmSessionStorage/clearMetaMaskEvmSessionStorage.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearMetaMaskEvmSessionStorage.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/clearMetaMaskEvmSessionStorage/clearMetaMaskEvmSessionStorage.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,8BAA8B,QAAO,OAAO,CAAC,IAAI,CAqB7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/clearMetaMaskEvmSessionStorage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
import type { MetaMaskEvmController } from '../../metamask.types';
|
|
3
|
+
/**
|
|
4
|
+
* Builds a fully-initialised `MetaMaskEvmController` for the given Dynamic
|
|
5
|
+
* client. Used internally by `getOrCreateMetaMaskEvmController`; not part
|
|
6
|
+
* of the public API.
|
|
7
|
+
*
|
|
8
|
+
* Runs the SDK in headless mode (`ui.headless: true`) — the SDK does not
|
|
9
|
+
* render any built-in UI; consumers subscribe via `onDisplayUri` (or the
|
|
10
|
+
* public `onMetaMaskEvmDisplayUri` helper) to render their own QR /
|
|
11
|
+
* deep-link surface. `ui.preferExtension` is always `true`, so the SDK
|
|
12
|
+
* auto-routes to the installed MetaMask browser extension whenever
|
|
13
|
+
* available and only falls back to QR / deep-link when it isn't.
|
|
14
|
+
*
|
|
15
|
+
* `display_uri` handling is registered as an `eventHandlers` callback at
|
|
16
|
+
* SDK construction time (rather than via `provider.on(...)` after the
|
|
17
|
+
* fact) so the first URI emission can never be lost to a race between
|
|
18
|
+
* subscription and the SDK's transport selection. The handler caches the
|
|
19
|
+
* URI and broadcasts it to every subscribed listener. The `connect` /
|
|
20
|
+
* `disconnect` handlers clear the cached URI so that a brand-new pairing
|
|
21
|
+
* does not replay a stale URI.
|
|
22
|
+
*
|
|
23
|
+
* Dapp metadata is sourced from the Dynamic client's app metadata
|
|
24
|
+
* (`getAppMetadata`) — name, icon, native scheme, and universal link. No
|
|
25
|
+
* other configuration is exposed; the function is intentionally
|
|
26
|
+
* parameterless aside from the client to keep the integration's behaviour
|
|
27
|
+
* predictable across consumers.
|
|
28
|
+
*
|
|
29
|
+
* Only ever invoked from a browser context: the function sits behind the
|
|
30
|
+
* lazy façade in `createMetaMaskEvmWalletProvider`, which only constructs
|
|
31
|
+
* the SDK when the user clicks the MetaMask entry in the wallet picker.
|
|
32
|
+
*
|
|
33
|
+
* @not-instrumented
|
|
34
|
+
*/
|
|
35
|
+
export declare const createMetaMaskEvmController: (client: DynamicClient) => Promise<MetaMaskEvmController>;
|
|
36
|
+
//# sourceMappingURL=createMetaMaskEvmController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMetaMaskEvmController.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/createMetaMaskEvmController/createMetaMaskEvmController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI9D,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,2BAA2B,WAC9B,aAAa,KACpB,OAAO,CAAC,qBAAqB,CAwE/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/createMetaMaskEvmController/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/metamask/utils/getOrCreateMetaMaskEvmController/getOrCreateMetaMaskEvmController.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-`DynamicClient` accessor for the lazily-constructed MetaMask EVM
|
|
3
|
+
* controller. Wraps `createMetaMaskEvmController` with the standard
|
|
4
|
+
* `runtimeServices` cache so every caller — the EIP-1193 wallet-provider
|
|
5
|
+
* façade, the `display_uri` subscription helper, and the
|
|
6
|
+
* `connectWithMetaMaskEvm` URI-returning helper — shares the same
|
|
7
|
+
* controller (and therefore the same SDK instance, display-URI cache, and
|
|
8
|
+
* listener registry) per Dynamic client.
|
|
9
|
+
*
|
|
10
|
+
* This matches the pattern used by the WalletConnect `getSignClient`
|
|
11
|
+
* accessor: the first call triggers construction; subsequent calls
|
|
12
|
+
* (within the same client) return the cached promise without re-running
|
|
13
|
+
* the builder.
|
|
14
|
+
*
|
|
15
|
+
* The cache is **per-Dynamic-client, not per-SDK-instance**:
|
|
16
|
+
* `@metamask/connect-evm`'s `createEVMClient` is itself a singleton —
|
|
17
|
+
* a second call returns the same underlying SDK — so when multiple
|
|
18
|
+
* Dynamic clients coexist they end up sharing the same MetaMask SDK
|
|
19
|
+
* instance (and therefore the same active pairing session) regardless
|
|
20
|
+
* of this cache. The wrapper exists to own the controller's
|
|
21
|
+
* `display_uri` cache and listener registry per Dynamic client, which
|
|
22
|
+
* the SDK itself does not expose.
|
|
23
|
+
*
|
|
24
|
+
* @not-instrumented
|
|
25
|
+
*/
|
|
26
|
+
export declare const getOrCreateMetaMaskEvmController: (client: import("@dynamic-labs-sdk/client").DynamicClient) => Promise<import("../../metamask.types").MetaMaskEvmController>;
|
|
27
|
+
//# sourceMappingURL=getOrCreateMetaMaskEvmController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOrCreateMetaMaskEvmController.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/getOrCreateMetaMaskEvmController/getOrCreateMetaMaskEvmController.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,gCAAgC,6HAG5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/getOrCreateMetaMaskEvmController/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
type MetaMaskSupportedNetworks = Record<`0x${string}`, string>;
|
|
3
|
+
/** @not-instrumented */
|
|
4
|
+
export declare const getSupportedNetworks: (client: DynamicClient) => MetaMaskSupportedNetworks;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=getSupportedNetworks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSupportedNetworks.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/getSupportedNetworks/getSupportedNetworks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,KAAK,yBAAyB,GAAG,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;AAE/D,wBAAwB;AACxB,eAAO,MAAM,oBAAoB,WACvB,aAAa,KACpB,yBAuBF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/getSupportedNetworks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/isConnectShapedResponse/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,YAAY,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Address } from '@metamask/connect-evm';
|
|
2
|
+
/**
|
|
3
|
+
* The response shape that `@metamask/connect-evm` returns for connection
|
|
4
|
+
* methods (`eth_requestAccounts`, `wallet_requestPermissions`). EIP-1193
|
|
5
|
+
* callers expect a bare `accounts[]` array, so the MetaMask EVM façade
|
|
6
|
+
* unwraps this shape before returning.
|
|
7
|
+
*/
|
|
8
|
+
export type ConnectShapedResponse = {
|
|
9
|
+
accounts: readonly Address[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Type guard that detects the `{ accounts }` response shape that
|
|
13
|
+
* `@metamask/connect-evm` returns for `eth_requestAccounts` and
|
|
14
|
+
* `wallet_requestPermissions`. Used by the MetaMask EVM wallet provider
|
|
15
|
+
* façade to bridge the SDK's response back to the EIP-1193 `accounts[]`
|
|
16
|
+
* contract.
|
|
17
|
+
*
|
|
18
|
+
* @not-instrumented
|
|
19
|
+
*/
|
|
20
|
+
export declare const isConnectShapedResponse: (value: unknown) => value is ConnectShapedResponse;
|
|
21
|
+
//# sourceMappingURL=isConnectShapedResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isConnectShapedResponse.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/isConnectShapedResponse/isConnectShapedResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;CAC9B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,UAC3B,OAAO,KACb,KAAK,IAAI,qBAG+C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/subscribeMetaMaskEvmFacadeListener/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,YAAY,EAAE,gCAAgC,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DynamicClient } from '@dynamic-labs-sdk/client';
|
|
2
|
+
import type { EIP1193Provider as SdkEip1193Provider } from '@metamask/connect-evm';
|
|
3
|
+
import type { EIP1193ProviderEvents } from '../../../EvmWalletProvider.types';
|
|
4
|
+
/**
|
|
5
|
+
* A facade listener captured by the MetaMask EVM wallet-provider facade.
|
|
6
|
+
*
|
|
7
|
+
* The discriminated-union shape (rather than `{ event: string; listener:
|
|
8
|
+
* (...args: unknown[]) => void }`) is what lets
|
|
9
|
+
* `subscribeMetaMaskEvmFacadeListener` narrow the listener type per
|
|
10
|
+
* event, so the per-event adapters stay type-safe without casts.
|
|
11
|
+
*/
|
|
12
|
+
export type PendingMetaMaskEvmFacadeListener = {
|
|
13
|
+
[E in keyof EIP1193ProviderEvents]: {
|
|
14
|
+
event: E;
|
|
15
|
+
listener: EIP1193ProviderEvents[E];
|
|
16
|
+
};
|
|
17
|
+
}[keyof EIP1193ProviderEvents];
|
|
18
|
+
/**
|
|
19
|
+
* Subscribes a facade listener to the underlying MetaMask SDK provider,
|
|
20
|
+
* forwarding events through per-event adapters:
|
|
21
|
+
*
|
|
22
|
+
* - `accountsChanged` — clones the readonly addresses array
|
|
23
|
+
* `@metamask/connect-evm` hands the listener, since the Dynamic SDK
|
|
24
|
+
* facade contract emits a mutable `Address[]`.
|
|
25
|
+
* - `chainChanged` — passes the chain id through verbatim.
|
|
26
|
+
* - `disconnected` — bridged to the SDK's canonical `disconnect`
|
|
27
|
+
* event, which the SDK actually emits.
|
|
28
|
+
*
|
|
29
|
+
* Returns the unsubscribe function returned by the SDK provider so the
|
|
30
|
+
* caller can clean it up later (for example, when the facade's
|
|
31
|
+
* `removeAllListeners` is invoked).
|
|
32
|
+
*
|
|
33
|
+
* @not-instrumented
|
|
34
|
+
*/
|
|
35
|
+
export declare const subscribeMetaMaskEvmFacadeListener: ({ client, pending, provider, }: {
|
|
36
|
+
client: DynamicClient;
|
|
37
|
+
pending: PendingMetaMaskEvmFacadeListener;
|
|
38
|
+
provider: SdkEip1193Provider;
|
|
39
|
+
}) => (() => void);
|
|
40
|
+
//# sourceMappingURL=subscribeMetaMaskEvmFacadeListener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribeMetaMaskEvmFacadeListener.d.ts","sourceRoot":"","sources":["../../../../src/metamask/utils/subscribeMetaMaskEvmFacadeListener/subscribeMetaMaskEvmFacadeListener.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAGV,eAAe,IAAI,kBAAkB,EACtC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAI9E;;;;;;;GAOG;AACH,MAAM,MAAM,gCAAgC,GAAG;KAC5C,CAAC,IAAI,MAAM,qBAAqB,GAAG;QAClC,KAAK,EAAE,CAAC,CAAC;QACT,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;KACpC;CACF,CAAC,MAAM,qBAAqB,CAAC,CAAC;AAE/B;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kCAAkC,mCAI5C;IACD,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,gCAAgC,CAAC;IAC1C,QAAQ,EAAE,kBAAkB,CAAC;CAC9B,KAAG,CAAC,MAAM,IAAI,CA6Bd,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region package.json
|
|
2
2
|
var name = "@dynamic-labs-sdk/evm";
|
|
3
|
-
var version = "1.
|
|
3
|
+
var version = "1.3.0";
|
|
4
4
|
|
|
5
5
|
//#endregion
|
|
6
6
|
export { version as n, name as t };
|
|
7
|
-
//# sourceMappingURL=package-
|
|
7
|
+
//# sourceMappingURL=package-DGj3wg-e.native.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-DGj3wg-e.native.esm.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|