@aa-sdk/core 4.0.0-alpha.8 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/abis/EntryPointAbi_v7.js +1 -0
- package/dist/esm/abis/EntryPointAbi_v7.js.map +1 -1
- package/dist/esm/account/smartContractAccount.d.ts +50 -1
- package/dist/esm/account/smartContractAccount.js +111 -2
- package/dist/esm/account/smartContractAccount.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperation.d.ts +23 -0
- package/dist/esm/actions/smartAccount/buildUserOperation.js +23 -0
- package/dist/esm/actions/smartAccount/buildUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.d.ts +39 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js +39 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTx.js.map +1 -1
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.d.ts +54 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js +55 -0
- package/dist/esm/actions/smartAccount/buildUserOperationFromTxs.js.map +1 -1
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +28 -0
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js +28 -0
- package/dist/esm/actions/smartAccount/checkGasSponsorshipEligibility.js.map +1 -1
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.d.ts +22 -0
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js +27 -6
- package/dist/esm/actions/smartAccount/dropAndReplaceUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.d.ts +13 -0
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js +13 -0
- package/dist/esm/actions/smartAccount/estimateUserOperationGas.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/initUserOperation.d.ts +13 -0
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js +14 -1
- package/dist/esm/actions/smartAccount/internal/initUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js +2 -1
- package/dist/esm/actions/smartAccount/internal/runMiddlewareStack.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendTransaction.d.ts +24 -0
- package/dist/esm/actions/smartAccount/sendTransaction.js +24 -0
- package/dist/esm/actions/smartAccount/sendTransaction.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendTransactions.d.ts +23 -0
- package/dist/esm/actions/smartAccount/sendTransactions.js +23 -0
- package/dist/esm/actions/smartAccount/sendTransactions.js.map +1 -1
- package/dist/esm/actions/smartAccount/sendUserOperation.d.ts +21 -0
- package/dist/esm/actions/smartAccount/sendUserOperation.js +21 -0
- package/dist/esm/actions/smartAccount/sendUserOperation.js.map +1 -1
- package/dist/esm/actions/smartAccount/types.d.ts +14 -0
- package/dist/esm/actions/smartAccount/types.js +1 -0
- package/dist/esm/actions/smartAccount/types.js.map +1 -1
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.d.ts +24 -0
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js +24 -0
- package/dist/esm/actions/smartAccount/waitForUserOperationTransacation.js.map +1 -1
- package/dist/esm/client/bundlerClient.d.ts +21 -0
- package/dist/esm/client/bundlerClient.js +32 -0
- package/dist/esm/client/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/bundlerClient.d.ts +41 -0
- package/dist/esm/client/decorators/bundlerClient.js +10 -0
- package/dist/esm/client/decorators/bundlerClient.js.map +1 -1
- package/dist/esm/client/decorators/smartAccountClient.d.ts +8 -0
- package/dist/esm/client/decorators/smartAccountClient.js +12 -1
- package/dist/esm/client/decorators/smartAccountClient.js.map +1 -1
- package/dist/esm/client/isSmartAccountClient.d.ts +16 -0
- package/dist/esm/client/isSmartAccountClient.js +16 -0
- package/dist/esm/client/isSmartAccountClient.js.map +1 -1
- package/dist/esm/client/schema.d.ts +12 -0
- package/dist/esm/client/schema.js +14 -0
- package/dist/esm/client/schema.js.map +1 -1
- package/dist/esm/client/smartAccountClient.js +53 -0
- package/dist/esm/client/smartAccountClient.js.map +1 -1
- package/dist/esm/client/types.js +1 -0
- package/dist/esm/client/types.js.map +1 -1
- package/dist/esm/ens/utils.d.ts +45 -0
- package/dist/esm/ens/utils.js +49 -0
- package/dist/esm/ens/utils.js.map +1 -1
- package/dist/esm/entrypoint/index.d.ts +14 -0
- package/dist/esm/entrypoint/index.js +30 -0
- package/dist/esm/entrypoint/index.js.map +1 -1
- package/dist/esm/entrypoint/types.d.ts +17 -0
- package/dist/esm/errors/account.d.ts +87 -4
- package/dist/esm/errors/account.js +88 -4
- package/dist/esm/errors/account.js.map +1 -1
- package/dist/esm/errors/base.d.ts +5 -0
- package/dist/esm/errors/base.js +5 -0
- package/dist/esm/errors/base.js.map +1 -1
- package/dist/esm/errors/client.d.ts +24 -0
- package/dist/esm/errors/client.js +24 -0
- package/dist/esm/errors/client.js.map +1 -1
- package/dist/esm/errors/entrypoint.d.ts +18 -0
- package/dist/esm/errors/entrypoint.js +18 -0
- package/dist/esm/errors/entrypoint.js.map +1 -1
- package/dist/esm/errors/signer.d.ts +8 -0
- package/dist/esm/errors/signer.js +8 -0
- package/dist/esm/errors/signer.js.map +1 -1
- package/dist/esm/errors/transaction.d.ts +14 -1
- package/dist/esm/errors/transaction.js +14 -1
- package/dist/esm/errors/transaction.js.map +1 -1
- package/dist/esm/errors/useroperation.d.ts +25 -0
- package/dist/esm/errors/useroperation.js +26 -0
- package/dist/esm/errors/useroperation.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logger.d.ts +91 -0
- package/dist/esm/logger.js +91 -0
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/middleware/actions.d.ts +14 -0
- package/dist/esm/middleware/actions.js +7 -0
- package/dist/esm/middleware/actions.js.map +1 -1
- package/dist/esm/middleware/defaults/feeEstimator.d.ts +20 -0
- package/dist/esm/middleware/defaults/feeEstimator.js +28 -0
- package/dist/esm/middleware/defaults/feeEstimator.js.map +1 -1
- package/dist/esm/middleware/defaults/gasEstimator.d.ts +8 -0
- package/dist/esm/middleware/defaults/gasEstimator.js +10 -1
- package/dist/esm/middleware/defaults/gasEstimator.js.map +1 -1
- package/dist/esm/middleware/defaults/paymasterAndData.d.ts +8 -0
- package/dist/esm/middleware/defaults/paymasterAndData.js +8 -0
- package/dist/esm/middleware/defaults/paymasterAndData.js.map +1 -1
- package/dist/esm/middleware/defaults/userOpSigner.d.ts +10 -0
- package/dist/esm/middleware/defaults/userOpSigner.js +10 -0
- package/dist/esm/middleware/defaults/userOpSigner.js.map +1 -1
- package/dist/esm/middleware/erc7677middleware.d.ts +21 -0
- package/dist/esm/middleware/erc7677middleware.js +23 -0
- package/dist/esm/middleware/erc7677middleware.js.map +1 -1
- package/dist/esm/middleware/noopMiddleware.d.ts +6 -0
- package/dist/esm/middleware/noopMiddleware.js +6 -0
- package/dist/esm/middleware/noopMiddleware.js.map +1 -1
- package/dist/esm/middleware/types.js +1 -0
- package/dist/esm/middleware/types.js.map +1 -1
- package/dist/esm/signer/local-account.d.ts +96 -1
- package/dist/esm/signer/local-account.js +97 -2
- package/dist/esm/signer/local-account.js.map +1 -1
- package/dist/esm/signer/schema.d.ts +14 -0
- package/dist/esm/signer/schema.js +14 -0
- package/dist/esm/signer/schema.js.map +1 -1
- package/dist/esm/signer/types.d.ts +12 -0
- package/dist/esm/signer/types.js +1 -0
- package/dist/esm/signer/types.js.map +1 -1
- package/dist/esm/signer/utils.d.ts +20 -0
- package/dist/esm/signer/utils.js +27 -0
- package/dist/esm/signer/utils.js.map +1 -1
- package/dist/esm/signer/wallet-client.d.ts +92 -0
- package/dist/esm/signer/wallet-client.js +92 -0
- package/dist/esm/signer/wallet-client.js.map +1 -1
- package/dist/esm/transport/split.d.ts +32 -0
- package/dist/esm/transport/split.js +32 -0
- package/dist/esm/transport/split.js.map +1 -1
- package/dist/esm/types.d.ts +17 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/bigint.d.ts +45 -0
- package/dist/esm/utils/bigint.js +46 -0
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/utils/bytes.d.ts +9 -0
- package/dist/esm/utils/bytes.js +10 -1
- package/dist/esm/utils/bytes.js.map +1 -1
- package/dist/esm/utils/index.d.ts +86 -0
- package/dist/esm/utils/index.js +86 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/schema.d.ts +3 -0
- package/dist/esm/utils/schema.js +9 -0
- package/dist/esm/utils/schema.js.map +1 -1
- package/dist/esm/utils/stateOverride.js +2 -0
- package/dist/esm/utils/stateOverride.js.map +1 -1
- package/dist/esm/utils/types.d.ts +22 -0
- package/dist/esm/utils/types.js +1 -0
- package/dist/esm/utils/types.js.map +1 -1
- package/dist/esm/utils/userop.d.ts +79 -0
- package/dist/esm/utils/userop.js +83 -0
- package/dist/esm/utils/userop.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +3 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/account/smartContractAccount.d.ts +1 -1
- package/dist/types/account/smartContractAccount.d.ts.map +1 -1
- package/dist/types/actions/smartAccount/buildUserOperationFromTx.d.ts +1 -1
- package/dist/types/actions/smartAccount/dropAndReplaceUserOperation.d.ts.map +1 -1
- package/dist/types/client/smartAccountClient.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/middleware/defaults/gasEstimator.d.ts.map +1 -1
- package/dist/types/transport/split.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +11 -12
- package/src/account/smartContractAccount.ts +3 -4
- package/src/actions/smartAccount/buildUserOperationFromTx.ts +1 -1
- package/src/actions/smartAccount/dropAndReplaceUserOperation.ts +10 -10
- package/src/actions/smartAccount/internal/initUserOperation.ts +1 -1
- package/src/client/smartAccountClient.ts +7 -0
- package/src/index.ts +0 -1
- package/src/middleware/defaults/gasEstimator.ts +2 -1
- package/src/transport/split.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/cjs/abis/EntryPointAbi_v6.d.ts +0 -1018
- package/dist/cjs/abis/EntryPointAbi_v6.js +0 -1313
- package/dist/cjs/abis/EntryPointAbi_v6.js.map +0 -1
- package/dist/cjs/abis/EntryPointAbi_v7.d.ts +0 -775
- package/dist/cjs/abis/EntryPointAbi_v7.js +0 -661
- package/dist/cjs/abis/EntryPointAbi_v7.js.map +0 -1
- package/dist/cjs/abis/SimpleAccountAbi_v6.d.ts +0 -405
- package/dist/cjs/abis/SimpleAccountAbi_v6.js +0 -528
- package/dist/cjs/abis/SimpleAccountAbi_v6.js.map +0 -1
- package/dist/cjs/abis/SimpleAccountAbi_v7.d.ts +0 -410
- package/dist/cjs/abis/SimpleAccountAbi_v7.js +0 -538
- package/dist/cjs/abis/SimpleAccountAbi_v7.js.map +0 -1
- package/dist/cjs/abis/SimpleAccountFactoryAbi.d.ts +0 -55
- package/dist/cjs/abis/SimpleAccountFactoryAbi.js +0 -78
- package/dist/cjs/abis/SimpleAccountFactoryAbi.js.map +0 -1
- package/dist/cjs/account/smartContractAccount.d.ts +0 -74
- package/dist/cjs/account/smartContractAccount.js +0 -180
- package/dist/cjs/account/smartContractAccount.js.map +0 -1
- package/dist/cjs/actions/bundler/estimateUserOperationGas.d.ts +0 -8
- package/dist/cjs/actions/bundler/estimateUserOperationGas.js +0 -18
- package/dist/cjs/actions/bundler/estimateUserOperationGas.js.map +0 -1
- package/dist/cjs/actions/bundler/getSupportedEntryPoints.d.ts +0 -3
- package/dist/cjs/actions/bundler/getSupportedEntryPoints.js +0 -11
- package/dist/cjs/actions/bundler/getSupportedEntryPoints.js.map +0 -1
- package/dist/cjs/actions/bundler/getUserOperationByHash.d.ts +0 -6
- package/dist/cjs/actions/bundler/getUserOperationByHash.js +0 -11
- package/dist/cjs/actions/bundler/getUserOperationByHash.js.map +0 -1
- package/dist/cjs/actions/bundler/getUserOperationReceipt.d.ts +0 -6
- package/dist/cjs/actions/bundler/getUserOperationReceipt.js +0 -11
- package/dist/cjs/actions/bundler/getUserOperationReceipt.js.map +0 -1
- package/dist/cjs/actions/bundler/sendRawUserOperation.d.ts +0 -7
- package/dist/cjs/actions/bundler/sendRawUserOperation.js +0 -11
- package/dist/cjs/actions/bundler/sendRawUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/buildUserOperation.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/buildUserOperation.js +0 -25
- package/dist/cjs/actions/smartAccount/buildUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js +0 -39
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTx.js.map +0 -1
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js +0 -62
- package/dist/cjs/actions/smartAccount/buildUserOperationFromTxs.js.map +0 -1
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js +0 -34
- package/dist/cjs/actions/smartAccount/checkGasSponsorshipEligibility.js.map +0 -1
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js +0 -64
- package/dist/cjs/actions/smartAccount/dropAndReplaceUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js +0 -23
- package/dist/cjs/actions/smartAccount/estimateUserOperationGas.js.map +0 -1
- package/dist/cjs/actions/smartAccount/getAddress.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/getAddress.js +0 -13
- package/dist/cjs/actions/smartAccount/getAddress.js.map +0 -1
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.d.ts +0 -7
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js +0 -42
- package/dist/cjs/actions/smartAccount/internal/initUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.d.ts +0 -10
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js +0 -47
- package/dist/cjs/actions/smartAccount/internal/runMiddlewareStack.js.map +0 -1
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.d.ts +0 -10
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js +0 -28
- package/dist/cjs/actions/smartAccount/internal/sendUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/sendTransaction.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/sendTransaction.js +0 -35
- package/dist/cjs/actions/smartAccount/sendTransaction.js.map +0 -1
- package/dist/cjs/actions/smartAccount/sendTransactions.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/sendTransactions.js +0 -36
- package/dist/cjs/actions/smartAccount/sendTransactions.js.map +0 -1
- package/dist/cjs/actions/smartAccount/sendUserOperation.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/sendUserOperation.js +0 -31
- package/dist/cjs/actions/smartAccount/sendUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signMessage.d.ts +0 -6
- package/dist/cjs/actions/smartAccount/signMessage.js +0 -12
- package/dist/cjs/actions/smartAccount/signMessage.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signMessageWith6492.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/signMessageWith6492.js +0 -12
- package/dist/cjs/actions/smartAccount/signMessageWith6492.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signTypedData.d.ts +0 -10
- package/dist/cjs/actions/smartAccount/signTypedData.js +0 -12
- package/dist/cjs/actions/smartAccount/signTypedData.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signTypedDataWith6492.d.ts +0 -6
- package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js +0 -12
- package/dist/cjs/actions/smartAccount/signTypedDataWith6492.js.map +0 -1
- package/dist/cjs/actions/smartAccount/signUserOperation.d.ts +0 -5
- package/dist/cjs/actions/smartAccount/signUserOperation.js +0 -30
- package/dist/cjs/actions/smartAccount/signUserOperation.js.map +0 -1
- package/dist/cjs/actions/smartAccount/types.d.ts +0 -42
- package/dist/cjs/actions/smartAccount/types.js +0 -3
- package/dist/cjs/actions/smartAccount/types.js.map +0 -1
- package/dist/cjs/actions/smartAccount/upgradeAccount.d.ts +0 -4
- package/dist/cjs/actions/smartAccount/upgradeAccount.js +0 -38
- package/dist/cjs/actions/smartAccount/upgradeAccount.js.map +0 -1
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.d.ts +0 -3
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js +0 -36
- package/dist/cjs/actions/smartAccount/waitForUserOperationTransacation.js.map +0 -1
- package/dist/cjs/client/bundlerClient.d.ts +0 -10
- package/dist/cjs/client/bundlerClient.js +0 -51
- package/dist/cjs/client/bundlerClient.js.map +0 -1
- package/dist/cjs/client/decorators/bundlerClient.d.ts +0 -41
- package/dist/cjs/client/decorators/bundlerClient.js +0 -17
- package/dist/cjs/client/decorators/bundlerClient.js.map +0 -1
- package/dist/cjs/client/decorators/smartAccountClient.d.ts +0 -35
- package/dist/cjs/client/decorators/smartAccountClient.js +0 -43
- package/dist/cjs/client/decorators/smartAccountClient.js.map +0 -1
- package/dist/cjs/client/isSmartAccountClient.d.ts +0 -5
- package/dist/cjs/client/isSmartAccountClient.js +0 -18
- package/dist/cjs/client/isSmartAccountClient.js.map +0 -1
- package/dist/cjs/client/schema.d.ts +0 -767
- package/dist/cjs/client/schema.js +0 -63
- package/dist/cjs/client/schema.js.map +0 -1
- package/dist/cjs/client/smartAccountClient.d.ts +0 -33
- package/dist/cjs/client/smartAccountClient.js +0 -93
- package/dist/cjs/client/smartAccountClient.js.map +0 -1
- package/dist/cjs/client/types.d.ts +0 -21
- package/dist/cjs/client/types.js +0 -3
- package/dist/cjs/client/types.js.map +0 -1
- package/dist/cjs/ens/utils.d.ts +0 -6
- package/dist/cjs/ens/utils.js +0 -53
- package/dist/cjs/ens/utils.js.map +0 -1
- package/dist/cjs/entrypoint/0.6.d.ts +0 -1029
- package/dist/cjs/entrypoint/0.6.js +0 -49
- package/dist/cjs/entrypoint/0.6.js.map +0 -1
- package/dist/cjs/entrypoint/0.7.d.ts +0 -792
- package/dist/cjs/entrypoint/0.7.js +0 -88
- package/dist/cjs/entrypoint/0.7.js.map +0 -1
- package/dist/cjs/entrypoint/index.d.ts +0 -8
- package/dist/cjs/entrypoint/index.js +0 -53
- package/dist/cjs/entrypoint/index.js.map +0 -1
- package/dist/cjs/entrypoint/types.d.ts +0 -46
- package/dist/cjs/entrypoint/types.js +0 -3
- package/dist/cjs/entrypoint/types.js.map +0 -1
- package/dist/cjs/errors/account.d.ts +0 -47
- package/dist/cjs/errors/account.js +0 -140
- package/dist/cjs/errors/account.js.map +0 -1
- package/dist/cjs/errors/base.d.ts +0 -18
- package/dist/cjs/errors/base.js +0 -39
- package/dist/cjs/errors/base.js.map +0 -1
- package/dist/cjs/errors/client.d.ts +0 -14
- package/dist/cjs/errors/client.js +0 -44
- package/dist/cjs/errors/client.js.map +0 -1
- package/dist/cjs/errors/entrypoint.d.ts +0 -10
- package/dist/cjs/errors/entrypoint.js +0 -32
- package/dist/cjs/errors/entrypoint.js.map +0 -1
- package/dist/cjs/errors/signer.d.ts +0 -5
- package/dist/cjs/errors/signer.js +0 -20
- package/dist/cjs/errors/signer.js.map +0 -1
- package/dist/cjs/errors/transaction.d.ts +0 -10
- package/dist/cjs/errors/transaction.js +0 -29
- package/dist/cjs/errors/transaction.js.map +0 -1
- package/dist/cjs/errors/useroperation.d.ts +0 -10
- package/dist/cjs/errors/useroperation.js +0 -34
- package/dist/cjs/errors/useroperation.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -60
- package/dist/cjs/index.js +0 -170
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/logger.d.ts +0 -20
- package/dist/cjs/logger.js +0 -60
- package/dist/cjs/logger.js.map +0 -1
- package/dist/cjs/middleware/actions.d.ts +0 -12
- package/dist/cjs/middleware/actions.js +0 -21
- package/dist/cjs/middleware/actions.js.map +0 -1
- package/dist/cjs/middleware/defaults/feeEstimator.d.ts +0 -3
- package/dist/cjs/middleware/defaults/feeEstimator.js +0 -23
- package/dist/cjs/middleware/defaults/feeEstimator.js.map +0 -1
- package/dist/cjs/middleware/defaults/gasEstimator.d.ts +0 -3
- package/dist/cjs/middleware/defaults/gasEstimator.js +0 -27
- package/dist/cjs/middleware/defaults/gasEstimator.js.map +0 -1
- package/dist/cjs/middleware/defaults/paymasterAndData.d.ts +0 -2
- package/dist/cjs/middleware/defaults/paymasterAndData.js +0 -12
- package/dist/cjs/middleware/defaults/paymasterAndData.js.map +0 -1
- package/dist/cjs/middleware/defaults/userOpSigner.d.ts +0 -2
- package/dist/cjs/middleware/defaults/userOpSigner.js +0 -26
- package/dist/cjs/middleware/defaults/userOpSigner.js.map +0 -1
- package/dist/cjs/middleware/erc7677middleware.d.ts +0 -40
- package/dist/cjs/middleware/erc7677middleware.js +0 -77
- package/dist/cjs/middleware/erc7677middleware.js.map +0 -1
- package/dist/cjs/middleware/noopMiddleware.d.ts +0 -3
- package/dist/cjs/middleware/noopMiddleware.js +0 -8
- package/dist/cjs/middleware/noopMiddleware.js.map +0 -1
- package/dist/cjs/middleware/types.d.ts +0 -22
- package/dist/cjs/middleware/types.js +0 -3
- package/dist/cjs/middleware/types.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/signer/local-account.d.ts +0 -219
- package/dist/cjs/signer/local-account.js +0 -56
- package/dist/cjs/signer/local-account.js.map +0 -1
- package/dist/cjs/signer/schema.d.ts +0 -4
- package/dist/cjs/signer/schema.js +0 -16
- package/dist/cjs/signer/schema.js.map +0 -1
- package/dist/cjs/signer/types.d.ts +0 -15
- package/dist/cjs/signer/types.js +0 -3
- package/dist/cjs/signer/types.js.map +0 -1
- package/dist/cjs/signer/utils.d.ts +0 -7
- package/dist/cjs/signer/utils.js +0 -16
- package/dist/cjs/signer/utils.js.map +0 -1
- package/dist/cjs/signer/wallet-client.d.ts +0 -217
- package/dist/cjs/signer/wallet-client.js +0 -58
- package/dist/cjs/signer/wallet-client.js.map +0 -1
- package/dist/cjs/transport/split.d.ts +0 -9
- package/dist/cjs/transport/split.js +0 -26
- package/dist/cjs/transport/split.js.map +0 -1
- package/dist/cjs/types.d.ts +0 -158
- package/dist/cjs/types.js +0 -3
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/utils/bigint.d.ts +0 -10
- package/dist/cjs/utils/bigint.js +0 -55
- package/dist/cjs/utils/bigint.js.map +0 -1
- package/dist/cjs/utils/bytes.d.ts +0 -7
- package/dist/cjs/utils/bytes.js +0 -11
- package/dist/cjs/utils/bytes.js.map +0 -1
- package/dist/cjs/utils/defaults.d.ts +0 -4
- package/dist/cjs/utils/defaults.js +0 -19
- package/dist/cjs/utils/defaults.js.map +0 -1
- package/dist/cjs/utils/index.d.ts +0 -19
- package/dist/cjs/utils/index.js +0 -95
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/schema.d.ts +0 -25
- package/dist/cjs/utils/schema.js +0 -35
- package/dist/cjs/utils/schema.js.map +0 -1
- package/dist/cjs/utils/stateOverride.d.ts +0 -4
- package/dist/cjs/utils/stateOverride.js +0 -52
- package/dist/cjs/utils/stateOverride.js.map +0 -1
- package/dist/cjs/utils/testUtils.d.ts +0 -6
- package/dist/cjs/utils/testUtils.js +0 -33
- package/dist/cjs/utils/testUtils.js.map +0 -1
- package/dist/cjs/utils/types.d.ts +0 -16
- package/dist/cjs/utils/types.js +0 -3
- package/dist/cjs/utils/types.js.map +0 -1
- package/dist/cjs/utils/userop.d.ts +0 -49
- package/dist/cjs/utils/userop.js +0 -75
- package/dist/cjs/utils/userop.js.map +0 -1
- package/dist/cjs/version.d.ts +0 -1
- package/dist/cjs/version.js +0 -5
- package/dist/cjs/version.js.map +0 -1
- package/dist/esm/package.json +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.js","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AAExC,2CAA2C;AAQpC,MAAM,SAAS,GAAG,CAAC,GAAG,IAAc,EAAU,EAAE;IACrD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB;AAQK,MAAM,SAAS,GAAG,CAAC,GAAG,IAAc,EAAU,EAAE;IACrD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB;AAUK,MAAM,WAAW,GAAG,CACzB,KAAmB,EACnB,KAAsC,EACtC,KAAsC,EAC9B,EAAE;IACV,KAAK,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7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aAAa,CAAC;YACvD,MAAM,CAAC,EAAE,IAAI,aAAa,GAAG,CAAC,CAAC;QACjC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,GAAG,EAAE,IAAI,aAAa,CAAC,CAAC;IAE9D,OAAO,GAAG,GAAG,MAAM,CAAC,EAAE,IAAI,aAAa,CAAC,CAAC;AAC3C,CAAC,CAAC;AApBW,QAAA,cAAc,kBAoBzB;AAkBK,MAAM,aAAa,GAAG,CAAC,MAAc,EAAU,EAAE,CACtD,MAAM,CAAC,IAAA,gBAAS,EAAC,IAAA,YAAK,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AADtB,QAAA,aAAa,iBACS","sourcesContent":["import { keccak256, toHex } from \"viem\";\nimport type { BigNumberish, Multiplier } from \"../types\";\nimport { isMultiplier } from \"./schema.js\";\n\n/**\n * Returns the max bigint in a list of bigints\n *\n * @param {bigint[]} args a list of bigints to get the max of\n * @returns {bigint} the max bigint in the list\n */\nexport const bigIntMax = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMax requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m > c ? m : c));\n};\n\n/**\n * Returns the min bigint in a list of bigints\n *\n * @param {bigint[]} args a list of bigints to get the max of\n * @returns {bigint} the min bigint in the list\n */\nexport const bigIntMin = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMin requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m < c ? m : c));\n};\n\n/**\n * Given a bigint and a min-max range, returns the min-max clamped bigint value\n *\n * @param {BigNumberish} value a bigint value to clamp\n * @param {BigNumberish | undefined} lower lower bound min max tuple value\n * @param {BigNumberish | undefined} upper upper bound min max tuple value\n * @returns {bigint} the clamped bigint value per given range\n */\nexport const bigIntClamp = (\n value: BigNumberish,\n lower: BigNumberish | null | undefined,\n upper: BigNumberish | null | undefined\n): bigint => {\n lower = lower != null ? BigInt(lower) : null;\n upper = upper != null ? BigInt(upper) : null;\n\n if (upper != null && lower != null && upper < lower) {\n throw new Error(\n `invalid range: upper bound ${upper} is less than lower bound ${lower}`\n );\n }\n\n let ret = BigInt(value);\n if (lower != null && lower > ret) {\n ret = lower;\n }\n if (upper != null && upper < ret) {\n ret = upper;\n }\n return ret;\n};\n\nexport enum RoundingMode {\n ROUND_DOWN = 0,\n ROUND_UP = 1,\n}\n\n/**\n * Given a bigint and a number (which can be a float), returns the bigint value.\n * Note: this function has loss and will round down to the nearest integer.\n *\n * @param {BigNumberish} base - the number to be multiplied\n * @param {number} multiplier - the amount to multiply by\n * @param {RoundingMode} roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP\n * @returns {bigint} the bigint value of the multiplication with the number rounded by the rounding mode\n */\nexport const bigIntMultiply = (\n base: BigNumberish,\n multiplier: Multiplier[\"multiplier\"],\n roundingMode: RoundingMode = RoundingMode.ROUND_UP\n) => {\n if (!isMultiplier({ multiplier })) {\n throw new Error(\n \"bigIntMultiply requires a multiplier validated number as the second argument\"\n );\n }\n\n // Get decimal places of b. Max decimal places is defined by the MultiplerSchema.\n const decimalPlaces = multiplier.toString().split(\".\")[1]?.length ?? 0;\n const val =\n roundingMode === RoundingMode.ROUND_UP\n ? BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces) +\n BigInt(10 ** decimalPlaces - 1)\n : BigInt(base) * BigInt(multiplier * 10 ** decimalPlaces);\n\n return val / BigInt(10 ** decimalPlaces);\n};\n\n/**\n * Useful if you want to use a string, such as a user's email address, as salt to generate a unique SmartAccount per user.\n *\n * example:\n * ```\n * const salt = stringToIndex(\"alice@example.com\");\n *\n * export const account = new SimpleSmartContractAccount({\n * index: salt,\n * // other args omitted...\n * });\n * ```\n *\n * @param {string} phrase -- any string value.\n * @returns {bigint} the bigint value of the hashed string\n */\nexport const stringToIndex = (phrase: string): bigint =>\n BigInt(keccak256(toHex(phrase)));\n"]}
|
package/dist/cjs/utils/bytes.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.takeBytes = void 0;
|
|
4
|
-
const takeBytes = (bytes, opts = {}) => {
|
|
5
|
-
const { offset, count } = opts;
|
|
6
|
-
const start = (offset ? offset * 2 : 0) + 2;
|
|
7
|
-
const end = count ? start + count * 2 : undefined;
|
|
8
|
-
return `0x${bytes.slice(start, end)}`;
|
|
9
|
-
};
|
|
10
|
-
exports.takeBytes = takeBytes;
|
|
11
|
-
//# sourceMappingURL=bytes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src/utils/bytes.ts"],"names":[],"mappings":";;;AAgBO,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,OAAsB,EAAE,EAAO,EAAE;IACrE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAElD,OAAO,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;AACxC,CAAC,CAAC;AANW,QAAA,SAAS,aAMpB","sourcesContent":["import type { Hex } from \"viem\";\n\ntype TakeBytesOpts = {\n count?: number;\n offset?: number;\n};\n\n/**\n * Given a bytes string, returns a slice of the bytes\n *\n * @param {Hex} bytes - the hex string representing bytes\n * @param {TakeBytesOpts} opts - optional parameters for slicing the bytes\n * @param {number} opts.offset - the offset in bytes to start slicing from\n * @param {number} opts.count - the number of bytes to slice\n * @returns {Hex} the sliced bytes\n */\nexport const takeBytes = (bytes: Hex, opts: TakeBytesOpts = {}): Hex => {\n const { offset, count } = opts;\n const start = (offset ? offset * 2 : 0) + 2; // add 2 to skip the 0x prefix\n const end = count ? start + count * 2 : undefined;\n\n return `0x${bytes.slice(start, end)}`;\n};\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultUserOperationFeeOptions = exports.minPriorityFeePerBidDefaults = void 0;
|
|
4
|
-
const chains_1 = require("viem/chains");
|
|
5
|
-
exports.minPriorityFeePerBidDefaults = new Map([
|
|
6
|
-
[chains_1.arbitrum.id, 10000000n],
|
|
7
|
-
[chains_1.arbitrumGoerli.id, 10000000n],
|
|
8
|
-
[chains_1.arbitrumSepolia.id, 10000000n],
|
|
9
|
-
]);
|
|
10
|
-
const getDefaultUserOperationFeeOptions = (chain) => {
|
|
11
|
-
return {
|
|
12
|
-
maxPriorityFeePerGas: {
|
|
13
|
-
min: exports.minPriorityFeePerBidDefaults.get(chain.id) ?? 100000000n,
|
|
14
|
-
multiplier: 1.33,
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
exports.getDefaultUserOperationFeeOptions = getDefaultUserOperationFeeOptions;
|
|
19
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":";;;AACA,wCAAwE;AAG3D,QAAA,4BAA4B,GAAG,IAAI,GAAG,CAAiB;IAClE,CAAC,iBAAQ,CAAC,EAAE,EAAE,SAAW,CAAC;IAC1B,CAAC,uBAAc,CAAC,EAAE,EAAE,SAAW,CAAC;IAChC,CAAC,wBAAe,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 Chain } from \"viem\";\nimport { arbitrum, arbitrumGoerli, arbitrumSepolia } from \"viem/chains\";\nimport type { UserOperationFeeOptions } from \"../types.js\";\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"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { PromiseOrValue } from "../types.js";
|
|
2
|
-
import type { RecordableKeys } from "./types.js";
|
|
3
|
-
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>;
|
|
4
|
-
export type Deferrable<T> = {
|
|
5
|
-
[K in keyof T]: PromiseOrValue<T[K]>;
|
|
6
|
-
};
|
|
7
|
-
export declare function resolveProperties<T>(object: Deferrable<T>): Promise<T>;
|
|
8
|
-
export declare function deepHexlify(obj: any): any;
|
|
9
|
-
export declare function filterUndefined<T>(obj: T): T;
|
|
10
|
-
export declare function pick(obj: Record<string, unknown>, keys: string | string[]): {};
|
|
11
|
-
export declare const allEqual: (...params: any[]) => boolean;
|
|
12
|
-
export declare const conditionalReturn: <T>(condition: Promise<boolean>, value: () => Promise<T>) => Promise<T | undefined>;
|
|
13
|
-
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>;
|
|
14
|
-
export * from "./bigint.js";
|
|
15
|
-
export * from "./bytes.js";
|
|
16
|
-
export * from "./defaults.js";
|
|
17
|
-
export * from "./schema.js";
|
|
18
|
-
export type * from "./types.js";
|
|
19
|
-
export * from "./userop.js";
|
package/dist/cjs/utils/index.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.toRecord = exports.conditionalReturn = exports.allEqual = exports.pick = exports.filterUndefined = exports.deepHexlify = exports.resolveProperties = exports.asyncPipe = void 0;
|
|
18
|
-
const viem_1 = require("viem");
|
|
19
|
-
const asyncPipe = (...fns) => async (s, o, f) => {
|
|
20
|
-
let result = s;
|
|
21
|
-
for (const fn of fns) {
|
|
22
|
-
result = await fn(result, o, f);
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
exports.asyncPipe = asyncPipe;
|
|
27
|
-
async function resolveProperties(object) {
|
|
28
|
-
const promises = Object.keys(object).map((key) => {
|
|
29
|
-
const value = object[key];
|
|
30
|
-
return Promise.resolve(value).then((v) => ({ key: key, value: v }));
|
|
31
|
-
});
|
|
32
|
-
const results = await Promise.all(promises);
|
|
33
|
-
return filterUndefined(results.reduce((accum, curr) => {
|
|
34
|
-
accum[curr.key] = curr.value;
|
|
35
|
-
return accum;
|
|
36
|
-
}, {}));
|
|
37
|
-
}
|
|
38
|
-
exports.resolveProperties = resolveProperties;
|
|
39
|
-
function deepHexlify(obj) {
|
|
40
|
-
if (typeof obj === "function") {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
if (obj == null || typeof obj === "string" || typeof obj === "boolean") {
|
|
44
|
-
return obj;
|
|
45
|
-
}
|
|
46
|
-
else if (typeof obj === "bigint") {
|
|
47
|
-
return (0, viem_1.toHex)(obj);
|
|
48
|
-
}
|
|
49
|
-
else if (obj._isBigNumber != null || typeof obj !== "object") {
|
|
50
|
-
return (0, viem_1.toHex)(obj).replace(/^0x0/, "0x");
|
|
51
|
-
}
|
|
52
|
-
if (Array.isArray(obj)) {
|
|
53
|
-
return obj.map((member) => deepHexlify(member));
|
|
54
|
-
}
|
|
55
|
-
return Object.keys(obj).reduce((set, key) => ({
|
|
56
|
-
...set,
|
|
57
|
-
[key]: deepHexlify(obj[key]),
|
|
58
|
-
}), {});
|
|
59
|
-
}
|
|
60
|
-
exports.deepHexlify = deepHexlify;
|
|
61
|
-
function filterUndefined(obj) {
|
|
62
|
-
for (const key in obj) {
|
|
63
|
-
if (obj[key] == null) {
|
|
64
|
-
delete obj[key];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return obj;
|
|
68
|
-
}
|
|
69
|
-
exports.filterUndefined = filterUndefined;
|
|
70
|
-
function pick(obj, keys) {
|
|
71
|
-
return Object.keys(obj)
|
|
72
|
-
.filter((k) => keys.includes(k))
|
|
73
|
-
.reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});
|
|
74
|
-
}
|
|
75
|
-
exports.pick = pick;
|
|
76
|
-
const allEqual = (...params) => {
|
|
77
|
-
if (params.length === 0) {
|
|
78
|
-
throw new Error("no values passed in");
|
|
79
|
-
}
|
|
80
|
-
return params.every((v) => v === params[0]);
|
|
81
|
-
};
|
|
82
|
-
exports.allEqual = allEqual;
|
|
83
|
-
const conditionalReturn = (condition, value) => condition.then((t) => (t ? value() : undefined));
|
|
84
|
-
exports.conditionalReturn = conditionalReturn;
|
|
85
|
-
const toRecord = (array, selector, fn) => array.reduce((acc, item) => {
|
|
86
|
-
acc[item[selector]] = fn(item);
|
|
87
|
-
return acc;
|
|
88
|
-
}, {});
|
|
89
|
-
exports.toRecord = toRecord;
|
|
90
|
-
__exportStar(require("./bigint.js"), exports);
|
|
91
|
-
__exportStar(require("./bytes.js"), exports);
|
|
92
|
-
__exportStar(require("./defaults.js"), exports);
|
|
93
|
-
__exportStar(require("./schema.js"), exports);
|
|
94
|
-
__exportStar(require("./userop.js"), exports);
|
|
95
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAA6B;AAUtB,MAAM,SAAS,GACpB,CAAU,GAAG,GAA2C,EAAE,EAAE,CAC5D,KAAK,EAAE,CAAI,EAAE,CAAK,EAAE,CAAK,EAAE,EAAE;IAC3B,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARS,QAAA,SAAS,aAQlB;AAaG,KAAK,UAAU,iBAAiB,CAAI,MAAqB;IAC9D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QA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AAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC,CAAC;AALW,QAAA,QAAQ,YAKnB;AASK,MAAM,iBAAiB,GAAG,CAC/B,SAA2B,EAC3B,KAAuB,EACC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAHjE,QAAA,iBAAiB,qBAGgD;AAsBvE,MAAM,QAAQ,GAAG,CAKtB,KAAU,EACV,QAAW,EACX,EAAkB,EACD,EAAE,CACnB,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IACzB,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 { toHex } from \"viem\";\nimport type { PromiseOrValue } from \"../types.js\";\nimport type { RecordableKeys } from \"./types.js\";\n\n/**\n * Utility function that allows for piping a series of async functions together\n *\n * @param {((s: S, o?: O, f?: F) => Promise<S>)[]} fns - functions to pipe\n * @returns {S} 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 Deferrable object\n *\n * @param {Deferrable<T>} object - a Deferrable object\n * @returns {Promise<T>} 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 {any} obj - obj to deep hexlify\n * @returns {any} 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/**\n * Filters out properties with undefined or null values from the provided object.\n *\n * @example\n * ```ts\n * import { filterUndefined } from \"@aa-sdk/core\";\n *\n * const result = filterUndefined({\n * foo: undefined,\n * bar: null,\n * baz: \"baz\",\n * }); // { baz: \"baz\" }\n * ```\n *\n * @param {T} obj the object from which to remove properties with undefined or null values\n * @returns {T} the object with undefined or null properties removed\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\n/**\n * Picks the specified keys from an object and returns a new object containing only those key-value pairs.\n *\n * @example\n * ```ts\n * import { pick } from \"@aa-sdk/core\";\n *\n * const picked = pick({\n * foo: \"foo\",\n * bar: \"bar\",\n * }, [\"foo\"]); // { foo: \"foo\" }\n * ```\n *\n * @param {Record<string, unknown>} obj The object from which to pick keys\n * @param {string|string[]} keys A single key or an array of keys to pick from the object\n * @returns {Record<string, unknown>} A new object containing only the picked key-value pairs\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 {...any[]} params - values to check\n * @returns {boolean} 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 {Promise<boolean>} condition - condition to check\n * @param {() => Promise<T>} value - value to return when condition holds true\n * @returns {Promise<T | undefined>} 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\n/**\n * Converts an array of objects into a record (object) where each key is determined by the specified selector and the value is determined by the provided function.\n *\n * @example\n * ```ts\n * import { toRecord } from \"@aa-sdk/core\";\n * import { sepolia, mainnet } from \"viem/chains\";\n *\n * const addressesByChain = toRecord(\n * [sepolia, mainnet],\n * \"id\",\n * () => \"0x...\"\n * ); // { [sepolia.id]: \"0x...\", [mainnet.id]: \"0x...\" }\n * ```\n *\n * @param {T[]} array The array of objects to convert to a record\n * @param {K} selector The key used to select the property that will become the record's key\n * @param {(item: T) => V} fn The function that transforms each item in the array into the record's value\n * @returns {Record<T[K], V>} The resulting record object\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"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
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;
|
package/dist/cjs/utils/schema.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/utils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,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"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type RpcStateOverride, type StateOverride } from "viem";
|
|
2
|
-
type SerializeStateOverrideParameters = StateOverride | undefined;
|
|
3
|
-
export declare function serializeStateOverride(parameters?: SerializeStateOverrideParameters): RpcStateOverride | undefined;
|
|
4
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,KAAK,CACb,6CAA6C,KAAK,CAAC,MAAM,YAAY,CACtE,CAAC;IACJ,CAAC;AACH,CAAC;AAOD,SAAS,6BAA6B,CACpC,UAAmD;IAEnD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;IAC9D,MAAM,uBAAuB,GAA4B,EAAE,C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"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"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
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>;
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
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];
|
package/dist/cjs/utils/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 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 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"]}
|
|
@@ -1,49 +0,0 @@
|
|
|
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;
|
package/dist/cjs/utils/userop.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,IAAI,EAAE,CAAC,GAAG,EAAE;QACvC,MAAM,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,GAAG,EAAE;QACvC,MAAM,CAAC,OAAO,CAAC,kBAAkB,IAAI,EAAE,CAAC,GAAG,EAAE;QAC7C,MAAM,CAAC,OAAO,CAAC,oBAAoB,IAA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AAC;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 UserOperationStruct has valid fields for the given entry point version\n *\n * @param {UserOperationStruct} request a UserOperationStruct to validate\n * @returns {boolean} a type guard that asserts the 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 UserOperationRequest has valid fields for the paymaster data\n *\n * @param {UserOperationRequest} request a UserOperationRequest to validate\n * @returns {boolean} a type guard that asserts the UserOperationRequest is a 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 UserOperationStruct has valid fields for the paymaster data\n *\n * @param {UserOperationRequest} request a UserOperationRequest to validate\n * @returns {boolean} a type guard that asserts the UserOperationStruct is a 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 UserOperationOverrides field value\n * over the current value set for the field\n *\n * @param {BigNumberish} value the current value of the field\n * @param {BigNumberish | Multiplier} override the override value to apply\n * @returns {BigNumberish} 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 UserOperationFeeOptionsField value\n * over the current value set for the field\n *\n * @param {BigNumberish} value the current value of the field\n * @param {UserOperationFeeOptionsField} feeOption the override value to apply\n * @returns {BigNumberish} the new value of the field after applying the override\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 UserOperationOverrides field value and\n * a UserOperationFeeOptionsField value over the current value set for the field,\n * with the override taking precedence over the fee option\n *\n * @param {BigNumberish} value the current value of the field\n * @param {BigNumberish | Multiplier} [override] the override value to apply\n * @param {UserOperationFeeOptionsField} [feeOption] the fee option field value to apply\n * @returns {BigNumberish} 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 {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the user operation overrides to check\n * @returns {boolean} 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 {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the user operation overrides to check\n * @returns {boolean} 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 {Hex} 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 {{ paymaster: Hex; paymasterData: Hex}} 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 {{ paymaster: Hex; paymasterData: Hex}} paymasterAndData the object containing the picked paymaster and paymasterData fields of\n * entrypoint v0.7 user operation request\n * @param {Hex} paymasterAndData.paymaster the paymaster address\n * @param {Hex} paymasterAndData.paymasterData the paymaster data\n * @returns {Hex} 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"]}
|
package/dist/cjs/version.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.0-alpha.8";
|
package/dist/cjs/version.js
DELETED
package/dist/cjs/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0-alpha.8\";\n"]}
|
package/dist/esm/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|