@dynamic-labs-sdk/zerodev 0.1.2 → 0.2.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.
- package/dist/KernelClient.types.d.ts.map +1 -0
- package/{src → dist}/addZerodevExtension/addZerodevExtension.d.ts +1 -1
- package/dist/addZerodevExtension/addZerodevExtension.d.ts.map +1 -0
- package/dist/addZerodevExtension/index.d.ts.map +1 -0
- package/dist/canSponsorTransaction/canSponsorTransaction.d.ts.map +1 -0
- package/dist/canSponsorTransaction/index.d.ts.map +1 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core.cjs.js +17 -0
- package/dist/core.cjs.js.map +1 -0
- package/dist/core.esm.js +9 -0
- package/dist/core.esm.js.map +1 -0
- package/{src → dist}/createKernelClientForWalletAccount/createKernelClientForWalletAccount.d.ts +1 -1
- package/dist/createKernelClientForWalletAccount/createKernelClientForWalletAccount.d.ts.map +1 -0
- package/dist/createKernelClientForWalletAccount/index.d.ts.map +1 -0
- package/dist/estimateTransactionGas/estimateTransactionGas.d.ts.map +1 -0
- package/dist/estimateTransactionGas/index.d.ts.map +1 -0
- package/dist/exports/core.d.ts.map +1 -0
- package/dist/exports/index.d.ts.map +1 -0
- package/{src → dist}/getSignerForSmartWalletAccount/getSignerForSmartWalletAccount.d.ts +1 -1
- package/dist/getSignerForSmartWalletAccount/getSignerForSmartWalletAccount.d.ts.map +1 -0
- package/dist/getSignerForSmartWalletAccount/index.d.ts.map +1 -0
- package/dist/getZerodevRpc-Bv9aCgYr.esm.js +177 -0
- package/dist/getZerodevRpc-Bv9aCgYr.esm.js.map +1 -0
- package/dist/getZerodevRpc-DhG6DLOa.cjs.js +254 -0
- package/dist/getZerodevRpc-DhG6DLOa.cjs.js.map +1 -0
- package/dist/index.cjs.js +258 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +253 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/isGasSponsorshipError/index.d.ts.map +1 -0
- package/dist/isGasSponsorshipError/isGasSponsorshipError.d.ts.map +1 -0
- package/dist/isZerodevWalletAccount/index.d.ts.map +1 -0
- package/dist/isZerodevWalletAccount/isZerodevWalletAccount.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/dist/utils/calculateGasForUserOperation/calculateGasForUserOperation.d.ts.map +1 -0
- package/dist/utils/calculateGasForUserOperation/index.d.ts.map +1 -0
- package/dist/utils/createKernelAccount/createKernelAccount.d.ts.map +1 -0
- package/dist/utils/createKernelAccount/index.d.ts.map +1 -0
- package/dist/utils/createZerodevWalletProvider/createZerodevWalletProvider.d.ts.map +1 -0
- package/dist/utils/createZerodevWalletProvider/index.d.ts.map +1 -0
- package/dist/utils/getAllUserZerodevAddresses/getAllUserZerodevAddresses.d.ts.map +1 -0
- package/dist/utils/getAllUserZerodevAddresses/index.d.ts.map +1 -0
- package/dist/utils/getEcdsaValidator/getEcdsaValidator.d.ts.map +1 -0
- package/dist/utils/getEcdsaValidator/index.d.ts.map +1 -0
- package/dist/utils/getEntryPoint/getEntryPoint.d.ts.map +1 -0
- package/dist/utils/getEntryPoint/index.d.ts.map +1 -0
- package/dist/utils/getKernelVersion/getKernelVersion.d.ts.map +1 -0
- package/dist/utils/getKernelVersion/index.d.ts.map +1 -0
- package/dist/utils/getPaymasterConfig/getPaymasterConfig.d.ts.map +1 -0
- package/dist/utils/getPaymasterConfig/index.d.ts.map +1 -0
- package/{src → dist}/utils/getZerodevChainProviderForNetworkId/getZerodevChainProviderForNetworkId.d.ts +1 -1
- package/dist/utils/getZerodevChainProviderForNetworkId/getZerodevChainProviderForNetworkId.d.ts.map +1 -0
- package/dist/utils/getZerodevChainProviderForNetworkId/index.d.ts.map +1 -0
- package/{src → dist}/utils/getZerodevProviderFromSettings/getZerodevProviderFromSettings.d.ts +1 -1
- package/dist/utils/getZerodevProviderFromSettings/getZerodevProviderFromSettings.d.ts.map +1 -0
- package/dist/utils/getZerodevProviderFromSettings/index.d.ts.map +1 -0
- package/{src → dist}/utils/getZerodevRpc/getZerodevRpc.d.ts +1 -1
- package/dist/utils/getZerodevRpc/getZerodevRpc.d.ts.map +1 -0
- package/dist/utils/getZerodevRpc/index.d.ts.map +1 -0
- package/dist/utils/prepareUserOperationWithKernelClient/index.d.ts.map +1 -0
- package/dist/utils/prepareUserOperationWithKernelClient/prepareUserOperationWithKernelClient.d.ts.map +1 -0
- package/dist/utils/shouldSignWithEoa/index.d.ts.map +1 -0
- package/dist/utils/shouldSignWithEoa/shouldSignWithEoa.d.ts.map +1 -0
- package/dist/utils/shouldUseEIP7702/index.d.ts.map +1 -0
- package/{src → dist}/utils/shouldUseEIP7702/shouldUseEIP7702.d.ts +1 -1
- package/dist/utils/shouldUseEIP7702/shouldUseEIP7702.d.ts.map +1 -0
- package/dist/utils/signMessage/index.d.ts.map +1 -0
- package/dist/utils/signMessage/signMessage.d.ts.map +1 -0
- package/package.json +29 -15
- package/CHANGELOG.md +0 -606
- package/core.cjs.d.ts +0 -1
- package/core.cjs.js +0 -25
- package/core.esm.d.ts +0 -1
- package/core.esm.js +0 -14
- package/getZerodevRpc.cjs.js +0 -222
- package/getZerodevRpc.esm.js +0 -208
- package/index.cjs.d.ts +0 -1
- package/index.cjs.js +0 -311
- package/index.esm.d.ts +0 -1
- package/index.esm.js +0 -305
- package/src/KernelClient.types.d.ts.map +0 -1
- package/src/addZerodevExtension/addZerodevExtension.d.ts.map +0 -1
- package/src/addZerodevExtension/index.d.ts.map +0 -1
- package/src/canSponsorTransaction/canSponsorTransaction.d.ts.map +0 -1
- package/src/canSponsorTransaction/index.d.ts.map +0 -1
- package/src/constants.d.ts.map +0 -1
- package/src/createKernelClientForWalletAccount/createKernelClientForWalletAccount.d.ts.map +0 -1
- package/src/createKernelClientForWalletAccount/index.d.ts.map +0 -1
- package/src/estimateTransactionGas/estimateTransactionGas.d.ts.map +0 -1
- package/src/estimateTransactionGas/index.d.ts.map +0 -1
- package/src/exports/core.d.ts.map +0 -1
- package/src/exports/index.d.ts.map +0 -1
- package/src/getSignerForSmartWalletAccount/getSignerForSmartWalletAccount.d.ts.map +0 -1
- package/src/getSignerForSmartWalletAccount/index.d.ts.map +0 -1
- package/src/isGasSponsorshipError/index.d.ts.map +0 -1
- package/src/isGasSponsorshipError/isGasSponsorshipError.d.ts.map +0 -1
- package/src/isZerodevWalletAccount/index.d.ts.map +0 -1
- package/src/isZerodevWalletAccount/isZerodevWalletAccount.d.ts.map +0 -1
- package/src/utils/calculateGasForUserOperation/calculateGasForUserOperation.d.ts.map +0 -1
- package/src/utils/calculateGasForUserOperation/index.d.ts.map +0 -1
- package/src/utils/createKernelAccount/createKernelAccount.d.ts.map +0 -1
- package/src/utils/createKernelAccount/index.d.ts.map +0 -1
- package/src/utils/createZerodevWalletProvider/createZerodevWalletProvider.d.ts.map +0 -1
- package/src/utils/createZerodevWalletProvider/index.d.ts.map +0 -1
- package/src/utils/getAllUserZerodevAddresses/getAllUserZerodevAddresses.d.ts.map +0 -1
- package/src/utils/getAllUserZerodevAddresses/index.d.ts.map +0 -1
- package/src/utils/getEcdsaValidator/getEcdsaValidator.d.ts.map +0 -1
- package/src/utils/getEcdsaValidator/index.d.ts.map +0 -1
- package/src/utils/getEntryPoint/getEntryPoint.d.ts.map +0 -1
- package/src/utils/getEntryPoint/index.d.ts.map +0 -1
- package/src/utils/getKernelVersion/getKernelVersion.d.ts.map +0 -1
- package/src/utils/getKernelVersion/index.d.ts.map +0 -1
- package/src/utils/getPaymasterConfig/getPaymasterConfig.d.ts.map +0 -1
- package/src/utils/getPaymasterConfig/index.d.ts.map +0 -1
- package/src/utils/getZerodevChainProviderForNetworkId/getZerodevChainProviderForNetworkId.d.ts.map +0 -1
- package/src/utils/getZerodevChainProviderForNetworkId/index.d.ts.map +0 -1
- package/src/utils/getZerodevProviderFromSettings/getZerodevProviderFromSettings.d.ts.map +0 -1
- package/src/utils/getZerodevProviderFromSettings/index.d.ts.map +0 -1
- package/src/utils/getZerodevRpc/getZerodevRpc.d.ts.map +0 -1
- package/src/utils/getZerodevRpc/index.d.ts.map +0 -1
- package/src/utils/prepareUserOperationWithKernelClient/index.d.ts.map +0 -1
- package/src/utils/prepareUserOperationWithKernelClient/prepareUserOperationWithKernelClient.d.ts.map +0 -1
- package/src/utils/shouldSignWithEoa/index.d.ts.map +0 -1
- package/src/utils/shouldSignWithEoa/shouldSignWithEoa.d.ts.map +0 -1
- package/src/utils/shouldUseEIP7702/index.d.ts.map +0 -1
- package/src/utils/shouldUseEIP7702/shouldUseEIP7702.d.ts.map +0 -1
- package/src/utils/signMessage/index.d.ts.map +0 -1
- package/src/utils/signMessage/signMessage.d.ts.map +0 -1
- /package/{src → dist}/KernelClient.types.d.ts +0 -0
- /package/{src → dist}/addZerodevExtension/index.d.ts +0 -0
- /package/{src → dist}/canSponsorTransaction/canSponsorTransaction.d.ts +0 -0
- /package/{src → dist}/canSponsorTransaction/index.d.ts +0 -0
- /package/{src → dist}/constants.d.ts +0 -0
- /package/{src → dist}/createKernelClientForWalletAccount/index.d.ts +0 -0
- /package/{src → dist}/estimateTransactionGas/estimateTransactionGas.d.ts +0 -0
- /package/{src → dist}/estimateTransactionGas/index.d.ts +0 -0
- /package/{src → dist}/exports/core.d.ts +0 -0
- /package/{src → dist}/exports/index.d.ts +0 -0
- /package/{src → dist}/getSignerForSmartWalletAccount/index.d.ts +0 -0
- /package/{src → dist}/isGasSponsorshipError/index.d.ts +0 -0
- /package/{src → dist}/isGasSponsorshipError/isGasSponsorshipError.d.ts +0 -0
- /package/{src → dist}/isZerodevWalletAccount/index.d.ts +0 -0
- /package/{src → dist}/isZerodevWalletAccount/isZerodevWalletAccount.d.ts +0 -0
- /package/{src → dist}/utils/calculateGasForUserOperation/calculateGasForUserOperation.d.ts +0 -0
- /package/{src → dist}/utils/calculateGasForUserOperation/index.d.ts +0 -0
- /package/{src → dist}/utils/createKernelAccount/createKernelAccount.d.ts +0 -0
- /package/{src → dist}/utils/createKernelAccount/index.d.ts +0 -0
- /package/{src → dist}/utils/createZerodevWalletProvider/createZerodevWalletProvider.d.ts +0 -0
- /package/{src → dist}/utils/createZerodevWalletProvider/index.d.ts +0 -0
- /package/{src → dist}/utils/getAllUserZerodevAddresses/getAllUserZerodevAddresses.d.ts +0 -0
- /package/{src → dist}/utils/getAllUserZerodevAddresses/index.d.ts +0 -0
- /package/{src → dist}/utils/getEcdsaValidator/getEcdsaValidator.d.ts +0 -0
- /package/{src → dist}/utils/getEcdsaValidator/index.d.ts +0 -0
- /package/{src → dist}/utils/getEntryPoint/getEntryPoint.d.ts +0 -0
- /package/{src → dist}/utils/getEntryPoint/index.d.ts +0 -0
- /package/{src → dist}/utils/getKernelVersion/getKernelVersion.d.ts +0 -0
- /package/{src → dist}/utils/getKernelVersion/index.d.ts +0 -0
- /package/{src → dist}/utils/getPaymasterConfig/getPaymasterConfig.d.ts +0 -0
- /package/{src → dist}/utils/getPaymasterConfig/index.d.ts +0 -0
- /package/{src → dist}/utils/getZerodevChainProviderForNetworkId/index.d.ts +0 -0
- /package/{src → dist}/utils/getZerodevProviderFromSettings/index.d.ts +0 -0
- /package/{src → dist}/utils/getZerodevRpc/index.d.ts +0 -0
- /package/{src → dist}/utils/prepareUserOperationWithKernelClient/index.d.ts +0 -0
- /package/{src → dist}/utils/prepareUserOperationWithKernelClient/prepareUserOperationWithKernelClient.d.ts +0 -0
- /package/{src → dist}/utils/shouldSignWithEoa/index.d.ts +0 -0
- /package/{src → dist}/utils/shouldSignWithEoa/shouldSignWithEoa.d.ts +0 -0
- /package/{src → dist}/utils/shouldUseEIP7702/index.d.ts +0 -0
- /package/{src → dist}/utils/signMessage/index.d.ts +0 -0
- /package/{src → dist}/utils/signMessage/signMessage.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getZerodevRpc-DhG6DLOa.cjs.js","names":["DYNAMIC_ICONIC_SPRITE_URL","ProviderKernelVersionEnum","constants","ENTRY_POINT_VERSION_MAP: Record<\n EntryPointVersion,\n KERNEL_VERSION_TYPE\n>","ProviderEnum","NoSmartWalletAccountSignerFoundError","ProviderEntryPointVersionEnum","constants","entryPointVersion: keyof typeof ENTRY_POINT_VERSION_MAP","constants","constants","ZerodevBundlerProvider"],"sources":["../package.json","../src/constants.ts","../src/utils/getZerodevProviderFromSettings/getZerodevProviderFromSettings.ts","../src/utils/getZerodevChainProviderForNetworkId/getZerodevChainProviderForNetworkId.ts","../src/getSignerForSmartWalletAccount/getSignerForSmartWalletAccount.ts","../src/utils/getEcdsaValidator/getEcdsaValidator.ts","../src/utils/getEntryPoint/getEntryPoint.ts","../src/utils/getKernelVersion/getKernelVersion.ts","../src/utils/shouldUseEIP7702/shouldUseEIP7702.ts","../src/utils/createKernelAccount/createKernelAccount.ts","../src/utils/getPaymasterConfig/getPaymasterConfig.ts","../src/utils/getZerodevRpc/getZerodevRpc.ts"],"sourcesContent":["","import { DYNAMIC_ICONIC_SPRITE_URL } from '@dynamic-labs-sdk/client/core';\nimport { ProviderKernelVersionEnum } from '@dynamic-labs/sdk-api-core';\nimport { constants } from '@zerodev/sdk';\nimport type { KERNEL_VERSION_TYPE } from '@zerodev/sdk/types';\nimport type { EntryPointVersion } from 'viem/account-abstraction';\n\nexport const ZERODEV_METADATA = {\n displayName: 'ZeroDev',\n icon: `${DYNAMIC_ICONIC_SPRITE_URL}#smartwallet`,\n normalizedWalletName: 'zerodev',\n};\n\nexport const ZERODEV_RPC_BASE_URL = 'https://rpc.zerodev.app/api/v2';\n\nexport const KERNEL_VERSION_MAP = {\n [ProviderKernelVersionEnum.V33]: constants.KERNEL_V3_3,\n [ProviderKernelVersionEnum.V32]: constants.KERNEL_V3_2,\n [ProviderKernelVersionEnum.V31]: constants.KERNEL_V3_1,\n [ProviderKernelVersionEnum.V30]: constants.KERNEL_V3_0,\n [ProviderKernelVersionEnum.V24]: constants.KERNEL_V2_4,\n} as const;\n\nexport const ENTRY_POINT_VERSION_MAP: Record<\n EntryPointVersion,\n KERNEL_VERSION_TYPE\n> = {\n 0.6: constants.KERNEL_V2_4,\n 0.7: constants.KERNEL_V3_1,\n 0.8: constants.KERNEL_V3_3,\n} as const;\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport { ProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nexport const getZerodevProviderFromSettings = (client: DynamicClient) => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const zerodevProvider = projectSettings.providers?.find(\n (provider) => provider.provider === ProviderEnum.Zerodev\n );\n\n assertDefined(\n zerodevProvider,\n 'Zerodev is not configured in project settings'\n );\n\n return zerodevProvider;\n};\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\n\nimport { getZerodevProviderFromSettings } from '../getZerodevProviderFromSettings';\n\ntype GetZerodevChainProviderForNetworkIdProps = {\n networkId: string;\n};\n\nexport const getZerodevChainProviderForNetworkId = (\n { networkId }: GetZerodevChainProviderForNetworkIdProps,\n client: DynamicClient\n) => {\n const zerodevProvider = getZerodevProviderFromSettings(client);\n\n return zerodevProvider.multichainAccountAbstractionProviders?.find(\n (provider) => provider.chain === networkId\n );\n};\n","import {\n NoSmartWalletAccountSignerFoundError,\n getOwnerWalletAccountForSmartWalletAccount,\n} from '@dynamic-labs-sdk/client';\nimport { getDefaultClient } from '@dynamic-labs-sdk/client/core';\nimport {\n type EvmWalletAccount,\n isEvmWalletAccount,\n} from '@dynamic-labs-sdk/evm';\nimport { createWalletClientForWalletAccount } from '@dynamic-labs-sdk/evm/viem';\nimport type { Account, Chain, Transport, WalletClient } from 'viem';\n\ntype GetSignerForSmartWalletAccountParams = {\n smartWalletAccount: EvmWalletAccount;\n};\n\n/**\n * Gets a WalletClient instance for the EOA of the smart wallet account.\n * You can use this signer to sign EVM transactions.\n *\n * @param params.smartWalletAccount - The EVM smart wallet account to get the signer for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to an WalletClient instance.\n * @throws NoSmartWalletAccountSignerFoundError When the signer wallet account is not found for the given smart wallet account.\n */\nexport const getSignerForSmartWalletAccount = (\n { smartWalletAccount }: GetSignerForSmartWalletAccountParams,\n client = getDefaultClient()\n): Promise<WalletClient<Transport, Chain, Account>> => {\n const signerWalletAccount = getOwnerWalletAccountForSmartWalletAccount(\n { smartWalletAccount },\n client\n );\n\n if (!signerWalletAccount || !isEvmWalletAccount(signerWalletAccount)) {\n throw new NoSmartWalletAccountSignerFoundError(smartWalletAccount.address);\n }\n\n return createWalletClientForWalletAccount(\n {\n walletAccount: signerWalletAccount,\n },\n client\n );\n};\n","import { signerToEcdsaValidator } from '@zerodev/ecdsa-validator';\nimport { toMultiChainECDSAValidator } from '@zerodev/multi-chain-ecdsa-validator';\nimport type {\n EntryPointType,\n GetKernelVersion,\n Signer,\n} from '@zerodev/sdk/types';\nimport type { Client } from 'viem';\nimport type { EntryPointVersion } from 'viem/account-abstraction';\n\ntype GetEcdsaValidatorParams = {\n ecdsaProviderType?: string;\n entryPoint: EntryPointType<EntryPointVersion>;\n kernelVersion: GetKernelVersion<EntryPointVersion>;\n publicClient: Client;\n signer: Signer;\n};\n\nexport const getEcdsaValidator = ({\n ecdsaProviderType,\n publicClient,\n signer,\n entryPoint,\n kernelVersion,\n}: GetEcdsaValidatorParams) => {\n const params = {\n entryPoint,\n kernelVersion,\n signer,\n };\n\n if (ecdsaProviderType === 'zerodev_multi_chain') {\n return toMultiChainECDSAValidator(publicClient, params);\n }\n\n return signerToEcdsaValidator(publicClient, params);\n};\n","import { ProviderEntryPointVersionEnum } from '@dynamic-labs/sdk-api-core';\nimport { constants } from '@zerodev/sdk';\n\nexport const getEntryPoint = (entryPoint?: string) => {\n if (entryPoint === ProviderEntryPointVersionEnum.V6) {\n return constants.getEntryPoint('0.6');\n }\n\n // default to v7\n return constants.getEntryPoint('0.7');\n};\n","import type { ProviderKernelVersionEnum } from '@dynamic-labs/sdk-api-core';\nimport { constants } from '@zerodev/sdk';\nimport type { EntryPointType } from '@zerodev/sdk/types';\nimport type { EntryPointVersion } from 'viem/account-abstraction';\n\nimport { ENTRY_POINT_VERSION_MAP, KERNEL_VERSION_MAP } from '../../constants';\n\ntype GetKernelVersionParams = {\n entryPoint: EntryPointType<EntryPointVersion>;\n kernelVersion: ProviderKernelVersionEnum | undefined;\n};\n\nexport const getKernelVersion = ({\n kernelVersion,\n entryPoint,\n}: GetKernelVersionParams) => {\n // If kernel version is explicitly provided, use it\n if (kernelVersion && kernelVersion in KERNEL_VERSION_MAP) {\n return KERNEL_VERSION_MAP[kernelVersion];\n }\n\n // If no kernel version provided, determine based on entry point version\n const entryPointVersion: keyof typeof ENTRY_POINT_VERSION_MAP =\n entryPoint.version;\n if (entryPointVersion in ENTRY_POINT_VERSION_MAP) {\n return ENTRY_POINT_VERSION_MAP[entryPointVersion];\n }\n\n // Fallback to latest version\n return constants.KERNEL_V3_3;\n};\n","import {\n type DynamicClient,\n type WalletAccount,\n getOwnerWalletAccountForSmartWalletAccount,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\n\nimport { getZerodevProviderFromSettings } from '../getZerodevProviderFromSettings';\n\ntype ShouldUseEIP7702Params = {\n smartWalletAccount: WalletAccount;\n};\n\nexport const shouldUseEIP7702 = (\n { smartWalletAccount }: ShouldUseEIP7702Params,\n client: DynamicClient\n) => {\n const zerodevProvider = getZerodevProviderFromSettings(client);\n\n assertDefined(\n zerodevProvider,\n 'Zerodev provider is not enabled in project settings'\n );\n\n const eoaWalletAccount = getOwnerWalletAccountForSmartWalletAccount(\n { smartWalletAccount },\n client\n );\n\n assertDefined(eoaWalletAccount, 'EOA wallet account is not found');\n\n return (\n zerodevProvider.enableEIP7702 &&\n // with EIP7702, the EOA wallet account address is the same as the smart wallet account address\n smartWalletAccount.address === eoaWalletAccount.address\n );\n};\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n getVerifiedCredentialForWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\nimport type { EvmWalletAccount } from '@dynamic-labs-sdk/evm';\nimport { createEcdsaKernelMigrationAccount } from '@zerodev/ecdsa-validator';\nimport {\n type CreateKernelAccountReturnType,\n constants,\n createKernelAccount as createZerodevKernelAccount,\n} from '@zerodev/sdk';\nimport type { PublicClient } from 'viem';\nimport type { EntryPointVersion } from 'viem/account-abstraction';\n\nimport { getSignerForSmartWalletAccount } from '../../getSignerForSmartWalletAccount';\nimport { getEcdsaValidator } from '../getEcdsaValidator';\nimport { getEntryPoint } from '../getEntryPoint';\nimport { getKernelVersion } from '../getKernelVersion';\nimport { getZerodevProviderFromSettings } from '../getZerodevProviderFromSettings';\nimport { shouldUseEIP7702 } from '../shouldUseEIP7702';\n\ntype CreateKernelAccountParams = {\n publicClient: PublicClient;\n smartWalletAccount: EvmWalletAccount;\n};\n\nexport const createKernelAccount = async (\n { publicClient, smartWalletAccount }: CreateKernelAccountParams,\n client: DynamicClient\n): Promise<CreateKernelAccountReturnType<EntryPointVersion>> => {\n const zerodevProvider = getZerodevProviderFromSettings(client);\n\n assertDefined(\n zerodevProvider,\n 'Zerodev provider is not enabled in project settings'\n );\n\n const signer = await getSignerForSmartWalletAccount(\n {\n smartWalletAccount,\n },\n client\n );\n\n const walletProperties = getVerifiedCredentialForWalletAccount(\n { walletAccount: smartWalletAccount },\n client\n )?.walletProperties;\n\n const entryPointVersion =\n walletProperties?.entryPointVersion ?? zerodevProvider.entryPointVersion;\n const entryPoint = getEntryPoint(entryPointVersion);\n\n const useEIP7702 = shouldUseEIP7702({ smartWalletAccount }, client);\n\n if (useEIP7702) {\n return createZerodevKernelAccount(publicClient, {\n eip7702Account: signer,\n entryPoint,\n kernelVersion: constants.KERNEL_V3_3,\n });\n }\n\n const kernelVersionValue =\n walletProperties?.kernelVersion ?? zerodevProvider.kernelVersion;\n\n const kernelVersion = getKernelVersion({\n entryPoint,\n kernelVersion: kernelVersionValue,\n });\n\n const kernelV3MigrationEnabled =\n zerodevProvider.enableKernelV3Migration ?? false;\n\n if (kernelV3MigrationEnabled) {\n const apiKernelVersion = getKernelVersion({\n entryPoint,\n kernelVersion: zerodevProvider.kernelVersion,\n });\n\n return createEcdsaKernelMigrationAccount(publicClient, {\n entryPoint,\n migrationVersion: {\n from: kernelVersion,\n to: apiKernelVersion,\n },\n signer,\n });\n }\n\n const validator = await getEcdsaValidator({\n ecdsaProviderType:\n walletProperties?.ecdsaProviderType ?? zerodevProvider.ecdsaProviderType,\n entryPoint,\n kernelVersion,\n publicClient,\n signer,\n });\n\n return createZerodevKernelAccount(publicClient, {\n entryPoint,\n kernelVersion,\n plugins: {\n sudo: validator,\n },\n });\n};\n","import { createZeroDevPaymasterClient } from '@zerodev/sdk';\nimport type { Hex, Chain as ViemChain } from 'viem';\nimport { http } from 'viem';\nimport type { GetPaymasterDataParameters } from 'viem/account-abstraction';\n\ntype GetPaymasterConfigProps = {\n chain: ViemChain;\n /**\n * The address the ERC20 token to use for the paymaster.\n * If not provided, the paymaster will use the default gas token for the chain.\n */\n gasTokenAddress?: Hex;\n paymasterRpc: string;\n};\n\nexport const getPaymasterConfig = ({\n chain,\n gasTokenAddress,\n paymasterRpc,\n}: GetPaymasterConfigProps) => {\n const getPaymasterData = (params: GetPaymasterDataParameters) => {\n const zerodevPaymaster = createZeroDevPaymasterClient({\n chain,\n transport: http(paymasterRpc),\n });\n\n return zerodevPaymaster.sponsorUserOperation({\n gasToken: gasTokenAddress,\n userOperation: params,\n });\n };\n\n return {\n paymaster: {\n getPaymasterData,\n },\n };\n};\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport { ZerodevBundlerProvider } from '@dynamic-labs/sdk-api-core';\n\nimport { ZERODEV_RPC_BASE_URL } from '../../constants';\nimport { getZerodevChainProviderForNetworkId } from '../getZerodevChainProviderForNetworkId';\nimport { getZerodevProviderFromSettings } from '../getZerodevProviderFromSettings';\n\ntype GetZerodevRpcParams = {\n bundlerProvider?: ZerodevBundlerProvider;\n networkId: string;\n rpcType: 'paymaster' | 'bundler';\n};\n\nexport const getZerodevRpc = (\n { networkId, bundlerProvider, rpcType }: GetZerodevRpcParams,\n client: DynamicClient\n) => {\n const zerodevProvider = getZerodevProviderFromSettings(client);\n\n if (zerodevProvider?.zerodevPaymasterRpcUrl) {\n return zerodevProvider.zerodevPaymasterRpcUrl;\n }\n\n const zerodevChainProvider = getZerodevChainProviderForNetworkId(\n { networkId },\n client\n );\n\n assertDefined(\n zerodevChainProvider,\n `No zerodev provider found for network id ${networkId}`\n );\n\n const paymasterProvider =\n bundlerProvider ??\n zerodevProvider.zerodevBundlerProvider ??\n ZerodevBundlerProvider.Pimlico;\n\n const paramName =\n rpcType === 'bundler' ? 'bundlerProvider' : 'paymasterProvider';\n\n return `${ZERODEV_RPC_BASE_URL}/${rpcType}/${zerodevChainProvider.clientId}?${paramName}=${paymasterProvider}`;\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
const require_getZerodevRpc = require('./getZerodevRpc-DhG6DLOa.cjs.js');
|
|
2
|
+
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
3
|
+
let _dynamic_labs_sdk_client_core = require("@dynamic-labs-sdk/client/core");
|
|
4
|
+
let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
|
|
5
|
+
let _dynamic_labs_sdk_evm = require("@dynamic-labs-sdk/evm");
|
|
6
|
+
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
7
|
+
let _zerodev_sdk = require("@zerodev/sdk");
|
|
8
|
+
let _dynamic_labs_sdk_evm_viem = require("@dynamic-labs-sdk/evm/viem");
|
|
9
|
+
let viem = require("viem");
|
|
10
|
+
|
|
11
|
+
//#region src/utils/getAllUserZerodevAddresses/getAllUserZerodevAddresses.ts
|
|
12
|
+
const getAllUserZerodevAddresses = (client) => {
|
|
13
|
+
return (client.user?.verifiedCredentials.filter((credential) => credential.walletProvider === _dynamic_labs_sdk_api_core.WalletProviderEnum.SmartContractWallet && credential.walletName?.toLowerCase().startsWith(require_getZerodevRpc.ZERODEV_METADATA.normalizedWalletName) && credential.address && credential.chain && (0, _dynamic_labs_sdk_client_core.getChainFromVerifiedCredentialChain)(credential.chain) === "EVM") ?? []).map((credential) => credential.address);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/createKernelClientForWalletAccount/createKernelClientForWalletAccount.ts
|
|
18
|
+
/**
|
|
19
|
+
* Creates a KernelClient instance for a given smart wallet account.
|
|
20
|
+
*
|
|
21
|
+
* @param params.smartWalletAccount - The smart wallet account to create the KernelClient for.
|
|
22
|
+
* @param [params.bundlerProvider] - A custom bundler provider to use
|
|
23
|
+
* @param [params.bundlerRpc] - A custom bundler RPC to use
|
|
24
|
+
* @param [params.networkId] - The network ID to use for the KernelClient.
|
|
25
|
+
* If not provided, the network ID will be fetched from the active network data.
|
|
26
|
+
* @param [params.paymasterRpc] - A custom paymaster RPC to use
|
|
27
|
+
* @param [params.gasTokenAddress] - The address of a custom ERC20 token to use as a gas token
|
|
28
|
+
* @param [params.withSponsorship] - Whether to use sponsorship for the KernelClient or not (default is true).
|
|
29
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
30
|
+
* @returns A promise that resolves to a KernelClient instance.
|
|
31
|
+
*/
|
|
32
|
+
const createKernelClientForWalletAccount = async ({ smartWalletAccount, withSponsorship = true, bundlerProvider, networkId, bundlerRpc: bundlerRpcOverride, paymasterRpc: paymasterRpcOverride, gasTokenAddress }, client = (0, _dynamic_labs_sdk_client_core.getDefaultClient)()) => {
|
|
33
|
+
let networkData;
|
|
34
|
+
if (networkId) {
|
|
35
|
+
networkData = (0, _dynamic_labs_sdk_client_core.getNetworkDataForNetworkId)({
|
|
36
|
+
chain: "EVM",
|
|
37
|
+
networkId
|
|
38
|
+
}, client);
|
|
39
|
+
(0, _dynamic_labs_sdk_client_core.assertDefined)(networkData, `No network data found for specified network ID: ${networkId}. Make sure the network is enabled for your project.`);
|
|
40
|
+
} else {
|
|
41
|
+
networkData = (await (0, _dynamic_labs_sdk_client.getActiveNetworkData)({ walletAccount: smartWalletAccount }, client)).networkData;
|
|
42
|
+
(0, _dynamic_labs_sdk_client_core.assertDefined)(networkData, `No active network data found for this wallet account.`);
|
|
43
|
+
}
|
|
44
|
+
const viemChain = (0, _dynamic_labs_sdk_evm_viem.mapNetworkDataToViemChain)(networkData);
|
|
45
|
+
const bundlerTransport = (0, viem.http)(bundlerRpcOverride ?? require_getZerodevRpc.getZerodevRpc({
|
|
46
|
+
bundlerProvider,
|
|
47
|
+
networkId: networkData.networkId,
|
|
48
|
+
rpcType: "bundler"
|
|
49
|
+
}, client));
|
|
50
|
+
const publicClient = (0, viem.createPublicClient)({
|
|
51
|
+
chain: viemChain,
|
|
52
|
+
transport: bundlerTransport
|
|
53
|
+
});
|
|
54
|
+
const account = await require_getZerodevRpc.createKernelAccount({
|
|
55
|
+
publicClient,
|
|
56
|
+
smartWalletAccount
|
|
57
|
+
}, client);
|
|
58
|
+
const paymasterRpc = paymasterRpcOverride ?? require_getZerodevRpc.getZerodevRpc({
|
|
59
|
+
bundlerProvider,
|
|
60
|
+
networkId: networkData.networkId,
|
|
61
|
+
rpcType: "paymaster"
|
|
62
|
+
}, client);
|
|
63
|
+
return (0, _zerodev_sdk.createKernelAccountClient)({
|
|
64
|
+
account,
|
|
65
|
+
bundlerTransport,
|
|
66
|
+
chain: viemChain,
|
|
67
|
+
client: publicClient,
|
|
68
|
+
userOperation: { estimateFeesPerGas: async ({ bundlerClient }) => (0, _zerodev_sdk.getUserOperationGasPrice)(bundlerClient) },
|
|
69
|
+
...withSponsorship ? require_getZerodevRpc.getPaymasterConfig({
|
|
70
|
+
chain: viemChain,
|
|
71
|
+
gasTokenAddress,
|
|
72
|
+
paymasterRpc
|
|
73
|
+
}) : {}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/utils/shouldSignWithEoa/shouldSignWithEoa.ts
|
|
79
|
+
const shouldSignWithEoa = async ({ kernelClient, smartWalletAccount }, client) => {
|
|
80
|
+
if (!require_getZerodevRpc.shouldUseEIP7702({ smartWalletAccount }, client)) return false;
|
|
81
|
+
return !await kernelClient.account.isDeployed();
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/utils/signMessage/signMessage.ts
|
|
86
|
+
const signMessage = async ({ walletAccount, message }, client) => {
|
|
87
|
+
const kernelClient = await createKernelClientForWalletAccount({ smartWalletAccount: walletAccount }, client);
|
|
88
|
+
if (await shouldSignWithEoa({
|
|
89
|
+
kernelClient,
|
|
90
|
+
smartWalletAccount: walletAccount
|
|
91
|
+
}, client)) {
|
|
92
|
+
const eoaWalletAccount = (0, _dynamic_labs_sdk_client.getOwnerWalletAccountForSmartWalletAccount)({ smartWalletAccount: walletAccount }, client);
|
|
93
|
+
(0, _dynamic_labs_sdk_client_core.assertDefined)(eoaWalletAccount, "Eoa wallet account not found");
|
|
94
|
+
const { signature } = await (0, _dynamic_labs_sdk_client.signMessage)({
|
|
95
|
+
message,
|
|
96
|
+
walletAccount: eoaWalletAccount
|
|
97
|
+
});
|
|
98
|
+
return { signature };
|
|
99
|
+
}
|
|
100
|
+
return { signature: await kernelClient.signMessage({ message }) };
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/utils/createZerodevWalletProvider/createZerodevWalletProvider.ts
|
|
105
|
+
const createZerodevWalletProvider = (client) => {
|
|
106
|
+
const chain = "EVM";
|
|
107
|
+
const walletProviderType = _dynamic_labs_sdk_api_core.WalletProviderEnum.SmartContractWallet;
|
|
108
|
+
const key = (0, _dynamic_labs_sdk_client_core.formatWalletProviderKey)({
|
|
109
|
+
chain,
|
|
110
|
+
displayName: require_getZerodevRpc.ZERODEV_METADATA.displayName,
|
|
111
|
+
walletProviderType
|
|
112
|
+
});
|
|
113
|
+
const getActiveNetworkId = async () => (0, _dynamic_labs_sdk_client_core.getActiveNetworkIdFromLastKnownRegistry)({
|
|
114
|
+
client,
|
|
115
|
+
walletProviderKey: key
|
|
116
|
+
});
|
|
117
|
+
const getConnectedAddresses = async () => {
|
|
118
|
+
return { addresses: getAllUserZerodevAddresses(client) };
|
|
119
|
+
};
|
|
120
|
+
const signMessage$1 = async ({ walletAccount, message }) => {
|
|
121
|
+
(0, _dynamic_labs_sdk_client_core.assertDefined)(walletAccount, "Wallet account is required");
|
|
122
|
+
if (!(0, _dynamic_labs_sdk_evm.isEvmWalletAccount)(walletAccount)) throw new _dynamic_labs_sdk_client.InvalidParamError(`walletAccount is not an EVM wallet account`);
|
|
123
|
+
return signMessage({
|
|
124
|
+
message,
|
|
125
|
+
walletAccount
|
|
126
|
+
}, client);
|
|
127
|
+
};
|
|
128
|
+
const switchActiveNetwork = async ({ networkId }) => {
|
|
129
|
+
if (!require_getZerodevRpc.getZerodevChainProviderForNetworkId({ networkId }, client)) throw new _dynamic_labs_sdk_client.UnrecognizedNetworkError({
|
|
130
|
+
networkId,
|
|
131
|
+
originalError: null,
|
|
132
|
+
walletProviderKey: key
|
|
133
|
+
});
|
|
134
|
+
return (0, _dynamic_labs_sdk_client_core.switchActiveNetworkInLastKnownRegistry)({
|
|
135
|
+
client,
|
|
136
|
+
networkId,
|
|
137
|
+
walletProviderKey: key
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
return {
|
|
141
|
+
chain,
|
|
142
|
+
getActiveNetworkId,
|
|
143
|
+
getConnectedAddresses,
|
|
144
|
+
groupKey: (0, _dynamic_labs_sdk_client_core.formatWalletProviderGroupKey)(require_getZerodevRpc.ZERODEV_METADATA.displayName),
|
|
145
|
+
key,
|
|
146
|
+
metadata: {
|
|
147
|
+
displayName: require_getZerodevRpc.ZERODEV_METADATA.displayName,
|
|
148
|
+
icon: require_getZerodevRpc.ZERODEV_METADATA.icon
|
|
149
|
+
},
|
|
150
|
+
signMessage: signMessage$1,
|
|
151
|
+
switchActiveNetwork,
|
|
152
|
+
walletProviderType
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/addZerodevExtension/addZerodevExtension.ts
|
|
158
|
+
const ZERODEV_EXTENSION_KEY = "zerodev";
|
|
159
|
+
/**
|
|
160
|
+
* Adds the ZeroDev extension to the Dynamic client.
|
|
161
|
+
*
|
|
162
|
+
* This extension enables Account Abstraction integration with ZeroDev
|
|
163
|
+
*
|
|
164
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
165
|
+
*/
|
|
166
|
+
const addZerodevExtension = (client = (0, _dynamic_labs_sdk_client_core.getDefaultClient)()) => {
|
|
167
|
+
if ((0, _dynamic_labs_sdk_client_core.hasExtension)({ extensionKey: ZERODEV_EXTENSION_KEY }, client)) return;
|
|
168
|
+
(0, _dynamic_labs_sdk_client_core.registerExtension)({ extensionKey: ZERODEV_EXTENSION_KEY }, client);
|
|
169
|
+
const walletProviderRegistry = (0, _dynamic_labs_sdk_client_core.getWalletProviderRegistry)(client);
|
|
170
|
+
const walletProvider = createZerodevWalletProvider(client);
|
|
171
|
+
walletProviderRegistry.register({
|
|
172
|
+
priority: _dynamic_labs_sdk_client_core.WalletProviderPriority.WALLET_SDK,
|
|
173
|
+
walletProvider
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/utils/prepareUserOperationWithKernelClient/prepareUserOperationWithKernelClient.ts
|
|
179
|
+
const prepareUserOperationWithKernelClient = async ({ kernelClient, transaction }) => {
|
|
180
|
+
const callData = await kernelClient.account.encodeCalls([{
|
|
181
|
+
data: transaction.data ?? "0x",
|
|
182
|
+
to: transaction.to,
|
|
183
|
+
value: transaction.value
|
|
184
|
+
}]);
|
|
185
|
+
return kernelClient.prepareUserOperation({ callData });
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/canSponsorTransaction/canSponsorTransaction.ts
|
|
190
|
+
/**
|
|
191
|
+
* Checks if a transaction can be sponsored
|
|
192
|
+
* @param params.transaction - The transaction to check if it can be sponsored
|
|
193
|
+
* @param params.kernelClient - The kernel client to use to check if the transaction can be sponsored. If no provided, a walletAccount is required to create a kernel client with sponsorship.
|
|
194
|
+
* @param params.walletAccount - The wallet account that will be used to send the transaction, Only required if no kernel client is provided
|
|
195
|
+
* @returns True if the transaction can be sponsored, false otherwise
|
|
196
|
+
*/
|
|
197
|
+
const canSponsorTransaction = async ({ walletAccount, transaction, kernelClient }) => {
|
|
198
|
+
let kernelClientToUse = kernelClient;
|
|
199
|
+
if (!kernelClientToUse) {
|
|
200
|
+
(0, _dynamic_labs_sdk_client_core.assertDefined)(walletAccount, "Please provide either a wallet account or a kernel client in the parameters");
|
|
201
|
+
kernelClientToUse = await createKernelClientForWalletAccount({ smartWalletAccount: walletAccount });
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
return (await prepareUserOperationWithKernelClient({
|
|
205
|
+
kernelClient: kernelClientToUse,
|
|
206
|
+
transaction
|
|
207
|
+
})).paymasterAndData !== "0x";
|
|
208
|
+
} catch {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/utils/calculateGasForUserOperation/calculateGasForUserOperation.ts
|
|
215
|
+
const calculateGasForUserOperation = ({ userOperationData }) => {
|
|
216
|
+
return (userOperationData.callGasLimit + userOperationData.verificationGasLimit + userOperationData.preVerificationGas) * userOperationData.maxFeePerGas;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/estimateTransactionGas/estimateTransactionGas.ts
|
|
221
|
+
/**
|
|
222
|
+
* Estimates the total gas for a transaction
|
|
223
|
+
* @param params.transaction - The transaction to estimate the gas for
|
|
224
|
+
* @param params.walletAccount - The wallet account that will be used to send the transaction
|
|
225
|
+
* @returns The gas for the transaction in wei
|
|
226
|
+
*/
|
|
227
|
+
const estimateTransactionGas = async ({ walletAccount, transaction }) => {
|
|
228
|
+
try {
|
|
229
|
+
return calculateGasForUserOperation({ userOperationData: await prepareUserOperationWithKernelClient({
|
|
230
|
+
kernelClient: await createKernelClientForWalletAccount({
|
|
231
|
+
smartWalletAccount: walletAccount,
|
|
232
|
+
withSponsorship: false
|
|
233
|
+
}),
|
|
234
|
+
transaction
|
|
235
|
+
}) });
|
|
236
|
+
} catch {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/isGasSponsorshipError/isGasSponsorshipError.ts
|
|
243
|
+
const isGasSponsorshipError = (err) => {
|
|
244
|
+
return err?.message?.includes("userOp did not match any gas sponsoring policies") || false;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/exports/index.ts
|
|
249
|
+
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_getZerodevRpc.name, require_getZerodevRpc.version);
|
|
250
|
+
|
|
251
|
+
//#endregion
|
|
252
|
+
exports.addZerodevExtension = addZerodevExtension;
|
|
253
|
+
exports.canSponsorTransaction = canSponsorTransaction;
|
|
254
|
+
exports.createKernelClientForWalletAccount = createKernelClientForWalletAccount;
|
|
255
|
+
exports.estimateTransactionGas = estimateTransactionGas;
|
|
256
|
+
exports.getSignerForSmartWalletAccount = require_getZerodevRpc.getSignerForSmartWalletAccount;
|
|
257
|
+
exports.isGasSponsorshipError = isGasSponsorshipError;
|
|
258
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","names":["WalletProviderEnum","ZERODEV_METADATA","networkData: NetworkData | undefined","getZerodevRpc","createKernelAccount","getPaymasterConfig","shouldUseEIP7702","chain: Chain","WalletProviderEnum","ZERODEV_METADATA","signMessage","InvalidParamError","signMessageUtils","getZerodevChainProviderForNetworkId","UnrecognizedNetworkError","WalletProviderPriority","name","version"],"sources":["../src/utils/getAllUserZerodevAddresses/getAllUserZerodevAddresses.ts","../src/createKernelClientForWalletAccount/createKernelClientForWalletAccount.ts","../src/utils/shouldSignWithEoa/shouldSignWithEoa.ts","../src/utils/signMessage/signMessage.ts","../src/utils/createZerodevWalletProvider/createZerodevWalletProvider.ts","../src/addZerodevExtension/addZerodevExtension.ts","../src/utils/prepareUserOperationWithKernelClient/prepareUserOperationWithKernelClient.ts","../src/canSponsorTransaction/canSponsorTransaction.ts","../src/utils/calculateGasForUserOperation/calculateGasForUserOperation.ts","../src/estimateTransactionGas/estimateTransactionGas.ts","../src/isGasSponsorshipError/isGasSponsorshipError.ts","../src/exports/index.ts"],"sourcesContent":["import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport { getChainFromVerifiedCredentialChain } from '@dynamic-labs-sdk/client/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { ZERODEV_METADATA } from '../../constants';\n\nexport const getAllUserZerodevAddresses = (client: DynamicClient): string[] => {\n const zerodevWalletCredentials =\n client.user?.verifiedCredentials.filter(\n (credential) =>\n credential.walletProvider === WalletProviderEnum.SmartContractWallet &&\n credential.walletName\n ?.toLowerCase()\n .startsWith(ZERODEV_METADATA.normalizedWalletName) &&\n credential.address &&\n credential.chain &&\n getChainFromVerifiedCredentialChain(credential.chain) === 'EVM'\n ) ?? [];\n\n const zerodevAddresses: string[] = zerodevWalletCredentials.map(\n // casting because we're already filtering out credentials without an address\n (credential) => credential.address as string\n );\n\n return zerodevAddresses;\n};\n","import type { NetworkData } from '@dynamic-labs-sdk/client';\nimport { getActiveNetworkData } from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n getDefaultClient,\n getNetworkDataForNetworkId,\n} from '@dynamic-labs-sdk/client/core';\nimport type { EvmWalletAccount } from '@dynamic-labs-sdk/evm';\nimport { mapNetworkDataToViemChain } from '@dynamic-labs-sdk/evm/viem';\nimport type { ZerodevBundlerProvider } from '@dynamic-labs/sdk-api-core';\nimport {\n createKernelAccountClient,\n getUserOperationGasPrice,\n} from '@zerodev/sdk';\nimport type { Hex } from 'viem';\nimport { createPublicClient, http } from 'viem';\n\nimport type { KernelClient } from '../KernelClient.types';\nimport { createKernelAccount } from '../utils/createKernelAccount';\nimport { getPaymasterConfig } from '../utils/getPaymasterConfig';\nimport { getZerodevRpc } from '../utils/getZerodevRpc';\n\ntype CreateKernelClientForWalletAccountParams = {\n bundlerProvider?: ZerodevBundlerProvider;\n bundlerRpc?: string;\n gasTokenAddress?: Hex;\n networkId?: string;\n paymasterRpc?: string;\n smartWalletAccount: EvmWalletAccount;\n withSponsorship?: boolean;\n};\n\n/**\n * Creates a KernelClient instance for a given smart wallet account.\n *\n * @param params.smartWalletAccount - The smart wallet account to create the KernelClient for.\n * @param [params.bundlerProvider] - A custom bundler provider to use\n * @param [params.bundlerRpc] - A custom bundler RPC to use\n * @param [params.networkId] - The network ID to use for the KernelClient.\n * If not provided, the network ID will be fetched from the active network data.\n * @param [params.paymasterRpc] - A custom paymaster RPC to use\n * @param [params.gasTokenAddress] - The address of a custom ERC20 token to use as a gas token\n * @param [params.withSponsorship] - Whether to use sponsorship for the KernelClient or not (default is true).\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to a KernelClient instance.\n */\nexport const createKernelClientForWalletAccount = async (\n {\n smartWalletAccount,\n withSponsorship = true,\n bundlerProvider,\n networkId,\n bundlerRpc: bundlerRpcOverride,\n paymasterRpc: paymasterRpcOverride,\n gasTokenAddress,\n }: CreateKernelClientForWalletAccountParams,\n client = getDefaultClient()\n): Promise<KernelClient> => {\n let networkData: NetworkData | undefined;\n\n if (networkId) {\n networkData = getNetworkDataForNetworkId(\n { chain: 'EVM', networkId },\n client\n );\n\n assertDefined(\n networkData,\n `No network data found for specified network ID: ${networkId}. Make sure the network is enabled for your project.`\n );\n } else {\n const activeNetworkData = await getActiveNetworkData(\n { walletAccount: smartWalletAccount },\n client\n );\n\n networkData = activeNetworkData.networkData;\n\n assertDefined(\n networkData,\n `No active network data found for this wallet account.`\n );\n }\n\n const viemChain = mapNetworkDataToViemChain(networkData);\n\n const bundlerRpc =\n bundlerRpcOverride ??\n getZerodevRpc(\n {\n bundlerProvider,\n networkId: networkData.networkId,\n rpcType: 'bundler',\n },\n client\n );\n\n const bundlerTransport = http(bundlerRpc);\n\n const publicClient = createPublicClient({\n chain: viemChain,\n transport: bundlerTransport,\n });\n\n const account = await createKernelAccount(\n {\n publicClient,\n smartWalletAccount,\n },\n client\n );\n\n const paymasterRpc =\n paymasterRpcOverride ??\n getZerodevRpc(\n {\n bundlerProvider,\n networkId: networkData.networkId,\n rpcType: 'paymaster',\n },\n client\n );\n\n const paymasterConfig = withSponsorship\n ? getPaymasterConfig({\n chain: viemChain,\n gasTokenAddress,\n paymasterRpc,\n })\n : {};\n\n return createKernelAccountClient({\n account,\n bundlerTransport,\n chain: viemChain,\n client: publicClient,\n userOperation: {\n estimateFeesPerGas: async ({ bundlerClient }) =>\n getUserOperationGasPrice(bundlerClient),\n },\n ...paymasterConfig,\n });\n};\n","import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport type { EvmWalletAccount } from '@dynamic-labs-sdk/evm';\n\nimport type { KernelClient } from '../../KernelClient.types';\nimport { shouldUseEIP7702 } from '../shouldUseEIP7702';\n\ntype ShouldSignWithEoaParams = {\n kernelClient: KernelClient;\n smartWalletAccount: EvmWalletAccount;\n};\n\nexport const shouldSignWithEoa = async (\n { kernelClient, smartWalletAccount }: ShouldSignWithEoaParams,\n client: DynamicClient\n) => {\n const useEIP7702 = shouldUseEIP7702({ smartWalletAccount }, client);\n\n if (!useEIP7702) {\n return false;\n }\n\n const isDeployed = await kernelClient.account.isDeployed();\n\n return !isDeployed;\n};\n","import {\n type DynamicClient,\n getOwnerWalletAccountForSmartWalletAccount,\n signMessage as signMessageWithWalletAccount,\n} from '@dynamic-labs-sdk/client';\nimport { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport type { EvmWalletAccount } from '@dynamic-labs-sdk/evm';\n\nimport { createKernelClientForWalletAccount } from '../../createKernelClientForWalletAccount';\nimport { shouldSignWithEoa } from '../shouldSignWithEoa';\n\ntype SignMessageParams = {\n message: string;\n walletAccount: EvmWalletAccount;\n};\n\nexport const signMessage = async (\n { walletAccount, message }: SignMessageParams,\n client: DynamicClient\n): Promise<{ signature: string }> => {\n const kernelClient = await createKernelClientForWalletAccount(\n { smartWalletAccount: walletAccount },\n client\n );\n\n const shouldUseEoa = await shouldSignWithEoa(\n {\n kernelClient,\n smartWalletAccount: walletAccount,\n },\n client\n );\n\n if (shouldUseEoa) {\n const eoaWalletAccount = getOwnerWalletAccountForSmartWalletAccount(\n { smartWalletAccount: walletAccount },\n client\n );\n\n assertDefined(eoaWalletAccount, 'Eoa wallet account not found');\n\n const { signature } = await signMessageWithWalletAccount({\n message,\n walletAccount: eoaWalletAccount,\n });\n\n return { signature };\n }\n\n const signature = await kernelClient.signMessage({ message });\n return { signature };\n};\n","import {\n type Chain,\n type DynamicClient,\n InvalidParamError,\n UnrecognizedNetworkError,\n type WalletAccount,\n} from '@dynamic-labs-sdk/client';\nimport {\n assertDefined,\n formatWalletProviderGroupKey,\n formatWalletProviderKey,\n getActiveNetworkIdFromLastKnownRegistry,\n switchActiveNetworkInLastKnownRegistry,\n} from '@dynamic-labs-sdk/client/core';\nimport {\n type EvmWalletProvider,\n isEvmWalletAccount,\n} from '@dynamic-labs-sdk/evm';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { ZERODEV_METADATA } from '../../constants';\nimport { getAllUserZerodevAddresses } from '../getAllUserZerodevAddresses';\nimport { getZerodevChainProviderForNetworkId } from '../getZerodevChainProviderForNetworkId';\nimport { signMessage as signMessageUtils } from '../signMessage';\n\nexport const createZerodevWalletProvider = (\n client: DynamicClient\n): EvmWalletProvider => {\n const chain: Chain = 'EVM';\n const walletProviderType = WalletProviderEnum.SmartContractWallet;\n const key = formatWalletProviderKey({\n chain,\n displayName: ZERODEV_METADATA.displayName,\n walletProviderType,\n });\n\n const getActiveNetworkId = async () =>\n getActiveNetworkIdFromLastKnownRegistry({\n client,\n walletProviderKey: key,\n });\n\n const getConnectedAddresses = async () => {\n const zerodevAddresses = getAllUserZerodevAddresses(client);\n\n return {\n addresses: zerodevAddresses,\n };\n };\n\n const signMessage = async ({\n walletAccount,\n message,\n }: {\n message: string;\n walletAccount?: WalletAccount;\n }) => {\n assertDefined(walletAccount, 'Wallet account is required');\n\n if (!isEvmWalletAccount(walletAccount)) {\n throw new InvalidParamError(`walletAccount is not an EVM wallet account`);\n }\n\n return signMessageUtils({ message, walletAccount }, client);\n };\n\n const switchActiveNetwork = async ({ networkId }: { networkId: string }) => {\n const isNetworkEnabled = getZerodevChainProviderForNetworkId(\n { networkId },\n client\n );\n\n if (!isNetworkEnabled) {\n throw new UnrecognizedNetworkError({\n networkId,\n originalError: null,\n walletProviderKey: key,\n });\n }\n\n return switchActiveNetworkInLastKnownRegistry({\n client,\n networkId,\n walletProviderKey: key,\n });\n };\n\n return {\n chain,\n getActiveNetworkId,\n getConnectedAddresses,\n groupKey: formatWalletProviderGroupKey(ZERODEV_METADATA.displayName),\n key,\n metadata: {\n displayName: ZERODEV_METADATA.displayName,\n icon: ZERODEV_METADATA.icon,\n },\n signMessage,\n switchActiveNetwork,\n walletProviderType,\n };\n};\n","import {\n WalletProviderPriority,\n getDefaultClient,\n getWalletProviderRegistry,\n hasExtension,\n registerExtension,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { createZerodevWalletProvider } from '../utils/createZerodevWalletProvider';\n\nexport const ZERODEV_EXTENSION_KEY = 'zerodev';\n\n/**\n * Adds the ZeroDev extension to the Dynamic client.\n *\n * This extension enables Account Abstraction integration with ZeroDev\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\nexport const addZerodevExtension = (client = getDefaultClient()) => {\n if (hasExtension({ extensionKey: ZERODEV_EXTENSION_KEY }, client)) {\n return;\n }\n\n registerExtension({ extensionKey: ZERODEV_EXTENSION_KEY }, client);\n\n const walletProviderRegistry = getWalletProviderRegistry(client);\n\n const walletProvider = createZerodevWalletProvider(client);\n\n walletProviderRegistry.register({\n priority: WalletProviderPriority.WALLET_SDK,\n walletProvider,\n });\n};\n","import type { Hex } from 'viem';\n\nimport type { KernelClient } from '../../KernelClient.types';\n\ntype PrepareUserOperationWithKernelClientParams = {\n kernelClient: KernelClient;\n transaction: {\n data?: Hex;\n to: Hex;\n value: bigint;\n };\n};\n\nexport const prepareUserOperationWithKernelClient = async ({\n kernelClient,\n transaction,\n}: PrepareUserOperationWithKernelClientParams) => {\n const callData = await kernelClient.account.encodeCalls([\n {\n data: transaction.data ?? '0x',\n to: transaction.to,\n value: transaction.value,\n },\n ]);\n\n return kernelClient.prepareUserOperation({\n callData,\n });\n};\n","import { assertDefined } from '@dynamic-labs-sdk/client/core';\nimport type { EvmWalletAccount } from '@dynamic-labs-sdk/evm';\nimport type { Hex } from 'viem';\n\nimport { createKernelClientForWalletAccount } from '../createKernelClientForWalletAccount';\nimport type { KernelClient } from '../KernelClient.types';\nimport { prepareUserOperationWithKernelClient } from '../utils/prepareUserOperationWithKernelClient';\n\ntype CanSponsorTransactionBaseParams = {\n transaction: {\n data?: Hex;\n to: Hex;\n value: bigint;\n };\n};\n\ntype CanSponsorTransactionWithWalletParams = CanSponsorTransactionBaseParams & {\n kernelClient?: never;\n walletAccount: EvmWalletAccount;\n};\n\ntype CanSponsorTransactionWithClientParams = CanSponsorTransactionBaseParams & {\n kernelClient: KernelClient;\n walletAccount?: never;\n};\n\nexport type CanSponsorTransactionParams =\n | CanSponsorTransactionWithWalletParams\n | CanSponsorTransactionWithClientParams;\n\n/**\n * Checks if a transaction can be sponsored\n * @param params.transaction - The transaction to check if it can be sponsored\n * @param params.kernelClient - The kernel client to use to check if the transaction can be sponsored. If no provided, a walletAccount is required to create a kernel client with sponsorship.\n * @param params.walletAccount - The wallet account that will be used to send the transaction, Only required if no kernel client is provided\n * @returns True if the transaction can be sponsored, false otherwise\n */\nexport const canSponsorTransaction = async ({\n walletAccount,\n transaction,\n kernelClient,\n}: CanSponsorTransactionParams): Promise<boolean> => {\n let kernelClientToUse = kernelClient;\n\n if (!kernelClientToUse) {\n assertDefined(\n walletAccount,\n 'Please provide either a wallet account or a kernel client in the parameters'\n );\n\n kernelClientToUse = await createKernelClientForWalletAccount({\n smartWalletAccount: walletAccount,\n });\n }\n\n try {\n const sponsorResult = await prepareUserOperationWithKernelClient({\n kernelClient: kernelClientToUse,\n transaction,\n });\n\n const hasPaymaster = sponsorResult.paymasterAndData !== '0x';\n\n return hasPaymaster;\n } catch {\n return false;\n }\n};\n","import type { UserOperation } from 'viem/account-abstraction';\n\ntype CalculateGasForUserOperationParams = {\n userOperationData: Pick<\n UserOperation,\n | 'callGasLimit'\n | 'verificationGasLimit'\n | 'preVerificationGas'\n | 'maxFeePerGas'\n >;\n};\n\nexport const calculateGasForUserOperation = ({\n userOperationData,\n}: CalculateGasForUserOperationParams): bigint => {\n // Sum all gas units\n const totalGasUnits =\n userOperationData.callGasLimit +\n userOperationData.verificationGasLimit +\n userOperationData.preVerificationGas;\n\n // Multiply by maxFeePerGas to get the total gas cost in wei\n const gasCost = totalGasUnits * userOperationData.maxFeePerGas;\n\n return gasCost;\n};\n","import type { EvmWalletAccount } from '@dynamic-labs-sdk/evm';\nimport type { Hex } from 'viem';\n\nimport { createKernelClientForWalletAccount } from '../createKernelClientForWalletAccount';\nimport { calculateGasForUserOperation } from '../utils/calculateGasForUserOperation';\nimport { prepareUserOperationWithKernelClient } from '../utils/prepareUserOperationWithKernelClient';\n\nexport type EstimateTransactionGasParams = {\n transaction: {\n data?: Hex;\n to: Hex;\n value: bigint;\n };\n walletAccount: EvmWalletAccount;\n};\n\n/**\n * Estimates the total gas for a transaction\n * @param params.transaction - The transaction to estimate the gas for\n * @param params.walletAccount - The wallet account that will be used to send the transaction\n * @returns The gas for the transaction in wei\n */\nexport const estimateTransactionGas = async ({\n walletAccount,\n transaction,\n}: EstimateTransactionGasParams): Promise<bigint | null> => {\n try {\n const kernelClientWithoutSponsorship =\n await createKernelClientForWalletAccount({\n smartWalletAccount: walletAccount,\n withSponsorship: false,\n });\n\n const unsponsoredUserOperation = await prepareUserOperationWithKernelClient(\n {\n kernelClient: kernelClientWithoutSponsorship,\n transaction,\n }\n );\n\n return calculateGasForUserOperation({\n userOperationData: unsponsoredUserOperation,\n });\n } catch {\n return null;\n }\n};\n","export const isGasSponsorshipError = (err: unknown): boolean => {\n const errorWithMessage = err as { message?: string } | undefined;\n\n return (\n errorWithMessage?.message?.includes(\n 'userOp did not match any gas sponsoring policies'\n ) || false\n );\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport { name, version } from '../../package.json';\n\nassertPackageVersion(name, version);\n\nexport { addZerodevExtension } from '../addZerodevExtension';\nexport { canSponsorTransaction } from '../canSponsorTransaction';\nexport { createKernelClientForWalletAccount } from '../createKernelClientForWalletAccount';\nexport { estimateTransactionGas } from '../estimateTransactionGas';\nexport { getSignerForSmartWalletAccount } from '../getSignerForSmartWalletAccount';\nexport { isGasSponsorshipError } from '../isGasSponsorshipError';\nexport type { KernelClient } from '../KernelClient.types';\n"],"mappings":"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"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { c as getSignerForSmartWalletAccount, d as ZERODEV_METADATA, f as name, i as shouldUseEIP7702, l as getZerodevChainProviderForNetworkId, n as getPaymasterConfig, p as version, r as createKernelAccount$1, t as getZerodevRpc } from "./getZerodevRpc-Bv9aCgYr.esm.js";
|
|
2
|
+
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
3
|
+
import { WalletProviderPriority, assertDefined, formatWalletProviderGroupKey, formatWalletProviderKey, getActiveNetworkIdFromLastKnownRegistry, getChainFromVerifiedCredentialChain, getDefaultClient, getNetworkDataForNetworkId, getWalletProviderRegistry, hasExtension, registerExtension, switchActiveNetworkInLastKnownRegistry } from "@dynamic-labs-sdk/client/core";
|
|
4
|
+
import { InvalidParamError, UnrecognizedNetworkError, getActiveNetworkData, getOwnerWalletAccountForSmartWalletAccount, signMessage } from "@dynamic-labs-sdk/client";
|
|
5
|
+
import { isEvmWalletAccount } from "@dynamic-labs-sdk/evm";
|
|
6
|
+
import { WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
7
|
+
import { createKernelAccountClient, getUserOperationGasPrice } from "@zerodev/sdk";
|
|
8
|
+
import { mapNetworkDataToViemChain } from "@dynamic-labs-sdk/evm/viem";
|
|
9
|
+
import { createPublicClient, http } from "viem";
|
|
10
|
+
|
|
11
|
+
//#region src/utils/getAllUserZerodevAddresses/getAllUserZerodevAddresses.ts
|
|
12
|
+
const getAllUserZerodevAddresses = (client) => {
|
|
13
|
+
return (client.user?.verifiedCredentials.filter((credential) => credential.walletProvider === WalletProviderEnum.SmartContractWallet && credential.walletName?.toLowerCase().startsWith(ZERODEV_METADATA.normalizedWalletName) && credential.address && credential.chain && getChainFromVerifiedCredentialChain(credential.chain) === "EVM") ?? []).map((credential) => credential.address);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/createKernelClientForWalletAccount/createKernelClientForWalletAccount.ts
|
|
18
|
+
/**
|
|
19
|
+
* Creates a KernelClient instance for a given smart wallet account.
|
|
20
|
+
*
|
|
21
|
+
* @param params.smartWalletAccount - The smart wallet account to create the KernelClient for.
|
|
22
|
+
* @param [params.bundlerProvider] - A custom bundler provider to use
|
|
23
|
+
* @param [params.bundlerRpc] - A custom bundler RPC to use
|
|
24
|
+
* @param [params.networkId] - The network ID to use for the KernelClient.
|
|
25
|
+
* If not provided, the network ID will be fetched from the active network data.
|
|
26
|
+
* @param [params.paymasterRpc] - A custom paymaster RPC to use
|
|
27
|
+
* @param [params.gasTokenAddress] - The address of a custom ERC20 token to use as a gas token
|
|
28
|
+
* @param [params.withSponsorship] - Whether to use sponsorship for the KernelClient or not (default is true).
|
|
29
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
30
|
+
* @returns A promise that resolves to a KernelClient instance.
|
|
31
|
+
*/
|
|
32
|
+
const createKernelClientForWalletAccount = async ({ smartWalletAccount, withSponsorship = true, bundlerProvider, networkId, bundlerRpc: bundlerRpcOverride, paymasterRpc: paymasterRpcOverride, gasTokenAddress }, client = getDefaultClient()) => {
|
|
33
|
+
let networkData;
|
|
34
|
+
if (networkId) {
|
|
35
|
+
networkData = getNetworkDataForNetworkId({
|
|
36
|
+
chain: "EVM",
|
|
37
|
+
networkId
|
|
38
|
+
}, client);
|
|
39
|
+
assertDefined(networkData, `No network data found for specified network ID: ${networkId}. Make sure the network is enabled for your project.`);
|
|
40
|
+
} else {
|
|
41
|
+
networkData = (await getActiveNetworkData({ walletAccount: smartWalletAccount }, client)).networkData;
|
|
42
|
+
assertDefined(networkData, `No active network data found for this wallet account.`);
|
|
43
|
+
}
|
|
44
|
+
const viemChain = mapNetworkDataToViemChain(networkData);
|
|
45
|
+
const bundlerTransport = http(bundlerRpcOverride ?? getZerodevRpc({
|
|
46
|
+
bundlerProvider,
|
|
47
|
+
networkId: networkData.networkId,
|
|
48
|
+
rpcType: "bundler"
|
|
49
|
+
}, client));
|
|
50
|
+
const publicClient = createPublicClient({
|
|
51
|
+
chain: viemChain,
|
|
52
|
+
transport: bundlerTransport
|
|
53
|
+
});
|
|
54
|
+
const account = await createKernelAccount$1({
|
|
55
|
+
publicClient,
|
|
56
|
+
smartWalletAccount
|
|
57
|
+
}, client);
|
|
58
|
+
const paymasterRpc = paymasterRpcOverride ?? getZerodevRpc({
|
|
59
|
+
bundlerProvider,
|
|
60
|
+
networkId: networkData.networkId,
|
|
61
|
+
rpcType: "paymaster"
|
|
62
|
+
}, client);
|
|
63
|
+
return createKernelAccountClient({
|
|
64
|
+
account,
|
|
65
|
+
bundlerTransport,
|
|
66
|
+
chain: viemChain,
|
|
67
|
+
client: publicClient,
|
|
68
|
+
userOperation: { estimateFeesPerGas: async ({ bundlerClient }) => getUserOperationGasPrice(bundlerClient) },
|
|
69
|
+
...withSponsorship ? getPaymasterConfig({
|
|
70
|
+
chain: viemChain,
|
|
71
|
+
gasTokenAddress,
|
|
72
|
+
paymasterRpc
|
|
73
|
+
}) : {}
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/utils/shouldSignWithEoa/shouldSignWithEoa.ts
|
|
79
|
+
const shouldSignWithEoa = async ({ kernelClient, smartWalletAccount }, client) => {
|
|
80
|
+
if (!shouldUseEIP7702({ smartWalletAccount }, client)) return false;
|
|
81
|
+
return !await kernelClient.account.isDeployed();
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/utils/signMessage/signMessage.ts
|
|
86
|
+
const signMessage$1 = async ({ walletAccount, message }, client) => {
|
|
87
|
+
const kernelClient = await createKernelClientForWalletAccount({ smartWalletAccount: walletAccount }, client);
|
|
88
|
+
if (await shouldSignWithEoa({
|
|
89
|
+
kernelClient,
|
|
90
|
+
smartWalletAccount: walletAccount
|
|
91
|
+
}, client)) {
|
|
92
|
+
const eoaWalletAccount = getOwnerWalletAccountForSmartWalletAccount({ smartWalletAccount: walletAccount }, client);
|
|
93
|
+
assertDefined(eoaWalletAccount, "Eoa wallet account not found");
|
|
94
|
+
const { signature } = await signMessage({
|
|
95
|
+
message,
|
|
96
|
+
walletAccount: eoaWalletAccount
|
|
97
|
+
});
|
|
98
|
+
return { signature };
|
|
99
|
+
}
|
|
100
|
+
return { signature: await kernelClient.signMessage({ message }) };
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/utils/createZerodevWalletProvider/createZerodevWalletProvider.ts
|
|
105
|
+
const createZerodevWalletProvider = (client) => {
|
|
106
|
+
const chain = "EVM";
|
|
107
|
+
const walletProviderType = WalletProviderEnum.SmartContractWallet;
|
|
108
|
+
const key = formatWalletProviderKey({
|
|
109
|
+
chain,
|
|
110
|
+
displayName: ZERODEV_METADATA.displayName,
|
|
111
|
+
walletProviderType
|
|
112
|
+
});
|
|
113
|
+
const getActiveNetworkId = async () => getActiveNetworkIdFromLastKnownRegistry({
|
|
114
|
+
client,
|
|
115
|
+
walletProviderKey: key
|
|
116
|
+
});
|
|
117
|
+
const getConnectedAddresses = async () => {
|
|
118
|
+
return { addresses: getAllUserZerodevAddresses(client) };
|
|
119
|
+
};
|
|
120
|
+
const signMessage$2 = async ({ walletAccount, message }) => {
|
|
121
|
+
assertDefined(walletAccount, "Wallet account is required");
|
|
122
|
+
if (!isEvmWalletAccount(walletAccount)) throw new InvalidParamError(`walletAccount is not an EVM wallet account`);
|
|
123
|
+
return signMessage$1({
|
|
124
|
+
message,
|
|
125
|
+
walletAccount
|
|
126
|
+
}, client);
|
|
127
|
+
};
|
|
128
|
+
const switchActiveNetwork = async ({ networkId }) => {
|
|
129
|
+
if (!getZerodevChainProviderForNetworkId({ networkId }, client)) throw new UnrecognizedNetworkError({
|
|
130
|
+
networkId,
|
|
131
|
+
originalError: null,
|
|
132
|
+
walletProviderKey: key
|
|
133
|
+
});
|
|
134
|
+
return switchActiveNetworkInLastKnownRegistry({
|
|
135
|
+
client,
|
|
136
|
+
networkId,
|
|
137
|
+
walletProviderKey: key
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
return {
|
|
141
|
+
chain,
|
|
142
|
+
getActiveNetworkId,
|
|
143
|
+
getConnectedAddresses,
|
|
144
|
+
groupKey: formatWalletProviderGroupKey(ZERODEV_METADATA.displayName),
|
|
145
|
+
key,
|
|
146
|
+
metadata: {
|
|
147
|
+
displayName: ZERODEV_METADATA.displayName,
|
|
148
|
+
icon: ZERODEV_METADATA.icon
|
|
149
|
+
},
|
|
150
|
+
signMessage: signMessage$2,
|
|
151
|
+
switchActiveNetwork,
|
|
152
|
+
walletProviderType
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/addZerodevExtension/addZerodevExtension.ts
|
|
158
|
+
const ZERODEV_EXTENSION_KEY = "zerodev";
|
|
159
|
+
/**
|
|
160
|
+
* Adds the ZeroDev extension to the Dynamic client.
|
|
161
|
+
*
|
|
162
|
+
* This extension enables Account Abstraction integration with ZeroDev
|
|
163
|
+
*
|
|
164
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
165
|
+
*/
|
|
166
|
+
const addZerodevExtension = (client = getDefaultClient()) => {
|
|
167
|
+
if (hasExtension({ extensionKey: ZERODEV_EXTENSION_KEY }, client)) return;
|
|
168
|
+
registerExtension({ extensionKey: ZERODEV_EXTENSION_KEY }, client);
|
|
169
|
+
const walletProviderRegistry = getWalletProviderRegistry(client);
|
|
170
|
+
const walletProvider = createZerodevWalletProvider(client);
|
|
171
|
+
walletProviderRegistry.register({
|
|
172
|
+
priority: WalletProviderPriority.WALLET_SDK,
|
|
173
|
+
walletProvider
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/utils/prepareUserOperationWithKernelClient/prepareUserOperationWithKernelClient.ts
|
|
179
|
+
const prepareUserOperationWithKernelClient = async ({ kernelClient, transaction }) => {
|
|
180
|
+
const callData = await kernelClient.account.encodeCalls([{
|
|
181
|
+
data: transaction.data ?? "0x",
|
|
182
|
+
to: transaction.to,
|
|
183
|
+
value: transaction.value
|
|
184
|
+
}]);
|
|
185
|
+
return kernelClient.prepareUserOperation({ callData });
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/canSponsorTransaction/canSponsorTransaction.ts
|
|
190
|
+
/**
|
|
191
|
+
* Checks if a transaction can be sponsored
|
|
192
|
+
* @param params.transaction - The transaction to check if it can be sponsored
|
|
193
|
+
* @param params.kernelClient - The kernel client to use to check if the transaction can be sponsored. If no provided, a walletAccount is required to create a kernel client with sponsorship.
|
|
194
|
+
* @param params.walletAccount - The wallet account that will be used to send the transaction, Only required if no kernel client is provided
|
|
195
|
+
* @returns True if the transaction can be sponsored, false otherwise
|
|
196
|
+
*/
|
|
197
|
+
const canSponsorTransaction = async ({ walletAccount, transaction, kernelClient }) => {
|
|
198
|
+
let kernelClientToUse = kernelClient;
|
|
199
|
+
if (!kernelClientToUse) {
|
|
200
|
+
assertDefined(walletAccount, "Please provide either a wallet account or a kernel client in the parameters");
|
|
201
|
+
kernelClientToUse = await createKernelClientForWalletAccount({ smartWalletAccount: walletAccount });
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
return (await prepareUserOperationWithKernelClient({
|
|
205
|
+
kernelClient: kernelClientToUse,
|
|
206
|
+
transaction
|
|
207
|
+
})).paymasterAndData !== "0x";
|
|
208
|
+
} catch {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/utils/calculateGasForUserOperation/calculateGasForUserOperation.ts
|
|
215
|
+
const calculateGasForUserOperation = ({ userOperationData }) => {
|
|
216
|
+
return (userOperationData.callGasLimit + userOperationData.verificationGasLimit + userOperationData.preVerificationGas) * userOperationData.maxFeePerGas;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/estimateTransactionGas/estimateTransactionGas.ts
|
|
221
|
+
/**
|
|
222
|
+
* Estimates the total gas for a transaction
|
|
223
|
+
* @param params.transaction - The transaction to estimate the gas for
|
|
224
|
+
* @param params.walletAccount - The wallet account that will be used to send the transaction
|
|
225
|
+
* @returns The gas for the transaction in wei
|
|
226
|
+
*/
|
|
227
|
+
const estimateTransactionGas = async ({ walletAccount, transaction }) => {
|
|
228
|
+
try {
|
|
229
|
+
return calculateGasForUserOperation({ userOperationData: await prepareUserOperationWithKernelClient({
|
|
230
|
+
kernelClient: await createKernelClientForWalletAccount({
|
|
231
|
+
smartWalletAccount: walletAccount,
|
|
232
|
+
withSponsorship: false
|
|
233
|
+
}),
|
|
234
|
+
transaction
|
|
235
|
+
}) });
|
|
236
|
+
} catch {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/isGasSponsorshipError/isGasSponsorshipError.ts
|
|
243
|
+
const isGasSponsorshipError = (err) => {
|
|
244
|
+
return err?.message?.includes("userOp did not match any gas sponsoring policies") || false;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/exports/index.ts
|
|
249
|
+
assertPackageVersion(name, version);
|
|
250
|
+
|
|
251
|
+
//#endregion
|
|
252
|
+
export { addZerodevExtension, canSponsorTransaction, createKernelClientForWalletAccount, estimateTransactionGas, getSignerForSmartWalletAccount, isGasSponsorshipError };
|
|
253
|
+
//# sourceMappingURL=index.esm.js.map
|