viem 0.0.1-alpha.2 → 0.0.1-alpha.20
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/chains/package.json +1 -1
- package/clients/package.json +1 -1
- package/dist/{rpc-655c0ba4.d.ts → chain-32f56cfa.d.ts} +78 -17
- package/dist/chain-f12cdc7f.d.ts +5 -0
- package/dist/chains.d.ts +1291 -74
- package/dist/chains.js +125 -129
- package/dist/chains.js.map +1 -0
- package/dist/chains.mjs +129 -0
- package/dist/chains.mjs.map +1 -0
- package/dist/{chunk-3EOU525X.js → chunk-5Q6FSUU2.mjs} +1199 -562
- package/dist/chunk-5Q6FSUU2.mjs.map +1 -0
- package/dist/chunk-FHXXG7I6.js +259 -0
- package/dist/chunk-FHXXG7I6.js.map +1 -0
- package/dist/chunk-IAQPMSGJ.js +176 -0
- package/dist/chunk-IAQPMSGJ.js.map +1 -0
- package/dist/{chunk-4HNVS7AM.js → chunk-MYQNZSWD.mjs} +330 -539
- package/dist/chunk-MYQNZSWD.mjs.map +1 -0
- package/dist/chunk-NHAKUPTF.js +889 -0
- package/dist/chunk-NHAKUPTF.js.map +1 -0
- package/dist/chunk-SF4I2NKC.js +2683 -0
- package/dist/chunk-SF4I2NKC.js.map +1 -0
- package/dist/chunk-T7CBAKLI.mjs +176 -0
- package/dist/chunk-T7CBAKLI.mjs.map +1 -0
- package/dist/chunk-YFKR74XG.js +256 -0
- package/dist/chunk-YFKR74XG.js.map +1 -0
- package/dist/chunk-YODUQCHJ.mjs +256 -0
- package/dist/chunk-YODUQCHJ.mjs.map +1 -0
- package/dist/{chunk-YQRTXQ2G.js → chunk-ZVGTYLKU.mjs} +3 -15
- package/dist/chunk-ZVGTYLKU.mjs.map +1 -0
- package/dist/clients/index.d.ts +8 -7
- package/dist/clients/index.js +24 -25
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/index.mjs +24 -0
- package/dist/clients/index.mjs.map +1 -0
- package/dist/contract-9af4608b.d.ts +142 -0
- package/dist/createClient-5d316c7e.d.ts +62 -0
- package/dist/createPublicClient-9d2b42e1.d.ts +19 -0
- package/dist/createTestClient-79498dab.d.ts +34 -0
- package/dist/createWalletClient-f69a5230.d.ts +30 -0
- package/dist/{eip1193-8f7c22ce.d.ts → eip1193-6c485d63.d.ts} +13 -10
- package/dist/index.d.ts +424 -11
- package/dist/index.js +395 -292
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +395 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{parseGwei-fd7a0f7d.d.ts → parseGwei-4308ad80.d.ts} +82 -139
- package/dist/public.d.ts +11 -0
- package/dist/public.js +59 -0
- package/dist/public.js.map +1 -0
- package/dist/public.mjs +59 -0
- package/dist/public.mjs.map +1 -0
- package/dist/{rpc-3c0e3985.d.ts → rpc-26932bae.d.ts} +1 -38
- package/dist/sendTransaction-1c8290a9.d.ts +12 -0
- package/dist/stopImpersonatingAccount-7781842a.d.ts +156 -0
- package/dist/test.d.ts +6 -0
- package/dist/test.js +60 -0
- package/dist/test.js.map +1 -0
- package/dist/test.mjs +60 -0
- package/dist/test.mjs.map +1 -0
- package/dist/transactionRequest-341b6ed2.d.ts +15 -0
- package/dist/utils/index.d.ts +51 -8
- package/dist/utils/index.js +171 -156
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +171 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/wallet.d.ts +8 -0
- package/dist/wallet.js +24 -0
- package/dist/wallet.js.map +1 -0
- package/dist/wallet.mjs +24 -0
- package/dist/wallet.mjs.map +1 -0
- package/dist/watchAsset-afaad3c7.d.ts +38 -0
- package/dist/{watchAsset-04ab8db5.d.ts → watchPendingTransactions-3b722547.d.ts} +67 -217
- package/dist/{webSocket-c6e0d26f.d.ts → webSocket-b180e679.d.ts} +4 -9
- package/dist/window.d.ts +3 -2
- package/dist/window.js +1 -0
- package/dist/window.js.map +1 -0
- package/dist/window.mjs +1 -0
- package/dist/window.mjs.map +1 -0
- package/package.json +30 -66
- package/src/_test/abis.ts +1413 -0
- package/src/_test/bench.ts +15 -0
- package/src/_test/constants.ts +60 -0
- package/src/_test/globalSetup.ts +11 -0
- package/src/_test/index.ts +23 -0
- package/src/_test/setup.ts +8 -0
- package/src/_test/utils.ts +112 -0
- package/src/actions/index.test.ts +78 -0
- package/src/actions/index.ts +174 -0
- package/src/actions/public/call.bench.ts +48 -0
- package/src/actions/public/call.test.ts +99 -0
- package/src/actions/public/call.ts +97 -0
- package/src/actions/public/createBlockFilter.bench.ts +11 -0
- package/src/actions/public/createBlockFilter.test.ts +9 -0
- package/src/actions/public/createBlockFilter.ts +14 -0
- package/src/actions/public/createContractEventFilter.test.ts +119 -0
- package/src/actions/public/createContractEventFilter.ts +69 -0
- package/src/actions/public/createEventFilter.test.ts +245 -0
- package/src/actions/public/createEventFilter.ts +76 -0
- package/src/actions/public/createPendingTransactionFilter.bench.ts +11 -0
- package/src/actions/public/createPendingTransactionFilter.test.ts +9 -0
- package/src/actions/public/createPendingTransactionFilter.ts +14 -0
- package/src/actions/public/deployContract.test.ts +56 -0
- package/src/actions/public/deployContract.ts +38 -0
- package/src/actions/public/estimateGas.bench.ts +46 -0
- package/src/actions/public/estimateGas.test.ts +92 -0
- package/src/actions/public/estimateGas.ts +61 -0
- package/src/actions/public/getBalance.test.ts +83 -0
- package/src/actions/public/getBalance.ts +37 -0
- package/src/actions/public/getBlock.bench.ts +28 -0
- package/src/actions/public/getBlock.test.ts +575 -0
- package/src/actions/public/getBlock.ts +65 -0
- package/src/actions/public/getBlockNumber.bench.ts +28 -0
- package/src/actions/public/getBlockNumber.test.ts +27 -0
- package/src/actions/public/getBlockNumber.ts +32 -0
- package/src/actions/public/getBlockTransactionCount.bench.ts +15 -0
- package/src/actions/public/getBlockTransactionCount.test.ts +57 -0
- package/src/actions/public/getBlockTransactionCount.ts +52 -0
- package/src/actions/public/getBytecode.test.ts +27 -0
- package/src/actions/public/getBytecode.ts +32 -0
- package/src/actions/public/getChainId.bench.ts +15 -0
- package/src/actions/public/getChainId.test.ts +8 -0
- package/src/actions/public/getChainId.ts +7 -0
- package/src/actions/public/getFeeHistory.bench.ts +18 -0
- package/src/actions/public/getFeeHistory.test.ts +137 -0
- package/src/actions/public/getFeeHistory.ts +44 -0
- package/src/actions/public/getFilterChanges.bench.ts +13 -0
- package/src/actions/public/getFilterChanges.test.ts +189 -0
- package/src/actions/public/getFilterChanges.ts +23 -0
- package/src/actions/public/getFilterLogs.test.ts +104 -0
- package/src/actions/public/getFilterLogs.ts +20 -0
- package/src/actions/public/getGasPrice.bench.ts +28 -0
- package/src/actions/public/getGasPrice.test.ts +8 -0
- package/src/actions/public/getGasPrice.ts +15 -0
- package/src/actions/public/getLogs.test.ts +107 -0
- package/src/actions/public/getLogs.ts +84 -0
- package/src/actions/public/getStorageAt.test.ts +34 -0
- package/src/actions/public/getStorageAt.ts +32 -0
- package/src/actions/public/getTransaction.bench.ts +33 -0
- package/src/actions/public/getTransaction.test.ts +311 -0
- package/src/actions/public/getTransaction.ts +95 -0
- package/src/actions/public/getTransactionConfirmations.test.ts +69 -0
- package/src/actions/public/getTransactionConfirmations.ts +38 -0
- package/src/actions/public/getTransactionCount.test.ts +56 -0
- package/src/actions/public/getTransactionCount.ts +34 -0
- package/src/actions/public/getTransactionReceipt.bench.ts +33 -0
- package/src/actions/public/getTransactionReceipt.test.ts +179 -0
- package/src/actions/public/getTransactionReceipt.ts +34 -0
- package/src/actions/public/index.test.ts +43 -0
- package/src/actions/public/index.ts +149 -0
- package/src/actions/public/readContract.test.ts +128 -0
- package/src/actions/public/readContract.ts +87 -0
- package/src/actions/public/simulateContract.bench.ts +31 -0
- package/src/actions/public/simulateContract.test.ts +238 -0
- package/src/actions/public/simulateContract.ts +98 -0
- package/src/actions/public/uninstallFilter.bench.ts +13 -0
- package/src/actions/public/uninstallFilter.test.ts +65 -0
- package/src/actions/public/uninstallFilter.ts +17 -0
- package/src/actions/public/waitForTransactionReceipt.test.ts +322 -0
- package/src/actions/public/waitForTransactionReceipt.ts +170 -0
- package/src/actions/public/watchBlockNumber.test.ts +166 -0
- package/src/actions/public/watchBlockNumber.ts +79 -0
- package/src/actions/public/watchBlocks.test.ts +210 -0
- package/src/actions/public/watchBlocks.ts +114 -0
- package/src/actions/public/watchContractEvent.test.ts +301 -0
- package/src/actions/public/watchContractEvent.ts +108 -0
- package/src/actions/public/watchEvent.test.ts +190 -0
- package/src/actions/public/watchEvent.ts +95 -0
- package/src/actions/public/watchPendingTransactions.test.ts +116 -0
- package/src/actions/public/watchPendingTransactions.ts +74 -0
- package/src/actions/test/dropTransaction.test.ts +34 -0
- package/src/actions/test/dropTransaction.ts +17 -0
- package/src/actions/test/getAutomine.test.ts +14 -0
- package/src/actions/test/getAutomine.ts +11 -0
- package/src/actions/test/getTxpoolContent.test.ts +45 -0
- package/src/actions/test/getTxpoolContent.ts +7 -0
- package/src/actions/test/getTxpoolStatus.test.ts +41 -0
- package/src/actions/test/getTxpoolStatus.ts +12 -0
- package/src/actions/test/impersonateAccount.test.ts +28 -0
- package/src/actions/test/impersonateAccount.ts +17 -0
- package/src/actions/test/increaseTime.test.ts +18 -0
- package/src/actions/test/increaseTime.ts +17 -0
- package/src/actions/test/index.test.ts +38 -0
- package/src/actions/test/index.ts +77 -0
- package/src/actions/test/inspectTxpool.test.ts +50 -0
- package/src/actions/test/inspectTxpool.ts +7 -0
- package/src/actions/test/mine.test.ts +20 -0
- package/src/actions/test/mine.ts +16 -0
- package/src/actions/test/removeBlockTimestampInterval.test.ts +23 -0
- package/src/actions/test/removeBlockTimestampInterval.ts +7 -0
- package/src/actions/test/reset.test.ts +19 -0
- package/src/actions/test/reset.ts +18 -0
- package/src/actions/test/revert.test.ts +39 -0
- package/src/actions/test/revert.ts +14 -0
- package/src/actions/test/sendUnsignedTransaction.test.ts +52 -0
- package/src/actions/test/sendUnsignedTransaction.ts +19 -0
- package/src/actions/test/setAutomine.test.ts +14 -0
- package/src/actions/test/setAutomine.ts +8 -0
- package/src/actions/test/setBalance.test.ts +29 -0
- package/src/actions/test/setBalance.ts +20 -0
- package/src/actions/test/setBlockGasLimit.test.ts +21 -0
- package/src/actions/test/setBlockGasLimit.ts +17 -0
- package/src/actions/test/setBlockTimestampInterval.test.ts +23 -0
- package/src/actions/test/setBlockTimestampInterval.ts +16 -0
- package/src/actions/test/setCode.test.ts +26 -0
- package/src/actions/test/setCode.ts +19 -0
- package/src/actions/test/setCoinbase.test.ts +11 -0
- package/src/actions/test/setCoinbase.ts +17 -0
- package/src/actions/test/setIntervalMining.test.ts +30 -0
- package/src/actions/test/setIntervalMining.ts +16 -0
- package/src/actions/test/setLoggingEnabled.test.ts +10 -0
- package/src/actions/test/setLoggingEnabled.ts +8 -0
- package/src/actions/test/setMinGasPrice.test.ts +22 -0
- package/src/actions/test/setMinGasPrice.ts +17 -0
- package/src/actions/test/setNextBlockBaseFeePerGas.test.ts +23 -0
- package/src/actions/test/setNextBlockBaseFeePerGas.ts +17 -0
- package/src/actions/test/setNextBlockTimestamp.test.ts +19 -0
- package/src/actions/test/setNextBlockTimestamp.ts +17 -0
- package/src/actions/test/setNonce.test.ts +28 -0
- package/src/actions/test/setNonce.ts +20 -0
- package/src/actions/test/setRpcUrl.test.ts +9 -0
- package/src/actions/test/setRpcUrl.ts +8 -0
- package/src/actions/test/setStorageAt.test.ts +36 -0
- package/src/actions/test/setStorageAt.ts +26 -0
- package/src/actions/test/snapshot.test.ts +18 -0
- package/src/actions/test/snapshot.ts +7 -0
- package/src/actions/test/stopImpersonatingAccount.test.ts +31 -0
- package/src/actions/test/stopImpersonatingAccount.ts +17 -0
- package/src/actions/wallet/addChain.test.ts +14 -0
- package/src/actions/wallet/addChain.ts +21 -0
- package/src/actions/wallet/getAccounts.test.ts +22 -0
- package/src/actions/wallet/getAccounts.ts +7 -0
- package/src/actions/wallet/getPermissions.test.ts +24 -0
- package/src/actions/wallet/getPermissions.ts +9 -0
- package/src/actions/wallet/index.test.ts +20 -0
- package/src/actions/wallet/index.ts +30 -0
- package/src/actions/wallet/requestAccounts.test.ts +13 -0
- package/src/actions/wallet/requestAccounts.ts +7 -0
- package/src/actions/wallet/requestPermissions.test.ts +26 -0
- package/src/actions/wallet/requestPermissions.ts +19 -0
- package/src/actions/wallet/sendTransaction.bench.ts +57 -0
- package/src/actions/wallet/sendTransaction.test.ts +440 -0
- package/src/actions/wallet/sendTransaction.ts +77 -0
- package/src/actions/wallet/signMessage.test.ts +62 -0
- package/src/actions/wallet/signMessage.ts +35 -0
- package/src/actions/wallet/switchChain.test.ts +22 -0
- package/src/actions/wallet/switchChain.ts +19 -0
- package/src/actions/wallet/watchAsset.test.ts +41 -0
- package/src/actions/wallet/watchAsset.ts +16 -0
- package/src/actions/wallet/writeContract.test.ts +54 -0
- package/src/actions/wallet/writeContract.ts +56 -0
- package/src/chains.test.ts +1912 -0
- package/src/chains.ts +99 -0
- package/src/clients/createClient.test.ts +295 -0
- package/src/clients/createClient.ts +81 -0
- package/src/clients/createPublicClient.test.ts +165 -0
- package/src/clients/createPublicClient.ts +49 -0
- package/src/clients/createTestClient.test.ts +145 -0
- package/src/clients/createTestClient.ts +72 -0
- package/src/clients/createWalletClient.test.ts +121 -0
- package/src/clients/createWalletClient.ts +54 -0
- package/src/clients/index.test.ts +19 -0
- package/src/clients/index.ts +31 -0
- package/src/clients/transports/createTransport.test.ts +58 -0
- package/src/clients/transports/createTransport.ts +48 -0
- package/src/clients/transports/custom.test.ts +98 -0
- package/src/clients/transports/custom.ts +34 -0
- package/src/clients/transports/fallback.test.ts +223 -0
- package/src/clients/transports/fallback.ts +48 -0
- package/src/clients/transports/http.test.ts +110 -0
- package/src/clients/transports/http.ts +51 -0
- package/src/clients/transports/index.test.ts +15 -0
- package/src/clients/transports/index.ts +17 -0
- package/src/clients/transports/webSocket.test.ts +164 -0
- package/src/clients/transports/webSocket.ts +117 -0
- package/src/errors/abi.test.ts +83 -0
- package/src/errors/abi.ts +238 -0
- package/src/errors/address.test.ts +14 -0
- package/src/errors/address.ts +9 -0
- package/src/errors/base.test.ts +72 -0
- package/src/errors/base.ts +57 -0
- package/src/errors/block.test.ts +24 -0
- package/src/errors/block.ts +18 -0
- package/src/errors/contract.ts +125 -0
- package/src/errors/data.ts +20 -0
- package/src/errors/encoding.ts +60 -0
- package/src/errors/index.ts +77 -0
- package/src/errors/log.ts +8 -0
- package/src/errors/request.test.ts +331 -0
- package/src/errors/request.ts +163 -0
- package/src/errors/rpc.test.ts +88 -0
- package/src/errors/rpc.ts +113 -0
- package/src/errors/transaction.test.ts +83 -0
- package/src/errors/transaction.ts +54 -0
- package/src/errors/transport.test.ts +12 -0
- package/src/errors/transport.ts +12 -0
- package/src/index.test.ts +214 -0
- package/src/index.ts +373 -0
- package/src/public.ts +80 -0
- package/src/test.ts +51 -0
- package/src/types/block.ts +71 -0
- package/src/types/chain.ts +6 -0
- package/src/types/contract.ts +342 -0
- package/src/types/eip1193.ts +1041 -0
- package/src/types/fee.ts +47 -0
- package/src/types/filter.ts +8 -0
- package/src/types/formatter.ts +23 -0
- package/src/types/index.ts +78 -0
- package/src/types/log.ts +22 -0
- package/src/types/misc.ts +5 -0
- package/src/types/rpc.ts +35 -0
- package/src/types/transaction.ts +145 -0
- package/src/types/utils.ts +67 -0
- package/src/types/window.ts +9 -0
- package/src/utils/abi/decodeAbi.bench.ts +135 -0
- package/src/utils/abi/decodeAbi.test.ts +1615 -0
- package/src/utils/abi/decodeAbi.ts +296 -0
- package/src/utils/abi/decodeDeployData.test.ts +159 -0
- package/src/utils/abi/decodeDeployData.ts +41 -0
- package/src/utils/abi/decodeErrorResult.test.ts +130 -0
- package/src/utils/abi/decodeErrorResult.ts +28 -0
- package/src/utils/abi/decodeFunctionData.test.ts +140 -0
- package/src/utils/abi/decodeFunctionData.ts +29 -0
- package/src/utils/abi/decodeFunctionResult.test.ts +262 -0
- package/src/utils/abi/decodeFunctionResult.ts +53 -0
- package/src/utils/abi/encodeAbi.bench.ts +163 -0
- package/src/utils/abi/encodeAbi.test.ts +1414 -0
- package/src/utils/abi/encodeAbi.ts +258 -0
- package/src/utils/abi/encodeDeployData.test.ts +131 -0
- package/src/utils/abi/encodeDeployData.ts +37 -0
- package/src/utils/abi/encodeErrorResult.test.ts +197 -0
- package/src/utils/abi/encodeErrorResult.ts +40 -0
- package/src/utils/abi/encodeEventTopics.test.ts +348 -0
- package/src/utils/abi/encodeEventTopics.ts +69 -0
- package/src/utils/abi/encodeFunctionData.test.ts +140 -0
- package/src/utils/abi/encodeFunctionData.ts +38 -0
- package/src/utils/abi/encodeFunctionResult.test.ts +284 -0
- package/src/utils/abi/encodeFunctionResult.ts +39 -0
- package/src/utils/abi/formatAbiItem.test.ts +335 -0
- package/src/utils/abi/formatAbiItem.ts +41 -0
- package/src/utils/abi/formatAbiItemWithArgs.test.ts +291 -0
- package/src/utils/abi/formatAbiItemWithArgs.ts +27 -0
- package/src/utils/abi/getAbiItem.ts +5 -0
- package/src/utils/abi/index.test.ts +23 -0
- package/src/utils/abi/index.ts +38 -0
- package/src/utils/address/getAddress.bench.ts +22 -0
- package/src/utils/address/getAddress.test.ts +46 -0
- package/src/utils/address/getAddress.ts +28 -0
- package/src/utils/address/getContractAddress.bench.ts +20 -0
- package/src/utils/address/getContractAddress.test.ts +78 -0
- package/src/utils/address/getContractAddress.ts +59 -0
- package/src/utils/address/index.test.ts +17 -0
- package/src/utils/address/index.ts +16 -0
- package/src/utils/address/isAddress.test.ts +10 -0
- package/src/utils/address/isAddress.ts +10 -0
- package/src/utils/address/isAddressEqual.test.ts +55 -0
- package/src/utils/address/isAddressEqual.ts +6 -0
- package/src/utils/buildRequest.test.ts +365 -0
- package/src/utils/buildRequest.ts +45 -0
- package/src/utils/chain.test.ts +43 -0
- package/src/utils/chain.ts +8 -0
- package/src/utils/contract/extractFunctionParts.test.ts +109 -0
- package/src/utils/contract/extractFunctionParts.ts +27 -0
- package/src/utils/contract/getContractError.test.ts +97 -0
- package/src/utils/contract/getContractError.ts +66 -0
- package/src/utils/contract/index.test.ts +15 -0
- package/src/utils/contract/index.ts +8 -0
- package/src/utils/data/concat.test.ts +35 -0
- package/src/utils/data/concat.ts +34 -0
- package/src/utils/data/index.test.ts +23 -0
- package/src/utils/data/index.ts +13 -0
- package/src/utils/data/isBytes.test.ts +9 -0
- package/src/utils/data/isBytes.ts +7 -0
- package/src/utils/data/isHex.test.ts +13 -0
- package/src/utils/data/isHex.ts +5 -0
- package/src/utils/data/pad.bench.ts +39 -0
- package/src/utils/data/pad.test.ts +367 -0
- package/src/utils/data/pad.ts +53 -0
- package/src/utils/data/size.test.ts +18 -0
- package/src/utils/data/size.ts +13 -0
- package/src/utils/data/slice.test.ts +203 -0
- package/src/utils/data/slice.ts +60 -0
- package/src/utils/data/trim.bench.ts +50 -0
- package/src/utils/data/trim.test.ts +175 -0
- package/src/utils/data/trim.ts +33 -0
- package/src/utils/encoding/decodeBytes.bench.ts +40 -0
- package/src/utils/encoding/decodeBytes.test.ts +144 -0
- package/src/utils/encoding/decodeBytes.ts +63 -0
- package/src/utils/encoding/decodeHex.bench.ts +24 -0
- package/src/utils/encoding/decodeHex.test.ts +167 -0
- package/src/utils/encoding/decodeHex.ts +76 -0
- package/src/utils/encoding/decodeRlp.bench.ts +34 -0
- package/src/utils/encoding/decodeRlp.test.ts +350 -0
- package/src/utils/encoding/decodeRlp.ts +121 -0
- package/src/utils/encoding/encodeBytes.bench.ts +41 -0
- package/src/utils/encoding/encodeBytes.test.ts +676 -0
- package/src/utils/encoding/encodeBytes.ts +59 -0
- package/src/utils/encoding/encodeHex.bench.ts +60 -0
- package/src/utils/encoding/encodeHex.test.ts +232 -0
- package/src/utils/encoding/encodeHex.ts +104 -0
- package/src/utils/encoding/encodeRlp.bench.ts +54 -0
- package/src/utils/encoding/encodeRlp.test.ts +254 -0
- package/src/utils/encoding/encodeRlp.ts +48 -0
- package/src/utils/encoding/index.test.ts +32 -0
- package/src/utils/encoding/index.ts +36 -0
- package/src/utils/formatters/block.bench.ts +51 -0
- package/src/utils/formatters/block.test.ts +115 -0
- package/src/utils/formatters/block.ts +37 -0
- package/src/utils/formatters/extract.test.ts +14 -0
- package/src/utils/formatters/extract.ts +18 -0
- package/src/utils/formatters/feeHistory.test.ts +66 -0
- package/src/utils/formatters/feeHistory.ts +12 -0
- package/src/utils/formatters/format.test.ts +93 -0
- package/src/utils/formatters/format.ts +90 -0
- package/src/utils/formatters/index.test.ts +27 -0
- package/src/utils/formatters/index.ts +34 -0
- package/src/utils/formatters/log.test.ts +79 -0
- package/src/utils/formatters/log.ts +12 -0
- package/src/utils/formatters/transaction.test.ts +271 -0
- package/src/utils/formatters/transaction.ts +63 -0
- package/src/utils/formatters/transactionReceipt.bench.ts +73 -0
- package/src/utils/formatters/transactionReceipt.test.ts +151 -0
- package/src/utils/formatters/transactionReceipt.ts +63 -0
- package/src/utils/formatters/transactionRequest.bench.ts +29 -0
- package/src/utils/formatters/transactionRequest.test.ts +237 -0
- package/src/utils/formatters/transactionRequest.ts +56 -0
- package/src/utils/hash/getEventSignature.test.ts +61 -0
- package/src/utils/hash/getEventSignature.ts +4 -0
- package/src/utils/hash/getFunctionSignature.test.ts +22 -0
- package/src/utils/hash/getFunctionSignature.ts +5 -0
- package/src/utils/hash/hashFunction.test.ts +65 -0
- package/src/utils/hash/hashFunction.ts +12 -0
- package/src/utils/hash/index.test.ts +13 -0
- package/src/utils/hash/index.ts +5 -0
- package/src/utils/hash/keccak256.test.ts +59 -0
- package/src/utils/hash/keccak256.ts +23 -0
- package/src/utils/index.test.ts +110 -0
- package/src/utils/index.ts +137 -0
- package/src/utils/observe.test.ts +176 -0
- package/src/utils/observe.ts +66 -0
- package/src/utils/poll.test.ts +127 -0
- package/src/utils/poll.ts +42 -0
- package/src/utils/promise/index.test.ts +14 -0
- package/src/utils/promise/index.ts +3 -0
- package/src/utils/promise/withCache.test.ts +97 -0
- package/src/utils/promise/withCache.ts +73 -0
- package/src/utils/promise/withRetry.test.ts +231 -0
- package/src/utils/promise/withRetry.ts +61 -0
- package/src/utils/promise/withTimeout.test.ts +37 -0
- package/src/utils/promise/withTimeout.ts +39 -0
- package/src/utils/rpc.test.ts +992 -0
- package/src/utils/rpc.ts +292 -0
- package/src/utils/stringify.test.ts +13 -0
- package/src/utils/stringify.ts +5 -0
- package/src/utils/uid.ts +14 -0
- package/src/utils/unit/constants.test.ts +22 -0
- package/src/utils/unit/constants.ts +12 -0
- package/src/utils/unit/formatEther.test.ts +75 -0
- package/src/utils/unit/formatEther.ts +6 -0
- package/src/utils/unit/formatGwei.test.ts +32 -0
- package/src/utils/unit/formatGwei.ts +6 -0
- package/src/utils/unit/formatUnit.bench.ts +26 -0
- package/src/utils/unit/formatUnit.test.ts +40 -0
- package/src/utils/unit/formatUnit.ts +16 -0
- package/src/utils/unit/index.test.ts +28 -0
- package/src/utils/unit/index.ts +7 -0
- package/src/utils/unit/parseEther.test.ts +126 -0
- package/src/utils/unit/parseEther.ts +6 -0
- package/src/utils/unit/parseGwei.test.ts +50 -0
- package/src/utils/unit/parseGwei.ts +6 -0
- package/src/utils/unit/parseUnit.bench.ts +26 -0
- package/src/utils/unit/parseUnit.test.ts +54 -0
- package/src/utils/unit/parseUnit.ts +27 -0
- package/src/utils/wait.ts +3 -0
- package/src/wallet.ts +23 -0
- package/src/window.ts +1 -0
- package/utils/package.json +1 -1
- package/window/package.json +1 -1
- package/actions/package.json +0 -4
- package/dist/BaseError-7688f84e.d.ts +0 -18
- package/dist/actions/index.d.ts +0 -8
- package/dist/actions/index.js +0 -123
- package/dist/createWalletClient-915223f3.d.ts +0 -130
- package/dist/transactionRequest-ade896ac.d.ts +0 -44
@@ -8,10 +8,10 @@ var __publicField = (obj, key, value) => {
|
|
8
8
|
// package.json
|
9
9
|
var package_default = {
|
10
10
|
name: "viem",
|
11
|
-
description: "TypeScript
|
12
|
-
version: "0.0.1-alpha.
|
11
|
+
description: "TypeScript Interface for Ethereum",
|
12
|
+
version: "0.0.1-alpha.20",
|
13
13
|
scripts: {
|
14
|
-
anvil: "source .env && anvil --fork-url $
|
14
|
+
anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
|
15
15
|
bench: "vitest bench --no-threads",
|
16
16
|
"bench:ci": "CI=true vitest bench --no-threads",
|
17
17
|
build: "tsup",
|
@@ -27,10 +27,12 @@ var package_default = {
|
|
27
27
|
"playground:benchmark": "pnpm --filter playground-benchmark dev",
|
28
28
|
postinstall: "pnpm dev",
|
29
29
|
preinstall: "npx only-allow pnpm",
|
30
|
+
prepublishOnly: "pnpm ts-node scripts/generate-package-json.ts",
|
30
31
|
prepare: "npx simple-git-hooks",
|
31
32
|
test: "vitest dev --coverage --no-threads",
|
32
33
|
"test:ci": "CI=true vitest --coverage --no-threads",
|
33
34
|
"test:ui": "vitest dev --ui --no-threads",
|
35
|
+
"ts-node": "node --loader esbuild-register/loader -r esbuild-register",
|
34
36
|
typecheck: "tsc --noEmit"
|
35
37
|
},
|
36
38
|
files: [
|
@@ -38,6 +40,7 @@ var package_default = {
|
|
38
40
|
"/chains",
|
39
41
|
"/dist",
|
40
42
|
"/clients",
|
43
|
+
"/src",
|
41
44
|
"/types",
|
42
45
|
"/utils",
|
43
46
|
"/window"
|
@@ -45,38 +48,54 @@ var package_default = {
|
|
45
48
|
exports: {
|
46
49
|
".": {
|
47
50
|
types: "./dist/index.d.ts",
|
51
|
+
module: "./dist/index.mjs",
|
48
52
|
default: "./dist/index.js"
|
49
53
|
},
|
50
|
-
"./actions": {
|
51
|
-
types: "./dist/actions/index.d.ts",
|
52
|
-
default: "./dist/actions/index.js"
|
53
|
-
},
|
54
54
|
"./chains": {
|
55
55
|
types: "./dist/chains.d.ts",
|
56
|
+
module: "./dist/chains.mjs",
|
56
57
|
default: "./dist/chains.js"
|
57
58
|
},
|
58
59
|
"./clients": {
|
59
60
|
types: "./dist/clients/index.d.ts",
|
61
|
+
module: "./dist/clients/index.mjs",
|
60
62
|
default: "./dist/clients/index.js"
|
61
63
|
},
|
64
|
+
"./public": {
|
65
|
+
types: "./dist/public.d.ts",
|
66
|
+
module: "./dist/public.mjs",
|
67
|
+
default: "./dist/public.js"
|
68
|
+
},
|
69
|
+
"./test": {
|
70
|
+
types: "./dist/test.d.ts",
|
71
|
+
module: "./dist/test.mjs",
|
72
|
+
default: "./dist/test.js"
|
73
|
+
},
|
62
74
|
"./utils": {
|
63
75
|
types: "./dist/utils/index.d.ts",
|
76
|
+
module: "./dist/utils/index.mjs",
|
64
77
|
default: "./dist/utils/index.js"
|
65
78
|
},
|
79
|
+
"./wallet": {
|
80
|
+
types: "./dist/wallet.d.ts",
|
81
|
+
module: "./dist/wallet.mjs",
|
82
|
+
default: "./dist/wallet.js"
|
83
|
+
},
|
66
84
|
"./window": {
|
67
85
|
types: "./dist/window.d.ts",
|
86
|
+
module: "./dist/window.mjs",
|
68
87
|
default: "./dist/window.js"
|
69
88
|
},
|
70
89
|
"./package.json": "./package.json"
|
71
90
|
},
|
72
|
-
type: "module",
|
73
91
|
main: "dist/index.js",
|
92
|
+
module: "dist/index.mjs",
|
74
93
|
types: "dist/index.d.ts",
|
75
94
|
sideEffects: false,
|
76
95
|
dependencies: {
|
77
96
|
"@noble/hashes": "^1.1.2",
|
78
|
-
"@wagmi/chains": "
|
79
|
-
abitype: "
|
97
|
+
"@wagmi/chains": "~0.2.6",
|
98
|
+
abitype: "~0.2.5"
|
80
99
|
},
|
81
100
|
devDependencies: {
|
82
101
|
"@actions/core": "^1.10.0",
|
@@ -129,30 +148,706 @@ var package_default = {
|
|
129
148
|
}
|
130
149
|
};
|
131
150
|
|
132
|
-
// src/utils/
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
this
|
151
|
+
// src/utils/stringify.ts
|
152
|
+
function stringify(value) {
|
153
|
+
return JSON.stringify(
|
154
|
+
value,
|
155
|
+
(_, value2) => typeof value2 === "bigint" ? value2.toString() : value2
|
156
|
+
);
|
157
|
+
}
|
158
|
+
|
159
|
+
// src/errors/base.ts
|
160
|
+
var version = process.env.TEST ? "1.0.2" : package_default.version;
|
161
|
+
var BaseError = class extends Error {
|
162
|
+
constructor(humanMessage, args = {}) {
|
163
|
+
const details = args.cause instanceof BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
|
164
|
+
const docsPath5 = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
|
165
|
+
const message = [
|
166
|
+
humanMessage,
|
167
|
+
...docsPath5 ? ["", `Docs: https://viem.sh${docsPath5}`] : [],
|
168
|
+
"",
|
169
|
+
...details ? [`Details: ${details}`] : [],
|
170
|
+
`Version: viem@${version}`,
|
171
|
+
...args.cause && !(args.cause instanceof BaseError) && Object.keys(args.cause).length > 0 ? [`Internal Error: ${stringify(args.cause)}`] : []
|
172
|
+
].join("\n");
|
173
|
+
super(message);
|
174
|
+
__publicField(this, "humanMessage");
|
175
|
+
__publicField(this, "details");
|
176
|
+
__publicField(this, "docsPath");
|
177
|
+
__publicField(this, "name", "ViemError");
|
178
|
+
if (args.cause)
|
179
|
+
this.cause = args.cause;
|
180
|
+
this.details = details;
|
181
|
+
this.docsPath = docsPath5;
|
182
|
+
this.humanMessage = humanMessage;
|
183
|
+
}
|
184
|
+
};
|
185
|
+
|
186
|
+
// src/errors/abi.ts
|
187
|
+
var AbiConstructorNotFoundError = class extends BaseError {
|
188
|
+
constructor({ docsPath: docsPath5 }) {
|
189
|
+
super(
|
190
|
+
[
|
191
|
+
"A constructor was not found on the ABI.",
|
192
|
+
"Make sure you are using the correct ABI and that the constructor exists on it."
|
193
|
+
].join("\n"),
|
194
|
+
{
|
195
|
+
docsPath: docsPath5
|
196
|
+
}
|
197
|
+
);
|
198
|
+
__publicField(this, "name", "AbiConstructorNotFoundError");
|
199
|
+
}
|
200
|
+
};
|
201
|
+
var AbiConstructorParamsNotFoundError = class extends BaseError {
|
202
|
+
constructor({ docsPath: docsPath5 }) {
|
203
|
+
super(
|
204
|
+
[
|
205
|
+
"Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
|
206
|
+
"Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
|
207
|
+
].join("\n"),
|
208
|
+
{
|
209
|
+
docsPath: docsPath5
|
210
|
+
}
|
211
|
+
);
|
212
|
+
__publicField(this, "name", "AbiConstructorParamsNotFoundError");
|
213
|
+
}
|
214
|
+
};
|
215
|
+
var AbiDecodingDataSizeInvalidError = class extends BaseError {
|
216
|
+
constructor(size2) {
|
217
|
+
super(
|
218
|
+
[
|
219
|
+
`Data size of ${size2} bytes is invalid.`,
|
220
|
+
"Size must be in increments of 32 bytes (size % 32 === 0)."
|
221
|
+
].join("\n")
|
222
|
+
);
|
223
|
+
__publicField(this, "name", "AbiDecodingDataSizeInvalidError");
|
224
|
+
}
|
225
|
+
};
|
226
|
+
var AbiDecodingZeroDataError = class extends BaseError {
|
227
|
+
constructor() {
|
228
|
+
super('Cannot decode zero data ("0x") with ABI parameters.');
|
229
|
+
__publicField(this, "name", "AbiDecodingZeroDataError");
|
230
|
+
}
|
231
|
+
};
|
232
|
+
var AbiEncodingArrayLengthMismatchError = class extends BaseError {
|
233
|
+
constructor({
|
234
|
+
expectedLength,
|
235
|
+
givenLength,
|
236
|
+
type
|
237
|
+
}) {
|
238
|
+
super(
|
239
|
+
[
|
240
|
+
`ABI encoding array length mismatch for type ${type}.`,
|
241
|
+
`Expected length: ${expectedLength}`,
|
242
|
+
`Given length: ${givenLength}`
|
243
|
+
].join("\n")
|
244
|
+
);
|
245
|
+
__publicField(this, "name", "AbiEncodingArrayLengthMismatchError");
|
246
|
+
}
|
247
|
+
};
|
248
|
+
var AbiEncodingLengthMismatchError = class extends BaseError {
|
249
|
+
constructor({
|
250
|
+
expectedLength,
|
251
|
+
givenLength
|
252
|
+
}) {
|
253
|
+
super(
|
254
|
+
[
|
255
|
+
"ABI encoding params/values length mismatch.",
|
256
|
+
`Expected length (params): ${expectedLength}`,
|
257
|
+
`Given length (values): ${givenLength}`
|
258
|
+
].join("\n")
|
259
|
+
);
|
260
|
+
__publicField(this, "name", "AbiEncodingLengthMismatchError");
|
261
|
+
}
|
262
|
+
};
|
263
|
+
var AbiErrorInputsNotFoundError = class extends BaseError {
|
264
|
+
constructor(errorName, { docsPath: docsPath5 }) {
|
265
|
+
super(
|
266
|
+
[
|
267
|
+
`Arguments (\`args\`) were provided to "${errorName}", but "${errorName}" on the ABI does not contain any parameters (\`inputs\`).`,
|
268
|
+
"Cannot encode error result without knowing what the parameter types are.",
|
269
|
+
"Make sure you are using the correct ABI and that the inputs exist on it."
|
270
|
+
].join("\n"),
|
271
|
+
{
|
272
|
+
docsPath: docsPath5
|
273
|
+
}
|
274
|
+
);
|
275
|
+
__publicField(this, "name", "AbiErrorInputsNotFoundError");
|
276
|
+
}
|
277
|
+
};
|
278
|
+
var AbiErrorNotFoundError = class extends BaseError {
|
279
|
+
constructor(errorName, { docsPath: docsPath5 }) {
|
280
|
+
super(
|
281
|
+
[
|
282
|
+
`Error "${errorName}" not found on ABI.`,
|
283
|
+
"Make sure you are using the correct ABI and that the error exists on it."
|
284
|
+
].join("\n"),
|
285
|
+
{
|
286
|
+
docsPath: docsPath5
|
287
|
+
}
|
288
|
+
);
|
289
|
+
__publicField(this, "name", "AbiErrorNotFoundError");
|
290
|
+
}
|
291
|
+
};
|
292
|
+
var AbiErrorSignatureNotFoundError = class extends BaseError {
|
293
|
+
constructor(signature, { docsPath: docsPath5 }) {
|
294
|
+
super(
|
295
|
+
[
|
296
|
+
`Encoded error signature "${signature}" not found on ABI.`,
|
297
|
+
"Make sure you are using the correct ABI and that the error exists on it.",
|
298
|
+
`You can look up the signature "${signature}" here: https://sig.eth.samczsun.com/.`
|
299
|
+
].join("\n"),
|
300
|
+
{
|
301
|
+
docsPath: docsPath5
|
302
|
+
}
|
303
|
+
);
|
304
|
+
__publicField(this, "name", "AbiErrorSignatureNotFoundError");
|
305
|
+
}
|
306
|
+
};
|
307
|
+
var AbiEventNotFoundError = class extends BaseError {
|
308
|
+
constructor(eventName, { docsPath: docsPath5 }) {
|
309
|
+
super(
|
310
|
+
[
|
311
|
+
`Event "${eventName}" not found on ABI.`,
|
312
|
+
"Make sure you are using the correct ABI and that the event exists on it."
|
313
|
+
].join("\n"),
|
314
|
+
{
|
315
|
+
docsPath: docsPath5
|
316
|
+
}
|
317
|
+
);
|
318
|
+
__publicField(this, "name", "AbiEventNotFoundError");
|
319
|
+
}
|
320
|
+
};
|
321
|
+
var AbiFunctionNotFoundError = class extends BaseError {
|
322
|
+
constructor(functionName, { docsPath: docsPath5 }) {
|
323
|
+
super(
|
324
|
+
[
|
325
|
+
`Function "${functionName}" not found on ABI.`,
|
326
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
327
|
+
].join("\n"),
|
328
|
+
{
|
329
|
+
docsPath: docsPath5
|
330
|
+
}
|
331
|
+
);
|
332
|
+
__publicField(this, "name", "AbiFunctionNotFoundError");
|
333
|
+
}
|
334
|
+
};
|
335
|
+
var AbiFunctionOutputsNotFoundError = class extends BaseError {
|
336
|
+
constructor(functionName, { docsPath: docsPath5 }) {
|
337
|
+
super(
|
338
|
+
[
|
339
|
+
`Function "${functionName}" does not contain any \`outputs\` on ABI.`,
|
340
|
+
"Cannot decode function result without knowing what the parameter types are.",
|
341
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
342
|
+
].join("\n"),
|
343
|
+
{
|
344
|
+
docsPath: docsPath5
|
345
|
+
}
|
346
|
+
);
|
347
|
+
__publicField(this, "name", "AbiFunctionOutputsNotFoundError");
|
348
|
+
}
|
349
|
+
};
|
350
|
+
var AbiFunctionSignatureNotFoundError = class extends BaseError {
|
351
|
+
constructor(signature, { docsPath: docsPath5 }) {
|
352
|
+
super(
|
353
|
+
[
|
354
|
+
`Encoded function signature "${signature}" not found on ABI.`,
|
355
|
+
"Make sure you are using the correct ABI and that the function exists on it.",
|
356
|
+
`You can look up the signature "${signature}" here: https://sig.eth.samczsun.com/.`
|
357
|
+
].join("\n"),
|
358
|
+
{
|
359
|
+
docsPath: docsPath5
|
360
|
+
}
|
361
|
+
);
|
362
|
+
__publicField(this, "name", "AbiFunctionSignatureNotFoundError");
|
363
|
+
}
|
364
|
+
};
|
365
|
+
var InvalidAbiEncodingTypeError = class extends BaseError {
|
366
|
+
constructor(type, { docsPath: docsPath5 }) {
|
367
|
+
super(
|
368
|
+
[
|
369
|
+
`Type "${type}" is not a valid encoding type.`,
|
370
|
+
"Please provide a valid ABI type."
|
371
|
+
].join("\n"),
|
372
|
+
{ docsPath: docsPath5 }
|
373
|
+
);
|
374
|
+
__publicField(this, "name", "InvalidAbiEncodingType");
|
375
|
+
}
|
376
|
+
};
|
377
|
+
var InvalidAbiDecodingTypeError = class extends BaseError {
|
378
|
+
constructor(type, { docsPath: docsPath5 }) {
|
379
|
+
super(
|
380
|
+
[
|
381
|
+
`Type "${type}" is not a valid decoding type.`,
|
382
|
+
"Please provide a valid ABI type."
|
383
|
+
].join("\n"),
|
384
|
+
{ docsPath: docsPath5 }
|
385
|
+
);
|
386
|
+
__publicField(this, "name", "InvalidAbiDecodingType");
|
387
|
+
}
|
388
|
+
};
|
389
|
+
var InvalidArrayError = class extends BaseError {
|
390
|
+
constructor(value) {
|
391
|
+
super([`Value "${value}" is not a valid array.`].join("\n"));
|
392
|
+
__publicField(this, "name", "InvalidArrayError");
|
393
|
+
}
|
394
|
+
};
|
395
|
+
var InvalidDefinitionTypeError = class extends BaseError {
|
396
|
+
constructor(type) {
|
397
|
+
super(
|
398
|
+
[
|
399
|
+
`"${type}" is not a valid definition type.`,
|
400
|
+
'Valid types: "function", "event", "error"'
|
401
|
+
].join("\n")
|
402
|
+
);
|
403
|
+
__publicField(this, "name", "InvalidDefinitionTypeError");
|
404
|
+
}
|
405
|
+
};
|
406
|
+
|
407
|
+
// src/errors/address.ts
|
408
|
+
var InvalidAddressError = class extends BaseError {
|
409
|
+
constructor({ address }) {
|
410
|
+
super(`Address "${address}" is invalid.`);
|
411
|
+
__publicField(this, "name", "InvalidAddressError");
|
412
|
+
}
|
413
|
+
};
|
414
|
+
|
415
|
+
// src/errors/block.ts
|
416
|
+
var BlockNotFoundError = class extends BaseError {
|
417
|
+
constructor({
|
418
|
+
blockHash,
|
419
|
+
blockNumber
|
420
|
+
}) {
|
421
|
+
let identifier = "Block";
|
422
|
+
if (blockHash)
|
423
|
+
identifier = `Block at hash "${blockHash}"`;
|
424
|
+
if (blockNumber)
|
425
|
+
identifier = `Block at number "${blockNumber}"`;
|
426
|
+
super(`${identifier} could not be found.`);
|
427
|
+
__publicField(this, "name", "BlockNotFoundError");
|
428
|
+
}
|
429
|
+
};
|
430
|
+
|
431
|
+
// src/errors/contract.ts
|
432
|
+
var ContractMethodExecutionError = class extends BaseError {
|
433
|
+
constructor(message, {
|
434
|
+
abi,
|
435
|
+
args,
|
436
|
+
cause,
|
437
|
+
contractAddress,
|
438
|
+
formattedArgs,
|
439
|
+
functionName,
|
440
|
+
functionWithParams,
|
441
|
+
sender
|
442
|
+
} = {}) {
|
443
|
+
super(
|
444
|
+
[
|
445
|
+
message,
|
446
|
+
" ",
|
447
|
+
sender && `Sender: ${sender}`,
|
448
|
+
contractAddress && `Contract: ${process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
|
449
|
+
functionWithParams && `Function: ${functionWithParams}`,
|
450
|
+
formattedArgs && `Arguments: ${[...Array(functionName?.length ?? 0).keys()].map(() => " ").join("")}${formattedArgs}`
|
451
|
+
].filter(Boolean).join("\n"),
|
452
|
+
{
|
453
|
+
cause
|
454
|
+
}
|
455
|
+
);
|
456
|
+
__publicField(this, "abi");
|
457
|
+
__publicField(this, "args");
|
458
|
+
__publicField(this, "contractAddress");
|
459
|
+
__publicField(this, "formattedArgs");
|
460
|
+
__publicField(this, "functionName");
|
461
|
+
__publicField(this, "reason");
|
462
|
+
__publicField(this, "sender");
|
463
|
+
__publicField(this, "name", "ContractMethodExecutionError");
|
464
|
+
if (message)
|
465
|
+
this.reason = message;
|
466
|
+
this.abi = abi;
|
467
|
+
this.args = args;
|
468
|
+
this.contractAddress = contractAddress;
|
469
|
+
this.functionName = functionName;
|
470
|
+
this.sender = sender;
|
471
|
+
}
|
472
|
+
};
|
473
|
+
var ContractMethodZeroDataError = class extends BaseError {
|
474
|
+
constructor({
|
475
|
+
abi,
|
476
|
+
args,
|
477
|
+
cause,
|
478
|
+
contractAddress,
|
479
|
+
functionName,
|
480
|
+
functionWithParams
|
481
|
+
} = {}) {
|
482
|
+
super(
|
483
|
+
[
|
484
|
+
`The contract method "${functionName}" returned no data ("0x"). This could be due to any of the following:`,
|
485
|
+
`- The contract does not have the function "${functionName}",`,
|
486
|
+
"- The parameters passed to the contract function may be invalid, or",
|
487
|
+
"- The address is not a contract.",
|
488
|
+
" ",
|
489
|
+
contractAddress && `Contract: ${process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
|
490
|
+
functionWithParams && `Function: ${functionWithParams}`,
|
491
|
+
functionWithParams && ` > "0x"`
|
492
|
+
].filter(Boolean).join("\n"),
|
493
|
+
{
|
494
|
+
cause
|
495
|
+
}
|
496
|
+
);
|
497
|
+
__publicField(this, "abi");
|
498
|
+
__publicField(this, "args");
|
499
|
+
__publicField(this, "contractAddress");
|
500
|
+
__publicField(this, "functionName");
|
501
|
+
__publicField(this, "functionWithParams");
|
502
|
+
__publicField(this, "name", "ContractMethodZeroDataError");
|
503
|
+
this.abi = abi;
|
504
|
+
this.args = args;
|
505
|
+
this.contractAddress = contractAddress;
|
506
|
+
this.functionName = functionName;
|
507
|
+
}
|
508
|
+
};
|
509
|
+
|
510
|
+
// src/errors/data.ts
|
511
|
+
var SizeExceedsPaddingSizeError = class extends BaseError {
|
512
|
+
constructor({
|
513
|
+
size: size2,
|
514
|
+
targetSize,
|
515
|
+
type
|
516
|
+
}) {
|
517
|
+
super(
|
518
|
+
`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`
|
519
|
+
);
|
520
|
+
__publicField(this, "name", "SizeExceedsPaddingSizeError");
|
521
|
+
}
|
522
|
+
};
|
523
|
+
|
524
|
+
// src/errors/encoding.ts
|
525
|
+
var DataLengthTooLongError = class extends BaseError {
|
526
|
+
constructor({ consumed, length }) {
|
527
|
+
super(
|
528
|
+
`Consumed bytes (${consumed}) is shorter than data length (${length - 1}).`
|
529
|
+
);
|
530
|
+
__publicField(this, "name", "DataLengthTooLongError");
|
531
|
+
}
|
532
|
+
};
|
533
|
+
var DataLengthTooShortError = class extends BaseError {
|
534
|
+
constructor({ length, dataLength }) {
|
535
|
+
super(
|
536
|
+
`Data length (${dataLength - 1}) is shorter than prefix length (${length - 1}).`
|
537
|
+
);
|
538
|
+
__publicField(this, "name", "DataLengthTooShortError");
|
539
|
+
}
|
540
|
+
};
|
541
|
+
var InvalidBytesBooleanError = class extends BaseError {
|
542
|
+
constructor(bytes) {
|
543
|
+
super(
|
544
|
+
`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`
|
545
|
+
);
|
546
|
+
__publicField(this, "name", "InvalidBytesBooleanError");
|
547
|
+
}
|
548
|
+
};
|
549
|
+
var InvalidHexBooleanError = class extends BaseError {
|
550
|
+
constructor(hex) {
|
551
|
+
super(
|
552
|
+
`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`
|
553
|
+
);
|
554
|
+
__publicField(this, "name", "InvalidHexBooleanError");
|
555
|
+
}
|
556
|
+
};
|
557
|
+
var InvalidHexValueError = class extends BaseError {
|
558
|
+
constructor(value) {
|
559
|
+
super(
|
560
|
+
`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`
|
561
|
+
);
|
562
|
+
__publicField(this, "name", "InvalidHexValueError");
|
563
|
+
}
|
564
|
+
};
|
565
|
+
var OffsetOutOfBoundsError = class extends BaseError {
|
566
|
+
constructor({ nextOffset, offset }) {
|
567
|
+
super(
|
568
|
+
`Next offset (${nextOffset}) is greater than previous offset + consumed bytes (${offset})`
|
569
|
+
);
|
570
|
+
__publicField(this, "name", "OffsetOutOfBoundsError");
|
571
|
+
}
|
572
|
+
};
|
573
|
+
|
574
|
+
// src/errors/log.ts
|
575
|
+
var FilterTypeNotSupportedError = class extends BaseError {
|
576
|
+
constructor(type) {
|
577
|
+
super(`Filter type "${type}" is not supported.`);
|
578
|
+
__publicField(this, "name", "FilterTypeNotSupportedError");
|
579
|
+
}
|
580
|
+
};
|
581
|
+
|
582
|
+
// src/errors/request.ts
|
583
|
+
var RequestError = class extends BaseError {
|
584
|
+
constructor(err, { docsPath: docsPath5, humanMessage }) {
|
585
|
+
super(humanMessage, {
|
586
|
+
cause: err,
|
587
|
+
docsPath: docsPath5
|
588
|
+
});
|
589
|
+
this.name = err.name;
|
590
|
+
}
|
591
|
+
};
|
592
|
+
var RpcRequestError = class extends RequestError {
|
593
|
+
constructor(err, { docsPath: docsPath5, humanMessage }) {
|
594
|
+
super(err, { docsPath: docsPath5, humanMessage });
|
595
|
+
__publicField(this, "code");
|
596
|
+
this.code = err.code;
|
597
|
+
this.name = err.name;
|
598
|
+
}
|
599
|
+
};
|
600
|
+
var ParseRpcError = class extends RpcRequestError {
|
601
|
+
constructor(err) {
|
602
|
+
super(err, {
|
603
|
+
humanMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
|
604
|
+
});
|
605
|
+
__publicField(this, "name", "ParseRpcError");
|
606
|
+
__publicField(this, "code", -32700);
|
607
|
+
}
|
608
|
+
};
|
609
|
+
var InvalidRequestRpcError = class extends RpcRequestError {
|
610
|
+
constructor(err) {
|
611
|
+
super(err, { humanMessage: "JSON is not a valid request object." });
|
612
|
+
__publicField(this, "name", "InvalidRequestRpcError");
|
613
|
+
__publicField(this, "code", -32600);
|
614
|
+
}
|
615
|
+
};
|
616
|
+
var MethodNotFoundRpcError = class extends RpcRequestError {
|
617
|
+
constructor(err) {
|
618
|
+
super(err, {
|
619
|
+
humanMessage: "The method does not exist / is not available."
|
620
|
+
});
|
621
|
+
__publicField(this, "name", "MethodNotFoundRpcError");
|
622
|
+
__publicField(this, "code", -32601);
|
623
|
+
}
|
624
|
+
};
|
625
|
+
var InvalidParamsRpcError = class extends RpcRequestError {
|
626
|
+
constructor(err) {
|
627
|
+
super(err, {
|
628
|
+
humanMessage: [
|
629
|
+
"Invalid parameters were provided to the RPC method.",
|
630
|
+
"Double check you have provided the correct parameters."
|
631
|
+
].join("\n")
|
632
|
+
});
|
633
|
+
__publicField(this, "name", "InvalidParamsRpcError");
|
634
|
+
__publicField(this, "code", -32602);
|
635
|
+
}
|
636
|
+
};
|
637
|
+
var InternalRpcError = class extends RpcRequestError {
|
638
|
+
constructor(err) {
|
639
|
+
super(err, { humanMessage: "An internal error was received." });
|
640
|
+
__publicField(this, "name", "InternalRpcError");
|
641
|
+
__publicField(this, "code", -32603);
|
642
|
+
}
|
643
|
+
};
|
644
|
+
var InvalidInputRpcError = class extends RpcRequestError {
|
645
|
+
constructor(err) {
|
646
|
+
super(err, {
|
647
|
+
humanMessage: [
|
648
|
+
"Missing or invalid parameters.",
|
649
|
+
"Double check you have provided the correct parameters."
|
650
|
+
].join("\n")
|
651
|
+
});
|
652
|
+
__publicField(this, "name", "InvalidInputRpcError");
|
653
|
+
__publicField(this, "code", -32e3);
|
654
|
+
}
|
655
|
+
};
|
656
|
+
var ResourceNotFoundRpcError = class extends RpcRequestError {
|
657
|
+
constructor(err) {
|
658
|
+
super(err, { humanMessage: "Requested resource not found." });
|
659
|
+
__publicField(this, "name", "ResourceNotFoundRpcError");
|
660
|
+
__publicField(this, "code", -32001);
|
661
|
+
}
|
662
|
+
};
|
663
|
+
var ResourceUnavailableRpcError = class extends RpcRequestError {
|
664
|
+
constructor(err) {
|
665
|
+
super(err, { humanMessage: "Requested resource not available." });
|
666
|
+
__publicField(this, "name", "ResourceUnavailableRpcError");
|
667
|
+
__publicField(this, "code", -32002);
|
668
|
+
}
|
669
|
+
};
|
670
|
+
var TransactionRejectedRpcError = class extends RpcRequestError {
|
671
|
+
constructor(err) {
|
672
|
+
super(err, { humanMessage: "Transaction creation failed." });
|
673
|
+
__publicField(this, "name", "TransactionRejectedRpcError");
|
674
|
+
__publicField(this, "code", -32003);
|
675
|
+
}
|
676
|
+
};
|
677
|
+
var MethodNotSupportedRpcError = class extends RpcRequestError {
|
678
|
+
constructor(err) {
|
679
|
+
super(err, { humanMessage: "Method is not implemented." });
|
680
|
+
__publicField(this, "name", "MethodNotSupportedRpcError");
|
681
|
+
__publicField(this, "code", -32004);
|
682
|
+
}
|
683
|
+
};
|
684
|
+
var LimitExceededRpcError = class extends RpcRequestError {
|
685
|
+
constructor(err) {
|
686
|
+
super(err, { humanMessage: "Request exceeds defined limit." });
|
687
|
+
__publicField(this, "name", "LimitExceededRpcError");
|
688
|
+
__publicField(this, "code", -32005);
|
689
|
+
}
|
690
|
+
};
|
691
|
+
var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
|
692
|
+
constructor(err) {
|
693
|
+
super(err, {
|
694
|
+
humanMessage: "Version of JSON-RPC protocol is not supported."
|
695
|
+
});
|
696
|
+
__publicField(this, "name", "JsonRpcVersionUnsupportedError");
|
697
|
+
__publicField(this, "code", -32006);
|
698
|
+
}
|
699
|
+
};
|
700
|
+
var UnknownRpcError = class extends RequestError {
|
701
|
+
constructor(err) {
|
702
|
+
super(err, {
|
703
|
+
humanMessage: "An unknown RPC error occurred."
|
704
|
+
});
|
705
|
+
__publicField(this, "name", "UnknownRpcError");
|
706
|
+
}
|
707
|
+
};
|
708
|
+
|
709
|
+
// src/errors/rpc.ts
|
710
|
+
var HttpRequestError = class extends BaseError {
|
711
|
+
constructor({
|
712
|
+
body,
|
713
|
+
details,
|
714
|
+
status,
|
715
|
+
url
|
716
|
+
}) {
|
717
|
+
super(
|
718
|
+
[
|
719
|
+
"HTTP request failed.",
|
720
|
+
"",
|
721
|
+
`Status: ${status}`,
|
722
|
+
`URL: ${url}`,
|
723
|
+
`Request body: ${stringify(body)}`
|
724
|
+
].join("\n"),
|
725
|
+
{
|
726
|
+
details
|
727
|
+
}
|
728
|
+
);
|
729
|
+
__publicField(this, "name", "HttpRequestError");
|
730
|
+
__publicField(this, "status");
|
731
|
+
this.status = status;
|
732
|
+
}
|
733
|
+
};
|
734
|
+
var WebSocketRequestError = class extends BaseError {
|
735
|
+
constructor({
|
736
|
+
body,
|
737
|
+
details,
|
738
|
+
url
|
739
|
+
}) {
|
740
|
+
super(
|
741
|
+
[
|
742
|
+
"WebSocket request failed.",
|
743
|
+
"",
|
744
|
+
`URL: ${url}`,
|
745
|
+
`Request body: ${stringify(body)}`
|
746
|
+
].join("\n"),
|
747
|
+
{
|
748
|
+
details
|
749
|
+
}
|
750
|
+
);
|
751
|
+
__publicField(this, "name", "WebSocketRequestError");
|
752
|
+
}
|
753
|
+
};
|
754
|
+
var RpcError = class extends BaseError {
|
755
|
+
constructor({
|
756
|
+
body,
|
757
|
+
error,
|
758
|
+
url
|
759
|
+
}) {
|
760
|
+
super(
|
761
|
+
[
|
762
|
+
"RPC Request failed.",
|
763
|
+
"",
|
764
|
+
`URL: ${url}`,
|
765
|
+
`Request body: ${stringify(body)}`
|
766
|
+
].join("\n"),
|
767
|
+
{
|
768
|
+
cause: error,
|
769
|
+
details: error.message
|
770
|
+
}
|
771
|
+
);
|
772
|
+
__publicField(this, "code");
|
773
|
+
__publicField(this, "name", "RpcError");
|
774
|
+
this.code = error.code;
|
775
|
+
}
|
776
|
+
};
|
777
|
+
var TimeoutError = class extends BaseError {
|
778
|
+
constructor({
|
779
|
+
body,
|
780
|
+
url
|
781
|
+
}) {
|
782
|
+
super(
|
783
|
+
[
|
784
|
+
"The request took too long to respond.",
|
785
|
+
"",
|
786
|
+
`URL: ${url}`,
|
787
|
+
`Request body: ${stringify(body)}`
|
788
|
+
].join("\n"),
|
789
|
+
{
|
790
|
+
details: "The request timed out."
|
791
|
+
}
|
792
|
+
);
|
793
|
+
__publicField(this, "name", "TimeoutError");
|
794
|
+
}
|
795
|
+
};
|
796
|
+
|
797
|
+
// src/errors/transaction.ts
|
798
|
+
var InvalidGasArgumentsError = class extends BaseError {
|
799
|
+
constructor() {
|
800
|
+
super("`maxFeePerGas` cannot be less than `maxPriorityFeePerGas`");
|
801
|
+
__publicField(this, "name", "InvalidGasArgumentsError");
|
802
|
+
}
|
803
|
+
};
|
804
|
+
var TransactionNotFoundError = class extends BaseError {
|
805
|
+
constructor({
|
806
|
+
blockHash,
|
807
|
+
blockNumber,
|
808
|
+
blockTag,
|
809
|
+
hash: hash2,
|
810
|
+
index
|
811
|
+
}) {
|
812
|
+
let identifier = "Transaction";
|
813
|
+
if (blockTag && index !== void 0)
|
814
|
+
identifier = `Transaction at block time "${blockTag}" at index "${index}"`;
|
815
|
+
if (blockHash && index !== void 0)
|
816
|
+
identifier = `Transaction at block hash "${blockHash}" at index "${index}"`;
|
817
|
+
if (blockNumber && index !== void 0)
|
818
|
+
identifier = `Transaction at block number "${blockNumber}" at index "${index}"`;
|
819
|
+
if (hash2)
|
820
|
+
identifier = `Transaction with hash "${hash2}"`;
|
821
|
+
super(`${identifier} could not be found.`);
|
822
|
+
__publicField(this, "name", "TransactionNotFoundError");
|
823
|
+
}
|
824
|
+
};
|
825
|
+
var TransactionReceiptNotFoundError = class extends BaseError {
|
826
|
+
constructor({ hash: hash2 }) {
|
827
|
+
super(
|
828
|
+
`Transaction receipt with hash "${hash2}" could not be found. The Transaction may not be processed on a block yet.`
|
829
|
+
);
|
830
|
+
__publicField(this, "name", "TransactionReceiptNotFoundError");
|
831
|
+
}
|
832
|
+
};
|
833
|
+
var WaitForTransactionReceiptTimeoutError = class extends BaseError {
|
834
|
+
constructor({ hash: hash2 }) {
|
835
|
+
super(
|
836
|
+
`Timed out while waiting for transaction with hash "${hash2}" to be confirmed.`
|
837
|
+
);
|
838
|
+
__publicField(this, "name", "WaitForTransactionReceiptTimeoutError");
|
839
|
+
}
|
840
|
+
};
|
841
|
+
|
842
|
+
// src/errors/transport.ts
|
843
|
+
var UrlRequiredError = class extends BaseError {
|
844
|
+
constructor() {
|
845
|
+
super(
|
846
|
+
"No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",
|
847
|
+
{
|
848
|
+
docsPath: "/docs/clients/intro"
|
849
|
+
}
|
850
|
+
);
|
156
851
|
}
|
157
852
|
};
|
158
853
|
|
@@ -233,18 +928,6 @@ function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
|
|
233
928
|
}
|
234
929
|
return paddedBytes;
|
235
930
|
}
|
236
|
-
var SizeExceedsPaddingSizeError = class extends BaseError {
|
237
|
-
constructor({
|
238
|
-
size: size2,
|
239
|
-
targetSize,
|
240
|
-
type
|
241
|
-
}) {
|
242
|
-
super(
|
243
|
-
`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`
|
244
|
-
);
|
245
|
-
__publicField(this, "name", "SizeExceedsPaddingSizeError");
|
246
|
-
}
|
247
|
-
};
|
248
931
|
|
249
932
|
// src/utils/data/trim.ts
|
250
933
|
function trim(hexOrBytes, { dir = "left" } = {}) {
|
@@ -457,14 +1140,6 @@ function hexToString(hex) {
|
|
457
1140
|
const bytes = hexToBytes(hex);
|
458
1141
|
return new TextDecoder().decode(bytes);
|
459
1142
|
}
|
460
|
-
var InvalidHexBooleanError = class extends BaseError {
|
461
|
-
constructor(hex) {
|
462
|
-
super(
|
463
|
-
`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`
|
464
|
-
);
|
465
|
-
__publicField(this, "name", "InvalidHexBooleanError");
|
466
|
-
}
|
467
|
-
};
|
468
1143
|
|
469
1144
|
// src/utils/encoding/decodeBytes.ts
|
470
1145
|
function decodeBytes(bytes, to) {
|
@@ -494,14 +1169,6 @@ function bytesToNumber(bytes) {
|
|
494
1169
|
function bytesToString(bytes) {
|
495
1170
|
return new TextDecoder().decode(bytes);
|
496
1171
|
}
|
497
|
-
var InvalidBytesBooleanError = class extends BaseError {
|
498
|
-
constructor(bytes) {
|
499
|
-
super(
|
500
|
-
`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`
|
501
|
-
);
|
502
|
-
__publicField(this, "name", "InvalidBytesBooleanError");
|
503
|
-
}
|
504
|
-
};
|
505
1172
|
|
506
1173
|
// src/utils/encoding/decodeRlp.ts
|
507
1174
|
function decodeRlp(value, to) {
|
@@ -583,40 +1250,8 @@ function rlpToBytes(bytes, offset = 0) {
|
|
583
1250
|
}
|
584
1251
|
return [result, consumed];
|
585
1252
|
}
|
586
|
-
var DataLengthTooLongError = class extends BaseError {
|
587
|
-
constructor({ consumed, length }) {
|
588
|
-
super(
|
589
|
-
`Consumed bytes (${consumed}) is shorter than data length (${length - 1}).`
|
590
|
-
);
|
591
|
-
__publicField(this, "name", "DataLengthTooLongError");
|
592
|
-
}
|
593
|
-
};
|
594
|
-
var DataLengthTooShortError = class extends BaseError {
|
595
|
-
constructor({ length, dataLength }) {
|
596
|
-
super(
|
597
|
-
`Data length (${dataLength - 1}) is shorter than prefix length (${length - 1}).`
|
598
|
-
);
|
599
|
-
__publicField(this, "name", "DataLengthTooShortError");
|
600
|
-
}
|
601
|
-
};
|
602
|
-
var InvalidHexValueError = class extends BaseError {
|
603
|
-
constructor(value) {
|
604
|
-
super(
|
605
|
-
`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`
|
606
|
-
);
|
607
|
-
__publicField(this, "name", "InvalidHexValueError");
|
608
|
-
}
|
609
|
-
};
|
610
|
-
var OffsetOutOfBoundsError = class extends BaseError {
|
611
|
-
constructor({ nextOffset, offset }) {
|
612
|
-
super(
|
613
|
-
`Next offset (${nextOffset}) is greater than previous offset + consumed bytes (${offset})`
|
614
|
-
);
|
615
|
-
__publicField(this, "name", "OffsetOutOfBoundsError");
|
616
|
-
}
|
617
|
-
};
|
618
1253
|
|
619
|
-
// src/utils/
|
1254
|
+
// src/utils/contract/extractFunctionParts.ts
|
620
1255
|
var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
|
621
1256
|
function extractFunctionParts(def) {
|
622
1257
|
const parts = def.match(paramsRegex);
|
@@ -641,6 +1276,49 @@ function extractFunctionType(def) {
|
|
641
1276
|
return extractFunctionParts(def).type;
|
642
1277
|
}
|
643
1278
|
|
1279
|
+
// src/utils/contract/getContractError.ts
|
1280
|
+
function getContractError(err, {
|
1281
|
+
abi,
|
1282
|
+
address,
|
1283
|
+
args,
|
1284
|
+
functionName,
|
1285
|
+
sender
|
1286
|
+
}) {
|
1287
|
+
const { code, message } = err.cause || {};
|
1288
|
+
const abiItem = getAbiItem({ abi, name: functionName });
|
1289
|
+
const formattedArgs = abiItem ? formatAbiItemWithArgs({
|
1290
|
+
abiItem,
|
1291
|
+
args,
|
1292
|
+
includeFunctionName: false,
|
1293
|
+
includeName: false
|
1294
|
+
}) : void 0;
|
1295
|
+
const functionWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
|
1296
|
+
if (err instanceof AbiDecodingZeroDataError) {
|
1297
|
+
return new ContractMethodZeroDataError({
|
1298
|
+
abi,
|
1299
|
+
args,
|
1300
|
+
cause: err,
|
1301
|
+
contractAddress: address,
|
1302
|
+
functionName,
|
1303
|
+
functionWithParams
|
1304
|
+
});
|
1305
|
+
}
|
1306
|
+
if (code === 3 || message?.includes("execution reverted")) {
|
1307
|
+
const message_ = message?.replace("execution reverted: ", "");
|
1308
|
+
return new ContractMethodExecutionError(message_, {
|
1309
|
+
abi,
|
1310
|
+
args,
|
1311
|
+
cause: err,
|
1312
|
+
contractAddress: address,
|
1313
|
+
formattedArgs,
|
1314
|
+
functionName,
|
1315
|
+
functionWithParams,
|
1316
|
+
sender
|
1317
|
+
});
|
1318
|
+
}
|
1319
|
+
return err;
|
1320
|
+
}
|
1321
|
+
|
644
1322
|
// src/utils/hash/keccak256.ts
|
645
1323
|
import { keccak_256 } from "@noble/hashes/sha3";
|
646
1324
|
function keccak256(value, to_) {
|
@@ -674,10 +1352,10 @@ function checksumAddress(address_) {
|
|
674
1352
|
const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
|
675
1353
|
let address = hexAddress.split("");
|
676
1354
|
for (let i = 0; i < 40; i += 2) {
|
677
|
-
if (hash2?.[i >> 1] >> 4 >= 8) {
|
1355
|
+
if (hash2?.[i >> 1] >> 4 >= 8 && address[i]) {
|
678
1356
|
address[i] = address[i].toUpperCase();
|
679
1357
|
}
|
680
|
-
if ((hash2[i >> 1] & 15) >= 8) {
|
1358
|
+
if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
|
681
1359
|
address[i + 1] = address[i + 1].toUpperCase();
|
682
1360
|
}
|
683
1361
|
}
|
@@ -688,12 +1366,6 @@ function getAddress(address) {
|
|
688
1366
|
throw new InvalidAddressError({ address });
|
689
1367
|
return checksumAddress(address);
|
690
1368
|
}
|
691
|
-
var InvalidAddressError = class extends BaseError {
|
692
|
-
constructor({ address }) {
|
693
|
-
super(`Address "${address}" is invalid.`);
|
694
|
-
__publicField(this, "name", "InvalidAddressError");
|
695
|
-
}
|
696
|
-
};
|
697
1369
|
|
698
1370
|
// src/utils/address/getContractAddress.ts
|
699
1371
|
function getContractAddress(opts) {
|
@@ -756,7 +1428,7 @@ function encodeAbi({
|
|
756
1428
|
const preparedParams = prepareParams({ params, values });
|
757
1429
|
const data = encodeParams(preparedParams);
|
758
1430
|
if (data.length === 0)
|
759
|
-
return
|
1431
|
+
return "0x";
|
760
1432
|
return data;
|
761
1433
|
}
|
762
1434
|
function prepareParams({
|
@@ -799,7 +1471,9 @@ function prepareParam({
|
|
799
1471
|
if (param.type === "string") {
|
800
1472
|
return encodeString(value);
|
801
1473
|
}
|
802
|
-
throw new InvalidAbiEncodingTypeError(param.type
|
1474
|
+
throw new InvalidAbiEncodingTypeError(param.type, {
|
1475
|
+
docsPath: "/docs/contract/encodeAbi"
|
1476
|
+
});
|
803
1477
|
}
|
804
1478
|
function encodeParams(preparedParams) {
|
805
1479
|
let staticSize = 0;
|
@@ -825,6 +1499,9 @@ function encodeParams(preparedParams) {
|
|
825
1499
|
}
|
826
1500
|
return concat([...staticParams, ...dynamicParams]);
|
827
1501
|
}
|
1502
|
+
function encodeAddress(value) {
|
1503
|
+
return { dynamic: false, encoded: padHex(value.toLowerCase()) };
|
1504
|
+
}
|
828
1505
|
function encodeArray(value, {
|
829
1506
|
length,
|
830
1507
|
param
|
@@ -863,27 +1540,6 @@ function encodeArray(value, {
|
|
863
1540
|
encoded: concat(preparedParams.map(({ encoded }) => encoded))
|
864
1541
|
};
|
865
1542
|
}
|
866
|
-
function encodeTuple(value, { param }) {
|
867
|
-
let dynamic = false;
|
868
|
-
let preparedParams = [];
|
869
|
-
for (let i = 0; i < param.components.length; i++) {
|
870
|
-
const param_ = param.components[i];
|
871
|
-
const index = Array.isArray(value) ? i : param_.name;
|
872
|
-
const preparedParam = prepareParam({
|
873
|
-
param: param_,
|
874
|
-
value: value[index]
|
875
|
-
});
|
876
|
-
preparedParams.push(preparedParam);
|
877
|
-
dynamic = preparedParam.dynamic;
|
878
|
-
}
|
879
|
-
return {
|
880
|
-
dynamic,
|
881
|
-
encoded: dynamic ? encodeParams(preparedParams) : concat(preparedParams.map(({ encoded }) => encoded))
|
882
|
-
};
|
883
|
-
}
|
884
|
-
function encodeAddress(value) {
|
885
|
-
return { dynamic: false, encoded: padHex(value.toLowerCase()) };
|
886
|
-
}
|
887
1543
|
function encodeBytes2(value, { param }) {
|
888
1544
|
const [_, size_] = param.type.split("bytes");
|
889
1545
|
if (!size_)
|
@@ -897,91 +1553,65 @@ function encodeBytes2(value, { param }) {
|
|
897
1553
|
return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
|
898
1554
|
}
|
899
1555
|
function encodeBool(value) {
|
900
|
-
return { dynamic: false, encoded: padHex(boolToHex(value)) };
|
901
|
-
}
|
902
|
-
function encodeNumber(value, { signed }) {
|
903
|
-
return {
|
904
|
-
dynamic: false,
|
905
|
-
encoded: numberToHex(value, {
|
906
|
-
size: 32,
|
907
|
-
signed
|
908
|
-
})
|
909
|
-
};
|
910
|
-
}
|
911
|
-
function encodeString(value) {
|
912
|
-
return {
|
913
|
-
dynamic: true,
|
914
|
-
encoded: concat([
|
915
|
-
padHex(numberToHex(value.length, { size: 32 })),
|
916
|
-
padHex(stringToHex(value), { dir: "right" })
|
917
|
-
])
|
918
|
-
};
|
919
|
-
}
|
920
|
-
function
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
`ABI encoding array length mismatch for type ${type}.`,
|
933
|
-
`Expected length: ${expectedLength}`,
|
934
|
-
`Given length: ${givenLength}`
|
935
|
-
].join("\n")
|
936
|
-
);
|
937
|
-
__publicField(this, "name", "AbiEncodingArrayLengthMismatchError");
|
938
|
-
}
|
939
|
-
};
|
940
|
-
var AbiEncodingLengthMismatchError = class extends BaseError {
|
941
|
-
constructor({
|
942
|
-
expectedLength,
|
943
|
-
givenLength
|
944
|
-
}) {
|
945
|
-
super(
|
946
|
-
[
|
947
|
-
"ABI encoding params/values length mismatch.",
|
948
|
-
`Expected length (params): ${expectedLength}`,
|
949
|
-
`Given length (values): ${givenLength}`
|
950
|
-
].join("\n")
|
951
|
-
);
|
952
|
-
__publicField(this, "name", "AbiEncodingLengthMismatchError");
|
953
|
-
}
|
954
|
-
};
|
955
|
-
var InvalidAbiEncodingTypeError = class extends BaseError {
|
956
|
-
constructor(type) {
|
957
|
-
super(
|
958
|
-
[
|
959
|
-
`Type "${type}" is not a valid encoding type.`,
|
960
|
-
"Please provide a valid ABI type."
|
961
|
-
].join("\n"),
|
962
|
-
{ docsPath: "/docs/contract/encodeAbi#params" }
|
963
|
-
);
|
964
|
-
__publicField(this, "name", "InvalidAbiEncodingType");
|
965
|
-
}
|
966
|
-
};
|
967
|
-
var InvalidArrayError = class extends BaseError {
|
968
|
-
constructor(value) {
|
969
|
-
super([`Value "${value}" is not a valid array.`].join("\n"));
|
970
|
-
__publicField(this, "name", "InvalidArrayError");
|
1556
|
+
return { dynamic: false, encoded: padHex(boolToHex(value)) };
|
1557
|
+
}
|
1558
|
+
function encodeNumber(value, { signed }) {
|
1559
|
+
return {
|
1560
|
+
dynamic: false,
|
1561
|
+
encoded: numberToHex(value, {
|
1562
|
+
size: 32,
|
1563
|
+
signed
|
1564
|
+
})
|
1565
|
+
};
|
1566
|
+
}
|
1567
|
+
function encodeString(value) {
|
1568
|
+
return {
|
1569
|
+
dynamic: true,
|
1570
|
+
encoded: concat([
|
1571
|
+
padHex(numberToHex(value.length, { size: 32 })),
|
1572
|
+
padHex(stringToHex(value), { dir: "right" })
|
1573
|
+
])
|
1574
|
+
};
|
1575
|
+
}
|
1576
|
+
function encodeTuple(value, { param }) {
|
1577
|
+
let dynamic = false;
|
1578
|
+
let preparedParams = [];
|
1579
|
+
for (let i = 0; i < param.components.length; i++) {
|
1580
|
+
const param_ = param.components[i];
|
1581
|
+
const index = Array.isArray(value) ? i : param_.name;
|
1582
|
+
const preparedParam = prepareParam({
|
1583
|
+
param: param_,
|
1584
|
+
value: value[index]
|
1585
|
+
});
|
1586
|
+
preparedParams.push(preparedParam);
|
1587
|
+
dynamic = preparedParam.dynamic;
|
971
1588
|
}
|
972
|
-
|
1589
|
+
return {
|
1590
|
+
dynamic,
|
1591
|
+
encoded: dynamic ? encodeParams(preparedParams) : concat(preparedParams.map(({ encoded }) => encoded))
|
1592
|
+
};
|
1593
|
+
}
|
1594
|
+
function getArrayComponents(type) {
|
1595
|
+
const matches = type.match(/^(.*)\[(\d+)?\]$/);
|
1596
|
+
return matches ? [matches[2] ? Number(matches[2]) : null, matches[1]] : void 0;
|
1597
|
+
}
|
973
1598
|
|
974
1599
|
// src/utils/abi/decodeAbi.ts
|
975
1600
|
function decodeAbi({
|
976
1601
|
data,
|
977
1602
|
params
|
978
1603
|
}) {
|
1604
|
+
if (data === "0x" && params.length > 0)
|
1605
|
+
throw new AbiDecodingZeroDataError();
|
979
1606
|
if (size(data) % 32 !== 0)
|
980
1607
|
throw new AbiDecodingDataSizeInvalidError(size(data));
|
981
|
-
|
1608
|
+
const values = decodeParams({
|
982
1609
|
data,
|
983
1610
|
params
|
984
1611
|
});
|
1612
|
+
if (values.length === 0)
|
1613
|
+
return void 0;
|
1614
|
+
return values;
|
985
1615
|
}
|
986
1616
|
function decodeParams({
|
987
1617
|
data,
|
@@ -1030,7 +1660,12 @@ function decodeParam({
|
|
1030
1660
|
if (param.type === "bool") {
|
1031
1661
|
return decodeBool(value);
|
1032
1662
|
}
|
1033
|
-
throw new InvalidAbiDecodingTypeError(param.type
|
1663
|
+
throw new InvalidAbiDecodingTypeError(param.type, {
|
1664
|
+
docsPath: "/docs/contract/decodeAbi"
|
1665
|
+
});
|
1666
|
+
}
|
1667
|
+
function decodeAddress(value) {
|
1668
|
+
return { consumed: 32, value: checksumAddress(slice(value, -20)) };
|
1034
1669
|
}
|
1035
1670
|
function decodeArray(data, {
|
1036
1671
|
param,
|
@@ -1083,9 +1718,6 @@ function decodeArray(data, {
|
|
1083
1718
|
}
|
1084
1719
|
return { value, consumed };
|
1085
1720
|
}
|
1086
|
-
function decodeAddress(value) {
|
1087
|
-
return { consumed: 32, value: checksumAddress(trim(value)) };
|
1088
|
-
}
|
1089
1721
|
function decodeBool(value) {
|
1090
1722
|
return { consumed: 32, value: hexToBool(value) };
|
1091
1723
|
}
|
@@ -1161,277 +1793,283 @@ function hasDynamicChild(param) {
|
|
1161
1793
|
return true;
|
1162
1794
|
return false;
|
1163
1795
|
}
|
1164
|
-
var AbiDecodingDataSizeInvalidError = class extends BaseError {
|
1165
|
-
constructor(size2) {
|
1166
|
-
super(
|
1167
|
-
[
|
1168
|
-
`Data size of ${size2} bytes is invalid.`,
|
1169
|
-
"Size must be in increments of 32 bytes (size % 32 === 0)."
|
1170
|
-
].join("\n")
|
1171
|
-
);
|
1172
|
-
__publicField(this, "name", "AbiDecodingDataSizeInvalidError");
|
1173
|
-
}
|
1174
|
-
};
|
1175
|
-
var InvalidAbiDecodingTypeError = class extends BaseError {
|
1176
|
-
constructor(type) {
|
1177
|
-
super(
|
1178
|
-
[
|
1179
|
-
`Type "${type}" is not a valid decoding type.`,
|
1180
|
-
"Please provide a valid ABI type."
|
1181
|
-
].join("\n"),
|
1182
|
-
{ docsPath: "/docs/contract/decodeAbi#params" }
|
1183
|
-
);
|
1184
|
-
__publicField(this, "name", "InvalidAbiDecodingType");
|
1185
|
-
}
|
1186
|
-
};
|
1187
1796
|
|
1188
|
-
// src/utils/abi/
|
1189
|
-
function
|
1190
|
-
if (
|
1191
|
-
throw new InvalidDefinitionTypeError(
|
1192
|
-
return `${
|
1797
|
+
// src/utils/abi/formatAbiItem.ts
|
1798
|
+
function formatAbiItem(abiItem, { includeName = false } = {}) {
|
1799
|
+
if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
|
1800
|
+
throw new InvalidDefinitionTypeError(abiItem.type);
|
1801
|
+
return `${abiItem.name}(${getParams(abiItem.inputs, { includeName })})`;
|
1193
1802
|
}
|
1194
|
-
function getParams(params) {
|
1803
|
+
function getParams(params, { includeName }) {
|
1195
1804
|
if (!params)
|
1196
1805
|
return "";
|
1197
|
-
return params.map(getParam).join(",");
|
1806
|
+
return params.map((param) => getParam(param, { includeName })).join(includeName ? ", " : ",");
|
1198
1807
|
}
|
1199
|
-
function getParam(param) {
|
1808
|
+
function getParam(param, { includeName }) {
|
1200
1809
|
if (param.type.startsWith("tuple")) {
|
1201
1810
|
return `(${getParams(
|
1202
|
-
param.components
|
1811
|
+
param.components,
|
1812
|
+
{ includeName }
|
1203
1813
|
)})${param.type.slice("tuple".length)}`;
|
1204
1814
|
}
|
1205
|
-
return param.type;
|
1815
|
+
return param.type + (includeName && param.name ? ` ${param.name}` : "");
|
1206
1816
|
}
|
1207
|
-
var InvalidDefinitionTypeError = class extends BaseError {
|
1208
|
-
constructor(type) {
|
1209
|
-
super(
|
1210
|
-
[
|
1211
|
-
`"${type}" is not a valid definition type.`,
|
1212
|
-
'Valid types: "function", "event", "error"'
|
1213
|
-
].join("\n"),
|
1214
|
-
{
|
1215
|
-
docsPath: "/docs/contract/getDefinition"
|
1216
|
-
}
|
1217
|
-
);
|
1218
|
-
}
|
1219
|
-
};
|
1220
1817
|
|
1221
|
-
// src/utils/abi/
|
1222
|
-
function
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
const description = abi.find((x) => "name" in x && x.name === functionName);
|
1818
|
+
// src/utils/abi/decodeErrorResult.ts
|
1819
|
+
function decodeErrorResult({ abi, data }) {
|
1820
|
+
const signature = slice(data, 0, 4);
|
1821
|
+
const description = abi.find(
|
1822
|
+
(x) => signature === getFunctionSignature(formatAbiItem(x))
|
1823
|
+
);
|
1228
1824
|
if (!description)
|
1229
|
-
throw new
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
}
|
1236
|
-
return concatHex([signature, data ?? "0x"]);
|
1825
|
+
throw new AbiErrorSignatureNotFoundError(signature, {
|
1826
|
+
docsPath: "/docs/contract/decodeErrorResult"
|
1827
|
+
});
|
1828
|
+
return {
|
1829
|
+
errorName: description.name,
|
1830
|
+
args: "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbi({ data: slice(data, 4), params: description.inputs }) : void 0
|
1831
|
+
};
|
1237
1832
|
}
|
1238
|
-
var AbiFunctionNotFoundError = class extends BaseError {
|
1239
|
-
constructor(functionName) {
|
1240
|
-
super(
|
1241
|
-
[
|
1242
|
-
`Function "${functionName}" not found on ABI.`,
|
1243
|
-
"Make sure you are using the correct ABI and that the function exists on it."
|
1244
|
-
].join("\n"),
|
1245
|
-
{
|
1246
|
-
docsPath: "/docs/contract/encodeFunctionParams"
|
1247
|
-
}
|
1248
|
-
);
|
1249
|
-
}
|
1250
|
-
};
|
1251
1833
|
|
1252
|
-
// src/utils/
|
1253
|
-
function
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
if (err.code === -32602)
|
1266
|
-
throw new InvalidParamsRpcError(err);
|
1267
|
-
if (err.code === -32603)
|
1268
|
-
throw new InternalRpcError(err);
|
1269
|
-
if (err.code === -32e3)
|
1270
|
-
throw new InvalidInputRpcError(err);
|
1271
|
-
if (err.code === -32001)
|
1272
|
-
throw new ResourceNotFoundRpcError(err);
|
1273
|
-
if (err.code === -32002)
|
1274
|
-
throw new ResourceUnavailableRpcError(err);
|
1275
|
-
if (err.code === -32003)
|
1276
|
-
throw new TransactionRejectedRpcError(err);
|
1277
|
-
if (err.code === -32004)
|
1278
|
-
throw new MethodNotSupportedRpcError(err);
|
1279
|
-
if (err.code === -32005)
|
1280
|
-
throw new LimitExceededRpcError(err);
|
1281
|
-
if (err.code === -32006)
|
1282
|
-
throw new JsonRpcVersionUnsupportedError(err);
|
1283
|
-
if (err_ instanceof BaseError)
|
1284
|
-
throw err_;
|
1285
|
-
throw new UnknownRpcError(err);
|
1286
|
-
}
|
1834
|
+
// src/utils/abi/decodeFunctionData.ts
|
1835
|
+
function decodeFunctionData({ abi, data }) {
|
1836
|
+
const signature = slice(data, 0, 4);
|
1837
|
+
const description = abi.find(
|
1838
|
+
(x) => signature === getFunctionSignature(formatAbiItem(x))
|
1839
|
+
);
|
1840
|
+
if (!description)
|
1841
|
+
throw new AbiFunctionSignatureNotFoundError(signature, {
|
1842
|
+
docsPath: "/docs/contract/decodeFunctionData"
|
1843
|
+
});
|
1844
|
+
return {
|
1845
|
+
functionName: description.name,
|
1846
|
+
args: "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbi({ data: slice(data, 4), params: description.inputs }) : void 0
|
1287
1847
|
};
|
1288
1848
|
}
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
}
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
}
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
humanMessage: [
|
1354
|
-
"Missing or invalid parameters.",
|
1355
|
-
"Double check you have provided the correct parameters."
|
1356
|
-
].join("\n")
|
1357
|
-
});
|
1358
|
-
__publicField(this, "name", "InvalidInputRpcError");
|
1359
|
-
__publicField(this, "code", -32e3);
|
1360
|
-
}
|
1361
|
-
};
|
1362
|
-
var ResourceNotFoundRpcError = class extends RpcRequestError {
|
1363
|
-
constructor(err) {
|
1364
|
-
super(err, { humanMessage: "Requested resource not found." });
|
1365
|
-
__publicField(this, "name", "ResourceNotFoundRpcError");
|
1366
|
-
__publicField(this, "code", -32001);
|
1367
|
-
}
|
1368
|
-
};
|
1369
|
-
var ResourceUnavailableRpcError = class extends RpcRequestError {
|
1370
|
-
constructor(err) {
|
1371
|
-
super(err, { humanMessage: "Requested resource not available." });
|
1372
|
-
__publicField(this, "name", "ResourceUnavailableRpcError");
|
1373
|
-
__publicField(this, "code", -32002);
|
1374
|
-
}
|
1375
|
-
};
|
1376
|
-
var TransactionRejectedRpcError = class extends RpcRequestError {
|
1377
|
-
constructor(err) {
|
1378
|
-
super(err, { humanMessage: "Transaction creation failed." });
|
1379
|
-
__publicField(this, "name", "TransactionRejectedRpcError");
|
1380
|
-
__publicField(this, "code", -32003);
|
1381
|
-
}
|
1382
|
-
};
|
1383
|
-
var MethodNotSupportedRpcError = class extends RpcRequestError {
|
1384
|
-
constructor(err) {
|
1385
|
-
super(err, { humanMessage: "Method is not implemented." });
|
1386
|
-
__publicField(this, "name", "MethodNotSupportedRpcError");
|
1387
|
-
__publicField(this, "code", -32004);
|
1388
|
-
}
|
1389
|
-
};
|
1390
|
-
var LimitExceededRpcError = class extends RpcRequestError {
|
1391
|
-
constructor(err) {
|
1392
|
-
super(err, { humanMessage: "Request exceeds defined limit." });
|
1393
|
-
__publicField(this, "name", "LimitExceededRpcError");
|
1394
|
-
__publicField(this, "code", -32005);
|
1849
|
+
|
1850
|
+
// src/utils/abi/decodeFunctionResult.ts
|
1851
|
+
var docsPath = "/docs/contract/decodeFunctionResult";
|
1852
|
+
function decodeFunctionResult({
|
1853
|
+
abi,
|
1854
|
+
functionName,
|
1855
|
+
data
|
1856
|
+
}) {
|
1857
|
+
const description = abi.find(
|
1858
|
+
(x) => "name" in x && x.name === functionName
|
1859
|
+
);
|
1860
|
+
if (!description)
|
1861
|
+
throw new AbiFunctionNotFoundError(functionName, { docsPath });
|
1862
|
+
if (!("outputs" in description))
|
1863
|
+
throw new AbiFunctionOutputsNotFoundError(functionName, { docsPath });
|
1864
|
+
const values = decodeAbi({ data, params: description.outputs });
|
1865
|
+
if (values && values.length > 1)
|
1866
|
+
return values;
|
1867
|
+
if (values && values.length === 1)
|
1868
|
+
return values[0];
|
1869
|
+
return void 0;
|
1870
|
+
}
|
1871
|
+
|
1872
|
+
// src/utils/abi/encodeDeployData.ts
|
1873
|
+
var docsPath2 = "/docs/contract/encodeDeployData";
|
1874
|
+
function encodeDeployData({
|
1875
|
+
abi,
|
1876
|
+
args,
|
1877
|
+
bytecode
|
1878
|
+
}) {
|
1879
|
+
if (!args || args.length === 0)
|
1880
|
+
return bytecode;
|
1881
|
+
const description = abi.find((x) => "type" in x && x.type === "constructor");
|
1882
|
+
if (!description)
|
1883
|
+
throw new AbiConstructorNotFoundError({ docsPath: docsPath2 });
|
1884
|
+
if (!("inputs" in description))
|
1885
|
+
throw new AbiConstructorParamsNotFoundError({ docsPath: docsPath2 });
|
1886
|
+
if (!description.inputs || description.inputs.length === 0)
|
1887
|
+
throw new AbiConstructorParamsNotFoundError({ docsPath: docsPath2 });
|
1888
|
+
const data = encodeAbi({
|
1889
|
+
params: description.inputs,
|
1890
|
+
values: args
|
1891
|
+
});
|
1892
|
+
return concatHex([bytecode, data]);
|
1893
|
+
}
|
1894
|
+
|
1895
|
+
// src/utils/abi/getAbiItem.ts
|
1896
|
+
function getAbiItem({ abi, name }) {
|
1897
|
+
return abi.find((x) => "name" in x && x.name === name);
|
1898
|
+
}
|
1899
|
+
|
1900
|
+
// src/utils/abi/encodeErrorResult.ts
|
1901
|
+
var docsPath3 = "/docs/contract/encodeErrorResult";
|
1902
|
+
function encodeErrorResult({ abi, errorName, args }) {
|
1903
|
+
const description = getAbiItem({ abi, name: errorName });
|
1904
|
+
if (!description)
|
1905
|
+
throw new AbiErrorNotFoundError(errorName, { docsPath: docsPath3 });
|
1906
|
+
const definition = formatAbiItem(description);
|
1907
|
+
const signature = getFunctionSignature(definition);
|
1908
|
+
let data = "0x";
|
1909
|
+
if (args && args.length > 0) {
|
1910
|
+
if (!("inputs" in description && description.inputs))
|
1911
|
+
throw new AbiErrorInputsNotFoundError(errorName, { docsPath: docsPath3 });
|
1912
|
+
data = encodeAbi({ params: description.inputs, values: args });
|
1395
1913
|
}
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1914
|
+
return concatHex([signature, data]);
|
1915
|
+
}
|
1916
|
+
|
1917
|
+
// src/utils/abi/encodeEventTopics.ts
|
1918
|
+
function encodeEventTopics({ abi, eventName, args }) {
|
1919
|
+
const abiItem = getAbiItem({ abi, name: eventName });
|
1920
|
+
if (!abiItem)
|
1921
|
+
throw new AbiEventNotFoundError(eventName, {
|
1922
|
+
docsPath: "/docs/contract/encodeEventTopics"
|
1401
1923
|
});
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1924
|
+
const definition = formatAbiItem(abiItem);
|
1925
|
+
const signature = getEventSignature(definition);
|
1926
|
+
let topics = [];
|
1927
|
+
if (args && "inputs" in abiItem) {
|
1928
|
+
const args_ = Array.isArray(args) ? args : abiItem.inputs?.map((x) => args[x.name]) ?? [];
|
1929
|
+
topics = abiItem.inputs?.filter((param) => "indexed" in param && param.indexed).map(
|
1930
|
+
(param, i) => Array.isArray(args_[i]) ? args_[i].map(
|
1931
|
+
(_, j) => encodeArg({ param, value: args_[i][j] })
|
1932
|
+
) : args_[i] ? encodeArg({ param, value: args_[i] }) : null
|
1933
|
+
) ?? [];
|
1934
|
+
}
|
1935
|
+
return [signature, ...topics];
|
1936
|
+
}
|
1937
|
+
function encodeArg({
|
1938
|
+
param,
|
1939
|
+
value
|
1940
|
+
}) {
|
1941
|
+
if (param.type === "string" || param.type === "bytes")
|
1942
|
+
return keccak256(encodeBytes(value));
|
1943
|
+
if (param.type === "tuple" || param.type.match(/^(.*)\[(\d+)?\]$/))
|
1944
|
+
throw new FilterTypeNotSupportedError(param.type);
|
1945
|
+
return encodeAbi({ params: [param], values: [value] });
|
1946
|
+
}
|
1947
|
+
|
1948
|
+
// src/utils/abi/encodeFunctionData.ts
|
1949
|
+
function encodeFunctionData({ abi, args, functionName }) {
|
1950
|
+
const description = getAbiItem({ abi, name: functionName });
|
1951
|
+
if (!description)
|
1952
|
+
throw new AbiFunctionNotFoundError(functionName, {
|
1953
|
+
docsPath: "/docs/contract/encodeFunctionData"
|
1410
1954
|
});
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1955
|
+
const definition = formatAbiItem(description);
|
1956
|
+
const signature = getFunctionSignature(definition);
|
1957
|
+
const data = "inputs" in description && description.inputs ? encodeAbi({
|
1958
|
+
params: description.inputs,
|
1959
|
+
values: args ?? []
|
1960
|
+
}) : void 0;
|
1961
|
+
return concatHex([signature, data ?? "0x"]);
|
1962
|
+
}
|
1414
1963
|
|
1415
|
-
// src/
|
1416
|
-
var
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1964
|
+
// src/utils/abi/encodeFunctionResult.ts
|
1965
|
+
var docsPath4 = "/docs/contract/encodeFunctionResult";
|
1966
|
+
function encodeFunctionResult({
|
1967
|
+
abi,
|
1968
|
+
functionName,
|
1969
|
+
result
|
1970
|
+
}) {
|
1971
|
+
const description = abi.find((x) => "name" in x && x.name === functionName);
|
1972
|
+
if (!description)
|
1973
|
+
throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath4 });
|
1974
|
+
if (!("outputs" in description))
|
1975
|
+
throw new AbiFunctionOutputsNotFoundError(functionName, { docsPath: docsPath4 });
|
1976
|
+
let values = Array.isArray(result) ? result : [result];
|
1977
|
+
if (description.outputs.length === 0 && !values[0])
|
1978
|
+
values = [];
|
1979
|
+
return encodeAbi({ params: description.outputs, values });
|
1980
|
+
}
|
1981
|
+
|
1982
|
+
// src/utils/abi/formatAbiItemWithArgs.ts
|
1983
|
+
function formatAbiItemWithArgs({
|
1984
|
+
abiItem,
|
1985
|
+
args,
|
1986
|
+
includeFunctionName = true,
|
1987
|
+
includeName = false
|
1988
|
+
}) {
|
1989
|
+
if (!("name" in abiItem))
|
1990
|
+
return;
|
1991
|
+
if (!("inputs" in abiItem))
|
1992
|
+
return;
|
1993
|
+
if (!abiItem.inputs)
|
1994
|
+
return;
|
1995
|
+
return `${includeFunctionName ? abiItem.name : ""}(${abiItem.inputs.map(
|
1996
|
+
(input, i) => `${includeName && input.name ? `${input.name}: ` : ""}${typeof args[i] === "object" ? stringify(args[i]) : args[i]}`
|
1997
|
+
).join(", ")})`;
|
1998
|
+
}
|
1999
|
+
|
2000
|
+
// src/utils/buildRequest.ts
|
2001
|
+
function buildRequest(request) {
|
2002
|
+
return async (args) => {
|
2003
|
+
try {
|
2004
|
+
return await request(args);
|
2005
|
+
} catch (err_) {
|
2006
|
+
let err = err_;
|
2007
|
+
if (err.code === -32700)
|
2008
|
+
throw new ParseRpcError(err);
|
2009
|
+
if (err.code === -32600)
|
2010
|
+
throw new InvalidRequestRpcError(err);
|
2011
|
+
if (err.code === -32601)
|
2012
|
+
throw new MethodNotFoundRpcError(err);
|
2013
|
+
if (err.code === -32602)
|
2014
|
+
throw new InvalidParamsRpcError(err);
|
2015
|
+
if (err.code === -32603)
|
2016
|
+
throw new InternalRpcError(err);
|
2017
|
+
if (err.code === -32e3)
|
2018
|
+
throw new InvalidInputRpcError(err);
|
2019
|
+
if (err.code === -32001)
|
2020
|
+
throw new ResourceNotFoundRpcError(err);
|
2021
|
+
if (err.code === -32002)
|
2022
|
+
throw new ResourceUnavailableRpcError(err);
|
2023
|
+
if (err.code === -32003)
|
2024
|
+
throw new TransactionRejectedRpcError(err);
|
2025
|
+
if (err.code === -32004)
|
2026
|
+
throw new MethodNotSupportedRpcError(err);
|
2027
|
+
if (err.code === -32005)
|
2028
|
+
throw new LimitExceededRpcError(err);
|
2029
|
+
if (err.code === -32006)
|
2030
|
+
throw new JsonRpcVersionUnsupportedError(err);
|
2031
|
+
if (err_ instanceof BaseError)
|
2032
|
+
throw err_;
|
2033
|
+
throw new UnknownRpcError(err);
|
2034
|
+
}
|
2035
|
+
};
|
2036
|
+
}
|
2037
|
+
|
2038
|
+
// src/utils/chain.ts
|
2039
|
+
function defineChain(chain) {
|
2040
|
+
return chain;
|
2041
|
+
}
|
2042
|
+
|
2043
|
+
// src/utils/formatters/format.ts
|
2044
|
+
function format3(data, { formatter }) {
|
2045
|
+
return formatter(data);
|
2046
|
+
}
|
2047
|
+
function defineFormatter({
|
2048
|
+
format: format4
|
2049
|
+
}) {
|
2050
|
+
return ({
|
2051
|
+
exclude,
|
2052
|
+
format: formatOverride
|
2053
|
+
}) => (data) => {
|
2054
|
+
const formatted = format4(data);
|
2055
|
+
if (exclude) {
|
2056
|
+
for (const key of exclude) {
|
2057
|
+
delete formatted[key];
|
2058
|
+
}
|
2059
|
+
}
|
2060
|
+
return {
|
2061
|
+
...formatted,
|
2062
|
+
...formatOverride?.(data)
|
2063
|
+
};
|
2064
|
+
};
|
2065
|
+
}
|
2066
|
+
|
2067
|
+
// src/utils/formatters/transaction.ts
|
1428
2068
|
var transactionType = {
|
1429
2069
|
"0x0": "legacy",
|
1430
2070
|
"0x1": "eip2930",
|
1431
2071
|
"0x2": "eip1559"
|
1432
2072
|
};
|
1433
|
-
|
1434
|
-
// src/utils/formatters/transaction.ts
|
1435
2073
|
function formatTransaction(transaction) {
|
1436
2074
|
const transaction_ = {
|
1437
2075
|
...transaction,
|
@@ -1457,6 +2095,7 @@ function formatTransaction(transaction) {
|
|
1457
2095
|
}
|
1458
2096
|
return transaction_;
|
1459
2097
|
}
|
2098
|
+
var defineTransaction = defineFormatter({ format: formatTransaction });
|
1460
2099
|
|
1461
2100
|
// src/utils/formatters/block.ts
|
1462
2101
|
function formatBlock(block) {
|
@@ -1478,6 +2117,21 @@ function formatBlock(block) {
|
|
1478
2117
|
totalDifficulty: block.totalDifficulty ? BigInt(block.totalDifficulty) : null
|
1479
2118
|
};
|
1480
2119
|
}
|
2120
|
+
var defineBlock = defineFormatter({ format: formatBlock });
|
2121
|
+
|
2122
|
+
// src/utils/formatters/extract.ts
|
2123
|
+
function extract(value, { formatter }) {
|
2124
|
+
if (!formatter)
|
2125
|
+
return {};
|
2126
|
+
const keys = Object.keys(formatter({}));
|
2127
|
+
return keys.reduce((data, key) => {
|
2128
|
+
if (value?.hasOwnProperty(key)) {
|
2129
|
+
;
|
2130
|
+
data[key] = value[key];
|
2131
|
+
}
|
2132
|
+
return data;
|
2133
|
+
}, {});
|
2134
|
+
}
|
1481
2135
|
|
1482
2136
|
// src/utils/formatters/feeHistory.ts
|
1483
2137
|
function formatFeeHistory(feeHistory) {
|
@@ -1491,11 +2145,6 @@ function formatFeeHistory(feeHistory) {
|
|
1491
2145
|
};
|
1492
2146
|
}
|
1493
2147
|
|
1494
|
-
// src/utils/formatters/format.ts
|
1495
|
-
function format3(data, { formatter }) {
|
1496
|
-
return formatter(data);
|
1497
|
-
}
|
1498
|
-
|
1499
2148
|
// src/utils/formatters/log.ts
|
1500
2149
|
function formatLog(log) {
|
1501
2150
|
return {
|
@@ -1524,6 +2173,9 @@ function formatTransactionReceipt(transactionReceipt) {
|
|
1524
2173
|
type: transactionReceipt.type ? transactionType[transactionReceipt.type] : null
|
1525
2174
|
};
|
1526
2175
|
}
|
2176
|
+
var defineTransactionReceipt = defineFormatter({
|
2177
|
+
format: formatTransactionReceipt
|
2178
|
+
});
|
1527
2179
|
|
1528
2180
|
// src/utils/formatters/transactionRequest.ts
|
1529
2181
|
function formatTransactionRequest(transactionRequest) {
|
@@ -1537,6 +2189,9 @@ function formatTransactionRequest(transactionRequest) {
|
|
1537
2189
|
value: typeof transactionRequest.value !== "undefined" ? numberToHex(transactionRequest.value) : void 0
|
1538
2190
|
};
|
1539
2191
|
}
|
2192
|
+
var defineTransactionRequest = defineFormatter({
|
2193
|
+
format: formatTransactionRequest
|
2194
|
+
});
|
1540
2195
|
|
1541
2196
|
// src/utils/promise/withCache.ts
|
1542
2197
|
var promiseCache = /* @__PURE__ */ new Map();
|
@@ -1664,7 +2319,7 @@ async function http(url, {
|
|
1664
2319
|
"Content-Type": "application/json"
|
1665
2320
|
},
|
1666
2321
|
method: "POST",
|
1667
|
-
body:
|
2322
|
+
body: stringify({ jsonrpc: "2.0", id: id++, ...body }),
|
1668
2323
|
signal: timeout > 0 ? signal : void 0
|
1669
2324
|
});
|
1670
2325
|
return response2;
|
@@ -1701,7 +2356,7 @@ async function http(url, {
|
|
1701
2356
|
if (!response.ok) {
|
1702
2357
|
throw new HttpRequestError({
|
1703
2358
|
body,
|
1704
|
-
details:
|
2359
|
+
details: stringify(data.error) || response.statusText,
|
1705
2360
|
status: response.status,
|
1706
2361
|
url
|
1707
2362
|
});
|
@@ -1809,91 +2464,19 @@ var rpc = {
|
|
1809
2464
|
webSocket,
|
1810
2465
|
webSocketAsync
|
1811
2466
|
};
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
url
|
1818
|
-
}) {
|
1819
|
-
super(
|
1820
|
-
[
|
1821
|
-
"HTTP request failed.",
|
1822
|
-
"",
|
1823
|
-
`Status: ${status}`,
|
1824
|
-
`URL: ${url}`,
|
1825
|
-
`Request body: ${JSON.stringify(body)}`
|
1826
|
-
].join("\n"),
|
1827
|
-
{
|
1828
|
-
details
|
1829
|
-
}
|
1830
|
-
);
|
1831
|
-
__publicField(this, "name", "HttpRequestError");
|
1832
|
-
__publicField(this, "status");
|
1833
|
-
this.status = status;
|
1834
|
-
}
|
1835
|
-
};
|
1836
|
-
var WebSocketRequestError = class extends BaseError {
|
1837
|
-
constructor({
|
1838
|
-
body,
|
1839
|
-
details,
|
1840
|
-
url
|
1841
|
-
}) {
|
1842
|
-
super(
|
1843
|
-
[
|
1844
|
-
"WebSocket request failed.",
|
1845
|
-
"",
|
1846
|
-
`URL: ${url}`,
|
1847
|
-
`Request body: ${JSON.stringify(body)}`
|
1848
|
-
].join("\n"),
|
1849
|
-
{
|
1850
|
-
details
|
1851
|
-
}
|
1852
|
-
);
|
1853
|
-
__publicField(this, "name", "WebSocketRequestError");
|
1854
|
-
}
|
2467
|
+
|
2468
|
+
// src/utils/unit/constants.ts
|
2469
|
+
var etherUnits = {
|
2470
|
+
gwei: 9,
|
2471
|
+
wei: 18
|
1855
2472
|
};
|
1856
|
-
var
|
1857
|
-
|
1858
|
-
|
1859
|
-
error,
|
1860
|
-
url
|
1861
|
-
}) {
|
1862
|
-
super(
|
1863
|
-
[
|
1864
|
-
"RPC Request failed.",
|
1865
|
-
"",
|
1866
|
-
`URL: ${url}`,
|
1867
|
-
`Request body: ${JSON.stringify(body)}`
|
1868
|
-
].join("\n"),
|
1869
|
-
{
|
1870
|
-
cause: error,
|
1871
|
-
details: error.message
|
1872
|
-
}
|
1873
|
-
);
|
1874
|
-
__publicField(this, "code");
|
1875
|
-
__publicField(this, "name", "RpcError");
|
1876
|
-
this.code = error.code;
|
1877
|
-
}
|
2473
|
+
var gweiUnits = {
|
2474
|
+
ether: -9,
|
2475
|
+
wei: 9
|
1878
2476
|
};
|
1879
|
-
var
|
1880
|
-
|
1881
|
-
|
1882
|
-
url
|
1883
|
-
}) {
|
1884
|
-
super(
|
1885
|
-
[
|
1886
|
-
"The request took too long to respond.",
|
1887
|
-
"",
|
1888
|
-
`URL: ${url}`,
|
1889
|
-
`Request body: ${JSON.stringify(body)}`
|
1890
|
-
].join("\n"),
|
1891
|
-
{
|
1892
|
-
details: "The request timed out."
|
1893
|
-
}
|
1894
|
-
);
|
1895
|
-
__publicField(this, "name", "TimeoutError");
|
1896
|
-
}
|
2477
|
+
var weiUnits = {
|
2478
|
+
ether: -18,
|
2479
|
+
gwei: -9
|
1897
2480
|
};
|
1898
2481
|
|
1899
2482
|
// src/utils/unit/formatUnit.ts
|
@@ -1954,8 +2537,49 @@ function parseGwei(ether, unit = "wei") {
|
|
1954
2537
|
}
|
1955
2538
|
|
1956
2539
|
export {
|
1957
|
-
|
2540
|
+
stringify,
|
1958
2541
|
BaseError,
|
2542
|
+
AbiConstructorNotFoundError,
|
2543
|
+
AbiConstructorParamsNotFoundError,
|
2544
|
+
AbiDecodingDataSizeInvalidError,
|
2545
|
+
AbiEncodingArrayLengthMismatchError,
|
2546
|
+
AbiEncodingLengthMismatchError,
|
2547
|
+
AbiErrorInputsNotFoundError,
|
2548
|
+
AbiErrorNotFoundError,
|
2549
|
+
AbiErrorSignatureNotFoundError,
|
2550
|
+
AbiEventNotFoundError,
|
2551
|
+
AbiFunctionNotFoundError,
|
2552
|
+
AbiFunctionOutputsNotFoundError,
|
2553
|
+
AbiFunctionSignatureNotFoundError,
|
2554
|
+
InvalidAbiEncodingTypeError,
|
2555
|
+
InvalidAbiDecodingTypeError,
|
2556
|
+
InvalidArrayError,
|
2557
|
+
InvalidDefinitionTypeError,
|
2558
|
+
InvalidAddressError,
|
2559
|
+
BlockNotFoundError,
|
2560
|
+
SizeExceedsPaddingSizeError,
|
2561
|
+
DataLengthTooLongError,
|
2562
|
+
DataLengthTooShortError,
|
2563
|
+
InvalidBytesBooleanError,
|
2564
|
+
InvalidHexBooleanError,
|
2565
|
+
InvalidHexValueError,
|
2566
|
+
OffsetOutOfBoundsError,
|
2567
|
+
FilterTypeNotSupportedError,
|
2568
|
+
RequestError,
|
2569
|
+
RpcRequestError,
|
2570
|
+
ParseRpcError,
|
2571
|
+
InvalidRequestRpcError,
|
2572
|
+
MethodNotFoundRpcError,
|
2573
|
+
InvalidParamsRpcError,
|
2574
|
+
InternalRpcError,
|
2575
|
+
InvalidInputRpcError,
|
2576
|
+
ResourceNotFoundRpcError,
|
2577
|
+
ResourceUnavailableRpcError,
|
2578
|
+
TransactionRejectedRpcError,
|
2579
|
+
MethodNotSupportedRpcError,
|
2580
|
+
LimitExceededRpcError,
|
2581
|
+
JsonRpcVersionUnsupportedError,
|
2582
|
+
UnknownRpcError,
|
1959
2583
|
isBytes,
|
1960
2584
|
isHex,
|
1961
2585
|
pad,
|
@@ -1988,9 +2612,11 @@ export {
|
|
1988
2612
|
bytesToNumber,
|
1989
2613
|
bytesToString,
|
1990
2614
|
decodeRlp,
|
2615
|
+
extractFunctionParts,
|
1991
2616
|
extractFunctionName,
|
1992
2617
|
extractFunctionParams,
|
1993
2618
|
extractFunctionType,
|
2619
|
+
getContractError,
|
1994
2620
|
keccak256,
|
1995
2621
|
getEventSignature,
|
1996
2622
|
getFunctionSignature,
|
@@ -2003,44 +2629,55 @@ export {
|
|
2003
2629
|
isAddressEqual,
|
2004
2630
|
encodeAbi,
|
2005
2631
|
decodeAbi,
|
2006
|
-
|
2632
|
+
formatAbiItem,
|
2633
|
+
decodeErrorResult,
|
2634
|
+
decodeFunctionData,
|
2635
|
+
decodeFunctionResult,
|
2636
|
+
encodeDeployData,
|
2637
|
+
getAbiItem,
|
2638
|
+
encodeErrorResult,
|
2639
|
+
encodeEventTopics,
|
2640
|
+
encodeFunctionData,
|
2641
|
+
encodeFunctionResult,
|
2642
|
+
formatAbiItemWithArgs,
|
2007
2643
|
buildRequest,
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
MethodNotFoundRpcError,
|
2012
|
-
InvalidParamsRpcError,
|
2013
|
-
InternalRpcError,
|
2014
|
-
InvalidInputRpcError,
|
2015
|
-
ResourceNotFoundRpcError,
|
2016
|
-
ResourceUnavailableRpcError,
|
2017
|
-
TransactionRejectedRpcError,
|
2018
|
-
MethodNotSupportedRpcError,
|
2019
|
-
LimitExceededRpcError,
|
2020
|
-
JsonRpcVersionUnsupportedError,
|
2021
|
-
etherUnits,
|
2022
|
-
gweiUnits,
|
2023
|
-
weiUnits,
|
2644
|
+
defineChain,
|
2645
|
+
format3 as format,
|
2646
|
+
defineFormatter,
|
2024
2647
|
transactionType,
|
2025
2648
|
formatTransaction,
|
2649
|
+
defineTransaction,
|
2026
2650
|
formatBlock,
|
2651
|
+
defineBlock,
|
2652
|
+
extract,
|
2027
2653
|
formatFeeHistory,
|
2028
|
-
format3 as format,
|
2029
2654
|
formatLog,
|
2030
2655
|
formatTransactionReceipt,
|
2656
|
+
defineTransactionReceipt,
|
2031
2657
|
formatTransactionRequest,
|
2658
|
+
defineTransactionRequest,
|
2032
2659
|
getCache,
|
2033
2660
|
withCache,
|
2034
2661
|
wait,
|
2035
2662
|
getSocket,
|
2036
2663
|
rpc,
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2664
|
+
etherUnits,
|
2665
|
+
gweiUnits,
|
2666
|
+
weiUnits,
|
2040
2667
|
formatUnit,
|
2041
2668
|
formatEther,
|
2042
2669
|
formatGwei,
|
2043
2670
|
parseUnit,
|
2044
2671
|
parseEther,
|
2045
|
-
parseGwei
|
2672
|
+
parseGwei,
|
2673
|
+
HttpRequestError,
|
2674
|
+
WebSocketRequestError,
|
2675
|
+
RpcError,
|
2676
|
+
TimeoutError,
|
2677
|
+
InvalidGasArgumentsError,
|
2678
|
+
TransactionNotFoundError,
|
2679
|
+
TransactionReceiptNotFoundError,
|
2680
|
+
WaitForTransactionReceiptTimeoutError,
|
2681
|
+
UrlRequiredError
|
2046
2682
|
};
|
2683
|
+
//# sourceMappingURL=chunk-5Q6FSUU2.mjs.map
|