viem 2.8.10 → 2.8.12
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 +20 -0
- package/README.md +0 -12
- package/_cjs/accounts/generateMnemonic.js.map +1 -1
- package/_cjs/actions/getContract.js.map +1 -1
- package/_cjs/actions/public/call.js +5 -1
- package/_cjs/actions/public/call.js.map +1 -1
- package/_cjs/actions/public/createContractEventFilter.js.map +1 -1
- package/_cjs/actions/public/estimateFeesPerGas.js.map +1 -1
- package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
- package/_cjs/actions/public/watchBlockNumber.js +1 -1
- package/_cjs/actions/public/watchBlockNumber.js.map +1 -1
- package/_cjs/actions/public/watchBlocks.js +1 -1
- package/_cjs/actions/public/watchBlocks.js.map +1 -1
- package/_cjs/actions/public/watchContractEvent.js +73 -58
- package/_cjs/actions/public/watchContractEvent.js.map +1 -1
- package/_cjs/actions/public/watchEvent.js +1 -1
- package/_cjs/actions/public/watchEvent.js.map +1 -1
- package/_cjs/actions/public/watchPendingTransactions.js +1 -1
- package/_cjs/actions/public/watchPendingTransactions.js.map +1 -1
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_cjs/chains/celo/parsers.js.map +1 -1
- package/_cjs/chains/celo/serializers.js.map +1 -1
- package/_cjs/chains/definitions/cronos.js +3 -3
- package/_cjs/chains/definitions/cronos.js.map +1 -1
- package/_cjs/chains/definitions/lukso.js +6 -0
- package/_cjs/chains/definitions/lukso.js.map +1 -1
- package/_cjs/chains/definitions/luksoTestnet.js +34 -0
- package/_cjs/chains/definitions/luksoTestnet.js.map +1 -0
- package/_cjs/chains/definitions/zkSyncInMemoryNode.js +17 -0
- package/_cjs/chains/definitions/zkSyncInMemoryNode.js.map +1 -0
- package/_cjs/chains/definitions/zkSyncLocalNode.js +17 -0
- package/_cjs/chains/definitions/zkSyncLocalNode.js.map +1 -0
- package/_cjs/chains/index.js +19 -13
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/chains/opStack/actions/getL1BaseFee.js.map +1 -1
- package/_cjs/chains/opStack/actions/getTimeToProve.js.map +1 -1
- package/_cjs/chains/opStack/actions/waitForNextL2Output.js.map +1 -1
- package/_cjs/chains/zksync/formatters.js.map +1 -1
- package/_cjs/chains/zksync/serializers.js.map +1 -1
- package/_cjs/chains/zksync/utils/assertEip712Request.js.map +1 -1
- package/_cjs/chains/zksync/utils/assertEip712Transaction.js.map +1 -1
- package/_cjs/chains/zksync/utils/isEip712Transaction.js.map +1 -1
- package/_cjs/clients/createClient.js.map +1 -1
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/clients/transports/createTransport.js.map +1 -1
- package/_cjs/clients/transports/fallback.js.map +1 -1
- package/_cjs/clients/transports/http.js.map +1 -1
- package/_cjs/errors/abi.js.map +1 -1
- package/_cjs/errors/account.js.map +1 -1
- package/_cjs/errors/base.js.map +1 -1
- package/_cjs/errors/chain.js.map +1 -1
- package/_cjs/errors/contract.js.map +1 -1
- package/_cjs/errors/node.js +5 -5
- package/_cjs/errors/node.js.map +1 -1
- package/_cjs/errors/request.js.map +1 -1
- package/_cjs/errors/rpc.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/abi/formatAbiItem.js.map +1 -1
- package/_cjs/utils/address/getAddress.js.map +1 -1
- package/_cjs/utils/data/isHex.js.map +1 -1
- package/_cjs/utils/data/slice.js.map +1 -1
- package/_cjs/utils/encoding/toBytes.js.map +1 -1
- package/_cjs/utils/errors/getNodeError.js.map +1 -1
- package/_cjs/utils/formatters/block.js.map +1 -1
- package/_cjs/utils/formatters/extract.js.map +1 -1
- package/_cjs/utils/formatters/log.js +1 -1
- package/_cjs/utils/formatters/log.js.map +1 -1
- package/_cjs/utils/formatters/proof.js.map +1 -1
- package/_cjs/utils/formatters/transaction.js.map +1 -1
- package/_cjs/utils/formatters/transactionReceipt.js.map +1 -1
- package/_cjs/utils/formatters/transactionRequest.js.map +1 -1
- package/_cjs/utils/hash/keccak256.js.map +1 -1
- package/_cjs/utils/hash/ripemd160.js.map +1 -1
- package/_cjs/utils/hash/sha256.js.map +1 -1
- package/_cjs/utils/promise/withRetry.js.map +1 -1
- package/_cjs/utils/promise/withTimeout.js +1 -1
- package/_cjs/utils/promise/withTimeout.js.map +1 -1
- package/_cjs/utils/rpc/http.js +1 -1
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_cjs/utils/signature/hashMessage.js.map +1 -1
- package/_cjs/utils/transaction/assertRequest.js.map +1 -1
- package/_cjs/utils/transaction/getTransactionType.js.map +1 -1
- package/_cjs/utils/transaction/serializeAccessList.js.map +1 -1
- package/_cjs/utils/transaction/serializeTransaction.js.map +1 -1
- package/_cjs/utils/typedData.js.map +1 -1
- package/_esm/accounts/generateMnemonic.js.map +1 -1
- package/_esm/actions/getContract.js.map +1 -1
- package/_esm/actions/public/call.js +5 -1
- package/_esm/actions/public/call.js.map +1 -1
- package/_esm/actions/public/createContractEventFilter.js.map +1 -1
- package/_esm/actions/public/estimateFeesPerGas.js.map +1 -1
- package/_esm/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -1
- package/_esm/actions/public/watchBlockNumber.js +1 -1
- package/_esm/actions/public/watchBlockNumber.js.map +1 -1
- package/_esm/actions/public/watchBlocks.js +1 -1
- package/_esm/actions/public/watchBlocks.js.map +1 -1
- package/_esm/actions/public/watchContractEvent.js +75 -60
- package/_esm/actions/public/watchContractEvent.js.map +1 -1
- package/_esm/actions/public/watchEvent.js +1 -1
- package/_esm/actions/public/watchEvent.js.map +1 -1
- package/_esm/actions/public/watchPendingTransactions.js +1 -1
- package/_esm/actions/public/watchPendingTransactions.js.map +1 -1
- package/_esm/actions/wallet/prepareTransactionRequest.js.map +1 -1
- package/_esm/chains/celo/parsers.js.map +1 -1
- package/_esm/chains/celo/serializers.js.map +1 -1
- package/_esm/chains/definitions/cronos.js +3 -3
- package/_esm/chains/definitions/cronos.js.map +1 -1
- package/_esm/chains/definitions/lukso.js +6 -0
- package/_esm/chains/definitions/lukso.js.map +1 -1
- package/_esm/chains/definitions/luksoTestnet.js +31 -0
- package/_esm/chains/definitions/luksoTestnet.js.map +1 -0
- package/_esm/chains/definitions/zkSyncInMemoryNode.js +14 -0
- package/_esm/chains/definitions/zkSyncInMemoryNode.js.map +1 -0
- package/_esm/chains/definitions/zkSyncLocalNode.js +14 -0
- package/_esm/chains/definitions/zkSyncLocalNode.js.map +1 -0
- package/_esm/chains/index.js +8 -5
- package/_esm/chains/index.js.map +1 -1
- package/_esm/chains/opStack/actions/getL1BaseFee.js.map +1 -1
- package/_esm/chains/opStack/actions/getTimeToProve.js.map +1 -1
- package/_esm/chains/opStack/actions/waitForNextL2Output.js.map +1 -1
- package/_esm/chains/opStack/decorators/publicL2.js +2 -2
- package/_esm/chains/zksync/formatters.js.map +1 -1
- package/_esm/chains/zksync/serializers.js.map +1 -1
- package/_esm/chains/zksync/utils/assertEip712Request.js.map +1 -1
- package/_esm/chains/zksync/utils/assertEip712Transaction.js.map +1 -1
- package/_esm/chains/zksync/utils/isEip712Transaction.js.map +1 -1
- package/_esm/clients/createClient.js.map +1 -1
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/clients/transports/createTransport.js.map +1 -1
- package/_esm/clients/transports/fallback.js.map +1 -1
- package/_esm/clients/transports/http.js.map +1 -1
- package/_esm/errors/abi.js.map +1 -1
- package/_esm/errors/account.js.map +1 -1
- package/_esm/errors/base.js.map +1 -1
- package/_esm/errors/chain.js.map +1 -1
- package/_esm/errors/contract.js.map +1 -1
- package/_esm/errors/node.js +5 -5
- package/_esm/errors/node.js.map +1 -1
- package/_esm/errors/request.js.map +1 -1
- package/_esm/errors/rpc.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/utils/abi/formatAbiItem.js.map +1 -1
- package/_esm/utils/address/getAddress.js.map +1 -1
- package/_esm/utils/data/isHex.js.map +1 -1
- package/_esm/utils/data/slice.js.map +1 -1
- package/_esm/utils/encoding/toBytes.js.map +1 -1
- package/_esm/utils/errors/getNodeError.js.map +1 -1
- package/_esm/utils/formatters/block.js.map +1 -1
- package/_esm/utils/formatters/extract.js.map +1 -1
- package/_esm/utils/formatters/log.js +1 -1
- package/_esm/utils/formatters/log.js.map +1 -1
- package/_esm/utils/formatters/proof.js.map +1 -1
- package/_esm/utils/formatters/transaction.js.map +1 -1
- package/_esm/utils/formatters/transactionReceipt.js.map +1 -1
- package/_esm/utils/formatters/transactionRequest.js.map +1 -1
- package/_esm/utils/hash/keccak256.js.map +1 -1
- package/_esm/utils/hash/ripemd160.js.map +1 -1
- package/_esm/utils/hash/sha256.js.map +1 -1
- package/_esm/utils/promise/withRetry.js.map +1 -1
- package/_esm/utils/promise/withTimeout.js +1 -1
- package/_esm/utils/promise/withTimeout.js.map +1 -1
- package/_esm/utils/rpc/http.js +1 -1
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_esm/utils/signature/hashMessage.js.map +1 -1
- package/_esm/utils/transaction/assertRequest.js.map +1 -1
- package/_esm/utils/transaction/getTransactionType.js.map +1 -1
- package/_esm/utils/transaction/serializeAccessList.js.map +1 -1
- package/_esm/utils/transaction/serializeTransaction.js.map +1 -1
- package/_esm/utils/typedData.js.map +1 -1
- package/_types/accounts/generateMnemonic.d.ts +1 -1
- package/_types/accounts/generateMnemonic.d.ts.map +1 -1
- package/_types/accounts/types.d.ts +9 -9
- package/_types/accounts/types.d.ts.map +1 -1
- package/_types/accounts/utils/signTransaction.d.ts +1 -1
- package/_types/accounts/utils/signTransaction.d.ts.map +1 -1
- package/_types/actions/ens/getEnsAddress.d.ts +4 -4
- package/_types/actions/ens/getEnsAddress.d.ts.map +1 -1
- package/_types/actions/ens/getEnsAvatar.d.ts +1 -1
- package/_types/actions/ens/getEnsAvatar.d.ts.map +1 -1
- package/_types/actions/ens/getEnsName.d.ts +3 -3
- package/_types/actions/ens/getEnsName.d.ts.map +1 -1
- package/_types/actions/ens/getEnsResolver.d.ts +1 -1
- package/_types/actions/ens/getEnsResolver.d.ts.map +1 -1
- package/_types/actions/ens/getEnsText.d.ts +3 -3
- package/_types/actions/ens/getEnsText.d.ts.map +1 -1
- package/_types/actions/getContract.d.ts +3 -3
- package/_types/actions/getContract.d.ts.map +1 -1
- package/_types/actions/public/call.d.ts +8 -8
- package/_types/actions/public/call.d.ts.map +1 -1
- package/_types/actions/public/createContractEventFilter.d.ts +6 -6
- package/_types/actions/public/createContractEventFilter.d.ts.map +1 -1
- package/_types/actions/public/createEventFilter.d.ts +21 -21
- package/_types/actions/public/createEventFilter.d.ts.map +1 -1
- package/_types/actions/public/estimateFeesPerGas.d.ts +4 -4
- package/_types/actions/public/estimateFeesPerGas.d.ts.map +1 -1
- package/_types/actions/public/estimateGas.d.ts +5 -5
- package/_types/actions/public/estimateGas.d.ts.map +1 -1
- package/_types/actions/public/estimateMaxPriorityFeePerGas.d.ts +3 -3
- package/_types/actions/public/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
- package/_types/actions/public/getBalance.d.ts +4 -4
- package/_types/actions/public/getBalance.d.ts.map +1 -1
- package/_types/actions/public/getBlock.d.ts +10 -10
- package/_types/actions/public/getBlock.d.ts.map +1 -1
- package/_types/actions/public/getBlockNumber.d.ts +1 -1
- package/_types/actions/public/getBlockNumber.d.ts.map +1 -1
- package/_types/actions/public/getBlockTransactionCount.d.ts +9 -9
- package/_types/actions/public/getBlockTransactionCount.d.ts.map +1 -1
- package/_types/actions/public/getBytecode.d.ts +4 -4
- package/_types/actions/public/getBytecode.d.ts.map +1 -1
- package/_types/actions/public/getContractEvents.d.ts +4 -4
- package/_types/actions/public/getContractEvents.d.ts.map +1 -1
- package/_types/actions/public/getFeeHistory.d.ts +4 -4
- package/_types/actions/public/getFeeHistory.d.ts.map +1 -1
- package/_types/actions/public/getLogs.d.ts +17 -17
- package/_types/actions/public/getLogs.d.ts.map +1 -1
- package/_types/actions/public/getProof.d.ts +4 -4
- package/_types/actions/public/getProof.d.ts.map +1 -1
- package/_types/actions/public/getStorageAt.d.ts +4 -4
- package/_types/actions/public/getStorageAt.d.ts.map +1 -1
- package/_types/actions/public/getTransaction.d.ts +13 -13
- package/_types/actions/public/getTransaction.d.ts.map +1 -1
- package/_types/actions/public/getTransactionConfirmations.d.ts +2 -2
- package/_types/actions/public/getTransactionConfirmations.d.ts.map +1 -1
- package/_types/actions/public/getTransactionCount.d.ts +4 -4
- package/_types/actions/public/getTransactionCount.d.ts.map +1 -1
- package/_types/actions/public/simulateContract.d.ts +3 -3
- package/_types/actions/public/simulateContract.d.ts.map +1 -1
- package/_types/actions/public/waitForTransactionReceipt.d.ts +6 -6
- package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts +1 -1
- package/_types/actions/public/watchBlockNumber.d.ts.map +1 -1
- package/_types/actions/public/watchContractEvent.d.ts.map +1 -1
- package/_types/actions/public/watchEvent.d.ts +13 -13
- package/_types/actions/public/watchEvent.d.ts.map +1 -1
- package/_types/actions/public/watchPendingTransactions.d.ts +1 -1
- package/_types/actions/public/watchPendingTransactions.d.ts.map +1 -1
- package/_types/actions/test/mine.d.ts +1 -1
- package/_types/actions/test/mine.d.ts.map +1 -1
- package/_types/actions/test/reset.d.ts +2 -2
- package/_types/actions/test/reset.d.ts.map +1 -1
- package/_types/actions/wallet/prepareTransactionRequest.d.ts +5 -5
- package/_types/actions/wallet/prepareTransactionRequest.d.ts.map +1 -1
- package/_types/actions/wallet/writeContract.d.ts +1 -1
- package/_types/actions/wallet/writeContract.d.ts.map +1 -1
- package/_types/chains/celo/chainConfig.d.ts +312 -312
- package/_types/chains/celo/formatters.d.ts +312 -312
- package/_types/chains/celo/parsers.d.ts.map +1 -1
- package/_types/chains/celo/serializers.d.ts +1 -1
- package/_types/chains/celo/serializers.d.ts.map +1 -1
- package/_types/chains/celo/types.d.ts +39 -39
- package/_types/chains/celo/types.d.ts.map +1 -1
- package/_types/chains/definitions/ancient8.d.ts +217 -217
- package/_types/chains/definitions/ancient8Sepolia.d.ts +217 -217
- package/_types/chains/definitions/base.d.ts +217 -217
- package/_types/chains/definitions/baseGoerli.d.ts +217 -217
- package/_types/chains/definitions/baseSepolia.d.ts +217 -217
- package/_types/chains/definitions/celo.d.ts +312 -312
- package/_types/chains/definitions/celoAlfajores.d.ts +312 -312
- package/_types/chains/definitions/cronos.d.ts +3 -3
- package/_types/chains/definitions/fraxtal.d.ts +217 -217
- package/_types/chains/definitions/fraxtalTestnet.d.ts +217 -217
- package/_types/chains/definitions/liskSepolia.d.ts +217 -217
- package/_types/chains/definitions/lukso.d.ts +6 -8
- package/_types/chains/definitions/lukso.d.ts.map +1 -1
- package/_types/chains/definitions/luksoTestnet.d.ts +35 -0
- package/_types/chains/definitions/luksoTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/optimism.d.ts +217 -217
- package/_types/chains/definitions/optimismGoerli.d.ts +217 -217
- package/_types/chains/definitions/optimismSepolia.d.ts +217 -217
- package/_types/chains/definitions/pgn.d.ts +217 -217
- package/_types/chains/definitions/pgnTestnet.d.ts +217 -217
- package/_types/chains/definitions/rss3.d.ts +217 -217
- package/_types/chains/definitions/rss3Sepolia.d.ts +217 -217
- package/_types/chains/definitions/zkSync.d.ts +33 -33
- package/_types/chains/definitions/zkSyncInMemoryNode.d.ts +42 -0
- package/_types/chains/definitions/zkSyncInMemoryNode.d.ts.map +1 -0
- package/_types/chains/definitions/zkSyncLocalNode.d.ts +42 -0
- package/_types/chains/definitions/zkSyncLocalNode.d.ts.map +1 -0
- package/_types/chains/definitions/zkSyncSepoliaTestnet.d.ts +33 -33
- package/_types/chains/definitions/zkSyncTestnet.d.ts +33 -33
- package/_types/chains/definitions/zora.d.ts +217 -217
- package/_types/chains/definitions/zoraSepolia.d.ts +217 -217
- package/_types/chains/definitions/zoraTestnet.d.ts +217 -217
- package/_types/chains/index.d.ts +9 -6
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/chains/opStack/actions/buildDepositTransaction.d.ts +7 -7
- package/_types/chains/opStack/actions/buildDepositTransaction.d.ts.map +1 -1
- package/_types/chains/opStack/actions/buildInitiateWithdrawal.d.ts +3 -3
- package/_types/chains/opStack/actions/buildInitiateWithdrawal.d.ts.map +1 -1
- package/_types/chains/opStack/actions/depositTransaction.d.ts +1 -1
- package/_types/chains/opStack/actions/depositTransaction.d.ts.map +1 -1
- package/_types/chains/opStack/actions/estimateDepositTransactionGas.d.ts +1 -1
- package/_types/chains/opStack/actions/estimateDepositTransactionGas.d.ts.map +1 -1
- package/_types/chains/opStack/actions/estimateFinalizeWithdrawalGas.d.ts +1 -1
- package/_types/chains/opStack/actions/estimateFinalizeWithdrawalGas.d.ts.map +1 -1
- package/_types/chains/opStack/actions/estimateInitiateWithdrawalGas.d.ts +1 -1
- package/_types/chains/opStack/actions/estimateInitiateWithdrawalGas.d.ts.map +1 -1
- package/_types/chains/opStack/actions/estimateL1Fee.d.ts +1 -1
- package/_types/chains/opStack/actions/estimateL1Fee.d.ts.map +1 -1
- package/_types/chains/opStack/actions/estimateL1Gas.d.ts +1 -1
- package/_types/chains/opStack/actions/estimateL1Gas.d.ts.map +1 -1
- package/_types/chains/opStack/actions/estimateProveWithdrawalGas.d.ts +1 -1
- package/_types/chains/opStack/actions/estimateProveWithdrawalGas.d.ts.map +1 -1
- package/_types/chains/opStack/actions/finalizeWithdrawal.d.ts +1 -1
- package/_types/chains/opStack/actions/finalizeWithdrawal.d.ts.map +1 -1
- package/_types/chains/opStack/actions/getL1BaseFee.d.ts +2 -2
- package/_types/chains/opStack/actions/getL1BaseFee.d.ts.map +1 -1
- package/_types/chains/opStack/actions/getTimeToNextL2Output.d.ts +2 -2
- package/_types/chains/opStack/actions/getTimeToNextL2Output.d.ts.map +1 -1
- package/_types/chains/opStack/actions/getTimeToProve.d.ts +1 -1
- package/_types/chains/opStack/actions/getTimeToProve.d.ts.map +1 -1
- package/_types/chains/opStack/actions/proveWithdrawal.d.ts +1 -1
- package/_types/chains/opStack/actions/proveWithdrawal.d.ts.map +1 -1
- package/_types/chains/opStack/actions/waitForNextL2Output.d.ts +2 -2
- package/_types/chains/opStack/actions/waitForNextL2Output.d.ts.map +1 -1
- package/_types/chains/opStack/actions/waitToProve.d.ts +1 -1
- package/_types/chains/opStack/actions/waitToProve.d.ts.map +1 -1
- package/_types/chains/opStack/chainConfig.d.ts +217 -217
- package/_types/chains/opStack/decorators/publicL2.d.ts +3 -3
- package/_types/chains/opStack/decorators/publicL2.d.ts.map +1 -1
- package/_types/chains/opStack/formatters.d.ts +217 -217
- package/_types/chains/opStack/types/deposit.d.ts +6 -6
- package/_types/chains/opStack/types/deposit.d.ts.map +1 -1
- package/_types/chains/opStack/types/transaction.d.ts +4 -4
- package/_types/chains/opStack/types/transaction.d.ts.map +1 -1
- package/_types/chains/opStack/types/withdrawal.d.ts +2 -2
- package/_types/chains/opStack/types/withdrawal.d.ts.map +1 -1
- package/_types/chains/zksync/chainConfig.d.ts +33 -33
- package/_types/chains/zksync/formatters.d.ts +33 -33
- package/_types/chains/zksync/serializers.d.ts +1 -1
- package/_types/chains/zksync/serializers.d.ts.map +1 -1
- package/_types/chains/zksync/types/eip712.d.ts +4 -4
- package/_types/chains/zksync/types/eip712.d.ts.map +1 -1
- package/_types/chains/zksync/types/transaction.d.ts +21 -21
- package/_types/chains/zksync/types/transaction.d.ts.map +1 -1
- package/_types/chains/zksync/utils/assertEip712Request.d.ts +2 -1
- package/_types/chains/zksync/utils/assertEip712Request.d.ts.map +1 -1
- package/_types/chains/zksync/utils/assertEip712Transaction.d.ts +2 -1
- package/_types/chains/zksync/utils/assertEip712Transaction.d.ts.map +1 -1
- package/_types/chains/zksync/utils/isEip712Transaction.d.ts +2 -1
- package/_types/chains/zksync/utils/isEip712Transaction.d.ts.map +1 -1
- package/_types/clients/createClient.d.ts +2 -2
- package/_types/clients/createClient.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +7 -7
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/clients/decorators/test.d.ts +1 -1
- package/_types/clients/decorators/test.d.ts.map +1 -1
- package/_types/clients/transports/createTransport.d.ts +9 -9
- package/_types/clients/transports/createTransport.d.ts.map +1 -1
- package/_types/clients/transports/custom.d.ts +4 -4
- package/_types/clients/transports/custom.d.ts.map +1 -1
- package/_types/clients/transports/fallback.d.ts +17 -17
- package/_types/clients/transports/fallback.d.ts.map +1 -1
- package/_types/clients/transports/http.d.ts +13 -13
- package/_types/clients/transports/http.d.ts.map +1 -1
- package/_types/clients/transports/ipc.d.ts +6 -6
- package/_types/clients/transports/ipc.d.ts.map +1 -1
- package/_types/clients/transports/webSocket.d.ts +6 -6
- package/_types/clients/transports/webSocket.d.ts.map +1 -1
- package/_types/errors/abi.d.ts +6 -6
- package/_types/errors/abi.d.ts.map +1 -1
- package/_types/errors/account.d.ts +1 -1
- package/_types/errors/account.d.ts.map +1 -1
- package/_types/errors/base.d.ts +9 -9
- package/_types/errors/base.d.ts.map +1 -1
- package/_types/errors/block.d.ts +2 -2
- package/_types/errors/block.d.ts.map +1 -1
- package/_types/errors/chain.d.ts +3 -3
- package/_types/errors/chain.d.ts.map +1 -1
- package/_types/errors/contract.d.ts +20 -20
- package/_types/errors/contract.d.ts.map +1 -1
- package/_types/errors/encoding.d.ts +3 -3
- package/_types/errors/encoding.d.ts.map +1 -1
- package/_types/errors/estimateGas.d.ts +3 -3
- package/_types/errors/estimateGas.d.ts.map +1 -1
- package/_types/errors/node.d.ts +27 -27
- package/_types/errors/node.d.ts.map +1 -1
- package/_types/errors/request.d.ts +7 -7
- package/_types/errors/request.d.ts.map +1 -1
- package/_types/errors/rpc.d.ts +5 -5
- package/_types/errors/rpc.d.ts.map +1 -1
- package/_types/errors/transaction.d.ts +7 -7
- package/_types/errors/transaction.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +1 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/types/block.d.ts +3 -3
- package/_types/types/block.d.ts.map +1 -1
- package/_types/types/chain.d.ts +1 -1
- package/_types/types/chain.d.ts.map +1 -1
- package/_types/types/contract.d.ts +5 -5
- package/_types/types/contract.d.ts.map +1 -1
- package/_types/types/eip1193.d.ts +29 -29
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/types/ens.d.ts +1 -1
- package/_types/types/ens.d.ts.map +1 -1
- package/_types/types/fee.d.ts +6 -6
- package/_types/types/fee.d.ts.map +1 -1
- package/_types/types/filter.d.ts +9 -9
- package/_types/types/filter.d.ts.map +1 -1
- package/_types/types/kzg.d.ts +1 -1
- package/_types/types/kzg.d.ts.map +1 -1
- package/_types/types/misc.d.ts +2 -2
- package/_types/types/misc.d.ts.map +1 -1
- package/_types/types/rpc.d.ts +16 -16
- package/_types/types/rpc.d.ts.map +1 -1
- package/_types/types/stateOverride.d.ts +5 -5
- package/_types/types/stateOverride.d.ts.map +1 -1
- package/_types/types/transaction.d.ts +56 -56
- package/_types/types/transaction.d.ts.map +1 -1
- package/_types/types/typedData.d.ts +1 -1
- package/_types/types/typedData.d.ts.map +1 -1
- package/_types/types/utils.d.ts +6 -3
- package/_types/types/utils.d.ts.map +1 -1
- package/_types/types/window.d.ts +1 -1
- package/_types/types/window.d.ts.map +1 -1
- package/_types/utils/abi/decodeEventLog.d.ts +1 -1
- package/_types/utils/abi/decodeEventLog.d.ts.map +1 -1
- package/_types/utils/abi/decodeFunctionResult.d.ts +2 -2
- package/_types/utils/abi/decodeFunctionResult.d.ts.map +1 -1
- package/_types/utils/abi/encodeErrorResult.d.ts +2 -2
- package/_types/utils/abi/encodeErrorResult.d.ts.map +1 -1
- package/_types/utils/abi/encodeEventTopics.d.ts +2 -2
- package/_types/utils/abi/encodeEventTopics.d.ts.map +1 -1
- package/_types/utils/abi/encodeFunctionData.d.ts +2 -2
- package/_types/utils/abi/encodeFunctionData.d.ts.map +1 -1
- package/_types/utils/abi/encodeFunctionResult.d.ts +2 -2
- package/_types/utils/abi/encodeFunctionResult.d.ts.map +1 -1
- package/_types/utils/abi/formatAbiItem.d.ts +2 -2
- package/_types/utils/abi/formatAbiItem.d.ts.map +1 -1
- package/_types/utils/abi/formatAbiItemWithArgs.d.ts +2 -2
- package/_types/utils/abi/formatAbiItemWithArgs.d.ts.map +1 -1
- package/_types/utils/address/getAddress.d.ts +1 -1
- package/_types/utils/address/getAddress.d.ts.map +1 -1
- package/_types/utils/address/getContractAddress.d.ts +1 -1
- package/_types/utils/address/getContractAddress.d.ts.map +1 -1
- package/_types/utils/address/isAddress.d.ts +1 -1
- package/_types/utils/address/isAddress.d.ts.map +1 -1
- package/_types/utils/blob/commitmentToVersionedHash.d.ts +1 -1
- package/_types/utils/blob/commitmentToVersionedHash.d.ts.map +1 -1
- package/_types/utils/blob/commitmentsToVersionedHashes.d.ts +1 -1
- package/_types/utils/blob/commitmentsToVersionedHashes.d.ts.map +1 -1
- package/_types/utils/blob/sidecarsToVersionedHashes.d.ts +1 -1
- package/_types/utils/blob/sidecarsToVersionedHashes.d.ts.map +1 -1
- package/_types/utils/chain/assertCurrentChain.d.ts +1 -1
- package/_types/utils/chain/assertCurrentChain.d.ts.map +1 -1
- package/_types/utils/chain/getChainContractAddress.d.ts +1 -1
- package/_types/utils/chain/getChainContractAddress.d.ts.map +1 -1
- package/_types/utils/cursor.d.ts +1 -1
- package/_types/utils/cursor.d.ts.map +1 -1
- package/_types/utils/data/isHex.d.ts +1 -1
- package/_types/utils/data/isHex.d.ts.map +1 -1
- package/_types/utils/data/pad.d.ts +2 -2
- package/_types/utils/data/pad.d.ts.map +1 -1
- package/_types/utils/data/slice.d.ts +6 -6
- package/_types/utils/data/slice.d.ts.map +1 -1
- package/_types/utils/data/trim.d.ts +1 -1
- package/_types/utils/data/trim.d.ts.map +1 -1
- package/_types/utils/encoding/fromBytes.d.ts +5 -5
- package/_types/utils/encoding/fromBytes.d.ts.map +1 -1
- package/_types/utils/encoding/fromHex.d.ts +5 -5
- package/_types/utils/encoding/fromHex.d.ts.map +1 -1
- package/_types/utils/encoding/toBytes.d.ts +5 -5
- package/_types/utils/encoding/toBytes.d.ts.map +1 -1
- package/_types/utils/encoding/toHex.d.ts +7 -7
- package/_types/utils/encoding/toHex.d.ts.map +1 -1
- package/_types/utils/ens/avatar/parseAvatarRecord.d.ts +1 -1
- package/_types/utils/ens/avatar/parseAvatarRecord.d.ts.map +1 -1
- package/_types/utils/errors/getCallError.d.ts +2 -2
- package/_types/utils/errors/getCallError.d.ts.map +1 -1
- package/_types/utils/errors/getContractError.d.ts +3 -3
- package/_types/utils/errors/getContractError.d.ts.map +1 -1
- package/_types/utils/errors/getEstimateGasError.d.ts +3 -3
- package/_types/utils/errors/getEstimateGasError.d.ts.map +1 -1
- package/_types/utils/errors/getNodeError.d.ts +2 -1
- package/_types/utils/errors/getNodeError.d.ts.map +1 -1
- package/_types/utils/errors/getTransactionError.d.ts +2 -2
- package/_types/utils/errors/getTransactionError.d.ts.map +1 -1
- package/_types/utils/formatters/block.d.ts +3 -3
- package/_types/utils/formatters/block.d.ts.map +1 -1
- package/_types/utils/formatters/extract.d.ts +1 -1
- package/_types/utils/formatters/extract.d.ts.map +1 -1
- package/_types/utils/formatters/formatter.d.ts.map +1 -1
- package/_types/utils/formatters/log.d.ts +4 -3
- package/_types/utils/formatters/log.d.ts.map +1 -1
- package/_types/utils/formatters/proof.d.ts +2 -1
- package/_types/utils/formatters/proof.d.ts.map +1 -1
- package/_types/utils/formatters/transaction.d.ts +3 -3
- package/_types/utils/formatters/transaction.d.ts.map +1 -1
- package/_types/utils/formatters/transactionReceipt.d.ts +3 -2
- package/_types/utils/formatters/transactionReceipt.d.ts.map +1 -1
- package/_types/utils/formatters/transactionRequest.d.ts +3 -2
- package/_types/utils/formatters/transactionRequest.d.ts.map +1 -1
- package/_types/utils/hash/keccak256.d.ts +1 -1
- package/_types/utils/hash/keccak256.d.ts.map +1 -1
- package/_types/utils/hash/ripemd160.d.ts +1 -1
- package/_types/utils/hash/ripemd160.d.ts.map +1 -1
- package/_types/utils/hash/sha256.d.ts +1 -1
- package/_types/utils/hash/sha256.d.ts.map +1 -1
- package/_types/utils/poll.d.ts +2 -2
- package/_types/utils/poll.d.ts.map +1 -1
- package/_types/utils/promise/createBatchScheduler.d.ts +4 -4
- package/_types/utils/promise/createBatchScheduler.d.ts.map +1 -1
- package/_types/utils/promise/withCache.d.ts +1 -1
- package/_types/utils/promise/withCache.d.ts.map +1 -1
- package/_types/utils/promise/withRetry.d.ts +4 -4
- package/_types/utils/promise/withRetry.d.ts.map +1 -1
- package/_types/utils/promise/withTimeout.d.ts +4 -4
- package/_types/utils/promise/withTimeout.d.ts.map +1 -1
- package/_types/utils/rpc/http.d.ts +6 -6
- package/_types/utils/rpc/http.d.ts.map +1 -1
- package/_types/utils/rpc/socket.d.ts +2 -2
- package/_types/utils/rpc/socket.d.ts.map +1 -1
- package/_types/utils/signature/hashMessage.d.ts +1 -1
- package/_types/utils/signature/hashMessage.d.ts.map +1 -1
- package/_types/utils/transaction/assertRequest.d.ts +2 -1
- package/_types/utils/transaction/assertRequest.d.ts.map +1 -1
- package/_types/utils/transaction/getTransactionType.d.ts +4 -4
- package/_types/utils/transaction/getTransactionType.d.ts.map +1 -1
- package/_types/utils/transaction/serializeAccessList.d.ts +1 -1
- package/_types/utils/transaction/serializeAccessList.d.ts.map +1 -1
- package/_types/utils/transaction/serializeTransaction.d.ts +2 -2
- package/_types/utils/transaction/serializeTransaction.d.ts.map +1 -1
- package/_types/utils/typedData.d.ts +1 -1
- package/_types/utils/typedData.d.ts.map +1 -1
- package/accounts/generateMnemonic.ts +1 -1
- package/accounts/types.ts +12 -10
- package/accounts/utils/signTransaction.ts +1 -1
- package/actions/ens/getEnsAddress.ts +4 -4
- package/actions/ens/getEnsAvatar.ts +1 -1
- package/actions/ens/getEnsName.ts +3 -3
- package/actions/ens/getEnsResolver.ts +1 -1
- package/actions/ens/getEnsText.ts +3 -3
- package/actions/getContract.ts +3 -3
- package/actions/public/call.ts +16 -12
- package/actions/public/createContractEventFilter.ts +9 -6
- package/actions/public/createEventFilter.ts +21 -21
- package/actions/public/estimateFeesPerGas.ts +4 -4
- package/actions/public/estimateGas.ts +5 -5
- package/actions/public/estimateMaxPriorityFeePerGas.ts +11 -7
- package/actions/public/getBalance.ts +4 -4
- package/actions/public/getBlock.ts +10 -10
- package/actions/public/getBlockNumber.ts +1 -1
- package/actions/public/getBlockTransactionCount.ts +9 -9
- package/actions/public/getBytecode.ts +4 -4
- package/actions/public/getContractEvents.ts +4 -4
- package/actions/public/getFeeHistory.ts +4 -4
- package/actions/public/getLogs.ts +17 -17
- package/actions/public/getProof.ts +4 -4
- package/actions/public/getStorageAt.ts +4 -4
- package/actions/public/getTransaction.ts +13 -13
- package/actions/public/getTransactionConfirmations.ts +2 -2
- package/actions/public/getTransactionCount.ts +4 -4
- package/actions/public/simulateContract.ts +3 -3
- package/actions/public/waitForTransactionReceipt.ts +6 -6
- package/actions/public/watchBlockNumber.ts +2 -2
- package/actions/public/watchBlocks.ts +1 -1
- package/actions/public/watchContractEvent.ts +75 -59
- package/actions/public/watchEvent.ts +14 -14
- package/actions/public/watchPendingTransactions.ts +2 -2
- package/actions/test/mine.ts +1 -1
- package/actions/test/reset.ts +2 -2
- package/actions/wallet/prepareTransactionRequest.ts +5 -4
- package/actions/wallet/writeContract.ts +1 -1
- package/chains/celo/parsers.ts +3 -2
- package/chains/celo/serializers.ts +3 -3
- package/chains/celo/types.ts +37 -37
- package/chains/definitions/cronos.ts +3 -3
- package/chains/definitions/lukso.ts +6 -0
- package/chains/definitions/luksoTestnet.ts +31 -0
- package/chains/definitions/zkSyncInMemoryNode.ts +14 -0
- package/chains/definitions/zkSyncLocalNode.ts +14 -0
- package/chains/index.ts +16 -6
- package/chains/opStack/actions/buildDepositTransaction.ts +7 -7
- package/chains/opStack/actions/buildInitiateWithdrawal.ts +3 -3
- package/chains/opStack/actions/depositTransaction.ts +1 -1
- package/chains/opStack/actions/estimateDepositTransactionGas.ts +1 -1
- package/chains/opStack/actions/estimateFinalizeWithdrawalGas.ts +1 -1
- package/chains/opStack/actions/estimateInitiateWithdrawalGas.ts +1 -1
- package/chains/opStack/actions/estimateL1Fee.ts +1 -1
- package/chains/opStack/actions/estimateL1Gas.ts +1 -1
- package/chains/opStack/actions/estimateProveWithdrawalGas.ts +1 -1
- package/chains/opStack/actions/finalizeWithdrawal.ts +1 -1
- package/chains/opStack/actions/getL1BaseFee.ts +2 -2
- package/chains/opStack/actions/getTimeToNextL2Output.ts +2 -2
- package/chains/opStack/actions/getTimeToProve.ts +3 -1
- package/chains/opStack/actions/proveWithdrawal.ts +1 -1
- package/chains/opStack/actions/waitForNextL2Output.ts +4 -2
- package/chains/opStack/actions/waitToProve.ts +1 -1
- package/chains/opStack/decorators/publicL2.ts +3 -3
- package/chains/opStack/types/deposit.ts +6 -6
- package/chains/opStack/types/transaction.ts +4 -4
- package/chains/opStack/types/withdrawal.ts +2 -2
- package/chains/zksync/formatters.ts +1 -1
- package/chains/zksync/serializers.ts +1 -1
- package/chains/zksync/types/eip712.ts +4 -4
- package/chains/zksync/types/transaction.ts +21 -21
- package/chains/zksync/utils/assertEip712Request.ts +2 -1
- package/chains/zksync/utils/assertEip712Transaction.ts +2 -1
- package/chains/zksync/utils/isEip712Transaction.ts +2 -1
- package/clients/createClient.ts +3 -3
- package/clients/decorators/public.ts +23 -21
- package/clients/decorators/test.ts +1 -1
- package/clients/transports/createTransport.ts +9 -9
- package/clients/transports/custom.ts +4 -4
- package/clients/transports/fallback.ts +28 -26
- package/clients/transports/http.ts +13 -13
- package/clients/transports/ipc.ts +6 -6
- package/clients/transports/webSocket.ts +6 -6
- package/errors/abi.ts +12 -3
- package/errors/account.ts +1 -1
- package/errors/base.ts +13 -10
- package/errors/block.ts +2 -2
- package/errors/chain.ts +3 -3
- package/errors/contract.ts +26 -15
- package/errors/encoding.ts +3 -3
- package/errors/estimateGas.ts +3 -3
- package/errors/node.ts +35 -14
- package/errors/request.ts +7 -7
- package/errors/rpc.ts +5 -5
- package/errors/transaction.ts +7 -7
- package/errors/version.ts +1 -1
- package/index.ts +2 -0
- package/package.json +1 -1
- package/types/block.ts +3 -3
- package/types/chain.ts +1 -1
- package/types/contract.ts +7 -5
- package/types/eip1193.ts +42 -38
- package/types/ens.ts +1 -1
- package/types/fee.ts +6 -6
- package/types/filter.ts +9 -9
- package/types/kzg.ts +1 -1
- package/types/misc.ts +2 -2
- package/types/rpc.ts +16 -16
- package/types/stateOverride.ts +5 -5
- package/types/transaction.ts +63 -56
- package/types/typedData.ts +1 -1
- package/types/utils.ts +9 -3
- package/types/window.ts +1 -1
- package/utils/abi/decodeEventLog.ts +1 -1
- package/utils/abi/decodeFunctionResult.ts +2 -2
- package/utils/abi/encodeErrorResult.ts +2 -2
- package/utils/abi/encodeEventTopics.ts +2 -2
- package/utils/abi/encodeFunctionData.ts +2 -2
- package/utils/abi/encodeFunctionResult.ts +2 -2
- package/utils/abi/formatAbiItem.ts +2 -2
- package/utils/abi/formatAbiItemWithArgs.ts +2 -2
- package/utils/address/getAddress.ts +4 -1
- package/utils/address/getContractAddress.ts +1 -1
- package/utils/address/isAddress.ts +1 -1
- package/utils/blob/commitmentToVersionedHash.ts +1 -1
- package/utils/blob/commitmentsToVersionedHashes.ts +1 -1
- package/utils/blob/sidecarsToVersionedHashes.ts +1 -1
- package/utils/chain/assertCurrentChain.ts +1 -1
- package/utils/chain/getChainContractAddress.ts +1 -1
- package/utils/cursor.ts +1 -1
- package/utils/data/isHex.ts +1 -1
- package/utils/data/pad.ts +2 -2
- package/utils/data/slice.ts +15 -11
- package/utils/data/trim.ts +1 -1
- package/utils/encoding/fromBytes.ts +5 -5
- package/utils/encoding/fromHex.ts +5 -5
- package/utils/encoding/toBytes.ts +8 -5
- package/utils/encoding/toHex.ts +7 -7
- package/utils/ens/avatar/parseAvatarRecord.ts +2 -2
- package/utils/errors/getCallError.ts +2 -2
- package/utils/errors/getContractError.ts +3 -3
- package/utils/errors/getEstimateGasError.ts +3 -3
- package/utils/errors/getNodeError.ts +4 -1
- package/utils/errors/getTransactionError.ts +2 -2
- package/utils/formatters/block.ts +2 -2
- package/utils/formatters/extract.ts +1 -1
- package/utils/formatters/formatter.ts +1 -1
- package/utils/formatters/log.ts +6 -2
- package/utils/formatters/proof.ts +2 -1
- package/utils/formatters/transaction.ts +2 -2
- package/utils/formatters/transactionReceipt.ts +2 -1
- package/utils/formatters/transactionRequest.ts +4 -1
- package/utils/hash/keccak256.ts +1 -1
- package/utils/hash/ripemd160.ts +1 -1
- package/utils/hash/sha256.ts +1 -1
- package/utils/poll.ts +2 -2
- package/utils/promise/createBatchScheduler.ts +6 -6
- package/utils/promise/withCache.ts +1 -1
- package/utils/promise/withRetry.ts +14 -9
- package/utils/promise/withTimeout.ts +6 -4
- package/utils/rpc/http.ts +7 -7
- package/utils/rpc/socket.ts +2 -2
- package/utils/signature/hashMessage.ts +1 -1
- package/utils/transaction/assertRequest.ts +4 -1
- package/utils/transaction/getTransactionType.ts +10 -4
- package/utils/transaction/parseTransaction.ts +1 -1
- package/utils/transaction/serializeAccessList.ts +1 -1
- package/utils/transaction/serializeTransaction.ts +6 -6
- package/utils/typedData.ts +1 -1
package/utils/data/slice.ts
CHANGED
@@ -27,9 +27,9 @@ export type SliceErrorType =
|
|
27
27
|
*/
|
28
28
|
export function slice<TValue extends ByteArray | Hex>(
|
29
29
|
value: TValue,
|
30
|
-
start?: number,
|
31
|
-
end?: number,
|
32
|
-
{ strict }: { strict?: boolean } = {},
|
30
|
+
start?: number | undefined,
|
31
|
+
end?: number | undefined,
|
32
|
+
{ strict }: { strict?: boolean | undefined } = {},
|
33
33
|
): SliceReturnType<TValue> {
|
34
34
|
if (isHex(value, { strict: false }))
|
35
35
|
return sliceHex(value as Hex, start, end, {
|
@@ -45,7 +45,7 @@ export type AssertStartOffsetErrorType =
|
|
45
45
|
| SizeErrorType
|
46
46
|
| ErrorType
|
47
47
|
|
48
|
-
function assertStartOffset(value: Hex | ByteArray, start?: number) {
|
48
|
+
function assertStartOffset(value: Hex | ByteArray, start?: number | undefined) {
|
49
49
|
if (typeof start === 'number' && start > 0 && start > size(value) - 1)
|
50
50
|
throw new SliceOffsetOutOfBoundsError({
|
51
51
|
offset: start,
|
@@ -59,7 +59,11 @@ export type AssertEndOffsetErrorType =
|
|
59
59
|
| SizeErrorType
|
60
60
|
| ErrorType
|
61
61
|
|
62
|
-
function assertEndOffset(
|
62
|
+
function assertEndOffset(
|
63
|
+
value: Hex | ByteArray,
|
64
|
+
start?: number | undefined,
|
65
|
+
end?: number | undefined,
|
66
|
+
) {
|
63
67
|
if (
|
64
68
|
typeof start === 'number' &&
|
65
69
|
typeof end === 'number' &&
|
@@ -87,9 +91,9 @@ export type SliceBytesErrorType =
|
|
87
91
|
*/
|
88
92
|
export function sliceBytes(
|
89
93
|
value_: ByteArray,
|
90
|
-
start?: number,
|
91
|
-
end?: number,
|
92
|
-
{ strict }: { strict?: boolean } = {},
|
94
|
+
start?: number | undefined,
|
95
|
+
end?: number | undefined,
|
96
|
+
{ strict }: { strict?: boolean | undefined } = {},
|
93
97
|
): ByteArray {
|
94
98
|
assertStartOffset(value_, start)
|
95
99
|
const value = value_.slice(start, end)
|
@@ -111,9 +115,9 @@ export type SliceHexErrorType =
|
|
111
115
|
*/
|
112
116
|
export function sliceHex(
|
113
117
|
value_: Hex,
|
114
|
-
start?: number,
|
115
|
-
end?: number,
|
116
|
-
{ strict }: { strict?: boolean } = {},
|
118
|
+
start?: number | undefined,
|
119
|
+
end?: number | undefined,
|
120
|
+
{ strict }: { strict?: boolean | undefined } = {},
|
117
121
|
): Hex {
|
118
122
|
assertStartOffset(value_, start)
|
119
123
|
const value = `0x${value_
|
package/utils/data/trim.ts
CHANGED
@@ -2,7 +2,7 @@ import type { ErrorType } from '../../errors/utils.js'
|
|
2
2
|
import type { ByteArray, Hex } from '../../types/misc.js'
|
3
3
|
|
4
4
|
type TrimOptions = {
|
5
|
-
dir?: 'left' | 'right'
|
5
|
+
dir?: 'left' | 'right' | undefined
|
6
6
|
}
|
7
7
|
export type TrimReturnType<TValue extends ByteArray | Hex> = TValue extends Hex
|
8
8
|
? Hex
|
@@ -19,7 +19,7 @@ export type FromBytesParameters<
|
|
19
19
|
| TTo
|
20
20
|
| {
|
21
21
|
/** Size of the bytes. */
|
22
|
-
size?: number
|
22
|
+
size?: number | undefined
|
23
23
|
/** Type to convert to. */
|
24
24
|
to: TTo
|
25
25
|
}
|
@@ -89,9 +89,9 @@ export function fromBytes<
|
|
89
89
|
|
90
90
|
export type BytesToBigIntOpts = {
|
91
91
|
/** Whether or not the number of a signed representation. */
|
92
|
-
signed?: boolean
|
92
|
+
signed?: boolean | undefined
|
93
93
|
/** Size of the bytes. */
|
94
|
-
size?: number
|
94
|
+
size?: number | undefined
|
95
95
|
}
|
96
96
|
|
97
97
|
export type BytesToBigIntErrorType =
|
@@ -124,7 +124,7 @@ export function bytesToBigInt(
|
|
124
124
|
|
125
125
|
export type BytesToBoolOpts = {
|
126
126
|
/** Size of the bytes. */
|
127
|
-
size?: number
|
127
|
+
size?: number | undefined
|
128
128
|
}
|
129
129
|
|
130
130
|
export type BytesToBoolErrorType =
|
@@ -192,7 +192,7 @@ export function bytesToNumber(
|
|
192
192
|
|
193
193
|
export type BytesToStringOpts = {
|
194
194
|
/** Size of the bytes. */
|
195
|
-
size?: number
|
195
|
+
size?: number | undefined
|
196
196
|
}
|
197
197
|
|
198
198
|
export type BytesToStringErrorType =
|
@@ -33,7 +33,7 @@ export type FromHexParameters<
|
|
33
33
|
| TTo
|
34
34
|
| {
|
35
35
|
/** Size (in bytes) of the hex value. */
|
36
|
-
size?: number
|
36
|
+
size?: number | undefined
|
37
37
|
/** Type to convert to. */
|
38
38
|
to: TTo
|
39
39
|
}
|
@@ -101,9 +101,9 @@ export function fromHex<
|
|
101
101
|
|
102
102
|
export type HexToBigIntOpts = {
|
103
103
|
/** Whether or not the number of a signed representation. */
|
104
|
-
signed?: boolean
|
104
|
+
signed?: boolean | undefined
|
105
105
|
/** Size (in bytes) of the hex value. */
|
106
|
-
size?: number
|
106
|
+
size?: number | undefined
|
107
107
|
}
|
108
108
|
|
109
109
|
export type HexToBigIntErrorType = AssertSizeErrorType | ErrorType
|
@@ -144,7 +144,7 @@ export function hexToBigInt(hex: Hex, opts: HexToBigIntOpts = {}): bigint {
|
|
144
144
|
|
145
145
|
export type HexToBoolOpts = {
|
146
146
|
/** Size (in bytes) of the hex value. */
|
147
|
-
size?: number
|
147
|
+
size?: number | undefined
|
148
148
|
}
|
149
149
|
|
150
150
|
export type HexToBoolErrorType =
|
@@ -212,7 +212,7 @@ export function hexToNumber(hex: Hex, opts: HexToNumberOpts = {}): number {
|
|
212
212
|
|
213
213
|
export type HexToStringOpts = {
|
214
214
|
/** Size (in bytes) of the hex value. */
|
215
|
-
size?: number
|
215
|
+
size?: number | undefined
|
216
216
|
}
|
217
217
|
|
218
218
|
export type HexToStringErrorType =
|
@@ -15,7 +15,7 @@ const encoder = /*#__PURE__*/ new TextEncoder()
|
|
15
15
|
|
16
16
|
export type ToBytesParameters = {
|
17
17
|
/** Size of the output bytes. */
|
18
|
-
size?: number
|
18
|
+
size?: number | undefined
|
19
19
|
}
|
20
20
|
|
21
21
|
export type ToBytesErrorType =
|
@@ -64,7 +64,7 @@ export function toBytes(
|
|
64
64
|
|
65
65
|
export type BoolToBytesOpts = {
|
66
66
|
/** Size of the output bytes. */
|
67
|
-
size?: number
|
67
|
+
size?: number | undefined
|
68
68
|
}
|
69
69
|
|
70
70
|
export type BoolToBytesErrorType =
|
@@ -123,7 +123,7 @@ function charCodeToBase16(char: number) {
|
|
123
123
|
|
124
124
|
export type HexToBytesOpts = {
|
125
125
|
/** Size of the output bytes. */
|
126
|
-
size?: number
|
126
|
+
size?: number | undefined
|
127
127
|
}
|
128
128
|
|
129
129
|
export type HexToBytesErrorType = AssertSizeErrorType | PadErrorType | ErrorType
|
@@ -198,14 +198,17 @@ export type NumberToBytesErrorType =
|
|
198
198
|
* const data = numberToBytes(420, { size: 4 })
|
199
199
|
* // Uint8Array([0, 0, 1, 164])
|
200
200
|
*/
|
201
|
-
export function numberToBytes(
|
201
|
+
export function numberToBytes(
|
202
|
+
value: bigint | number,
|
203
|
+
opts?: NumberToHexOpts | undefined,
|
204
|
+
) {
|
202
205
|
const hex = numberToHex(value, opts)
|
203
206
|
return hexToBytes(hex)
|
204
207
|
}
|
205
208
|
|
206
209
|
export type StringToBytesOpts = {
|
207
210
|
/** Size of the output bytes. */
|
208
|
-
size?: number
|
211
|
+
size?: number | undefined
|
209
212
|
}
|
210
213
|
|
211
214
|
export type StringToBytesErrorType =
|
package/utils/encoding/toHex.ts
CHANGED
@@ -14,7 +14,7 @@ const hexes = /*#__PURE__*/ Array.from({ length: 256 }, (_v, i) =>
|
|
14
14
|
|
15
15
|
export type ToHexParameters = {
|
16
16
|
/** The size (in bytes) of the output hex value. */
|
17
|
-
size?: number
|
17
|
+
size?: number | undefined
|
18
18
|
}
|
19
19
|
|
20
20
|
export type ToHexErrorType =
|
@@ -64,7 +64,7 @@ export function toHex(
|
|
64
64
|
|
65
65
|
export type BoolToHexOpts = {
|
66
66
|
/** The size (in bytes) of the output hex value. */
|
67
|
-
size?: number
|
67
|
+
size?: number | undefined
|
68
68
|
}
|
69
69
|
|
70
70
|
export type BoolToHexErrorType = AssertSizeErrorType | PadErrorType | ErrorType
|
@@ -104,7 +104,7 @@ export function boolToHex(value: boolean, opts: BoolToHexOpts = {}): Hex {
|
|
104
104
|
|
105
105
|
export type BytesToHexOpts = {
|
106
106
|
/** The size (in bytes) of the output hex value. */
|
107
|
-
size?: number
|
107
|
+
size?: number | undefined
|
108
108
|
}
|
109
109
|
|
110
110
|
export type BytesToHexErrorType = AssertSizeErrorType | PadErrorType | ErrorType
|
@@ -145,14 +145,14 @@ export function bytesToHex(value: ByteArray, opts: BytesToHexOpts = {}): Hex {
|
|
145
145
|
export type NumberToHexOpts =
|
146
146
|
| {
|
147
147
|
/** Whether or not the number of a signed representation. */
|
148
|
-
signed?: boolean
|
148
|
+
signed?: boolean | undefined
|
149
149
|
/** The size (in bytes) of the output hex value. */
|
150
150
|
size: number
|
151
151
|
}
|
152
152
|
| {
|
153
|
-
signed?: never
|
153
|
+
signed?: never | undefined
|
154
154
|
/** The size (in bytes) of the output hex value. */
|
155
|
-
size?: number
|
155
|
+
size?: number | undefined
|
156
156
|
}
|
157
157
|
|
158
158
|
export type NumberToHexErrorType =
|
@@ -218,7 +218,7 @@ export function numberToHex(
|
|
218
218
|
|
219
219
|
export type StringToHexOpts = {
|
220
220
|
/** The size (in bytes) of the output hex value. */
|
221
|
-
size?: number
|
221
|
+
size?: number | undefined
|
222
222
|
}
|
223
223
|
|
224
224
|
export type StringToHexErrorType = BytesToHexErrorType | ErrorType
|
@@ -30,7 +30,7 @@ export async function parseAvatarRecord<TChain extends Chain | undefined>(
|
|
30
30
|
gatewayUrls,
|
31
31
|
record,
|
32
32
|
}: {
|
33
|
-
gatewayUrls?: AssetGatewayUrls
|
33
|
+
gatewayUrls?: AssetGatewayUrls | undefined
|
34
34
|
record: string
|
35
35
|
},
|
36
36
|
): Promise<string> {
|
@@ -54,7 +54,7 @@ async function parseNftAvatarUri<TChain extends Chain | undefined>(
|
|
54
54
|
gatewayUrls,
|
55
55
|
record,
|
56
56
|
}: {
|
57
|
-
gatewayUrls?: AssetGatewayUrls
|
57
|
+
gatewayUrls?: AssetGatewayUrls | undefined
|
58
58
|
record: string
|
59
59
|
},
|
60
60
|
): Promise<string> {
|
@@ -27,8 +27,8 @@ export function getCallError<err extends ErrorType<string>>(
|
|
27
27
|
docsPath,
|
28
28
|
...args
|
29
29
|
}: CallParameters & {
|
30
|
-
chain?: Chain
|
31
|
-
docsPath?: string
|
30
|
+
chain?: Chain | undefined
|
31
|
+
docsPath?: string | undefined
|
32
32
|
},
|
33
33
|
): GetCallErrorReturnType<err> {
|
34
34
|
const cause = (() => {
|
@@ -38,10 +38,10 @@ export function getContractError<err extends ErrorType<string>>(
|
|
38
38
|
}: {
|
39
39
|
abi: Abi
|
40
40
|
args: any
|
41
|
-
address?: Address
|
42
|
-
docsPath?: string
|
41
|
+
address?: Address | undefined
|
42
|
+
docsPath?: string | undefined
|
43
43
|
functionName: string
|
44
|
-
sender?: Address
|
44
|
+
sender?: Address | undefined
|
45
45
|
},
|
46
46
|
): GetContractErrorReturnType {
|
47
47
|
const { code, data, message, shortMessage } = (
|
@@ -26,9 +26,9 @@ export function getEstimateGasError<err extends ErrorType<string>>(
|
|
26
26
|
docsPath,
|
27
27
|
...args
|
28
28
|
}: Omit<EstimateGasParameters, 'account'> & {
|
29
|
-
account?: Account
|
30
|
-
chain?: Chain
|
31
|
-
docsPath?: string
|
29
|
+
account?: Account | undefined
|
30
|
+
chain?: Chain | undefined
|
31
|
+
docsPath?: string | undefined
|
32
32
|
},
|
33
33
|
): GetEstimateGasErrorReturnType<err> {
|
34
34
|
const cause = (() => {
|
@@ -31,6 +31,7 @@ import {
|
|
31
31
|
InvalidInputRpcError,
|
32
32
|
TransactionRejectedRpcError,
|
33
33
|
} from '../../errors/rpc.js'
|
34
|
+
import type { ExactPartial } from '../../types/utils.js'
|
34
35
|
|
35
36
|
export function containsNodeError(err: BaseError) {
|
36
37
|
return (
|
@@ -40,7 +41,9 @@ export function containsNodeError(err: BaseError) {
|
|
40
41
|
)
|
41
42
|
}
|
42
43
|
|
43
|
-
export type GetNodeErrorParameters =
|
44
|
+
export type GetNodeErrorParameters = ExactPartial<
|
45
|
+
SendTransactionParameters<any>
|
46
|
+
>
|
44
47
|
|
45
48
|
export type GetNodeErrorReturnType =
|
46
49
|
| ExecutionRevertedErrorType
|
@@ -20,8 +20,8 @@ export type GetTransactionErrorParameters = Omit<
|
|
20
20
|
'account' | 'chain'
|
21
21
|
> & {
|
22
22
|
account: Account
|
23
|
-
chain?: Chain
|
24
|
-
docsPath?: string
|
23
|
+
chain?: Chain | undefined
|
24
|
+
docsPath?: string | undefined
|
25
25
|
}
|
26
26
|
|
27
27
|
export type GetTransactionErrorReturnType<cause = ErrorType> = Omit<
|
@@ -7,7 +7,7 @@ import type {
|
|
7
7
|
} from '../../types/chain.js'
|
8
8
|
import type { Hash } from '../../types/misc.js'
|
9
9
|
import type { RpcBlock } from '../../types/rpc.js'
|
10
|
-
import type { Prettify } from '../../types/utils.js'
|
10
|
+
import type { ExactPartial, Prettify } from '../../types/utils.js'
|
11
11
|
|
12
12
|
import { type DefineFormatterErrorType, defineFormatter } from './formatter.js'
|
13
13
|
import { type FormattedTransaction, formatTransaction } from './transaction.js'
|
@@ -40,7 +40,7 @@ export type FormattedBlock<
|
|
40
40
|
|
41
41
|
export type FormatBlockErrorType = ErrorType
|
42
42
|
|
43
|
-
export function formatBlock(block:
|
43
|
+
export function formatBlock(block: ExactPartial<RpcBlock>) {
|
44
44
|
const transactions = block.transactions?.map((transaction) => {
|
45
45
|
if (typeof transaction === 'string') return transaction
|
46
46
|
return formatTransaction(transaction)
|
@@ -8,7 +8,7 @@ export type ExtractErrorType = ErrorType
|
|
8
8
|
*/
|
9
9
|
export function extract(
|
10
10
|
value_: Record<string, unknown>,
|
11
|
-
{ format }: { format?: ChainFormatter['format'] },
|
11
|
+
{ format }: { format?: ChainFormatter['format'] | undefined },
|
12
12
|
) {
|
13
13
|
if (!format) return {}
|
14
14
|
|
@@ -15,7 +15,7 @@ export function defineFormatter<TType extends string, TParameters, TReturnType>(
|
|
15
15
|
exclude,
|
16
16
|
format: overrides,
|
17
17
|
}: {
|
18
|
-
exclude?: TExclude
|
18
|
+
exclude?: TExclude | undefined
|
19
19
|
format: (_: TOverrideParameters) => TOverrideReturnType
|
20
20
|
}) => {
|
21
21
|
return {
|
package/utils/formatters/log.ts
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
import type { ErrorType } from '../../errors/utils.js'
|
2
2
|
import type { Log } from '../../types/log.js'
|
3
3
|
import type { RpcLog } from '../../types/rpc.js'
|
4
|
+
import type { ExactPartial } from '../../types/utils.js'
|
4
5
|
|
5
6
|
export type FormatLogErrorType = ErrorType
|
6
7
|
|
7
8
|
export function formatLog(
|
8
|
-
log:
|
9
|
-
{
|
9
|
+
log: ExactPartial<RpcLog>,
|
10
|
+
{
|
11
|
+
args,
|
12
|
+
eventName,
|
13
|
+
}: { args?: unknown | undefined; eventName?: string | undefined } = {},
|
10
14
|
) {
|
11
15
|
return {
|
12
16
|
...log,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { ErrorType } from '../../errors/utils.js'
|
2
2
|
import type { Proof } from '../../types/proof.js'
|
3
3
|
import type { RpcProof } from '../../types/rpc.js'
|
4
|
+
import type { ExactPartial } from '../../types/utils.js'
|
4
5
|
import { hexToNumber } from '../index.js'
|
5
6
|
|
6
7
|
export type FormatProofErrorType = ErrorType
|
@@ -12,7 +13,7 @@ function formatStorageProof(storageProof: RpcProof['storageProof']) {
|
|
12
13
|
}))
|
13
14
|
}
|
14
15
|
|
15
|
-
export function formatProof(proof:
|
16
|
+
export function formatProof(proof: ExactPartial<RpcProof>) {
|
16
17
|
return {
|
17
18
|
...proof,
|
18
19
|
balance: proof.balance ? BigInt(proof.balance) : undefined,
|
@@ -8,7 +8,7 @@ import type {
|
|
8
8
|
import type { Hex } from '../../types/misc.js'
|
9
9
|
import type { RpcTransaction } from '../../types/rpc.js'
|
10
10
|
import type { Transaction, TransactionType } from '../../types/transaction.js'
|
11
|
-
import type { UnionLooseOmit } from '../../types/utils.js'
|
11
|
+
import type { ExactPartial, UnionLooseOmit } from '../../types/utils.js'
|
12
12
|
import { hexToNumber } from '../encoding/fromHex.js'
|
13
13
|
import { type DefineFormatterErrorType, defineFormatter } from './formatter.js'
|
14
14
|
|
@@ -43,7 +43,7 @@ export const transactionType = {
|
|
43
43
|
|
44
44
|
export type FormatTransactionErrorType = ErrorType
|
45
45
|
|
46
|
-
export function formatTransaction(transaction:
|
46
|
+
export function formatTransaction(transaction: ExactPartial<RpcTransaction>) {
|
47
47
|
const transaction_ = {
|
48
48
|
...transaction,
|
49
49
|
blockHash: transaction.blockHash ? transaction.blockHash : null,
|
@@ -5,6 +5,7 @@ import type {
|
|
5
5
|
} from '../../types/chain.js'
|
6
6
|
import type { RpcTransactionReceipt } from '../../types/rpc.js'
|
7
7
|
import type { TransactionReceipt } from '../../types/transaction.js'
|
8
|
+
import type { ExactPartial } from '../../types/utils.js'
|
8
9
|
import { hexToNumber } from '../encoding/fromHex.js'
|
9
10
|
|
10
11
|
import { type DefineFormatterErrorType, defineFormatter } from './formatter.js'
|
@@ -27,7 +28,7 @@ const statuses = {
|
|
27
28
|
export type FormatTransactionReceiptErrorType = ErrorType
|
28
29
|
|
29
30
|
export function formatTransactionReceipt(
|
30
|
-
transactionReceipt:
|
31
|
+
transactionReceipt: ExactPartial<RpcTransactionReceipt>,
|
31
32
|
) {
|
32
33
|
const receipt = {
|
33
34
|
...transactionReceipt,
|
@@ -6,6 +6,7 @@ import type {
|
|
6
6
|
import type { ByteArray } from '../../types/misc.js'
|
7
7
|
import type { RpcTransactionRequest } from '../../types/rpc.js'
|
8
8
|
import type { TransactionRequest } from '../../types/transaction.js'
|
9
|
+
import type { ExactPartial } from '../../types/utils.js'
|
9
10
|
import { bytesToHex, numberToHex } from '../encoding/toHex.js'
|
10
11
|
import { type DefineFormatterErrorType, defineFormatter } from './formatter.js'
|
11
12
|
|
@@ -26,7 +27,9 @@ export const rpcTransactionType = {
|
|
26
27
|
|
27
28
|
export type FormatTransactionRequestErrorType = ErrorType
|
28
29
|
|
29
|
-
export function formatTransactionRequest(
|
30
|
+
export function formatTransactionRequest(
|
31
|
+
request: ExactPartial<TransactionRequest>,
|
32
|
+
) {
|
30
33
|
const rpcRequest = { ...request } as RpcTransactionRequest
|
31
34
|
|
32
35
|
if (
|
package/utils/hash/keccak256.ts
CHANGED
package/utils/hash/ripemd160.ts
CHANGED
package/utils/hash/sha256.ts
CHANGED
package/utils/poll.ts
CHANGED
@@ -3,9 +3,9 @@ import { wait } from './wait.js'
|
|
3
3
|
|
4
4
|
type PollOptions<TData> = {
|
5
5
|
// Whether or not to emit when the polling starts.
|
6
|
-
emitOnBegin?: boolean
|
6
|
+
emitOnBegin?: boolean | undefined
|
7
7
|
// The initial wait time (in ms) before polling.
|
8
|
-
initialWaitTime?: (data: TData | void) => Promise<number>
|
8
|
+
initialWaitTime?: ((data: TData | void) => Promise<number>) | undefined
|
9
9
|
// The interval (in ms).
|
10
10
|
interval: number
|
11
11
|
}
|
@@ -6,8 +6,8 @@ type Resolved<TReturnType extends readonly unknown[] = any> = [
|
|
6
6
|
]
|
7
7
|
|
8
8
|
type PendingPromise<TReturnType extends readonly unknown[] = any> = {
|
9
|
-
resolve?: (data: Resolved<TReturnType>) => void
|
10
|
-
reject?: (reason?: unknown) => void
|
9
|
+
resolve?: ((data: Resolved<TReturnType>) => void) | undefined
|
10
|
+
reject?: ((reason?: unknown) => void) | undefined
|
11
11
|
}
|
12
12
|
|
13
13
|
type SchedulerItem = { args: unknown; pendingPromise: PendingPromise }
|
@@ -23,9 +23,9 @@ export type CreateBatchSchedulerArguments<
|
|
23
23
|
> = {
|
24
24
|
fn: (args: TParameters[]) => Promise<TReturnType>
|
25
25
|
id: number | string
|
26
|
-
shouldSplitBatch?: (args: TParameters[]) => boolean
|
27
|
-
wait?: number
|
28
|
-
sort?: BatchResultsCompareFn<TReturnType[number]>
|
26
|
+
shouldSplitBatch?: ((args: TParameters[]) => boolean) | undefined
|
27
|
+
wait?: number | undefined
|
28
|
+
sort?: BatchResultsCompareFn<TReturnType[number]> | undefined
|
29
29
|
}
|
30
30
|
|
31
31
|
export type CreateBatchSchedulerReturnType<
|
@@ -34,7 +34,7 @@ export type CreateBatchSchedulerReturnType<
|
|
34
34
|
> = {
|
35
35
|
flush: () => void
|
36
36
|
schedule: TParameters extends undefined
|
37
|
-
? (args?: TParameters) => Promise<Resolved<TReturnType>>
|
37
|
+
? (args?: TParameters | undefined) => Promise<Resolved<TReturnType>>
|
38
38
|
: (args: TParameters) => Promise<Resolved<TReturnType>>
|
39
39
|
}
|
40
40
|
|
@@ -32,7 +32,7 @@ export type WithCacheParameters = {
|
|
32
32
|
/** The key to cache the data against. */
|
33
33
|
cacheKey: string
|
34
34
|
/** The time that cached data will remain in memory. Default: Infinity (no expiry) */
|
35
|
-
cacheTime?: number
|
35
|
+
cacheTime?: number | undefined
|
36
36
|
}
|
37
37
|
|
38
38
|
/**
|
@@ -3,17 +3,22 @@ import { wait } from '../wait.js'
|
|
3
3
|
|
4
4
|
export type WithRetryParameters = {
|
5
5
|
// The delay (in ms) between retries.
|
6
|
-
delay?:
|
6
|
+
delay?:
|
7
|
+
| ((config: { count: number; error: Error }) => number)
|
8
|
+
| number
|
9
|
+
| undefined
|
7
10
|
// The max number of times to retry.
|
8
|
-
retryCount?: number
|
11
|
+
retryCount?: number | undefined
|
9
12
|
// Whether or not to retry when an error is thrown.
|
10
|
-
shouldRetry?:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
shouldRetry?:
|
14
|
+
| (({
|
15
|
+
count,
|
16
|
+
error,
|
17
|
+
}: {
|
18
|
+
count: number
|
19
|
+
error: Error
|
20
|
+
}) => Promise<boolean> | boolean)
|
21
|
+
| undefined
|
17
22
|
}
|
18
23
|
|
19
24
|
export type WithRetryErrorType = ErrorType
|
@@ -3,18 +3,20 @@ import type { ErrorType } from '../../errors/utils.js'
|
|
3
3
|
export type WithTimeoutErrorType = ErrorType
|
4
4
|
|
5
5
|
export function withTimeout<TData>(
|
6
|
-
fn: ({
|
6
|
+
fn: ({
|
7
|
+
signal,
|
8
|
+
}: { signal: AbortController['signal'] | null }) => Promise<TData>,
|
7
9
|
{
|
8
10
|
errorInstance = new Error('timed out'),
|
9
11
|
timeout,
|
10
12
|
signal,
|
11
13
|
}: {
|
12
14
|
// The error instance to throw when the timeout is reached.
|
13
|
-
errorInstance?: Error
|
15
|
+
errorInstance?: Error | undefined
|
14
16
|
// The timeout (in ms).
|
15
17
|
timeout: number
|
16
18
|
// Whether or not the timeout should use an abort signal.
|
17
|
-
signal?: boolean
|
19
|
+
signal?: boolean | undefined
|
18
20
|
},
|
19
21
|
): Promise<TData> {
|
20
22
|
return new Promise((resolve, reject) => {
|
@@ -31,7 +33,7 @@ export function withTimeout<TData>(
|
|
31
33
|
}
|
32
34
|
}, timeout)
|
33
35
|
}
|
34
|
-
resolve(await fn({ signal: controller?.signal }))
|
36
|
+
resolve(await fn({ signal: controller?.signal || null }))
|
35
37
|
} catch (err) {
|
36
38
|
if ((err as Error).name === 'AbortError') reject(errorInstance)
|
37
39
|
reject(err)
|
package/utils/rpc/http.ts
CHANGED
@@ -15,11 +15,11 @@ import { idCache } from './id.js'
|
|
15
15
|
|
16
16
|
export type HttpRpcClientOptions = {
|
17
17
|
// Request configuration to pass to `fetch`.
|
18
|
-
fetchOptions?: Omit<RequestInit, 'body'>
|
18
|
+
fetchOptions?: Omit<RequestInit, 'body'> | undefined
|
19
19
|
// A callback to handle the response.
|
20
|
-
onResponse?: (response: Response) => Promise<void> | void
|
20
|
+
onResponse?: ((response: Response) => Promise<void> | void) | undefined
|
21
21
|
// The timeout (in ms) for the request.
|
22
|
-
timeout?: number
|
22
|
+
timeout?: number | undefined
|
23
23
|
}
|
24
24
|
|
25
25
|
export type HttpRequestParameters<
|
@@ -28,11 +28,11 @@ export type HttpRequestParameters<
|
|
28
28
|
// The RPC request body.
|
29
29
|
body: TBody
|
30
30
|
// Request configuration to pass to `fetch`.
|
31
|
-
fetchOptions?: HttpRpcClientOptions['fetchOptions']
|
31
|
+
fetchOptions?: HttpRpcClientOptions['fetchOptions'] | undefined
|
32
32
|
// A callback to handle the response.
|
33
|
-
onResponse?: (response: Response) => Promise<void> | void
|
33
|
+
onResponse?: ((response: Response) => Promise<void> | void) | undefined
|
34
34
|
// The timeout (in ms) for the request.
|
35
|
-
timeout?: HttpRpcClientOptions['timeout']
|
35
|
+
timeout?: HttpRpcClientOptions['timeout'] | undefined
|
36
36
|
}
|
37
37
|
|
38
38
|
export type HttpRequestReturnType<
|
@@ -92,7 +92,7 @@ export function getHttpRpcClient(
|
|
92
92
|
'Content-Type': 'application/json',
|
93
93
|
},
|
94
94
|
method: method || 'POST',
|
95
|
-
signal: signal_ || (timeout > 0 ? signal :
|
95
|
+
signal: signal_ || (timeout > 0 ? signal : null),
|
96
96
|
})
|
97
97
|
return response
|
98
98
|
},
|