@aa-sdk/core 4.0.0-alpha.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/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/cjs/abis/EntryPointAbi_v6.d.ts +1018 -0
- package/dist/cjs/abis/EntryPointAbi_v6.js +1313 -0
- package/dist/cjs/abis/EntryPointAbi_v6.js.map +1 -0
- package/dist/cjs/abis/EntryPointAbi_v7.d.ts +775 -0
- package/dist/cjs/abis/EntryPointAbi_v7.js +661 -0
- package/dist/cjs/abis/EntryPointAbi_v7.js.map +1 -0
- package/dist/cjs/abis/SimpleAccountAbi_v6.d.ts +405 -0
- package/dist/cjs/abis/SimpleAccountAbi_v6.js +528 -0
- package/dist/cjs/abis/SimpleAccountAbi_v6.js.map +1 -0
- package/dist/cjs/abis/SimpleAccountAbi_v7.d.ts +410 -0
- package/dist/cjs/abis/SimpleAccountAbi_v7.js +538 -0
- package/dist/cjs/abis/SimpleAccountAbi_v7.js.map +1 -0
- package/dist/cjs/abis/SimpleAccountFactoryAbi.d.ts +55 -0
- package/dist/cjs/abis/SimpleAccountFactoryAbi.js +78 -0
- package/dist/cjs/abis/SimpleAccountFactoryAbi.js.map +1 -0
- package/dist/cjs/account/base.d.ts +49 -0
- package/dist/cjs/account/base.js +257 -0
- package/dist/cjs/account/base.js.map +1 -0
- package/dist/cjs/account/schema.d.ts +100 -0
- package/dist/cjs/account/schema.js +43 -0
- package/dist/cjs/account/schema.js.map +1 -0
- package/dist/cjs/account/simple.d.ts +14 -0
- package/dist/cjs/account/simple.js +119 -0
- package/dist/cjs/account/simple.js.map +1 -0
- package/dist/cjs/account/smartContractAccount.d.ts +68 -0
- package/dist/cjs/account/smartContractAccount.js +174 -0
- package/dist/cjs/account/smartContractAccount.js.map +1 -0
- package/dist/cjs/account/types.d.ts +30 -0
- package/dist/cjs/account/types.js +3 -0
- package/dist/cjs/account/types.js.map +1 -0
- package/dist/cjs/actions/bundler/estimateUserOperationGas.d.ts +8 -0
- package/dist/cjs/actions/bundler/estimateUserOperationGas.js +18 -0
- package/dist/cjs/actions/bundler/estimateUserOperationGas.js.map +1 -0
- package/dist/cjs/actions/bundler/getSupportedEntryPoints.d.ts +3 -0
- package/dist/cjs/actions/bundler/getSupportedEntryPoints.js +11 -0
- package/dist/cjs/actions/bundler/getSupportedEntryPoints.js.map +1 -0
- package/dist/cjs/actions/bundler/getUserOperationByHash.d.ts +6 -0
- package/dist/cjs/actions/bundler/getUserOperationByHash.js +11 -0
- package/dist/cjs/actions/bundler/getUserOperationByHash.js.map +1 -0
- package/dist/cjs/actions/bundler/getUserOperationReceipt.d.ts +6 -0
- package/dist/cjs/actions/bundler/getUserOperationReceipt.js +11 -0
- package/dist/cjs/actions/bundler/getUserOperationReceipt.js.map +1 -0
- package/dist/cjs/actions/bundler/sendRawUserOperation.d.ts +7 -0
- package/dist/cjs/actions/bundler/sendRawUserOperation.js +11 -0
- package/dist/cjs/actions/bundler/sendRawUserOperation.js.map +1 -0
- package/dist/cjs/actions/smartAccount/buildUserOperation.d.ts +5 -0
- package/dist/cjs/actions/smartAccount/buildUserOperation.js +25 -0
- package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +1 -0
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.d.ts +5 -0
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js +39 -0
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +1 -0
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.d.ts +4 -0
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js +62 -0
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -0
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +4 -0
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js +34 -0
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -0
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.d.ts +5 -0
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js +64 -0
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -0
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.d.ts +5 -0
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js +23 -0
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +1 -0
- package/dist/cjs/actions/smartAccount/getAddress.d.ts +4 -0
- package/dist/cjs/actions/smartAccount/getAddress.js +13 -0
- package/dist/cjs/actions/smartAccount/getAddress.js.map +1 -0
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.d.ts +7 -0
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js +42 -0
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +1 -0
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.d.ts +10 -0
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js +47 -0
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -0
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.d.ts +10 -0
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js +28 -0
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +1 -0
- package/dist/cjs/actions/smartAccount/sendTransaction.d.ts +5 -0
- package/dist/cjs/actions/smartAccount/sendTransaction.js +35 -0
- package/dist/cjs/actions/smartAccount/sendTransaction.js.map +1 -0
- package/dist/cjs/actions/smartAccount/sendTransactions.d.ts +4 -0
- package/dist/cjs/actions/smartAccount/sendTransactions.js +36 -0
- package/dist/cjs/actions/smartAccount/sendTransactions.js.map +1 -0
- package/dist/cjs/actions/smartAccount/sendUserOperation.d.ts +5 -0
- package/dist/cjs/actions/smartAccount/sendUserOperation.js +31 -0
- package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +1 -0
- package/dist/cjs/actions/smartAccount/signMessage.d.ts +6 -0
- package/dist/cjs/actions/smartAccount/signMessage.js +12 -0
- package/dist/cjs/actions/smartAccount/signMessage.js.map +1 -0
- package/dist/cjs/actions/smartAccount/signMessageWith6492.d.ts +4 -0
- package/dist/cjs/actions/smartAccount/signMessageWith6492.js +12 -0
- package/dist/cjs/actions/smartAccount/signMessageWith6492.js.map +1 -0
- package/dist/cjs/actions/smartAccount/signTypedData.d.ts +10 -0
- package/dist/cjs/actions/smartAccount/signTypedData.js +12 -0
- package/dist/cjs/actions/smartAccount/signTypedData.js.map +1 -0
- package/dist/cjs/actions/smartAccount/signTypedDataWith6492.d.ts +6 -0
- package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js +12 -0
- package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js.map +1 -0
- package/dist/cjs/actions/smartAccount/signUserOperation.d.ts +5 -0
- package/dist/cjs/actions/smartAccount/signUserOperation.js +30 -0
- package/dist/cjs/actions/smartAccount/signUserOperation.js.map +1 -0
- package/dist/cjs/actions/smartAccount/types.d.ts +42 -0
- package/dist/cjs/actions/smartAccount/types.js +3 -0
- package/dist/cjs/actions/smartAccount/types.js.map +1 -0
- package/dist/cjs/actions/smartAccount/upgradeAccount.d.ts +4 -0
- package/dist/cjs/actions/smartAccount/upgradeAccount.js +38 -0
- package/dist/cjs/actions/smartAccount/upgradeAccount.js.map +1 -0
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.d.ts +3 -0
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js +36 -0
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -0
- package/dist/cjs/chains/index.d.ts +20 -0
- package/dist/cjs/chains/index.js +169 -0
- package/dist/cjs/chains/index.js.map +1 -0
- package/dist/cjs/client/bundlerClient.d.ts +10 -0
- package/dist/cjs/client/bundlerClient.js +51 -0
- package/dist/cjs/client/bundlerClient.js.map +1 -0
- package/dist/cjs/client/decorators/bundlerClient.d.ts +41 -0
- package/dist/cjs/client/decorators/bundlerClient.js +17 -0
- package/dist/cjs/client/decorators/bundlerClient.js.map +1 -0
- package/dist/cjs/client/decorators/smartAccountClient.d.ts +35 -0
- package/dist/cjs/client/decorators/smartAccountClient.js +43 -0
- package/dist/cjs/client/decorators/smartAccountClient.js.map +1 -0
- package/dist/cjs/client/isSmartAccountClient.d.ts +5 -0
- package/dist/cjs/client/isSmartAccountClient.js +18 -0
- package/dist/cjs/client/isSmartAccountClient.js.map +1 -0
- package/dist/cjs/client/schema.d.ts +767 -0
- package/dist/cjs/client/schema.js +63 -0
- package/dist/cjs/client/schema.js.map +1 -0
- package/dist/cjs/client/smartAccountClient.d.ts +33 -0
- package/dist/cjs/client/smartAccountClient.js +93 -0
- package/dist/cjs/client/smartAccountClient.js.map +1 -0
- package/dist/cjs/client/types.d.ts +26 -0
- package/dist/cjs/client/types.js +3 -0
- package/dist/cjs/client/types.js.map +1 -0
- package/dist/cjs/ens/utils.d.ts +6 -0
- package/dist/cjs/ens/utils.js +53 -0
- package/dist/cjs/ens/utils.js.map +1 -0
- package/dist/cjs/entrypoint/0.6.d.ts +1029 -0
- package/dist/cjs/entrypoint/0.6.js +49 -0
- package/dist/cjs/entrypoint/0.6.js.map +1 -0
- package/dist/cjs/entrypoint/0.7.d.ts +792 -0
- package/dist/cjs/entrypoint/0.7.js +88 -0
- package/dist/cjs/entrypoint/0.7.js.map +1 -0
- package/dist/cjs/entrypoint/index.d.ts +8 -0
- package/dist/cjs/entrypoint/index.js +53 -0
- package/dist/cjs/entrypoint/index.js.map +1 -0
- package/dist/cjs/entrypoint/types.d.ts +46 -0
- package/dist/cjs/entrypoint/types.js +3 -0
- package/dist/cjs/entrypoint/types.js.map +1 -0
- package/dist/cjs/errors/account.d.ts +47 -0
- package/dist/cjs/errors/account.js +140 -0
- package/dist/cjs/errors/account.js.map +1 -0
- package/dist/cjs/errors/base.d.ts +18 -0
- package/dist/cjs/errors/base.js +39 -0
- package/dist/cjs/errors/base.js.map +1 -0
- package/dist/cjs/errors/client.d.ts +14 -0
- package/dist/cjs/errors/client.js +44 -0
- package/dist/cjs/errors/client.js.map +1 -0
- package/dist/cjs/errors/entrypoint.d.ts +10 -0
- package/dist/cjs/errors/entrypoint.js +32 -0
- package/dist/cjs/errors/entrypoint.js.map +1 -0
- package/dist/cjs/errors/signer.d.ts +5 -0
- package/dist/cjs/errors/signer.js +20 -0
- package/dist/cjs/errors/signer.js.map +1 -0
- package/dist/cjs/errors/transaction.d.ts +10 -0
- package/dist/cjs/errors/transaction.js +29 -0
- package/dist/cjs/errors/transaction.js.map +1 -0
- package/dist/cjs/errors/useroperation.d.ts +10 -0
- package/dist/cjs/errors/useroperation.js +34 -0
- package/dist/cjs/errors/useroperation.js.map +1 -0
- package/dist/cjs/index.d.ts +63 -0
- package/dist/cjs/index.js +198 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/logger.d.ts +20 -0
- package/dist/cjs/logger.js +60 -0
- package/dist/cjs/logger.js.map +1 -0
- package/dist/cjs/middleware/actions.d.ts +12 -0
- package/dist/cjs/middleware/actions.js +37 -0
- package/dist/cjs/middleware/actions.js.map +1 -0
- package/dist/cjs/middleware/defaults/feeEstimator.d.ts +3 -0
- package/dist/cjs/middleware/defaults/feeEstimator.js +21 -0
- package/dist/cjs/middleware/defaults/feeEstimator.js.map +1 -0
- package/dist/cjs/middleware/defaults/gasEstimator.d.ts +3 -0
- package/dist/cjs/middleware/defaults/gasEstimator.js +26 -0
- package/dist/cjs/middleware/defaults/gasEstimator.js.map +1 -0
- package/dist/cjs/middleware/defaults/paymasterAndData.d.ts +2 -0
- package/dist/cjs/middleware/defaults/paymasterAndData.js +12 -0
- package/dist/cjs/middleware/defaults/paymasterAndData.js.map +1 -0
- package/dist/cjs/middleware/defaults/userOpSigner.d.ts +2 -0
- package/dist/cjs/middleware/defaults/userOpSigner.js +26 -0
- package/dist/cjs/middleware/defaults/userOpSigner.js.map +1 -0
- package/dist/cjs/middleware/noopMiddleware.d.ts +2 -0
- package/dist/cjs/middleware/noopMiddleware.js +8 -0
- package/dist/cjs/middleware/noopMiddleware.js.map +1 -0
- package/dist/cjs/middleware/types.d.ts +21 -0
- package/dist/cjs/middleware/types.js +3 -0
- package/dist/cjs/middleware/types.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/signer/local-account.d.ts +219 -0
- package/dist/cjs/signer/local-account.js +56 -0
- package/dist/cjs/signer/local-account.js.map +1 -0
- package/dist/cjs/signer/schema.d.ts +4 -0
- package/dist/cjs/signer/schema.js +16 -0
- package/dist/cjs/signer/schema.js.map +1 -0
- package/dist/cjs/signer/types.d.ts +15 -0
- package/dist/cjs/signer/types.js +3 -0
- package/dist/cjs/signer/types.js.map +1 -0
- package/dist/cjs/signer/utils.d.ts +15 -0
- package/dist/cjs/signer/utils.js +31 -0
- package/dist/cjs/signer/utils.js.map +1 -0
- package/dist/cjs/signer/wallet-client.d.ts +217 -0
- package/dist/cjs/signer/wallet-client.js +58 -0
- package/dist/cjs/signer/wallet-client.js.map +1 -0
- package/dist/cjs/transport/split.d.ts +9 -0
- package/dist/cjs/transport/split.js +26 -0
- package/dist/cjs/transport/split.js.map +1 -0
- package/dist/cjs/types.d.ts +158 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/bigint.d.ts +10 -0
- package/dist/cjs/utils/bigint.js +55 -0
- package/dist/cjs/utils/bigint.js.map +1 -0
- package/dist/cjs/utils/bytes.d.ts +7 -0
- package/dist/cjs/utils/bytes.js +11 -0
- package/dist/cjs/utils/bytes.js.map +1 -0
- package/dist/cjs/utils/defaults.d.ts +6 -0
- package/dist/cjs/utils/defaults.js +59 -0
- package/dist/cjs/utils/defaults.js.map +1 -0
- package/dist/cjs/utils/index.d.ts +23 -0
- package/dist/cjs/utils/index.js +127 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/schema.d.ts +25 -0
- package/dist/cjs/utils/schema.js +35 -0
- package/dist/cjs/utils/schema.js.map +1 -0
- package/dist/cjs/utils/stateOverride.d.ts +4 -0
- package/dist/cjs/utils/stateOverride.js +52 -0
- package/dist/cjs/utils/stateOverride.js.map +1 -0
- package/dist/cjs/utils/testUtils.d.ts +6 -0
- package/dist/cjs/utils/testUtils.js +33 -0
- package/dist/cjs/utils/testUtils.js.map +1 -0
- package/dist/cjs/utils/types.d.ts +16 -0
- package/dist/cjs/utils/types.js +3 -0
- package/dist/cjs/utils/types.js.map +1 -0
- package/dist/cjs/utils/userop.d.ts +49 -0
- package/dist/cjs/utils/userop.js +75 -0
- package/dist/cjs/utils/userop.js.map +1 -0
- package/dist/cjs/version.d.ts +1 -0
- package/dist/cjs/version.js +5 -0
- package/dist/cjs/version.js.map +1 -0
- package/dist/esm/abis/EntryPointAbi_v6.d.ts +1018 -0
- package/dist/esm/abis/EntryPointAbi_v6.js +1310 -0
- package/dist/esm/abis/EntryPointAbi_v6.js.map +1 -0
- package/dist/esm/abis/EntryPointAbi_v7.d.ts +775 -0
- package/dist/esm/abis/EntryPointAbi_v7.js +658 -0
- package/dist/esm/abis/EntryPointAbi_v7.js.map +1 -0
- package/dist/esm/abis/SimpleAccountAbi_v6.d.ts +405 -0
- package/dist/esm/abis/SimpleAccountAbi_v6.js +525 -0
- package/dist/esm/abis/SimpleAccountAbi_v6.js.map +1 -0
- package/dist/esm/abis/SimpleAccountAbi_v7.d.ts +410 -0
- package/dist/esm/abis/SimpleAccountAbi_v7.js +535 -0
- package/dist/esm/abis/SimpleAccountAbi_v7.js.map +1 -0
- package/dist/esm/abis/SimpleAccountFactoryAbi.d.ts +55 -0
- package/dist/esm/abis/SimpleAccountFactoryAbi.js +75 -0
- package/dist/esm/abis/SimpleAccountFactoryAbi.js.map +1 -0
- package/dist/esm/account/base.d.ts +49 -0
- package/dist/esm/account/base.js +253 -0
- package/dist/esm/account/base.js.map +1 -0
- package/dist/esm/account/schema.d.ts +100 -0
- package/dist/esm/account/schema.js +35 -0
- package/dist/esm/account/schema.js.map +1 -0
- package/dist/esm/account/simple.d.ts +14 -0
- package/dist/esm/account/simple.js +115 -0
- package/dist/esm/account/simple.js.map +1 -0
- package/dist/esm/account/smartContractAccount.d.ts +68 -0
- package/dist/esm/account/smartContractAccount.js +167 -0
- package/dist/esm/account/smartContractAccount.js.map +1 -0
- package/dist/esm/account/types.d.ts +30 -0
- package/dist/esm/account/types.js +2 -0
- package/dist/esm/account/types.js.map +1 -0
- package/dist/esm/actions/bundler/estimateUserOperationGas.d.ts +8 -0
- package/dist/esm/actions/bundler/estimateUserOperationGas.js +14 -0
- package/dist/esm/actions/bundler/estimateUserOperationGas.js.map +1 -0
- package/dist/esm/actions/bundler/getSupportedEntryPoints.d.ts +3 -0
- package/dist/esm/actions/bundler/getSupportedEntryPoints.js +7 -0
- package/dist/esm/actions/bundler/getSupportedEntryPoints.js.map +1 -0
- package/dist/esm/actions/bundler/getUserOperationByHash.d.ts +6 -0
- package/dist/esm/actions/bundler/getUserOperationByHash.js +7 -0
- package/dist/esm/actions/bundler/getUserOperationByHash.js.map +1 -0
- package/dist/esm/actions/bundler/getUserOperationReceipt.d.ts +6 -0
- package/dist/esm/actions/bundler/getUserOperationReceipt.js +7 -0
- package/dist/esm/actions/bundler/getUserOperationReceipt.js.map +1 -0
- package/dist/esm/actions/bundler/sendRawUserOperation.d.ts +7 -0
- package/dist/esm/actions/bundler/sendRawUserOperation.js +7 -0
- package/dist/esm/actions/bundler/sendRawUserOperation.js.map +1 -0
- package/dist/esm/actions/smartAccount/buildUserOperation.d.ts +5 -0
- package/dist/esm/actions/smartAccount/buildUserOperation.js +22 -0
- package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.d.ts +5 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js +36 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.d.ts +4 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js +58 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -0
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +4 -0
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js +30 -0
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -0
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.d.ts +5 -0
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js +60 -0
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -0
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.d.ts +5 -0
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js +20 -0
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -0
- package/dist/esm/actions/smartAccount/getAddress.d.ts +4 -0
- package/dist/esm/actions/smartAccount/getAddress.js +9 -0
- package/dist/esm/actions/smartAccount/getAddress.js.map +1 -0
- package/dist/esm/actions/smartAccount/internal/initUserOperation.d.ts +7 -0
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js +38 -0
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -0
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.d.ts +10 -0
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js +43 -0
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -0
- package/dist/esm/actions/smartAccount/internal/sendUserOperation.d.ts +10 -0
- package/dist/esm/actions/smartAccount/internal/sendUserOperation.js +24 -0
- package/dist/esm/actions/smartAccount/internal/sendUserOperation.js.map +1 -0
- package/dist/esm/actions/smartAccount/sendTransaction.d.ts +5 -0
- package/dist/esm/actions/smartAccount/sendTransaction.js +31 -0
- package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -0
- package/dist/esm/actions/smartAccount/sendTransactions.d.ts +4 -0
- package/dist/esm/actions/smartAccount/sendTransactions.js +32 -0
- package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -0
- package/dist/esm/actions/smartAccount/sendUserOperation.d.ts +5 -0
- package/dist/esm/actions/smartAccount/sendUserOperation.js +27 -0
- package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -0
- package/dist/esm/actions/smartAccount/signMessage.d.ts +6 -0
- package/dist/esm/actions/smartAccount/signMessage.js +8 -0
- package/dist/esm/actions/smartAccount/signMessage.js.map +1 -0
- package/dist/esm/actions/smartAccount/signMessageWith6492.d.ts +4 -0
- package/dist/esm/actions/smartAccount/signMessageWith6492.js +8 -0
- package/dist/esm/actions/smartAccount/signMessageWith6492.js.map +1 -0
- package/dist/esm/actions/smartAccount/signTypedData.d.ts +10 -0
- package/dist/esm/actions/smartAccount/signTypedData.js +8 -0
- package/dist/esm/actions/smartAccount/signTypedData.js.map +1 -0
- package/dist/esm/actions/smartAccount/signTypedDataWith6492.d.ts +6 -0
- package/dist/esm/actions/smartAccount/signTypedDataWith6492.js +8 -0
- package/dist/esm/actions/smartAccount/signTypedDataWith6492.js.map +1 -0
- package/dist/esm/actions/smartAccount/signUserOperation.d.ts +5 -0
- package/dist/esm/actions/smartAccount/signUserOperation.js +26 -0
- package/dist/esm/actions/smartAccount/signUserOperation.js.map +1 -0
- package/dist/esm/actions/smartAccount/types.d.ts +42 -0
- package/dist/esm/actions/smartAccount/types.js +2 -0
- package/dist/esm/actions/smartAccount/types.js.map +1 -0
- package/dist/esm/actions/smartAccount/upgradeAccount.d.ts +4 -0
- package/dist/esm/actions/smartAccount/upgradeAccount.js +34 -0
- package/dist/esm/actions/smartAccount/upgradeAccount.js.map +1 -0
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.d.ts +3 -0
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js +32 -0
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -0
- package/dist/esm/chains/index.d.ts +20 -0
- package/dist/esm/chains/index.js +166 -0
- package/dist/esm/chains/index.js.map +1 -0
- package/dist/esm/client/bundlerClient.d.ts +10 -0
- package/dist/esm/client/bundlerClient.js +46 -0
- package/dist/esm/client/bundlerClient.js.map +1 -0
- package/dist/esm/client/decorators/bundlerClient.d.ts +41 -0
- package/dist/esm/client/decorators/bundlerClient.js +13 -0
- package/dist/esm/client/decorators/bundlerClient.js.map +1 -0
- package/dist/esm/client/decorators/smartAccountClient.d.ts +35 -0
- package/dist/esm/client/decorators/smartAccountClient.js +40 -0
- package/dist/esm/client/decorators/smartAccountClient.js.map +1 -0
- package/dist/esm/client/isSmartAccountClient.d.ts +5 -0
- package/dist/esm/client/isSmartAccountClient.js +13 -0
- package/dist/esm/client/isSmartAccountClient.js.map +1 -0
- package/dist/esm/client/schema.d.ts +767 -0
- package/dist/esm/client/schema.js +59 -0
- package/dist/esm/client/schema.js.map +1 -0
- package/dist/esm/client/smartAccountClient.d.ts +33 -0
- package/dist/esm/client/smartAccountClient.js +90 -0
- package/dist/esm/client/smartAccountClient.js.map +1 -0
- package/dist/esm/client/types.d.ts +26 -0
- package/dist/esm/client/types.js +2 -0
- package/dist/esm/client/types.js.map +1 -0
- package/dist/esm/ens/utils.d.ts +6 -0
- package/dist/esm/ens/utils.js +24 -0
- package/dist/esm/ens/utils.js.map +1 -0
- package/dist/esm/entrypoint/0.6.d.ts +1029 -0
- package/dist/esm/entrypoint/0.6.js +47 -0
- package/dist/esm/entrypoint/0.6.js.map +1 -0
- package/dist/esm/entrypoint/0.7.d.ts +792 -0
- package/dist/esm/entrypoint/0.7.js +82 -0
- package/dist/esm/entrypoint/0.7.js.map +1 -0
- package/dist/esm/entrypoint/index.d.ts +8 -0
- package/dist/esm/entrypoint/index.js +46 -0
- package/dist/esm/entrypoint/index.js.map +1 -0
- package/dist/esm/entrypoint/types.d.ts +46 -0
- package/dist/esm/entrypoint/types.js +2 -0
- package/dist/esm/entrypoint/types.js.map +1 -0
- package/dist/esm/errors/account.d.ts +47 -0
- package/dist/esm/errors/account.js +126 -0
- package/dist/esm/errors/account.js.map +1 -0
- package/dist/esm/errors/base.d.ts +18 -0
- package/dist/esm/errors/base.js +35 -0
- package/dist/esm/errors/base.js.map +1 -0
- package/dist/esm/errors/client.d.ts +14 -0
- package/dist/esm/errors/client.js +38 -0
- package/dist/esm/errors/client.js.map +1 -0
- package/dist/esm/errors/entrypoint.d.ts +10 -0
- package/dist/esm/errors/entrypoint.js +27 -0
- package/dist/esm/errors/entrypoint.js.map +1 -0
- package/dist/esm/errors/signer.d.ts +5 -0
- package/dist/esm/errors/signer.js +16 -0
- package/dist/esm/errors/signer.js.map +1 -0
- package/dist/esm/errors/transaction.d.ts +10 -0
- package/dist/esm/errors/transaction.js +24 -0
- package/dist/esm/errors/transaction.js.map +1 -0
- package/dist/esm/errors/useroperation.d.ts +10 -0
- package/dist/esm/errors/useroperation.js +29 -0
- package/dist/esm/errors/useroperation.js.map +1 -0
- package/dist/esm/index.d.ts +63 -0
- package/dist/esm/index.js +48 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.d.ts +20 -0
- package/dist/esm/logger.js +56 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/middleware/actions.d.ts +12 -0
- package/dist/esm/middleware/actions.js +33 -0
- package/dist/esm/middleware/actions.js.map +1 -0
- package/dist/esm/middleware/defaults/feeEstimator.d.ts +3 -0
- package/dist/esm/middleware/defaults/feeEstimator.js +17 -0
- package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -0
- package/dist/esm/middleware/defaults/gasEstimator.d.ts +3 -0
- package/dist/esm/middleware/defaults/gasEstimator.js +22 -0
- package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -0
- package/dist/esm/middleware/defaults/paymasterAndData.d.ts +2 -0
- package/dist/esm/middleware/defaults/paymasterAndData.js +8 -0
- package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -0
- package/dist/esm/middleware/defaults/userOpSigner.d.ts +2 -0
- package/dist/esm/middleware/defaults/userOpSigner.js +22 -0
- package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -0
- package/dist/esm/middleware/noopMiddleware.d.ts +2 -0
- package/dist/esm/middleware/noopMiddleware.js +4 -0
- package/dist/esm/middleware/noopMiddleware.js.map +1 -0
- package/dist/esm/middleware/types.d.ts +21 -0
- package/dist/esm/middleware/types.js +2 -0
- package/dist/esm/middleware/types.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/signer/local-account.d.ts +219 -0
- package/dist/esm/signer/local-account.js +53 -0
- package/dist/esm/signer/local-account.js.map +1 -0
- package/dist/esm/signer/schema.d.ts +4 -0
- package/dist/esm/signer/schema.js +12 -0
- package/dist/esm/signer/schema.js.map +1 -0
- package/dist/esm/signer/types.d.ts +15 -0
- package/dist/esm/signer/types.js +2 -0
- package/dist/esm/signer/types.js.map +1 -0
- package/dist/esm/signer/utils.d.ts +15 -0
- package/dist/esm/signer/utils.js +26 -0
- package/dist/esm/signer/utils.js.map +1 -0
- package/dist/esm/signer/wallet-client.d.ts +217 -0
- package/dist/esm/signer/wallet-client.js +54 -0
- package/dist/esm/signer/wallet-client.js.map +1 -0
- package/dist/esm/transport/split.d.ts +9 -0
- package/dist/esm/transport/split.js +22 -0
- package/dist/esm/transport/split.js.map +1 -0
- package/dist/esm/types.d.ts +158 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/bigint.d.ts +10 -0
- package/dist/esm/utils/bigint.js +47 -0
- package/dist/esm/utils/bigint.js.map +1 -0
- package/dist/esm/utils/bytes.d.ts +7 -0
- package/dist/esm/utils/bytes.js +7 -0
- package/dist/esm/utils/bytes.js.map +1 -0
- package/dist/esm/utils/defaults.d.ts +6 -0
- package/dist/esm/utils/defaults.js +55 -0
- package/dist/esm/utils/defaults.js.map +1 -0
- package/dist/esm/utils/index.d.ts +23 -0
- package/dist/esm/utils/index.js +88 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/schema.d.ts +25 -0
- package/dist/esm/utils/schema.js +30 -0
- package/dist/esm/utils/schema.js.map +1 -0
- package/dist/esm/utils/stateOverride.d.ts +4 -0
- package/dist/esm/utils/stateOverride.js +48 -0
- package/dist/esm/utils/stateOverride.js.map +1 -0
- package/dist/esm/utils/testUtils.d.ts +6 -0
- package/dist/esm/utils/testUtils.js +28 -0
- package/dist/esm/utils/testUtils.js.map +1 -0
- package/dist/esm/utils/types.d.ts +16 -0
- package/dist/esm/utils/types.js +2 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/esm/utils/userop.d.ts +49 -0
- package/dist/esm/utils/userop.js +62 -0
- package/dist/esm/utils/userop.js.map +1 -0
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/types/abis/EntryPointAbi_v6.d.ts +1019 -0
- package/dist/types/abis/EntryPointAbi_v6.d.ts.map +1 -0
- package/dist/types/abis/EntryPointAbi_v7.d.ts +776 -0
- package/dist/types/abis/EntryPointAbi_v7.d.ts.map +1 -0
- package/dist/types/abis/SimpleAccountAbi_v6.d.ts +406 -0
- package/dist/types/abis/SimpleAccountAbi_v6.d.ts.map +1 -0
- package/dist/types/abis/SimpleAccountAbi_v7.d.ts +411 -0
- package/dist/types/abis/SimpleAccountAbi_v7.d.ts.map +1 -0
- package/dist/types/abis/SimpleAccountFactoryAbi.d.ts +56 -0
- package/dist/types/abis/SimpleAccountFactoryAbi.d.ts.map +1 -0
- package/dist/types/account/base.d.ts +128 -0
- package/dist/types/account/base.d.ts.map +1 -0
- package/dist/types/account/schema.d.ts +101 -0
- package/dist/types/account/schema.d.ts.map +1 -0
- package/dist/types/account/simple.d.ts +15 -0
- package/dist/types/account/simple.d.ts.map +1 -0
- package/dist/types/account/smartContractAccount.d.ts +69 -0
- package/dist/types/account/smartContractAccount.d.ts.map +1 -0
- package/dist/types/account/types.d.ts +144 -0
- package/dist/types/account/types.d.ts.map +1 -0
- package/dist/types/actions/bundler/estimateUserOperationGas.d.ts +9 -0
- package/dist/types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -0
- package/dist/types/actions/bundler/getSupportedEntryPoints.d.ts +4 -0
- package/dist/types/actions/bundler/getSupportedEntryPoints.d.ts.map +1 -0
- package/dist/types/actions/bundler/getUserOperationByHash.d.ts +7 -0
- package/dist/types/actions/bundler/getUserOperationByHash.d.ts.map +1 -0
- package/dist/types/actions/bundler/getUserOperationReceipt.d.ts +7 -0
- package/dist/types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -0
- package/dist/types/actions/bundler/sendRawUserOperation.d.ts +8 -0
- package/dist/types/actions/bundler/sendRawUserOperation.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/buildUserOperation.d.ts +6 -0
- package/dist/types/actions/smartAccount/buildUserOperation.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +45 -0
- package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts +75 -0
- package/dist/types/actions/smartAccount/buildUserOperationFromTxs.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +33 -0
- package/dist/types/actions/smartAccount/checkGasSponsorshipEligibility.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts +6 -0
- package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts +19 -0
- package/dist/types/actions/smartAccount/estimateUserOperationGas.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/getAddress.d.ts +5 -0
- package/dist/types/actions/smartAccount/getAddress.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts +22 -0
- package/dist/types/actions/smartAccount/internal/initUserOperation.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts +25 -0
- package/dist/types/actions/smartAccount/internal/runMiddlewareStack.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts +18 -0
- package/dist/types/actions/smartAccount/internal/sendUserOperation.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/sendTransaction.d.ts +6 -0
- package/dist/types/actions/smartAccount/sendTransaction.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/sendTransactions.d.ts +5 -0
- package/dist/types/actions/smartAccount/sendTransactions.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts +13 -0
- package/dist/types/actions/smartAccount/sendUserOperation.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/signMessage.d.ts +7 -0
- package/dist/types/actions/smartAccount/signMessage.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/signMessageWith6492.d.ts +5 -0
- package/dist/types/actions/smartAccount/signMessageWith6492.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/signTypedData.d.ts +11 -0
- package/dist/types/actions/smartAccount/signTypedData.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/signTypedDataWith6492.d.ts +7 -0
- package/dist/types/actions/smartAccount/signTypedDataWith6492.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/signUserOperation.d.ts +6 -0
- package/dist/types/actions/smartAccount/signUserOperation.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/types.d.ts +57 -0
- package/dist/types/actions/smartAccount/types.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/upgradeAccount.d.ts +5 -0
- package/dist/types/actions/smartAccount/upgradeAccount.d.ts.map +1 -0
- package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts +4 -0
- package/dist/types/actions/smartAccount/waitForUserOperationTransacation.d.ts.map +1 -0
- package/dist/types/chains/index.d.ts +21 -0
- package/dist/types/chains/index.d.ts.map +1 -0
- package/dist/types/client/bundlerClient.d.ts +17 -0
- package/dist/types/client/bundlerClient.d.ts.map +1 -0
- package/dist/types/client/decorators/bundlerClient.d.ts +74 -0
- package/dist/types/client/decorators/bundlerClient.d.ts.map +1 -0
- package/dist/types/client/decorators/smartAccountClient.d.ts +36 -0
- package/dist/types/client/decorators/smartAccountClient.d.ts.map +1 -0
- package/dist/types/client/isSmartAccountClient.d.ts +22 -0
- package/dist/types/client/isSmartAccountClient.d.ts.map +1 -0
- package/dist/types/client/schema.d.ts +780 -0
- package/dist/types/client/schema.d.ts.map +1 -0
- package/dist/types/client/smartAccountClient.d.ts +34 -0
- package/dist/types/client/smartAccountClient.d.ts.map +1 -0
- package/dist/types/client/types.d.ts +27 -0
- package/dist/types/client/types.d.ts.map +1 -0
- package/dist/types/ens/utils.d.ts +7 -0
- package/dist/types/ens/utils.d.ts.map +1 -0
- package/dist/types/entrypoint/0.6.d.ts +1030 -0
- package/dist/types/entrypoint/0.6.d.ts.map +1 -0
- package/dist/types/entrypoint/0.7.d.ts +793 -0
- package/dist/types/entrypoint/0.7.d.ts.map +1 -0
- package/dist/types/entrypoint/index.d.ts +9 -0
- package/dist/types/entrypoint/index.d.ts.map +1 -0
- package/dist/types/entrypoint/types.d.ts +64 -0
- package/dist/types/entrypoint/types.d.ts.map +1 -0
- package/dist/types/errors/account.d.ts +48 -0
- package/dist/types/errors/account.d.ts.map +1 -0
- package/dist/types/errors/base.d.ts +19 -0
- package/dist/types/errors/base.d.ts.map +1 -0
- package/dist/types/errors/client.d.ts +15 -0
- package/dist/types/errors/client.d.ts.map +1 -0
- package/dist/types/errors/entrypoint.d.ts +11 -0
- package/dist/types/errors/entrypoint.d.ts.map +1 -0
- package/dist/types/errors/signer.d.ts +6 -0
- package/dist/types/errors/signer.d.ts.map +1 -0
- package/dist/types/errors/transaction.d.ts +11 -0
- package/dist/types/errors/transaction.d.ts.map +1 -0
- package/dist/types/errors/useroperation.d.ts +36 -0
- package/dist/types/errors/useroperation.d.ts.map +1 -0
- package/dist/types/index.d.ts +64 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/logger.d.ts +21 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/middleware/actions.d.ts +27 -0
- package/dist/types/middleware/actions.d.ts.map +1 -0
- package/dist/types/middleware/defaults/feeEstimator.d.ts +4 -0
- package/dist/types/middleware/defaults/feeEstimator.d.ts.map +1 -0
- package/dist/types/middleware/defaults/gasEstimator.d.ts +12 -0
- package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -0
- package/dist/types/middleware/defaults/paymasterAndData.d.ts +3 -0
- package/dist/types/middleware/defaults/paymasterAndData.d.ts.map +1 -0
- package/dist/types/middleware/defaults/userOpSigner.d.ts +3 -0
- package/dist/types/middleware/defaults/userOpSigner.d.ts.map +1 -0
- package/dist/types/middleware/noopMiddleware.d.ts +10 -0
- package/dist/types/middleware/noopMiddleware.d.ts.map +1 -0
- package/dist/types/middleware/types.d.ts +22 -0
- package/dist/types/middleware/types.d.ts.map +1 -0
- package/dist/types/signer/local-account.d.ts +220 -0
- package/dist/types/signer/local-account.d.ts.map +1 -0
- package/dist/types/signer/schema.d.ts +5 -0
- package/dist/types/signer/schema.d.ts.map +1 -0
- package/dist/types/signer/types.d.ts +28 -0
- package/dist/types/signer/types.d.ts.map +1 -0
- package/dist/types/signer/utils.d.ts +16 -0
- package/dist/types/signer/utils.d.ts.map +1 -0
- package/dist/types/signer/wallet-client.d.ts +218 -0
- package/dist/types/signer/wallet-client.d.ts.map +1 -0
- package/dist/types/transport/split.d.ts +42 -0
- package/dist/types/transport/split.d.ts.map +1 -0
- package/dist/types/types.d.ts +176 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils/bigint.d.ts +56 -0
- package/dist/types/utils/bigint.d.ts.map +1 -0
- package/dist/types/utils/bytes.d.ts +17 -0
- package/dist/types/utils/bytes.d.ts.map +1 -0
- package/dist/types/utils/defaults.d.ts +15 -0
- package/dist/types/utils/defaults.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +63 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/schema.d.ts +29 -0
- package/dist/types/utils/schema.d.ts.map +1 -0
- package/dist/types/utils/stateOverride.d.ts +5 -0
- package/dist/types/utils/stateOverride.d.ts.map +1 -0
- package/dist/types/utils/testUtils.d.ts +7 -0
- package/dist/types/utils/testUtils.d.ts.map +1 -0
- package/dist/types/utils/types.d.ts +39 -0
- package/dist/types/utils/types.d.ts.map +1 -0
- package/dist/types/utils/userop.d.ts +129 -0
- package/dist/types/utils/userop.d.ts.map +1 -0
- package/dist/types/version.d.ts +2 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +70 -0
- package/src/abis/EntryPointAbi_v6.ts +1309 -0
- package/src/abis/EntryPointAbi_v7.ts +658 -0
- package/src/abis/SimpleAccountAbi_v6.ts +524 -0
- package/src/abis/SimpleAccountAbi_v7.ts +534 -0
- package/src/abis/SimpleAccountFactoryAbi.ts +74 -0
- package/src/account/base.ts +415 -0
- package/src/account/schema.ts +51 -0
- package/src/account/simple.ts +215 -0
- package/src/account/smartContractAccount.ts +406 -0
- package/src/account/types.ts +184 -0
- package/src/actions/bundler/estimateUserOperationGas.ts +32 -0
- package/src/actions/bundler/getSupportedEntryPoints.ts +13 -0
- package/src/actions/bundler/getUserOperationByHash.ts +17 -0
- package/src/actions/bundler/getUserOperationReceipt.ts +17 -0
- package/src/actions/bundler/sendRawUserOperation.ts +20 -0
- package/src/actions/smartAccount/buildUserOperation.ts +52 -0
- package/src/actions/smartAccount/buildUserOperationFromTx.ts +112 -0
- package/src/actions/smartAccount/buildUserOperationFromTxs.ts +168 -0
- package/src/actions/smartAccount/checkGasSponsorshipEligibility.ts +86 -0
- package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +111 -0
- package/src/actions/smartAccount/estimateUserOperationGas.ts +65 -0
- package/src/actions/smartAccount/getAddress.ts +25 -0
- package/src/actions/smartAccount/internal/initUserOperation.ts +93 -0
- package/src/actions/smartAccount/internal/runMiddlewareStack.ts +121 -0
- package/src/actions/smartAccount/internal/sendUserOperation.ts +64 -0
- package/src/actions/smartAccount/sendTransaction.ts +73 -0
- package/src/actions/smartAccount/sendTransactions.ts +53 -0
- package/src/actions/smartAccount/sendUserOperation.ts +65 -0
- package/src/actions/smartAccount/signMessage.ts +28 -0
- package/src/actions/smartAccount/signMessageWith6492.ts +21 -0
- package/src/actions/smartAccount/signTypedData.ts +42 -0
- package/src/actions/smartAccount/signTypedDataWith6492.ts +23 -0
- package/src/actions/smartAccount/signUserOperation.ts +54 -0
- package/src/actions/smartAccount/types.ts +158 -0
- package/src/actions/smartAccount/upgradeAccount.ts +66 -0
- package/src/actions/smartAccount/waitForUserOperationTransacation.ts +58 -0
- package/src/chains/index.ts +194 -0
- package/src/client/bundlerClient.ts +107 -0
- package/src/client/decorators/bundlerClient.ts +129 -0
- package/src/client/decorators/smartAccountClient.ts +177 -0
- package/src/client/isSmartAccountClient.ts +53 -0
- package/src/client/schema.ts +92 -0
- package/src/client/smartAccountClient.ts +276 -0
- package/src/client/types.ts +51 -0
- package/src/ens/utils.ts +37 -0
- package/src/entrypoint/0.6.ts +74 -0
- package/src/entrypoint/0.7.ts +153 -0
- package/src/entrypoint/index.ts +152 -0
- package/src/entrypoint/types.ts +120 -0
- package/src/errors/account.ts +87 -0
- package/src/errors/base.ts +48 -0
- package/src/errors/client.ts +28 -0
- package/src/errors/entrypoint.ts +25 -0
- package/src/errors/signer.ts +13 -0
- package/src/errors/transaction.ts +16 -0
- package/src/errors/useroperation.ts +54 -0
- package/src/index.ts +172 -0
- package/src/logger.ts +58 -0
- package/src/middleware/actions.ts +92 -0
- package/src/middleware/defaults/feeEstimator.ts +50 -0
- package/src/middleware/defaults/gasEstimator.ts +66 -0
- package/src/middleware/defaults/paymasterAndData.ts +13 -0
- package/src/middleware/defaults/userOpSigner.ts +35 -0
- package/src/middleware/noopMiddleware.ts +12 -0
- package/src/middleware/types.ts +49 -0
- package/src/signer/local-account.ts +59 -0
- package/src/signer/schema.ts +16 -0
- package/src/signer/types.ts +46 -0
- package/src/signer/utils.ts +68 -0
- package/src/signer/wallet-client.ts +49 -0
- package/src/transport/split.ts +69 -0
- package/src/types.ts +411 -0
- package/src/utils/bigint.ts +118 -0
- package/src/utils/bytes.ts +23 -0
- package/src/utils/defaults.ts +93 -0
- package/src/utils/index.ts +173 -0
- package/src/utils/schema.ts +52 -0
- package/src/utils/stateOverride.ts +80 -0
- package/src/utils/testUtils.ts +42 -0
- package/src/utils/types.ts +94 -0
- package/src/utils/userop.ts +220 -0
- package/src/version.ts +3 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { Chain } from "viem";
|
|
2
|
+
import { toHex } from "viem";
|
|
3
|
+
import * as chains from "viem/chains";
|
|
4
|
+
import * as alchemyChains from "../chains/index.js";
|
|
5
|
+
import type { PromiseOrValue } from "../types.js";
|
|
6
|
+
import type { RecordableKeys } from "./types.js";
|
|
7
|
+
|
|
8
|
+
export const AlchemyChainMap = new Map<number, Chain>(
|
|
9
|
+
Object.values(alchemyChains).map((c) => [c.id, c])
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Utility method for converting a chainId to a {@link Chain} object
|
|
14
|
+
*
|
|
15
|
+
* @param chainId - the chainId to convert
|
|
16
|
+
* @returns a {@link Chain} object for the given chainId
|
|
17
|
+
* @throws if the chainId is not found
|
|
18
|
+
*/
|
|
19
|
+
export const getChain = (chainId: number): Chain => {
|
|
20
|
+
for (const chain of Object.values(chains)) {
|
|
21
|
+
if (chain.id === chainId) {
|
|
22
|
+
return AlchemyChainMap.get(chain.id) ?? chain;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
throw new Error("could not find chain");
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Utility function that allows for piping a series of async functions together
|
|
30
|
+
*
|
|
31
|
+
* @param fns - functions to pipe
|
|
32
|
+
* @returns result of the pipe
|
|
33
|
+
*/
|
|
34
|
+
export const asyncPipe =
|
|
35
|
+
<S, O, F>(...fns: ((s: S, o?: O, f?: F) => Promise<S>)[]) =>
|
|
36
|
+
async (s: S, o?: O, f?: F) => {
|
|
37
|
+
let result = s;
|
|
38
|
+
for (const fn of fns) {
|
|
39
|
+
result = await fn(result, o, f);
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// based on @ethersproject/properties, but pulled in here to minize the dependency on ethers
|
|
45
|
+
export type Deferrable<T> = {
|
|
46
|
+
[K in keyof T]: PromiseOrValue<T[K]>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Await all of the properties of a {@link Deferrable} object
|
|
51
|
+
*
|
|
52
|
+
* @param object - a {@link Deferrable} object
|
|
53
|
+
* @returns the object with its properties resolved
|
|
54
|
+
*/
|
|
55
|
+
export async function resolveProperties<T>(object: Deferrable<T>): Promise<T> {
|
|
56
|
+
const promises = Object.keys(object).map((key) => {
|
|
57
|
+
const value = object[key as keyof Deferrable<T>];
|
|
58
|
+
return Promise.resolve(value).then((v) => ({ key: key, value: v }));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const results = await Promise.all(promises);
|
|
62
|
+
|
|
63
|
+
return filterUndefined<T>(
|
|
64
|
+
results.reduce((accum, curr) => {
|
|
65
|
+
accum[curr.key as keyof T] = curr.value;
|
|
66
|
+
return accum;
|
|
67
|
+
}, {} as T)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Recursively converts all values in an object to hex strings
|
|
73
|
+
*
|
|
74
|
+
* @param obj - obj to deep hexlify
|
|
75
|
+
* @returns object with all of its values hexlified
|
|
76
|
+
*/
|
|
77
|
+
export function deepHexlify(obj: any): any {
|
|
78
|
+
if (typeof obj === "function") {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
if (obj == null || typeof obj === "string" || typeof obj === "boolean") {
|
|
82
|
+
return obj;
|
|
83
|
+
} else if (typeof obj === "bigint") {
|
|
84
|
+
return toHex(obj);
|
|
85
|
+
} else if (obj._isBigNumber != null || typeof obj !== "object") {
|
|
86
|
+
return toHex(obj).replace(/^0x0/, "0x");
|
|
87
|
+
}
|
|
88
|
+
if (Array.isArray(obj)) {
|
|
89
|
+
return obj.map((member) => deepHexlify(member));
|
|
90
|
+
}
|
|
91
|
+
return Object.keys(obj).reduce(
|
|
92
|
+
(set, key) => ({
|
|
93
|
+
...set,
|
|
94
|
+
[key]: deepHexlify(obj[key]),
|
|
95
|
+
}),
|
|
96
|
+
{}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// borrowed from ethers.js
|
|
101
|
+
export function defineReadOnly<T, K extends keyof T>(
|
|
102
|
+
object: T,
|
|
103
|
+
key: K,
|
|
104
|
+
value: T[K]
|
|
105
|
+
): void {
|
|
106
|
+
Object.defineProperty(object, key, {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
value: value,
|
|
109
|
+
writable: false,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function filterUndefined<T>(obj: T): T {
|
|
114
|
+
for (const key in obj) {
|
|
115
|
+
if (obj[key] == null) {
|
|
116
|
+
delete obj[key];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return obj as T;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function pick(obj: Record<string, unknown>, keys: string | string[]) {
|
|
123
|
+
return Object.keys(obj)
|
|
124
|
+
.filter((k) => keys.includes(k))
|
|
125
|
+
.reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Utility method for checking if the passed in values are all equal (strictly)
|
|
130
|
+
*
|
|
131
|
+
* @param params - values to check
|
|
132
|
+
* @returns a boolean indicating if all values are the same
|
|
133
|
+
* @throws if no values are passed in
|
|
134
|
+
*/
|
|
135
|
+
export const allEqual = (...params: any[]): boolean => {
|
|
136
|
+
if (params.length === 0) {
|
|
137
|
+
throw new Error("no values passed in");
|
|
138
|
+
}
|
|
139
|
+
return params.every((v) => v === params[0]);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Utility method for checking the condition and return the value if condition holds true, undefined if not.
|
|
144
|
+
*
|
|
145
|
+
* @param condition - condition to check
|
|
146
|
+
* @param value - value to return when condition holds true
|
|
147
|
+
* @returns the value if condition holds true, undefined if not
|
|
148
|
+
*/
|
|
149
|
+
export const conditionalReturn = <T>(
|
|
150
|
+
condition: Promise<boolean>,
|
|
151
|
+
value: () => Promise<T>
|
|
152
|
+
): Promise<T | undefined> => condition.then((t) => (t ? value() : undefined));
|
|
153
|
+
|
|
154
|
+
export const toRecord = <
|
|
155
|
+
T extends { [K in RecordableKeys<T>]: string | number | symbol },
|
|
156
|
+
K extends RecordableKeys<T>,
|
|
157
|
+
V
|
|
158
|
+
>(
|
|
159
|
+
array: T[],
|
|
160
|
+
selector: K,
|
|
161
|
+
fn: (item: T) => V
|
|
162
|
+
): Record<T[K], V> =>
|
|
163
|
+
array.reduce((acc, item) => {
|
|
164
|
+
acc[item[selector]] = fn(item);
|
|
165
|
+
return acc;
|
|
166
|
+
}, {} as Record<T[K], V>);
|
|
167
|
+
|
|
168
|
+
export * from "./bigint.js";
|
|
169
|
+
export * from "./bytes.js";
|
|
170
|
+
export * from "./defaults.js";
|
|
171
|
+
export * from "./schema.js";
|
|
172
|
+
export type * from "./types.js";
|
|
173
|
+
export * from "./userop.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { isHex, type Chain } from "viem";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { BigNumberish, Multiplier } from "../types";
|
|
4
|
+
|
|
5
|
+
export const ChainSchema = z.custom<Chain>(
|
|
6
|
+
(chain) =>
|
|
7
|
+
chain != null &&
|
|
8
|
+
typeof chain === "object" &&
|
|
9
|
+
"id" in chain &&
|
|
10
|
+
typeof chain.id === "number"
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const HexSchema = z.custom<`0x${string}` | "0x">((val) => {
|
|
14
|
+
return isHex(val, { strict: true });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// [!region BigNumberish]
|
|
18
|
+
export const BigNumberishSchema = z.union([HexSchema, z.number(), z.bigint()]);
|
|
19
|
+
// [!endregion BigNumberish]
|
|
20
|
+
|
|
21
|
+
// [!region BigNumberishRange]
|
|
22
|
+
export const BigNumberishRangeSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
min: BigNumberishSchema.optional(),
|
|
25
|
+
max: BigNumberishSchema.optional(),
|
|
26
|
+
})
|
|
27
|
+
.strict();
|
|
28
|
+
// [!endregion BigNumberishRange]
|
|
29
|
+
|
|
30
|
+
// [!region Multiplier]
|
|
31
|
+
export const MultiplierSchema = z
|
|
32
|
+
.object({
|
|
33
|
+
/**
|
|
34
|
+
* Multiplier value with max precision of 4 decimal places
|
|
35
|
+
*/
|
|
36
|
+
multiplier: z.number().refine(
|
|
37
|
+
(n) => {
|
|
38
|
+
return (n.toString().split(".")[1]?.length ?? 0) <= 4;
|
|
39
|
+
},
|
|
40
|
+
{ message: "Max precision is 4 decimal places" }
|
|
41
|
+
),
|
|
42
|
+
})
|
|
43
|
+
.strict();
|
|
44
|
+
// [!endregion Multiplier]
|
|
45
|
+
|
|
46
|
+
export function isBigNumberish(x: any): x is BigNumberish {
|
|
47
|
+
return x != null && BigNumberishSchema.safeParse(x).success;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function isMultiplier(x: any): x is Multiplier {
|
|
51
|
+
return x != null && MultiplierSchema.safeParse(x).success;
|
|
52
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Address } from "abitype";
|
|
2
|
+
import {
|
|
3
|
+
AccountStateConflictError,
|
|
4
|
+
InvalidAddressError,
|
|
5
|
+
StateAssignmentConflictError,
|
|
6
|
+
isAddress,
|
|
7
|
+
numberToHex,
|
|
8
|
+
type RpcAccountStateOverride,
|
|
9
|
+
type RpcStateMapping,
|
|
10
|
+
type RpcStateOverride,
|
|
11
|
+
type StateMapping,
|
|
12
|
+
type StateOverride,
|
|
13
|
+
} from "viem";
|
|
14
|
+
|
|
15
|
+
// Copied from Viem's utils/stateOverride.ts, which does not expose these
|
|
16
|
+
// functions.
|
|
17
|
+
|
|
18
|
+
type SerializeStateMappingParameters = StateMapping | undefined;
|
|
19
|
+
|
|
20
|
+
function serializeStateMapping(
|
|
21
|
+
stateMapping: SerializeStateMappingParameters
|
|
22
|
+
): RpcStateMapping | undefined {
|
|
23
|
+
if (!stateMapping || stateMapping.length === 0) return undefined;
|
|
24
|
+
return stateMapping.reduce((acc, { slot, value }) => {
|
|
25
|
+
validateBytes32HexLength(slot);
|
|
26
|
+
validateBytes32HexLength(value);
|
|
27
|
+
acc[slot] = value;
|
|
28
|
+
return acc;
|
|
29
|
+
}, {} as RpcStateMapping);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function validateBytes32HexLength(value: Address): void {
|
|
33
|
+
if (value.length !== 66) {
|
|
34
|
+
// This is the error message from Viem's non-exported InvalidBytesLengthError.
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Hex is expected to be 66 hex long, but is ${value.length} hex long.`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type SerializeAccountStateOverrideParameters = Omit<
|
|
42
|
+
StateOverride[number],
|
|
43
|
+
"address"
|
|
44
|
+
>;
|
|
45
|
+
|
|
46
|
+
function serializeAccountStateOverride(
|
|
47
|
+
parameters: SerializeAccountStateOverrideParameters
|
|
48
|
+
): RpcAccountStateOverride {
|
|
49
|
+
const { balance, nonce, state, stateDiff, code } = parameters;
|
|
50
|
+
const rpcAccountStateOverride: RpcAccountStateOverride = {};
|
|
51
|
+
if (code !== undefined) rpcAccountStateOverride.code = code;
|
|
52
|
+
if (balance !== undefined)
|
|
53
|
+
rpcAccountStateOverride.balance = numberToHex(balance);
|
|
54
|
+
if (nonce !== undefined) rpcAccountStateOverride.nonce = numberToHex(nonce);
|
|
55
|
+
if (state !== undefined)
|
|
56
|
+
rpcAccountStateOverride.state = serializeStateMapping(state);
|
|
57
|
+
if (stateDiff !== undefined) {
|
|
58
|
+
if (rpcAccountStateOverride.state) throw new StateAssignmentConflictError();
|
|
59
|
+
rpcAccountStateOverride.stateDiff = serializeStateMapping(stateDiff);
|
|
60
|
+
}
|
|
61
|
+
return rpcAccountStateOverride;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type SerializeStateOverrideParameters = StateOverride | undefined;
|
|
65
|
+
|
|
66
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
67
|
+
export function serializeStateOverride(
|
|
68
|
+
parameters?: SerializeStateOverrideParameters
|
|
69
|
+
): RpcStateOverride | undefined {
|
|
70
|
+
if (!parameters) return undefined;
|
|
71
|
+
const rpcStateOverride: RpcStateOverride = {};
|
|
72
|
+
for (const { address, ...accountState } of parameters) {
|
|
73
|
+
if (!isAddress(address, { strict: false }))
|
|
74
|
+
throw new InvalidAddressError({ address });
|
|
75
|
+
if (rpcStateOverride[address])
|
|
76
|
+
throw new AccountStateConflictError({ address: address });
|
|
77
|
+
rpcStateOverride[address] = serializeAccountStateOverride(accountState);
|
|
78
|
+
}
|
|
79
|
+
return rpcStateOverride;
|
|
80
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createPublicClient, custom, type Chain, type Hex } from "viem";
|
|
2
|
+
import {
|
|
3
|
+
toSmartContractAccount,
|
|
4
|
+
type SmartContractAccount,
|
|
5
|
+
} from "../account/smartContractAccount.js";
|
|
6
|
+
import {
|
|
7
|
+
createBundlerClientFromExisting,
|
|
8
|
+
type BundlerClient,
|
|
9
|
+
} from "../client/bundlerClient.js";
|
|
10
|
+
import { getEntryPoint } from "../entrypoint/index.js";
|
|
11
|
+
import type { DefaultEntryPointVersion } from "../entrypoint/types.js";
|
|
12
|
+
|
|
13
|
+
export const createDummySmartContractAccount = async <C extends BundlerClient>(
|
|
14
|
+
client: C
|
|
15
|
+
): Promise<SmartContractAccount<"dummy", DefaultEntryPointVersion>> => {
|
|
16
|
+
return toSmartContractAccount({
|
|
17
|
+
source: "dummy",
|
|
18
|
+
accountAddress: "0x1234567890123456789012345678901234567890",
|
|
19
|
+
entryPoint: getEntryPoint(client.chain),
|
|
20
|
+
chain: client.chain,
|
|
21
|
+
transport: custom(client),
|
|
22
|
+
signMessage: async () => "0xdeadbeef",
|
|
23
|
+
signTypedData: async () => "0xdeadbeef",
|
|
24
|
+
getAccountInitCode: async () =>
|
|
25
|
+
"0x1234567890123456789012345678901234567890deadbeef",
|
|
26
|
+
encodeBatchExecute: async () => "0x",
|
|
27
|
+
encodeExecute: async () => "0x",
|
|
28
|
+
getDummySignature: (): Hex =>
|
|
29
|
+
"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const createTestClient = (chain: Chain) => {
|
|
34
|
+
return createBundlerClientFromExisting(
|
|
35
|
+
createPublicClient({
|
|
36
|
+
chain,
|
|
37
|
+
transport: custom({
|
|
38
|
+
request: async () => {},
|
|
39
|
+
}),
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// borrowed from viem
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Constructs a type by excluding `undefined` from `T`.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* NoUndefined<string | undefined>
|
|
8
|
+
* => string
|
|
9
|
+
*/
|
|
10
|
+
export type NoUndefined<T> = T extends undefined ? never : T;
|
|
11
|
+
// borrowed from viem
|
|
12
|
+
/**
|
|
13
|
+
* @description Checks if {@link T} is `undefined`
|
|
14
|
+
* @param T - Type to check
|
|
15
|
+
* @example
|
|
16
|
+
* type Result = IsUndefined<undefined>
|
|
17
|
+
* // ^? type Result = true
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export type IsUndefined<T> = [undefined] extends [T] ? true : false;
|
|
21
|
+
|
|
22
|
+
export type RequiredBy<TType, TKeys extends keyof TType> = Required<
|
|
23
|
+
Pick<TType, TKeys>
|
|
24
|
+
> &
|
|
25
|
+
Omit<TType, TKeys>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @description Combines members of an intersection into a readable type.
|
|
29
|
+
*
|
|
30
|
+
* @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}
|
|
31
|
+
* @example
|
|
32
|
+
* Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>
|
|
33
|
+
* => { a: string, b: string, c: number, d: bigint }
|
|
34
|
+
*/
|
|
35
|
+
export type Prettify<T> = {
|
|
36
|
+
[K in keyof T]: T[K];
|
|
37
|
+
} & {};
|
|
38
|
+
|
|
39
|
+
export type WithRequired<T, K extends keyof T> = Required<Pick<T, K>>;
|
|
40
|
+
export type WithOptional<T, K extends keyof T> = Pick<Partial<T>, K>;
|
|
41
|
+
|
|
42
|
+
// Checks for type equivalence, evaluates always to either `true` or `false`.
|
|
43
|
+
// Semantics: (EQ<A, B> = true) <==> (A <==> B)
|
|
44
|
+
export type EQ<A, B> = [A] extends [B]
|
|
45
|
+
? [B] extends [A]
|
|
46
|
+
? true
|
|
47
|
+
: false
|
|
48
|
+
: false;
|
|
49
|
+
|
|
50
|
+
// Auxiliary type for `IsMemberOrSubtypeOfAComponent`
|
|
51
|
+
// Evaluates to `true` or `boolean` if one of the explicit components (according to the TypeScript distribution
|
|
52
|
+
// mechanism for union types) of the union type equals the other given type.
|
|
53
|
+
// Examples:
|
|
54
|
+
// EqualsOneOfTheComponents<string, string | boolean> ⟶ boolean
|
|
55
|
+
// EqualsOneOfTheComponents<string, string> ⟶ true
|
|
56
|
+
// EqualsOneOfTheComponents<number, string | boolean> ⟶ false
|
|
57
|
+
export type EqualsOneOfTheComponents<T, Union> = Union extends infer Component // enforce distribution
|
|
58
|
+
? EQ<T, Component>
|
|
59
|
+
: never;
|
|
60
|
+
|
|
61
|
+
// Auxiliary type for `IsOneOf`
|
|
62
|
+
export type IsMemberOrSubtypeOfAComponent<
|
|
63
|
+
T,
|
|
64
|
+
Union,
|
|
65
|
+
ConjunctionOfExplicitComponentChecks extends boolean
|
|
66
|
+
> = [T] extends [Union]
|
|
67
|
+
? true extends ConjunctionOfExplicitComponentChecks
|
|
68
|
+
? true
|
|
69
|
+
: false
|
|
70
|
+
: false;
|
|
71
|
+
|
|
72
|
+
// Checks whether the given type equals one of the explicit components of the union type. Note that in this respect we
|
|
73
|
+
// consider the members of the infinite types number and string as implicit since the inbuilt distribution mechanism of
|
|
74
|
+
// TypeScript does not (cannot) distribute over the infinite number of strings or numbers. However, `boolean` is treated
|
|
75
|
+
// by TypeScript (and accordingly here) as the explicit union `true | false`.
|
|
76
|
+
//
|
|
77
|
+
// In particular, the evaluation result is `false` if the type is a proper union of components of the union type. It also
|
|
78
|
+
// evaluates to false if the given type is a proper subtype of one of its explicit components.
|
|
79
|
+
// It always evaluates to either `true` or `false`.
|
|
80
|
+
// Examples:
|
|
81
|
+
// IsOneOf<number, string | number | boolean> ⟶ true
|
|
82
|
+
// IsOneOf<2 | 4, 0 | 1 | 2 | 3 | 4 | 5 | 6> ⟶ false
|
|
83
|
+
// IsOneOf<'text', string> ⟶ false // only implicit but not explicit component
|
|
84
|
+
export type IsOneOf<T, Union> = IsMemberOrSubtypeOfAComponent<
|
|
85
|
+
T,
|
|
86
|
+
Union,
|
|
87
|
+
EqualsOneOfTheComponents<T, Union>
|
|
88
|
+
>;
|
|
89
|
+
|
|
90
|
+
export type OneOf<T1, T2> = IsOneOf<T1, T2> extends true ? T1 : never;
|
|
91
|
+
|
|
92
|
+
export type RecordableKeys<T> = {
|
|
93
|
+
[K in keyof T]: T[K] extends string | number | symbol ? K : never;
|
|
94
|
+
}[keyof T];
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { concat, type Address, type Hex } from "viem";
|
|
2
|
+
import type { EntryPointVersion } from "../entrypoint/types";
|
|
3
|
+
import type {
|
|
4
|
+
BigNumberish,
|
|
5
|
+
Multiplier,
|
|
6
|
+
UserOperationFeeOptionsField,
|
|
7
|
+
UserOperationOverrides,
|
|
8
|
+
UserOperationRequest,
|
|
9
|
+
UserOperationStruct,
|
|
10
|
+
UserOperationStruct_v6,
|
|
11
|
+
UserOperationStruct_v7,
|
|
12
|
+
} from "../types";
|
|
13
|
+
import { bigIntClamp, bigIntMultiply } from "./bigint.js";
|
|
14
|
+
import { allEqual, isBigNumberish } from "./index.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Utility method for asserting a {@link UserOperationStruct} has valid fields for the given entry point version
|
|
18
|
+
*
|
|
19
|
+
* @param request a {@link UserOperationStruct} to validate
|
|
20
|
+
* @returns a type guard that asserts the {@link UserOperationRequest} is valid
|
|
21
|
+
*/
|
|
22
|
+
export function isValidRequest<
|
|
23
|
+
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
24
|
+
>(
|
|
25
|
+
request: UserOperationStruct<TEntryPointVersion>
|
|
26
|
+
): request is UserOperationRequest<TEntryPointVersion> {
|
|
27
|
+
// These are the only ones marked as optional in the interface above
|
|
28
|
+
return (
|
|
29
|
+
BigInt(request.callGasLimit || 0n) > 0n &&
|
|
30
|
+
BigInt(request.maxFeePerGas || 0n) > 0n &&
|
|
31
|
+
BigInt(request.preVerificationGas || 0n) > 0n &&
|
|
32
|
+
BigInt(request.verificationGasLimit || 0n) > 0n &&
|
|
33
|
+
request.maxPriorityFeePerGas != null &&
|
|
34
|
+
isValidPaymasterAndData(request) &&
|
|
35
|
+
isValidFactoryAndData(request)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Utility method for asserting a {@link UserOperationRequest} has valid fields for the paymaster data
|
|
41
|
+
*
|
|
42
|
+
* @param request a {@link UserOperationRequest} to validate
|
|
43
|
+
* @returns a type guard that asserts the {@link UserOperationRequest} is a {@link UserOperationRequest}
|
|
44
|
+
*/
|
|
45
|
+
export function isValidPaymasterAndData<
|
|
46
|
+
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
47
|
+
>(request: UserOperationStruct<TEntryPointVersion>): boolean {
|
|
48
|
+
if ("paymasterAndData" in request) {
|
|
49
|
+
return (request as UserOperationStruct_v6).paymasterAndData != null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// either all exist, or none.
|
|
53
|
+
return allEqual(
|
|
54
|
+
(request as UserOperationStruct_v7).paymaster == null,
|
|
55
|
+
(request as UserOperationStruct_v7).paymasterData == null,
|
|
56
|
+
(request as UserOperationStruct_v7).paymasterPostOpGasLimit == null,
|
|
57
|
+
(request as UserOperationStruct_v7).paymasterVerificationGasLimit == null
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Utility method for asserting a {@link UserOperationStruct} has valid fields for the paymaster data
|
|
63
|
+
*
|
|
64
|
+
* @param request a {@link UserOperationRequest} to validate
|
|
65
|
+
* @returns a type guard that asserts the {@link UserOperationStruct} is a {@link UserOperationRequest}
|
|
66
|
+
*/
|
|
67
|
+
export function isValidFactoryAndData<
|
|
68
|
+
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
69
|
+
>(request: UserOperationStruct<TEntryPointVersion>): boolean {
|
|
70
|
+
if ("initCode" in request) {
|
|
71
|
+
const { initCode } = request as UserOperationStruct_v6;
|
|
72
|
+
return initCode != null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// either all exist, or none.
|
|
76
|
+
return allEqual(
|
|
77
|
+
(request as UserOperationStruct_v7).factory == null,
|
|
78
|
+
(request as UserOperationStruct_v7).factoryData == null
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Utility method for applying a {@link UserOperationOverrides} field value
|
|
84
|
+
* over the current value set for the field
|
|
85
|
+
*
|
|
86
|
+
* @param value the current value of the field
|
|
87
|
+
* @param override the override value to apply
|
|
88
|
+
* @returns the new value of the field after applying the override
|
|
89
|
+
*/
|
|
90
|
+
export function applyUserOpOverride<TValue extends BigNumberish | undefined>(
|
|
91
|
+
value: TValue,
|
|
92
|
+
override?: BigNumberish | Multiplier
|
|
93
|
+
): TValue | BigNumberish {
|
|
94
|
+
if (override == null) {
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (isBigNumberish(override)) {
|
|
99
|
+
return override;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// multiplier override
|
|
103
|
+
else {
|
|
104
|
+
return value != null ? bigIntMultiply(value, override.multiplier) : value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Utility method for applying a {@link UserOperationFeeOptionsField} value
|
|
110
|
+
* over the current value set for the field
|
|
111
|
+
*
|
|
112
|
+
* @param value the current value of the field
|
|
113
|
+
* @param feeOption the fee option field value to apply
|
|
114
|
+
* @returns the new value of the field after applying the fee option
|
|
115
|
+
*/
|
|
116
|
+
export function applyUserOpFeeOption<TValue extends BigNumberish | undefined>(
|
|
117
|
+
value: TValue,
|
|
118
|
+
feeOption?: UserOperationFeeOptionsField
|
|
119
|
+
): TValue | BigNumberish {
|
|
120
|
+
if (feeOption == null) {
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return value != null
|
|
125
|
+
? bigIntClamp(
|
|
126
|
+
feeOption.multiplier
|
|
127
|
+
? bigIntMultiply(value, feeOption.multiplier)
|
|
128
|
+
: value,
|
|
129
|
+
feeOption.min,
|
|
130
|
+
feeOption.max
|
|
131
|
+
)
|
|
132
|
+
: feeOption.min ?? 0n;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Utility method for applying a {@link UserOperationOverrides} field value and
|
|
137
|
+
* a {@link UserOperationFeeOptionsField} value over the current value set for the field,
|
|
138
|
+
* with the override taking precedence over the fee option
|
|
139
|
+
*
|
|
140
|
+
* @param value the current value of the field
|
|
141
|
+
* @param [override] the override value to apply
|
|
142
|
+
* @param [feeOption] the fee option field value to apply
|
|
143
|
+
* @returns the new value of the field after applying the override or fee option
|
|
144
|
+
*/
|
|
145
|
+
export function applyUserOpOverrideOrFeeOption<
|
|
146
|
+
TValue extends BigNumberish | undefined
|
|
147
|
+
>(
|
|
148
|
+
value: TValue,
|
|
149
|
+
override?: BigNumberish | Multiplier,
|
|
150
|
+
feeOption?: UserOperationFeeOptionsField
|
|
151
|
+
): TValue | BigNumberish {
|
|
152
|
+
return value != null && override != null
|
|
153
|
+
? applyUserOpOverride(value, override)!
|
|
154
|
+
: applyUserOpFeeOption(value, feeOption);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Utility method for checking whether the middleware pipeline should
|
|
159
|
+
* bypass the paymaster middleware for the user operation with the given overrides,
|
|
160
|
+
* either because the UserOp is paying for its own gas, or passing a specific paymaster
|
|
161
|
+
*
|
|
162
|
+
* @template EntryPointVersion TEntryPointVersion
|
|
163
|
+
* @param overrides the user operation overrides to check
|
|
164
|
+
* @returns whether the paymaster middleware should be bypassed
|
|
165
|
+
*/
|
|
166
|
+
export const bypassPaymasterAndData = <
|
|
167
|
+
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
168
|
+
>(
|
|
169
|
+
overrides: UserOperationOverrides<TEntryPointVersion> | undefined
|
|
170
|
+
): boolean =>
|
|
171
|
+
!!overrides &&
|
|
172
|
+
("paymasterAndData" in overrides || "paymasterData" in overrides);
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* An alternative to `bypassPaymasterAndData` which only returns true if the data parameter
|
|
176
|
+
* is "0x," this is useful for cases when middleware should be bypassed ONLY IF the UserOp will
|
|
177
|
+
* pay for its own gas
|
|
178
|
+
*
|
|
179
|
+
* @template EntryPointVersion TEntryPointVersion
|
|
180
|
+
* @param overrides the user operation overrides to check
|
|
181
|
+
* @returns whether the paymaster middleware should be bypassed
|
|
182
|
+
*/
|
|
183
|
+
export const bypassPaymasterAndDataEmptyHex = <
|
|
184
|
+
TEntryPointVersion extends EntryPointVersion = EntryPointVersion
|
|
185
|
+
>(
|
|
186
|
+
overrides: UserOperationOverrides<TEntryPointVersion> | undefined
|
|
187
|
+
): boolean =>
|
|
188
|
+
overrides !== undefined &&
|
|
189
|
+
(("paymasterAndData" in overrides && overrides.paymasterAndData === "0x") ||
|
|
190
|
+
("paymasterData" in overrides && overrides.paymasterData === "0x"));
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Utility method for parsing the paymaster address and paymasterData from the paymasterAndData hex string
|
|
194
|
+
*
|
|
195
|
+
* @param paymasterAndData the paymaster and data hex string to parse.
|
|
196
|
+
* The hex string refers to the paymasterAndData field of entrypoint v0.6 user operation request
|
|
197
|
+
* @returns the parsed paymaster and paymasterData fields of entrypoint v0.7 user operation request paymaster and paymasterData field
|
|
198
|
+
*/
|
|
199
|
+
export const parsePaymasterAndData = (
|
|
200
|
+
paymasterAndData: Hex
|
|
201
|
+
): Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData"> => ({
|
|
202
|
+
paymaster: paymasterAndData.substring(0, 42) as Address,
|
|
203
|
+
paymasterData: `0x${paymasterAndData.substring(42)}` as Hex,
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Utility method for converting the object containing the paymaster address and paymaster data
|
|
208
|
+
* to the paymaster and data concatenated hex string
|
|
209
|
+
*
|
|
210
|
+
* @param paymasterAndData the object containing the picked paymaster and paymasterData fields of
|
|
211
|
+
* entrypoint v0.7 user operation request
|
|
212
|
+
* @param paymasterAndData.paymaster the paymaster address
|
|
213
|
+
* @param paymasterAndData.paymasterData the paymaster data
|
|
214
|
+
* @returns the paymasterAndData hex value of entrypoint v0.6 user operation request paymasterAndData field
|
|
215
|
+
*/
|
|
216
|
+
export const concatPaymasterAndData = ({
|
|
217
|
+
paymaster = "0x",
|
|
218
|
+
paymasterData = "0x",
|
|
219
|
+
}: Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData">): Hex =>
|
|
220
|
+
concat([paymaster, paymasterData]);
|
package/src/version.ts
ADDED