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,211 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getArrayComponents = exports.encodeAbiParameters = void 0;
|
4
|
+
const abi_js_1 = require("../../errors/abi.js");
|
5
|
+
const address_js_1 = require("../../errors/address.js");
|
6
|
+
const isAddress_js_1 = require("../address/isAddress.js");
|
7
|
+
const concat_js_1 = require("../data/concat.js");
|
8
|
+
const pad_js_1 = require("../data/pad.js");
|
9
|
+
const size_js_1 = require("../data/size.js");
|
10
|
+
const slice_js_1 = require("../data/slice.js");
|
11
|
+
const toHex_js_1 = require("../encoding/toHex.js");
|
12
|
+
function encodeAbiParameters(params, values) {
|
13
|
+
if (params.length !== values.length)
|
14
|
+
throw new abi_js_1.AbiEncodingLengthMismatchError({
|
15
|
+
expectedLength: params.length,
|
16
|
+
givenLength: values.length,
|
17
|
+
});
|
18
|
+
const preparedParams = prepareParams({
|
19
|
+
params: params,
|
20
|
+
values,
|
21
|
+
});
|
22
|
+
const data = encodeParams(preparedParams);
|
23
|
+
if (data.length === 0)
|
24
|
+
return '0x';
|
25
|
+
return data;
|
26
|
+
}
|
27
|
+
exports.encodeAbiParameters = encodeAbiParameters;
|
28
|
+
function prepareParams({ params, values, }) {
|
29
|
+
const preparedParams = [];
|
30
|
+
for (let i = 0; i < params.length; i++) {
|
31
|
+
preparedParams.push(prepareParam({ param: params[i], value: values[i] }));
|
32
|
+
}
|
33
|
+
return preparedParams;
|
34
|
+
}
|
35
|
+
function prepareParam({ param, value, }) {
|
36
|
+
const arrayComponents = getArrayComponents(param.type);
|
37
|
+
if (arrayComponents) {
|
38
|
+
const [length, type] = arrayComponents;
|
39
|
+
return encodeArray(value, { length, param: { ...param, type } });
|
40
|
+
}
|
41
|
+
if (param.type === 'tuple') {
|
42
|
+
return encodeTuple(value, {
|
43
|
+
param: param,
|
44
|
+
});
|
45
|
+
}
|
46
|
+
if (param.type === 'address') {
|
47
|
+
return encodeAddress(value);
|
48
|
+
}
|
49
|
+
if (param.type === 'bool') {
|
50
|
+
return encodeBool(value);
|
51
|
+
}
|
52
|
+
if (param.type.startsWith('uint') || param.type.startsWith('int')) {
|
53
|
+
const signed = param.type.startsWith('int');
|
54
|
+
return encodeNumber(value, { signed });
|
55
|
+
}
|
56
|
+
if (param.type.startsWith('bytes')) {
|
57
|
+
return encodeBytes(value, { param });
|
58
|
+
}
|
59
|
+
if (param.type === 'string') {
|
60
|
+
return encodeString(value);
|
61
|
+
}
|
62
|
+
throw new abi_js_1.InvalidAbiEncodingTypeError(param.type, {
|
63
|
+
docsPath: '/docs/contract/encodeAbiParameters',
|
64
|
+
});
|
65
|
+
}
|
66
|
+
function encodeParams(preparedParams) {
|
67
|
+
let staticSize = 0;
|
68
|
+
for (let i = 0; i < preparedParams.length; i++) {
|
69
|
+
const { dynamic, encoded } = preparedParams[i];
|
70
|
+
if (dynamic)
|
71
|
+
staticSize += 32;
|
72
|
+
else
|
73
|
+
staticSize += (0, size_js_1.size)(encoded);
|
74
|
+
}
|
75
|
+
const staticParams = [];
|
76
|
+
const dynamicParams = [];
|
77
|
+
let dynamicSize = 0;
|
78
|
+
for (let i = 0; i < preparedParams.length; i++) {
|
79
|
+
const { dynamic, encoded } = preparedParams[i];
|
80
|
+
if (dynamic) {
|
81
|
+
staticParams.push((0, toHex_js_1.numberToHex)(staticSize + dynamicSize, { size: 32 }));
|
82
|
+
dynamicParams.push(encoded);
|
83
|
+
dynamicSize += (0, size_js_1.size)(encoded);
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
staticParams.push(encoded);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
return (0, concat_js_1.concat)([...staticParams, ...dynamicParams]);
|
90
|
+
}
|
91
|
+
function encodeAddress(value) {
|
92
|
+
if (!(0, isAddress_js_1.isAddress)(value))
|
93
|
+
throw new address_js_1.InvalidAddressError({ address: value });
|
94
|
+
return { dynamic: false, encoded: (0, pad_js_1.padHex)(value.toLowerCase()) };
|
95
|
+
}
|
96
|
+
function encodeArray(value, { length, param, }) {
|
97
|
+
const dynamic = length === null;
|
98
|
+
if (!Array.isArray(value))
|
99
|
+
throw new abi_js_1.InvalidArrayError(value);
|
100
|
+
if (!dynamic && value.length !== length)
|
101
|
+
throw new abi_js_1.AbiEncodingArrayLengthMismatchError({
|
102
|
+
expectedLength: length,
|
103
|
+
givenLength: value.length,
|
104
|
+
type: `${param.type}[${length}]`,
|
105
|
+
});
|
106
|
+
let dynamicChild = false;
|
107
|
+
const preparedParams = [];
|
108
|
+
for (let i = 0; i < value.length; i++) {
|
109
|
+
const preparedParam = prepareParam({ param, value: value[i] });
|
110
|
+
if (preparedParam.dynamic)
|
111
|
+
dynamicChild = true;
|
112
|
+
preparedParams.push(preparedParam);
|
113
|
+
}
|
114
|
+
if (dynamic || dynamicChild) {
|
115
|
+
const data = encodeParams(preparedParams);
|
116
|
+
if (dynamic) {
|
117
|
+
const length = (0, toHex_js_1.numberToHex)(preparedParams.length, { size: 32 });
|
118
|
+
return {
|
119
|
+
dynamic: true,
|
120
|
+
encoded: preparedParams.length > 0 ? (0, concat_js_1.concat)([length, data]) : length,
|
121
|
+
};
|
122
|
+
}
|
123
|
+
if (dynamicChild)
|
124
|
+
return { dynamic: true, encoded: data };
|
125
|
+
}
|
126
|
+
return {
|
127
|
+
dynamic: false,
|
128
|
+
encoded: (0, concat_js_1.concat)(preparedParams.map(({ encoded }) => encoded)),
|
129
|
+
};
|
130
|
+
}
|
131
|
+
function encodeBytes(value, { param }) {
|
132
|
+
const [, paramSize] = param.type.split('bytes');
|
133
|
+
const bytesSize = (0, size_js_1.size)(value);
|
134
|
+
if (!paramSize) {
|
135
|
+
let value_ = value;
|
136
|
+
if (bytesSize % 32 !== 0)
|
137
|
+
value_ = (0, pad_js_1.padHex)(value_, {
|
138
|
+
dir: 'right',
|
139
|
+
size: Math.ceil((value.length - 2) / 2 / 32) * 32,
|
140
|
+
});
|
141
|
+
return {
|
142
|
+
dynamic: true,
|
143
|
+
encoded: (0, concat_js_1.concat)([(0, pad_js_1.padHex)((0, toHex_js_1.numberToHex)(bytesSize, { size: 32 })), value_]),
|
144
|
+
};
|
145
|
+
}
|
146
|
+
if (bytesSize !== parseInt(paramSize))
|
147
|
+
throw new abi_js_1.AbiEncodingBytesSizeMismatchError({
|
148
|
+
expectedSize: parseInt(paramSize),
|
149
|
+
value,
|
150
|
+
});
|
151
|
+
return { dynamic: false, encoded: (0, pad_js_1.padHex)(value, { dir: 'right' }) };
|
152
|
+
}
|
153
|
+
function encodeBool(value) {
|
154
|
+
return { dynamic: false, encoded: (0, pad_js_1.padHex)((0, toHex_js_1.boolToHex)(value)) };
|
155
|
+
}
|
156
|
+
function encodeNumber(value, { signed }) {
|
157
|
+
return {
|
158
|
+
dynamic: false,
|
159
|
+
encoded: (0, toHex_js_1.numberToHex)(value, {
|
160
|
+
size: 32,
|
161
|
+
signed,
|
162
|
+
}),
|
163
|
+
};
|
164
|
+
}
|
165
|
+
function encodeString(value) {
|
166
|
+
const hexValue = (0, toHex_js_1.stringToHex)(value);
|
167
|
+
const partsLength = Math.ceil((0, size_js_1.size)(hexValue) / 32);
|
168
|
+
const parts = [];
|
169
|
+
for (let i = 0; i < partsLength; i++) {
|
170
|
+
parts.push((0, pad_js_1.padHex)((0, slice_js_1.slice)(hexValue, i * 32, (i + 1) * 32), {
|
171
|
+
dir: 'right',
|
172
|
+
}));
|
173
|
+
}
|
174
|
+
return {
|
175
|
+
dynamic: true,
|
176
|
+
encoded: (0, concat_js_1.concat)([
|
177
|
+
(0, pad_js_1.padHex)((0, toHex_js_1.numberToHex)((0, size_js_1.size)(hexValue), { size: 32 })),
|
178
|
+
...parts,
|
179
|
+
]),
|
180
|
+
};
|
181
|
+
}
|
182
|
+
function encodeTuple(value, { param }) {
|
183
|
+
let dynamic = false;
|
184
|
+
const preparedParams = [];
|
185
|
+
for (let i = 0; i < param.components.length; i++) {
|
186
|
+
const param_ = param.components[i];
|
187
|
+
const index = Array.isArray(value) ? i : param_.name;
|
188
|
+
const preparedParam = prepareParam({
|
189
|
+
param: param_,
|
190
|
+
value: value[index],
|
191
|
+
});
|
192
|
+
preparedParams.push(preparedParam);
|
193
|
+
if (preparedParam.dynamic)
|
194
|
+
dynamic = true;
|
195
|
+
}
|
196
|
+
return {
|
197
|
+
dynamic,
|
198
|
+
encoded: dynamic
|
199
|
+
? encodeParams(preparedParams)
|
200
|
+
: (0, concat_js_1.concat)(preparedParams.map(({ encoded }) => encoded)),
|
201
|
+
};
|
202
|
+
}
|
203
|
+
function getArrayComponents(type) {
|
204
|
+
const matches = type.match(/^(.*)\[(\d+)?\]$/);
|
205
|
+
return matches
|
206
|
+
?
|
207
|
+
[matches[2] ? Number(matches[2]) : null, matches[1]]
|
208
|
+
: undefined;
|
209
|
+
}
|
210
|
+
exports.getArrayComponents = getArrayComponents;
|
211
|
+
//# sourceMappingURL=encodeAbiParameters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"encodeAbiParameters.js","sourceRoot":"","sources":["../../../utils/abi/encodeAbiParameters.ts"],"names":[],"mappings":";;;AAMA,gDAW4B;AAC5B,wDAGgC;AAGhC,0DAA4E;AAC5E,iDAAgE;AAChE,2CAA6D;AAC7D,6CAA0D;AAC1D,+CAA6D;AAC7D,mDAO6B;AAa7B,SAAgB,mBAAmB,CAGjC,MAAe,EACf,MAES;IAET,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;QACjC,MAAM,IAAI,uCAA8B,CAAC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AAC,CAAA;QAClC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAA;QACpD,MAAM,aAAa,GAAG,YAAY,CAAC;YACjC,KAAK,EAAE,MAAM;YACb,KAAK,EAAG,KAAa,CAAC,KAAM,CAAuB;SACpD,CAAC,CAAA;QACF,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAClC,IAAI,aAAa,CAAC,OAAO;YAAE,OAAO,GAAG,IAAI,CAAA;KAC1C;IACD,OAAO;QACL,OAAO;QACP,OAAO,EAAE,OAAO;YACd,CAAC,CAAC,YAAY,CAAC,cAAc,CAAC;YAC9B,CAAC,CAAC,IAAA,kBAAM,EAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;KACzD,CAAA;AACH,CAAC;AAID,SAAgB,kBAAkB,CAChC,IAAY;IAEZ,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;IAC9C,OAAO,OAAO;QACZ,CAAC;YACC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC,SAAS,CAAA;AACf,CAAC;AARD,gDAQC"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.encodeDeployData = void 0;
|
4
|
+
const abi_js_1 = require("../../errors/abi.js");
|
5
|
+
const concat_js_1 = require("../data/concat.js");
|
6
|
+
const encodeAbiParameters_js_1 = require("./encodeAbiParameters.js");
|
7
|
+
const docsPath = '/docs/contract/encodeDeployData';
|
8
|
+
function encodeDeployData(parameters) {
|
9
|
+
const { abi, args, bytecode } = parameters;
|
10
|
+
if (!args || args.length === 0)
|
11
|
+
return bytecode;
|
12
|
+
const description = abi.find((x) => 'type' in x && x.type === 'constructor');
|
13
|
+
if (!description)
|
14
|
+
throw new abi_js_1.AbiConstructorNotFoundError({ docsPath });
|
15
|
+
if (!('inputs' in description))
|
16
|
+
throw new abi_js_1.AbiConstructorParamsNotFoundError({ docsPath });
|
17
|
+
if (!description.inputs || description.inputs.length === 0)
|
18
|
+
throw new abi_js_1.AbiConstructorParamsNotFoundError({ docsPath });
|
19
|
+
const data = (0, encodeAbiParameters_js_1.encodeAbiParameters)(description.inputs, args);
|
20
|
+
return (0, concat_js_1.concatHex)([bytecode, data]);
|
21
|
+
}
|
22
|
+
exports.encodeDeployData = encodeDeployData;
|
23
|
+
//# sourceMappingURL=encodeDeployData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"encodeDeployData.js","sourceRoot":"","sources":["../../../utils/abi/encodeDeployData.ts"],"names":[],"mappings":";;;AAEA,gDAI4B;AAK5B,iDAAsE;AACtE,qEAGiC;AAEjC,MAAM,QAAQ,GAAG,iCAAiC,CAAA;AA+BlD,SAAgB,gBAAgB,CAC9B,UAA2C;IAE3C,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAwC,CAAA;IACxE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAA;IAE/C,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAA;IAC5E,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,oCAA2B,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IACrE,IAAI,CAAC,CAAC,QAAQ,IAAI,WAAW,CAAC;QAC5B,MAAM,IAAI,0CAAiC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC3D,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QACxD,MAAM,IAAI,0CAAiC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IAE3D,MAAM,IAAI,GAAG,IAAA,4CAAmB,EAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC1D,OAAO,IAAA,qBAAS,EAAC,CAAC,QAAQ,EAAE,IAAK,CAAC,CAAC,CAAA;AACrC,CAAC;AAfD,4CAeC"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.encodeErrorResult = void 0;
|
4
|
+
const abi_js_1 = require("../../errors/abi.js");
|
5
|
+
const concat_js_1 = require("../data/concat.js");
|
6
|
+
const getFunctionSelector_js_1 = require("../hash/getFunctionSelector.js");
|
7
|
+
const encodeAbiParameters_js_1 = require("./encodeAbiParameters.js");
|
8
|
+
const formatAbiItem_js_1 = require("./formatAbiItem.js");
|
9
|
+
const getAbiItem_js_1 = require("./getAbiItem.js");
|
10
|
+
const docsPath = '/docs/contract/encodeErrorResult';
|
11
|
+
function encodeErrorResult(parameters) {
|
12
|
+
const { abi, errorName, args } = parameters;
|
13
|
+
let abiItem = abi[0];
|
14
|
+
if (errorName) {
|
15
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi, args, name: errorName });
|
16
|
+
if (!item)
|
17
|
+
throw new abi_js_1.AbiErrorNotFoundError(errorName, { docsPath });
|
18
|
+
abiItem = item;
|
19
|
+
}
|
20
|
+
if (abiItem.type !== 'error')
|
21
|
+
throw new abi_js_1.AbiErrorNotFoundError(undefined, { docsPath });
|
22
|
+
const definition = (0, formatAbiItem_js_1.formatAbiItem)(abiItem);
|
23
|
+
const signature = (0, getFunctionSelector_js_1.getFunctionSelector)(definition);
|
24
|
+
let data = '0x';
|
25
|
+
if (args && args.length > 0) {
|
26
|
+
if (!abiItem.inputs)
|
27
|
+
throw new abi_js_1.AbiErrorInputsNotFoundError(abiItem.name, { docsPath });
|
28
|
+
data = (0, encodeAbiParameters_js_1.encodeAbiParameters)(abiItem.inputs, args);
|
29
|
+
}
|
30
|
+
return (0, concat_js_1.concatHex)([signature, data]);
|
31
|
+
}
|
32
|
+
exports.encodeErrorResult = encodeErrorResult;
|
33
|
+
//# sourceMappingURL=encodeErrorResult.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"encodeErrorResult.js","sourceRoot":"","sources":["../../../utils/abi/encodeErrorResult.ts"],"names":[],"mappings":";;;AAEA,gDAG4B;AAM5B,iDAAsE;AACtE,2EAGuC;AAIvC,qEAGiC;AACjC,yDAA+E;AAC/E,mDAAsE;AAEtE,MAAM,QAAQ,GAAG,kCAAkC,CAAA;AA0CnD,SAAgB,iBAAiB,CAI/B,UAAuD;IAEvD,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,UAAyC,CAAA;IAE1E,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;IACpB,IAAI,SAAS,EAAE;QACb,MAAM,IAAI,GAAG,IAAA,0BAAU,EAAC,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;QACvD,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,8BAAqB,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;QACnE,OAAO,GAAG,IAAI,CAAA;KACf;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;QAC1B,MAAM,IAAI,8BAAqB,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAE1D,MAAM,UAAU,GAAG,IAAA,gCAAa,EAAC,OAAO,CAAC,CAAA;IACzC,MAAM,SAAS,GAAG,IAAA,4CAAmB,EAAC,UAAU,CAAC,CAAA;IAEjD,IAAI,IAAI,GAAQ,IAAI,CAAA;IACpB,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,IAAI,CAAC,OAAO,CAAC,MAAM;YACjB,MAAM,IAAI,oCAA2B,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;QACnE,IAAI,GAAG,IAAA,4CAAmB,EAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;KACjD;IACD,OAAO,IAAA,qBAAS,EAAC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAA;AACrC,CAAC;AA5BD,8CA4BC"}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.encodeEventTopics = void 0;
|
4
|
+
const abi_js_1 = require("../../errors/abi.js");
|
5
|
+
const log_js_1 = require("../../errors/log.js");
|
6
|
+
const toBytes_js_1 = require("../encoding/toBytes.js");
|
7
|
+
const getEventSelector_js_1 = require("../hash/getEventSelector.js");
|
8
|
+
const keccak256_js_1 = require("../hash/keccak256.js");
|
9
|
+
const encodeAbiParameters_js_1 = require("./encodeAbiParameters.js");
|
10
|
+
const formatAbiItem_js_1 = require("./formatAbiItem.js");
|
11
|
+
const getAbiItem_js_1 = require("./getAbiItem.js");
|
12
|
+
const docsPath = '/docs/contract/encodeEventTopics';
|
13
|
+
function encodeEventTopics(parameters) {
|
14
|
+
const { abi, eventName, args } = parameters;
|
15
|
+
let abiItem = abi[0];
|
16
|
+
if (eventName) {
|
17
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi, name: eventName });
|
18
|
+
if (!item)
|
19
|
+
throw new abi_js_1.AbiEventNotFoundError(eventName, { docsPath });
|
20
|
+
abiItem = item;
|
21
|
+
}
|
22
|
+
if (abiItem.type !== 'event')
|
23
|
+
throw new abi_js_1.AbiEventNotFoundError(undefined, { docsPath });
|
24
|
+
const definition = (0, formatAbiItem_js_1.formatAbiItem)(abiItem);
|
25
|
+
const signature = (0, getEventSelector_js_1.getEventSelector)(definition);
|
26
|
+
let topics = [];
|
27
|
+
if (args && 'inputs' in abiItem) {
|
28
|
+
const indexedInputs = abiItem.inputs?.filter((param) => 'indexed' in param && param.indexed);
|
29
|
+
const args_ = Array.isArray(args)
|
30
|
+
? args
|
31
|
+
: Object.values(args).length > 0
|
32
|
+
? indexedInputs?.map((x) => args[x.name]) ?? []
|
33
|
+
: [];
|
34
|
+
if (args_.length > 0) {
|
35
|
+
topics =
|
36
|
+
indexedInputs?.map((param, i) => Array.isArray(args_[i])
|
37
|
+
? args_[i].map((_, j) => encodeArg({ param, value: args_[i][j] }))
|
38
|
+
: args_[i]
|
39
|
+
? encodeArg({ param, value: args_[i] })
|
40
|
+
: null) ?? [];
|
41
|
+
}
|
42
|
+
}
|
43
|
+
return [signature, ...topics];
|
44
|
+
}
|
45
|
+
exports.encodeEventTopics = encodeEventTopics;
|
46
|
+
function encodeArg({ param, value, }) {
|
47
|
+
if (param.type === 'string' || param.type === 'bytes')
|
48
|
+
return (0, keccak256_js_1.keccak256)((0, toBytes_js_1.toBytes)(value));
|
49
|
+
if (param.type === 'tuple' || param.type.match(/^(.*)\[(\d+)?\]$/))
|
50
|
+
throw new log_js_1.FilterTypeNotSupportedError(param.type);
|
51
|
+
return (0, encodeAbiParameters_js_1.encodeAbiParameters)([param], [value]);
|
52
|
+
}
|
53
|
+
//# sourceMappingURL=encodeEventTopics.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"encodeEventTopics.js","sourceRoot":"","sources":["../../../utils/abi/encodeEventTopics.ts"],"names":[],"mappings":";;;AAOA,gDAG4B;AAC5B,gDAG4B;AAS5B,uDAAuE;AACvE,qEAGoC;AACpC,uDAAyE;AACzE,qEAGiC;AACjC,yDAA+E;AAC/E,mDAAsE;AAEtE,MAAM,QAAQ,GAAG,kCAAkC,CAAA;AAwCnD,SAAgB,iBA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+
const abi_js_1 = require("../../errors/abi.js");
|
5
|
+
const concat_js_1 = require("../data/concat.js");
|
6
|
+
const getFunctionSelector_js_1 = require("../hash/getFunctionSelector.js");
|
7
|
+
const encodeAbiParameters_js_1 = require("./encodeAbiParameters.js");
|
8
|
+
const formatAbiItem_js_1 = require("./formatAbiItem.js");
|
9
|
+
const getAbiItem_js_1 = require("./getAbiItem.js");
|
10
|
+
const docsPath = '/docs/contract/encodeFunctionData';
|
11
|
+
function encodeFunctionData(parameters) {
|
12
|
+
const { abi, args, functionName } = parameters;
|
13
|
+
let abiItem = abi[0];
|
14
|
+
if (functionName) {
|
15
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({
|
16
|
+
abi,
|
17
|
+
args,
|
18
|
+
name: functionName,
|
19
|
+
});
|
20
|
+
if (!item)
|
21
|
+
throw new abi_js_1.AbiFunctionNotFoundError(functionName, { docsPath });
|
22
|
+
abiItem = item;
|
23
|
+
}
|
24
|
+
if (abiItem.type !== 'function')
|
25
|
+
throw new abi_js_1.AbiFunctionNotFoundError(undefined, { docsPath });
|
26
|
+
const definition = (0, formatAbiItem_js_1.formatAbiItem)(abiItem);
|
27
|
+
const signature = (0, getFunctionSelector_js_1.getFunctionSelector)(definition);
|
28
|
+
const data = 'inputs' in abiItem && abiItem.inputs
|
29
|
+
? (0, encodeAbiParameters_js_1.encodeAbiParameters)(abiItem.inputs, args ?? [])
|
30
|
+
: undefined;
|
31
|
+
return (0, concat_js_1.concatHex)([signature, data ?? '0x']);
|
32
|
+
}
|
33
|
+
exports.encodeFunctionData = encodeFunctionData;
|
34
|
+
//# sourceMappingURL=encodeFunctionData.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"encodeFunctionData.js","sourceRoot":"","sources":["../../../utils/abi/encodeFunctionData.ts"],"names":[],"mappings":";;;AAEA,gDAG4B;AAK5B,iDAAsE;AACtE,2EAGuC;AAKvC,qEAGiC;AACjC,yDAA+E;AAC/E,mDAAsE;AAEtE,MAAM,QAAQ,GAAG,mCAAmC,CAAA;AAkDpD,SAAgB,kBAAkB,CAIhC,UAA2D;IAE3D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,UAA0C,CAAA;IAE9E,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;IACpB,IAAI,YAAY,EAAE;QAChB,MAAM,IAAI,GAAG,IAAA,0BAAU,EAAC;YACtB,GAAG;YACH,IAAI;YACJ,IAAI,EAAE,YAAY;SACnB,CAAC,CAAA;QACF,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,iCAAwB,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;QACzE,OAAO,GAAG,IAAI,CAAA;KACf;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU;QAC7B,MAAM,IAAI,iCAAwB,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAE7D,MAAM,UAAU,GAAG,IAAA,gCAAa,EAAC,OAAO,CAAC,CAAA;IACzC,MAAM,SAAS,GAAG,IAAA,4CAAmB,EAAC,UAAU,CAAC,CAAA;IACjD,MAAM,IAAI,GACR,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM;QACnC,CAAC,CAAC,IAAA,4CAAmB,EAAC,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;QACjD,CAAC,CAAC,SAAS,CAAA;IACf,OAAO,IAAA,qBAAS,EAAC,CAAC,SAAS,EAAE,IAAI,IAAI,IAAI,CAAC,CAAC,CAAA;AAC7C,CAAC;AA7BD,gDA6BC"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.encodeFunctionResult = void 0;
|
4
|
+
const abi_js_1 = require("../../errors/abi.js");
|
5
|
+
const encodeAbiParameters_js_1 = require("./encodeAbiParameters.js");
|
6
|
+
const getAbiItem_js_1 = require("./getAbiItem.js");
|
7
|
+
const docsPath = '/docs/contract/encodeFunctionResult';
|
8
|
+
function encodeFunctionResult(parameters) {
|
9
|
+
const { abi, functionName, result } = parameters;
|
10
|
+
let abiItem = abi[0];
|
11
|
+
if (functionName) {
|
12
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi, name: functionName });
|
13
|
+
if (!item)
|
14
|
+
throw new abi_js_1.AbiFunctionNotFoundError(functionName, { docsPath });
|
15
|
+
abiItem = item;
|
16
|
+
}
|
17
|
+
if (abiItem.type !== 'function')
|
18
|
+
throw new abi_js_1.AbiFunctionNotFoundError(undefined, { docsPath });
|
19
|
+
if (!abiItem.outputs)
|
20
|
+
throw new abi_js_1.AbiFunctionOutputsNotFoundError(abiItem.name, { docsPath });
|
21
|
+
let values = Array.isArray(result) ? result : [result];
|
22
|
+
if (abiItem.outputs.length === 0 && !values[0])
|
23
|
+
values = [];
|
24
|
+
return (0, encodeAbiParameters_js_1.encodeAbiParameters)(abiItem.outputs, values);
|
25
|
+
}
|
26
|
+
exports.encodeFunctionResult = encodeFunctionResult;
|
27
|
+
//# sourceMappingURL=encodeFunctionResult.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"encodeFunctionResult.js","sourceRoot":"","sources":["../../../utils/abi/encodeFunctionResult.ts"],"names":[],"mappings":";;;AAEA,gDAG4B;AAS5B,qEAGiC;AACjC,mDAAsE;AAEtE,MAAM,QAAQ,GAAG,qCAAqC,CAAA;AA8CtD,SAAgB,oBAAoB,CAIlC,UAA6D;IAE7D,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,GACjC,UAA4C,CAAA;IAE9C,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;IACpB,IAAI,YAAY,EAAE;QAChB,MAAM,IAAI,GAAG,IAAA,0BAAU,EAAC,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,iCAAwB,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;QACzE,OAAO,GAAG,IAAI,CAAA;KACf;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU;QAC7B,MAAM,IAAI,iCAAwB,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAE7D,IAAI,CAAC,OAAO,CAAC,OAAO;QAClB,MAAM,IAAI,wCAA+B,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAA;IAEvE,IAAI,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IACtD,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAAE,MAAM,GAAG,EAAE,CAAA;IAE3D,OAAO,IAAA,4CAAmB,EAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AACrD,CAAC;AA1BD,oDA0BC"}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.encodePacked = void 0;
|
4
|
+
const abi_js_1 = require("../../errors/abi.js");
|
5
|
+
const address_js_1 = require("../../errors/address.js");
|
6
|
+
const isAddress_js_1 = require("../address/isAddress.js");
|
7
|
+
const concat_js_1 = require("../data/concat.js");
|
8
|
+
const pad_js_1 = require("../data/pad.js");
|
9
|
+
const toHex_js_1 = require("../encoding/toHex.js");
|
10
|
+
const regex_js_1 = require("../regex.js");
|
11
|
+
function encodePacked(types, values) {
|
12
|
+
if (types.length !== values.length)
|
13
|
+
throw new abi_js_1.AbiEncodingLengthMismatchError({
|
14
|
+
expectedLength: types.length,
|
15
|
+
givenLength: values.length,
|
16
|
+
});
|
17
|
+
const data = [];
|
18
|
+
for (let i = 0; i < types.length; i++) {
|
19
|
+
const type = types[i];
|
20
|
+
const value = values[i];
|
21
|
+
data.push(encode(type, value));
|
22
|
+
}
|
23
|
+
return (0, concat_js_1.concatHex)(data);
|
24
|
+
}
|
25
|
+
exports.encodePacked = encodePacked;
|
26
|
+
function encode(type, value, isArray = false) {
|
27
|
+
if (type === 'address') {
|
28
|
+
const address = value;
|
29
|
+
if (!(0, isAddress_js_1.isAddress)(address))
|
30
|
+
throw new address_js_1.InvalidAddressError({ address });
|
31
|
+
return (0, pad_js_1.pad)(address.toLowerCase(), {
|
32
|
+
size: isArray ? 32 : null,
|
33
|
+
});
|
34
|
+
}
|
35
|
+
if (type === 'string')
|
36
|
+
return (0, toHex_js_1.stringToHex)(value);
|
37
|
+
if (type === 'bytes')
|
38
|
+
return value;
|
39
|
+
if (type === 'bool')
|
40
|
+
return (0, pad_js_1.pad)((0, toHex_js_1.boolToHex)(value), { size: isArray ? 32 : 1 });
|
41
|
+
const intMatch = type.match(regex_js_1.integerRegex);
|
42
|
+
if (intMatch) {
|
43
|
+
const [_type, baseType, bits = '256'] = intMatch;
|
44
|
+
const size = parseInt(bits) / 8;
|
45
|
+
return (0, toHex_js_1.numberToHex)(value, {
|
46
|
+
size: isArray ? 32 : size,
|
47
|
+
signed: baseType === 'int',
|
48
|
+
});
|
49
|
+
}
|
50
|
+
const bytesMatch = type.match(regex_js_1.bytesRegex);
|
51
|
+
if (bytesMatch) {
|
52
|
+
const [_type, size] = bytesMatch;
|
53
|
+
if (parseInt(size) !== (value.length - 2) / 2)
|
54
|
+
throw new abi_js_1.BytesSizeMismatchError({
|
55
|
+
expectedSize: parseInt(size),
|
56
|
+
givenSize: (value.length - 2) / 2,
|
57
|
+
});
|
58
|
+
return (0, pad_js_1.pad)(value, { dir: 'right', size: isArray ? 32 : null });
|
59
|
+
}
|
60
|
+
const arrayMatch = type.match(regex_js_1.arrayRegex);
|
61
|
+
if (arrayMatch && Array.isArray(value)) {
|
62
|
+
const [_type, childType] = arrayMatch;
|
63
|
+
const data = [];
|
64
|
+
for (let i = 0; i < value.length; i++) {
|
65
|
+
data.push(encode(childType, value[i], true));
|
66
|
+
}
|
67
|
+
if (data.length === 0)
|
68
|
+
return '0x';
|
69
|
+
return (0, concat_js_1.concatHex)(data);
|
70
|
+
}
|
71
|
+
throw new abi_js_1.UnsupportedPackedAbiType(type);
|
72
|
+
}
|
73
|
+
//# sourceMappingURL=encodePacked.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"encodePacked.js","sourceRoot":"","sources":["../../../utils/abi/encodePacked.ts"],"names":[],"mappings":";;;AAYA,gDAM4B;AAC5B,wDAGgC;AAGhC,0DAA4E;AAC5E,iDAAsE;AACtE,2CAAuD;AACvD,mDAO6B;AAC7B,0CAAkE;AAwBlE,SAAgB,YAAY,CAE1B,KAAsB,EAAE,MAA2C;IACnE,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;QAChC,MAAM,IAAI,uCAA8B,CAAC;YACvC,cAAc,EAAE,KAAK,CAAC,MAAgB;YACtC,WAAW,EAAE,MAAM,CAAC,MAAgB;SACrC,CAAC,CAAA;IAEJ,MAAM,IAAI,GAAU,EAAE,CAAA;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAI,KAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACrB,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;KAC/B;IACD,OAAO,IAAA,qBAAS,EAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AAhBD,oCAgBC;AAaD,SAAS,MAAM,CACb,IAAoB,EACpB,KAA8C,EAC9C,OAAO,GAAG,KAAK;IAEf,IAAI,IAAI,KAAK,SAAS,EAAE;QACtB,MAAM,O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K,CAAE,KAAa,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC;YACpD,MAAM,IAAI,+BAAsB,CAAC;gBAC/B,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC;gBAC5B,SAAS,EAAE,CAAE,KAAa,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC;aAC3C,CAAC,CAAA;QACJ,OAAO,IAAA,YAAG,EAAC,KAAY,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAQ,CAAA;KAC7E;IAED,MAAM,UAAU,GAAI,IAAe,CAAC,KAAK,CAAC,qBAAU,CAAC,CAAA;IACrD,IAAI,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACtC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,UAAU,CAAA;QACrC,MAAM,IAAI,GAAU,EAAE,CAAA;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;SAC7C;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QAClC,OAAO,IAAA,qBAAS,EAAC,IAAI,CAAC,CAAA;KACvB;IAED,MAAM,IAAI,iCAAwB,CAAC,IAAI,CAAC,CAAA;AAC1C,CAAC"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.formatAbiParams = exports.formatAbiItem = void 0;
|
4
|
+
const abi_js_1 = require("../../errors/abi.js");
|
5
|
+
function formatAbiItem(abiItem, { includeName = false } = {}) {
|
6
|
+
if (abiItem.type !== 'function' &&
|
7
|
+
abiItem.type !== 'event' &&
|
8
|
+
abiItem.type !== 'error')
|
9
|
+
throw new abi_js_1.InvalidDefinitionTypeError(abiItem.type);
|
10
|
+
return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
|
11
|
+
}
|
12
|
+
exports.formatAbiItem = formatAbiItem;
|
13
|
+
function formatAbiParams(params, { includeName = false } = {}) {
|
14
|
+
if (!params)
|
15
|
+
return '';
|
16
|
+
return params
|
17
|
+
.map((param) => formatAbiParam(param, { includeName }))
|
18
|
+
.join(includeName ? ', ' : ',');
|
19
|
+
}
|
20
|
+
exports.formatAbiParams = formatAbiParams;
|
21
|
+
function formatAbiParam(param, { includeName }) {
|
22
|
+
if (param.type.startsWith('tuple')) {
|
23
|
+
return `(${formatAbiParams(param.components, { includeName })})${param.type.slice('tuple'.length)}`;
|
24
|
+
}
|
25
|
+
return param.type + (includeName && param.name ? ` ${param.name}` : '');
|
26
|
+
}
|
27
|
+
//# sourceMappingURL=formatAbiItem.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"formatAbiItem.js","sourceRoot":"","sources":["../../../utils/abi/formatAbiItem.ts"],"names":[],"mappings":";;;AAEA,gDAG4B;AAS5B,SAAgB,aAAa,CAC3B,OAAgB,EAChB,EAAE,WAAW,GAAG,KAAK,KAAgC,EAAE;IAEvD,IACE,OAAO,CAAC,IAAI,KAAK,UAAU;QAC3B,OAAO,CAAC,IAAI,KAAK,OAAO;QACxB,OAAO,CAAC,IAAI,KAAK,OAAO;QAExB,MAAM,IAAI,mCAA0B,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAEpD,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,GAAG,CAAA;AAC/E,CAAC;AAZD,sCAYC;AAID,SAAgB,eAAe,CAC7B,MAA2C,EAC3C,EAAE,WAAW,GAAG,KAAK,KAAgC,EAAE;IAEvD,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAA;IACtB,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;SACtD,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AACnC,CAAC;AARD,0CAQC;AAID,SAAS,cAAc,CACrB,KAAmB,EACnB,EAAE,WAAW,EAA4B;IAEzC,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAClC,OAAO,IAAI,eAAe,CACvB,KAAmD,CAAC,UAAU,EAC/D,EAAE,WAAW,EAAE,CAChB,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAA;KACxC;IACD,OAAO,KAAK,CAAC,IAAI,GAAG,CAAC,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AACzE,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.formatAbiItemWithArgs = void 0;
|
4
|
+
const stringify_js_1 = require("../stringify.js");
|
5
|
+
function formatAbiItemWithArgs({ abiItem, args, includeFunctionName = true, includeName = false, }) {
|
6
|
+
if (!('name' in abiItem))
|
7
|
+
return;
|
8
|
+
if (!('inputs' in abiItem))
|
9
|
+
return;
|
10
|
+
if (!abiItem.inputs)
|
11
|
+
return;
|
12
|
+
return `${includeFunctionName ? abiItem.name : ''}(${abiItem.inputs
|
13
|
+
.map((input, i) => `${includeName && input.name ? `${input.name}: ` : ''}${typeof args[i] === 'object' ? (0, stringify_js_1.stringify)(args[i]) : args[i]}`)
|
14
|
+
.join(', ')})`;
|
15
|
+
}
|
16
|
+
exports.formatAbiItemWithArgs = formatAbiItemWithArgs;
|
17
|
+
//# sourceMappingURL=formatAbiItemWithArgs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"formatAbiItemWithArgs.js","sourceRoot":"","sources":["../../../utils/abi/formatAbiItemWithArgs.ts"],"names":[],"mappings":";;;AAIA,kDAA2C;AAI3C,SAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,IAAI,EACJ,mBAAmB,GAAG,IAAI,EAC1B,WAAW,GAAG,KAAK,GAMpB;IACC,IAAI,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC;QAAE,OAAM;IAChC,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC;QAAE,OAAM;IAClC,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAM;IAC3B,OAAO,GAAG,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,MAAM;SAChE,GAAG,CACF,CAAC,KAAmB,EAAE,CAAS,EAAE,EAAE,CACjC,GAAG,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,GACnD,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,wBAAS,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAC3D,EAAE,CACL;SACA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;AAClB,CAAC;AAtBD,sDAsBC"}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isArgOfType = exports.getAbiItem = void 0;
|
4
|
+
const isHex_js_1 = require("../../utils/data/isHex.js");
|
5
|
+
const getEventSelector_js_1 = require("../../utils/hash/getEventSelector.js");
|
6
|
+
const getFunctionSelector_js_1 = require("../../utils/hash/getFunctionSelector.js");
|
7
|
+
const isAddress_js_1 = require("../address/isAddress.js");
|
8
|
+
function getAbiItem(parameters) {
|
9
|
+
const { abi, args = [], name } = parameters;
|
10
|
+
const isSelector = (0, isHex_js_1.isHex)(name, { strict: false });
|
11
|
+
const abiItems = abi.filter((abiItem) => {
|
12
|
+
if (isSelector) {
|
13
|
+
if (abiItem.type === 'function')
|
14
|
+
return (0, getFunctionSelector_js_1.getFunctionSelector)(abiItem) === name;
|
15
|
+
if (abiItem.type === 'event')
|
16
|
+
return (0, getEventSelector_js_1.getEventSelector)(abiItem) === name;
|
17
|
+
return false;
|
18
|
+
}
|
19
|
+
return 'name' in abiItem && abiItem.name === name;
|
20
|
+
});
|
21
|
+
if (abiItems.length === 0)
|
22
|
+
return undefined;
|
23
|
+
if (abiItems.length === 1)
|
24
|
+
return abiItems[0];
|
25
|
+
for (const abiItem of abiItems) {
|
26
|
+
if (!('inputs' in abiItem))
|
27
|
+
continue;
|
28
|
+
if (!args || args.length === 0) {
|
29
|
+
if (!abiItem.inputs || abiItem.inputs.length === 0)
|
30
|
+
return abiItem;
|
31
|
+
continue;
|
32
|
+
}
|
33
|
+
if (!abiItem.inputs)
|
34
|
+
continue;
|
35
|
+
if (abiItem.inputs.length === 0)
|
36
|
+
continue;
|
37
|
+
if (abiItem.inputs.length !== args.length)
|
38
|
+
continue;
|
39
|
+
const matched = args.every((arg, index) => {
|
40
|
+
const abiParameter = 'inputs' in abiItem && abiItem.inputs[index];
|
41
|
+
if (!abiParameter)
|
42
|
+
return false;
|
43
|
+
return isArgOfType(arg, abiParameter);
|
44
|
+
});
|
45
|
+
if (matched)
|
46
|
+
return abiItem;
|
47
|
+
}
|
48
|
+
return abiItems[0];
|
49
|
+
}
|
50
|
+
exports.getAbiItem = getAbiItem;
|
51
|
+
function isArgOfType(arg, abiParameter) {
|
52
|
+
const argType = typeof arg;
|
53
|
+
const abiParameterType = abiParameter.type;
|
54
|
+
switch (abiParameterType) {
|
55
|
+
case 'address':
|
56
|
+
return (0, isAddress_js_1.isAddress)(arg);
|
57
|
+
case 'bool':
|
58
|
+
return argType === 'boolean';
|
59
|
+
case 'function':
|
60
|
+
return argType === 'string';
|
61
|
+
case 'string':
|
62
|
+
return argType === 'string';
|
63
|
+
default: {
|
64
|
+
if (abiParameterType === 'tuple' && 'components' in abiParameter)
|
65
|
+
return Object.values(abiParameter.components).every((component, index) => {
|
66
|
+
return isArgOfType(Object.values(arg)[index], component);
|
67
|
+
});
|
68
|
+
if (/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(abiParameterType))
|
69
|
+
return argType === 'number' || argType === 'bigint';
|
70
|
+
if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
|
71
|
+
return argType === 'string' || arg instanceof Uint8Array;
|
72
|
+
if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
|
73
|
+
return (Array.isArray(arg) &&
|
74
|
+
arg.every((x) => isArgOfType(x, {
|
75
|
+
...abiParameter,
|
76
|
+
type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, ''),
|
77
|
+
})));
|
78
|
+
}
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
83
|
+
exports.isArgOfType = isArgOfType;
|
84
|
+
//# sourceMappingURL=getAbiItem.js.map
|