@aa-sdk/core 4.0.0-alpha.9 → 4.0.0-beta.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/esm/abis/EntryPointAbi_v7.js +1 -0
- package/dist/esm/abis/EntryPointAbi_v7.js.map +1 -1
- package/dist/esm/account/smartContractAccount.d.ts +50 -1
- package/dist/esm/account/smartContractAccount.js +111 -2
- package/dist/esm/account/smartContractAccount.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperation.d.ts +23 -0
- package/dist/esm/actions/smartAccount/buildUserOperation.js +23 -0
- package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.d.ts +39 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js +39 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.d.ts +54 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js +55 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +28 -0
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js +28 -0
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.d.ts +22 -0
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js +27 -6
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.d.ts +13 -0
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js +13 -0
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/initUserOperation.d.ts +13 -0
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js +14 -1
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js +2 -1
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendTransaction.d.ts +24 -0
- package/dist/esm/actions/smartAccount/sendTransaction.js +24 -0
- package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendTransactions.d.ts +23 -0
- package/dist/esm/actions/smartAccount/sendTransactions.js +23 -0
- package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendUserOperation.d.ts +21 -0
- package/dist/esm/actions/smartAccount/sendUserOperation.js +21 -0
- package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/types.d.ts +14 -0
- package/dist/esm/actions/smartAccount/types.js +1 -0
- package/dist/esm/actions/smartAccount/types.js.map +1 -1
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.d.ts +24 -0
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js +24 -0
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
- package/dist/esm/client/bundlerClient.d.ts +21 -0
- package/dist/esm/client/bundlerClient.js +32 -0
- package/dist/esm/client/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/bundlerClient.d.ts +41 -0
- package/dist/esm/client/decorators/bundlerClient.js +10 -0
- package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/smartAccountClient.d.ts +8 -0
- package/dist/esm/client/decorators/smartAccountClient.js +12 -1
- package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
- package/dist/esm/client/isSmartAccountClient.d.ts +16 -0
- package/dist/esm/client/isSmartAccountClient.js +16 -0
- package/dist/esm/client/isSmartAccountClient.js.map +1 -1
- package/dist/esm/client/schema.d.ts +12 -0
- package/dist/esm/client/schema.js +14 -0
- package/dist/esm/client/schema.js.map +1 -1
- package/dist/esm/client/smartAccountClient.js +53 -0
- package/dist/esm/client/smartAccountClient.js.map +1 -1
- package/dist/esm/client/types.js +1 -0
- package/dist/esm/client/types.js.map +1 -1
- package/dist/esm/ens/utils.d.ts +45 -0
- package/dist/esm/ens/utils.js +49 -0
- package/dist/esm/ens/utils.js.map +1 -1
- package/dist/esm/entrypoint/index.d.ts +14 -0
- package/dist/esm/entrypoint/index.js +30 -0
- package/dist/esm/entrypoint/index.js.map +1 -1
- package/dist/esm/entrypoint/types.d.ts +17 -0
- package/dist/esm/errors/account.d.ts +87 -4
- package/dist/esm/errors/account.js +88 -4
- package/dist/esm/errors/account.js.map +1 -1
- package/dist/esm/errors/base.d.ts +5 -0
- package/dist/esm/errors/base.js +5 -0
- package/dist/esm/errors/base.js.map +1 -1
- package/dist/esm/errors/client.d.ts +24 -0
- package/dist/esm/errors/client.js +24 -0
- package/dist/esm/errors/client.js.map +1 -1
- package/dist/esm/errors/entrypoint.d.ts +18 -0
- package/dist/esm/errors/entrypoint.js +18 -0
- package/dist/esm/errors/entrypoint.js.map +1 -1
- package/dist/esm/errors/signer.d.ts +8 -0
- package/dist/esm/errors/signer.js +8 -0
- package/dist/esm/errors/signer.js.map +1 -1
- package/dist/esm/errors/transaction.d.ts +14 -1
- package/dist/esm/errors/transaction.js +14 -1
- package/dist/esm/errors/transaction.js.map +1 -1
- package/dist/esm/errors/useroperation.d.ts +25 -0
- package/dist/esm/errors/useroperation.js +26 -0
- package/dist/esm/errors/useroperation.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logger.d.ts +91 -0
- package/dist/esm/logger.js +91 -0
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/middleware/actions.d.ts +14 -0
- package/dist/esm/middleware/actions.js +7 -0
- package/dist/esm/middleware/actions.js.map +1 -1
- package/dist/esm/middleware/defaults/feeEstimator.d.ts +20 -0
- package/dist/esm/middleware/defaults/feeEstimator.js +28 -0
- package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
- package/dist/esm/middleware/defaults/gasEstimator.d.ts +8 -0
- package/dist/esm/middleware/defaults/gasEstimator.js +8 -0
- package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/esm/middleware/defaults/paymasterAndData.d.ts +8 -0
- package/dist/esm/middleware/defaults/paymasterAndData.js +8 -0
- package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
- package/dist/esm/middleware/defaults/userOpSigner.d.ts +10 -0
- package/dist/esm/middleware/defaults/userOpSigner.js +10 -0
- package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
- package/dist/esm/middleware/erc7677middleware.d.ts +21 -0
- package/dist/esm/middleware/erc7677middleware.js +23 -0
- package/dist/esm/middleware/erc7677middleware.js.map +1 -1
- package/dist/esm/middleware/noopMiddleware.d.ts +6 -0
- package/dist/esm/middleware/noopMiddleware.js +6 -0
- package/dist/esm/middleware/noopMiddleware.js.map +1 -1
- package/dist/esm/middleware/types.js +1 -0
- package/dist/esm/middleware/types.js.map +1 -1
- package/dist/esm/signer/local-account.d.ts +96 -1
- package/dist/esm/signer/local-account.js +97 -2
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/signer/schema.d.ts +14 -0
- package/dist/esm/signer/schema.js +14 -0
- package/dist/esm/signer/schema.js.map +1 -1
- package/dist/esm/signer/types.d.ts +12 -0
- package/dist/esm/signer/types.js +1 -0
- package/dist/esm/signer/types.js.map +1 -1
- package/dist/esm/signer/utils.d.ts +20 -0
- package/dist/esm/signer/utils.js +27 -0
- package/dist/esm/signer/utils.js.map +1 -1
- package/dist/esm/signer/wallet-client.d.ts +92 -0
- package/dist/esm/signer/wallet-client.js +92 -0
- package/dist/esm/signer/wallet-client.js.map +1 -1
- package/dist/esm/transport/split.d.ts +32 -0
- package/dist/esm/transport/split.js +32 -0
- package/dist/esm/transport/split.js.map +1 -1
- package/dist/esm/types.d.ts +17 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/bigint.d.ts +45 -0
- package/dist/esm/utils/bigint.js +46 -0
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/utils/bytes.d.ts +9 -0
- package/dist/esm/utils/bytes.js +10 -1
- package/dist/esm/utils/bytes.js.map +1 -1
- package/dist/esm/utils/index.d.ts +86 -0
- package/dist/esm/utils/index.js +86 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/schema.d.ts +3 -0
- package/dist/esm/utils/schema.js +9 -0
- package/dist/esm/utils/schema.js.map +1 -1
- package/dist/esm/utils/stateOverride.js +2 -0
- package/dist/esm/utils/stateOverride.js.map +1 -1
- package/dist/esm/utils/types.d.ts +22 -0
- package/dist/esm/utils/types.js +1 -0
- package/dist/esm/utils/types.js.map +1 -1
- package/dist/esm/utils/userop.d.ts +79 -0
- package/dist/esm/utils/userop.js +83 -0
- package/dist/esm/utils/userop.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +3 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/account/smartContractAccount.d.ts +1 -1
- package/dist/types/account/smartContractAccount.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
- package/dist/types/client/smartAccountClient.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/transport/split.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +10 -11
- package/src/account/smartContractAccount.ts +3 -3
- package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +10 -10
- package/src/actions/smartAccount/internal/initUserOperation.ts +1 -1
- package/src/client/smartAccountClient.ts +7 -0
- package/src/index.ts +0 -1
- package/src/transport/split.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/cjs/abis/EntryPointAbi_v6.d.ts +0 -1018
- package/dist/cjs/abis/EntryPointAbi_v6.js +0 -1313
- package/dist/cjs/abis/EntryPointAbi_v6.js.map +0 -1
- package/dist/cjs/abis/EntryPointAbi_v7.d.ts +0 -775
- package/dist/cjs/abis/EntryPointAbi_v7.js +0 -661
- package/dist/cjs/abis/EntryPointAbi_v7.js.map +0 -1
- package/dist/cjs/abis/SimpleAccountAbi_v6.d.ts +0 -405
- package/dist/cjs/abis/SimpleAccountAbi_v6.js +0 -528
- package/dist/cjs/abis/SimpleAccountAbi_v6.js.map +0 -1
- package/dist/cjs/abis/SimpleAccountAbi_v7.d.ts +0 -410
- package/dist/cjs/abis/SimpleAccountAbi_v7.js +0 -538
- package/dist/cjs/abis/SimpleAccountAbi_v7.js.map +0 -1
- package/dist/cjs/abis/SimpleAccountFactoryAbi.d.ts +0 -55
- package/dist/cjs/abis/SimpleAccountFactoryAbi.js +0 -78
- package/dist/cjs/abis/SimpleAccountFactoryAbi.js.map +0 -1
- package/dist/cjs/account/smartContractAccount.d.ts +0 -74
- package/dist/cjs/account/smartContractAccount.js +0 -180
- package/dist/cjs/account/smartContractAccount.js.map +0 -1
- package/dist/cjs/actions/bundler/estimateUserOperationGas.d.ts +0 -8
- package/dist/cjs/actions/bundler/estimateUserOperationGas.js +0 -18
- package/dist/cjs/actions/bundler/estimateUserOperationGas.js.map +0 -1
- package/dist/cjs/actions/bundler/getSupportedEntryPoints.d.ts +0 -3
- package/dist/cjs/actions/bundler/getSupportedEntryPoints.js +0 -11
- package/dist/cjs/actions/bundler/getSupportedEntryPoints.js.map +0 -1
- package/dist/cjs/actions/bundler/getUserOperationByHash.d.ts +0 -6
- package/dist/cjs/actions/bundler/getUserOperationByHash.js +0 -11
- package/dist/cjs/actions/bundler/getUserOperationByHash.js.map +0 -1
- package/dist/cjs/actions/bundler/getUserOperationReceipt.d.ts +0 -6
- package/dist/cjs/actions/bundler/getUserOperationReceipt.js +0 -11
- package/dist/cjs/actions/bundler/getUserOperationReceipt.js.map +0 -1
- package/dist/cjs/actions/bundler/sendRawUserOperation.d.ts +0 -7
- package/dist/cjs/actions/bundler/sendRawUserOperation.js +0 -11
- package/dist/cjs/actions/bundler/sendRawUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/buildUserOperation.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/buildUserOperation.js +0 -25
- package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js +0 -39
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +0 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js +0 -62
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +0 -1
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js +0 -34
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +0 -1
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js +0 -64
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js +0 -23
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +0 -1
- package/dist/cjs/actions/smartAccount/getAddress.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/getAddress.js +0 -13
- package/dist/cjs/actions/smartAccount/getAddress.js.map +0 -1
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.d.ts +0 -7
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js +0 -42
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -10
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js +0 -47
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +0 -1
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.d.ts +0 -10
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js +0 -28
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/sendTransaction.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/sendTransaction.js +0 -35
- package/dist/cjs/actions/smartAccount/sendTransaction.js.map +0 -1
- package/dist/cjs/actions/smartAccount/sendTransactions.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/sendTransactions.js +0 -36
- package/dist/cjs/actions/smartAccount/sendTransactions.js.map +0 -1
- package/dist/cjs/actions/smartAccount/sendUserOperation.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/sendUserOperation.js +0 -31
- package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signMessage.d.ts +0 -6
- package/dist/cjs/actions/smartAccount/signMessage.js +0 -12
- package/dist/cjs/actions/smartAccount/signMessage.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signMessageWith6492.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/signMessageWith6492.js +0 -12
- package/dist/cjs/actions/smartAccount/signMessageWith6492.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signTypedData.d.ts +0 -10
- package/dist/cjs/actions/smartAccount/signTypedData.js +0 -12
- package/dist/cjs/actions/smartAccount/signTypedData.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signTypedDataWith6492.d.ts +0 -6
- package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js +0 -12
- package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signUserOperation.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/signUserOperation.js +0 -30
- package/dist/cjs/actions/smartAccount/signUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/types.d.ts +0 -42
- package/dist/cjs/actions/smartAccount/types.js +0 -3
- package/dist/cjs/actions/smartAccount/types.js.map +0 -1
- package/dist/cjs/actions/smartAccount/upgradeAccount.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/upgradeAccount.js +0 -38
- package/dist/cjs/actions/smartAccount/upgradeAccount.js.map +0 -1
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.d.ts +0 -3
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js +0 -36
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +0 -1
- package/dist/cjs/client/bundlerClient.d.ts +0 -10
- package/dist/cjs/client/bundlerClient.js +0 -51
- package/dist/cjs/client/bundlerClient.js.map +0 -1
- package/dist/cjs/client/decorators/bundlerClient.d.ts +0 -41
- package/dist/cjs/client/decorators/bundlerClient.js +0 -17
- package/dist/cjs/client/decorators/bundlerClient.js.map +0 -1
- package/dist/cjs/client/decorators/smartAccountClient.d.ts +0 -35
- package/dist/cjs/client/decorators/smartAccountClient.js +0 -43
- package/dist/cjs/client/decorators/smartAccountClient.js.map +0 -1
- package/dist/cjs/client/isSmartAccountClient.d.ts +0 -5
- package/dist/cjs/client/isSmartAccountClient.js +0 -18
- package/dist/cjs/client/isSmartAccountClient.js.map +0 -1
- package/dist/cjs/client/schema.d.ts +0 -767
- package/dist/cjs/client/schema.js +0 -63
- package/dist/cjs/client/schema.js.map +0 -1
- package/dist/cjs/client/smartAccountClient.d.ts +0 -33
- package/dist/cjs/client/smartAccountClient.js +0 -93
- package/dist/cjs/client/smartAccountClient.js.map +0 -1
- package/dist/cjs/client/types.d.ts +0 -21
- package/dist/cjs/client/types.js +0 -3
- package/dist/cjs/client/types.js.map +0 -1
- package/dist/cjs/ens/utils.d.ts +0 -6
- package/dist/cjs/ens/utils.js +0 -53
- package/dist/cjs/ens/utils.js.map +0 -1
- package/dist/cjs/entrypoint/0.6.d.ts +0 -1029
- package/dist/cjs/entrypoint/0.6.js +0 -49
- package/dist/cjs/entrypoint/0.6.js.map +0 -1
- package/dist/cjs/entrypoint/0.7.d.ts +0 -792
- package/dist/cjs/entrypoint/0.7.js +0 -88
- package/dist/cjs/entrypoint/0.7.js.map +0 -1
- package/dist/cjs/entrypoint/index.d.ts +0 -8
- package/dist/cjs/entrypoint/index.js +0 -53
- package/dist/cjs/entrypoint/index.js.map +0 -1
- package/dist/cjs/entrypoint/types.d.ts +0 -46
- package/dist/cjs/entrypoint/types.js +0 -3
- package/dist/cjs/entrypoint/types.js.map +0 -1
- package/dist/cjs/errors/account.d.ts +0 -47
- package/dist/cjs/errors/account.js +0 -140
- package/dist/cjs/errors/account.js.map +0 -1
- package/dist/cjs/errors/base.d.ts +0 -18
- package/dist/cjs/errors/base.js +0 -39
- package/dist/cjs/errors/base.js.map +0 -1
- package/dist/cjs/errors/client.d.ts +0 -14
- package/dist/cjs/errors/client.js +0 -44
- package/dist/cjs/errors/client.js.map +0 -1
- package/dist/cjs/errors/entrypoint.d.ts +0 -10
- package/dist/cjs/errors/entrypoint.js +0 -32
- package/dist/cjs/errors/entrypoint.js.map +0 -1
- package/dist/cjs/errors/signer.d.ts +0 -5
- package/dist/cjs/errors/signer.js +0 -20
- package/dist/cjs/errors/signer.js.map +0 -1
- package/dist/cjs/errors/transaction.d.ts +0 -10
- package/dist/cjs/errors/transaction.js +0 -29
- package/dist/cjs/errors/transaction.js.map +0 -1
- package/dist/cjs/errors/useroperation.d.ts +0 -10
- package/dist/cjs/errors/useroperation.js +0 -34
- package/dist/cjs/errors/useroperation.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -60
- package/dist/cjs/index.js +0 -170
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/logger.d.ts +0 -20
- package/dist/cjs/logger.js +0 -60
- package/dist/cjs/logger.js.map +0 -1
- package/dist/cjs/middleware/actions.d.ts +0 -12
- package/dist/cjs/middleware/actions.js +0 -21
- package/dist/cjs/middleware/actions.js.map +0 -1
- package/dist/cjs/middleware/defaults/feeEstimator.d.ts +0 -3
- package/dist/cjs/middleware/defaults/feeEstimator.js +0 -23
- package/dist/cjs/middleware/defaults/feeEstimator.js.map +0 -1
- package/dist/cjs/middleware/defaults/gasEstimator.d.ts +0 -3
- package/dist/cjs/middleware/defaults/gasEstimator.js +0 -28
- package/dist/cjs/middleware/defaults/gasEstimator.js.map +0 -1
- package/dist/cjs/middleware/defaults/paymasterAndData.d.ts +0 -2
- package/dist/cjs/middleware/defaults/paymasterAndData.js +0 -12
- package/dist/cjs/middleware/defaults/paymasterAndData.js.map +0 -1
- package/dist/cjs/middleware/defaults/userOpSigner.d.ts +0 -2
- package/dist/cjs/middleware/defaults/userOpSigner.js +0 -26
- package/dist/cjs/middleware/defaults/userOpSigner.js.map +0 -1
- package/dist/cjs/middleware/erc7677middleware.d.ts +0 -40
- package/dist/cjs/middleware/erc7677middleware.js +0 -77
- package/dist/cjs/middleware/erc7677middleware.js.map +0 -1
- package/dist/cjs/middleware/noopMiddleware.d.ts +0 -3
- package/dist/cjs/middleware/noopMiddleware.js +0 -8
- package/dist/cjs/middleware/noopMiddleware.js.map +0 -1
- package/dist/cjs/middleware/types.d.ts +0 -22
- package/dist/cjs/middleware/types.js +0 -3
- package/dist/cjs/middleware/types.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/signer/local-account.d.ts +0 -219
- package/dist/cjs/signer/local-account.js +0 -56
- package/dist/cjs/signer/local-account.js.map +0 -1
- package/dist/cjs/signer/schema.d.ts +0 -4
- package/dist/cjs/signer/schema.js +0 -16
- package/dist/cjs/signer/schema.js.map +0 -1
- package/dist/cjs/signer/types.d.ts +0 -15
- package/dist/cjs/signer/types.js +0 -3
- package/dist/cjs/signer/types.js.map +0 -1
- package/dist/cjs/signer/utils.d.ts +0 -7
- package/dist/cjs/signer/utils.js +0 -16
- package/dist/cjs/signer/utils.js.map +0 -1
- package/dist/cjs/signer/wallet-client.d.ts +0 -217
- package/dist/cjs/signer/wallet-client.js +0 -58
- package/dist/cjs/signer/wallet-client.js.map +0 -1
- package/dist/cjs/transport/split.d.ts +0 -9
- package/dist/cjs/transport/split.js +0 -26
- package/dist/cjs/transport/split.js.map +0 -1
- package/dist/cjs/types.d.ts +0 -158
- package/dist/cjs/types.js +0 -3
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/utils/bigint.d.ts +0 -10
- package/dist/cjs/utils/bigint.js +0 -55
- package/dist/cjs/utils/bigint.js.map +0 -1
- package/dist/cjs/utils/bytes.d.ts +0 -7
- package/dist/cjs/utils/bytes.js +0 -11
- package/dist/cjs/utils/bytes.js.map +0 -1
- package/dist/cjs/utils/defaults.d.ts +0 -4
- package/dist/cjs/utils/defaults.js +0 -19
- package/dist/cjs/utils/defaults.js.map +0 -1
- package/dist/cjs/utils/index.d.ts +0 -19
- package/dist/cjs/utils/index.js +0 -95
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/schema.d.ts +0 -25
- package/dist/cjs/utils/schema.js +0 -35
- package/dist/cjs/utils/schema.js.map +0 -1
- package/dist/cjs/utils/stateOverride.d.ts +0 -4
- package/dist/cjs/utils/stateOverride.js +0 -52
- package/dist/cjs/utils/stateOverride.js.map +0 -1
- package/dist/cjs/utils/testUtils.d.ts +0 -6
- package/dist/cjs/utils/testUtils.js +0 -33
- package/dist/cjs/utils/testUtils.js.map +0 -1
- package/dist/cjs/utils/types.d.ts +0 -16
- package/dist/cjs/utils/types.js +0 -3
- package/dist/cjs/utils/types.js.map +0 -1
- package/dist/cjs/utils/userop.d.ts +0 -49
- package/dist/cjs/utils/userop.js +0 -75
- package/dist/cjs/utils/userop.js.map +0 -1
- package/dist/cjs/version.d.ts +0 -1
- package/dist/cjs/version.js +0 -5
- package/dist/cjs/version.js.map +0 -1
- package/dist/esm/package.json +0 -1
package/dist/esm/ens/utils.js
CHANGED
|
@@ -1,18 +1,67 @@
|
|
|
1
1
|
import * as chains from "viem/chains";
|
|
2
2
|
import { mainnet } from "viem/chains";
|
|
3
3
|
export const ChainsById = new Map(Object.values(chains).map((x) => [x.id, x]));
|
|
4
|
+
/**
|
|
5
|
+
* Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { convertChainIdToCoinType } from "@aa-sdk/core";
|
|
10
|
+
* import { sepolia } from "viem/chains";
|
|
11
|
+
*
|
|
12
|
+
* const coinType = convertChainIdToCoinType(sepolia.id);
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param {number} chainId the blockchain chain ID that you want to convert to a coin type
|
|
16
|
+
* @returns {number} the corresponding coin type for the given chain ID
|
|
17
|
+
*/
|
|
4
18
|
export const convertChainIdToCoinType = (chainId) => {
|
|
5
19
|
if (chainId === mainnet.id) {
|
|
20
|
+
// this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)
|
|
6
21
|
return 60;
|
|
7
22
|
}
|
|
23
|
+
// this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains
|
|
8
24
|
return (0x80000000 | chainId) >>> 0;
|
|
9
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { convertChainIdToCoinType, convertCoinTypeToChainId } from "@aa-sdk/core";
|
|
32
|
+
* import { sepolia } from "viem/chains";
|
|
33
|
+
*
|
|
34
|
+
* const coinType = convertChainIdToCoinType(sepolia.id);
|
|
35
|
+
* const chainId = convertCoinTypeToChainId(coinType);
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param {number} coinType the coin type to be converted to a chain ID
|
|
39
|
+
* @returns {number} the corresponding chain ID
|
|
40
|
+
*/
|
|
10
41
|
export const convertCoinTypeToChainId = (coinType) => {
|
|
11
42
|
if (coinType === 60) {
|
|
43
|
+
// this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)
|
|
12
44
|
return mainnet.id;
|
|
13
45
|
}
|
|
46
|
+
// this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains
|
|
14
47
|
return (0x7fffffff & coinType) >> 0;
|
|
15
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Converts a coin type to its corresponding blockchain chain based on a predefined mapping.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { convertChainIdToCoinType, convertCoinTypeToChain } from "@aa-sdk/core";
|
|
55
|
+
* import { sepolia } from "viem/chains";
|
|
56
|
+
*
|
|
57
|
+
* const coinType = convertChainIdToCoinType(sepolia.id);
|
|
58
|
+
* const chain = convertCoinTypeToChain(coinType);
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @param {number} coinType The numerical identifier for the coin type
|
|
62
|
+
* @returns {Chain} The corresponding blockchain chain
|
|
63
|
+
* @throws {Error} If the coin type does not map to a supported chain
|
|
64
|
+
*/
|
|
16
65
|
export const convertCoinTypeToChain = (coinType) => {
|
|
17
66
|
const chainId = convertCoinTypeToChainId(coinType);
|
|
18
67
|
const chain = ChainsById.get(chainId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ens/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAc,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,UAAU,GAA8B,IAAI,GAAG,CAC1D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAC5C,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ens/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAc,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,UAAU,GAA8B,IAAI,GAAG,CAC1D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAC5C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE;IAClE,IAAI,OAAO,KAAK,OAAO,CAAC,EAAE,EAAE,CAAC;QAC3B,sHAAsH;QACtH,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,uLAAuL;IACvL,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAU,EAAE;IACnE,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QACpB,sHAAsH;QACtH,OAAO,OAAO,CAAC,EAAE,CAAC;IACpB,CAAC;IAED,uLAAuL;IACvL,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAS,EAAE;IAChE,MAAM,OAAO,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import * as chains from \"viem/chains\";\nimport { mainnet, type Chain } from \"viem/chains\";\n\nexport const ChainsById: Map<number, chains.Chain> = new Map(\n Object.values(chains).map((x) => [x.id, x])\n);\n\n/**\n * Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * ```\n *\n * @param {number} chainId the blockchain chain ID that you want to convert to a coin type\n * @returns {number} the corresponding coin type for the given chain ID\n */\nexport const convertChainIdToCoinType = (chainId: number): number => {\n if (chainId === mainnet.id) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return 60;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x80000000 | chainId) >>> 0;\n};\n\n/**\n * Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChainId } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chainId = convertCoinTypeToChainId(coinType);\n * ```\n *\n * @param {number} coinType the coin type to be converted to a chain ID\n * @returns {number} the corresponding chain ID\n */\nexport const convertCoinTypeToChainId = (coinType: number): number => {\n if (coinType === 60) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return mainnet.id;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x7fffffff & coinType) >> 0;\n};\n\n/**\n * Converts a coin type to its corresponding blockchain chain based on a predefined mapping.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChain } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chain = convertCoinTypeToChain(coinType);\n * ```\n *\n * @param {number} coinType The numerical identifier for the coin type\n * @returns {Chain} The corresponding blockchain chain\n * @throws {Error} If the coin type does not map to a supported chain\n */\nexport const convertCoinTypeToChain = (coinType: number): Chain => {\n const chainId = convertCoinTypeToChainId(coinType);\n const chain = ChainsById.get(chainId);\n if (!chain) {\n throw new Error(\"CoinType does not map to a supported chain\");\n }\n\n return chain;\n};\n"]}
|
|
@@ -2,6 +2,20 @@ import { type Chain } from "viem";
|
|
|
2
2
|
import type { DefaultEntryPointVersion, EntryPointDefRegistry, EntryPointRegistry, EntryPointVersion, GetEntryPointOptions } from "./types.js";
|
|
3
3
|
export declare const defaultEntryPointVersion: DefaultEntryPointVersion;
|
|
4
4
|
export declare const entryPointRegistry: EntryPointRegistry;
|
|
5
|
+
/**
|
|
6
|
+
* Checks if the given value is a valid key of the EntryPointRegistry.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { isEntryPointVersion } from "@aa-sdk/core";
|
|
11
|
+
*
|
|
12
|
+
* const valid = isEntryPointVersion("0.6.0");
|
|
13
|
+
* const invalid = isEntryPointVersion("0.8.0");
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param {*} value The value to be checked
|
|
17
|
+
* @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise
|
|
18
|
+
*/
|
|
5
19
|
export declare const isEntryPointVersion: (value: any) => value is keyof EntryPointRegistry<Chain>;
|
|
6
20
|
export declare function getEntryPoint<TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion, TChain extends Chain = Chain>(chain: TChain, options: GetEntryPointOptions<TEntryPointVersion>): EntryPointDefRegistry<TChain>[TEntryPointVersion];
|
|
7
21
|
export declare function getEntryPoint<TEntryPointVersion extends DefaultEntryPointVersion = DefaultEntryPointVersion, TChain extends Chain = Chain>(chain: TChain, options?: GetEntryPointOptions<TEntryPointVersion>): EntryPointDefRegistry<TChain>[TEntryPointVersion];
|
|
@@ -7,9 +7,39 @@ export const entryPointRegistry = {
|
|
|
7
7
|
"0.6.0": EntryPoint_v6,
|
|
8
8
|
"0.7.0": EntryPoint_v7,
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the given value is a valid key of the EntryPointRegistry.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { isEntryPointVersion } from "@aa-sdk/core";
|
|
16
|
+
*
|
|
17
|
+
* const valid = isEntryPointVersion("0.6.0");
|
|
18
|
+
* const invalid = isEntryPointVersion("0.8.0");
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param {*} value The value to be checked
|
|
22
|
+
* @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise
|
|
23
|
+
*/
|
|
10
24
|
export const isEntryPointVersion = (value) => {
|
|
11
25
|
return Object.keys(entryPointRegistry).includes(value);
|
|
12
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves the entry point definition for the specified chain and version, falling back to the default version if not provided. Throws an error if the entry point address cannot be found.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { getEntryPoint } from "@aa-sdk/core";
|
|
33
|
+
* import { sepolia } from "viem/chains";
|
|
34
|
+
*
|
|
35
|
+
* const entryPoint060 = getEntryPoint(sepolia);
|
|
36
|
+
* const entryPoint070 = getEntryPoint(sepolia, { version: "0.7.0" });
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param {Chain} chain The chain for which the entry point is being retrieved
|
|
40
|
+
* @param {GetEntryPointOptions<TEntryPointVersion>} options Options containing the version and address overrides for the entry point
|
|
41
|
+
* @returns {EntryPointDefRegistry<TChain>[EntryPointVersion]} The entry point definition for the specified chain and version
|
|
42
|
+
*/
|
|
13
43
|
export function getEntryPoint(chain, options) {
|
|
14
44
|
const { version = defaultEntryPointVersion, addressOverride } = options ?? {
|
|
15
45
|
version: defaultEntryPointVersion,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entrypoint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,aAAa,MAAM,UAAU,CAAC;AASrC,MAAM,CAAC,MAAM,wBAAwB,GAA6B,OAAO,CAAC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;CACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entrypoint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,aAAa,MAAM,UAAU,CAAC;AASrC,MAAM,CAAC,MAAM,wBAAwB,GAA6B,OAAO,CAAC;AAE1E,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD,OAAO,EAAE,aAAa;IACtB,OAAO,EAAE,aAAa;CACvB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAU,EACyB,EAAE;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAuBF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAI3B,KAAa,EACb,OAAiD;IAEjD,MAAM,EAAE,OAAO,GAAG,wBAAwB,EAAE,eAAe,EAAE,GAAG,OAAO,IAAI;QACzE,OAAO,EAAE,wBAAwB;KAClC,CAAC;IAEF,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC;IAC3E,MAAM,OAAO,GACX,eAAe;QACf,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;SAAM,IAAI,UAAU,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAC1C,OAAO;YACL,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,OAAO;YACP,KAAK;YACL,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAC1B,UAAU,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;YACvD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAChD,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { type Chain } from \"viem\";\nimport { EntryPointNotFoundError } from \"../errors/entrypoint.js\";\nimport EntryPoint_v6 from \"./0.6.js\";\nimport EntryPoint_v7 from \"./0.7.js\";\nimport type {\n DefaultEntryPointVersion,\n EntryPointDefRegistry,\n EntryPointRegistry,\n EntryPointVersion,\n GetEntryPointOptions,\n} from \"./types.js\";\n\nexport const defaultEntryPointVersion: DefaultEntryPointVersion = \"0.6.0\";\n\nexport const entryPointRegistry: EntryPointRegistry = {\n \"0.6.0\": EntryPoint_v6,\n \"0.7.0\": EntryPoint_v7,\n};\n\n/**\n * Checks if the given value is a valid key of the EntryPointRegistry.\n *\n * @example\n * ```ts\n * import { isEntryPointVersion } from \"@aa-sdk/core\";\n *\n * const valid = isEntryPointVersion(\"0.6.0\");\n * const invalid = isEntryPointVersion(\"0.8.0\");\n * ```\n *\n * @param {*} value The value to be checked\n * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise\n */\nexport const isEntryPointVersion = (\n value: any\n): value is keyof EntryPointRegistry => {\n return Object.keys(entryPointRegistry).includes(value);\n};\n\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<\n TEntryPointVersion extends DefaultEntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options?: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<TChain extends Chain = Chain>(\n chain: TChain,\n options?: GetEntryPointOptions<DefaultEntryPointVersion>\n): EntryPointDefRegistry<TChain>[DefaultEntryPointVersion];\n\n/**\n * Retrieves the entry point definition for the specified chain and version, falling back to the default version if not provided. Throws an error if the entry point address cannot be found.\n *\n * @example\n * ```ts\n * import { getEntryPoint } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const entryPoint060 = getEntryPoint(sepolia);\n * const entryPoint070 = getEntryPoint(sepolia, { version: \"0.7.0\" });\n * ```\n *\n * @param {Chain} chain The chain for which the entry point is being retrieved\n * @param {GetEntryPointOptions<TEntryPointVersion>} options Options containing the version and address overrides for the entry point\n * @returns {EntryPointDefRegistry<TChain>[EntryPointVersion]} The entry point definition for the specified chain and version\n */\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion,\n TChain extends Chain = Chain\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>\n): EntryPointDefRegistry<TChain>[EntryPointVersion] {\n const { version = defaultEntryPointVersion, addressOverride } = options ?? {\n version: defaultEntryPointVersion,\n };\n\n const entryPoint = entryPointRegistry[version ?? defaultEntryPointVersion];\n const address =\n addressOverride ??\n entryPoint.address[chain.id] ??\n entryPoint.address.default;\n if (!address) {\n throw new EntryPointNotFoundError(chain, version);\n }\n\n if (entryPoint.version === \"0.6.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n } else if (entryPoint.version === \"0.7.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n }\n\n throw new EntryPointNotFoundError(chain, version);\n}\n"]}
|
|
@@ -13,7 +13,24 @@ export type SupportedEntryPoint<TEntryPointVersion extends EntryPointVersion = E
|
|
|
13
13
|
version: TEntryPointVersion;
|
|
14
14
|
address: Record<TChain["id"] | "default", Address>;
|
|
15
15
|
abi: GetContractParameters<Transport, TChain, Account, TAbi>["abi"];
|
|
16
|
+
/**
|
|
17
|
+
* Generates a hash for a UserOperation valid from entry point version 0.6 onwards
|
|
18
|
+
*
|
|
19
|
+
* @param request - the UserOperation to get the hash for
|
|
20
|
+
* @param entryPointAddress - the entry point address that will be used to execute the UserOperation
|
|
21
|
+
* @param chainId - the chain on which this UserOperation will be executed
|
|
22
|
+
* @returns the hash of the UserOperation
|
|
23
|
+
*/
|
|
16
24
|
getUserOperationHash: (request: UserOperationRequest<TEntryPointVersion>, entryPointAddress: Address, chainId: number) => Hash;
|
|
25
|
+
/**
|
|
26
|
+
* Pack the user operation data into bytes for hashing for entry point version 0.6 onwards
|
|
27
|
+
* Reference:
|
|
28
|
+
* v6: https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.6/test/UserOp.ts#L16-L61
|
|
29
|
+
* v7: https://github.com/eth-infinitism/account-abstraction/blob/releases/v0.7/test/UserOp.ts#L28-L67
|
|
30
|
+
*
|
|
31
|
+
* @param request - the UserOperation to get the hash for
|
|
32
|
+
* @returns the hash of the UserOperation
|
|
33
|
+
*/
|
|
17
34
|
packUserOperation: (userOperation: UserOperationRequest<TEntryPointVersion>) => Hex;
|
|
18
35
|
};
|
|
19
36
|
export interface EntryPointRegistry<TChain extends Chain = Chain> extends EntryPointRegistryBase<SupportedEntryPoint<EntryPointVersion, TChain, Abi>> {
|
|
@@ -1,47 +1,130 @@
|
|
|
1
1
|
import type { Chain } from "viem";
|
|
2
2
|
import type { EntryPointVersion } from "../entrypoint/types.js";
|
|
3
3
|
import { BaseError } from "./base.js";
|
|
4
|
+
/**
|
|
5
|
+
* This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.
|
|
6
|
+
*/
|
|
4
7
|
export declare class AccountNotFoundError extends BaseError {
|
|
5
8
|
name: string;
|
|
6
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Constructor for initializing an error message indicating that an account could not be found to execute the specified action.
|
|
11
|
+
*/ constructor();
|
|
7
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.
|
|
15
|
+
* This error suggests providing an override via the `factoryAddress` parameter when creating an account.
|
|
16
|
+
*/
|
|
8
17
|
export declare class DefaultFactoryNotDefinedError extends BaseError {
|
|
9
18
|
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} accountType the type of account
|
|
23
|
+
* @param {Chain} chain the blockchain chain
|
|
24
|
+
* @param {EntryPointVersion} version the entry point version
|
|
25
|
+
*/
|
|
10
26
|
constructor(accountType: string, chain: Chain, version: EntryPointVersion);
|
|
11
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.
|
|
30
|
+
*/
|
|
12
31
|
export declare class GetCounterFactualAddressError extends BaseError {
|
|
13
32
|
name: string;
|
|
14
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Constructor for initializing an error message indicating the failure of fetching the counter-factual address.
|
|
35
|
+
*/ constructor();
|
|
15
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.
|
|
39
|
+
*/
|
|
16
40
|
export declare class UpgradesNotSupportedError extends BaseError {
|
|
17
41
|
name: string;
|
|
42
|
+
/**
|
|
43
|
+
* Error constructor for indicating that upgrades are not supported by the given account type.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} accountType The type of account that does not support upgrades
|
|
46
|
+
*/
|
|
18
47
|
constructor(accountType: string);
|
|
19
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Error thrown when attempting to sign a transaction that is not supported by smart contracts.
|
|
51
|
+
*/
|
|
20
52
|
export declare class SignTransactionNotSupportedError extends BaseError {
|
|
21
53
|
name: string;
|
|
22
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Throws an error indicating that signing a transaction is not supported by smart contracts.
|
|
56
|
+
*
|
|
57
|
+
|
|
58
|
+
*/ constructor();
|
|
23
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.
|
|
62
|
+
*/
|
|
24
63
|
export declare class FailedToGetStorageSlotError extends BaseError {
|
|
25
64
|
name: string;
|
|
65
|
+
/**
|
|
66
|
+
* Custom error message constructor for failing to get a specific storage slot.
|
|
67
|
+
*
|
|
68
|
+
* @param {string} slot The storage slot that failed to be accessed or retrieved
|
|
69
|
+
* @param {string} slotDescriptor A description of the storage slot, for additional context in the error message
|
|
70
|
+
*/
|
|
26
71
|
constructor(slot: string, slotDescriptor: string);
|
|
27
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Represents an error indicating that batch execution is not supported for a specific account type.
|
|
75
|
+
*/
|
|
28
76
|
export declare class BatchExecutionNotSupportedError extends BaseError {
|
|
29
77
|
name: string;
|
|
78
|
+
/**
|
|
79
|
+
* Constructs an error message indicating that batch execution is not supported by the specified account type.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} accountType the type of account that does not support batch execution
|
|
82
|
+
*/
|
|
30
83
|
constructor(accountType: string);
|
|
31
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Represents an error that occurs when an account requires an owner to execute but none is provided.
|
|
87
|
+
*/
|
|
32
88
|
export declare class AccountRequiresOwnerError extends BaseError {
|
|
33
89
|
name: string;
|
|
90
|
+
/**
|
|
91
|
+
* Constructs an error indicating that an account of the specified type requires an owner to execute.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} accountType The type of account that requires an owner
|
|
94
|
+
*/
|
|
34
95
|
constructor(accountType: string);
|
|
35
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.
|
|
99
|
+
*/
|
|
36
100
|
export declare class UpgradeToAndCallNotSupportedError extends BaseError {
|
|
37
101
|
name: string;
|
|
102
|
+
/**
|
|
103
|
+
* Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.
|
|
104
|
+
*
|
|
105
|
+
* @param {string} accountType The type of account that does not support `UpgradeToAndCall`
|
|
106
|
+
*/
|
|
38
107
|
constructor(accountType: string);
|
|
39
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Represents an error thrown when an account type does not match the expected type.
|
|
111
|
+
*/
|
|
40
112
|
export declare class IncorrectAccountType extends BaseError {
|
|
41
113
|
name: string;
|
|
114
|
+
/**
|
|
115
|
+
* Constructs an error object indicating that the expected account type does not match the actual account type.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} expected the expected account type
|
|
118
|
+
* @param {string} actual the actual account type that was received
|
|
119
|
+
*/
|
|
42
120
|
constructor(expected: string, actual: string);
|
|
43
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Error class indicating that a smart account operation requires a signer.
|
|
124
|
+
*/
|
|
44
125
|
export declare class SmartAccountWithSignerRequiredError extends BaseError {
|
|
45
126
|
name: string;
|
|
46
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.
|
|
129
|
+
*/ constructor();
|
|
47
130
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { BaseError } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.
|
|
4
|
+
*/
|
|
2
5
|
export class AccountNotFoundError extends BaseError {
|
|
3
|
-
|
|
6
|
+
// TODO: extend this further using docs path as well
|
|
7
|
+
/**
|
|
8
|
+
* Constructor for initializing an error message indicating that an account could not be found to execute the specified action.
|
|
9
|
+
*/ constructor() {
|
|
4
10
|
super("Could not find an Account to execute with this Action.");
|
|
5
11
|
Object.defineProperty(this, "name", {
|
|
6
12
|
enumerable: true,
|
|
@@ -10,7 +16,18 @@ export class AccountNotFoundError extends BaseError {
|
|
|
10
16
|
});
|
|
11
17
|
}
|
|
12
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.
|
|
21
|
+
* This error suggests providing an override via the `factoryAddress` parameter when creating an account.
|
|
22
|
+
*/
|
|
13
23
|
export class DefaultFactoryNotDefinedError extends BaseError {
|
|
24
|
+
/**
|
|
25
|
+
* Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} accountType the type of account
|
|
28
|
+
* @param {Chain} chain the blockchain chain
|
|
29
|
+
* @param {EntryPointVersion} version the entry point version
|
|
30
|
+
*/
|
|
14
31
|
constructor(accountType, chain, version) {
|
|
15
32
|
super([
|
|
16
33
|
`No default factory for ${accountType} found on chain ${chain.name} for entrypoint version ${version}`,
|
|
@@ -24,8 +41,13 @@ export class DefaultFactoryNotDefinedError extends BaseError {
|
|
|
24
41
|
});
|
|
25
42
|
}
|
|
26
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.
|
|
46
|
+
*/
|
|
27
47
|
export class GetCounterFactualAddressError extends BaseError {
|
|
28
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Constructor for initializing an error message indicating the failure of fetching the counter-factual address.
|
|
50
|
+
*/ constructor() {
|
|
29
51
|
super("getCounterFactualAddress failed");
|
|
30
52
|
Object.defineProperty(this, "name", {
|
|
31
53
|
enumerable: true,
|
|
@@ -35,7 +57,15 @@ export class GetCounterFactualAddressError extends BaseError {
|
|
|
35
57
|
});
|
|
36
58
|
}
|
|
37
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.
|
|
62
|
+
*/
|
|
38
63
|
export class UpgradesNotSupportedError extends BaseError {
|
|
64
|
+
/**
|
|
65
|
+
* Error constructor for indicating that upgrades are not supported by the given account type.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} accountType The type of account that does not support upgrades
|
|
68
|
+
*/
|
|
39
69
|
constructor(accountType) {
|
|
40
70
|
super(`Upgrades are not supported by ${accountType}`);
|
|
41
71
|
Object.defineProperty(this, "name", {
|
|
@@ -46,8 +76,15 @@ export class UpgradesNotSupportedError extends BaseError {
|
|
|
46
76
|
});
|
|
47
77
|
}
|
|
48
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Error thrown when attempting to sign a transaction that is not supported by smart contracts.
|
|
81
|
+
*/
|
|
49
82
|
export class SignTransactionNotSupportedError extends BaseError {
|
|
50
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Throws an error indicating that signing a transaction is not supported by smart contracts.
|
|
85
|
+
*
|
|
86
|
+
|
|
87
|
+
*/ constructor() {
|
|
51
88
|
super(`SignTransaction is not supported by smart contracts`);
|
|
52
89
|
Object.defineProperty(this, "name", {
|
|
53
90
|
enumerable: true,
|
|
@@ -57,7 +94,16 @@ export class SignTransactionNotSupportedError extends BaseError {
|
|
|
57
94
|
});
|
|
58
95
|
}
|
|
59
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.
|
|
99
|
+
*/
|
|
60
100
|
export class FailedToGetStorageSlotError extends BaseError {
|
|
101
|
+
/**
|
|
102
|
+
* Custom error message constructor for failing to get a specific storage slot.
|
|
103
|
+
*
|
|
104
|
+
* @param {string} slot The storage slot that failed to be accessed or retrieved
|
|
105
|
+
* @param {string} slotDescriptor A description of the storage slot, for additional context in the error message
|
|
106
|
+
*/
|
|
61
107
|
constructor(slot, slotDescriptor) {
|
|
62
108
|
super(`Failed to get storage slot ${slot} (${slotDescriptor})`);
|
|
63
109
|
Object.defineProperty(this, "name", {
|
|
@@ -68,7 +114,15 @@ export class FailedToGetStorageSlotError extends BaseError {
|
|
|
68
114
|
});
|
|
69
115
|
}
|
|
70
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Represents an error indicating that batch execution is not supported for a specific account type.
|
|
119
|
+
*/
|
|
71
120
|
export class BatchExecutionNotSupportedError extends BaseError {
|
|
121
|
+
/**
|
|
122
|
+
* Constructs an error message indicating that batch execution is not supported by the specified account type.
|
|
123
|
+
*
|
|
124
|
+
* @param {string} accountType the type of account that does not support batch execution
|
|
125
|
+
*/
|
|
72
126
|
constructor(accountType) {
|
|
73
127
|
super(`Batch execution is not supported by ${accountType}`);
|
|
74
128
|
Object.defineProperty(this, "name", {
|
|
@@ -79,7 +133,15 @@ export class BatchExecutionNotSupportedError extends BaseError {
|
|
|
79
133
|
});
|
|
80
134
|
}
|
|
81
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Represents an error that occurs when an account requires an owner to execute but none is provided.
|
|
138
|
+
*/
|
|
82
139
|
export class AccountRequiresOwnerError extends BaseError {
|
|
140
|
+
/**
|
|
141
|
+
* Constructs an error indicating that an account of the specified type requires an owner to execute.
|
|
142
|
+
*
|
|
143
|
+
* @param {string} accountType The type of account that requires an owner
|
|
144
|
+
*/
|
|
83
145
|
constructor(accountType) {
|
|
84
146
|
super(`Account of type ${accountType} requires an owner to execute`);
|
|
85
147
|
Object.defineProperty(this, "name", {
|
|
@@ -90,7 +152,15 @@ export class AccountRequiresOwnerError extends BaseError {
|
|
|
90
152
|
});
|
|
91
153
|
}
|
|
92
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.
|
|
157
|
+
*/
|
|
93
158
|
export class UpgradeToAndCallNotSupportedError extends BaseError {
|
|
159
|
+
/**
|
|
160
|
+
* Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.
|
|
161
|
+
*
|
|
162
|
+
* @param {string} accountType The type of account that does not support `UpgradeToAndCall`
|
|
163
|
+
*/
|
|
94
164
|
constructor(accountType) {
|
|
95
165
|
super(`UpgradeToAndCall is not supported by ${accountType}`);
|
|
96
166
|
Object.defineProperty(this, "name", {
|
|
@@ -101,7 +171,16 @@ export class UpgradeToAndCallNotSupportedError extends BaseError {
|
|
|
101
171
|
});
|
|
102
172
|
}
|
|
103
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Represents an error thrown when an account type does not match the expected type.
|
|
176
|
+
*/
|
|
104
177
|
export class IncorrectAccountType extends BaseError {
|
|
178
|
+
/**
|
|
179
|
+
* Constructs an error object indicating that the expected account type does not match the actual account type.
|
|
180
|
+
*
|
|
181
|
+
* @param {string} expected the expected account type
|
|
182
|
+
* @param {string} actual the actual account type that was received
|
|
183
|
+
*/
|
|
105
184
|
constructor(expected, actual) {
|
|
106
185
|
super(`Expected account type ${expected}, got ${actual}`);
|
|
107
186
|
Object.defineProperty(this, "name", {
|
|
@@ -112,8 +191,13 @@ export class IncorrectAccountType extends BaseError {
|
|
|
112
191
|
});
|
|
113
192
|
}
|
|
114
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Error class indicating that a smart account operation requires a signer.
|
|
196
|
+
*/
|
|
115
197
|
export class SmartAccountWithSignerRequiredError extends BaseError {
|
|
116
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.
|
|
200
|
+
*/ constructor() {
|
|
117
201
|
super("Smart account requires a signer");
|
|
118
202
|
Object.defineProperty(this, "name", {
|
|
119
203
|
enumerable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/errors/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/errors/account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD,oDAAoD;IAEpD;;OAEG,CAAC;QACF,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAPzD;;;;mBAAO,sBAAsB;WAAC;IAQvC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,SAAS;IAG1D;;;;;;OAMG;IACH,YAAY,WAAmB,EAAE,KAAY,EAAE,OAA0B;QACvE,KAAK,CACH;YACE,0BAA0B,WAAW,mBAAmB,KAAK,CAAC,IAAI,2BAA2B,OAAO,EAAE;YACtG,gFAAgF;SACjF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAfK;;;;mBAAO,+BAA+B;WAAC;IAgBhD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,SAAS;IAG1D;;OAEG,CAAC;QACF,KAAK,CAAC,iCAAiC,CAAC,CAAC;QALlC;;;;mBAAO,+BAA+B;WAAC;IAMhD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAGtD;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAC;QAR/C;;;;mBAAO,sBAAsB;WAAC;IASvC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,gCAAiC,SAAQ,SAAS;IAG7D;;;;OAIG,CAAC;QACF,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAPtD;;;;mBAAO,6BAA6B;WAAC;IAQ9C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,SAAS;IAGxD;;;;;OAKG;IACH,YAAY,IAAY,EAAE,cAAsB;QAC9C,KAAK,CAAC,8BAA8B,IAAI,KAAK,cAAc,GAAG,CAAC,CAAC;QATzD;;;;mBAAO,6BAA6B;WAAC;IAU9C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,SAAS;IAG5D;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,uCAAuC,WAAW,EAAE,CAAC,CAAC;QARrD;;;;mBAAO,iCAAiC;WAAC;IASlD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IAGtD;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,mBAAmB,WAAW,+BAA+B,CAAC,CAAC;QAR9D;;;;mBAAO,2BAA2B;WAAC;IAS5C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iCAAkC,SAAQ,SAAS;IAG9D;;;;OAIG;IACH,YAAY,WAAmB;QAC7B,KAAK,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;QARtD;;;;mBAAO,mCAAmC;WAAC;IASpD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAGjD;;;;;OAKG;IACH,YAAY,QAAgB,EAAE,MAAc;QAC1C,KAAK,CAAC,yBAAyB,QAAQ,SAAS,MAAM,EAAE,CAAC,CAAC;QATnD;;;;mBAAO,2BAA2B;WAAC;IAU5C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,SAAS;IAGhE;;OAEG,CAAC;QACF,KAAK,CAAC,iCAAiC,CAAC,CAAC;QALlC;;;;mBAAO,qCAAqC;WAAC;IAMtD,CAAC;CACF","sourcesContent":["import type { Chain } from \"viem\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.\n */\nexport class AccountNotFoundError extends BaseError {\n override name = \"AccountNotFoundError\";\n\n // TODO: extend this further using docs path as well\n\n /**\n * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.\n */ constructor() {\n super(\"Could not find an Account to execute with this Action.\");\n }\n}\n\n/**\n * Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.\n * This error suggests providing an override via the `factoryAddress` parameter when creating an account.\n */\nexport class DefaultFactoryNotDefinedError extends BaseError {\n override name = \"DefaultFactoryNotDefinedError\";\n\n /**\n * Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.\n *\n * @param {string} accountType the type of account\n * @param {Chain} chain the blockchain chain\n * @param {EntryPointVersion} version the entry point version\n */\n constructor(accountType: string, chain: Chain, version: EntryPointVersion) {\n super(\n [\n `No default factory for ${accountType} found on chain ${chain.name} for entrypoint version ${version}`,\n \"Supply an override via the `factoryAddress` parameter when creating an account\",\n ].join(\"\\n\")\n );\n }\n}\n\n/**\n * Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.\n */\nexport class GetCounterFactualAddressError extends BaseError {\n override name = \"GetCounterFactualAddressError\";\n\n /**\n * Constructor for initializing an error message indicating the failure of fetching the counter-factual address.\n */ constructor() {\n super(\"getCounterFactualAddress failed\");\n }\n}\n\n/**\n * An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.\n */\nexport class UpgradesNotSupportedError extends BaseError {\n override name = \"UpgradesNotSupported\";\n\n /**\n * Error constructor for indicating that upgrades are not supported by the given account type.\n *\n * @param {string} accountType The type of account that does not support upgrades\n */\n constructor(accountType: string) {\n super(`Upgrades are not supported by ${accountType}`);\n }\n}\n\n/**\n * Error thrown when attempting to sign a transaction that is not supported by smart contracts.\n */\nexport class SignTransactionNotSupportedError extends BaseError {\n override name = \"SignTransactionNotSupported\";\n\n /**\n * Throws an error indicating that signing a transaction is not supported by smart contracts.\n *\n \n */ constructor() {\n super(`SignTransaction is not supported by smart contracts`);\n }\n}\n\n/**\n * Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.\n */\nexport class FailedToGetStorageSlotError extends BaseError {\n override name = \"FailedToGetStorageSlotError\";\n\n /**\n * Custom error message constructor for failing to get a specific storage slot.\n *\n * @param {string} slot The storage slot that failed to be accessed or retrieved\n * @param {string} slotDescriptor A description of the storage slot, for additional context in the error message\n */\n constructor(slot: string, slotDescriptor: string) {\n super(`Failed to get storage slot ${slot} (${slotDescriptor})`);\n }\n}\n\n/**\n * Represents an error indicating that batch execution is not supported for a specific account type.\n */\nexport class BatchExecutionNotSupportedError extends BaseError {\n override name = \"BatchExecutionNotSupportedError\";\n\n /**\n * Constructs an error message indicating that batch execution is not supported by the specified account type.\n *\n * @param {string} accountType the type of account that does not support batch execution\n */\n constructor(accountType: string) {\n super(`Batch execution is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error that occurs when an account requires an owner to execute but none is provided.\n */\nexport class AccountRequiresOwnerError extends BaseError {\n override name = \"AccountRequiresOwnerError\";\n\n /**\n * Constructs an error indicating that an account of the specified type requires an owner to execute.\n *\n * @param {string} accountType The type of account that requires an owner\n */\n constructor(accountType: string) {\n super(`Account of type ${accountType} requires an owner to execute`);\n }\n}\n\n/**\n * Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.\n */\nexport class UpgradeToAndCallNotSupportedError extends BaseError {\n override name = \"UpgradeToAndCallNotSupportedError\";\n\n /**\n * Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.\n *\n * @param {string} accountType The type of account that does not support `UpgradeToAndCall`\n */\n constructor(accountType: string) {\n super(`UpgradeToAndCall is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error thrown when an account type does not match the expected type.\n */\nexport class IncorrectAccountType extends BaseError {\n override name = \"IncorrectAccountTypeError\";\n\n /**\n * Constructs an error object indicating that the expected account type does not match the actual account type.\n *\n * @param {string} expected the expected account type\n * @param {string} actual the actual account type that was received\n */\n constructor(expected: string, actual: string) {\n super(`Expected account type ${expected}, got ${actual}`);\n }\n}\n\n/**\n * Error class indicating that a smart account operation requires a signer.\n */\nexport class SmartAccountWithSignerRequiredError extends BaseError {\n override name = \"SmartAccountWithSignerRequiredError\";\n\n /**\n * Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.\n */ constructor() {\n super(\"Smart account requires a signer\");\n }\n}\n"]}
|
|
@@ -10,6 +10,11 @@ type BaseErrorParameters = {
|
|
|
10
10
|
cause: BaseError | Error;
|
|
11
11
|
details?: never;
|
|
12
12
|
});
|
|
13
|
+
/**
|
|
14
|
+
* A custom error class that extends from `ViemBaseError`. This class allows for error messages to include links to relevant documentation based on provided `docsPath` and `docsSlug` parameters.
|
|
15
|
+
* This is based on on viem's BaseError type (obviously from the import and extend)
|
|
16
|
+
* we want the errors here to point to our docs if we supply a docsPath though
|
|
17
|
+
*/
|
|
13
18
|
export declare class BaseError extends ViemBaseError {
|
|
14
19
|
name: string;
|
|
15
20
|
version: string;
|
package/dist/esm/errors/base.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { BaseError as ViemBaseError } from "viem";
|
|
2
2
|
import { VERSION } from "../version.js";
|
|
3
|
+
/**
|
|
4
|
+
* A custom error class that extends from `ViemBaseError`. This class allows for error messages to include links to relevant documentation based on provided `docsPath` and `docsSlug` parameters.
|
|
5
|
+
* This is based on on viem's BaseError type (obviously from the import and extend)
|
|
6
|
+
* we want the errors here to point to our docs if we supply a docsPath though
|
|
7
|
+
*/
|
|
3
8
|
export class BaseError extends ViemBaseError {
|
|
4
9
|
constructor(shortMessage, args = {}) {
|
|
5
10
|
super(shortMessage, args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/errors/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAiBxC;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,aAAa;IAI1C,YAAY,YAAoB,EAAE,OAA4B,EAAE;QAC9D,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAJnB;;;;mBAAO,YAAY;WAAC;QACpB;;;;mBAAU,OAAO;WAAC;QAKzB,MAAM,QAAQ,GACZ,IAAI,CAAC,KAAK,YAAY,SAAS;YAC7B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;YACtC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;QAEpB,IAAI,CAAC,OAAO,GAAG;YACb,YAAY,IAAI,oBAAoB;YACpC,EAAE;YACF,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,GAAG,CAAC,QAAQ;gBACV,CAAC,CAAC;oBACE,uCAAuC,QAAQ,GAC7C,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EACxC,EAAE;iBACH;gBACH,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,YAAY,IAAI,CAAC,OAAO,EAAE;SAC3B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF","sourcesContent":["import { BaseError as ViemBaseError } from \"viem\";\nimport { VERSION } from \"../version.js\";\n\ntype BaseErrorParameters = {\n docsPath?: string;\n docsSlug?: string;\n metaMessages?: string[];\n} & (\n | {\n cause?: never;\n details?: string;\n }\n | {\n cause: BaseError | Error;\n details?: never;\n }\n);\n\n/**\n * A custom error class that extends from `ViemBaseError`. This class allows for error messages to include links to relevant documentation based on provided `docsPath` and `docsSlug` parameters.\n * This is based on on viem's BaseError type (obviously from the import and extend)\n * we want the errors here to point to our docs if we supply a docsPath though\n */\nexport class BaseError extends ViemBaseError {\n override name = \"AASDKError\";\n override version = VERSION;\n\n constructor(shortMessage: string, args: BaseErrorParameters = {}) {\n super(shortMessage, args);\n\n const docsPath =\n args.cause instanceof BaseError\n ? args.cause.docsPath || args.docsPath\n : args.docsPath;\n\n this.message = [\n shortMessage || \"An error occurred.\",\n \"\",\n ...(args.metaMessages ? [...args.metaMessages, \"\"] : []),\n ...(docsPath\n ? [\n `Docs: https://accountkit.alchemy.com${docsPath}${\n args.docsSlug ? `#${args.docsSlug}` : \"\"\n }`,\n ]\n : []),\n ...(this.details ? [`Details: ${this.details}`] : []),\n `Version: ${this.version}`,\n ].join(\"\\n\");\n }\n}\n"]}
|
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
import type { Client } from "viem";
|
|
2
2
|
import { BaseError } from "./base.js";
|
|
3
|
+
/**
|
|
4
|
+
* Represents an error thrown when a client is not compatible with the expected client type for a specific method. The error message provides guidance on how to create a compatible client.
|
|
5
|
+
*/
|
|
3
6
|
export declare class IncompatibleClientError extends BaseError {
|
|
4
7
|
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* Throws an error when the client type does not match the expected client type.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} expectedClient The expected type of the client.
|
|
12
|
+
* @param {string} method The method that was called.
|
|
13
|
+
* @param {Client} client The client instance.
|
|
14
|
+
*/
|
|
5
15
|
constructor(expectedClient: string, method: string, client: Client);
|
|
6
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents an error that occurs when an invalid RPC URL is provided. This class extends the `BaseError` class and includes the invalid URL in the error message.
|
|
19
|
+
*/
|
|
7
20
|
export declare class InvalidRpcUrlError extends BaseError {
|
|
8
21
|
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* Creates an instance of an error with a message indicating an invalid RPC URL.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} [rpcUrl] The invalid RPC URL that caused the error
|
|
26
|
+
*/
|
|
9
27
|
constructor(rpcUrl?: string);
|
|
10
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Error class representing a "Chain Not Found" error, typically thrown when no chain is supplied to the client.
|
|
31
|
+
*/
|
|
11
32
|
export declare class ChainNotFoundError extends BaseError {
|
|
12
33
|
name: string;
|
|
34
|
+
/**
|
|
35
|
+
* Initializes a new instance of the error message with a default message indicating that no chain was supplied to the client.
|
|
36
|
+
*/
|
|
13
37
|
constructor();
|
|
14
38
|
}
|