@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,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultUserOperationFeeOptions = exports.minPriorityFeePerBidDefaults = exports.getDefaultSimpleAccountFactoryAddress = void 0;
|
|
4
|
+
const index_js_1 = require("../chains/index.js");
|
|
5
|
+
const index_js_2 = require("../entrypoint/index.js");
|
|
6
|
+
const account_js_1 = require("../errors/account.js");
|
|
7
|
+
const getDefaultSimpleAccountFactoryAddress = (chain, version = index_js_2.defaultEntryPointVersion) => {
|
|
8
|
+
switch (version) {
|
|
9
|
+
case "0.6.0":
|
|
10
|
+
switch (chain.id) {
|
|
11
|
+
case index_js_1.mainnet.id:
|
|
12
|
+
case index_js_1.polygon.id:
|
|
13
|
+
case index_js_1.polygonAmoy.id:
|
|
14
|
+
case index_js_1.optimism.id:
|
|
15
|
+
case index_js_1.optimismSepolia.id:
|
|
16
|
+
case index_js_1.arbitrum.id:
|
|
17
|
+
case index_js_1.arbitrumSepolia.id:
|
|
18
|
+
case index_js_1.base.id:
|
|
19
|
+
case index_js_1.baseGoerli.id:
|
|
20
|
+
case index_js_1.baseSepolia.id:
|
|
21
|
+
case index_js_1.fraxtal.id:
|
|
22
|
+
case index_js_1.fraxtalSepolia.id:
|
|
23
|
+
case index_js_1.zora.id:
|
|
24
|
+
case index_js_1.zoraSepolia.id:
|
|
25
|
+
return "0x15Ba39375ee2Ab563E8873C8390be6f2E2F50232";
|
|
26
|
+
case index_js_1.sepolia.id:
|
|
27
|
+
case index_js_1.goerli.id:
|
|
28
|
+
case index_js_1.polygonMumbai.id:
|
|
29
|
+
case index_js_1.optimismGoerli.id:
|
|
30
|
+
case index_js_1.arbitrumGoerli.id:
|
|
31
|
+
return "0x9406Cc6185a346906296840746125a0E44976454";
|
|
32
|
+
default:
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
break;
|
|
36
|
+
case "0.7.0":
|
|
37
|
+
switch (chain.id) {
|
|
38
|
+
default:
|
|
39
|
+
return "0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
throw new account_js_1.DefaultFactoryNotDefinedError("SimpleAccount", chain, version);
|
|
43
|
+
};
|
|
44
|
+
exports.getDefaultSimpleAccountFactoryAddress = getDefaultSimpleAccountFactoryAddress;
|
|
45
|
+
exports.minPriorityFeePerBidDefaults = new Map([
|
|
46
|
+
[index_js_1.arbitrum.id, 10000000n],
|
|
47
|
+
[index_js_1.arbitrumGoerli.id, 10000000n],
|
|
48
|
+
[index_js_1.arbitrumSepolia.id, 10000000n],
|
|
49
|
+
]);
|
|
50
|
+
const getDefaultUserOperationFeeOptions = (chain) => {
|
|
51
|
+
return {
|
|
52
|
+
maxPriorityFeePerGas: {
|
|
53
|
+
min: exports.minPriorityFeePerBidDefaults.get(chain.id) ?? 100000000n,
|
|
54
|
+
multiplier: 1.33,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
exports.getDefaultUserOperationFeeOptions = getDefaultUserOperationFeeOptions;
|
|
59
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":";;;AACA,iDAoB4B;AAC5B,qDAAkE;AAElE,qDAAqE;AAW9D,MAAM,qCAAqC,GAAG,CACnD,KAAY,EACZ,UAA6B,mCAAwB,EAC5C,EAAE;IACX,QAAQ,OAAO,EAAE,CAAC;QAChB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E,EAAE,SAAW,CAAC;IAChC,CAAC,0BAAe,CAAC,EAAE,EAAE,SAAW,CAAC;CAClC,CAAC,CAAC;AAEI,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,OAAO;QACL,oBAAoB,EAAE;YACpB,GAAG,EAAE,oCAA4B,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,UAAY;YAC/D,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,iCAAiC,qCAS5C","sourcesContent":["import { type Address, type Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"../chains/index.js\";\nimport { defaultEntryPointVersion } from \"../entrypoint/index.js\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { DefaultFactoryNotDefinedError } from \"../errors/account.js\";\nimport type { UserOperationFeeOptions } from \"../types\";\n\n/**\n * Utility method returning the default simple account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - {@link EntryPointVersion} value that defaults to `defaultEntryPointVersion`\n * @returns a {@link abi.Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultSimpleAccountFactoryAddress = (\n chain: Chain,\n version: EntryPointVersion = defaultEntryPointVersion\n): Address => {\n switch (version) {\n case \"0.6.0\":\n switch (chain.id) {\n case mainnet.id:\n case polygon.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n case baseGoerli.id:\n case baseSepolia.id:\n case fraxtal.id:\n case fraxtalSepolia.id:\n case zora.id:\n case zoraSepolia.id:\n return \"0x15Ba39375ee2Ab563E8873C8390be6f2E2F50232\";\n case sepolia.id:\n case goerli.id:\n case polygonMumbai.id:\n case optimismGoerli.id:\n case arbitrumGoerli.id:\n return \"0x9406Cc6185a346906296840746125a0E44976454\";\n default:\n break;\n }\n break;\n case \"0.7.0\":\n switch (chain.id) {\n default:\n return \"0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985\";\n }\n }\n\n throw new DefaultFactoryNotDefinedError(\"SimpleAccount\", chain, version);\n};\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [arbitrum.id, 10_000_000n],\n [arbitrumGoerli.id, 10_000_000n],\n [arbitrumSepolia.id, 10_000_000n],\n]);\n\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain\n): UserOperationFeeOptions => {\n return {\n maxPriorityFeePerGas: {\n min: minPriorityFeePerBidDefaults.get(chain.id) ?? 100_000_000n,\n multiplier: 1.33,\n },\n };\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Chain } from "viem";
|
|
2
|
+
import type { PromiseOrValue } from "../types.js";
|
|
3
|
+
import type { RecordableKeys } from "./types.js";
|
|
4
|
+
export declare const AlchemyChainMap: Map<number, Chain>;
|
|
5
|
+
export declare const getChain: (chainId: number) => Chain;
|
|
6
|
+
export declare const asyncPipe: <S, O, F>(...fns: ((s: S, o?: O | undefined, f?: F | undefined) => Promise<S>)[]) => (s: S, o?: O | undefined, f?: F | undefined) => Promise<S>;
|
|
7
|
+
export type Deferrable<T> = {
|
|
8
|
+
[K in keyof T]: PromiseOrValue<T[K]>;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolveProperties<T>(object: Deferrable<T>): Promise<T>;
|
|
11
|
+
export declare function deepHexlify(obj: any): any;
|
|
12
|
+
export declare function defineReadOnly<T, K extends keyof T>(object: T, key: K, value: T[K]): void;
|
|
13
|
+
export declare function filterUndefined<T>(obj: T): T;
|
|
14
|
+
export declare function pick(obj: Record<string, unknown>, keys: string | string[]): {};
|
|
15
|
+
export declare const allEqual: (...params: any[]) => boolean;
|
|
16
|
+
export declare const conditionalReturn: <T>(condition: Promise<boolean>, value: () => Promise<T>) => Promise<T | undefined>;
|
|
17
|
+
export declare const toRecord: <T extends { [K in RecordableKeys<T>]: string | number | symbol; }, K_1 extends RecordableKeys<T>, V>(array: T[], selector: K_1, fn: (item: T) => V) => Record<T[K_1], V>;
|
|
18
|
+
export * from "./bigint.js";
|
|
19
|
+
export * from "./bytes.js";
|
|
20
|
+
export * from "./defaults.js";
|
|
21
|
+
export * from "./schema.js";
|
|
22
|
+
export type * from "./types.js";
|
|
23
|
+
export * from "./userop.js";
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.toRecord = exports.conditionalReturn = exports.allEqual = exports.pick = exports.filterUndefined = exports.defineReadOnly = exports.deepHexlify = exports.resolveProperties = exports.asyncPipe = exports.getChain = exports.AlchemyChainMap = void 0;
|
|
30
|
+
const viem_1 = require("viem");
|
|
31
|
+
const chains = __importStar(require("viem/chains"));
|
|
32
|
+
const alchemyChains = __importStar(require("../chains/index.js"));
|
|
33
|
+
exports.AlchemyChainMap = new Map(Object.values(alchemyChains).map((c) => [c.id, c]));
|
|
34
|
+
const getChain = (chainId) => {
|
|
35
|
+
for (const chain of Object.values(chains)) {
|
|
36
|
+
if (chain.id === chainId) {
|
|
37
|
+
return exports.AlchemyChainMap.get(chain.id) ?? chain;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
throw new Error("could not find chain");
|
|
41
|
+
};
|
|
42
|
+
exports.getChain = getChain;
|
|
43
|
+
const asyncPipe = (...fns) => async (s, o, f) => {
|
|
44
|
+
let result = s;
|
|
45
|
+
for (const fn of fns) {
|
|
46
|
+
result = await fn(result, o, f);
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
exports.asyncPipe = asyncPipe;
|
|
51
|
+
async function resolveProperties(object) {
|
|
52
|
+
const promises = Object.keys(object).map((key) => {
|
|
53
|
+
const value = object[key];
|
|
54
|
+
return Promise.resolve(value).then((v) => ({ key: key, value: v }));
|
|
55
|
+
});
|
|
56
|
+
const results = await Promise.all(promises);
|
|
57
|
+
return filterUndefined(results.reduce((accum, curr) => {
|
|
58
|
+
accum[curr.key] = curr.value;
|
|
59
|
+
return accum;
|
|
60
|
+
}, {}));
|
|
61
|
+
}
|
|
62
|
+
exports.resolveProperties = resolveProperties;
|
|
63
|
+
function deepHexlify(obj) {
|
|
64
|
+
if (typeof obj === "function") {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
if (obj == null || typeof obj === "string" || typeof obj === "boolean") {
|
|
68
|
+
return obj;
|
|
69
|
+
}
|
|
70
|
+
else if (typeof obj === "bigint") {
|
|
71
|
+
return (0, viem_1.toHex)(obj);
|
|
72
|
+
}
|
|
73
|
+
else if (obj._isBigNumber != null || typeof obj !== "object") {
|
|
74
|
+
return (0, viem_1.toHex)(obj).replace(/^0x0/, "0x");
|
|
75
|
+
}
|
|
76
|
+
if (Array.isArray(obj)) {
|
|
77
|
+
return obj.map((member) => deepHexlify(member));
|
|
78
|
+
}
|
|
79
|
+
return Object.keys(obj).reduce((set, key) => ({
|
|
80
|
+
...set,
|
|
81
|
+
[key]: deepHexlify(obj[key]),
|
|
82
|
+
}), {});
|
|
83
|
+
}
|
|
84
|
+
exports.deepHexlify = deepHexlify;
|
|
85
|
+
function defineReadOnly(object, key, value) {
|
|
86
|
+
Object.defineProperty(object, key, {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
value: value,
|
|
89
|
+
writable: false,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
exports.defineReadOnly = defineReadOnly;
|
|
93
|
+
function filterUndefined(obj) {
|
|
94
|
+
for (const key in obj) {
|
|
95
|
+
if (obj[key] == null) {
|
|
96
|
+
delete obj[key];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return obj;
|
|
100
|
+
}
|
|
101
|
+
exports.filterUndefined = filterUndefined;
|
|
102
|
+
function pick(obj, keys) {
|
|
103
|
+
return Object.keys(obj)
|
|
104
|
+
.filter((k) => keys.includes(k))
|
|
105
|
+
.reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});
|
|
106
|
+
}
|
|
107
|
+
exports.pick = pick;
|
|
108
|
+
const allEqual = (...params) => {
|
|
109
|
+
if (params.length === 0) {
|
|
110
|
+
throw new Error("no values passed in");
|
|
111
|
+
}
|
|
112
|
+
return params.every((v) => v === params[0]);
|
|
113
|
+
};
|
|
114
|
+
exports.allEqual = allEqual;
|
|
115
|
+
const conditionalReturn = (condition, value) => condition.then((t) => (t ? value() : undefined));
|
|
116
|
+
exports.conditionalReturn = conditionalReturn;
|
|
117
|
+
const toRecord = (array, selector, fn) => array.reduce((acc, item) => {
|
|
118
|
+
acc[item[selector]] = fn(item);
|
|
119
|
+
return acc;
|
|
120
|
+
}, {});
|
|
121
|
+
exports.toRecord = toRecord;
|
|
122
|
+
__exportStar(require("./bigint.js"), exports);
|
|
123
|
+
__exportStar(require("./bytes.js"), exports);
|
|
124
|
+
__exportStar(require("./defaults.js"), exports);
|
|
125
|
+
__exportStar(require("./schema.js"), exports);
|
|
126
|
+
__exportStar(require("./userop.js"), exports);
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+BAA6B;AAC7B,oDAAsC;AACtC,kEAAoD;AAIvC,QAAA,eAAe,GAAG,IAAI,GAAG,CACpC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CACnD,CAAC;AASK,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAS,EAAE;IACjD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,EAAE,KAAK,OAAO,EAAE,CAAC;YACzB,OAAO,uBAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;QAChD,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;A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ACzB,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAAqB,CAAC,CAAC;AAZf,QAAA,QAAQ,YAYO;AAE5B,8CAA4B;AAC5B,6CAA2B;AAC3B,gDAA8B;AAC9B,8CAA4B;AAE5B,8CAA4B","sourcesContent":["import type { Chain } from \"viem\";\nimport { toHex } from \"viem\";\nimport * as chains from \"viem/chains\";\nimport * as alchemyChains from \"../chains/index.js\";\nimport type { PromiseOrValue } from \"../types.js\";\nimport type { RecordableKeys } from \"./types.js\";\n\nexport const AlchemyChainMap = new Map<number, Chain>(\n Object.values(alchemyChains).map((c) => [c.id, c])\n);\n\n/**\n * Utility method for converting a chainId to a {@link Chain} object\n *\n * @param chainId - the chainId to convert\n * @returns a {@link Chain} object for the given chainId\n * @throws if the chainId is not found\n */\nexport const getChain = (chainId: number): Chain => {\n for (const chain of Object.values(chains)) {\n if (chain.id === chainId) {\n return AlchemyChainMap.get(chain.id) ?? chain;\n }\n }\n throw new Error(\"could not find chain\");\n};\n\n/**\n * Utility function that allows for piping a series of async functions together\n *\n * @param fns - functions to pipe\n * @returns result of the pipe\n */\nexport const asyncPipe =\n <S, O, F>(...fns: ((s: S, o?: O, f?: F) => Promise<S>)[]) =>\n async (s: S, o?: O, f?: F) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, o, f);\n }\n return result;\n };\n\n// based on @ethersproject/properties, but pulled in here to minize the dependency on ethers\nexport type Deferrable<T> = {\n [K in keyof T]: PromiseOrValue<T[K]>;\n};\n\n/**\n * Await all of the properties of a {@link Deferrable} object\n *\n * @param object - a {@link Deferrable} object\n * @returns the object with its properties resolved\n */\nexport async function resolveProperties<T>(object: Deferrable<T>): Promise<T> {\n const promises = Object.keys(object).map((key) => {\n const value = object[key as keyof Deferrable<T>];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n\n const results = await Promise.all(promises);\n\n return filterUndefined<T>(\n results.reduce((accum, curr) => {\n accum[curr.key as keyof T] = curr.value;\n return accum;\n }, {} as T)\n );\n}\n\n/**\n * Recursively converts all values in an object to hex strings\n *\n * @param obj - obj to deep hexlify\n * @returns object with all of its values hexlified\n */\nexport function deepHexlify(obj: any): any {\n if (typeof obj === \"function\") {\n return undefined;\n }\n if (obj == null || typeof obj === \"string\" || typeof obj === \"boolean\") {\n return obj;\n } else if (typeof obj === \"bigint\") {\n return toHex(obj);\n } else if (obj._isBigNumber != null || typeof obj !== \"object\") {\n return toHex(obj).replace(/^0x0/, \"0x\");\n }\n if (Array.isArray(obj)) {\n return obj.map((member) => deepHexlify(member));\n }\n return Object.keys(obj).reduce(\n (set, key) => ({\n ...set,\n [key]: deepHexlify(obj[key]),\n }),\n {}\n );\n}\n\n// borrowed from ethers.js\nexport function defineReadOnly<T, K extends keyof T>(\n object: T,\n key: K,\n value: T[K]\n): void {\n Object.defineProperty(object, key, {\n enumerable: true,\n value: value,\n writable: false,\n });\n}\n\nexport function filterUndefined<T>(obj: T): T {\n for (const key in obj) {\n if (obj[key] == null) {\n delete obj[key];\n }\n }\n return obj as T;\n}\n\nexport function pick(obj: Record<string, unknown>, keys: string | string[]) {\n return Object.keys(obj)\n .filter((k) => keys.includes(k))\n .reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});\n}\n\n/**\n * Utility method for checking if the passed in values are all equal (strictly)\n *\n * @param params - values to check\n * @returns a boolean indicating if all values are the same\n * @throws if no values are passed in\n */\nexport const allEqual = (...params: any[]): boolean => {\n if (params.length === 0) {\n throw new Error(\"no values passed in\");\n }\n return params.every((v) => v === params[0]);\n};\n\n/**\n * Utility method for checking the condition and return the value if condition holds true, undefined if not.\n *\n * @param condition - condition to check\n * @param value - value to return when condition holds true\n * @returns the value if condition holds true, undefined if not\n */\nexport const conditionalReturn = <T>(\n condition: Promise<boolean>,\n value: () => Promise<T>\n): Promise<T | undefined> => condition.then((t) => (t ? value() : undefined));\n\nexport const toRecord = <\n T extends { [K in RecordableKeys<T>]: string | number | symbol },\n K extends RecordableKeys<T>,\n V\n>(\n array: T[],\n selector: K,\n fn: (item: T) => V\n): Record<T[K], V> =>\n array.reduce((acc, item) => {\n acc[item[selector]] = fn(item);\n return acc;\n }, {} as Record<T[K], V>);\n\nexport * from \"./bigint.js\";\nexport * from \"./bytes.js\";\nexport * from \"./defaults.js\";\nexport * from \"./schema.js\";\nexport type * from \"./types.js\";\nexport * from \"./userop.js\";\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Chain } from "viem";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { BigNumberish, Multiplier } from "../types";
|
|
4
|
+
export declare const ChainSchema: z.ZodType<Chain, z.ZodTypeDef, Chain>;
|
|
5
|
+
export declare const HexSchema: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
6
|
+
export declare const BigNumberishSchema: z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>;
|
|
7
|
+
export declare const BigNumberishRangeSchema: z.ZodObject<{
|
|
8
|
+
min: z.ZodOptional<z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>>;
|
|
9
|
+
max: z.ZodOptional<z.ZodUnion<[z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, z.ZodNumber, z.ZodBigInt]>>;
|
|
10
|
+
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
min?: number | bigint | `0x${string}` | undefined;
|
|
12
|
+
max?: number | bigint | `0x${string}` | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
min?: number | bigint | `0x${string}` | undefined;
|
|
15
|
+
max?: number | bigint | `0x${string}` | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const MultiplierSchema: z.ZodObject<{
|
|
18
|
+
multiplier: z.ZodEffects<z.ZodNumber, number, number>;
|
|
19
|
+
}, "strict", z.ZodTypeAny, {
|
|
20
|
+
multiplier: number;
|
|
21
|
+
}, {
|
|
22
|
+
multiplier: number;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function isBigNumberish(x: any): x is BigNumberish;
|
|
25
|
+
export declare function isMultiplier(x: any): x is Multiplier;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMultiplier = exports.isBigNumberish = exports.MultiplierSchema = exports.BigNumberishRangeSchema = exports.BigNumberishSchema = exports.HexSchema = exports.ChainSchema = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.ChainSchema = zod_1.z.custom((chain) => chain != null &&
|
|
7
|
+
typeof chain === "object" &&
|
|
8
|
+
"id" in chain &&
|
|
9
|
+
typeof chain.id === "number");
|
|
10
|
+
exports.HexSchema = zod_1.z.custom((val) => {
|
|
11
|
+
return (0, viem_1.isHex)(val, { strict: true });
|
|
12
|
+
});
|
|
13
|
+
exports.BigNumberishSchema = zod_1.z.union([exports.HexSchema, zod_1.z.number(), zod_1.z.bigint()]);
|
|
14
|
+
exports.BigNumberishRangeSchema = zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
min: exports.BigNumberishSchema.optional(),
|
|
17
|
+
max: exports.BigNumberishSchema.optional(),
|
|
18
|
+
})
|
|
19
|
+
.strict();
|
|
20
|
+
exports.MultiplierSchema = zod_1.z
|
|
21
|
+
.object({
|
|
22
|
+
multiplier: zod_1.z.number().refine((n) => {
|
|
23
|
+
return (n.toString().split(".")[1]?.length ?? 0) <= 4;
|
|
24
|
+
}, { message: "Max precision is 4 decimal places" }),
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
function isBigNumberish(x) {
|
|
28
|
+
return x != null && exports.BigNumberishSchema.safeParse(x).success;
|
|
29
|
+
}
|
|
30
|
+
exports.isBigNumberish = isBigNumberish;
|
|
31
|
+
function isMultiplier(x) {
|
|
32
|
+
return x != null && exports.MultiplierSchema.safeParse(x).success;
|
|
33
|
+
}
|
|
34
|
+
exports.isMultiplier = isMultiplier;
|
|
35
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":";;;AAAA,+BAAyC;AACzC,6BAAwB;AAGX,QAAA,WAAW,GAAG,OAAC,CAAC,MAAM,CACjC,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,IAAI,IAAI,KAAK;IACb,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAC/B,CAAC;AAEW,QAAA,SAAS,GAAG,OAAC,CAAC,MAAM,CAAuB,CAAC,GAAG,EAAE,EAAE;IAC9D,OAAO,IAAA,YAAK,EAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC,CAAC,CAAC;AAGU,QAAA,kBAAkB,GAAG,OAAC,CAAC,KAAK,CAAC,CAAC,iBAAS,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAIlE,QAAA,uBAAuB,GAAG,OAAC;KACrC,MAAM,CAAC;IACN,GAAG,EAAE,0BAAkB,CAAC,QAAQ,EAAE;IAClC,GAAG,EAAE,0BAAkB,CAAC,QAAQ,EAAE;CACnC,CAAC;KACD,MAAM,EAAE,CAAC;AAIC,QAAA,gBAAgB,GAAG,OAAC;KAC9B,MAAM,CAAC;IAIN,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAC3B,CAAC,CAAC,EAAE,EAAE;QACJ,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC,EACD,EAAE,OAAO,EAAE,mCAAmC,EAAE,CACjD;CACF,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,SAAgB,cAAc,CAAC,CAAM;IACnC,OAAO,CAAC,IAAI,IAAI,IAAI,0BAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC9D,CAAC;AAFD,wCAEC;AAED,SAAgB,YAAY,CAAC,CAAM;IACjC,OAAO,CAAC,IAAI,IAAI,IAAI,wBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC;AAFD,oCAEC","sourcesContent":["import { isHex, type Chain } from \"viem\";\nimport { z } from \"zod\";\nimport type { BigNumberish, Multiplier } from \"../types\";\n\nexport const ChainSchema = z.custom<Chain>(\n (chain) =>\n chain != null &&\n typeof chain === \"object\" &&\n \"id\" in chain &&\n typeof chain.id === \"number\"\n);\n\nexport const HexSchema = z.custom<`0x${string}` | \"0x\">((val) => {\n return isHex(val, { strict: true });\n});\n\n// [!region BigNumberish]\nexport const BigNumberishSchema = z.union([HexSchema, z.number(), z.bigint()]);\n// [!endregion BigNumberish]\n\n// [!region BigNumberishRange]\nexport const BigNumberishRangeSchema = z\n .object({\n min: BigNumberishSchema.optional(),\n max: BigNumberishSchema.optional(),\n })\n .strict();\n// [!endregion BigNumberishRange]\n\n// [!region Multiplier]\nexport const MultiplierSchema = z\n .object({\n /**\n * Multiplier value with max precision of 4 decimal places\n */\n multiplier: z.number().refine(\n (n) => {\n return (n.toString().split(\".\")[1]?.length ?? 0) <= 4;\n },\n { message: \"Max precision is 4 decimal places\" }\n ),\n })\n .strict();\n// [!endregion Multiplier]\n\nexport function isBigNumberish(x: any): x is BigNumberish {\n return x != null && BigNumberishSchema.safeParse(x).success;\n}\n\nexport function isMultiplier(x: any): x is Multiplier {\n return x != null && MultiplierSchema.safeParse(x).success;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RpcStateOverride, type StateOverride } from "viem";
|
|
2
|
+
type SerializeStateOverrideParameters = StateOverride | undefined;
|
|
3
|
+
export declare function serializeStateOverride(parameters?: SerializeStateOverrideParameters): RpcStateOverride | undefined;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeStateOverride = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
function serializeStateMapping(stateMapping) {
|
|
6
|
+
if (!stateMapping || stateMapping.length === 0)
|
|
7
|
+
return undefined;
|
|
8
|
+
return stateMapping.reduce((acc, { slot, value }) => {
|
|
9
|
+
validateBytes32HexLength(slot);
|
|
10
|
+
validateBytes32HexLength(value);
|
|
11
|
+
acc[slot] = value;
|
|
12
|
+
return acc;
|
|
13
|
+
}, {});
|
|
14
|
+
}
|
|
15
|
+
function validateBytes32HexLength(value) {
|
|
16
|
+
if (value.length !== 66) {
|
|
17
|
+
throw new Error(`Hex is expected to be 66 hex long, but is ${value.length} hex long.`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function serializeAccountStateOverride(parameters) {
|
|
21
|
+
const { balance, nonce, state, stateDiff, code } = parameters;
|
|
22
|
+
const rpcAccountStateOverride = {};
|
|
23
|
+
if (code !== undefined)
|
|
24
|
+
rpcAccountStateOverride.code = code;
|
|
25
|
+
if (balance !== undefined)
|
|
26
|
+
rpcAccountStateOverride.balance = (0, viem_1.numberToHex)(balance);
|
|
27
|
+
if (nonce !== undefined)
|
|
28
|
+
rpcAccountStateOverride.nonce = (0, viem_1.numberToHex)(nonce);
|
|
29
|
+
if (state !== undefined)
|
|
30
|
+
rpcAccountStateOverride.state = serializeStateMapping(state);
|
|
31
|
+
if (stateDiff !== undefined) {
|
|
32
|
+
if (rpcAccountStateOverride.state)
|
|
33
|
+
throw new viem_1.StateAssignmentConflictError();
|
|
34
|
+
rpcAccountStateOverride.stateDiff = serializeStateMapping(stateDiff);
|
|
35
|
+
}
|
|
36
|
+
return rpcAccountStateOverride;
|
|
37
|
+
}
|
|
38
|
+
function serializeStateOverride(parameters) {
|
|
39
|
+
if (!parameters)
|
|
40
|
+
return undefined;
|
|
41
|
+
const rpcStateOverride = {};
|
|
42
|
+
for (const { address, ...accountState } of parameters) {
|
|
43
|
+
if (!(0, viem_1.isAddress)(address, { strict: false }))
|
|
44
|
+
throw new viem_1.InvalidAddressError({ address });
|
|
45
|
+
if (rpcStateOverride[address])
|
|
46
|
+
throw new viem_1.AccountStateConflictError({ address: address });
|
|
47
|
+
rpcStateOverride[address] = serializeAccountStateOverride(accountState);
|
|
48
|
+
}
|
|
49
|
+
return rpcStateOverride;
|
|
50
|
+
}
|
|
51
|
+
exports.serializeStateOverride = serializeStateOverride;
|
|
52
|
+
//# sourceMappingURL=stateOverride.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateOverride.js","sourceRoot":"","sources":["../../../src/utils/stateOverride.ts"],"names":[],"mappings":";;;AACA,+BAWc;AAOd,SAAS,qBAAqB,CAC5B,YAA6C;IAE7C,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACjE,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QAClD,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAC/B,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAChC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAClB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAqB,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAc;IAC9C,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAExB,MAAM,IAAI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C,OAAO,CAAC;YAC3B,MAAM,IAAI,gCAAyB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5D,gBAAgB,CAAC,OAAO,CAAC,GAAG,6BAA6B,CAAC,YAAY,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAbD,wDAaC","sourcesContent":["import type { Address } from \"abitype\";\nimport {\n AccountStateConflictError,\n InvalidAddressError,\n StateAssignmentConflictError,\n isAddress,\n numberToHex,\n type RpcAccountStateOverride,\n type RpcStateMapping,\n type RpcStateOverride,\n type StateMapping,\n type StateOverride,\n} from \"viem\";\n\n// Copied from Viem's utils/stateOverride.ts, which does not expose these\n// functions.\n\ntype SerializeStateMappingParameters = StateMapping | undefined;\n\nfunction serializeStateMapping(\n stateMapping: SerializeStateMappingParameters\n): RpcStateMapping | undefined {\n if (!stateMapping || stateMapping.length === 0) return undefined;\n return stateMapping.reduce((acc, { slot, value }) => {\n validateBytes32HexLength(slot);\n validateBytes32HexLength(value);\n acc[slot] = value;\n return acc;\n }, {} as RpcStateMapping);\n}\n\nfunction validateBytes32HexLength(value: Address): void {\n if (value.length !== 66) {\n // This is the error message from Viem's non-exported InvalidBytesLengthError.\n throw new Error(\n `Hex is expected to be 66 hex long, but is ${value.length} hex long.`\n );\n }\n}\n\ntype SerializeAccountStateOverrideParameters = Omit<\n StateOverride[number],\n \"address\"\n>;\n\nfunction serializeAccountStateOverride(\n parameters: SerializeAccountStateOverrideParameters\n): RpcAccountStateOverride {\n const { balance, nonce, state, stateDiff, code } = parameters;\n const rpcAccountStateOverride: RpcAccountStateOverride = {};\n if (code !== undefined) rpcAccountStateOverride.code = code;\n if (balance !== undefined)\n rpcAccountStateOverride.balance = numberToHex(balance);\n if (nonce !== undefined) rpcAccountStateOverride.nonce = numberToHex(nonce);\n if (state !== undefined)\n rpcAccountStateOverride.state = serializeStateMapping(state);\n if (stateDiff !== undefined) {\n if (rpcAccountStateOverride.state) throw new StateAssignmentConflictError();\n rpcAccountStateOverride.stateDiff = serializeStateMapping(stateDiff);\n }\n return rpcAccountStateOverride;\n}\n\ntype SerializeStateOverrideParameters = StateOverride | undefined;\n\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport function serializeStateOverride(\n parameters?: SerializeStateOverrideParameters\n): RpcStateOverride | undefined {\n if (!parameters) return undefined;\n const rpcStateOverride: RpcStateOverride = {};\n for (const { address, ...accountState } of parameters) {\n if (!isAddress(address, { strict: false }))\n throw new InvalidAddressError({ address });\n if (rpcStateOverride[address])\n throw new AccountStateConflictError({ address: address });\n rpcStateOverride[address] = serializeAccountStateOverride(accountState);\n }\n return rpcStateOverride;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Chain } from "viem";
|
|
2
|
+
import { type SmartContractAccount } from "../account/smartContractAccount.js";
|
|
3
|
+
import { type BundlerClient } from "../client/bundlerClient.js";
|
|
4
|
+
import type { DefaultEntryPointVersion } from "../entrypoint/types.js";
|
|
5
|
+
export declare const createDummySmartContractAccount: <C extends BundlerClient>(client: C) => Promise<SmartContractAccount<"dummy", DefaultEntryPointVersion>>;
|
|
6
|
+
export declare const createTestClient: (chain: Chain) => BundlerClient<import("viem").CustomTransport>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTestClient = exports.createDummySmartContractAccount = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const smartContractAccount_js_1 = require("../account/smartContractAccount.js");
|
|
6
|
+
const bundlerClient_js_1 = require("../client/bundlerClient.js");
|
|
7
|
+
const index_js_1 = require("../entrypoint/index.js");
|
|
8
|
+
const createDummySmartContractAccount = async (client) => {
|
|
9
|
+
return (0, smartContractAccount_js_1.toSmartContractAccount)({
|
|
10
|
+
source: "dummy",
|
|
11
|
+
accountAddress: "0x1234567890123456789012345678901234567890",
|
|
12
|
+
entryPoint: (0, index_js_1.getEntryPoint)(client.chain),
|
|
13
|
+
chain: client.chain,
|
|
14
|
+
transport: (0, viem_1.custom)(client),
|
|
15
|
+
signMessage: async () => "0xdeadbeef",
|
|
16
|
+
signTypedData: async () => "0xdeadbeef",
|
|
17
|
+
getAccountInitCode: async () => "0x1234567890123456789012345678901234567890deadbeef",
|
|
18
|
+
encodeBatchExecute: async () => "0x",
|
|
19
|
+
encodeExecute: async () => "0x",
|
|
20
|
+
getDummySignature: () => "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
exports.createDummySmartContractAccount = createDummySmartContractAccount;
|
|
24
|
+
const createTestClient = (chain) => {
|
|
25
|
+
return (0, bundlerClient_js_1.createBundlerClientFromExisting)((0, viem_1.createPublicClient)({
|
|
26
|
+
chain,
|
|
27
|
+
transport: (0, viem_1.custom)({
|
|
28
|
+
request: async () => { },
|
|
29
|
+
}),
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
exports.createTestClient = createTestClient;
|
|
33
|
+
//# sourceMappingURL=testUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.js","sourceRoot":"","sources":["../../../src/utils/testUtils.ts"],"names":[],"mappings":";;;AAAA,+BAAwE;AACxE,gFAG4C;AAC5C,iEAGoC;AACpC,qDAAuD;AAGhD,MAAM,+BAA+B,GAAG,KAAK,EAClD,MAAS,EACyD,EAAE;IACpE,OAAO,IAAA,gDAAsB,EAAC;QAC5B,MAAM,EAAE,OAAO;QACf,cAAc,EAAE,4CAA4C;QAC5D,UAAU,EAAE,IAAA,wBAAa,EAAC,MAAM,CAAC,KAAK,CAAC;QACvC,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,IAAA,aAAM,EAAC,MAAM,CAAC;QACzB,WAAW,EAAE,KAAK,IAAI,EAAE,CAAC,YAAY;QACrC,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,YAAY;QACvC,kBAAkB,EAAE,KAAK,IAAI,EAAE,CAC7B,oDAAoD;QACtD,kBAAkB,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI;QACpC,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI;QAC/B,iBAAiB,EAAE,GAAQ,EAAE,CAC3B,sIAAsI;KACzI,CAAC,CAAC;AACL,CAAC,CAAC;AAlBW,QAAA,+BAA+B,mCAkB1C;AAEK,MAAM,gBAAgB,GAAG,CAAC,KAAY,EAAE,EAAE;IAC/C,OAAO,IAAA,kDAA+B,EACpC,IAAA,yBAAkB,EAAC;QACjB,KAAK;QACL,SAAS,EAAE,IAAA,aAAM,EAAC;YAChB,OAAO,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;SACxB,CAAC;KACH,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,gBAAgB,oBAS3B","sourcesContent":["import { createPublicClient, custom, type Chain, type Hex } from \"viem\";\nimport {\n toSmartContractAccount,\n type SmartContractAccount,\n} from \"../account/smartContractAccount.js\";\nimport {\n createBundlerClientFromExisting,\n type BundlerClient,\n} from \"../client/bundlerClient.js\";\nimport { getEntryPoint } from \"../entrypoint/index.js\";\nimport type { DefaultEntryPointVersion } from \"../entrypoint/types.js\";\n\nexport const createDummySmartContractAccount = async <C extends BundlerClient>(\n client: C\n): Promise<SmartContractAccount<\"dummy\", DefaultEntryPointVersion>> => {\n return toSmartContractAccount({\n source: \"dummy\",\n accountAddress: \"0x1234567890123456789012345678901234567890\",\n entryPoint: getEntryPoint(client.chain),\n chain: client.chain,\n transport: custom(client),\n signMessage: async () => \"0xdeadbeef\",\n signTypedData: async () => \"0xdeadbeef\",\n getAccountInitCode: async () =>\n \"0x1234567890123456789012345678901234567890deadbeef\",\n encodeBatchExecute: async () => \"0x\",\n encodeExecute: async () => \"0x\",\n getDummySignature: (): Hex =>\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\",\n });\n};\n\nexport const createTestClient = (chain: Chain) => {\n return createBundlerClientFromExisting(\n createPublicClient({\n chain,\n transport: custom({\n request: async () => {},\n }),\n })\n );\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type NoUndefined<T> = T extends undefined ? never : T;
|
|
2
|
+
export type IsUndefined<T> = [undefined] extends [T] ? true : false;
|
|
3
|
+
export type RequiredBy<TType, TKeys extends keyof TType> = Required<Pick<TType, TKeys>> & Omit<TType, TKeys>;
|
|
4
|
+
export type Prettify<T> = {
|
|
5
|
+
[K in keyof T]: T[K];
|
|
6
|
+
} & {};
|
|
7
|
+
export type WithRequired<T, K extends keyof T> = Required<Pick<T, K>>;
|
|
8
|
+
export type WithOptional<T, K extends keyof T> = Pick<Partial<T>, K>;
|
|
9
|
+
export type EQ<A, B> = [A] extends [B] ? [B] extends [A] ? true : false : false;
|
|
10
|
+
export type EqualsOneOfTheComponents<T, Union> = Union extends infer Component ? EQ<T, Component> : never;
|
|
11
|
+
export type IsMemberOrSubtypeOfAComponent<T, Union, ConjunctionOfExplicitComponentChecks extends boolean> = [T] extends [Union] ? true extends ConjunctionOfExplicitComponentChecks ? true : false : false;
|
|
12
|
+
export type IsOneOf<T, Union> = IsMemberOrSubtypeOfAComponent<T, Union, EqualsOneOfTheComponents<T, Union>>;
|
|
13
|
+
export type OneOf<T1, T2> = IsOneOf<T1, T2> extends true ? T1 : never;
|
|
14
|
+
export type RecordableKeys<T> = {
|
|
15
|
+
[K in keyof T]: T[K] extends string | number | symbol ? K : never;
|
|
16
|
+
}[keyof T];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"","sourcesContent":["// borrowed from viem\n\n/**\n * @description Constructs a type by excluding `undefined` from `T`.\n *\n * @example\n * NoUndefined<string | undefined>\n * => string\n */\nexport type NoUndefined<T> = T extends undefined ? never : T;\n// borrowed from viem\n/**\n * @description Checks if {@link T} is `undefined`\n * @param T - Type to check\n * @example\n * type Result = IsUndefined<undefined>\n * // ^? type Result = true\n */\n\nexport type IsUndefined<T> = [undefined] extends [T] ? true : false;\n\nexport type RequiredBy<TType, TKeys extends keyof TType> = Required<\n Pick<TType, TKeys>\n> &\n Omit<TType, TKeys>;\n\n/**\n * @description Combines members of an intersection into a readable type.\n *\n * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}\n * @example\n * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>\n * => { a: string, b: string, c: number, d: bigint }\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n\nexport type WithRequired<T, K extends keyof T> = Required<Pick<T, K>>;\nexport type WithOptional<T, K extends keyof T> = Pick<Partial<T>, K>;\n\n// Checks for type equivalence, evaluates always to either `true` or `false`.\n// Semantics: (EQ<A, B> = true) <==> (A <==> B)\nexport type EQ<A, B> = [A] extends [B]\n ? [B] extends [A]\n ? true\n : false\n : false;\n\n// Auxiliary type for `IsMemberOrSubtypeOfAComponent`\n// Evaluates to `true` or `boolean` if one of the explicit components (according to the TypeScript distribution\n// mechanism for union types) of the union type equals the other given type.\n// Examples:\n// EqualsOneOfTheComponents<string, string | boolean> ⟶ boolean\n// EqualsOneOfTheComponents<string, string> ⟶ true\n// EqualsOneOfTheComponents<number, string | boolean> ⟶ false\nexport type EqualsOneOfTheComponents<T, Union> = Union extends infer Component // enforce distribution\n ? EQ<T, Component>\n : never;\n\n// Auxiliary type for `IsOneOf`\nexport type IsMemberOrSubtypeOfAComponent<\n T,\n Union,\n ConjunctionOfExplicitComponentChecks extends boolean\n> = [T] extends [Union]\n ? true extends ConjunctionOfExplicitComponentChecks\n ? true\n : false\n : false;\n\n// Checks whether the given type equals one of the explicit components of the union type. Note that in this respect we\n// consider the members of the infinite types number and string as implicit since the inbuilt distribution mechanism of\n// TypeScript does not (cannot) distribute over the infinite number of strings or numbers. However, `boolean` is treated\n// by TypeScript (and accordingly here) as the explicit union `true | false`.\n//\n// In particular, the evaluation result is `false` if the type is a proper union of components of the union type. It also\n// evaluates to false if the given type is a proper subtype of one of its explicit components.\n// It always evaluates to either `true` or `false`.\n// Examples:\n// IsOneOf<number, string | number | boolean> ⟶ true\n// IsOneOf<2 | 4, 0 | 1 | 2 | 3 | 4 | 5 | 6> ⟶ false\n// IsOneOf<'text', string> ⟶ false // only implicit but not explicit component\nexport type IsOneOf<T, Union> = IsMemberOrSubtypeOfAComponent<\n T,\n Union,\n EqualsOneOfTheComponents<T, Union>\n>;\n\nexport type OneOf<T1, T2> = IsOneOf<T1, T2> extends true ? T1 : never;\n\nexport type RecordableKeys<T> = {\n [K in keyof T]: T[K] extends string | number | symbol ? K : never;\n}[keyof T];\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Hex } from "viem";
|
|
2
|
+
import type { EntryPointVersion } from "../entrypoint/types";
|
|
3
|
+
import type { BigNumberish, Multiplier, UserOperationFeeOptionsField, UserOperationOverrides, UserOperationRequest, UserOperationStruct } from "../types";
|
|
4
|
+
export declare function isValidRequest<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationStruct<TEntryPointVersion>): request is UserOperationRequest<TEntryPointVersion>;
|
|
5
|
+
export declare function isValidPaymasterAndData<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationStruct<TEntryPointVersion>): boolean;
|
|
6
|
+
export declare function isValidFactoryAndData<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationStruct<TEntryPointVersion>): boolean;
|
|
7
|
+
export declare function applyUserOpOverride<TValue extends BigNumberish | undefined>(value: TValue, override?: BigNumberish | Multiplier): TValue | BigNumberish;
|
|
8
|
+
export declare function applyUserOpFeeOption<TValue extends BigNumberish | undefined>(value: TValue, feeOption?: UserOperationFeeOptionsField): TValue | BigNumberish;
|
|
9
|
+
export declare function applyUserOpOverrideOrFeeOption<TValue extends BigNumberish | undefined>(value: TValue, override?: BigNumberish | Multiplier, feeOption?: UserOperationFeeOptionsField): TValue | BigNumberish;
|
|
10
|
+
export declare const bypassPaymasterAndData: <TEntryPointVersion extends keyof import("../entrypoint/types").EntryPointRegistryBase<unknown> = keyof import("../entrypoint/types").EntryPointRegistryBase<unknown>>(overrides: Partial<{
|
|
11
|
+
callGasLimit: {
|
|
12
|
+
multiplier: number;
|
|
13
|
+
} | UserOperationStruct<TEntryPointVersion>["callGasLimit"];
|
|
14
|
+
maxFeePerGas: {
|
|
15
|
+
multiplier: number;
|
|
16
|
+
} | UserOperationStruct<TEntryPointVersion>["maxFeePerGas"];
|
|
17
|
+
maxPriorityFeePerGas: {
|
|
18
|
+
multiplier: number;
|
|
19
|
+
} | UserOperationStruct<TEntryPointVersion>["maxPriorityFeePerGas"];
|
|
20
|
+
preVerificationGas: {
|
|
21
|
+
multiplier: number;
|
|
22
|
+
} | UserOperationStruct<TEntryPointVersion>["preVerificationGas"];
|
|
23
|
+
verificationGasLimit: {
|
|
24
|
+
multiplier: number;
|
|
25
|
+
} | UserOperationStruct<TEntryPointVersion>["verificationGasLimit"];
|
|
26
|
+
nonceKey: bigint;
|
|
27
|
+
stateOverride: import("viem").StateOverride;
|
|
28
|
+
} & import("../types").UserOperationPaymasterOverrides<TEntryPointVersion>> | undefined) => boolean;
|
|
29
|
+
export declare const bypassPaymasterAndDataEmptyHex: <TEntryPointVersion extends keyof import("../entrypoint/types").EntryPointRegistryBase<unknown> = keyof import("../entrypoint/types").EntryPointRegistryBase<unknown>>(overrides: Partial<{
|
|
30
|
+
callGasLimit: {
|
|
31
|
+
multiplier: number;
|
|
32
|
+
} | UserOperationStruct<TEntryPointVersion>["callGasLimit"];
|
|
33
|
+
maxFeePerGas: {
|
|
34
|
+
multiplier: number;
|
|
35
|
+
} | UserOperationStruct<TEntryPointVersion>["maxFeePerGas"];
|
|
36
|
+
maxPriorityFeePerGas: {
|
|
37
|
+
multiplier: number;
|
|
38
|
+
} | UserOperationStruct<TEntryPointVersion>["maxPriorityFeePerGas"];
|
|
39
|
+
preVerificationGas: {
|
|
40
|
+
multiplier: number;
|
|
41
|
+
} | UserOperationStruct<TEntryPointVersion>["preVerificationGas"];
|
|
42
|
+
verificationGasLimit: {
|
|
43
|
+
multiplier: number;
|
|
44
|
+
} | UserOperationStruct<TEntryPointVersion>["verificationGasLimit"];
|
|
45
|
+
nonceKey: bigint;
|
|
46
|
+
stateOverride: import("viem").StateOverride;
|
|
47
|
+
} & import("../types").UserOperationPaymasterOverrides<TEntryPointVersion>> | undefined) => boolean;
|
|
48
|
+
export declare const parsePaymasterAndData: (paymasterAndData: Hex) => Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData">;
|
|
49
|
+
export declare const concatPaymasterAndData: ({ paymaster, paymasterData, }: Pick<UserOperationRequest<"0.7.0">, "paymaster" | "paymasterData">) => Hex;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.concatPaymasterAndData = exports.parsePaymasterAndData = exports.bypassPaymasterAndDataEmptyHex = exports.bypassPaymasterAndData = exports.applyUserOpOverrideOrFeeOption = exports.applyUserOpFeeOption = exports.applyUserOpOverride = exports.isValidFactoryAndData = exports.isValidPaymasterAndData = exports.isValidRequest = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const bigint_js_1 = require("./bigint.js");
|
|
6
|
+
const index_js_1 = require("./index.js");
|
|
7
|
+
function isValidRequest(request) {
|
|
8
|
+
return (BigInt(request.callGasLimit || 0n) > 0n &&
|
|
9
|
+
BigInt(request.maxFeePerGas || 0n) > 0n &&
|
|
10
|
+
BigInt(request.preVerificationGas || 0n) > 0n &&
|
|
11
|
+
BigInt(request.verificationGasLimit || 0n) > 0n &&
|
|
12
|
+
request.maxPriorityFeePerGas != null &&
|
|
13
|
+
isValidPaymasterAndData(request) &&
|
|
14
|
+
isValidFactoryAndData(request));
|
|
15
|
+
}
|
|
16
|
+
exports.isValidRequest = isValidRequest;
|
|
17
|
+
function isValidPaymasterAndData(request) {
|
|
18
|
+
if ("paymasterAndData" in request) {
|
|
19
|
+
return request.paymasterAndData != null;
|
|
20
|
+
}
|
|
21
|
+
return (0, index_js_1.allEqual)(request.paymaster == null, request.paymasterData == null, request.paymasterPostOpGasLimit == null, request.paymasterVerificationGasLimit == null);
|
|
22
|
+
}
|
|
23
|
+
exports.isValidPaymasterAndData = isValidPaymasterAndData;
|
|
24
|
+
function isValidFactoryAndData(request) {
|
|
25
|
+
if ("initCode" in request) {
|
|
26
|
+
const { initCode } = request;
|
|
27
|
+
return initCode != null;
|
|
28
|
+
}
|
|
29
|
+
return (0, index_js_1.allEqual)(request.factory == null, request.factoryData == null);
|
|
30
|
+
}
|
|
31
|
+
exports.isValidFactoryAndData = isValidFactoryAndData;
|
|
32
|
+
function applyUserOpOverride(value, override) {
|
|
33
|
+
if (override == null) {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
if ((0, index_js_1.isBigNumberish)(override)) {
|
|
37
|
+
return override;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return value != null ? (0, bigint_js_1.bigIntMultiply)(value, override.multiplier) : value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.applyUserOpOverride = applyUserOpOverride;
|
|
44
|
+
function applyUserOpFeeOption(value, feeOption) {
|
|
45
|
+
if (feeOption == null) {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
return value != null
|
|
49
|
+
? (0, bigint_js_1.bigIntClamp)(feeOption.multiplier
|
|
50
|
+
? (0, bigint_js_1.bigIntMultiply)(value, feeOption.multiplier)
|
|
51
|
+
: value, feeOption.min, feeOption.max)
|
|
52
|
+
: feeOption.min ?? 0n;
|
|
53
|
+
}
|
|
54
|
+
exports.applyUserOpFeeOption = applyUserOpFeeOption;
|
|
55
|
+
function applyUserOpOverrideOrFeeOption(value, override, feeOption) {
|
|
56
|
+
return value != null && override != null
|
|
57
|
+
? applyUserOpOverride(value, override)
|
|
58
|
+
: applyUserOpFeeOption(value, feeOption);
|
|
59
|
+
}
|
|
60
|
+
exports.applyUserOpOverrideOrFeeOption = applyUserOpOverrideOrFeeOption;
|
|
61
|
+
const bypassPaymasterAndData = (overrides) => !!overrides &&
|
|
62
|
+
("paymasterAndData" in overrides || "paymasterData" in overrides);
|
|
63
|
+
exports.bypassPaymasterAndData = bypassPaymasterAndData;
|
|
64
|
+
const bypassPaymasterAndDataEmptyHex = (overrides) => overrides !== undefined &&
|
|
65
|
+
(("paymasterAndData" in overrides && overrides.paymasterAndData === "0x") ||
|
|
66
|
+
("paymasterData" in overrides && overrides.paymasterData === "0x"));
|
|
67
|
+
exports.bypassPaymasterAndDataEmptyHex = bypassPaymasterAndDataEmptyHex;
|
|
68
|
+
const parsePaymasterAndData = (paymasterAndData) => ({
|
|
69
|
+
paymaster: paymasterAndData.substring(0, 42),
|
|
70
|
+
paymasterData: `0x${paymasterAndData.substring(42)}`,
|
|
71
|
+
});
|
|
72
|
+
exports.parsePaymasterAndData = parsePaymasterAndData;
|
|
73
|
+
const concatPaymasterAndData = ({ paymaster = "0x", paymasterData = "0x", }) => (0, viem_1.concat)([paymaster, paymasterData]);
|
|
74
|
+
exports.concatPaymasterAndData = concatPaymasterAndData;
|
|
75
|
+
//# sourceMappingURL=userop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userop.js","sourceRoot":"","sources":["../../../src/utils/userop.ts"],"names":[],"mappings":";;;AAAA,+BAAsD;AAYtD,2CAA0D;AAC1D,yCAAsD;AAQtD,SAAgB,cAAc,CAG5B,OAAgD;IAGhD,OAAO,CACL,MAAM,CAAC,OAAO,CAAC,YAAY,IAA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C,gBAAgB,KAAK,IAAI,CAAC;QACvE,CAAC,eAAe,IAAI,SAAS,IAAI,SAAS,CAAC,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC;AAP3D,QAAA,8BAA8B,kCAO6B;AASjE,MAAM,qBAAqB,GAAG,CACnC,gBAAqB,EAC+C,EAAE,CAAC,CAAC;IACxE,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAY;IACvD,aAAa,EAAE,KAAK,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC,EAAS;CAC5D,CAAC,CAAC;AALU,QAAA,qBAAqB,yBAK/B;AAYI,MAAM,sBAAsB,GAAG,CAAC,EACrC,SAAS,GAAG,IAAI,EAChB,aAAa,GAAG,IAAI,GAC+C,EAAO,EAAE,CAC5E,IAAA,aAAM,EAAC,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;AAJxB,QAAA,sBAAsB,0BAIE","sourcesContent":["import { concat, type Address, type Hex } from \"viem\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport type {\n BigNumberish,\n Multiplier,\n UserOperationFeeOptionsField,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n UserOperationStruct_v6,\n UserOperationStruct_v7,\n} from \"../types\";\nimport { bigIntClamp, bigIntMultiply } from \"./bigint.js\";\nimport { allEqual, isBigNumberish } from \"./index.js\";\n\n/**\n * Utility method for asserting a {@link UserOperationStruct} has valid fields for the given entry point version\n *\n * @param request a {@link UserOperationStruct} to validate\n * @returns a type guard that asserts the {@link UserOperationRequest} is valid\n */\nexport function isValidRequest<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n>(\n request: UserOperationStruct<TEntryPointVersion>\n): request is UserOperationRequest<TEntryPointVersion> {\n // These are the only ones marked as optional in the interface above\n return (\n BigInt(request.callGasLimit || 0n) > 0n &&\n BigInt(request.maxFeePerGas || 0n) > 0n &&\n BigInt(request.preVerificationGas || 0n) > 0n &&\n BigInt(request.verificationGasLimit || 0n) > 0n &&\n request.maxPriorityFeePerGas != null &&\n isValidPaymasterAndData(request) &&\n isValidFactoryAndData(request)\n );\n}\n\n/**\n * Utility method for asserting a {@link UserOperationRequest} has valid fields for the paymaster data\n *\n * @param request a {@link UserOperationRequest} to validate\n * @returns a type guard that asserts the {@link UserOperationRequest} is a {@link UserOperationRequest}\n */\nexport function isValidPaymasterAndData<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n>(request: UserOperationStruct<TEntryPointVersion>): boolean {\n if (\"paymasterAndData\" in request) {\n return (request as UserOperationStruct_v6).paymasterAndData != null;\n }\n\n // either all exist, or none.\n return allEqual(\n (request as UserOperationStruct_v7).paymaster == null,\n (request as UserOperationStruct_v7).paymasterData == null,\n (request as UserOperationStruct_v7).paymasterPostOpGasLimit == null,\n (request as UserOperationStruct_v7).paymasterVerificationGasLimit == null\n );\n}\n\n/**\n * Utility method for asserting a {@link UserOperationStruct} has valid fields for the paymaster data\n *\n * @param request a {@link UserOperationRequest} to validate\n * @returns a type guard that asserts the {@link UserOperationStruct} is a {@link UserOperationRequest}\n */\nexport function isValidFactoryAndData<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n>(request: UserOperationStruct<TEntryPointVersion>): boolean {\n if (\"initCode\" in request) {\n const { initCode } = request as UserOperationStruct_v6;\n return initCode != null;\n }\n\n // either all exist, or none.\n return allEqual(\n (request as UserOperationStruct_v7).factory == null,\n (request as UserOperationStruct_v7).factoryData == null\n );\n}\n\n/**\n * Utility method for applying a {@link UserOperationOverrides} field value\n * over the current value set for the field\n *\n * @param value the current value of the field\n * @param override the override value to apply\n * @returns the new value of the field after applying the override\n */\nexport function applyUserOpOverride<TValue extends BigNumberish | undefined>(\n value: TValue,\n override?: BigNumberish | Multiplier\n): TValue | BigNumberish {\n if (override == null) {\n return value;\n }\n\n if (isBigNumberish(override)) {\n return override;\n }\n\n // multiplier override\n else {\n return value != null ? bigIntMultiply(value, override.multiplier) : value;\n }\n}\n\n/**\n * Utility method for applying a {@link UserOperationFeeOptionsField} value\n * over the current value set for the field\n *\n * @param value the current value of the field\n * @param feeOption the fee option field value to apply\n * @returns the new value of the field after applying the fee option\n */\nexport function applyUserOpFeeOption<TValue extends BigNumberish | undefined>(\n value: TValue,\n feeOption?: UserOperationFeeOptionsField\n): TValue | BigNumberish {\n if (feeOption == null) {\n return value;\n }\n\n return value != null\n ? bigIntClamp(\n feeOption.multiplier\n ? bigIntMultiply(value, feeOption.multiplier)\n : value,\n feeOption.min,\n feeOption.max\n )\n : feeOption.min ?? 0n;\n}\n\n/**\n * Utility method for applying a {@link UserOperationOverrides} field value and\n * a {@link UserOperationFeeOptionsField} value over the current value set for the field,\n * with the override taking precedence over the fee option\n *\n * @param value the current value of the field\n * @param [override] the override value to apply\n * @param [feeOption] the fee option field value to apply\n * @returns the new value of the field after applying the override or fee option\n */\nexport function applyUserOpOverrideOrFeeOption<\n TValue extends BigNumberish | undefined\n>(\n value: TValue,\n override?: BigNumberish | Multiplier,\n feeOption?: UserOperationFeeOptionsField\n): TValue | BigNumberish {\n return value != null && override != null\n ? applyUserOpOverride(value, override)!\n : applyUserOpFeeOption(value, feeOption);\n}\n\n/**\n * Utility method for checking whether the middleware pipeline should\n * bypass the paymaster middleware for the user operation with the given overrides,\n * either because the UserOp is paying for its own gas, or passing a specific paymaster\n *\n * @template EntryPointVersion TEntryPointVersion\n * @param overrides the user operation overrides to check\n * @returns whether the paymaster middleware should be bypassed\n */\nexport const bypassPaymasterAndData = <\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n>(\n overrides: UserOperationOverrides<TEntryPointVersion> | undefined\n): boolean =>\n !!overrides &&\n (\"paymasterAndData\" in overrides || \"paymasterData\" in overrides);\n\n/**\n * An alternative to `bypassPaymasterAndData` which only returns true if the data parameter\n * is \"0x,\" this is useful for cases when middleware should be bypassed ONLY IF the UserOp will\n * pay for its own gas\n *\n * @template EntryPointVersion TEntryPointVersion\n * @param overrides the user operation overrides to check\n * @returns whether the paymaster middleware should be bypassed\n */\nexport const bypassPaymasterAndDataEmptyHex = <\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion\n>(\n overrides: UserOperationOverrides<TEntryPointVersion> | undefined\n): boolean =>\n overrides !== undefined &&\n ((\"paymasterAndData\" in overrides && overrides.paymasterAndData === \"0x\") ||\n (\"paymasterData\" in overrides && overrides.paymasterData === \"0x\"));\n\n/**\n * Utility method for parsing the paymaster address and paymasterData from the paymasterAndData hex string\n *\n * @param paymasterAndData the paymaster and data hex string to parse.\n * The hex string refers to the paymasterAndData field of entrypoint v0.6 user operation request\n * @returns the parsed paymaster and paymasterData fields of entrypoint v0.7 user operation request paymaster and paymasterData field\n */\nexport const parsePaymasterAndData = (\n paymasterAndData: Hex\n): Pick<UserOperationRequest<\"0.7.0\">, \"paymaster\" | \"paymasterData\"> => ({\n paymaster: paymasterAndData.substring(0, 42) as Address,\n paymasterData: `0x${paymasterAndData.substring(42)}` as Hex,\n});\n\n/**\n * Utility method for converting the object containing the paymaster address and paymaster data\n * to the paymaster and data concatenated hex string\n *\n * @param paymasterAndData the object containing the picked paymaster and paymasterData fields of\n * entrypoint v0.7 user operation request\n * @param paymasterAndData.paymaster the paymaster address\n * @param paymasterAndData.paymasterData the paymaster data\n * @returns the paymasterAndData hex value of entrypoint v0.6 user operation request paymasterAndData field\n */\nexport const concatPaymasterAndData = ({\n paymaster = \"0x\",\n paymasterData = \"0x\",\n}: Pick<UserOperationRequest<\"0.7.0\">, \"paymaster\" | \"paymasterData\">): Hex =>\n concat([paymaster, paymasterData]);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION = "4.0.0-alpha.0";
|