viem 2.0.0-beta.4 → 2.0.0-beta.5
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 +22 -0
- package/_cjs/accounts/generateMnemonic.js +9 -0
- package/_cjs/accounts/generateMnemonic.js.map +1 -0
- package/_cjs/accounts/generatePrivateKey.js +10 -0
- package/_cjs/accounts/generatePrivateKey.js.map +1 -0
- package/_cjs/accounts/hdKeyToAccount.js +16 -0
- package/_cjs/accounts/hdKeyToAccount.js.map +1 -0
- package/_cjs/accounts/index.js +52 -0
- package/_cjs/accounts/index.js.map +1 -0
- package/_cjs/accounts/mnemonicToAccount.js +12 -0
- package/_cjs/accounts/mnemonicToAccount.js.map +1 -0
- package/_cjs/accounts/privateKeyToAccount.js +33 -0
- package/_cjs/accounts/privateKeyToAccount.js.map +1 -0
- package/_cjs/accounts/toAccount.js +27 -0
- package/_cjs/accounts/toAccount.js.map +1 -0
- package/_cjs/accounts/types.js +3 -0
- package/_cjs/accounts/types.js.map +1 -0
- package/_cjs/accounts/utils/parseAccount.js +10 -0
- package/_cjs/accounts/utils/parseAccount.js.map +1 -0
- package/_cjs/accounts/utils/privateKeyToAddress.js +12 -0
- package/_cjs/accounts/utils/privateKeyToAddress.js.map +1 -0
- package/_cjs/accounts/utils/publicKeyToAddress.js +11 -0
- package/_cjs/accounts/utils/publicKeyToAddress.js.map +1 -0
- package/_cjs/accounts/utils/sign.js +15 -0
- package/_cjs/accounts/utils/sign.js.map +1 -0
- package/_cjs/accounts/utils/signMessage.js +12 -0
- package/_cjs/accounts/utils/signMessage.js.map +1 -0
- package/_cjs/accounts/utils/signTransaction.js +15 -0
- package/_cjs/accounts/utils/signTransaction.js.map +1 -0
- package/_cjs/accounts/utils/signTypedData.js +16 -0
- package/_cjs/accounts/utils/signTypedData.js.map +1 -0
- package/_cjs/actions/ens/getEnsAddress.js +63 -0
- package/_cjs/actions/ens/getEnsAddress.js.map +1 -0
- package/_cjs/actions/ens/getEnsAvatar.js +25 -0
- package/_cjs/actions/ens/getEnsAvatar.js.map +1 -0
- package/_cjs/actions/ens/getEnsName.js +41 -0
- package/_cjs/actions/ens/getEnsName.js.map +1 -0
- package/_cjs/actions/ens/getEnsResolver.js +39 -0
- package/_cjs/actions/ens/getEnsResolver.js.map +1 -0
- package/_cjs/actions/ens/getEnsText.js +57 -0
- package/_cjs/actions/ens/getEnsText.js.map +1 -0
- package/_cjs/actions/getContract.js +184 -0
- package/_cjs/actions/getContract.js.map +1 -0
- package/_cjs/actions/index.js +167 -0
- package/_cjs/actions/index.js.map +1 -0
- package/_cjs/actions/public/call.js +156 -0
- package/_cjs/actions/public/call.js.map +1 -0
- package/_cjs/actions/public/createBlockFilter.js +15 -0
- package/_cjs/actions/public/createBlockFilter.js.map +1 -0
- package/_cjs/actions/public/createContractEventFilter.js +41 -0
- package/_cjs/actions/public/createContractEventFilter.js.map +1 -0
- package/_cjs/actions/public/createEventFilter.js +48 -0
- package/_cjs/actions/public/createEventFilter.js.map +1 -0
- package/_cjs/actions/public/createPendingTransactionFilter.js +15 -0
- package/_cjs/actions/public/createPendingTransactionFilter.js.map +1 -0
- package/_cjs/actions/public/estimateContractGas.js +37 -0
- package/_cjs/actions/public/estimateContractGas.js.map +1 -0
- package/_cjs/actions/public/estimateFeesPerGas.js +62 -0
- package/_cjs/actions/public/estimateFeesPerGas.js.map +1 -0
- package/_cjs/actions/public/estimateGas.js +56 -0
- package/_cjs/actions/public/estimateGas.js.map +1 -0
- package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js +45 -0
- package/_cjs/actions/public/estimateMaxPriorityFeePerGas.js.map +1 -0
- package/_cjs/actions/public/getBalance.js +14 -0
- package/_cjs/actions/public/getBalance.js.map +1 -0
- package/_cjs/actions/public/getBlock.js +30 -0
- package/_cjs/actions/public/getBlock.js.map +1 -0
- package/_cjs/actions/public/getBlockNumber.js +17 -0
- package/_cjs/actions/public/getBlockNumber.js.map +1 -0
- package/_cjs/actions/public/getBlockTransactionCount.js +24 -0
- package/_cjs/actions/public/getBlockTransactionCount.js.map +1 -0
- package/_cjs/actions/public/getBytecode.js +16 -0
- package/_cjs/actions/public/getBytecode.js.map +1 -0
- package/_cjs/actions/public/getChainId.js +12 -0
- package/_cjs/actions/public/getChainId.js.map +1 -0
- package/_cjs/actions/public/getContractEvents.js +27 -0
- package/_cjs/actions/public/getContractEvents.js.map +1 -0
- package/_cjs/actions/public/getFeeHistory.js +19 -0
- package/_cjs/actions/public/getFeeHistory.js.map +1 -0
- package/_cjs/actions/public/getFilterChanges.js +44 -0
- package/_cjs/actions/public/getFilterChanges.js.map +1 -0
- package/_cjs/actions/public/getFilterLogs.js +42 -0
- package/_cjs/actions/public/getFilterLogs.js.map +1 -0
- package/_cjs/actions/public/getGasPrice.js +11 -0
- package/_cjs/actions/public/getGasPrice.js.map +1 -0
- package/_cjs/actions/public/getLogs.js +73 -0
- package/_cjs/actions/public/getLogs.js.map +1 -0
- package/_cjs/actions/public/getProof.js +16 -0
- package/_cjs/actions/public/getProof.js.map +1 -0
- package/_cjs/actions/public/getStorageAt.js +14 -0
- package/_cjs/actions/public/getStorageAt.js.map +1 -0
- package/_cjs/actions/public/getTransaction.js +41 -0
- package/_cjs/actions/public/getTransaction.js.map +1 -0
- package/_cjs/actions/public/getTransactionConfirmations.js +18 -0
- package/_cjs/actions/public/getTransactionConfirmations.js.map +1 -0
- package/_cjs/actions/public/getTransactionCount.js +14 -0
- package/_cjs/actions/public/getTransactionCount.js.map +1 -0
- package/_cjs/actions/public/getTransactionReceipt.js +18 -0
- package/_cjs/actions/public/getTransactionReceipt.js.map +1 -0
- package/_cjs/actions/public/multicall.js +135 -0
- package/_cjs/actions/public/multicall.js.map +1 -0
- package/_cjs/actions/public/readContract.js +40 -0
- package/_cjs/actions/public/readContract.js.map +1 -0
- package/_cjs/actions/public/simulateContract.js +56 -0
- package/_cjs/actions/public/simulateContract.js.map +1 -0
- package/_cjs/actions/public/uninstallFilter.js +11 -0
- package/_cjs/actions/public/uninstallFilter.js.map +1 -0
- package/_cjs/actions/public/verifyHash.js +32 -0
- package/_cjs/actions/public/verifyHash.js.map +1 -0
- package/_cjs/actions/public/verifyMessage.js +16 -0
- package/_cjs/actions/public/verifyMessage.js.map +1 -0
- package/_cjs/actions/public/verifyTypedData.js +16 -0
- package/_cjs/actions/public/verifyTypedData.js.map +1 -0
- package/_cjs/actions/public/waitForTransactionReceipt.js +119 -0
- package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -0
- package/_cjs/actions/public/watchBlockNumber.js +78 -0
- package/_cjs/actions/public/watchBlockNumber.js.map +1 -0
- package/_cjs/actions/public/watchBlocks.js +90 -0
- package/_cjs/actions/public/watchBlocks.js.map +1 -0
- package/_cjs/actions/public/watchContractEvent.js +162 -0
- package/_cjs/actions/public/watchContractEvent.js.map +1 -0
- package/_cjs/actions/public/watchEvent.js +161 -0
- package/_cjs/actions/public/watchEvent.js.map +1 -0
- package/_cjs/actions/public/watchPendingTransactions.js +88 -0
- package/_cjs/actions/public/watchPendingTransactions.js.map +1 -0
- package/_cjs/actions/test/dropTransaction.js +11 -0
- package/_cjs/actions/test/dropTransaction.js.map +1 -0
- package/_cjs/actions/test/dumpState.js +10 -0
- package/_cjs/actions/test/dumpState.js.map +1 -0
- package/_cjs/actions/test/getAutomine.js +14 -0
- package/_cjs/actions/test/getAutomine.js.map +1 -0
- package/_cjs/actions/test/getTxpoolContent.js +10 -0
- package/_cjs/actions/test/getTxpoolContent.js.map +1 -0
- package/_cjs/actions/test/getTxpoolStatus.js +15 -0
- package/_cjs/actions/test/getTxpoolStatus.js.map +1 -0
- package/_cjs/actions/test/impersonateAccount.js +11 -0
- package/_cjs/actions/test/impersonateAccount.js.map +1 -0
- package/_cjs/actions/test/increaseTime.js +12 -0
- package/_cjs/actions/test/increaseTime.js.map +1 -0
- package/_cjs/actions/test/inspectTxpool.js +10 -0
- package/_cjs/actions/test/inspectTxpool.js.map +1 -0
- package/_cjs/actions/test/loadState.js +11 -0
- package/_cjs/actions/test/loadState.js.map +1 -0
- package/_cjs/actions/test/mine.js +18 -0
- package/_cjs/actions/test/mine.js.map +1 -0
- package/_cjs/actions/test/removeBlockTimestampInterval.js +10 -0
- package/_cjs/actions/test/removeBlockTimestampInterval.js.map +1 -0
- package/_cjs/actions/test/reset.js +11 -0
- package/_cjs/actions/test/reset.js.map +1 -0
- package/_cjs/actions/test/revert.js +11 -0
- package/_cjs/actions/test/revert.js.map +1 -0
- package/_cjs/actions/test/sendUnsignedTransaction.js +30 -0
- package/_cjs/actions/test/sendUnsignedTransaction.js.map +1 -0
- package/_cjs/actions/test/setAutomine.js +18 -0
- package/_cjs/actions/test/setAutomine.js.map +1 -0
- package/_cjs/actions/test/setBalance.js +18 -0
- package/_cjs/actions/test/setBalance.js.map +1 -0
- package/_cjs/actions/test/setBlockGasLimit.js +12 -0
- package/_cjs/actions/test/setBlockGasLimit.js.map +1 -0
- package/_cjs/actions/test/setBlockTimestampInterval.js +16 -0
- package/_cjs/actions/test/setBlockTimestampInterval.js.map +1 -0
- package/_cjs/actions/test/setCode.js +11 -0
- package/_cjs/actions/test/setCode.js.map +1 -0
- package/_cjs/actions/test/setCoinbase.js +11 -0
- package/_cjs/actions/test/setCoinbase.js.map +1 -0
- package/_cjs/actions/test/setIntervalMining.js +16 -0
- package/_cjs/actions/test/setIntervalMining.js.map +1 -0
- package/_cjs/actions/test/setLoggingEnabled.js +11 -0
- package/_cjs/actions/test/setLoggingEnabled.js.map +1 -0
- package/_cjs/actions/test/setMinGasPrice.js +12 -0
- package/_cjs/actions/test/setMinGasPrice.js.map +1 -0
- package/_cjs/actions/test/setNextBlockBaseFeePerGas.js +12 -0
- package/_cjs/actions/test/setNextBlockBaseFeePerGas.js.map +1 -0
- package/_cjs/actions/test/setNextBlockTimestamp.js +12 -0
- package/_cjs/actions/test/setNextBlockTimestamp.js.map +1 -0
- package/_cjs/actions/test/setNonce.js +12 -0
- package/_cjs/actions/test/setNonce.js.map +1 -0
- package/_cjs/actions/test/setRpcUrl.js +11 -0
- package/_cjs/actions/test/setRpcUrl.js.map +1 -0
- package/_cjs/actions/test/setStorageAt.js +16 -0
- package/_cjs/actions/test/setStorageAt.js.map +1 -0
- package/_cjs/actions/test/snapshot.js +10 -0
- package/_cjs/actions/test/snapshot.js.map +1 -0
- package/_cjs/actions/test/stopImpersonatingAccount.js +11 -0
- package/_cjs/actions/test/stopImpersonatingAccount.js.map +1 -0
- package/_cjs/actions/wallet/addChain.js +23 -0
- package/_cjs/actions/wallet/addChain.js.map +1 -0
- package/_cjs/actions/wallet/deployContract.js +15 -0
- package/_cjs/actions/wallet/deployContract.js.map +1 -0
- package/_cjs/actions/wallet/getAddresses.js +12 -0
- package/_cjs/actions/wallet/getAddresses.js.map +1 -0
- package/_cjs/actions/wallet/getPermissions.js +9 -0
- package/_cjs/actions/wallet/getPermissions.js.map +1 -0
- package/_cjs/actions/wallet/prepareTransactionRequest.js +71 -0
- package/_cjs/actions/wallet/prepareTransactionRequest.js.map +1 -0
- package/_cjs/actions/wallet/requestAddresses.js +10 -0
- package/_cjs/actions/wallet/requestAddresses.js.map +1 -0
- package/_cjs/actions/wallet/requestPermissions.js +11 -0
- package/_cjs/actions/wallet/requestPermissions.js.map +1 -0
- package/_cjs/actions/wallet/sendRawTransaction.js +11 -0
- package/_cjs/actions/wallet/sendRawTransaction.js.map +1 -0
- package/_cjs/actions/wallet/sendTransaction.js +87 -0
- package/_cjs/actions/wallet/sendTransaction.js.map +1 -0
- package/_cjs/actions/wallet/signMessage.js +28 -0
- package/_cjs/actions/wallet/signMessage.js.map +1 -0
- package/_cjs/actions/wallet/signTransaction.js +48 -0
- package/_cjs/actions/wallet/signTransaction.js.map +1 -0
- package/_cjs/actions/wallet/signTypedData.js +30 -0
- package/_cjs/actions/wallet/signTypedData.js.map +1 -0
- package/_cjs/actions/wallet/switchChain.js +16 -0
- package/_cjs/actions/wallet/switchChain.js.map +1 -0
- package/_cjs/actions/wallet/watchAsset.js +12 -0
- package/_cjs/actions/wallet/watchAsset.js.map +1 -0
- package/_cjs/actions/wallet/writeContract.js +18 -0
- package/_cjs/actions/wallet/writeContract.js.map +1 -0
- package/_cjs/chains/celo/chainConfig.js +10 -0
- package/_cjs/chains/celo/chainConfig.js.map +1 -0
- package/_cjs/chains/celo/formatters.js +82 -0
- package/_cjs/chains/celo/formatters.js.map +1 -0
- package/_cjs/chains/celo/index.js +10 -0
- package/_cjs/chains/celo/index.js.map +1 -0
- package/_cjs/chains/celo/parsers.js +131 -0
- package/_cjs/chains/celo/parsers.js.map +1 -0
- package/_cjs/chains/celo/serializers.js +131 -0
- package/_cjs/chains/celo/serializers.js.map +1 -0
- package/_cjs/chains/celo/types.js +3 -0
- package/_cjs/chains/celo/types.js.map +1 -0
- package/_cjs/chains/celo/utils.js +44 -0
- package/_cjs/chains/celo/utils.js.map +1 -0
- package/_cjs/chains/definitions/arbitrum.js +24 -0
- package/_cjs/chains/definitions/arbitrum.js.map +1 -0
- package/_cjs/chains/definitions/arbitrumGoerli.js +30 -0
- package/_cjs/chains/definitions/arbitrumGoerli.js.map +1 -0
- package/_cjs/chains/definitions/arbitrumNova.js +24 -0
- package/_cjs/chains/definitions/arbitrumNova.js.map +1 -0
- package/_cjs/chains/definitions/arbitrumSepolia.js +32 -0
- package/_cjs/chains/definitions/arbitrumSepolia.js.map +1 -0
- package/_cjs/chains/definitions/astar.js +29 -0
- package/_cjs/chains/definitions/astar.js.map +1 -0
- package/_cjs/chains/definitions/astarZkatana.js +42 -0
- package/_cjs/chains/definitions/astarZkatana.js.map +1 -0
- package/_cjs/chains/definitions/aurora.js +20 -0
- package/_cjs/chains/definitions/aurora.js.map +1 -0
- package/_cjs/chains/definitions/auroraTestnet.js +21 -0
- package/_cjs/chains/definitions/auroraTestnet.js.map +1 -0
- package/_cjs/chains/definitions/avalanche.js +26 -0
- package/_cjs/chains/definitions/avalanche.js.map +1 -0
- package/_cjs/chains/definitions/avalancheFuji.js +27 -0
- package/_cjs/chains/definitions/avalancheFuji.js.map +1 -0
- package/_cjs/chains/definitions/base.js +30 -0
- package/_cjs/chains/definitions/base.js.map +1 -0
- package/_cjs/chains/definitions/baseGoerli.js +30 -0
- package/_cjs/chains/definitions/baseGoerli.js.map +1 -0
- package/_cjs/chains/definitions/baseSepolia.js +34 -0
- package/_cjs/chains/definitions/baseSepolia.js.map +1 -0
- package/_cjs/chains/definitions/bearNetworkChainMainnet.js +20 -0
- package/_cjs/chains/definitions/bearNetworkChainMainnet.js.map +1 -0
- package/_cjs/chains/definitions/bearNetworkChainTestnet.js +24 -0
- package/_cjs/chains/definitions/bearNetworkChainTestnet.js.map +1 -0
- package/_cjs/chains/definitions/boba.js +26 -0
- package/_cjs/chains/definitions/boba.js.map +1 -0
- package/_cjs/chains/definitions/bronos.js +20 -0
- package/_cjs/chains/definitions/bronos.js.map +1 -0
- package/_cjs/chains/definitions/bronosTestnet.js +21 -0
- package/_cjs/chains/definitions/bronosTestnet.js.map +1 -0
- package/_cjs/chains/definitions/bsc.js +26 -0
- package/_cjs/chains/definitions/bsc.js.map +1 -0
- package/_cjs/chains/definitions/bscTestnet.js +27 -0
- package/_cjs/chains/definitions/bscTestnet.js.map +1 -0
- package/_cjs/chains/definitions/bxn.js +21 -0
- package/_cjs/chains/definitions/bxn.js.map +1 -0
- package/_cjs/chains/definitions/bxnTestnet.js +25 -0
- package/_cjs/chains/definitions/bxnTestnet.js.map +1 -0
- package/_cjs/chains/definitions/canto.js +29 -0
- package/_cjs/chains/definitions/canto.js.map +1 -0
- package/_cjs/chains/definitions/celo.js +32 -0
- package/_cjs/chains/definitions/celo.js.map +1 -0
- package/_cjs/chains/definitions/celoAlfajores.js +34 -0
- package/_cjs/chains/definitions/celoAlfajores.js.map +1 -0
- package/_cjs/chains/definitions/celoCannoli.js +34 -0
- package/_cjs/chains/definitions/celoCannoli.js.map +1 -0
- package/_cjs/chains/definitions/chiliz.js +26 -0
- package/_cjs/chains/definitions/chiliz.js.map +1 -0
- package/_cjs/chains/definitions/classic.js +23 -0
- package/_cjs/chains/definitions/classic.js.map +1 -0
- package/_cjs/chains/definitions/confluxESpace.js +27 -0
- package/_cjs/chains/definitions/confluxESpace.js.map +1 -0
- package/_cjs/chains/definitions/coreDao.js +27 -0
- package/_cjs/chains/definitions/coreDao.js.map +1 -0
- package/_cjs/chains/definitions/cronos.js +26 -0
- package/_cjs/chains/definitions/cronos.js.map +1 -0
- package/_cjs/chains/definitions/cronosTestnet.js +30 -0
- package/_cjs/chains/definitions/cronosTestnet.js.map +1 -0
- package/_cjs/chains/definitions/crossbell.js +28 -0
- package/_cjs/chains/definitions/crossbell.js.map +1 -0
- package/_cjs/chains/definitions/dfk.js +25 -0
- package/_cjs/chains/definitions/dfk.js.map +1 -0
- package/_cjs/chains/definitions/dogechain.js +23 -0
- package/_cjs/chains/definitions/dogechain.js.map +1 -0
- package/_cjs/chains/definitions/edgeware.js +26 -0
- package/_cjs/chains/definitions/edgeware.js.map +1 -0
- package/_cjs/chains/definitions/edgewareTestnet.js +23 -0
- package/_cjs/chains/definitions/edgewareTestnet.js.map +1 -0
- package/_cjs/chains/definitions/ekta.js +20 -0
- package/_cjs/chains/definitions/ekta.js.map +1 -0
- package/_cjs/chains/definitions/ektaTestnet.js +21 -0
- package/_cjs/chains/definitions/ektaTestnet.js.map +1 -0
- package/_cjs/chains/definitions/eon.js +24 -0
- package/_cjs/chains/definitions/eon.js.map +1 -0
- package/_cjs/chains/definitions/eos.js +29 -0
- package/_cjs/chains/definitions/eos.js.map +1 -0
- package/_cjs/chains/definitions/eosTestnet.js +30 -0
- package/_cjs/chains/definitions/eosTestnet.js.map +1 -0
- package/_cjs/chains/definitions/evmos.js +20 -0
- package/_cjs/chains/definitions/evmos.js.map +1 -0
- package/_cjs/chains/definitions/evmosTestnet.js +23 -0
- package/_cjs/chains/definitions/evmosTestnet.js.map +1 -0
- package/_cjs/chains/definitions/fantom.js +26 -0
- package/_cjs/chains/definitions/fantom.js.map +1 -0
- package/_cjs/chains/definitions/fantomTestnet.js +26 -0
- package/_cjs/chains/definitions/fantomTestnet.js.map +1 -0
- package/_cjs/chains/definitions/fibo.js +20 -0
- package/_cjs/chains/definitions/fibo.js.map +1 -0
- package/_cjs/chains/definitions/filecoin.js +20 -0
- package/_cjs/chains/definitions/filecoin.js.map +1 -0
- package/_cjs/chains/definitions/filecoinCalibration.js +20 -0
- package/_cjs/chains/definitions/filecoinCalibration.js.map +1 -0
- package/_cjs/chains/definitions/filecoinHyperspace.js +20 -0
- package/_cjs/chains/definitions/filecoinHyperspace.js.map +1 -0
- package/_cjs/chains/definitions/flare.js +23 -0
- package/_cjs/chains/definitions/flare.js.map +1 -0
- package/_cjs/chains/definitions/flareTestnet.js +24 -0
- package/_cjs/chains/definitions/flareTestnet.js.map +1 -0
- package/_cjs/chains/definitions/foundry.js +20 -0
- package/_cjs/chains/definitions/foundry.js.map +1 -0
- package/_cjs/chains/definitions/fuse.js +22 -0
- package/_cjs/chains/definitions/fuse.js.map +1 -0
- package/_cjs/chains/definitions/fuseSparknet.js +19 -0
- package/_cjs/chains/definitions/fuseSparknet.js.map +1 -0
- package/_cjs/chains/definitions/gnosis.js +32 -0
- package/_cjs/chains/definitions/gnosis.js.map +1 -0
- package/_cjs/chains/definitions/gnosisChiado.js +33 -0
- package/_cjs/chains/definitions/gnosisChiado.js.map +1 -0
- package/_cjs/chains/definitions/gobi.js +22 -0
- package/_cjs/chains/definitions/gobi.js.map +1 -0
- package/_cjs/chains/definitions/goerli.js +35 -0
- package/_cjs/chains/definitions/goerli.js.map +1 -0
- package/_cjs/chains/definitions/haqqMainnet.js +25 -0
- package/_cjs/chains/definitions/haqqMainnet.js.map +1 -0
- package/_cjs/chains/definitions/haqqTestedge2.js +25 -0
- package/_cjs/chains/definitions/haqqTestedge2.js.map +1 -0
- package/_cjs/chains/definitions/hardhat.js +17 -0
- package/_cjs/chains/definitions/hardhat.js.map +1 -0
- package/_cjs/chains/definitions/harmonyOne.js +26 -0
- package/_cjs/chains/definitions/harmonyOne.js.map +1 -0
- package/_cjs/chains/definitions/holesky.js +22 -0
- package/_cjs/chains/definitions/holesky.js.map +1 -0
- package/_cjs/chains/definitions/iotex.js +23 -0
- package/_cjs/chains/definitions/iotex.js.map +1 -0
- package/_cjs/chains/definitions/iotexTestnet.js +23 -0
- package/_cjs/chains/definitions/iotexTestnet.js.map +1 -0
- package/_cjs/chains/definitions/kava.js +29 -0
- package/_cjs/chains/definitions/kava.js.map +1 -0
- package/_cjs/chains/definitions/kavaTestnet.js +32 -0
- package/_cjs/chains/definitions/kavaTestnet.js.map +1 -0
- package/_cjs/chains/definitions/klaytn.js +20 -0
- package/_cjs/chains/definitions/klaytn.js.map +1 -0
- package/_cjs/chains/definitions/kroma.js +22 -0
- package/_cjs/chains/definitions/kroma.js.map +1 -0
- package/_cjs/chains/definitions/kromaSepolia.js +22 -0
- package/_cjs/chains/definitions/kromaSepolia.js.map +1 -0
- package/_cjs/chains/definitions/linea.js +29 -0
- package/_cjs/chains/definitions/linea.js.map +1 -0
- package/_cjs/chains/definitions/lineaTestnet.js +29 -0
- package/_cjs/chains/definitions/lineaTestnet.js.map +1 -0
- package/_cjs/chains/definitions/localhost.js +17 -0
- package/_cjs/chains/definitions/localhost.js.map +1 -0
- package/_cjs/chains/definitions/lukso.js +31 -0
- package/_cjs/chains/definitions/lukso.js.map +1 -0
- package/_cjs/chains/definitions/mainnet.js +34 -0
- package/_cjs/chains/definitions/mainnet.js.map +1 -0
- package/_cjs/chains/definitions/manta.js +35 -0
- package/_cjs/chains/definitions/manta.js.map +1 -0
- package/_cjs/chains/definitions/mantaTestnet.js +36 -0
- package/_cjs/chains/definitions/mantaTestnet.js.map +1 -0
- package/_cjs/chains/definitions/mantle.js +29 -0
- package/_cjs/chains/definitions/mantle.js.map +1 -0
- package/_cjs/chains/definitions/mantleTestnet.js +24 -0
- package/_cjs/chains/definitions/mantleTestnet.js.map +1 -0
- package/_cjs/chains/definitions/meter.js +20 -0
- package/_cjs/chains/definitions/meter.js.map +1 -0
- package/_cjs/chains/definitions/meterTestnet.js +23 -0
- package/_cjs/chains/definitions/meterTestnet.js.map +1 -0
- package/_cjs/chains/definitions/metis.js +29 -0
- package/_cjs/chains/definitions/metis.js.map +1 -0
- package/_cjs/chains/definitions/metisGoerli.js +29 -0
- package/_cjs/chains/definitions/metisGoerli.js.map +1 -0
- package/_cjs/chains/definitions/mev.js +31 -0
- package/_cjs/chains/definitions/mev.js.map +1 -0
- package/_cjs/chains/definitions/mevTestnet.js +32 -0
- package/_cjs/chains/definitions/mevTestnet.js.map +1 -0
- package/_cjs/chains/definitions/modeTestnet.js +28 -0
- package/_cjs/chains/definitions/modeTestnet.js.map +1 -0
- package/_cjs/chains/definitions/moonbaseAlpha.js +33 -0
- package/_cjs/chains/definitions/moonbaseAlpha.js.map +1 -0
- package/_cjs/chains/definitions/moonbeam.js +33 -0
- package/_cjs/chains/definitions/moonbeam.js.map +1 -0
- package/_cjs/chains/definitions/moonbeamDev.js +20 -0
- package/_cjs/chains/definitions/moonbeamDev.js.map +1 -0
- package/_cjs/chains/definitions/moonriver.js +33 -0
- package/_cjs/chains/definitions/moonriver.js.map +1 -0
- package/_cjs/chains/definitions/neonDevnet.js +28 -0
- package/_cjs/chains/definitions/neonDevnet.js.map +1 -0
- package/_cjs/chains/definitions/neonMainnet.js +27 -0
- package/_cjs/chains/definitions/neonMainnet.js.map +1 -0
- package/_cjs/chains/definitions/nexi.js +27 -0
- package/_cjs/chains/definitions/nexi.js.map +1 -0
- package/_cjs/chains/definitions/nexilix.js +26 -0
- package/_cjs/chains/definitions/nexilix.js.map +1 -0
- package/_cjs/chains/definitions/oasys.js +21 -0
- package/_cjs/chains/definitions/oasys.js.map +1 -0
- package/_cjs/chains/definitions/okc.js +26 -0
- package/_cjs/chains/definitions/okc.js.map +1 -0
- package/_cjs/chains/definitions/opBNB.js +26 -0
- package/_cjs/chains/definitions/opBNB.js.map +1 -0
- package/_cjs/chains/definitions/opBNBTestnet.js +27 -0
- package/_cjs/chains/definitions/opBNBTestnet.js.map +1 -0
- package/_cjs/chains/definitions/optimism.js +30 -0
- package/_cjs/chains/definitions/optimism.js.map +1 -0
- package/_cjs/chains/definitions/optimismGoerli.js +31 -0
- package/_cjs/chains/definitions/optimismGoerli.js.map +1 -0
- package/_cjs/chains/definitions/optimismSepolia.js +31 -0
- package/_cjs/chains/definitions/optimismSepolia.js.map +1 -0
- package/_cjs/chains/definitions/plinga.js +27 -0
- package/_cjs/chains/definitions/plinga.js.map +1 -0
- package/_cjs/chains/definitions/polygon.js +27 -0
- package/_cjs/chains/definitions/polygon.js.map +1 -0
- package/_cjs/chains/definitions/polygonMumbai.js +28 -0
- package/_cjs/chains/definitions/polygonMumbai.js.map +1 -0
- package/_cjs/chains/definitions/polygonZkEvm.js +27 -0
- package/_cjs/chains/definitions/polygonZkEvm.js.map +1 -0
- package/_cjs/chains/definitions/polygonZkEvmTestnet.js +28 -0
- package/_cjs/chains/definitions/polygonZkEvmTestnet.js.map +1 -0
- package/_cjs/chains/definitions/pulsechain.js +32 -0
- package/_cjs/chains/definitions/pulsechain.js.map +1 -0
- package/_cjs/chains/definitions/pulsechainV4.js +32 -0
- package/_cjs/chains/definitions/pulsechainV4.js.map +1 -0
- package/_cjs/chains/definitions/qMainnet.js +23 -0
- package/_cjs/chains/definitions/qMainnet.js.map +1 -0
- package/_cjs/chains/definitions/qTestnet.js +24 -0
- package/_cjs/chains/definitions/qTestnet.js.map +1 -0
- package/_cjs/chains/definitions/rollux.js +29 -0
- package/_cjs/chains/definitions/rollux.js.map +1 -0
- package/_cjs/chains/definitions/rolluxTestnet.js +32 -0
- package/_cjs/chains/definitions/rolluxTestnet.js.map +1 -0
- package/_cjs/chains/definitions/ronin.js +24 -0
- package/_cjs/chains/definitions/ronin.js.map +1 -0
- package/_cjs/chains/definitions/saigon.js +28 -0
- package/_cjs/chains/definitions/saigon.js.map +1 -0
- package/_cjs/chains/definitions/scroll.js +29 -0
- package/_cjs/chains/definitions/scroll.js.map +1 -0
- package/_cjs/chains/definitions/scrollSepolia.js +28 -0
- package/_cjs/chains/definitions/scrollSepolia.js.map +1 -0
- package/_cjs/chains/definitions/scrollTestnet.js +23 -0
- package/_cjs/chains/definitions/scrollTestnet.js.map +1 -0
- package/_cjs/chains/definitions/sepolia.js +33 -0
- package/_cjs/chains/definitions/sepolia.js.map +1 -0
- package/_cjs/chains/definitions/shardeumSphinx.js +22 -0
- package/_cjs/chains/definitions/shardeumSphinx.js.map +1 -0
- package/_cjs/chains/definitions/skale/brawl.js +23 -0
- package/_cjs/chains/definitions/skale/brawl.js.map +1 -0
- package/_cjs/chains/definitions/skale/calypso.js +30 -0
- package/_cjs/chains/definitions/skale/calypso.js.map +1 -0
- package/_cjs/chains/definitions/skale/calypsoTestnet.js +33 -0
- package/_cjs/chains/definitions/skale/calypsoTestnet.js.map +1 -0
- package/_cjs/chains/definitions/skale/chaosTestnet.js +33 -0
- package/_cjs/chains/definitions/skale/chaosTestnet.js.map +1 -0
- package/_cjs/chains/definitions/skale/cryptoBlades.js +25 -0
- package/_cjs/chains/definitions/skale/cryptoBlades.js.map +1 -0
- package/_cjs/chains/definitions/skale/cryptoColosseum.js +23 -0
- package/_cjs/chains/definitions/skale/cryptoColosseum.js.map +1 -0
- package/_cjs/chains/definitions/skale/europa.js +28 -0
- package/_cjs/chains/definitions/skale/europa.js.map +1 -0
- package/_cjs/chains/definitions/skale/europaTestnet.js +31 -0
- package/_cjs/chains/definitions/skale/europaTestnet.js.map +1 -0
- package/_cjs/chains/definitions/skale/exorde.js +23 -0
- package/_cjs/chains/definitions/skale/exorde.js.map +1 -0
- package/_cjs/chains/definitions/skale/humanProtocol.js +23 -0
- package/_cjs/chains/definitions/skale/humanProtocol.js.map +1 -0
- package/_cjs/chains/definitions/skale/nebula.js +28 -0
- package/_cjs/chains/definitions/skale/nebula.js.map +1 -0
- package/_cjs/chains/definitions/skale/nebulaTestnet.js +31 -0
- package/_cjs/chains/definitions/skale/nebulaTestnet.js.map +1 -0
- package/_cjs/chains/definitions/skale/razor.js +23 -0
- package/_cjs/chains/definitions/skale/razor.js.map +1 -0
- package/_cjs/chains/definitions/skale/titan.js +28 -0
- package/_cjs/chains/definitions/skale/titan.js.map +1 -0
- package/_cjs/chains/definitions/skale/titanTestnet.js +33 -0
- package/_cjs/chains/definitions/skale/titanTestnet.js.map +1 -0
- package/_cjs/chains/definitions/songbird.js +23 -0
- package/_cjs/chains/definitions/songbird.js.map +1 -0
- package/_cjs/chains/definitions/songbirdTestnet.js +24 -0
- package/_cjs/chains/definitions/songbirdTestnet.js.map +1 -0
- package/_cjs/chains/definitions/spicy.js +34 -0
- package/_cjs/chains/definitions/spicy.js.map +1 -0
- package/_cjs/chains/definitions/syscoin.js +29 -0
- package/_cjs/chains/definitions/syscoin.js.map +1 -0
- package/_cjs/chains/definitions/syscoinTestnet.js +29 -0
- package/_cjs/chains/definitions/syscoinTestnet.js.map +1 -0
- package/_cjs/chains/definitions/taikoJolnir.js +21 -0
- package/_cjs/chains/definitions/taikoJolnir.js.map +1 -0
- package/_cjs/chains/definitions/taikoTestnetSepolia.js +21 -0
- package/_cjs/chains/definitions/taikoTestnetSepolia.js.map +1 -0
- package/_cjs/chains/definitions/taraxa.js +21 -0
- package/_cjs/chains/definitions/taraxa.js.map +1 -0
- package/_cjs/chains/definitions/taraxaTestnet.js +22 -0
- package/_cjs/chains/definitions/taraxaTestnet.js.map +1 -0
- package/_cjs/chains/definitions/telos.js +29 -0
- package/_cjs/chains/definitions/telos.js.map +1 -0
- package/_cjs/chains/definitions/telosTestnet.js +24 -0
- package/_cjs/chains/definitions/telosTestnet.js.map +1 -0
- package/_cjs/chains/definitions/tenet.js +23 -0
- package/_cjs/chains/definitions/tenet.js.map +1 -0
- package/_cjs/chains/definitions/thunderTestnet.js +22 -0
- package/_cjs/chains/definitions/thunderTestnet.js.map +1 -0
- package/_cjs/chains/definitions/vechain.js +25 -0
- package/_cjs/chains/definitions/vechain.js.map +1 -0
- package/_cjs/chains/definitions/wanchain.js +30 -0
- package/_cjs/chains/definitions/wanchain.js.map +1 -0
- package/_cjs/chains/definitions/wanchainTestnet.js +28 -0
- package/_cjs/chains/definitions/wanchainTestnet.js.map +1 -0
- package/_cjs/chains/definitions/xdc.js +21 -0
- package/_cjs/chains/definitions/xdc.js.map +1 -0
- package/_cjs/chains/definitions/xdcTestnet.js +21 -0
- package/_cjs/chains/definitions/xdcTestnet.js.map +1 -0
- package/_cjs/chains/definitions/zetachainAthensTestnet.js +26 -0
- package/_cjs/chains/definitions/zetachainAthensTestnet.js.map +1 -0
- package/_cjs/chains/definitions/zhejiang.js +22 -0
- package/_cjs/chains/definitions/zhejiang.js.map +1 -0
- package/_cjs/chains/definitions/zkSync.js +34 -0
- package/_cjs/chains/definitions/zkSync.js.map +1 -0
- package/_cjs/chains/definitions/zkSyncTestnet.js +31 -0
- package/_cjs/chains/definitions/zkSyncTestnet.js.map +1 -0
- package/_cjs/chains/definitions/zora.js +32 -0
- package/_cjs/chains/definitions/zora.js.map +1 -0
- package/_cjs/chains/definitions/zoraSepolia.js +41 -0
- package/_cjs/chains/definitions/zoraSepolia.js.map +1 -0
- package/_cjs/chains/definitions/zoraTestnet.js +36 -0
- package/_cjs/chains/definitions/zoraTestnet.js.map +1 -0
- package/_cjs/chains/index.js +325 -0
- package/_cjs/chains/index.js.map +1 -0
- package/_cjs/chains/opStack/abis.js +77 -0
- package/_cjs/chains/opStack/abis.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateContractL1Fee.js +36 -0
- package/_cjs/chains/opStack/actions/estimateContractL1Fee.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateContractL1Gas.js +36 -0
- package/_cjs/chains/opStack/actions/estimateContractL1Gas.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateContractTotalFee.js +36 -0
- package/_cjs/chains/opStack/actions/estimateContractTotalFee.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateContractTotalGas.js +36 -0
- package/_cjs/chains/opStack/actions/estimateContractTotalGas.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateL1Fee.js +53 -0
- package/_cjs/chains/opStack/actions/estimateL1Fee.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateL1Gas.js +53 -0
- package/_cjs/chains/opStack/actions/estimateL1Gas.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateTotalFee.js +18 -0
- package/_cjs/chains/opStack/actions/estimateTotalFee.js.map +1 -0
- package/_cjs/chains/opStack/actions/estimateTotalGas.js +16 -0
- package/_cjs/chains/opStack/actions/estimateTotalGas.js.map +1 -0
- package/_cjs/chains/opStack/chainConfig.js +10 -0
- package/_cjs/chains/opStack/chainConfig.js.map +1 -0
- package/_cjs/chains/opStack/contracts.js +16 -0
- package/_cjs/chains/opStack/contracts.js.map +1 -0
- package/_cjs/chains/opStack/decorators/public.js +27 -0
- package/_cjs/chains/opStack/decorators/public.js.map +1 -0
- package/_cjs/chains/opStack/formatters.js +54 -0
- package/_cjs/chains/opStack/formatters.js.map +1 -0
- package/_cjs/chains/opStack/index.js +42 -0
- package/_cjs/chains/opStack/index.js.map +1 -0
- package/_cjs/chains/opStack/types.js +3 -0
- package/_cjs/chains/opStack/types.js.map +1 -0
- package/_cjs/chains/utils.js +12 -0
- package/_cjs/chains/utils.js.map +1 -0
- package/_cjs/chains/zksync/chainConfig.js +10 -0
- package/_cjs/chains/zksync/chainConfig.js.map +1 -0
- package/_cjs/chains/zksync/formatters.js +128 -0
- package/_cjs/chains/zksync/formatters.js.map +1 -0
- package/_cjs/chains/zksync/index.js +8 -0
- package/_cjs/chains/zksync/index.js.map +1 -0
- package/_cjs/chains/zksync/serializers.js +74 -0
- package/_cjs/chains/zksync/serializers.js.map +1 -0
- package/_cjs/chains/zksync/types.js +3 -0
- package/_cjs/chains/zksync/types.js.map +1 -0
- package/_cjs/clients/createClient.js +42 -0
- package/_cjs/clients/createClient.js.map +1 -0
- package/_cjs/clients/createPublicClient.js +17 -0
- package/_cjs/clients/createPublicClient.js.map +1 -0
- package/_cjs/clients/createTestClient.js +20 -0
- package/_cjs/clients/createTestClient.js.map +1 -0
- package/_cjs/clients/createWalletClient.js +18 -0
- package/_cjs/clients/createWalletClient.js.map +1 -0
- package/_cjs/clients/decorators/public.js +101 -0
- package/_cjs/clients/decorators/public.js.map +1 -0
- package/_cjs/clients/decorators/test.js +74 -0
- package/_cjs/clients/decorators/test.js.map +1 -0
- package/_cjs/clients/decorators/wallet.js +41 -0
- package/_cjs/clients/decorators/wallet.js.map +1 -0
- package/_cjs/clients/transports/createTransport.js +13 -0
- package/_cjs/clients/transports/createTransport.js.map +1 -0
- package/_cjs/clients/transports/custom.js +17 -0
- package/_cjs/clients/transports/custom.js.map +1 -0
- package/_cjs/clients/transports/fallback.js +122 -0
- package/_cjs/clients/transports/fallback.js.map +1 -0
- package/_cjs/clients/transports/http.js +59 -0
- package/_cjs/clients/transports/http.js.map +1 -0
- package/_cjs/clients/transports/webSocket.js +81 -0
- package/_cjs/clients/transports/webSocket.js.map +1 -0
- package/_cjs/constants/abis.js +1350 -0
- package/_cjs/constants/abis.js.map +1 -0
- package/_cjs/constants/address.js +5 -0
- package/_cjs/constants/address.js.map +1 -0
- package/_cjs/constants/bytes.js +5 -0
- package/_cjs/constants/bytes.js.map +1 -0
- package/_cjs/constants/contract.js +5 -0
- package/_cjs/constants/contract.js.map +1 -0
- package/_cjs/constants/contracts.js +5 -0
- package/_cjs/constants/contracts.js.map +1 -0
- package/_cjs/constants/number.js +101 -0
- package/_cjs/constants/number.js.map +1 -0
- package/_cjs/constants/solidity.js +35 -0
- package/_cjs/constants/solidity.js.map +1 -0
- package/_cjs/constants/strings.js +5 -0
- package/_cjs/constants/strings.js.map +1 -0
- package/_cjs/constants/unit.js +16 -0
- package/_cjs/constants/unit.js.map +1 -0
- package/_cjs/ens/index.js +20 -0
- package/_cjs/ens/index.js.map +1 -0
- package/_cjs/errors/abi.js +461 -0
- package/_cjs/errors/abi.js.map +1 -0
- package/_cjs/errors/account.js +23 -0
- package/_cjs/errors/account.js.map +1 -0
- package/_cjs/errors/address.js +17 -0
- package/_cjs/errors/address.js.map +1 -0
- package/_cjs/errors/base.js +83 -0
- package/_cjs/errors/base.js.map +1 -0
- package/_cjs/errors/block.js +22 -0
- package/_cjs/errors/block.js.map +1 -0
- package/_cjs/errors/ccip.js +69 -0
- package/_cjs/errors/ccip.js.map +1 -0
- package/_cjs/errors/chain.js +86 -0
- package/_cjs/errors/chain.js.map +1 -0
- package/_cjs/errors/contract.js +286 -0
- package/_cjs/errors/contract.js.map +1 -0
- package/_cjs/errors/cursor.js +29 -0
- package/_cjs/errors/cursor.js.map +1 -0
- package/_cjs/errors/data.js +31 -0
- package/_cjs/errors/data.js.map +1 -0
- package/_cjs/errors/encoding.js +65 -0
- package/_cjs/errors/encoding.js.map +1 -0
- package/_cjs/errors/ens.js +59 -0
- package/_cjs/errors/ens.js.map +1 -0
- package/_cjs/errors/estimateGas.js +49 -0
- package/_cjs/errors/estimateGas.js.map +1 -0
- package/_cjs/errors/fee.js +42 -0
- package/_cjs/errors/fee.js.map +1 -0
- package/_cjs/errors/log.js +17 -0
- package/_cjs/errors/log.js.map +1 -0
- package/_cjs/errors/node.js +262 -0
- package/_cjs/errors/node.js.map +1 -0
- package/_cjs/errors/request.js +107 -0
- package/_cjs/errors/request.js.map +1 -0
- package/_cjs/errors/rpc.js +448 -0
- package/_cjs/errors/rpc.js.map +1 -0
- package/_cjs/errors/transaction.js +225 -0
- package/_cjs/errors/transaction.js.map +1 -0
- package/_cjs/errors/transport.js +13 -0
- package/_cjs/errors/transport.js.map +1 -0
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +486 -0
- package/_cjs/index.js.map +1 -0
- package/_cjs/types/account.js +3 -0
- package/_cjs/types/account.js.map +1 -0
- package/_cjs/types/block.js +3 -0
- package/_cjs/types/block.js.map +1 -0
- package/_cjs/types/chain.js +3 -0
- package/_cjs/types/chain.js.map +1 -0
- package/_cjs/types/contract.js +3 -0
- package/_cjs/types/contract.js.map +1 -0
- package/_cjs/types/eip1193.js +24 -0
- package/_cjs/types/eip1193.js.map +1 -0
- package/_cjs/types/ens.js +3 -0
- package/_cjs/types/ens.js.map +1 -0
- package/_cjs/types/fee.js +3 -0
- package/_cjs/types/fee.js.map +1 -0
- package/_cjs/types/filter.js +3 -0
- package/_cjs/types/filter.js.map +1 -0
- package/_cjs/types/log.js +3 -0
- package/_cjs/types/log.js.map +1 -0
- package/_cjs/types/misc.js +3 -0
- package/_cjs/types/misc.js.map +1 -0
- package/_cjs/types/multicall.js +3 -0
- package/_cjs/types/multicall.js.map +1 -0
- package/_cjs/types/proof.js +3 -0
- package/_cjs/types/proof.js.map +1 -0
- package/_cjs/types/rpc.js +3 -0
- package/_cjs/types/rpc.js.map +1 -0
- package/_cjs/types/transaction.js +3 -0
- package/_cjs/types/transaction.js.map +1 -0
- package/_cjs/types/transport.js +3 -0
- package/_cjs/types/transport.js.map +1 -0
- package/_cjs/types/typedData.js +3 -0
- package/_cjs/types/typedData.js.map +1 -0
- package/_cjs/types/utils.js +3 -0
- package/_cjs/types/utils.js.map +1 -0
- package/_cjs/types/window.js +3 -0
- package/_cjs/types/window.js.map +1 -0
- package/_cjs/types/withdrawal.js +3 -0
- package/_cjs/types/withdrawal.js.map +1 -0
- package/_cjs/utils/abi/decodeAbiParameters.js +210 -0
- package/_cjs/utils/abi/decodeAbiParameters.js.map +1 -0
- package/_cjs/utils/abi/decodeDeployData.js +22 -0
- package/_cjs/utils/abi/decodeDeployData.js.map +1 -0
- package/_cjs/utils/abi/decodeErrorResult.js +30 -0
- package/_cjs/utils/abi/decodeErrorResult.js.map +1 -0
- package/_cjs/utils/abi/decodeEventLog.js +85 -0
- package/_cjs/utils/abi/decodeEventLog.js.map +1 -0
- package/_cjs/utils/abi/decodeFunctionData.js +28 -0
- package/_cjs/utils/abi/decodeFunctionData.js.map +1 -0
- package/_cjs/utils/abi/decodeFunctionResult.js +29 -0
- package/_cjs/utils/abi/decodeFunctionResult.js.map +1 -0
- package/_cjs/utils/abi/encodeAbiParameters.js +211 -0
- package/_cjs/utils/abi/encodeAbiParameters.js.map +1 -0
- package/_cjs/utils/abi/encodeDeployData.js +23 -0
- package/_cjs/utils/abi/encodeDeployData.js.map +1 -0
- package/_cjs/utils/abi/encodeErrorResult.js +33 -0
- package/_cjs/utils/abi/encodeErrorResult.js.map +1 -0
- package/_cjs/utils/abi/encodeEventTopics.js +53 -0
- package/_cjs/utils/abi/encodeEventTopics.js.map +1 -0
- package/_cjs/utils/abi/encodeFunctionData.js +34 -0
- package/_cjs/utils/abi/encodeFunctionData.js.map +1 -0
- package/_cjs/utils/abi/encodeFunctionResult.js +27 -0
- package/_cjs/utils/abi/encodeFunctionResult.js.map +1 -0
- package/_cjs/utils/abi/encodePacked.js +73 -0
- package/_cjs/utils/abi/encodePacked.js.map +1 -0
- package/_cjs/utils/abi/formatAbiItem.js +27 -0
- package/_cjs/utils/abi/formatAbiItem.js.map +1 -0
- package/_cjs/utils/abi/formatAbiItemWithArgs.js +17 -0
- package/_cjs/utils/abi/formatAbiItemWithArgs.js.map +1 -0
- package/_cjs/utils/abi/getAbiItem.js +84 -0
- package/_cjs/utils/abi/getAbiItem.js.map +1 -0
- package/_cjs/utils/accounts.js +8 -0
- package/_cjs/utils/accounts.js.map +1 -0
- package/_cjs/utils/address/getAddress.js +31 -0
- package/_cjs/utils/address/getAddress.js.map +1 -0
- package/_cjs/utils/address/getContractAddress.js +42 -0
- package/_cjs/utils/address/getContractAddress.js.map +1 -0
- package/_cjs/utils/address/isAddress.js +9 -0
- package/_cjs/utils/address/isAddress.js.map +1 -0
- package/_cjs/utils/address/isAddressEqual.js +14 -0
- package/_cjs/utils/address/isAddressEqual.js.map +1 -0
- package/_cjs/utils/buildRequest.js +93 -0
- package/_cjs/utils/buildRequest.js.map +1 -0
- package/_cjs/utils/ccip.js +121 -0
- package/_cjs/utils/ccip.js.map +1 -0
- package/_cjs/utils/chain/assertCurrentChain.js +12 -0
- package/_cjs/utils/chain/assertCurrentChain.js.map +1 -0
- package/_cjs/utils/chain/defineChain.js +13 -0
- package/_cjs/utils/chain/defineChain.js.map +1 -0
- package/_cjs/utils/chain/extractChain.js +8 -0
- package/_cjs/utils/chain/extractChain.js.map +1 -0
- package/_cjs/utils/chain/getChainContractAddress.js +26 -0
- package/_cjs/utils/chain/getChainContractAddress.js.map +1 -0
- package/_cjs/utils/cursor.js +134 -0
- package/_cjs/utils/cursor.js.map +1 -0
- package/_cjs/utils/data/concat.js +28 -0
- package/_cjs/utils/data/concat.js.map +1 -0
- package/_cjs/utils/data/isBytes.js +14 -0
- package/_cjs/utils/data/isBytes.js.map +1 -0
- package/_cjs/utils/data/isBytesEqual.js +13 -0
- package/_cjs/utils/data/isBytesEqual.js.map +1 -0
- package/_cjs/utils/data/isHex.js +12 -0
- package/_cjs/utils/data/isHex.js.map +1 -0
- package/_cjs/utils/data/pad.js +42 -0
- package/_cjs/utils/data/pad.js.map +1 -0
- package/_cjs/utils/data/size.js +11 -0
- package/_cjs/utils/data/size.js.map +1 -0
- package/_cjs/utils/data/slice.js +54 -0
- package/_cjs/utils/data/slice.js.map +1 -0
- package/_cjs/utils/data/trim.js +25 -0
- package/_cjs/utils/data/trim.js.map +1 -0
- package/_cjs/utils/encoding/fromBytes.js +56 -0
- package/_cjs/utils/encoding/fromBytes.js.map +1 -0
- package/_cjs/utils/encoding/fromHex.js +70 -0
- package/_cjs/utils/encoding/fromHex.js.map +1 -0
- package/_cjs/utils/encoding/fromRlp.js +67 -0
- package/_cjs/utils/encoding/fromRlp.js.map +1 -0
- package/_cjs/utils/encoding/toBytes.js +83 -0
- package/_cjs/utils/encoding/toBytes.js.map +1 -0
- package/_cjs/utils/encoding/toHex.js +79 -0
- package/_cjs/utils/encoding/toHex.js.map +1 -0
- package/_cjs/utils/encoding/toRlp.js +105 -0
- package/_cjs/utils/encoding/toRlp.js.map +1 -0
- package/_cjs/utils/ens/avatar/parseAvatarRecord.js +34 -0
- package/_cjs/utils/ens/avatar/parseAvatarRecord.js.map +1 -0
- package/_cjs/utils/ens/avatar/utils.js +186 -0
- package/_cjs/utils/ens/avatar/utils.js.map +1 -0
- package/_cjs/utils/ens/encodeLabelhash.js +8 -0
- package/_cjs/utils/ens/encodeLabelhash.js.map +1 -0
- package/_cjs/utils/ens/encodedLabelToLabelhash.js +18 -0
- package/_cjs/utils/ens/encodedLabelToLabelhash.js.map +1 -0
- package/_cjs/utils/ens/errors.js +24 -0
- package/_cjs/utils/ens/errors.js.map +1 -0
- package/_cjs/utils/ens/labelhash.js +15 -0
- package/_cjs/utils/ens/labelhash.js.map +1 -0
- package/_cjs/utils/ens/namehash.js +24 -0
- package/_cjs/utils/ens/namehash.js.map +1 -0
- package/_cjs/utils/ens/normalize.js +9 -0
- package/_cjs/utils/ens/normalize.js.map +1 -0
- package/_cjs/utils/ens/packetToBytes.js +27 -0
- package/_cjs/utils/ens/packetToBytes.js.map +1 -0
- package/_cjs/utils/errors/getCallError.js +20 -0
- package/_cjs/utils/errors/getCallError.js.map +1 -0
- package/_cjs/utils/errors/getContractError.js +39 -0
- package/_cjs/utils/errors/getContractError.js.map +1 -0
- package/_cjs/utils/errors/getEstimateGasError.js +20 -0
- package/_cjs/utils/errors/getEstimateGasError.js.map +1 -0
- package/_cjs/utils/errors/getNodeError.js +65 -0
- package/_cjs/utils/errors/getNodeError.js.map +1 -0
- package/_cjs/utils/errors/getTransactionError.js +20 -0
- package/_cjs/utils/errors/getTransactionError.js.map +1 -0
- package/_cjs/utils/filters/createFilterRequestScope.js +14 -0
- package/_cjs/utils/filters/createFilterRequestScope.js.map +1 -0
- package/_cjs/utils/formatters/block.js +32 -0
- package/_cjs/utils/formatters/block.js.map +1 -0
- package/_cjs/utils/formatters/extract.js +24 -0
- package/_cjs/utils/formatters/extract.js.map +1 -0
- package/_cjs/utils/formatters/feeHistory.js +13 -0
- package/_cjs/utils/formatters/feeHistory.js.map +1 -0
- package/_cjs/utils/formatters/formatter.js +25 -0
- package/_cjs/utils/formatters/formatter.js.map +1 -0
- package/_cjs/utils/formatters/log.js +18 -0
- package/_cjs/utils/formatters/log.js.map +1 -0
- package/_cjs/utils/formatters/proof.js +22 -0
- package/_cjs/utils/formatters/proof.js.map +1 -0
- package/_cjs/utils/formatters/transaction.js +66 -0
- package/_cjs/utils/formatters/transaction.js.map +1 -0
- package/_cjs/utils/formatters/transactionReceipt.js +47 -0
- package/_cjs/utils/formatters/transactionReceipt.js.map +1 -0
- package/_cjs/utils/formatters/transactionRequest.js +39 -0
- package/_cjs/utils/formatters/transactionRequest.js.map +1 -0
- package/_cjs/utils/getAction.js +8 -0
- package/_cjs/utils/getAction.js.map +1 -0
- package/_cjs/utils/hash/getEventSelector.js +10 -0
- package/_cjs/utils/hash/getEventSelector.js.map +1 -0
- package/_cjs/utils/hash/getEventSignature.js +9 -0
- package/_cjs/utils/hash/getEventSignature.js.map +1 -0
- package/_cjs/utils/hash/getFunctionSelector.js +11 -0
- package/_cjs/utils/hash/getFunctionSelector.js.map +1 -0
- package/_cjs/utils/hash/getFunctionSignature.js +15 -0
- package/_cjs/utils/hash/getFunctionSignature.js.map +1 -0
- package/_cjs/utils/hash/hashFunction.js +17 -0
- package/_cjs/utils/hash/hashFunction.js.map +1 -0
- package/_cjs/utils/hash/isHash.js +10 -0
- package/_cjs/utils/hash/isHash.js.map +1 -0
- package/_cjs/utils/hash/keccak256.js +16 -0
- package/_cjs/utils/hash/keccak256.js.map +1 -0
- package/_cjs/utils/hash/normalizeSignature.js +48 -0
- package/_cjs/utils/hash/normalizeSignature.js.map +1 -0
- package/_cjs/utils/index.js +213 -0
- package/_cjs/utils/index.js.map +1 -0
- package/_cjs/utils/observe.js +42 -0
- package/_cjs/utils/observe.js.map +1 -0
- package/_cjs/utils/poll.js +27 -0
- package/_cjs/utils/poll.js.map +1 -0
- package/_cjs/utils/promise/createBatchScheduler.js +49 -0
- package/_cjs/utils/promise/createBatchScheduler.js.map +1 -0
- package/_cjs/utils/promise/withCache.js +47 -0
- package/_cjs/utils/promise/withCache.js.map +1 -0
- package/_cjs/utils/promise/withRetry.js +29 -0
- package/_cjs/utils/promise/withRetry.js.map +1 -0
- package/_cjs/utils/promise/withTimeout.js +35 -0
- package/_cjs/utils/promise/withTimeout.js.map +1 -0
- package/_cjs/utils/regex.js +7 -0
- package/_cjs/utils/regex.js.map +1 -0
- package/_cjs/utils/rpc.js +154 -0
- package/_cjs/utils/rpc.js.map +1 -0
- package/_cjs/utils/signature/compactSignatureToHex.js +10 -0
- package/_cjs/utils/signature/compactSignatureToHex.js.map +1 -0
- package/_cjs/utils/signature/compactSignatureToSignature.js +15 -0
- package/_cjs/utils/signature/compactSignatureToSignature.js.map +1 -0
- package/_cjs/utils/signature/hashMessage.js +20 -0
- package/_cjs/utils/signature/hashMessage.js.map +1 -0
- package/_cjs/utils/signature/hashTypedData.js +124 -0
- package/_cjs/utils/signature/hashTypedData.js.map +1 -0
- package/_cjs/utils/signature/hexToCompactSignature.js +14 -0
- package/_cjs/utils/signature/hexToCompactSignature.js.map +1 -0
- package/_cjs/utils/signature/hexToSignature.js +12 -0
- package/_cjs/utils/signature/hexToSignature.js.map +1 -0
- package/_cjs/utils/signature/recoverAddress.js +10 -0
- package/_cjs/utils/signature/recoverAddress.js.map +1 -0
- package/_cjs/utils/signature/recoverMessageAddress.js +10 -0
- package/_cjs/utils/signature/recoverMessageAddress.js.map +1 -0
- package/_cjs/utils/signature/recoverPublicKey.js +21 -0
- package/_cjs/utils/signature/recoverPublicKey.js.map +1 -0
- package/_cjs/utils/signature/recoverTypedDataAddress.js +19 -0
- package/_cjs/utils/signature/recoverTypedDataAddress.js.map +1 -0
- package/_cjs/utils/signature/signatureToCompactSignature.js +17 -0
- package/_cjs/utils/signature/signatureToCompactSignature.js.map +1 -0
- package/_cjs/utils/signature/signatureToHex.js +11 -0
- package/_cjs/utils/signature/signatureToHex.js.map +1 -0
- package/_cjs/utils/signature/verifyMessage.js +11 -0
- package/_cjs/utils/signature/verifyMessage.js.map +1 -0
- package/_cjs/utils/signature/verifyTypedData.js +18 -0
- package/_cjs/utils/signature/verifyTypedData.js.map +1 -0
- package/_cjs/utils/stringify.js +9 -0
- package/_cjs/utils/stringify.js.map +1 -0
- package/_cjs/utils/transaction/assertRequest.js +28 -0
- package/_cjs/utils/transaction/assertRequest.js.map +1 -0
- package/_cjs/utils/transaction/assertTransaction.js +51 -0
- package/_cjs/utils/transaction/assertTransaction.js.map +1 -0
- package/_cjs/utils/transaction/getSerializedTransactionType.js +18 -0
- package/_cjs/utils/transaction/getSerializedTransactionType.js.map +1 -0
- package/_cjs/utils/transaction/getTransactionType.js +19 -0
- package/_cjs/utils/transaction/getTransactionType.js.map +1 -0
- package/_cjs/utils/transaction/parseTransaction.js +213 -0
- package/_cjs/utils/transaction/parseTransaction.js.map +1 -0
- package/_cjs/utils/transaction/serializeAccessList.js +26 -0
- package/_cjs/utils/transaction/serializeAccessList.js.map +1 -0
- package/_cjs/utils/transaction/serializeTransaction.js +123 -0
- package/_cjs/utils/transaction/serializeTransaction.js.map +1 -0
- package/_cjs/utils/typedData.js +75 -0
- package/_cjs/utils/typedData.js.map +1 -0
- package/_cjs/utils/uid.js +18 -0
- package/_cjs/utils/uid.js.map +1 -0
- package/_cjs/utils/unit/formatEther.js +10 -0
- package/_cjs/utils/unit/formatEther.js.map +1 -0
- package/_cjs/utils/unit/formatGwei.js +10 -0
- package/_cjs/utils/unit/formatGwei.js.map +1 -0
- package/_cjs/utils/unit/formatUnits.js +18 -0
- package/_cjs/utils/unit/formatUnits.js.map +1 -0
- package/_cjs/utils/unit/parseEther.js +10 -0
- package/_cjs/utils/unit/parseEther.js.map +1 -0
- package/_cjs/utils/unit/parseGwei.js +10 -0
- package/_cjs/utils/unit/parseGwei.js.map +1 -0
- package/_cjs/utils/unit/parseUnits.js +38 -0
- package/_cjs/utils/unit/parseUnits.js.map +1 -0
- package/_cjs/utils/wait.js +8 -0
- package/_cjs/utils/wait.js.map +1 -0
- package/_cjs/window/index.js +4 -0
- package/_cjs/window/index.js.map +1 -0
- package/_esm/actions/test/dumpState.js +26 -0
- package/_esm/actions/test/dumpState.js.map +1 -0
- package/_esm/actions/test/loadState.js +27 -0
- package/_esm/actions/test/loadState.js.map +1 -0
- package/_esm/chains/celo/formatters.js.map +1 -1
- package/_esm/chains/definitions/chiliz.js +23 -0
- package/_esm/chains/definitions/chiliz.js.map +1 -0
- package/_esm/chains/definitions/lukso.js +28 -0
- package/_esm/chains/definitions/lukso.js.map +1 -0
- package/_esm/chains/definitions/spicy.js +31 -0
- package/_esm/chains/definitions/spicy.js.map +1 -0
- package/_esm/chains/index.js +3 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/chains/opStack/decorators/public.js +1 -1
- package/_esm/chains/opStack/index.js +1 -1
- package/_esm/clients/decorators/test.js +4 -0
- package/_esm/clients/decorators/test.js.map +1 -1
- package/_esm/constants/bytes.js +2 -0
- package/_esm/constants/bytes.js.map +1 -0
- package/_esm/constants/strings.js +2 -0
- package/_esm/constants/strings.js.map +1 -0
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +2 -0
- package/_esm/index.js.map +1 -1
- package/_esm/utils/formatters/transaction.js +19 -1
- package/_esm/utils/formatters/transaction.js.map +1 -1
- package/_esm/utils/signature/hashMessage.js +2 -1
- package/_esm/utils/signature/hashMessage.js.map +1 -1
- package/_esm/utils/transaction/serializeTransaction.js +20 -6
- package/_esm/utils/transaction/serializeTransaction.js.map +1 -1
- package/_types/actions/test/dumpState.d.ts +31 -0
- package/_types/actions/test/dumpState.d.ts.map +1 -0
- package/_types/actions/test/loadState.d.ts +34 -0
- package/_types/actions/test/loadState.d.ts.map +1 -0
- package/_types/chains/celo/chainConfig.d.ts +167 -137
- package/_types/chains/celo/chainConfig.d.ts.map +1 -1
- package/_types/chains/celo/formatters.d.ts +167 -137
- package/_types/chains/celo/formatters.d.ts.map +1 -1
- package/_types/chains/celo/types.d.ts +2 -0
- package/_types/chains/celo/types.d.ts.map +1 -1
- package/_types/chains/definitions/base.d.ts +129 -111
- package/_types/chains/definitions/base.d.ts.map +1 -1
- package/_types/chains/definitions/baseGoerli.d.ts +129 -111
- package/_types/chains/definitions/baseGoerli.d.ts.map +1 -1
- package/_types/chains/definitions/baseSepolia.d.ts +129 -111
- package/_types/chains/definitions/baseSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/celo.d.ts +167 -137
- package/_types/chains/definitions/celo.d.ts.map +1 -1
- package/_types/chains/definitions/celoAlfajores.d.ts +167 -137
- package/_types/chains/definitions/celoAlfajores.d.ts.map +1 -1
- package/_types/chains/definitions/celoCannoli.d.ts +167 -137
- package/_types/chains/definitions/celoCannoli.d.ts.map +1 -1
- package/_types/chains/definitions/chiliz.d.ts +35 -0
- package/_types/chains/definitions/chiliz.d.ts.map +1 -0
- package/_types/chains/definitions/lukso.d.ts +40 -0
- package/_types/chains/definitions/lukso.d.ts.map +1 -0
- package/_types/chains/definitions/optimism.d.ts +129 -111
- package/_types/chains/definitions/optimism.d.ts.map +1 -1
- package/_types/chains/definitions/optimismGoerli.d.ts +129 -111
- package/_types/chains/definitions/optimismGoerli.d.ts.map +1 -1
- package/_types/chains/definitions/optimismSepolia.d.ts +129 -111
- package/_types/chains/definitions/optimismSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/spicy.d.ts +36 -0
- package/_types/chains/definitions/spicy.d.ts.map +1 -0
- package/_types/chains/definitions/zkSync.d.ts +11 -0
- package/_types/chains/definitions/zkSync.d.ts.map +1 -1
- package/_types/chains/definitions/zkSyncTestnet.d.ts +11 -0
- package/_types/chains/definitions/zkSyncTestnet.d.ts.map +1 -1
- package/_types/chains/definitions/zora.d.ts +129 -111
- package/_types/chains/definitions/zora.d.ts.map +1 -1
- package/_types/chains/definitions/zoraSepolia.d.ts +129 -111
- package/_types/chains/definitions/zoraSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/zoraTestnet.d.ts +129 -111
- package/_types/chains/definitions/zoraTestnet.d.ts.map +1 -1
- package/_types/chains/index.d.ts +5 -1
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/chains/opStack/chainConfig.d.ts +125 -107
- package/_types/chains/opStack/chainConfig.d.ts.map +1 -1
- package/_types/chains/opStack/decorators/public.d.ts +18 -18
- package/_types/chains/opStack/formatters.d.ts +125 -107
- package/_types/chains/opStack/formatters.d.ts.map +1 -1
- package/_types/chains/opStack/index.d.ts +1 -1
- package/_types/chains/zksync/chainConfig.d.ts +11 -0
- package/_types/chains/zksync/chainConfig.d.ts.map +1 -1
- package/_types/chains/zksync/formatters.d.ts +11 -0
- package/_types/chains/zksync/formatters.d.ts.map +1 -1
- package/_types/clients/decorators/test.d.ts +41 -0
- package/_types/clients/decorators/test.d.ts.map +1 -1
- package/_types/constants/bytes.d.ts +2 -0
- package/_types/constants/bytes.d.ts.map +1 -0
- package/_types/constants/strings.d.ts +2 -0
- package/_types/constants/strings.d.ts.map +1 -0
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +2 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/types/eip1193.d.ts +16 -0
- package/_types/types/eip1193.d.ts.map +1 -1
- package/_types/types/rpc.d.ts +2 -2
- package/_types/types/rpc.d.ts.map +1 -1
- package/_types/types/transaction.d.ts +10 -1
- package/_types/types/transaction.d.ts.map +1 -1
- package/_types/types/utils.d.ts +16 -0
- package/_types/types/utils.d.ts.map +1 -1
- package/_types/utils/formatters/transaction.d.ts +1 -1
- package/_types/utils/formatters/transaction.d.ts.map +1 -1
- package/_types/utils/formatters/transactionRequest.d.ts +1 -1
- package/_types/utils/signature/hashMessage.d.ts.map +1 -1
- package/_types/utils/transaction/serializeTransaction.d.ts.map +1 -1
- package/actions/test/dumpState.ts +44 -0
- package/actions/test/loadState.ts +47 -0
- package/chains/celo/formatters.ts +0 -1
- package/chains/celo/types.ts +2 -0
- package/chains/definitions/chiliz.ts +23 -0
- package/chains/definitions/lukso.ts +28 -0
- package/chains/definitions/spicy.ts +31 -0
- package/chains/index.ts +21 -3
- package/chains/opStack/decorators/public.ts +19 -19
- package/chains/opStack/index.ts +1 -1
- package/clients/decorators/test.ts +50 -0
- package/constants/bytes.ts +2 -0
- package/constants/strings.ts +1 -0
- package/errors/version.ts +1 -1
- package/index.ts +2 -0
- package/package.json +34 -11
- package/types/eip1193.ts +16 -0
- package/types/rpc.ts +10 -5
- package/types/transaction.ts +10 -1
- package/types/utils.ts +20 -0
- package/utils/formatters/transaction.ts +20 -3
- package/utils/signature/hashMessage.ts +2 -1
- package/utils/transaction/serializeTransaction.ts +18 -12
@@ -0,0 +1,154 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.rpc = exports.getSocket = exports.socketsCache = void 0;
|
4
|
+
const isows_1 = require("isows");
|
5
|
+
const request_js_1 = require("../errors/request.js");
|
6
|
+
const createBatchScheduler_js_1 = require("./promise/createBatchScheduler.js");
|
7
|
+
const withTimeout_js_1 = require("./promise/withTimeout.js");
|
8
|
+
const stringify_js_1 = require("./stringify.js");
|
9
|
+
let id = 0;
|
10
|
+
async function http(url, { body, fetchOptions = {}, timeout = 10000 }) {
|
11
|
+
const { headers, method, signal: signal_ } = fetchOptions;
|
12
|
+
try {
|
13
|
+
const response = await (0, withTimeout_js_1.withTimeout)(async ({ signal }) => {
|
14
|
+
const response = await fetch(url, {
|
15
|
+
...fetchOptions,
|
16
|
+
body: Array.isArray(body)
|
17
|
+
? (0, stringify_js_1.stringify)(body.map((body) => ({
|
18
|
+
jsonrpc: '2.0',
|
19
|
+
id: body.id ?? id++,
|
20
|
+
...body,
|
21
|
+
})))
|
22
|
+
: (0, stringify_js_1.stringify)({ jsonrpc: '2.0', id: body.id ?? id++, ...body }),
|
23
|
+
headers: {
|
24
|
+
...headers,
|
25
|
+
'Content-Type': 'application/json',
|
26
|
+
},
|
27
|
+
method: method || 'POST',
|
28
|
+
signal: signal_ || (timeout > 0 ? signal : undefined),
|
29
|
+
});
|
30
|
+
return response;
|
31
|
+
}, {
|
32
|
+
errorInstance: new request_js_1.TimeoutError({ body, url }),
|
33
|
+
timeout,
|
34
|
+
signal: true,
|
35
|
+
});
|
36
|
+
let data;
|
37
|
+
if (response.headers.get('Content-Type')?.startsWith('application/json')) {
|
38
|
+
data = await response.json();
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
data = await response.text();
|
42
|
+
}
|
43
|
+
if (!response.ok) {
|
44
|
+
throw new request_js_1.HttpRequestError({
|
45
|
+
body,
|
46
|
+
details: (0, stringify_js_1.stringify)(data.error) || response.statusText,
|
47
|
+
headers: response.headers,
|
48
|
+
status: response.status,
|
49
|
+
url,
|
50
|
+
});
|
51
|
+
}
|
52
|
+
return data;
|
53
|
+
}
|
54
|
+
catch (err) {
|
55
|
+
if (err instanceof request_js_1.HttpRequestError)
|
56
|
+
throw err;
|
57
|
+
if (err instanceof request_js_1.TimeoutError)
|
58
|
+
throw err;
|
59
|
+
throw new request_js_1.HttpRequestError({
|
60
|
+
body,
|
61
|
+
details: err.message,
|
62
|
+
url,
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
exports.socketsCache = new Map();
|
67
|
+
async function getSocket(url) {
|
68
|
+
let socket = exports.socketsCache.get(url);
|
69
|
+
if (socket)
|
70
|
+
return socket;
|
71
|
+
const { schedule } = (0, createBatchScheduler_js_1.createBatchScheduler)({
|
72
|
+
id: url,
|
73
|
+
fn: async () => {
|
74
|
+
const webSocket = new isows_1.WebSocket(url);
|
75
|
+
const requests = new Map();
|
76
|
+
const subscriptions = new Map();
|
77
|
+
const onMessage = ({ data }) => {
|
78
|
+
const message = JSON.parse(data);
|
79
|
+
const isSubscription = message.method === 'eth_subscription';
|
80
|
+
const id = isSubscription ? message.params.subscription : message.id;
|
81
|
+
const cache = isSubscription ? subscriptions : requests;
|
82
|
+
const callback = cache.get(id);
|
83
|
+
if (callback)
|
84
|
+
callback({ data });
|
85
|
+
if (!isSubscription)
|
86
|
+
cache.delete(id);
|
87
|
+
};
|
88
|
+
const onClose = () => {
|
89
|
+
exports.socketsCache.delete(url);
|
90
|
+
webSocket.removeEventListener('close', onClose);
|
91
|
+
webSocket.removeEventListener('message', onMessage);
|
92
|
+
};
|
93
|
+
webSocket.addEventListener('close', onClose);
|
94
|
+
webSocket.addEventListener('message', onMessage);
|
95
|
+
if (webSocket.readyState === isows_1.WebSocket.CONNECTING) {
|
96
|
+
await new Promise((resolve, reject) => {
|
97
|
+
if (!webSocket)
|
98
|
+
return;
|
99
|
+
webSocket.onopen = resolve;
|
100
|
+
webSocket.onerror = reject;
|
101
|
+
});
|
102
|
+
}
|
103
|
+
socket = Object.assign(webSocket, {
|
104
|
+
requests,
|
105
|
+
subscriptions,
|
106
|
+
});
|
107
|
+
exports.socketsCache.set(url, socket);
|
108
|
+
return [socket];
|
109
|
+
},
|
110
|
+
});
|
111
|
+
const [_, [socket_]] = await schedule();
|
112
|
+
return socket_;
|
113
|
+
}
|
114
|
+
exports.getSocket = getSocket;
|
115
|
+
function webSocket(socket, { body, onResponse }) {
|
116
|
+
if (socket.readyState === socket.CLOSED ||
|
117
|
+
socket.readyState === socket.CLOSING)
|
118
|
+
throw new request_js_1.WebSocketRequestError({
|
119
|
+
body,
|
120
|
+
url: socket.url,
|
121
|
+
details: 'Socket is closed.',
|
122
|
+
});
|
123
|
+
const id_ = id++;
|
124
|
+
const callback = ({ data }) => {
|
125
|
+
const message = JSON.parse(data);
|
126
|
+
if (typeof message.id === 'number' && id_ !== message.id)
|
127
|
+
return;
|
128
|
+
onResponse?.(message);
|
129
|
+
if (body.method === 'eth_subscribe' && typeof message.result === 'string') {
|
130
|
+
socket.subscriptions.set(message.result, callback);
|
131
|
+
}
|
132
|
+
if (body.method === 'eth_unsubscribe') {
|
133
|
+
socket.subscriptions.delete(body.params?.[0]);
|
134
|
+
}
|
135
|
+
};
|
136
|
+
socket.requests.set(id_, callback);
|
137
|
+
socket.send(JSON.stringify({ jsonrpc: '2.0', ...body, id: id_ }));
|
138
|
+
return socket;
|
139
|
+
}
|
140
|
+
async function webSocketAsync(socket, { body, timeout = 10000 }) {
|
141
|
+
return (0, withTimeout_js_1.withTimeout)(() => new Promise((onResponse) => exports.rpc.webSocket(socket, {
|
142
|
+
body,
|
143
|
+
onResponse,
|
144
|
+
})), {
|
145
|
+
errorInstance: new request_js_1.TimeoutError({ body, url: socket.url }),
|
146
|
+
timeout,
|
147
|
+
});
|
148
|
+
}
|
149
|
+
exports.rpc = {
|
150
|
+
http,
|
151
|
+
webSocket,
|
152
|
+
webSocketAsync,
|
153
|
+
};
|
154
|
+
//# sourceMappingURL=rpc.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../utils/rpc.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAGjC,qDAM6B;AAE7B,+EAG0C;AAC1C,6DAGiC;AACjC,iDAA0C;AAE1C,IAAI,EAAE,GAAG,CAAC,CAAA;AAgEV,KAAK,UAAU,IAAI,CACjB,GAAW,EACX,EAAE,IAAI,EAAE,YAAY,GAAG,EAAE,EAAE,OAAO,GAAG,KAAM,EAAsB;IAEjE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,CAAA;IACzD,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAW,EAChC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACnB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAChC,GAAG,YAAY;gBACf,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;oBACvB,CAAC,CAAC,IAAA,wBAAS,EACP,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBAClB,OAAO,EAAE,KAAK;wBACd,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE;wBACnB,GAAG,IAAI;qBACR,CAAC,CAAC,CACJ;oBACH,CAAC,CAAC,IAAA,wBAAS,E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AI;QACJ,UAAU;KACX,CAAC,CACH,EACH;QACE,aAAa,EAAE,IAAI,yBAAY,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;QAC1D,OAAO;KACR,CACF,CAAA;AACH,CAAC;AAIY,QAAA,GAAG,GAAG;IACjB,IAAI;IACJ,SAAS;IACT,cAAc;CACf,CAAA"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.compactSignatureToHex = void 0;
|
4
|
+
const secp256k1_1 = require("@noble/curves/secp256k1");
|
5
|
+
const fromHex_js_1 = require("../encoding/fromHex.js");
|
6
|
+
function compactSignatureToHex({ r, yParityAndS, }) {
|
7
|
+
return `0x${new secp256k1_1.secp256k1.Signature((0, fromHex_js_1.hexToBigInt)(r), (0, fromHex_js_1.hexToBigInt)(yParityAndS)).toCompactHex()}`;
|
8
|
+
}
|
9
|
+
exports.compactSignatureToHex = compactSignatureToHex;
|
10
|
+
//# sourceMappingURL=compactSignatureToHex.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"compactSignatureToHex.js","sourceRoot":"","sources":["../../../utils/signature/compactSignatureToHex.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAGnD,uDAA+E;AAiB/E,SAAgB,qBAAqB,CAAC,EACpC,CAAC,EACD,WAAW,GACM;IACjB,OAAO,KAAK,IAAI,qBAAS,CAAC,SAAS,CACjC,IAAA,wBAAW,EAAC,CAAC,CAAC,EACd,IAAA,wBAAW,EAAC,WAAW,CAAC,CACzB,CAAC,YAAY,EAAE,EAAE,CAAA;AACpB,CAAC;AARD,sDAQC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.compactSignatureToSignature = void 0;
|
4
|
+
const toBytes_js_1 = require("../encoding/toBytes.js");
|
5
|
+
const toHex_js_1 = require("../encoding/toHex.js");
|
6
|
+
function compactSignatureToSignature({ r, yParityAndS, }) {
|
7
|
+
const yParityAndS_bytes = (0, toBytes_js_1.hexToBytes)(yParityAndS);
|
8
|
+
const v = yParityAndS_bytes[0] & 0x80 ? 28n : 27n;
|
9
|
+
const s = yParityAndS_bytes;
|
10
|
+
if (v === 28n)
|
11
|
+
s[0] &= 0x7f;
|
12
|
+
return { r, s: (0, toHex_js_1.bytesToHex)(s), v };
|
13
|
+
}
|
14
|
+
exports.compactSignatureToSignature = compactSignatureToSignature;
|
15
|
+
//# sourceMappingURL=compactSignatureToSignature.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"compactSignatureToSignature.js","sourceRoot":"","sources":["../../../utils/signature/compactSignatureToSignature.ts"],"names":[],"mappings":";;;AAEA,uDAA6E;AAC7E,mDAA2E;AAwB3E,SAAgB,2BAA2B,CAAC,EAC1C,CAAC,EACD,WAAW,GACM;IACjB,MAAM,iBAAiB,GAAG,IAAA,uBAAU,EAAC,WAAW,CAAC,CAAA;IACjD,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;IACjD,MAAM,CAAC,GAAG,iBAAiB,CAAA;IAC3B,IAAI,CAAC,KAAK,GAAG;QAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;IAC3B,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,IAAA,qBAAU,EAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;AACnC,CAAC;AATD,kEASC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.hashMessage = void 0;
|
4
|
+
const strings_js_1 = require("../../constants/strings.js");
|
5
|
+
const concat_js_1 = require("../data/concat.js");
|
6
|
+
const toBytes_js_1 = require("../encoding/toBytes.js");
|
7
|
+
const keccak256_js_1 = require("../hash/keccak256.js");
|
8
|
+
function hashMessage(message, to_) {
|
9
|
+
const messageBytes = (() => {
|
10
|
+
if (typeof message === 'string')
|
11
|
+
return (0, toBytes_js_1.stringToBytes)(message);
|
12
|
+
if (message.raw instanceof Uint8Array)
|
13
|
+
return message.raw;
|
14
|
+
return (0, toBytes_js_1.toBytes)(message.raw);
|
15
|
+
})();
|
16
|
+
const prefixBytes = (0, toBytes_js_1.stringToBytes)(`${strings_js_1.presignMessagePrefix}${messageBytes.length}`);
|
17
|
+
return (0, keccak256_js_1.keccak256)((0, concat_js_1.concat)([prefixBytes, messageBytes]), to_);
|
18
|
+
}
|
19
|
+
exports.hashMessage = hashMessage;
|
20
|
+
//# sourceMappingURL=hashMessage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hashMessage.js","sourceRoot":"","sources":["../../../utils/signature/hashMessage.ts"],"names":[],"mappings":";;;AAAA,2DAAiE;AAGjE,iDAAgE;AAChE,uDAK+B;AAC/B,uDAAyE;AAezE,SAAgB,WAAW,CACzB,OAAwB,EACxB,GAAS;IAET,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE;QACzB,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,IAAA,0BAAa,EAAC,OAAO,CAAC,CAAA;QAC9D,IAAI,OAAO,CAAC,GAAG,YAAY,UAAU;YAAE,OAAO,OAAO,CAAC,GAAG,CAAA;QACzD,OAAO,IAAA,oBAAO,EAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC7B,CAAC,CAAC,EAAE,CAAA;IACJ,MAAM,WAAW,GAAG,IAAA,0BAAa,EAC/B,GAAG,iCAAoB,GAAG,YAAY,CAAC,MAAM,EAAE,CAChD,CAAA;IACD,OAAO,IAAA,wBAAS,EAAC,IAAA,kBAAM,EAAC,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AAC5D,CAAC;AAbD,kCAaC"}
|
@@ -0,0 +1,124 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.hashDomain = exports.hashTypedData = void 0;
|
4
|
+
const encodeAbiParameters_js_1 = require("../abi/encodeAbiParameters.js");
|
5
|
+
const concat_js_1 = require("../data/concat.js");
|
6
|
+
const toHex_js_1 = require("../encoding/toHex.js");
|
7
|
+
const keccak256_js_1 = require("../hash/keccak256.js");
|
8
|
+
const typedData_js_1 = require("../typedData.js");
|
9
|
+
function hashTypedData(parameters) {
|
10
|
+
const { domain = {}, message, primaryType, } = parameters;
|
11
|
+
const types = {
|
12
|
+
EIP712Domain: (0, typedData_js_1.getTypesForEIP712Domain)({ domain }),
|
13
|
+
...parameters.types,
|
14
|
+
};
|
15
|
+
(0, typedData_js_1.validateTypedData)({
|
16
|
+
domain,
|
17
|
+
message,
|
18
|
+
primaryType,
|
19
|
+
types,
|
20
|
+
});
|
21
|
+
const parts = ['0x1901'];
|
22
|
+
if (domain)
|
23
|
+
parts.push(hashDomain({
|
24
|
+
domain,
|
25
|
+
types: types,
|
26
|
+
}));
|
27
|
+
if (primaryType !== 'EIP712Domain')
|
28
|
+
parts.push(hashStruct({
|
29
|
+
data: message,
|
30
|
+
primaryType,
|
31
|
+
types: types,
|
32
|
+
}));
|
33
|
+
return (0, keccak256_js_1.keccak256)((0, concat_js_1.concat)(parts));
|
34
|
+
}
|
35
|
+
exports.hashTypedData = hashTypedData;
|
36
|
+
function hashDomain({ domain, types, }) {
|
37
|
+
return hashStruct({
|
38
|
+
data: domain,
|
39
|
+
primaryType: 'EIP712Domain',
|
40
|
+
types,
|
41
|
+
});
|
42
|
+
}
|
43
|
+
exports.hashDomain = hashDomain;
|
44
|
+
function hashStruct({ data, primaryType, types, }) {
|
45
|
+
const encoded = encodeData({
|
46
|
+
data,
|
47
|
+
primaryType,
|
48
|
+
types,
|
49
|
+
});
|
50
|
+
return (0, keccak256_js_1.keccak256)(encoded);
|
51
|
+
}
|
52
|
+
function encodeData({ data, primaryType, types, }) {
|
53
|
+
const encodedTypes = [{ type: 'bytes32' }];
|
54
|
+
const encodedValues = [hashType({ primaryType, types })];
|
55
|
+
for (const field of types[primaryType]) {
|
56
|
+
const [type, value] = encodeField({
|
57
|
+
types,
|
58
|
+
name: field.name,
|
59
|
+
type: field.type,
|
60
|
+
value: data[field.name],
|
61
|
+
});
|
62
|
+
encodedTypes.push(type);
|
63
|
+
encodedValues.push(value);
|
64
|
+
}
|
65
|
+
return (0, encodeAbiParameters_js_1.encodeAbiParameters)(encodedTypes, encodedValues);
|
66
|
+
}
|
67
|
+
function hashType({ primaryType, types, }) {
|
68
|
+
const encodedHashType = (0, toHex_js_1.toHex)(encodeType({ primaryType, types }));
|
69
|
+
return (0, keccak256_js_1.keccak256)(encodedHashType);
|
70
|
+
}
|
71
|
+
function encodeType({ primaryType, types, }) {
|
72
|
+
let result = '';
|
73
|
+
const unsortedDeps = findTypeDependencies({ primaryType, types });
|
74
|
+
unsortedDeps.delete(primaryType);
|
75
|
+
const deps = [primaryType, ...Array.from(unsortedDeps).sort()];
|
76
|
+
for (const type of deps) {
|
77
|
+
result += `${type}(${types[type]
|
78
|
+
.map(({ name, type: t }) => `${t} ${name}`)
|
79
|
+
.join(',')})`;
|
80
|
+
}
|
81
|
+
return result;
|
82
|
+
}
|
83
|
+
function findTypeDependencies({ primaryType: primaryType_, types, }, results = new Set()) {
|
84
|
+
const match = primaryType_.match(/^\w*/u);
|
85
|
+
const primaryType = match?.[0];
|
86
|
+
if (results.has(primaryType) || types[primaryType] === undefined) {
|
87
|
+
return results;
|
88
|
+
}
|
89
|
+
results.add(primaryType);
|
90
|
+
for (const field of types[primaryType]) {
|
91
|
+
findTypeDependencies({ primaryType: field.type, types }, results);
|
92
|
+
}
|
93
|
+
return results;
|
94
|
+
}
|
95
|
+
function encodeField({ types, name, type, value, }) {
|
96
|
+
if (types[type] !== undefined) {
|
97
|
+
return [
|
98
|
+
{ type: 'bytes32' },
|
99
|
+
(0, keccak256_js_1.keccak256)(encodeData({ data: value, primaryType: type, types })),
|
100
|
+
];
|
101
|
+
}
|
102
|
+
if (type === 'bytes') {
|
103
|
+
const prepend = value.length % 2 ? '0' : '';
|
104
|
+
value = `0x${prepend + value.slice(2)}`;
|
105
|
+
return [{ type: 'bytes32' }, (0, keccak256_js_1.keccak256)(value)];
|
106
|
+
}
|
107
|
+
if (type === 'string')
|
108
|
+
return [{ type: 'bytes32' }, (0, keccak256_js_1.keccak256)((0, toHex_js_1.toHex)(value))];
|
109
|
+
if (type.lastIndexOf(']') === type.length - 1) {
|
110
|
+
const parsedType = type.slice(0, type.lastIndexOf('['));
|
111
|
+
const typeValuePairs = value.map((item) => encodeField({
|
112
|
+
name,
|
113
|
+
type: parsedType,
|
114
|
+
types,
|
115
|
+
value: item,
|
116
|
+
}));
|
117
|
+
return [
|
118
|
+
{ type: 'bytes32' },
|
119
|
+
(0, keccak256_js_1.keccak256)((0, encodeAbiParameters_js_1.encodeAbiParameters)(typeValuePairs.map(([t]) => t), typeValuePairs.map(([, v]) => v))),
|
120
|
+
];
|
121
|
+
}
|
122
|
+
return [{ type }, value];
|
123
|
+
}
|
124
|
+
//# sourceMappingURL=hashTypedData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hashTypedData.js","sourceRoot":"","sources":["../../../utils/signature/hashTypedData.ts"],"names":[],"mappings":";;;AAOA,0EAGsC;AACtC,iDAA0C;AAC1C,mDAAiE;AACjE,uDAAyE;AACzE,kDAKwB;AAqBxB,SAAgB,aAAa,CAI3B,UAA2D;IAE3D,MAAM,EACJ,MAAM,GAAG,EAAE,EACX,OAAO,EACP,WAAW,GACZ,GAAG,UAAqC,CAAA;IACzC,MAAM,KAAK,GAAG;QACZ,YAAY,EAAE,IAAA,sCAAuB,EAAC,EAAE,MAAM,EAAE,CAAC;QACjD,GAAG,UAAU,CAAC,KAAK;KACpB,CAAA;IAID,IAAA,gCAAiB,EAAC;QAChB,MAAM;QAC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,EAAE,SAAS,EAAE,EAAE,IAAA,wBAAS,EAAC,IAAA,gBAAK,EAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAE5E,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QACvD,MAAM,cAAc,GAAI,KAA+B,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACnE,WAAW,CAAC;YACV,IAAI;YACJ,IAAI,EAAE,UAAU;YAChB,KAAK;YACL,KAAK,EAAE,IAAI;SACZ,CAAC,CACH,CAAA;QACD,OAAO;YACL,EAAE,IAAI,EAAE,SAAS,EAAE;YACnB,IAAA,wBAAS,EACP,IAAA,4CAAmB,EACjB,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAC9B,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CACjC,CACF;SACF,CAAA;KACF;IAED,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.hexToCompactSignature = void 0;
|
4
|
+
const secp256k1_1 = require("@noble/curves/secp256k1");
|
5
|
+
const toHex_js_1 = require("../../utils/encoding/toHex.js");
|
6
|
+
function hexToCompactSignature(signatureHex) {
|
7
|
+
const { r, s } = secp256k1_1.secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));
|
8
|
+
return {
|
9
|
+
r: (0, toHex_js_1.numberToHex)(r, { size: 32 }),
|
10
|
+
yParityAndS: (0, toHex_js_1.numberToHex)(s, { size: 32 }),
|
11
|
+
};
|
12
|
+
}
|
13
|
+
exports.hexToCompactSignature = hexToCompactSignature;
|
14
|
+
//# sourceMappingURL=hexToCompactSignature.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hexToCompactSignature.js","sourceRoot":"","sources":["../../../utils/signature/hexToCompactSignature.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAInD,4DAGsC;AActC,SAAgB,qBAAqB,CAAC,YAAiB;IACrD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,qBAAS,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;IAC5E,OAAO;QACL,CAAC,EAAE,IAAA,sBAAW,EAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC/B,WAAW,EAAE,IAAA,sBAAW,EAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;KAC1C,CAAA;AACH,CAAC;AAND,sDAMC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.hexToSignature = void 0;
|
4
|
+
const secp256k1_1 = require("@noble/curves/secp256k1");
|
5
|
+
const toHex_js_1 = require("../../utils/encoding/toHex.js");
|
6
|
+
function hexToSignature(signatureHex) {
|
7
|
+
const { r, s } = secp256k1_1.secp256k1.Signature.fromCompact(signatureHex.slice(2, 130));
|
8
|
+
const v = BigInt(`0x${signatureHex.slice(130)}`);
|
9
|
+
return { r: (0, toHex_js_1.numberToHex)(r, { size: 32 }), s: (0, toHex_js_1.numberToHex)(s, { size: 32 }), v };
|
10
|
+
}
|
11
|
+
exports.hexToSignature = hexToSignature;
|
12
|
+
//# sourceMappingURL=hexToSignature.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hexToSignature.js","sourceRoot":"","sources":["../../../utils/signature/hexToSignature.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAInD,4DAGsC;AActC,SAAgB,cAAc,CAAC,YAAiB;IAC9C,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,qBAAS,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;IAC5E,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAChD,OAAO,EAAE,CAAC,EAAE,IAAA,sBAAW,EAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,IAAA,sBAAW,EAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;AAChF,CAAC;AAJD,wCAIC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.recoverAddress = void 0;
|
4
|
+
const publicKeyToAddress_js_1 = require("../../accounts/utils/publicKeyToAddress.js");
|
5
|
+
const recoverPublicKey_js_1 = require("./recoverPublicKey.js");
|
6
|
+
async function recoverAddress({ hash, signature, }) {
|
7
|
+
return (0, publicKeyToAddress_js_1.publicKeyToAddress)(await (0, recoverPublicKey_js_1.recoverPublicKey)({ hash: hash, signature }));
|
8
|
+
}
|
9
|
+
exports.recoverAddress = recoverAddress;
|
10
|
+
//# sourceMappingURL=recoverAddress.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"recoverAddress.js","sourceRoot":"","sources":["../../../utils/signature/recoverAddress.ts"],"names":[],"mappings":";;;AAEA,sFAA+E;AAI/E,+DAAwD;AAWjD,KAAK,UAAU,cAAc,CAAC,EACnC,IAAI,EACJ,SAAS,GACgB;IACzB,OAAO,IAAA,0CAAkB,EAAC,MAAM,IAAA,sCAAgB,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;AAC9E,CAAC;AALD,wCAKC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.recoverMessageAddress = void 0;
|
4
|
+
const hashMessage_js_1 = require("./hashMessage.js");
|
5
|
+
const recoverAddress_js_1 = require("./recoverAddress.js");
|
6
|
+
async function recoverMessageAddress({ message, signature, }) {
|
7
|
+
return (0, recoverAddress_js_1.recoverAddress)({ hash: (0, hashMessage_js_1.hashMessage)(message), signature });
|
8
|
+
}
|
9
|
+
exports.recoverMessageAddress = recoverMessageAddress;
|
10
|
+
//# sourceMappingURL=recoverMessageAddress.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"recoverMessageAddress.js","sourceRoot":"","sources":["../../../utils/signature/recoverMessageAddress.ts"],"names":[],"mappings":";;;AAKA,qDAAyE;AACzE,2DAG4B;AAcrB,KAAK,UAAU,qBAAqB,CAAC,EAC1C,OAAO,EACP,SAAS,GACuB;IAChC,OAAO,IAAA,kCAAc,EAAC,EAAE,IAAI,EAAE,IAAA,4BAAW,EAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;AAClE,CAAC;AALD,sDAKC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.recoverPublicKey = void 0;
|
4
|
+
const isHex_js_1 = require("../data/isHex.js");
|
5
|
+
const fromHex_js_1 = require("../encoding/fromHex.js");
|
6
|
+
const toHex_js_1 = require("../encoding/toHex.js");
|
7
|
+
async function recoverPublicKey({ hash, signature, }) {
|
8
|
+
const signatureHex = (0, isHex_js_1.isHex)(signature) ? signature : (0, toHex_js_1.toHex)(signature);
|
9
|
+
const hashHex = (0, isHex_js_1.isHex)(hash) ? hash : (0, toHex_js_1.toHex)(hash);
|
10
|
+
let v = (0, fromHex_js_1.hexToNumber)(`0x${signatureHex.slice(130)}`);
|
11
|
+
if (v === 0 || v === 1)
|
12
|
+
v += 27;
|
13
|
+
const { secp256k1 } = await Promise.resolve().then(() => require('@noble/curves/secp256k1'));
|
14
|
+
const publicKey = secp256k1.Signature.fromCompact(signatureHex.substring(2, 130))
|
15
|
+
.addRecoveryBit(v - 27)
|
16
|
+
.recoverPublicKey(hashHex.substring(2))
|
17
|
+
.toHex(false);
|
18
|
+
return `0x${publicKey}`;
|
19
|
+
}
|
20
|
+
exports.recoverPublicKey = recoverPublicKey;
|
21
|
+
//# sourceMappingURL=recoverPublicKey.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"recoverPublicKey.js","sourceRoot":"","sources":["../../../utils/signature/recoverPublicKey.ts"],"names":[],"mappings":";;;AAEA,+CAA6D;AAC7D,uDAA+E;AAC/E,mDAA4C;AAcrC,KAAK,UAAU,gBAAgB,CAAC,EACrC,IAAI,EACJ,SAAS,GACkB;IAC3B,MAAM,YAAY,GAAG,IAAA,gBAAK,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,gBAAK,EAAC,SAAS,CAAC,CAAA;IACpE,MAAM,OAAO,GAAG,IAAA,gBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,gBAAK,EAAC,IAAI,CAAC,CAAA;IAIhD,IAAI,CAAC,GAAG,IAAA,wBAAW,EAAC,KAAK,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACnD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,CAAC,IAAI,EAAE,CAAA;IAE/B,MAAM,EAAE,SAAS,EAAE,GAAG,2CAAa,yBAAyB,EAAC,CAAA;IAC7D,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,WAAW,CAC/C,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAC/B;SACE,cAAc,CAAC,CAAC,GAAG,EAAE,CAAC;SACtB,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SACtC,KAAK,CAAC,KAAK,CAAC,CAAA;IACf,OAAO,KAAK,SAAS,EAAE,CAAA;AACzB,CAAC;AApBD,4CAoBC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.recoverTypedDataAddress = void 0;
|
4
|
+
const hashTypedData_js_1 = require("./hashTypedData.js");
|
5
|
+
const recoverAddress_js_1 = require("./recoverAddress.js");
|
6
|
+
async function recoverTypedDataAddress(parameters) {
|
7
|
+
const { domain, message, primaryType, signature, types } = parameters;
|
8
|
+
return (0, recoverAddress_js_1.recoverAddress)({
|
9
|
+
hash: (0, hashTypedData_js_1.hashTypedData)({
|
10
|
+
domain,
|
11
|
+
message,
|
12
|
+
primaryType,
|
13
|
+
types,
|
14
|
+
}),
|
15
|
+
signature,
|
16
|
+
});
|
17
|
+
}
|
18
|
+
exports.recoverTypedDataAddress = recoverTypedDataAddress;
|
19
|
+
//# sourceMappingURL=recoverTypedDataAddress.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"recoverTypedDataAddress.js","sourceRoot":"","sources":["../../../utils/signature/recoverTypedDataAddress.ts"],"names":[],"mappings":";;;AAMA,yDAA+E;AAC/E,2DAG4B;AAgBrB,KAAK,UAAU,uBAAuB,CAI3C,UAAqE;IAErE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,GACtD,UAA0D,CAAA;IAC5D,OAAO,IAAA,kCAAc,EAAC;QACpB,IAAI,EAAE,IAAA,gCAAa,EAAC;YAClB,MAAM;YACN,OAAO;YACP,WAAW;YACX,KAAK;SACN,CAAC;QACF,SAAS;KACV,CAAC,CAAA;AACJ,CAAC;AAjBD,0DAiBC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.signatureToCompactSignature = void 0;
|
4
|
+
const index_js_1 = require("../index.js");
|
5
|
+
function signatureToCompactSignature(signature) {
|
6
|
+
const { r, s, v } = signature;
|
7
|
+
const yParity = v - 27n;
|
8
|
+
let yParityAndS = s;
|
9
|
+
if (yParity === 1n) {
|
10
|
+
const bytes = (0, index_js_1.hexToBytes)(s);
|
11
|
+
bytes[0] |= 0x80;
|
12
|
+
yParityAndS = (0, index_js_1.bytesToHex)(bytes);
|
13
|
+
}
|
14
|
+
return { r, yParityAndS };
|
15
|
+
}
|
16
|
+
exports.signatureToCompactSignature = signatureToCompactSignature;
|
17
|
+
//# sourceMappingURL=signatureToCompactSignature.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"signatureToCompactSignature.js","sourceRoot":"","sources":["../../../utils/signature/signatureToCompactSignature.ts"],"names":[],"mappings":";;;AAEA,0CAKoB;AAwBpB,SAAgB,2BAA2B,CACzC,SAAoB;IAEpB,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,CAAA;IAC7B,MAAM,OAAO,GAAG,CAAC,GAAG,GAAG,CAAA;IACvB,IAAI,WAAW,GAAG,CAAC,CAAA;IACnB,IAAI,OAAO,KAAK,EAAE,EAAE;QAClB,MAAM,KAAK,GAAG,IAAA,qBAAU,EAAC,CAAC,CAAC,CAAA;QAC3B,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;QAChB,WAAW,GAAG,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAA;KAChC;IACD,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,CAAA;AAC3B,CAAC;AAZD,kEAYC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.signatureToHex = void 0;
|
4
|
+
const secp256k1_1 = require("@noble/curves/secp256k1");
|
5
|
+
const fromHex_js_1 = require("../../utils/encoding/fromHex.js");
|
6
|
+
const toHex_js_1 = require("../../utils/encoding/toHex.js");
|
7
|
+
function signatureToHex({ r, s, v }) {
|
8
|
+
return `0x${new secp256k1_1.secp256k1.Signature((0, fromHex_js_1.hexToBigInt)(r), (0, fromHex_js_1.hexToBigInt)(s)).toCompactHex()}${(0, toHex_js_1.toHex)(v).slice(2)}`;
|
9
|
+
}
|
10
|
+
exports.signatureToHex = signatureToHex;
|
11
|
+
//# sourceMappingURL=signatureToHex.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"signatureToHex.js","sourceRoot":"","sources":["../../../utils/signature/signatureToHex.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAInD,gEAGwC;AACxC,4DAA0E;AAqB1E,SAAgB,cAAc,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAa;IACnD,OAAO,KAAK,IAAI,qBAAS,CAAC,SAAS,CACjC,IAAA,wBAAW,EAAC,CAAC,CAAC,EACd,IAAA,wBAAW,EAAC,CAAC,CAAC,CACf,CAAC,YAAY,EAAE,GAAG,IAAA,gBAAK,EAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;AACxC,CAAC;AALD,wCAKC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.verifyMessage = void 0;
|
4
|
+
const getAddress_js_1 = require("../address/getAddress.js");
|
5
|
+
const isAddressEqual_js_1 = require("../address/isAddressEqual.js");
|
6
|
+
const recoverMessageAddress_js_1 = require("./recoverMessageAddress.js");
|
7
|
+
async function verifyMessage({ address, message, signature, }) {
|
8
|
+
return (0, isAddressEqual_js_1.isAddressEqual)((0, getAddress_js_1.getAddress)(address), await (0, recoverMessageAddress_js_1.recoverMessageAddress)({ message, signature }));
|
9
|
+
}
|
10
|
+
exports.verifyMessage = verifyMessage;
|
11
|
+
//# sourceMappingURL=verifyMessage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"verifyMessage.js","sourceRoot":"","sources":["../../../utils/signature/verifyMessage.ts"],"names":[],"mappings":";;;AAGA,4DAA+E;AAC/E,oEAGqC;AAGrC,yEAGmC;AA+B5B,KAAK,UAAU,aAAa,CAAC,EAClC,OAAO,EACP,OAAO,EACP,SAAS,GACe;IACxB,OAAO,IAAA,kCAAc,EACnB,IAAA,0BAAU,EAAC,OAAO,CAAC,EACnB,MAAM,IAAA,gDAAqB,EAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CACpD,CAAA;AACH,CAAC;AATD,sCASC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.verifyTypedData = void 0;
|
4
|
+
const getAddress_js_1 = require("../address/getAddress.js");
|
5
|
+
const isAddressEqual_js_1 = require("../address/isAddressEqual.js");
|
6
|
+
const recoverTypedDataAddress_js_1 = require("./recoverTypedDataAddress.js");
|
7
|
+
async function verifyTypedData(parameters) {
|
8
|
+
const { address, domain, message, primaryType, signature, types } = parameters;
|
9
|
+
return (0, isAddressEqual_js_1.isAddressEqual)((0, getAddress_js_1.getAddress)(address), await (0, recoverTypedDataAddress_js_1.recoverTypedDataAddress)({
|
10
|
+
domain,
|
11
|
+
message,
|
12
|
+
primaryType,
|
13
|
+
signature,
|
14
|
+
types,
|
15
|
+
}));
|
16
|
+
}
|
17
|
+
exports.verifyTypedData = verifyTypedData;
|
18
|
+
//# sourceMappingURL=verifyTypedData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"verifyTypedData.js","sourceRoot":"","sources":["../../../utils/signature/verifyTypedData.ts"],"names":[],"mappings":";;;AAIA,4DAA+E;AAC/E,oEAGqC;AAGrC,6EAGqC;AAgC9B,KAAK,UAAU,eAAe,CAInC,UAA6D;IAE7D,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,GAC/D,UAAkD,CAAA;IACpD,OAAO,IAAA,kCAAc,EACnB,IAAA,0BAAU,EAAC,OAAO,CAAC,EACnB,MAAM,IAAA,oDAAuB,EAAC;QAC5B,MAAM;QACN,OAAO;QACP,WAAW;QACX,SAAS;QACT,KAAK;KAC+B,CAAC,CACxC,CAAA;AACH,CAAC;AAlBD,0CAkBC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.stringify = void 0;
|
4
|
+
const stringify = (value, replacer, space) => JSON.stringify(value, (key, value_) => {
|
5
|
+
const value = typeof value_ === 'bigint' ? value_.toString() : value_;
|
6
|
+
return typeof replacer === 'function' ? replacer(key, value) : value;
|
7
|
+
}, space);
|
8
|
+
exports.stringify = stringify;
|
9
|
+
//# sourceMappingURL=stringify.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stringify.js","sourceRoot":"","sources":["../../utils/stringify.ts"],"names":[],"mappings":";;;AAIO,MAAM,SAAS,GAA0B,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CACzE,IAAI,CAAC,SAAS,CACZ,KAAK,EACL,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;IACd,MAAM,KAAK,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;IACrE,OAAO,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AACtE,CAAC,EACD,KAAK,CACN,CAAA;AARU,QAAA,SAAS,aAQnB"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.assertRequest = void 0;
|
4
|
+
const parseAccount_js_1 = require("../../accounts/utils/parseAccount.js");
|
5
|
+
const address_js_1 = require("../../errors/address.js");
|
6
|
+
const node_js_1 = require("../../errors/node.js");
|
7
|
+
const transaction_js_1 = require("../../errors/transaction.js");
|
8
|
+
const isAddress_js_1 = require("../address/isAddress.js");
|
9
|
+
function assertRequest(args) {
|
10
|
+
const { account: account_, gasPrice, maxFeePerGas, maxPriorityFeePerGas, to, } = args;
|
11
|
+
const account = account_ ? (0, parseAccount_js_1.parseAccount)(account_) : undefined;
|
12
|
+
if (account && !(0, isAddress_js_1.isAddress)(account.address))
|
13
|
+
throw new address_js_1.InvalidAddressError({ address: account.address });
|
14
|
+
if (to && !(0, isAddress_js_1.isAddress)(to))
|
15
|
+
throw new address_js_1.InvalidAddressError({ address: to });
|
16
|
+
if (typeof gasPrice !== 'undefined' &&
|
17
|
+
(typeof maxFeePerGas !== 'undefined' ||
|
18
|
+
typeof maxPriorityFeePerGas !== 'undefined'))
|
19
|
+
throw new transaction_js_1.FeeConflictError();
|
20
|
+
if (maxFeePerGas && maxFeePerGas > 2n ** 256n - 1n)
|
21
|
+
throw new node_js_1.FeeCapTooHighError({ maxFeePerGas });
|
22
|
+
if (maxPriorityFeePerGas &&
|
23
|
+
maxFeePerGas &&
|
24
|
+
maxPriorityFeePerGas > maxFeePerGas)
|
25
|
+
throw new node_js_1.TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas });
|
26
|
+
}
|
27
|
+
exports.assertRequest = assertRequest;
|
28
|
+
//# sourceMappingURL=assertRequest.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"assertRequest.js","sourceRoot":"","sources":["../../../utils/transaction/assertRequest.ts"],"names":[],"mappings":";;;AAAA,0EAG6C;AAE7C,wDAGgC;AAChC,kDAK6B;AAC7B,gEAGoC;AAGpC,0DAAmD;AAYnD,SAAgB,aAAa,CAAC,IAA6B;IACzD,MAAM,EACJ,OAAO,EAAE,QAAQ,EACjB,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,EAAE,GACH,GAAG,IAAI,CAAA;IACR,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAA,8BAAY,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7D,IAAI,OAAO,IAAI,CAAC,IAAA,wBAAS,EAAC,OAAO,CAAC,OAAO,CAAC;QACxC,MAAM,IAAI,gCAAmB,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;IAC7D,IAAI,EAAE,IAAI,CAAC,IAAA,wBAAS,EAAC,EAAE,CAAC;QAAE,MAAM,IAAI,gCAAmB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;IACxE,IACE,OAAO,QAAQ,KAAK,WAAW;QAC/B,CAAC,OAAO,YAAY,KAAK,WAAW;YAClC,OAAO,oBAAoB,KAAK,WAAW,CAAC;QAE9C,MAAM,IAAI,iCAAgB,EAAE,CAAA;IAE9B,IAAI,YAAY,IAAI,YAAY,GAAG,EAAE,IAAI,IAAI,GAAG,EAAE;QAChD,MAAM,IAAI,4BAAkB,CAAC,EAAE,YAAY,EAAE,CAAC,CAAA;IAChD,IACE,oBAAoB;QACpB,YAAY;QACZ,oBAAoB,GAAG,YAAY;QAEnC,MAAM,IAAI,6BAAmB,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC,CAAA;AACzE,CAAC;AA3BD,sCA2BC"}
|