viem 2.57.17 → 2.57.19
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/CHANGELOG.md +100 -0
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js +4 -2
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterStubData.js +6 -2
- package/_cjs/account-abstraction/actions/paymaster/getPaymasterStubData.js.map +1 -1
- package/_cjs/actions/ens/getEnsAddress.js +11 -1
- package/_cjs/actions/ens/getEnsAddress.js.map +1 -1
- package/_cjs/actions/ens/getEnsText.js.map +1 -1
- package/_cjs/actions/index.js +5 -3
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/public/call.js +13 -2
- package/_cjs/actions/public/call.js.map +1 -1
- package/_cjs/actions/public/getDelegation.js +2 -1
- package/_cjs/actions/public/getDelegation.js.map +1 -1
- package/_cjs/actions/public/getFeeHistory.js.map +1 -1
- package/_cjs/actions/public/getLogs.js +18 -1
- package/_cjs/actions/public/getLogs.js.map +1 -1
- package/_cjs/actions/public/internal/isRangeError.js +18 -0
- package/_cjs/actions/public/internal/isRangeError.js.map +1 -0
- package/_cjs/actions/public/internal/watchTransport.js +24 -0
- package/_cjs/actions/public/internal/watchTransport.js.map +1 -0
- package/_cjs/actions/public/iterateLogs.js +48 -0
- package/_cjs/actions/public/iterateLogs.js.map +1 -0
- package/_cjs/actions/public/simulateContract.js +4 -4
- package/_cjs/actions/public/simulateContract.js.map +1 -1
- package/_cjs/actions/public/verifyHash.js +72 -39
- package/_cjs/actions/public/verifyHash.js.map +1 -1
- package/_cjs/actions/public/waitForTransactionReceipt.js +18 -1
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_cjs/actions/public/watchBlockHeaders.js +2 -10
- package/_cjs/actions/public/watchBlockHeaders.js.map +1 -1
- package/_cjs/actions/public/watchBlockNumber.js +3 -18
- package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
- package/_cjs/actions/public/watchBlocks.js +3 -18
- package/_cjs/actions/public/watchBlocks.js.map +1 -1
- package/_cjs/actions/public/watchContractEvent.js +5 -33
- package/_cjs/actions/public/watchContractEvent.js.map +1 -1
- package/_cjs/actions/public/watchEvent.js +5 -33
- package/_cjs/actions/public/watchEvent.js.map +1 -1
- package/_cjs/actions/token/internal.js +2 -10
- package/_cjs/actions/token/internal.js.map +1 -1
- package/_cjs/actions/wallet/deployContract.js +2 -1
- package/_cjs/actions/wallet/deployContract.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js +16 -3
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/actions/wallet/sendCalls.js +2 -1
- package/_cjs/actions/wallet/sendCalls.js.map +1 -1
- package/_cjs/actions/wallet/signAuthorization.js +2 -1
- package/_cjs/actions/wallet/signAuthorization.js.map +1 -1
- package/_cjs/celo/serializers.js +1 -1
- package/_cjs/celo/serializers.js.map +1 -1
- package/_cjs/chains/definitions/kinetiqElysium.js +30 -0
- package/_cjs/chains/definitions/kinetiqElysium.js.map +1 -0
- package/_cjs/chains/definitions/kinetiqElysiumTestnet.js +31 -0
- package/_cjs/chains/definitions/kinetiqElysiumTestnet.js.map +1 -0
- package/_cjs/chains/index.js +14 -9
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/decorators/public.js +2 -0
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/constants/contracts.js +1 -1
- package/_cjs/constants/contracts.js.map +1 -1
- package/_cjs/errors/chain.js +2 -2
- package/_cjs/errors/chain.js.map +1 -1
- package/_cjs/errors/typedData.js +2 -0
- package/_cjs/errors/typedData.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +5 -4
- package/_cjs/index.js.map +1 -1
- package/_cjs/op-stack/actions/buildProveWithdrawal.js +5 -5
- package/_cjs/op-stack/actions/buildProveWithdrawal.js.map +1 -1
- package/_cjs/op-stack/actions/getL2Output.js +13 -9
- package/_cjs/op-stack/actions/getL2Output.js.map +1 -1
- package/_cjs/op-stack/actions/waitToProve.js +1 -0
- package/_cjs/op-stack/actions/waitToProve.js.map +1 -1
- package/_cjs/tempo/Account.js +30 -0
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/actions/accessKey.js +1 -1
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/accounts.js +19 -9
- package/_cjs/tempo/actions/accounts.js.map +1 -1
- package/_cjs/tempo/actions/earn/deployment.js +1 -1
- package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
- package/_cjs/tempo/actions/earn.js +3 -3
- package/_cjs/tempo/actions/earn.js.map +1 -1
- package/_cjs/tempo/actions/propAmm.js +1 -1
- package/_cjs/tempo/actions/propAmm.js.map +1 -1
- package/_cjs/tempo/actions/token.js +10 -2
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +37 -1
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/internal/preAuthorized.js +214 -0
- package/_cjs/tempo/internal/preAuthorized.js.map +1 -0
- package/_cjs/tempo/internal/relay/feePayer.js +25 -7
- package/_cjs/tempo/internal/relay/feePayer.js.map +1 -1
- package/_cjs/tempo/internal/relay.js +2 -2
- package/_cjs/tempo/internal/relay.js.map +1 -1
- package/_cjs/tempo/internal/utils.js +2 -10
- package/_cjs/tempo/internal/utils.js.map +1 -1
- package/_cjs/tokens/defineToken.js +1 -1
- package/_cjs/tokens/defineToken.js.map +1 -1
- package/_cjs/tokens/definitions/ousd.js +1 -0
- package/_cjs/tokens/definitions/ousd.js.map +1 -1
- package/_cjs/utils/abi/decodeAbiParameters.js +33 -9
- package/_cjs/utils/abi/decodeAbiParameters.js.map +1 -1
- package/_cjs/utils/abi/encodeAbiParameters.js +5 -4
- package/_cjs/utils/abi/encodeAbiParameters.js.map +1 -1
- package/_cjs/utils/abi/encodePacked.js +4 -2
- package/_cjs/utils/abi/encodePacked.js.map +1 -1
- package/_cjs/utils/ccip.js +5 -1
- package/_cjs/utils/ccip.js.map +1 -1
- package/_cjs/utils/chain/getChainContractAddress.js +2 -2
- package/_cjs/utils/chain/getChainContractAddress.js.map +1 -1
- package/_cjs/utils/encoding/toBytes.js +5 -6
- package/_cjs/utils/encoding/toBytes.js.map +1 -1
- package/_cjs/utils/ens/avatar/utils.js +25 -5
- package/_cjs/utils/ens/avatar/utils.js.map +1 -1
- package/_cjs/utils/ens/localBatchGatewayRequest.js +13 -1
- package/_cjs/utils/ens/localBatchGatewayRequest.js.map +1 -1
- package/_cjs/utils/promise/createBatchScheduler.js +1 -1
- package/_cjs/utils/promise/createBatchScheduler.js.map +1 -1
- package/_cjs/utils/siwe/validateSiweMessage.js +5 -0
- package/_cjs/utils/siwe/validateSiweMessage.js.map +1 -1
- package/_cjs/zksync/actions/estimateFee.js +1 -1
- package/_cjs/zksync/actions/estimateFee.js.map +1 -1
- package/_cjs/zksync/actions/estimateGasL1ToL2.js +1 -1
- package/_cjs/zksync/actions/estimateGasL1ToL2.js.map +1 -1
- package/_cjs/zksync/actions/finalizeWithdrawal.js +3 -3
- package/_cjs/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_cjs/zksync/actions/sendEip712Transaction.js +10 -2
- package/_cjs/zksync/actions/sendEip712Transaction.js.map +1 -1
- package/_cjs/zksync/actions/signEip712Transaction.js +2 -2
- package/_cjs/zksync/actions/signEip712Transaction.js.map +1 -1
- package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js +4 -2
- package/_esm/account-abstraction/actions/paymaster/getPaymasterData.js.map +1 -1
- package/_esm/account-abstraction/actions/paymaster/getPaymasterStubData.js +6 -2
- package/_esm/account-abstraction/actions/paymaster/getPaymasterStubData.js.map +1 -1
- package/_esm/actions/ens/getEnsAddress.js +12 -1
- package/_esm/actions/ens/getEnsAddress.js.map +1 -1
- package/_esm/actions/ens/getEnsText.js.map +1 -1
- package/_esm/actions/index.js +1 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/public/call.js +13 -2
- package/_esm/actions/public/call.js.map +1 -1
- package/_esm/actions/public/getDelegation.js +2 -1
- package/_esm/actions/public/getDelegation.js.map +1 -1
- package/_esm/actions/public/getFeeHistory.js.map +1 -1
- package/_esm/actions/public/getLogs.js +18 -1
- package/_esm/actions/public/getLogs.js.map +1 -1
- package/_esm/actions/public/internal/isRangeError.js +19 -0
- package/_esm/actions/public/internal/isRangeError.js.map +1 -0
- package/_esm/actions/public/internal/watchTransport.js +22 -0
- package/_esm/actions/public/internal/watchTransport.js.map +1 -0
- package/_esm/actions/public/iterateLogs.js +84 -0
- package/_esm/actions/public/iterateLogs.js.map +1 -0
- package/_esm/actions/public/simulateContract.js +5 -4
- package/_esm/actions/public/simulateContract.js.map +1 -1
- package/_esm/actions/public/verifyHash.js +77 -40
- package/_esm/actions/public/verifyHash.js.map +1 -1
- package/_esm/actions/public/waitForTransactionReceipt.js +20 -1
- package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
- package/_esm/actions/public/watchBlockHeaders.js +2 -10
- package/_esm/actions/public/watchBlockHeaders.js.map +1 -1
- package/_esm/actions/public/watchBlockNumber.js +3 -18
- package/_esm/actions/public/watchBlockNumber.js.map +1 -1
- package/_esm/actions/public/watchBlocks.js +3 -18
- package/_esm/actions/public/watchBlocks.js.map +1 -1
- package/_esm/actions/public/watchContractEvent.js +4 -36
- package/_esm/actions/public/watchContractEvent.js.map +1 -1
- package/_esm/actions/public/watchEvent.js +4 -36
- package/_esm/actions/public/watchEvent.js.map +1 -1
- package/_esm/actions/token/internal.js +2 -10
- package/_esm/actions/token/internal.js.map +1 -1
- package/_esm/actions/wallet/deployContract.js +2 -1
- package/_esm/actions/wallet/deployContract.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js +17 -3
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/actions/wallet/sendCalls.js +2 -1
- package/_esm/actions/wallet/sendCalls.js.map +1 -1
- package/_esm/actions/wallet/signAuthorization.js +2 -1
- package/_esm/actions/wallet/signAuthorization.js.map +1 -1
- package/_esm/celo/serializers.js +1 -1
- package/_esm/celo/serializers.js.map +1 -1
- package/_esm/chains/definitions/kinetiqElysium.js +27 -0
- package/_esm/chains/definitions/kinetiqElysium.js.map +1 -0
- package/_esm/chains/definitions/kinetiqElysiumTestnet.js +28 -0
- package/_esm/chains/definitions/kinetiqElysiumTestnet.js.map +1 -0
- package/_esm/chains/index.js +2 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/decorators/public.js +2 -0
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/constants/contracts.js +1 -1
- package/_esm/constants/contracts.js.map +1 -1
- package/_esm/errors/chain.js +2 -2
- package/_esm/errors/chain.js.map +1 -1
- package/_esm/errors/typedData.js +2 -0
- package/_esm/errors/typedData.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/op-stack/actions/buildProveWithdrawal.js +5 -5
- package/_esm/op-stack/actions/buildProveWithdrawal.js.map +1 -1
- package/_esm/op-stack/actions/getL2Output.js +14 -9
- package/_esm/op-stack/actions/getL2Output.js.map +1 -1
- package/_esm/op-stack/actions/waitToProve.js +1 -0
- package/_esm/op-stack/actions/waitToProve.js.map +1 -1
- package/_esm/tempo/Account.js +33 -1
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/actions/accessKey.js +1 -1
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/accounts.js +24 -10
- package/_esm/tempo/actions/accounts.js.map +1 -1
- package/_esm/tempo/actions/earn/deployment.js +1 -1
- package/_esm/tempo/actions/earn/deployment.js.map +1 -1
- package/_esm/tempo/actions/earn.js +3 -3
- package/_esm/tempo/actions/earn.js.map +1 -1
- package/_esm/tempo/actions/propAmm.js +1 -1
- package/_esm/tempo/actions/propAmm.js.map +1 -1
- package/_esm/tempo/actions/token.js +10 -2
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/chainConfig.js +41 -1
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/internal/preAuthorized.js +244 -0
- package/_esm/tempo/internal/preAuthorized.js.map +1 -0
- package/_esm/tempo/internal/relay/feePayer.js +26 -7
- package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
- package/_esm/tempo/internal/relay.js +8 -3
- package/_esm/tempo/internal/relay.js.map +1 -1
- package/_esm/tempo/internal/utils.js +2 -10
- package/_esm/tempo/internal/utils.js.map +1 -1
- package/_esm/tokens/defineToken.js +2 -1
- package/_esm/tokens/defineToken.js.map +1 -1
- package/_esm/tokens/definitions/ousd.js +2 -1
- package/_esm/tokens/definitions/ousd.js.map +1 -1
- package/_esm/utils/abi/decodeAbiParameters.js +37 -9
- package/_esm/utils/abi/decodeAbiParameters.js.map +1 -1
- package/_esm/utils/abi/encodeAbiParameters.js +6 -4
- package/_esm/utils/abi/encodeAbiParameters.js.map +1 -1
- package/_esm/utils/abi/encodePacked.js +5 -2
- package/_esm/utils/abi/encodePacked.js.map +1 -1
- package/_esm/utils/ccip.js +8 -3
- package/_esm/utils/ccip.js.map +1 -1
- package/_esm/utils/chain/getChainContractAddress.js +2 -2
- package/_esm/utils/chain/getChainContractAddress.js.map +1 -1
- package/_esm/utils/encoding/toBytes.js +5 -6
- package/_esm/utils/encoding/toBytes.js.map +1 -1
- package/_esm/utils/ens/avatar/utils.js +26 -5
- package/_esm/utils/ens/avatar/utils.js.map +1 -1
- package/_esm/utils/ens/localBatchGatewayRequest.js +17 -1
- package/_esm/utils/ens/localBatchGatewayRequest.js.map +1 -1
- package/_esm/utils/promise/createBatchScheduler.js +2 -1
- package/_esm/utils/promise/createBatchScheduler.js.map +1 -1
- package/_esm/utils/siwe/validateSiweMessage.js +6 -0
- package/_esm/utils/siwe/validateSiweMessage.js.map +1 -1
- package/_esm/zksync/actions/estimateFee.js +1 -1
- package/_esm/zksync/actions/estimateFee.js.map +1 -1
- package/_esm/zksync/actions/estimateGasL1ToL2.js +1 -1
- package/_esm/zksync/actions/estimateGasL1ToL2.js.map +1 -1
- package/_esm/zksync/actions/finalizeWithdrawal.js +3 -3
- package/_esm/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_esm/zksync/actions/sendEip712Transaction.js +12 -2
- package/_esm/zksync/actions/sendEip712Transaction.js.map +1 -1
- package/_esm/zksync/actions/signEip712Transaction.js +2 -2
- package/_esm/zksync/actions/signEip712Transaction.js.map +1 -1
- package/_types/account-abstraction/actions/paymaster/getPaymasterData.d.ts.map +1 -1
- package/_types/account-abstraction/actions/paymaster/getPaymasterStubData.d.ts.map +1 -1
- package/_types/actions/ens/getEnsAddress.d.ts +2 -1
- package/_types/actions/ens/getEnsAddress.d.ts.map +1 -1
- package/_types/actions/ens/getEnsText.d.ts +2 -1
- package/_types/actions/ens/getEnsText.d.ts.map +1 -1
- package/_types/actions/index.d.ts +1 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/public/call.d.ts.map +1 -1
- package/_types/actions/public/getDelegation.d.ts.map +1 -1
- package/_types/actions/public/getFeeHistory.d.ts +2 -1
- package/_types/actions/public/getFeeHistory.d.ts.map +1 -1
- package/_types/actions/public/getLogs.d.ts +20 -2
- package/_types/actions/public/getLogs.d.ts.map +1 -1
- package/_types/actions/public/internal/isRangeError.d.ts +3 -0
- package/_types/actions/public/internal/isRangeError.d.ts.map +1 -0
- package/_types/actions/public/internal/watchTransport.d.ts +6 -0
- package/_types/actions/public/internal/watchTransport.d.ts.map +1 -0
- package/_types/actions/public/iterateLogs.d.ts +94 -0
- package/_types/actions/public/iterateLogs.d.ts.map +1 -0
- package/_types/actions/public/simulateContract.d.ts.map +1 -1
- package/_types/actions/public/verifyHash.d.ts +2 -1
- package/_types/actions/public/verifyHash.d.ts.map +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts +7 -2
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/public/watchBlockHeaders.d.ts.map +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
- package/_types/actions/public/watchBlocks.d.ts.map +1 -1
- package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/_types/actions/public/watchEvent.d.ts.map +1 -1
- package/_types/actions/token/internal.d.ts.map +1 -1
- package/_types/actions/wallet/deployContract.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts +3 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/actions/wallet/sendCalls.d.ts.map +1 -1
- package/_types/actions/wallet/signAuthorization.d.ts.map +1 -1
- package/_types/celo/serializers.d.ts.map +1 -1
- package/_types/chains/definitions/kinetiqElysium.d.ts +52 -0
- package/_types/chains/definitions/kinetiqElysium.d.ts.map +1 -0
- package/_types/chains/definitions/kinetiqElysiumTestnet.d.ts +52 -0
- package/_types/chains/definitions/kinetiqElysiumTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +2 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +33 -0
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/constants/contracts.d.ts +1 -1
- package/_types/constants/contracts.d.ts.map +1 -1
- package/_types/errors/typedData.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +2 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/op-stack/actions/getL2Output.d.ts +6 -0
- package/_types/op-stack/actions/getL2Output.d.ts.map +1 -1
- package/_types/op-stack/actions/waitToProve.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +5 -1
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/actions/accounts.d.ts +4 -1
- package/_types/tempo/actions/accounts.d.ts.map +1 -1
- package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
- package/_types/tempo/actions/propAmm.d.ts.map +1 -1
- package/_types/tempo/actions/token.d.ts.map +1 -1
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/internal/preAuthorized.d.ts +41 -0
- package/_types/tempo/internal/preAuthorized.d.ts.map +1 -0
- package/_types/tempo/internal/relay/feePayer.d.ts.map +1 -1
- package/_types/tempo/internal/utils.d.ts.map +1 -1
- package/_types/tokens/defineToken.d.ts +5 -1
- package/_types/tokens/defineToken.d.ts.map +1 -1
- package/_types/tokens/definitions/ousd.d.ts +2 -1
- package/_types/tokens/definitions/ousd.d.ts.map +1 -1
- package/_types/tokens/sets.d.ts +3 -0
- package/_types/tokens/sets.d.ts.map +1 -1
- package/_types/utils/abi/decodeAbiParameters.d.ts +15 -1
- package/_types/utils/abi/decodeAbiParameters.d.ts.map +1 -1
- package/_types/utils/abi/encodeAbiParameters.d.ts.map +1 -1
- package/_types/utils/ccip.d.ts +4 -3
- package/_types/utils/ccip.d.ts.map +1 -1
- package/_types/utils/encoding/toBytes.d.ts +1 -1
- package/_types/utils/encoding/toBytes.d.ts.map +1 -1
- package/_types/utils/ens/avatar/utils.d.ts +6 -2
- package/_types/utils/ens/avatar/utils.d.ts.map +1 -1
- package/_types/utils/ens/localBatchGatewayRequest.d.ts +6 -1
- package/_types/utils/ens/localBatchGatewayRequest.d.ts.map +1 -1
- package/_types/utils/promise/createBatchScheduler.d.ts.map +1 -1
- package/_types/utils/siwe/validateSiweMessage.d.ts.map +1 -1
- package/_types/zksync/actions/estimateFee.d.ts.map +1 -1
- package/_types/zksync/actions/estimateGasL1ToL2.d.ts.map +1 -1
- package/_types/zksync/actions/finalizeWithdrawal.d.ts.map +1 -1
- package/_types/zksync/actions/sendEip712Transaction.d.ts +1 -1
- package/_types/zksync/actions/sendEip712Transaction.d.ts.map +1 -1
- package/_types/zksync/errors/bridge.d.ts +1 -1
- package/_types/zksync/errors/bridge.d.ts.map +1 -1
- package/account-abstraction/actions/paymaster/getPaymasterData.ts +23 -16
- package/account-abstraction/actions/paymaster/getPaymasterStubData.ts +27 -16
- package/actions/ens/getEnsAddress.ts +15 -1
- package/actions/ens/getEnsText.ts +2 -0
- package/actions/index.ts +6 -0
- package/actions/public/call.ts +15 -2
- package/actions/public/getDelegation.ts +6 -1
- package/actions/public/getFeeHistory.ts +2 -0
- package/actions/public/getLogs.ts +44 -0
- package/actions/public/internal/isRangeError.ts +18 -0
- package/actions/public/internal/watchTransport.ts +29 -0
- package/actions/public/iterateLogs.ts +209 -0
- package/actions/public/simulateContract.ts +6 -4
- package/actions/public/verifyHash.ts +87 -60
- package/actions/public/waitForTransactionReceipt.ts +31 -1
- package/actions/public/watchBlockHeaders.ts +2 -12
- package/actions/public/watchBlockNumber.ts +6 -24
- package/actions/public/watchBlocks.ts +6 -24
- package/actions/public/watchContractEvent.ts +7 -42
- package/actions/public/watchEvent.ts +7 -42
- package/actions/token/internal.ts +2 -10
- package/actions/wallet/deployContract.ts +6 -1
- package/actions/wallet/prepareTransactionRequest.ts +25 -3
- package/actions/wallet/sendCalls.ts +6 -1
- package/actions/wallet/signAuthorization.ts +6 -1
- package/celo/serializers.ts +5 -2
- package/chains/definitions/kinetiqElysium.ts +27 -0
- package/chains/definitions/kinetiqElysiumTestnet.ts +28 -0
- package/chains/index.ts +2 -0
- package/clients/decorators/public.ts +47 -0
- package/constants/contracts.ts +1 -1
- package/errors/chain.ts +2 -2
- package/errors/typedData.ts +2 -0
- package/errors/version.ts +1 -1
- package/index.ts +7 -0
- package/op-stack/actions/buildProveWithdrawal.ts +5 -5
- package/op-stack/actions/getL2Output.ts +24 -11
- package/op-stack/actions/waitToProve.ts +1 -0
- package/package.json +2 -2
- package/tempo/Account.ts +38 -1
- package/tempo/actions/accessKey.ts +1 -1
- package/tempo/actions/accounts.ts +29 -11
- package/tempo/actions/earn/deployment.ts +2 -1
- package/tempo/actions/earn.ts +2 -2
- package/tempo/actions/propAmm.ts +2 -1
- package/tempo/actions/token.ts +10 -2
- package/tempo/chainConfig.ts +53 -5
- package/tempo/internal/preAuthorized.ts +309 -0
- package/tempo/internal/relay/feePayer.ts +33 -11
- package/tempo/internal/relay.ts +8 -3
- package/tempo/internal/utils.ts +2 -10
- package/tokens/defineToken.ts +6 -2
- package/tokens/definitions/ousd.ts +2 -1
- package/utils/abi/decodeAbiParameters.ts +60 -9
- package/utils/abi/encodeAbiParameters.ts +6 -4
- package/utils/abi/encodePacked.ts +5 -1
- package/utils/ccip.ts +17 -3
- package/utils/chain/getChainContractAddress.ts +2 -2
- package/utils/encoding/toBytes.ts +4 -6
- package/utils/ens/avatar/utils.ts +38 -4
- package/utils/ens/localBatchGatewayRequest.ts +21 -2
- package/utils/promise/createBatchScheduler.ts +2 -1
- package/utils/siwe/validateSiweMessage.ts +7 -0
- package/zksync/actions/estimateFee.ts +2 -1
- package/zksync/actions/estimateGasL1ToL2.ts +2 -1
- package/zksync/actions/finalizeWithdrawal.ts +4 -3
- package/zksync/actions/sendEip712Transaction.ts +21 -8
- package/zksync/actions/signEip712Transaction.ts +3 -3
- package/zksync/errors/bridge.ts +1 -1
package/actions/index.ts
CHANGED
|
@@ -242,6 +242,12 @@ export {
|
|
|
242
242
|
type GetTransactionReceiptReturnType,
|
|
243
243
|
getTransactionReceipt,
|
|
244
244
|
} from './public/getTransactionReceipt.js'
|
|
245
|
+
export {
|
|
246
|
+
type IterateLogsErrorType,
|
|
247
|
+
type IterateLogsParameters,
|
|
248
|
+
type IterateLogsReturnType,
|
|
249
|
+
iterateLogs,
|
|
250
|
+
} from './public/iterateLogs.js'
|
|
245
251
|
export {
|
|
246
252
|
type MulticallErrorType,
|
|
247
253
|
type MulticallParameters,
|
package/actions/public/call.ts
CHANGED
|
@@ -353,7 +353,15 @@ export async function call<chain extends Chain | undefined>(
|
|
|
353
353
|
to
|
|
354
354
|
)
|
|
355
355
|
return {
|
|
356
|
-
data: await offchainLookup(client, {
|
|
356
|
+
data: await offchainLookup(client, {
|
|
357
|
+
blockHash,
|
|
358
|
+
blockNumber,
|
|
359
|
+
blockTag,
|
|
360
|
+
data,
|
|
361
|
+
requestOptions,
|
|
362
|
+
requireCanonical,
|
|
363
|
+
to,
|
|
364
|
+
}),
|
|
357
365
|
}
|
|
358
366
|
|
|
359
367
|
// Check for counterfactual deployment error.
|
|
@@ -504,12 +512,17 @@ async function scheduleMulticall<chain extends Chain | undefined>(
|
|
|
504
512
|
requestOptions,
|
|
505
513
|
)
|
|
506
514
|
|
|
507
|
-
|
|
515
|
+
const results = decodeFunctionResult({
|
|
508
516
|
abi: multicall3Abi,
|
|
509
517
|
args: [calls],
|
|
510
518
|
functionName: 'aggregate3',
|
|
511
519
|
data: data || '0x',
|
|
512
520
|
})
|
|
521
|
+
if (results.length !== requests.length)
|
|
522
|
+
throw new BaseError(
|
|
523
|
+
`Multicall returned ${results.length} results for ${requests.length} calls.`,
|
|
524
|
+
)
|
|
525
|
+
return results
|
|
513
526
|
},
|
|
514
527
|
})
|
|
515
528
|
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from '../../utils/address/getAddress.js'
|
|
12
12
|
import { type SizeErrorType, size } from '../../utils/data/size.js'
|
|
13
13
|
import { type SliceErrorType, slice } from '../../utils/data/slice.js'
|
|
14
|
+
import { getAction } from '../../utils/getAction.js'
|
|
14
15
|
import { type GetCodeErrorType, getCode } from './getCode.js'
|
|
15
16
|
|
|
16
17
|
export type GetDelegationParameters = {
|
|
@@ -62,7 +63,11 @@ export async function getDelegation<chain extends Chain | undefined>(
|
|
|
62
63
|
client: Client<Transport, chain>,
|
|
63
64
|
{ address, blockNumber, blockTag = 'latest' }: GetDelegationParameters,
|
|
64
65
|
): Promise<GetDelegationReturnType> {
|
|
65
|
-
const code = await
|
|
66
|
+
const code = await getAction(
|
|
67
|
+
client,
|
|
68
|
+
getCode,
|
|
69
|
+
'getCode',
|
|
70
|
+
)({
|
|
66
71
|
address,
|
|
67
72
|
...(blockNumber !== undefined ? { blockNumber } : { blockTag }),
|
|
68
73
|
} as GetDelegationParameters)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Client } from '../../clients/createClient.js'
|
|
2
2
|
import type { Transport } from '../../clients/transports/createTransport.js'
|
|
3
|
+
import type { ErrorType } from '../../errors/utils.js'
|
|
3
4
|
import type { BlockTag } from '../../types/block.js'
|
|
4
5
|
import type { Chain } from '../../types/chain.js'
|
|
5
6
|
import type { FeeHistory } from '../../types/fee.js'
|
|
@@ -43,6 +44,7 @@ export type GetFeeHistoryErrorType =
|
|
|
43
44
|
| NumberToHexErrorType
|
|
44
45
|
| RequestErrorType
|
|
45
46
|
| FormatFeeHistoryErrorType
|
|
47
|
+
| ErrorType
|
|
46
48
|
|
|
47
49
|
/**
|
|
48
50
|
* Returns a collection of historical gas information.
|
|
@@ -28,6 +28,8 @@ import {
|
|
|
28
28
|
type FormatLogErrorType,
|
|
29
29
|
formatLog,
|
|
30
30
|
} from '../../utils/formatters/log.js'
|
|
31
|
+
import type { GetBlockErrorType } from './getBlock.js'
|
|
32
|
+
import { type IterateLogsParameters, iterateLogs } from './iterateLogs.js'
|
|
31
33
|
|
|
32
34
|
export type GetLogsParameters<
|
|
33
35
|
abiEvent extends AbiEvent | undefined = undefined,
|
|
@@ -78,12 +80,30 @@ export type GetLogsParameters<
|
|
|
78
80
|
/** Block number or tag before which to include logs */
|
|
79
81
|
toBlock?: toBlock | BlockNumber | BlockTag | undefined
|
|
80
82
|
blockHash?: undefined
|
|
83
|
+
blockRange?: undefined
|
|
81
84
|
}
|
|
82
85
|
| {
|
|
83
86
|
fromBlock?: undefined
|
|
84
87
|
toBlock?: undefined
|
|
85
88
|
/** Hash of block to include logs from */
|
|
86
89
|
blockHash?: Hash | undefined
|
|
90
|
+
blockRange?: undefined
|
|
91
|
+
}
|
|
92
|
+
| {
|
|
93
|
+
/** First block to include logs from. Inclusive. */
|
|
94
|
+
fromBlock: BlockNumber
|
|
95
|
+
/**
|
|
96
|
+
* Last block to include logs from. Inclusive. A block tag is resolved to a block number once, before the first request.
|
|
97
|
+
* @default 'latest'
|
|
98
|
+
*/
|
|
99
|
+
toBlock?: BlockNumber | Exclude<BlockTag, 'pending'> | undefined
|
|
100
|
+
blockHash?: undefined
|
|
101
|
+
/**
|
|
102
|
+
* Most blocks to request in one `eth_getLogs` call. When set, logs are requested in
|
|
103
|
+
* consecutive ranges of at most this many blocks, and a range the RPC Provider rejects
|
|
104
|
+
* is halved and requested again. Must be at least `1n`.
|
|
105
|
+
*/
|
|
106
|
+
blockRange: bigint
|
|
87
107
|
}
|
|
88
108
|
)
|
|
89
109
|
|
|
@@ -107,6 +127,7 @@ export type GetLogsErrorType =
|
|
|
107
127
|
| DecodeEventLogErrorType
|
|
108
128
|
| EncodeEventTopicsErrorType
|
|
109
129
|
| FormatLogErrorType
|
|
130
|
+
| GetBlockErrorType
|
|
110
131
|
| NumberToHexErrorType
|
|
111
132
|
| RequestErrorType
|
|
112
133
|
| ErrorType
|
|
@@ -153,9 +174,32 @@ export async function getLogs<
|
|
|
153
174
|
event,
|
|
154
175
|
events: events_,
|
|
155
176
|
args,
|
|
177
|
+
blockRange,
|
|
156
178
|
strict: strict_,
|
|
157
179
|
}: GetLogsParameters<abiEvent, abiEvents, strict, fromBlock, toBlock> = {},
|
|
158
180
|
): Promise<GetLogsReturnType<abiEvent, abiEvents, strict, fromBlock, toBlock>> {
|
|
181
|
+
if (blockRange !== undefined) {
|
|
182
|
+
const logs = []
|
|
183
|
+
for await (const page of iterateLogs(client, {
|
|
184
|
+
address,
|
|
185
|
+
args,
|
|
186
|
+
blockRange,
|
|
187
|
+
event,
|
|
188
|
+
events: events_,
|
|
189
|
+
fromBlock,
|
|
190
|
+
strict: strict_,
|
|
191
|
+
toBlock,
|
|
192
|
+
} as IterateLogsParameters))
|
|
193
|
+
for (const log of page.logs) logs.push(log)
|
|
194
|
+
return logs as GetLogsReturnType<
|
|
195
|
+
abiEvent,
|
|
196
|
+
abiEvents,
|
|
197
|
+
strict,
|
|
198
|
+
fromBlock,
|
|
199
|
+
toBlock
|
|
200
|
+
>
|
|
201
|
+
}
|
|
202
|
+
|
|
159
203
|
const strict = strict_ ?? false
|
|
160
204
|
const events = events_ ?? (event ? [event] : undefined)
|
|
161
205
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseError } from '../../../errors/base.js'
|
|
2
|
+
import { HttpRequestError, RpcRequestError } from '../../../errors/request.js'
|
|
3
|
+
|
|
4
|
+
/** Returns whether a failed `eth_getLogs` request may succeed with a smaller block range. */
|
|
5
|
+
export function isRangeError(error: unknown) {
|
|
6
|
+
if (!(error instanceof BaseError)) return true
|
|
7
|
+
const cause = error.walk(
|
|
8
|
+
(err) => err instanceof HttpRequestError || err instanceof RpcRequestError,
|
|
9
|
+
) as HttpRequestError | RpcRequestError | null
|
|
10
|
+
if (!cause) return true
|
|
11
|
+
// Rate limited.
|
|
12
|
+
if (cause instanceof RpcRequestError && cause.code === 429) return false
|
|
13
|
+
// Unreachable.
|
|
14
|
+
if (cause instanceof HttpRequestError && cause.status === undefined)
|
|
15
|
+
return false
|
|
16
|
+
// Unauthorized, forbidden or rate limited.
|
|
17
|
+
return cause.status !== 401 && cause.status !== 403 && cause.status !== 429
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Client } from '../../../clients/createClient.js'
|
|
2
|
+
import type { Transport } from '../../../clients/transports/createTransport.js'
|
|
3
|
+
|
|
4
|
+
/** Selects the first direct socket member of a fallback transport. */
|
|
5
|
+
export function getSubscriptionTransport(client: Client) {
|
|
6
|
+
if (client.transport.type === 'fallback') {
|
|
7
|
+
const transport = client.transport.transports.find(
|
|
8
|
+
(transport: ReturnType<Transport>) =>
|
|
9
|
+
transport.config.type === 'webSocket' ||
|
|
10
|
+
transport.config.type === 'ipc',
|
|
11
|
+
)
|
|
12
|
+
if (!transport) return client.transport
|
|
13
|
+
return transport.value
|
|
14
|
+
}
|
|
15
|
+
return client.transport
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Defaults to subscriptions only when the first transport supports them. */
|
|
19
|
+
export function shouldPoll(client: Client) {
|
|
20
|
+
if (client.transport.type === 'webSocket' || client.transport.type === 'ipc')
|
|
21
|
+
return false
|
|
22
|
+
if (
|
|
23
|
+
client.transport.type === 'fallback' &&
|
|
24
|
+
(client.transport.transports[0].config.type === 'webSocket' ||
|
|
25
|
+
client.transport.transports[0].config.type === 'ipc')
|
|
26
|
+
)
|
|
27
|
+
return false
|
|
28
|
+
return true
|
|
29
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type { AbiEvent, Address } from 'abitype'
|
|
2
|
+
|
|
3
|
+
import type { Client } from '../../clients/createClient.js'
|
|
4
|
+
import type { Transport } from '../../clients/transports/createTransport.js'
|
|
5
|
+
import { BaseError } from '../../errors/base.js'
|
|
6
|
+
import type { ErrorType } from '../../errors/utils.js'
|
|
7
|
+
import type { BlockTag } from '../../types/block.js'
|
|
8
|
+
import type { Chain } from '../../types/chain.js'
|
|
9
|
+
import type {
|
|
10
|
+
MaybeAbiEventName,
|
|
11
|
+
MaybeExtractEventArgsFromAbi,
|
|
12
|
+
} from '../../types/contract.js'
|
|
13
|
+
import { getAction } from '../../utils/getAction.js'
|
|
14
|
+
import { type GetBlockErrorType, getBlock } from './getBlock.js'
|
|
15
|
+
import {
|
|
16
|
+
type GetLogsErrorType,
|
|
17
|
+
type GetLogsParameters,
|
|
18
|
+
type GetLogsReturnType,
|
|
19
|
+
getLogs,
|
|
20
|
+
} from './getLogs.js'
|
|
21
|
+
import { isRangeError } from './internal/isRangeError.js'
|
|
22
|
+
|
|
23
|
+
export type IterateLogsParameters<
|
|
24
|
+
abiEvent extends AbiEvent | undefined = undefined,
|
|
25
|
+
abiEvents extends
|
|
26
|
+
| readonly AbiEvent[]
|
|
27
|
+
| readonly unknown[]
|
|
28
|
+
| undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,
|
|
29
|
+
strict extends boolean | undefined = undefined,
|
|
30
|
+
//
|
|
31
|
+
_eventName extends string | undefined = MaybeAbiEventName<abiEvent>,
|
|
32
|
+
> = {
|
|
33
|
+
/** Address or list of addresses from which logs originated */
|
|
34
|
+
address?: Address | Address[] | undefined
|
|
35
|
+
/**
|
|
36
|
+
* Most blocks to request in one `eth_getLogs` call. Must be at least `1n`.
|
|
37
|
+
* @default 1_000n
|
|
38
|
+
*/
|
|
39
|
+
blockRange?: bigint | undefined
|
|
40
|
+
/** First block to include. Inclusive. */
|
|
41
|
+
fromBlock: bigint
|
|
42
|
+
/**
|
|
43
|
+
* Last block to include. Inclusive. A block tag is resolved to a block number once, before the first page.
|
|
44
|
+
* @default 'latest'
|
|
45
|
+
*/
|
|
46
|
+
toBlock?: bigint | Exclude<BlockTag, 'pending'> | undefined
|
|
47
|
+
} & (
|
|
48
|
+
| {
|
|
49
|
+
event: abiEvent
|
|
50
|
+
events?: undefined
|
|
51
|
+
args?: MaybeExtractEventArgsFromAbi<abiEvents, _eventName> | undefined
|
|
52
|
+
/**
|
|
53
|
+
* Whether or not the logs must match the indexed/non-indexed arguments on `event`.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
strict?: strict | undefined
|
|
57
|
+
}
|
|
58
|
+
| {
|
|
59
|
+
event?: undefined
|
|
60
|
+
events: abiEvents
|
|
61
|
+
args?: undefined
|
|
62
|
+
/**
|
|
63
|
+
* Whether or not the logs must match the indexed/non-indexed arguments on `event`.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
strict?: strict | undefined
|
|
67
|
+
}
|
|
68
|
+
| {
|
|
69
|
+
event?: undefined
|
|
70
|
+
events?: undefined
|
|
71
|
+
args?: undefined
|
|
72
|
+
strict?: undefined
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
export type IterateLogsReturnType<
|
|
77
|
+
abiEvent extends AbiEvent | undefined = undefined,
|
|
78
|
+
abiEvents extends
|
|
79
|
+
| readonly AbiEvent[]
|
|
80
|
+
| readonly unknown[]
|
|
81
|
+
| undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,
|
|
82
|
+
strict extends boolean | undefined = undefined,
|
|
83
|
+
> = AsyncGenerator<
|
|
84
|
+
{
|
|
85
|
+
/** Last block of the whole iteration: `toBlock`, or the block number its tag resolved to. */
|
|
86
|
+
endBlock: bigint
|
|
87
|
+
/** First block of the page. */
|
|
88
|
+
fromBlock: bigint
|
|
89
|
+
/** Logs from `fromBlock` to `toBlock`. */
|
|
90
|
+
logs: GetLogsReturnType<abiEvent, abiEvents, strict>
|
|
91
|
+
/** Last block of the page. A resumed iteration starts at `toBlock + 1n`. */
|
|
92
|
+
toBlock: bigint
|
|
93
|
+
},
|
|
94
|
+
void,
|
|
95
|
+
undefined
|
|
96
|
+
>
|
|
97
|
+
|
|
98
|
+
export type IterateLogsErrorType =
|
|
99
|
+
| GetBlockErrorType
|
|
100
|
+
| GetLogsErrorType
|
|
101
|
+
| ErrorType
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Iterates over the event logs in a block range, one page of blocks at a time.
|
|
105
|
+
*
|
|
106
|
+
* - Docs: https://viem.sh/docs/actions/public/iterateLogs
|
|
107
|
+
* - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
|
|
108
|
+
*
|
|
109
|
+
* Pages are contiguous and are yielded even when they contain no logs, so a consumer that
|
|
110
|
+
* stores each page's `toBlock` can resume from `toBlock + 1n`. A page is only requested
|
|
111
|
+
* once the consumer asks for it. If a request fails with an error that a smaller block
|
|
112
|
+
* range may avoid (such as an RPC Provider's block range or response size limit), the page
|
|
113
|
+
* is halved and requested again.
|
|
114
|
+
*
|
|
115
|
+
* @param client - Client to use
|
|
116
|
+
* @param parameters - {@link IterateLogsParameters}
|
|
117
|
+
* @returns An async iterator of log pages. {@link IterateLogsReturnType}
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* import { createPublicClient, http, parseAbiItem } from 'viem'
|
|
121
|
+
* import { mainnet } from 'viem/chains'
|
|
122
|
+
* import { iterateLogs } from 'viem/actions'
|
|
123
|
+
*
|
|
124
|
+
* const client = createPublicClient({
|
|
125
|
+
* chain: mainnet,
|
|
126
|
+
* transport: http(),
|
|
127
|
+
* })
|
|
128
|
+
* for await (const page of iterateLogs(client, {
|
|
129
|
+
* event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'),
|
|
130
|
+
* fromBlock: 16330000n,
|
|
131
|
+
* toBlock: 16340000n,
|
|
132
|
+
* })) {
|
|
133
|
+
* console.log(page.toBlock, page.logs)
|
|
134
|
+
* }
|
|
135
|
+
*/
|
|
136
|
+
export async function* iterateLogs<
|
|
137
|
+
chain extends Chain | undefined,
|
|
138
|
+
const abiEvent extends AbiEvent | undefined = undefined,
|
|
139
|
+
const abiEvents extends
|
|
140
|
+
| readonly AbiEvent[]
|
|
141
|
+
| readonly unknown[]
|
|
142
|
+
| undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,
|
|
143
|
+
strict extends boolean | undefined = undefined,
|
|
144
|
+
>(
|
|
145
|
+
client: Client<Transport, chain>,
|
|
146
|
+
parameters: IterateLogsParameters<abiEvent, abiEvents, strict>,
|
|
147
|
+
): IterateLogsReturnType<abiEvent, abiEvents, strict> {
|
|
148
|
+
const {
|
|
149
|
+
address,
|
|
150
|
+
args,
|
|
151
|
+
blockRange = 1_000n,
|
|
152
|
+
event,
|
|
153
|
+
events,
|
|
154
|
+
fromBlock,
|
|
155
|
+
strict,
|
|
156
|
+
toBlock = 'latest',
|
|
157
|
+
} = parameters
|
|
158
|
+
|
|
159
|
+
// A range of less than one block never moves past `fromBlock`.
|
|
160
|
+
if (blockRange < 1n)
|
|
161
|
+
throw new BaseError(`\`blockRange\` must be at least 1n.`)
|
|
162
|
+
|
|
163
|
+
// Resolve a block tag once, so the iteration has a fixed end.
|
|
164
|
+
const endBlock =
|
|
165
|
+
typeof toBlock === 'bigint'
|
|
166
|
+
? toBlock
|
|
167
|
+
: (await getAction(client, getBlock, 'getBlock')({ blockTag: toBlock }))
|
|
168
|
+
.number
|
|
169
|
+
|
|
170
|
+
// `size` is the most blocks to request at once. It halves when a request fails
|
|
171
|
+
// and doubles back up to `blockRange` after each page.
|
|
172
|
+
let size = blockRange
|
|
173
|
+
let from = fromBlock
|
|
174
|
+
while (from <= endBlock) {
|
|
175
|
+
const end = from + size - 1n
|
|
176
|
+
const to = end < endBlock ? end : endBlock
|
|
177
|
+
|
|
178
|
+
const logs = await getAction(
|
|
179
|
+
client,
|
|
180
|
+
getLogs,
|
|
181
|
+
'getLogs',
|
|
182
|
+
)({
|
|
183
|
+
address,
|
|
184
|
+
args,
|
|
185
|
+
event,
|
|
186
|
+
events,
|
|
187
|
+
fromBlock: from,
|
|
188
|
+
strict,
|
|
189
|
+
toBlock: to,
|
|
190
|
+
} as GetLogsParameters).catch((error) => {
|
|
191
|
+
// A single block cannot be split, and a smaller range does not
|
|
192
|
+
// help when the RPC Provider is unreachable or rejects the client.
|
|
193
|
+
if (from === to || !isRangeError(error)) throw error
|
|
194
|
+
})
|
|
195
|
+
if (!logs) {
|
|
196
|
+
size = (to - from + 1n) / 2n
|
|
197
|
+
continue
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
yield {
|
|
201
|
+
endBlock,
|
|
202
|
+
fromBlock: from,
|
|
203
|
+
logs: logs as GetLogsReturnType<abiEvent, abiEvents, strict>,
|
|
204
|
+
toBlock: to,
|
|
205
|
+
}
|
|
206
|
+
from = to + 1n
|
|
207
|
+
size = size * 2n < blockRange ? size * 2n : blockRange
|
|
208
|
+
}
|
|
209
|
+
}
|
|
@@ -265,9 +265,10 @@ export async function simulateContract<
|
|
|
265
265
|
...callRequest
|
|
266
266
|
} = parameters as SimulateContractParameters
|
|
267
267
|
|
|
268
|
-
const account =
|
|
269
|
-
|
|
270
|
-
|
|
268
|
+
const account =
|
|
269
|
+
callRequest.account === undefined
|
|
270
|
+
? client.account
|
|
271
|
+
: callRequest.account && parseAccount(callRequest.account)
|
|
271
272
|
const calldata = encodeFunctionData({ abi, args, functionName })
|
|
272
273
|
|
|
273
274
|
try {
|
|
@@ -280,7 +281,8 @@ export async function simulateContract<
|
|
|
280
281
|
data: `${calldata}${dataSuffix ? dataSuffix.replace('0x', '') : ''}`,
|
|
281
282
|
to: address,
|
|
282
283
|
...callRequest,
|
|
283
|
-
|
|
284
|
+
// `call` omits the sender for `null` at runtime, but its parameter type excludes `null`.
|
|
285
|
+
account: account as Account | undefined,
|
|
284
286
|
})
|
|
285
287
|
const result = decodeFunctionResult({
|
|
286
288
|
abi,
|
|
@@ -9,20 +9,19 @@ import {
|
|
|
9
9
|
erc6492SignatureValidatorAbi,
|
|
10
10
|
multicall3Abi,
|
|
11
11
|
} from '../../constants/abis.js'
|
|
12
|
+
import { zeroAddress } from '../../constants/address.js'
|
|
12
13
|
import {
|
|
13
14
|
erc6492SignatureValidatorByteCode,
|
|
14
15
|
multicall3Bytecode,
|
|
15
16
|
} from '../../constants/contracts.js'
|
|
16
|
-
import {
|
|
17
|
-
CallExecutionError,
|
|
18
|
-
ContractFunctionExecutionError,
|
|
19
|
-
} from '../../errors/contract.js'
|
|
17
|
+
import { CallExecutionError } from '../../errors/contract.js'
|
|
20
18
|
import type { InvalidHexBooleanError } from '../../errors/encoding.js'
|
|
21
19
|
import type { ErrorType } from '../../errors/utils.js'
|
|
22
20
|
import type { BlockTag } from '../../types/block.js'
|
|
23
21
|
import type { Chain } from '../../types/chain.js'
|
|
24
22
|
import type { ByteArray, Hash, Hex, Signature } from '../../types/misc.js'
|
|
25
23
|
import type { OneOf } from '../../types/utils.js'
|
|
24
|
+
import { decodeFunctionResult } from '../../utils/abi/decodeFunctionResult.js'
|
|
26
25
|
import {
|
|
27
26
|
type EncodeDeployDataErrorType,
|
|
28
27
|
encodeDeployData,
|
|
@@ -49,7 +48,6 @@ import {
|
|
|
49
48
|
type NumberToHexErrorType,
|
|
50
49
|
numberToHex,
|
|
51
50
|
} from '../../utils/encoding/toHex.js'
|
|
52
|
-
import { getAction } from '../../utils/getAction.js'
|
|
53
51
|
import {
|
|
54
52
|
type RecoverAddressErrorType,
|
|
55
53
|
recoverAddress,
|
|
@@ -60,7 +58,7 @@ import {
|
|
|
60
58
|
} from '../../utils/signature/serializeSignature.js'
|
|
61
59
|
import { type CallErrorType, type CallParameters, call } from './call.js'
|
|
62
60
|
import { type GetCodeErrorType, getCode } from './getCode.js'
|
|
63
|
-
import {
|
|
61
|
+
import type { ReadContractErrorType } from './readContract.js'
|
|
64
62
|
|
|
65
63
|
export type BlockParameters = OneOf<
|
|
66
64
|
| {
|
|
@@ -70,6 +68,7 @@ export type BlockParameters = OneOf<
|
|
|
70
68
|
| {
|
|
71
69
|
/**
|
|
72
70
|
* The block tag to check if the contract was already deployed.
|
|
71
|
+
* Pre-delegated ERC-8010 signatures are verified against `'pending'` when no block is selected.
|
|
73
72
|
* @default 'latest'
|
|
74
73
|
*/
|
|
75
74
|
blockTag?: BlockTag | undefined
|
|
@@ -137,12 +136,26 @@ export async function verifyHash<chain extends Chain | undefined>(
|
|
|
137
136
|
hash,
|
|
138
137
|
erc6492VerifierAddress:
|
|
139
138
|
verifierAddress = parameters.universalSignatureVerifierAddress ??
|
|
140
|
-
|
|
139
|
+
(() => {
|
|
140
|
+
const { blockNumber } = parameters
|
|
141
|
+
const verifier = chain?.contracts?.erc6492Verifier
|
|
142
|
+
// Use the deployless validator for blocks before the verifier was created.
|
|
143
|
+
if (
|
|
144
|
+
blockNumber !== undefined &&
|
|
145
|
+
verifier?.blockCreated &&
|
|
146
|
+
verifier.blockCreated > blockNumber
|
|
147
|
+
)
|
|
148
|
+
return undefined
|
|
149
|
+
return verifier?.address
|
|
150
|
+
})(),
|
|
141
151
|
multicallAddress = parameters.multicallAddress ??
|
|
142
152
|
chain?.contracts?.multicall3?.address,
|
|
143
153
|
mode = 'auto',
|
|
144
154
|
} = parameters
|
|
145
155
|
|
|
156
|
+
// No signature is valid for the zero address.
|
|
157
|
+
if (address === zeroAddress) return false
|
|
158
|
+
|
|
146
159
|
if (chain?.verifyHash) return await chain.verifyHash(client, parameters)
|
|
147
160
|
|
|
148
161
|
const signature = (() => {
|
|
@@ -251,48 +264,51 @@ export async function verifyErc8010(
|
|
|
251
264
|
if (!valid) throw new VerificationError()
|
|
252
265
|
|
|
253
266
|
// Deployless verification.
|
|
254
|
-
const
|
|
255
|
-
client,
|
|
256
|
-
readContract,
|
|
257
|
-
'readContract',
|
|
258
|
-
)({
|
|
267
|
+
const { data: aggregate3Data } = await call({ ...client, ccipRead: false }, {
|
|
259
268
|
...(multicallAddress
|
|
260
|
-
? {
|
|
269
|
+
? { to: multicallAddress }
|
|
261
270
|
: { code: multicall3Bytecode }),
|
|
262
271
|
authorizationList: [authorization],
|
|
263
|
-
abi: multicall3Abi,
|
|
264
272
|
blockHash,
|
|
265
273
|
blockNumber,
|
|
266
|
-
blockTag: 'pending',
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
[
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
274
|
+
blockTag: blockTag ?? 'pending',
|
|
275
|
+
data: encodeFunctionData({
|
|
276
|
+
abi: multicall3Abi,
|
|
277
|
+
functionName: 'aggregate3',
|
|
278
|
+
args: [
|
|
279
|
+
[
|
|
280
|
+
...(initData
|
|
281
|
+
? ([
|
|
282
|
+
{
|
|
283
|
+
allowFailure: true,
|
|
284
|
+
target: to ?? address,
|
|
285
|
+
callData: initData,
|
|
286
|
+
},
|
|
287
|
+
] as const)
|
|
288
|
+
: []),
|
|
289
|
+
{
|
|
290
|
+
allowFailure: true,
|
|
291
|
+
target: address,
|
|
292
|
+
callData: encodeFunctionData({
|
|
293
|
+
abi: erc1271Abi,
|
|
294
|
+
functionName: 'isValidSignature',
|
|
295
|
+
args: [hash, signature],
|
|
296
|
+
}),
|
|
297
|
+
},
|
|
298
|
+
],
|
|
289
299
|
],
|
|
290
|
-
|
|
300
|
+
}),
|
|
301
|
+
requireCanonical,
|
|
302
|
+
} as CallParameters)
|
|
303
|
+
const results = decodeFunctionResult({
|
|
304
|
+
abi: multicall3Abi,
|
|
305
|
+
functionName: 'aggregate3',
|
|
306
|
+
data: aggregate3Data ?? '0x',
|
|
291
307
|
})
|
|
292
308
|
|
|
293
|
-
const
|
|
309
|
+
const result = results[results.length - 1]
|
|
294
310
|
|
|
295
|
-
if (
|
|
311
|
+
if (result?.success && result.returnData.startsWith('0x1626ba7e')) return true
|
|
296
312
|
throw new VerificationError()
|
|
297
313
|
}
|
|
298
314
|
|
|
@@ -344,6 +360,7 @@ async function verifyErc6492(
|
|
|
344
360
|
|
|
345
361
|
const args = verifierAddress
|
|
346
362
|
? ({
|
|
363
|
+
batch: false,
|
|
347
364
|
to: verifierAddress,
|
|
348
365
|
data: encodeFunctionData({
|
|
349
366
|
abi: erc6492SignatureValidatorAbi,
|
|
@@ -361,14 +378,14 @@ async function verifyErc6492(
|
|
|
361
378
|
...rest,
|
|
362
379
|
} as unknown as CallParameters)
|
|
363
380
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
381
|
+
// Verification calls run without CCIP-Read. They use `call` directly
|
|
382
|
+
// because a client's own `call` action keeps its CCIP-Read setting.
|
|
383
|
+
const { data } = await call({ ...client, ccipRead: false }, args).catch(
|
|
384
|
+
(error) => {
|
|
385
|
+
if (error instanceof CallExecutionError) throw new VerificationError()
|
|
386
|
+
throw error
|
|
387
|
+
},
|
|
388
|
+
)
|
|
372
389
|
|
|
373
390
|
if (hexToBool(data ?? '0x0')) return true
|
|
374
391
|
throw new VerificationError()
|
|
@@ -402,25 +419,35 @@ export async function verifyErc1271(
|
|
|
402
419
|
signature,
|
|
403
420
|
} = parameters
|
|
404
421
|
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
readContract,
|
|
408
|
-
'readContract',
|
|
409
|
-
)({
|
|
410
|
-
address,
|
|
411
|
-
abi: erc1271Abi,
|
|
412
|
-
args: [hash, signature],
|
|
422
|
+
const { data } = await call({ ...client, ccipRead: false }, {
|
|
423
|
+
batch: false,
|
|
413
424
|
blockHash,
|
|
414
425
|
blockNumber,
|
|
415
426
|
blockTag,
|
|
416
|
-
|
|
427
|
+
data: encodeFunctionData({
|
|
428
|
+
abi: erc1271Abi,
|
|
429
|
+
functionName: 'isValidSignature',
|
|
430
|
+
args: [hash, signature],
|
|
431
|
+
}),
|
|
417
432
|
requireCanonical,
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
433
|
+
to: address,
|
|
434
|
+
} as CallParameters).catch((error) => {
|
|
435
|
+
if (error instanceof CallExecutionError) throw new VerificationError()
|
|
421
436
|
throw error
|
|
422
437
|
})
|
|
423
438
|
|
|
439
|
+
const result = (() => {
|
|
440
|
+
try {
|
|
441
|
+
return decodeFunctionResult({
|
|
442
|
+
abi: erc1271Abi,
|
|
443
|
+
functionName: 'isValidSignature',
|
|
444
|
+
data: data ?? '0x',
|
|
445
|
+
})
|
|
446
|
+
} catch {
|
|
447
|
+
throw new VerificationError()
|
|
448
|
+
}
|
|
449
|
+
})()
|
|
450
|
+
|
|
424
451
|
if (result.startsWith('0x1626ba7e')) return true
|
|
425
452
|
throw new VerificationError()
|
|
426
453
|
}
|