viem 0.0.1-alpha.24 → 0.0.1-alpha.26
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/contract/package.json +4 -0
- package/dist/call-3476b8ee.d.ts +22 -0
- package/dist/{chain-afa13f5a.d.ts → chain-42de87e5.d.ts} +20 -14
- package/dist/{chain-e33d019b.d.ts → chain-b0cfb141.d.ts} +1 -1
- package/dist/chains.d.ts +20 -8
- package/dist/chains.js +46 -46
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-3ARWEJ3G.mjs → chunk-BSAB6UH4.mjs} +18 -2
- package/dist/chunk-BSAB6UH4.mjs.map +1 -0
- package/dist/{chunk-4D5XG6XB.js → chunk-DSQO3E4F.js} +367 -429
- package/dist/chunk-DSQO3E4F.js.map +1 -0
- package/dist/{chunk-A2HXAZXC.js → chunk-LINNE4N4.js} +199 -161
- package/dist/chunk-LINNE4N4.js.map +1 -0
- package/dist/{chunk-LQVMDX5I.mjs → chunk-PRG3BBPZ.mjs} +397 -459
- package/dist/chunk-PRG3BBPZ.mjs.map +1 -0
- package/dist/{chunk-YQUC52RL.mjs → chunk-QSIX64VZ.mjs} +136 -98
- package/dist/chunk-QSIX64VZ.mjs.map +1 -0
- package/dist/{chunk-ZYSXBTBB.js → chunk-YTG4YXMB.js} +30 -14
- package/dist/chunk-YTG4YXMB.js.map +1 -0
- package/dist/{contract-70f4ddbe.d.ts → contract-9dd2f98b.d.ts} +44 -31
- package/dist/contract.d.ts +129 -0
- package/dist/contract.js +55 -0
- package/dist/{clients/index.js.map → contract.js.map} +0 -0
- package/dist/contract.mjs +55 -0
- package/dist/{clients/index.mjs.map → contract.mjs.map} +0 -0
- package/dist/{createClient-60e3ab98.d.ts → createClient-6689596e.d.ts} +11 -5
- package/dist/{createPublicClient-d3d12dc3.d.ts → createPublicClient-fd558574.d.ts} +3 -3
- package/dist/{createTestClient-5f4532c4.d.ts → createTestClient-bc1d9028.d.ts} +3 -3
- package/dist/{createWalletClient-9ec3df4f.d.ts → createWalletClient-4df88244.d.ts} +3 -3
- package/dist/decodeErrorResult-ac835649.d.ts +16 -0
- package/dist/{eip1193-9317a312.d.ts → eip1193-617a05ae.d.ts} +2 -2
- package/dist/ens.d.ts +82 -1
- package/dist/ens.js +208 -3
- package/dist/ens.js.map +1 -1
- package/dist/ens.mjs +209 -4
- package/dist/ens.mjs.map +1 -1
- package/dist/getAbiItem-d2e8bd76.d.ts +97 -0
- package/dist/index.d.ts +113 -180
- package/dist/index.js +259 -279
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +267 -287
- package/dist/index.mjs.map +1 -1
- package/dist/public.d.ts +353 -10
- package/dist/public.js +3 -4
- package/dist/public.mjs +6 -7
- package/dist/readContract-c460f23a.d.ts +10 -0
- package/dist/rpc-8c10fc98.d.ts +119 -0
- package/dist/{sendTransaction-54a0d509.d.ts → sendTransaction-7ce442c0.d.ts} +3 -3
- package/dist/test.d.ts +160 -5
- package/dist/test.js +222 -18
- package/dist/test.js.map +1 -1
- package/dist/test.mjs +233 -29
- package/dist/test.mjs.map +1 -1
- package/dist/transactionReceipt-44dbf122.d.ts +26 -0
- package/dist/{transactionRequest-bdf57f7d.d.ts → transactionRequest-f437b4ba.d.ts} +1 -1
- package/dist/utils/index.d.ts +228 -21
- package/dist/utils/index.js +2 -6
- package/dist/utils/index.mjs +3 -7
- package/dist/wallet.d.ts +41 -7
- package/dist/wallet.js +3 -3
- package/dist/wallet.mjs +2 -2
- package/dist/watchEvent-569c9976.d.ts +41 -0
- package/dist/window.d.ts +2 -2
- package/ens/package.json +4 -0
- package/package.json +16 -12
- package/public/package.json +4 -0
- package/test/package.json +4 -0
- package/wallet/package.json +4 -0
- package/clients/package.json +0 -4
- package/dist/chunk-3ARWEJ3G.mjs.map +0 -1
- package/dist/chunk-4D5XG6XB.js.map +0 -1
- package/dist/chunk-6QTEW2BE.mjs +0 -260
- package/dist/chunk-6QTEW2BE.mjs.map +0 -1
- package/dist/chunk-A2HXAZXC.js.map +0 -1
- package/dist/chunk-KRPS5CIB.mjs +0 -256
- package/dist/chunk-KRPS5CIB.mjs.map +0 -1
- package/dist/chunk-LQVMDX5I.mjs.map +0 -1
- package/dist/chunk-N3IOPT3R.js +0 -256
- package/dist/chunk-N3IOPT3R.js.map +0 -1
- package/dist/chunk-YQUC52RL.mjs.map +0 -1
- package/dist/chunk-ZSTVHQ6J.js +0 -260
- package/dist/chunk-ZSTVHQ6J.js.map +0 -1
- package/dist/chunk-ZYSXBTBB.js.map +0 -1
- package/dist/clients/index.d.ts +0 -9
- package/dist/clients/index.js +0 -24
- package/dist/clients/index.mjs +0 -24
- package/dist/normalize-ef9240c0.d.ts +0 -33
- package/dist/parseGwei-492ab7dd.d.ts +0 -355
- package/dist/rpc-26932bae.d.ts +0 -61
- package/dist/stopImpersonatingAccount-c1a4b7e5.d.ts +0 -156
- package/dist/watchAsset-d59d6e35.d.ts +0 -38
- package/dist/watchPendingTransactions-ea21b31d.d.ts +0 -373
- package/dist/webSocket-775b4037.d.ts +0 -83
- package/src/_test/abis.ts +0 -1420
- package/src/_test/bench.ts +0 -15
- package/src/_test/constants.ts +0 -61
- package/src/_test/globalSetup.ts +0 -11
- package/src/_test/index.ts +0 -25
- package/src/_test/setup.ts +0 -8
- package/src/_test/utils.ts +0 -150
- package/src/actions/index.test.ts +0 -81
- package/src/actions/index.ts +0 -182
- package/src/actions/public/call.bench.ts +0 -48
- package/src/actions/public/call.test.ts +0 -99
- package/src/actions/public/call.ts +0 -97
- package/src/actions/public/createBlockFilter.bench.ts +0 -11
- package/src/actions/public/createBlockFilter.test.ts +0 -9
- package/src/actions/public/createBlockFilter.ts +0 -14
- package/src/actions/public/createContractEventFilter.test.ts +0 -119
- package/src/actions/public/createContractEventFilter.ts +0 -69
- package/src/actions/public/createEventFilter.test.ts +0 -245
- package/src/actions/public/createEventFilter.ts +0 -76
- package/src/actions/public/createPendingTransactionFilter.bench.ts +0 -11
- package/src/actions/public/createPendingTransactionFilter.test.ts +0 -9
- package/src/actions/public/createPendingTransactionFilter.ts +0 -14
- package/src/actions/public/deployContract.test.ts +0 -56
- package/src/actions/public/deployContract.ts +0 -38
- package/src/actions/public/estimateGas.bench.ts +0 -46
- package/src/actions/public/estimateGas.test.ts +0 -92
- package/src/actions/public/estimateGas.ts +0 -61
- package/src/actions/public/getBalance.test.ts +0 -83
- package/src/actions/public/getBalance.ts +0 -37
- package/src/actions/public/getBlock.bench.ts +0 -28
- package/src/actions/public/getBlock.test.ts +0 -575
- package/src/actions/public/getBlock.ts +0 -65
- package/src/actions/public/getBlockNumber.bench.ts +0 -28
- package/src/actions/public/getBlockNumber.test.ts +0 -27
- package/src/actions/public/getBlockNumber.ts +0 -32
- package/src/actions/public/getBlockTransactionCount.bench.ts +0 -15
- package/src/actions/public/getBlockTransactionCount.test.ts +0 -57
- package/src/actions/public/getBlockTransactionCount.ts +0 -52
- package/src/actions/public/getBytecode.test.ts +0 -27
- package/src/actions/public/getBytecode.ts +0 -32
- package/src/actions/public/getChainId.bench.ts +0 -15
- package/src/actions/public/getChainId.test.ts +0 -8
- package/src/actions/public/getChainId.ts +0 -7
- package/src/actions/public/getFeeHistory.bench.ts +0 -18
- package/src/actions/public/getFeeHistory.test.ts +0 -137
- package/src/actions/public/getFeeHistory.ts +0 -44
- package/src/actions/public/getFilterChanges.bench.ts +0 -13
- package/src/actions/public/getFilterChanges.test.ts +0 -189
- package/src/actions/public/getFilterChanges.ts +0 -23
- package/src/actions/public/getFilterLogs.test.ts +0 -104
- package/src/actions/public/getFilterLogs.ts +0 -20
- package/src/actions/public/getGasPrice.bench.ts +0 -19
- package/src/actions/public/getGasPrice.test.ts +0 -8
- package/src/actions/public/getGasPrice.ts +0 -15
- package/src/actions/public/getLogs.test.ts +0 -107
- package/src/actions/public/getLogs.ts +0 -84
- package/src/actions/public/getStorageAt.test.ts +0 -34
- package/src/actions/public/getStorageAt.ts +0 -32
- package/src/actions/public/getTransaction.bench.ts +0 -33
- package/src/actions/public/getTransaction.test.ts +0 -311
- package/src/actions/public/getTransaction.ts +0 -95
- package/src/actions/public/getTransactionConfirmations.test.ts +0 -69
- package/src/actions/public/getTransactionConfirmations.ts +0 -38
- package/src/actions/public/getTransactionCount.test.ts +0 -56
- package/src/actions/public/getTransactionCount.ts +0 -34
- package/src/actions/public/getTransactionReceipt.bench.ts +0 -33
- package/src/actions/public/getTransactionReceipt.test.ts +0 -179
- package/src/actions/public/getTransactionReceipt.ts +0 -34
- package/src/actions/public/index.test.ts +0 -44
- package/src/actions/public/index.ts +0 -152
- package/src/actions/public/multicall.test.ts +0 -452
- package/src/actions/public/multicall.ts +0 -103
- package/src/actions/public/readContract.test.ts +0 -328
- package/src/actions/public/readContract.ts +0 -73
- package/src/actions/public/simulateContract.bench.ts +0 -41
- package/src/actions/public/simulateContract.test.ts +0 -410
- package/src/actions/public/simulateContract.ts +0 -94
- package/src/actions/public/uninstallFilter.bench.ts +0 -13
- package/src/actions/public/uninstallFilter.test.ts +0 -65
- package/src/actions/public/uninstallFilter.ts +0 -17
- package/src/actions/public/waitForTransactionReceipt.test.ts +0 -322
- package/src/actions/public/waitForTransactionReceipt.ts +0 -170
- package/src/actions/public/watchBlockNumber.test.ts +0 -166
- package/src/actions/public/watchBlockNumber.ts +0 -79
- package/src/actions/public/watchBlocks.test.ts +0 -210
- package/src/actions/public/watchBlocks.ts +0 -114
- package/src/actions/public/watchContractEvent.test.ts +0 -305
- package/src/actions/public/watchContractEvent.ts +0 -108
- package/src/actions/public/watchEvent.test.ts +0 -195
- package/src/actions/public/watchEvent.ts +0 -95
- package/src/actions/public/watchPendingTransactions.test.ts +0 -116
- package/src/actions/public/watchPendingTransactions.ts +0 -74
- package/src/actions/test/dropTransaction.test.ts +0 -34
- package/src/actions/test/dropTransaction.ts +0 -17
- package/src/actions/test/getAutomine.test.ts +0 -14
- package/src/actions/test/getAutomine.ts +0 -11
- package/src/actions/test/getTxpoolContent.test.ts +0 -45
- package/src/actions/test/getTxpoolContent.ts +0 -7
- package/src/actions/test/getTxpoolStatus.test.ts +0 -41
- package/src/actions/test/getTxpoolStatus.ts +0 -12
- package/src/actions/test/impersonateAccount.test.ts +0 -26
- package/src/actions/test/impersonateAccount.ts +0 -17
- package/src/actions/test/increaseTime.test.ts +0 -18
- package/src/actions/test/increaseTime.ts +0 -17
- package/src/actions/test/index.test.ts +0 -38
- package/src/actions/test/index.ts +0 -77
- package/src/actions/test/inspectTxpool.test.ts +0 -50
- package/src/actions/test/inspectTxpool.ts +0 -7
- package/src/actions/test/mine.test.ts +0 -20
- package/src/actions/test/mine.ts +0 -16
- package/src/actions/test/removeBlockTimestampInterval.test.ts +0 -23
- package/src/actions/test/removeBlockTimestampInterval.ts +0 -7
- package/src/actions/test/reset.test.ts +0 -19
- package/src/actions/test/reset.ts +0 -18
- package/src/actions/test/revert.test.ts +0 -39
- package/src/actions/test/revert.ts +0 -14
- package/src/actions/test/sendUnsignedTransaction.test.ts +0 -52
- package/src/actions/test/sendUnsignedTransaction.ts +0 -19
- package/src/actions/test/setAutomine.test.ts +0 -14
- package/src/actions/test/setAutomine.ts +0 -8
- package/src/actions/test/setBalance.test.ts +0 -29
- package/src/actions/test/setBalance.ts +0 -20
- package/src/actions/test/setBlockGasLimit.test.ts +0 -21
- package/src/actions/test/setBlockGasLimit.ts +0 -17
- package/src/actions/test/setBlockTimestampInterval.test.ts +0 -23
- package/src/actions/test/setBlockTimestampInterval.ts +0 -16
- package/src/actions/test/setCode.test.ts +0 -26
- package/src/actions/test/setCode.ts +0 -19
- package/src/actions/test/setCoinbase.test.ts +0 -11
- package/src/actions/test/setCoinbase.ts +0 -17
- package/src/actions/test/setIntervalMining.test.ts +0 -30
- package/src/actions/test/setIntervalMining.ts +0 -16
- package/src/actions/test/setLoggingEnabled.test.ts +0 -10
- package/src/actions/test/setLoggingEnabled.ts +0 -8
- package/src/actions/test/setMinGasPrice.test.ts +0 -22
- package/src/actions/test/setMinGasPrice.ts +0 -17
- package/src/actions/test/setNextBlockBaseFeePerGas.test.ts +0 -23
- package/src/actions/test/setNextBlockBaseFeePerGas.ts +0 -17
- package/src/actions/test/setNextBlockTimestamp.test.ts +0 -19
- package/src/actions/test/setNextBlockTimestamp.ts +0 -17
- package/src/actions/test/setNonce.test.ts +0 -28
- package/src/actions/test/setNonce.ts +0 -20
- package/src/actions/test/setRpcUrl.test.ts +0 -9
- package/src/actions/test/setRpcUrl.ts +0 -8
- package/src/actions/test/setStorageAt.test.ts +0 -36
- package/src/actions/test/setStorageAt.ts +0 -26
- package/src/actions/test/snapshot.test.ts +0 -18
- package/src/actions/test/snapshot.ts +0 -7
- package/src/actions/test/stopImpersonatingAccount.test.ts +0 -29
- package/src/actions/test/stopImpersonatingAccount.ts +0 -17
- package/src/actions/wallet/addChain.test.ts +0 -14
- package/src/actions/wallet/addChain.ts +0 -21
- package/src/actions/wallet/getAccounts.test.ts +0 -22
- package/src/actions/wallet/getAccounts.ts +0 -7
- package/src/actions/wallet/getPermissions.test.ts +0 -24
- package/src/actions/wallet/getPermissions.ts +0 -9
- package/src/actions/wallet/index.test.ts +0 -20
- package/src/actions/wallet/index.ts +0 -30
- package/src/actions/wallet/requestAccounts.test.ts +0 -13
- package/src/actions/wallet/requestAccounts.ts +0 -7
- package/src/actions/wallet/requestPermissions.test.ts +0 -26
- package/src/actions/wallet/requestPermissions.ts +0 -19
- package/src/actions/wallet/sendTransaction.bench.ts +0 -57
- package/src/actions/wallet/sendTransaction.test.ts +0 -440
- package/src/actions/wallet/sendTransaction.ts +0 -77
- package/src/actions/wallet/signMessage.test.ts +0 -61
- package/src/actions/wallet/signMessage.ts +0 -35
- package/src/actions/wallet/switchChain.test.ts +0 -21
- package/src/actions/wallet/switchChain.ts +0 -19
- package/src/actions/wallet/watchAsset.test.ts +0 -40
- package/src/actions/wallet/watchAsset.ts +0 -16
- package/src/actions/wallet/writeContract.test.ts +0 -84
- package/src/actions/wallet/writeContract.ts +0 -47
- package/src/chains.test.ts +0 -1912
- package/src/chains.ts +0 -99
- package/src/clients/createClient.test.ts +0 -295
- package/src/clients/createClient.ts +0 -81
- package/src/clients/createPublicClient.test.ts +0 -165
- package/src/clients/createPublicClient.ts +0 -49
- package/src/clients/createTestClient.test.ts +0 -145
- package/src/clients/createTestClient.ts +0 -72
- package/src/clients/createWalletClient.test.ts +0 -121
- package/src/clients/createWalletClient.ts +0 -54
- package/src/clients/index.test.ts +0 -19
- package/src/clients/index.ts +0 -31
- package/src/clients/transports/createTransport.test.ts +0 -58
- package/src/clients/transports/createTransport.ts +0 -48
- package/src/clients/transports/custom.test.ts +0 -98
- package/src/clients/transports/custom.ts +0 -34
- package/src/clients/transports/fallback.test.ts +0 -257
- package/src/clients/transports/fallback.ts +0 -50
- package/src/clients/transports/http.test.ts +0 -109
- package/src/clients/transports/http.ts +0 -51
- package/src/clients/transports/index.test.ts +0 -15
- package/src/clients/transports/index.ts +0 -17
- package/src/clients/transports/webSocket.test.ts +0 -163
- package/src/clients/transports/webSocket.ts +0 -117
- package/src/constants/abis.test.ts +0 -53
- package/src/constants/abis.ts +0 -44
- package/src/constants/index.test.ts +0 -14
- package/src/constants/index.ts +0 -3
- package/src/constants/solidity.test.ts +0 -41
- package/src/constants/solidity.ts +0 -35
- package/src/ens.ts +0 -5
- package/src/errors/abi.test.ts +0 -81
- package/src/errors/abi.ts +0 -238
- package/src/errors/address.test.ts +0 -14
- package/src/errors/address.ts +0 -9
- package/src/errors/base.test.ts +0 -114
- package/src/errors/base.ts +0 -57
- package/src/errors/block.test.ts +0 -24
- package/src/errors/block.ts +0 -18
- package/src/errors/contract.test.ts +0 -233
- package/src/errors/contract.ts +0 -178
- package/src/errors/data.ts +0 -20
- package/src/errors/encoding.ts +0 -60
- package/src/errors/index.ts +0 -79
- package/src/errors/log.ts +0 -8
- package/src/errors/request.test.ts +0 -330
- package/src/errors/request.ts +0 -163
- package/src/errors/rpc.test.ts +0 -87
- package/src/errors/rpc.ts +0 -113
- package/src/errors/transaction.test.ts +0 -83
- package/src/errors/transaction.ts +0 -54
- package/src/errors/transport.test.ts +0 -11
- package/src/errors/transport.ts +0 -12
- package/src/index.test.ts +0 -263
- package/src/index.ts +0 -389
- package/src/public.ts +0 -80
- package/src/test.ts +0 -51
- package/src/types/block.ts +0 -71
- package/src/types/chain.ts +0 -6
- package/src/types/contract.ts +0 -393
- package/src/types/eip1193.ts +0 -1041
- package/src/types/fee.ts +0 -47
- package/src/types/filter.ts +0 -8
- package/src/types/formatter.ts +0 -23
- package/src/types/index.ts +0 -83
- package/src/types/log.ts +0 -22
- package/src/types/misc.ts +0 -5
- package/src/types/multicall.ts +0 -82
- package/src/types/rpc.ts +0 -35
- package/src/types/transaction.ts +0 -145
- package/src/types/utils.ts +0 -67
- package/src/types/window.ts +0 -9
- package/src/utils/abi/decodeAbi.bench.ts +0 -135
- package/src/utils/abi/decodeAbi.test.ts +0 -1614
- package/src/utils/abi/decodeAbi.ts +0 -300
- package/src/utils/abi/decodeDeployData.test.ts +0 -151
- package/src/utils/abi/decodeDeployData.ts +0 -44
- package/src/utils/abi/decodeErrorResult.test.ts +0 -230
- package/src/utils/abi/decodeErrorResult.ts +0 -45
- package/src/utils/abi/decodeFunctionData.test.ts +0 -139
- package/src/utils/abi/decodeFunctionData.ts +0 -29
- package/src/utils/abi/decodeFunctionResult.test.ts +0 -333
- package/src/utils/abi/decodeFunctionResult.ts +0 -57
- package/src/utils/abi/encodeAbi.bench.ts +0 -163
- package/src/utils/abi/encodeAbi.test.ts +0 -1447
- package/src/utils/abi/encodeAbi.ts +0 -273
- package/src/utils/abi/encodeDeployData.test.ts +0 -124
- package/src/utils/abi/encodeDeployData.ts +0 -40
- package/src/utils/abi/encodeErrorResult.test.ts +0 -192
- package/src/utils/abi/encodeErrorResult.ts +0 -47
- package/src/utils/abi/encodeEventTopics.test.ts +0 -345
- package/src/utils/abi/encodeEventTopics.ts +0 -75
- package/src/utils/abi/encodeFunctionData.test.ts +0 -138
- package/src/utils/abi/encodeFunctionData.ts +0 -45
- package/src/utils/abi/encodeFunctionResult.test.ts +0 -279
- package/src/utils/abi/encodeFunctionResult.ts +0 -41
- package/src/utils/abi/formatAbiItem.test.ts +0 -335
- package/src/utils/abi/formatAbiItem.ts +0 -41
- package/src/utils/abi/formatAbiItemWithArgs.test.ts +0 -291
- package/src/utils/abi/formatAbiItemWithArgs.ts +0 -27
- package/src/utils/abi/getAbiItem.test.ts +0 -547
- package/src/utils/abi/getAbiItem.ts +0 -95
- package/src/utils/abi/index.test.ts +0 -23
- package/src/utils/abi/index.ts +0 -42
- package/src/utils/address/getAddress.bench.ts +0 -22
- package/src/utils/address/getAddress.test.ts +0 -46
- package/src/utils/address/getAddress.ts +0 -28
- package/src/utils/address/getContractAddress.bench.ts +0 -20
- package/src/utils/address/getContractAddress.test.ts +0 -78
- package/src/utils/address/getContractAddress.ts +0 -59
- package/src/utils/address/index.test.ts +0 -17
- package/src/utils/address/index.ts +0 -16
- package/src/utils/address/isAddress.test.ts +0 -10
- package/src/utils/address/isAddress.ts +0 -10
- package/src/utils/address/isAddressEqual.test.ts +0 -55
- package/src/utils/address/isAddressEqual.ts +0 -6
- package/src/utils/buildRequest.test.ts +0 -365
- package/src/utils/buildRequest.ts +0 -45
- package/src/utils/chain.test.ts +0 -43
- package/src/utils/chain.ts +0 -8
- package/src/utils/contract/extractFunctionParts.test.ts +0 -109
- package/src/utils/contract/extractFunctionParts.ts +0 -27
- package/src/utils/contract/getContractError.test.ts +0 -282
- package/src/utils/contract/getContractError.ts +0 -58
- package/src/utils/contract/index.test.ts +0 -15
- package/src/utils/contract/index.ts +0 -8
- package/src/utils/data/concat.test.ts +0 -35
- package/src/utils/data/concat.ts +0 -34
- package/src/utils/data/index.test.ts +0 -23
- package/src/utils/data/index.ts +0 -13
- package/src/utils/data/isBytes.test.ts +0 -9
- package/src/utils/data/isBytes.ts +0 -7
- package/src/utils/data/isHex.test.ts +0 -13
- package/src/utils/data/isHex.ts +0 -5
- package/src/utils/data/pad.bench.ts +0 -30
- package/src/utils/data/pad.test.ts +0 -367
- package/src/utils/data/pad.ts +0 -53
- package/src/utils/data/size.test.ts +0 -18
- package/src/utils/data/size.ts +0 -13
- package/src/utils/data/slice.test.ts +0 -203
- package/src/utils/data/slice.ts +0 -60
- package/src/utils/data/trim.bench.ts +0 -34
- package/src/utils/data/trim.test.ts +0 -175
- package/src/utils/data/trim.ts +0 -33
- package/src/utils/encoding/decodeBytes.bench.ts +0 -40
- package/src/utils/encoding/decodeBytes.test.ts +0 -144
- package/src/utils/encoding/decodeBytes.ts +0 -63
- package/src/utils/encoding/decodeHex.bench.ts +0 -24
- package/src/utils/encoding/decodeHex.test.ts +0 -167
- package/src/utils/encoding/decodeHex.ts +0 -76
- package/src/utils/encoding/decodeRlp.bench.ts +0 -34
- package/src/utils/encoding/decodeRlp.test.ts +0 -350
- package/src/utils/encoding/decodeRlp.ts +0 -121
- package/src/utils/encoding/encodeBytes.bench.ts +0 -29
- package/src/utils/encoding/encodeBytes.test.ts +0 -676
- package/src/utils/encoding/encodeBytes.ts +0 -59
- package/src/utils/encoding/encodeHex.bench.ts +0 -49
- package/src/utils/encoding/encodeHex.test.ts +0 -232
- package/src/utils/encoding/encodeHex.ts +0 -104
- package/src/utils/encoding/encodeRlp.bench.ts +0 -54
- package/src/utils/encoding/encodeRlp.test.ts +0 -254
- package/src/utils/encoding/encodeRlp.ts +0 -48
- package/src/utils/encoding/index.test.ts +0 -32
- package/src/utils/encoding/index.ts +0 -36
- package/src/utils/ens/index.test.ts +0 -13
- package/src/utils/ens/index.ts +0 -5
- package/src/utils/ens/labelhash.test.ts +0 -55
- package/src/utils/ens/labelhash.ts +0 -16
- package/src/utils/ens/namehash.test.ts +0 -65
- package/src/utils/ens/namehash.ts +0 -28
- package/src/utils/ens/normalize.bench.ts +0 -14
- package/src/utils/ens/normalize.test.ts +0 -35
- package/src/utils/ens/normalize.ts +0 -14
- package/src/utils/formatters/block.bench.ts +0 -51
- package/src/utils/formatters/block.test.ts +0 -115
- package/src/utils/formatters/block.ts +0 -37
- package/src/utils/formatters/extract.test.ts +0 -14
- package/src/utils/formatters/extract.ts +0 -18
- package/src/utils/formatters/feeHistory.test.ts +0 -66
- package/src/utils/formatters/feeHistory.ts +0 -12
- package/src/utils/formatters/format.test.ts +0 -93
- package/src/utils/formatters/format.ts +0 -90
- package/src/utils/formatters/index.test.ts +0 -27
- package/src/utils/formatters/index.ts +0 -34
- package/src/utils/formatters/log.test.ts +0 -79
- package/src/utils/formatters/log.ts +0 -12
- package/src/utils/formatters/transaction.test.ts +0 -271
- package/src/utils/formatters/transaction.ts +0 -63
- package/src/utils/formatters/transactionReceipt.bench.ts +0 -73
- package/src/utils/formatters/transactionReceipt.test.ts +0 -151
- package/src/utils/formatters/transactionReceipt.ts +0 -63
- package/src/utils/formatters/transactionRequest.bench.ts +0 -29
- package/src/utils/formatters/transactionRequest.test.ts +0 -237
- package/src/utils/formatters/transactionRequest.ts +0 -56
- package/src/utils/hash/getEventSignature.test.ts +0 -61
- package/src/utils/hash/getEventSignature.ts +0 -4
- package/src/utils/hash/getFunctionSignature.test.ts +0 -22
- package/src/utils/hash/getFunctionSignature.ts +0 -5
- package/src/utils/hash/hashFunction.test.ts +0 -65
- package/src/utils/hash/hashFunction.ts +0 -12
- package/src/utils/hash/index.test.ts +0 -13
- package/src/utils/hash/index.ts +0 -5
- package/src/utils/hash/keccak256.test.ts +0 -59
- package/src/utils/hash/keccak256.ts +0 -21
- package/src/utils/index.test.ts +0 -113
- package/src/utils/index.ts +0 -141
- package/src/utils/observe.test.ts +0 -176
- package/src/utils/observe.ts +0 -66
- package/src/utils/poll.test.ts +0 -127
- package/src/utils/poll.ts +0 -42
- package/src/utils/promise/index.test.ts +0 -14
- package/src/utils/promise/index.ts +0 -3
- package/src/utils/promise/withCache.test.ts +0 -97
- package/src/utils/promise/withCache.ts +0 -73
- package/src/utils/promise/withRetry.test.ts +0 -231
- package/src/utils/promise/withRetry.ts +0 -61
- package/src/utils/promise/withTimeout.test.ts +0 -37
- package/src/utils/promise/withTimeout.ts +0 -39
- package/src/utils/rpc.test.ts +0 -989
- package/src/utils/rpc.ts +0 -292
- package/src/utils/stringify.test.ts +0 -13
- package/src/utils/stringify.ts +0 -5
- package/src/utils/uid.ts +0 -14
- package/src/utils/unit/constants.test.ts +0 -22
- package/src/utils/unit/constants.ts +0 -12
- package/src/utils/unit/formatEther.test.ts +0 -75
- package/src/utils/unit/formatEther.ts +0 -6
- package/src/utils/unit/formatGwei.test.ts +0 -32
- package/src/utils/unit/formatGwei.ts +0 -6
- package/src/utils/unit/formatUnit.bench.ts +0 -21
- package/src/utils/unit/formatUnit.test.ts +0 -40
- package/src/utils/unit/formatUnit.ts +0 -16
- package/src/utils/unit/index.test.ts +0 -28
- package/src/utils/unit/index.ts +0 -7
- package/src/utils/unit/parseEther.test.ts +0 -126
- package/src/utils/unit/parseEther.ts +0 -6
- package/src/utils/unit/parseGwei.test.ts +0 -50
- package/src/utils/unit/parseGwei.ts +0 -6
- package/src/utils/unit/parseUnit.bench.ts +0 -21
- package/src/utils/unit/parseUnit.test.ts +0 -54
- package/src/utils/unit/parseUnit.ts +0 -27
- package/src/utils/wait.ts +0 -3
- package/src/wallet.ts +0 -23
- package/src/window.ts +0 -1
@@ -6,159 +6,15 @@ var __publicField = (obj, key, value) => {
|
|
6
6
|
};
|
7
7
|
|
8
8
|
// package.json
|
9
|
-
var
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
"bench:ci": "CI=true vitest bench --no-threads",
|
17
|
-
build: "tsup",
|
18
|
-
changeset: "changeset",
|
19
|
-
"changeset:release": "pnpm build && changeset publish",
|
20
|
-
"changeset:version": "changeset version && pnpm install --lockfile-only",
|
21
|
-
"contracts:build": "wagmi generate",
|
22
|
-
dev: "DEV=true tsup",
|
23
|
-
"dev:docs": "pnpm -r --filter site dev",
|
24
|
-
format: "rome format src/ test/ --write",
|
25
|
-
lint: "rome check .",
|
26
|
-
"lint:fix": "pnpm lint --apply-suggested",
|
27
|
-
playground: "pnpm --filter playground-dev dev",
|
28
|
-
"playground:benchmark": "pnpm --filter playground-benchmark dev",
|
29
|
-
postinstall: "pnpm dev && pnpm contracts:build",
|
30
|
-
preinstall: "npx only-allow pnpm",
|
31
|
-
prepublishOnly: "pnpm ts-node scripts/generate-package-json.ts",
|
32
|
-
prepare: "npx simple-git-hooks",
|
33
|
-
test: "vitest dev --no-threads",
|
34
|
-
"test:ci": "CI=true vitest --coverage --no-threads",
|
35
|
-
"test:ui": "vitest dev --ui --no-threads",
|
36
|
-
"ts-node": "node --loader esbuild-register/loader -r esbuild-register",
|
37
|
-
typecheck: "tsc --noEmit"
|
38
|
-
},
|
39
|
-
files: [
|
40
|
-
"/actions",
|
41
|
-
"/chains",
|
42
|
-
"/dist",
|
43
|
-
"/clients",
|
44
|
-
"/src",
|
45
|
-
"/types",
|
46
|
-
"/utils",
|
47
|
-
"/window"
|
48
|
-
],
|
49
|
-
exports: {
|
50
|
-
".": {
|
51
|
-
types: "./dist/index.d.ts",
|
52
|
-
module: "./dist/index.mjs",
|
53
|
-
default: "./dist/index.js"
|
54
|
-
},
|
55
|
-
"./chains": {
|
56
|
-
types: "./dist/chains.d.ts",
|
57
|
-
module: "./dist/chains.mjs",
|
58
|
-
default: "./dist/chains.js"
|
59
|
-
},
|
60
|
-
"./clients": {
|
61
|
-
types: "./dist/clients/index.d.ts",
|
62
|
-
module: "./dist/clients/index.mjs",
|
63
|
-
default: "./dist/clients/index.js"
|
64
|
-
},
|
65
|
-
"./ens": {
|
66
|
-
types: "./dist/ens.d.ts",
|
67
|
-
module: "./dist/ens.mjs",
|
68
|
-
default: "./dist/ens.js"
|
69
|
-
},
|
70
|
-
"./public": {
|
71
|
-
types: "./dist/public.d.ts",
|
72
|
-
module: "./dist/public.mjs",
|
73
|
-
default: "./dist/public.js"
|
74
|
-
},
|
75
|
-
"./test": {
|
76
|
-
types: "./dist/test.d.ts",
|
77
|
-
module: "./dist/test.mjs",
|
78
|
-
default: "./dist/test.js"
|
79
|
-
},
|
80
|
-
"./utils": {
|
81
|
-
types: "./dist/utils/index.d.ts",
|
82
|
-
module: "./dist/utils/index.mjs",
|
83
|
-
default: "./dist/utils/index.js"
|
84
|
-
},
|
85
|
-
"./wallet": {
|
86
|
-
types: "./dist/wallet.d.ts",
|
87
|
-
module: "./dist/wallet.mjs",
|
88
|
-
default: "./dist/wallet.js"
|
89
|
-
},
|
90
|
-
"./window": {
|
91
|
-
types: "./dist/window.d.ts",
|
92
|
-
module: "./dist/window.mjs",
|
93
|
-
default: "./dist/window.js"
|
94
|
-
},
|
95
|
-
"./package.json": "./package.json"
|
96
|
-
},
|
97
|
-
main: "dist/index.js",
|
98
|
-
module: "dist/index.mjs",
|
99
|
-
types: "dist/index.d.ts",
|
100
|
-
sideEffects: false,
|
101
|
-
dependencies: {
|
102
|
-
"@noble/hashes": "^1.1.2",
|
103
|
-
"@wagmi/chains": "~0.2.6",
|
104
|
-
abitype: "~0.3.0",
|
105
|
-
"idna-uts46-hx": "^4.1.2"
|
106
|
-
},
|
107
|
-
devDependencies: {
|
108
|
-
"@actions/core": "^1.10.0",
|
109
|
-
"@actions/github": "^5.1.1",
|
110
|
-
"@adraffy/ens-normalize": "^1.8.9",
|
111
|
-
"@changesets/changelog-github": "^0.4.5",
|
112
|
-
"@changesets/cli": "^2.23.2",
|
113
|
-
"@testing-library/jest-dom": "^5.16.5",
|
114
|
-
"@types/dedent": "^0.7.0",
|
115
|
-
"@types/fs-extra": "^9.0.13",
|
116
|
-
"@types/node": "^17.0.45",
|
117
|
-
"@vitest/coverage-c8": "^0.24.3",
|
118
|
-
"@vitest/ui": "^0.19.1",
|
119
|
-
"@wagmi/cli": "^0.1.5",
|
120
|
-
bundlewatch: "^0.3.3",
|
121
|
-
dedent: "^0.7.0",
|
122
|
-
esbuild: "^0.16.12",
|
123
|
-
"esbuild-register": "^3.4.2",
|
124
|
-
ethers: "^5.7.2",
|
125
|
-
"ethers@6": "npm:ethers@^6.0.2",
|
126
|
-
execa: "^6.1.0",
|
127
|
-
"fs-extra": "^10.1.0",
|
128
|
-
jsdom: "^20.0.0",
|
129
|
-
rome: "^11.0.0",
|
130
|
-
"simple-git-hooks": "^2.8.1",
|
131
|
-
tsup: "^6.5.0",
|
132
|
-
typescript: "^4.9.4",
|
133
|
-
vite: "^3.0.4",
|
134
|
-
vitest: "^0.25.2",
|
135
|
-
web3: "^1.8.1"
|
136
|
-
},
|
137
|
-
license: "MIT",
|
138
|
-
repository: "wagmi-dev/viem",
|
139
|
-
authors: [
|
140
|
-
"awkweb.eth",
|
141
|
-
"jxom.eth"
|
142
|
-
],
|
143
|
-
keywords: [
|
144
|
-
"eth",
|
145
|
-
"ethereum",
|
146
|
-
"dapps",
|
147
|
-
"wallet",
|
148
|
-
"web3"
|
149
|
-
],
|
150
|
-
"simple-git-hooks": {
|
151
|
-
"pre-commit": "pnpm format & pnpm lint:fix"
|
152
|
-
},
|
153
|
-
pnpm: {
|
154
|
-
patchedDependencies: {
|
155
|
-
"vitepress@1.0.0-alpha.34": "patches/vitepress@1.0.0-alpha.34.patch"
|
156
|
-
}
|
157
|
-
}
|
158
|
-
};
|
9
|
+
var name = "viem";
|
10
|
+
var version = "0.0.1-alpha.26";
|
11
|
+
|
12
|
+
// src/errors/utils.ts
|
13
|
+
var getContractAddress = (address) => address;
|
14
|
+
var getUrl = (url) => url;
|
15
|
+
var getVersion = () => `${name}@${version}`;
|
159
16
|
|
160
17
|
// src/errors/base.ts
|
161
|
-
var version = process.env.TEST ? "1.0.2" : package_default.version;
|
162
18
|
var BaseError = class extends Error {
|
163
19
|
constructor(shortMessage, args = {}) {
|
164
20
|
const details = args.cause instanceof BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
|
@@ -169,7 +25,7 @@ var BaseError = class extends Error {
|
|
169
25
|
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
170
26
|
...docsPath5 ? [`Docs: https://viem.sh${docsPath5}`] : [],
|
171
27
|
...details ? [`Details: ${details}`] : [],
|
172
|
-
`Version:
|
28
|
+
`Version: ${getVersion()}`
|
173
29
|
].join("\n");
|
174
30
|
super(message);
|
175
31
|
__publicField(this, "details");
|
@@ -298,7 +154,7 @@ var AbiErrorSignatureNotFoundError = class extends BaseError {
|
|
298
154
|
[
|
299
155
|
`Encoded error signature "${signature}" not found on ABI.`,
|
300
156
|
"Make sure you are using the correct ABI and that the error exists on it.",
|
301
|
-
`You can look up the signature
|
157
|
+
`You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`
|
302
158
|
].join("\n"),
|
303
159
|
{
|
304
160
|
docsPath: docsPath5
|
@@ -307,6 +163,21 @@ var AbiErrorSignatureNotFoundError = class extends BaseError {
|
|
307
163
|
__publicField(this, "name", "AbiErrorSignatureNotFoundError");
|
308
164
|
}
|
309
165
|
};
|
166
|
+
var AbiEventSignatureNotFoundError = class extends BaseError {
|
167
|
+
constructor(signature, { docsPath: docsPath5 }) {
|
168
|
+
super(
|
169
|
+
[
|
170
|
+
`Encoded event signature "${signature}" not found on ABI.`,
|
171
|
+
"Make sure you are using the correct ABI and that the event exists on it.",
|
172
|
+
`You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`
|
173
|
+
].join("\n"),
|
174
|
+
{
|
175
|
+
docsPath: docsPath5
|
176
|
+
}
|
177
|
+
);
|
178
|
+
__publicField(this, "name", "AbiEventSignatureNotFoundError");
|
179
|
+
}
|
180
|
+
};
|
310
181
|
var AbiEventNotFoundError = class extends BaseError {
|
311
182
|
constructor(eventName, { docsPath: docsPath5 }) {
|
312
183
|
super(
|
@@ -356,7 +227,7 @@ var AbiFunctionSignatureNotFoundError = class extends BaseError {
|
|
356
227
|
[
|
357
228
|
`Encoded function signature "${signature}" not found on ABI.`,
|
358
229
|
"Make sure you are using the correct ABI and that the function exists on it.",
|
359
|
-
`You can look up the signature
|
230
|
+
`You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`
|
360
231
|
].join("\n"),
|
361
232
|
{
|
362
233
|
docsPath: docsPath5
|
@@ -431,6 +302,30 @@ var BlockNotFoundError = class extends BaseError {
|
|
431
302
|
}
|
432
303
|
};
|
433
304
|
|
305
|
+
// src/errors/chain.ts
|
306
|
+
var ChainDoesNotSupportContract = class extends BaseError {
|
307
|
+
constructor({
|
308
|
+
blockNumber,
|
309
|
+
chain,
|
310
|
+
contract
|
311
|
+
}) {
|
312
|
+
super(
|
313
|
+
`Chain "${chain.name}" does not support contract "${contract.name}".`,
|
314
|
+
{
|
315
|
+
metaMessages: [
|
316
|
+
"This could be due to any of the following:",
|
317
|
+
...blockNumber && contract.blockCreated && contract.blockCreated > blockNumber ? [
|
318
|
+
`- The contract "${contract.name}" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).`
|
319
|
+
] : [
|
320
|
+
`- The chain does not have the contract "${contract.name}" configured.`
|
321
|
+
]
|
322
|
+
]
|
323
|
+
}
|
324
|
+
);
|
325
|
+
__publicField(this, "name", "ChainDoesNotSupportContract");
|
326
|
+
}
|
327
|
+
};
|
328
|
+
|
434
329
|
// src/constants/abis.ts
|
435
330
|
var multicall3Abi = [
|
436
331
|
{
|
@@ -534,7 +429,7 @@ var ContractFunctionExecutionError = class extends BaseError {
|
|
534
429
|
docsPath: docsPath5,
|
535
430
|
metaMessages: [
|
536
431
|
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
537
|
-
contractAddress && `Contract: ${
|
432
|
+
contractAddress && `Contract: ${getContractAddress(contractAddress)}`,
|
538
433
|
functionWithParams && `Function: ${functionWithParams}`,
|
539
434
|
formattedArgs && formattedArgs !== "()" && `Arguments: ${[...Array(functionName?.length ?? 0).keys()].map(() => " ").join("")}${formattedArgs}`,
|
540
435
|
sender && `Sender: ${sender}`
|
@@ -703,17 +598,22 @@ var FilterTypeNotSupportedError = class extends BaseError {
|
|
703
598
|
|
704
599
|
// src/errors/request.ts
|
705
600
|
var RequestError = class extends BaseError {
|
706
|
-
constructor(err, {
|
601
|
+
constructor(err, {
|
602
|
+
docsPath: docsPath5,
|
603
|
+
metaMessages,
|
604
|
+
shortMessage
|
605
|
+
}) {
|
707
606
|
super(shortMessage, {
|
708
607
|
cause: err,
|
709
|
-
docsPath: docsPath5
|
608
|
+
docsPath: docsPath5,
|
609
|
+
metaMessages
|
710
610
|
});
|
711
611
|
this.name = err.name;
|
712
612
|
}
|
713
613
|
};
|
714
614
|
var RpcRequestError = class extends RequestError {
|
715
615
|
constructor(err, { docsPath: docsPath5, shortMessage }) {
|
716
|
-
super(err, { docsPath: docsPath5, shortMessage });
|
616
|
+
super(err, { docsPath: docsPath5, metaMessages: err.metaMessages, shortMessage });
|
717
617
|
__publicField(this, "code");
|
718
618
|
this.code = err.code;
|
719
619
|
this.name = err.name;
|
@@ -833,24 +733,27 @@ var HttpRequestError = class extends BaseError {
|
|
833
733
|
constructor({
|
834
734
|
body,
|
835
735
|
details,
|
736
|
+
headers,
|
836
737
|
status,
|
837
738
|
url
|
838
739
|
}) {
|
839
|
-
super(
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
`
|
844
|
-
`URL: ${url}`,
|
740
|
+
super("HTTP request failed.", {
|
741
|
+
details,
|
742
|
+
metaMessages: [
|
743
|
+
status && `Status: ${status}`,
|
744
|
+
`URL: ${getUrl(url)}`,
|
845
745
|
`Request body: ${stringify(body)}`
|
846
|
-
].
|
847
|
-
|
848
|
-
details
|
849
|
-
}
|
850
|
-
);
|
746
|
+
].filter(Boolean)
|
747
|
+
});
|
851
748
|
__publicField(this, "name", "HttpRequestError");
|
749
|
+
__publicField(this, "body");
|
750
|
+
__publicField(this, "headers");
|
852
751
|
__publicField(this, "status");
|
752
|
+
__publicField(this, "url");
|
753
|
+
this.body = body;
|
754
|
+
this.headers = headers;
|
853
755
|
this.status = status;
|
756
|
+
this.url = url;
|
854
757
|
}
|
855
758
|
};
|
856
759
|
var WebSocketRequestError = class extends BaseError {
|
@@ -859,17 +762,10 @@ var WebSocketRequestError = class extends BaseError {
|
|
859
762
|
details,
|
860
763
|
url
|
861
764
|
}) {
|
862
|
-
super(
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
`URL: ${url}`,
|
867
|
-
`Request body: ${stringify(body)}`
|
868
|
-
].join("\n"),
|
869
|
-
{
|
870
|
-
details
|
871
|
-
}
|
872
|
-
);
|
765
|
+
super("WebSocket request failed.", {
|
766
|
+
details,
|
767
|
+
metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
|
768
|
+
});
|
873
769
|
__publicField(this, "name", "WebSocketRequestError");
|
874
770
|
}
|
875
771
|
};
|
@@ -879,18 +775,11 @@ var RpcError = class extends BaseError {
|
|
879
775
|
error,
|
880
776
|
url
|
881
777
|
}) {
|
882
|
-
super(
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
`Request body: ${stringify(body)}`
|
888
|
-
].join("\n"),
|
889
|
-
{
|
890
|
-
cause: error,
|
891
|
-
details: error.message
|
892
|
-
}
|
893
|
-
);
|
778
|
+
super("RPC Request failed.", {
|
779
|
+
cause: error,
|
780
|
+
details: error.message,
|
781
|
+
metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
|
782
|
+
});
|
894
783
|
__publicField(this, "code");
|
895
784
|
__publicField(this, "name", "RpcError");
|
896
785
|
this.code = error.code;
|
@@ -901,17 +790,10 @@ var TimeoutError = class extends BaseError {
|
|
901
790
|
body,
|
902
791
|
url
|
903
792
|
}) {
|
904
|
-
super(
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
`URL: ${url}`,
|
909
|
-
`Request body: ${stringify(body)}`
|
910
|
-
].join("\n"),
|
911
|
-
{
|
912
|
-
details: "The request timed out."
|
913
|
-
}
|
914
|
-
);
|
793
|
+
super("The request took too long to respond.", {
|
794
|
+
details: "The request timed out.",
|
795
|
+
metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
|
796
|
+
});
|
915
797
|
__publicField(this, "name", "TimeoutError");
|
916
798
|
}
|
917
799
|
};
|
@@ -1378,9 +1260,9 @@ var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
|
|
1378
1260
|
function extractFunctionParts(def) {
|
1379
1261
|
const parts = def.match(paramsRegex);
|
1380
1262
|
const type = parts?.[2] || void 0;
|
1381
|
-
const
|
1263
|
+
const name2 = parts?.[3];
|
1382
1264
|
const params = parts?.[5] || void 0;
|
1383
|
-
return { type, name, params };
|
1265
|
+
return { type, name: name2, params };
|
1384
1266
|
}
|
1385
1267
|
function extractFunctionName(def) {
|
1386
1268
|
return extractFunctionParts(def).name;
|
@@ -1443,11 +1325,11 @@ function keccak256(value, to_) {
|
|
1443
1325
|
// src/utils/hash/hashFunction.ts
|
1444
1326
|
var hash = (value) => keccak256(encodeBytes(value));
|
1445
1327
|
function hashFunction(def) {
|
1446
|
-
const
|
1328
|
+
const name2 = extractFunctionName(def);
|
1447
1329
|
const params = extractFunctionParams(def);
|
1448
1330
|
if (!params || params.length === 0)
|
1449
1331
|
return hash(def.replace(/ /g, ""));
|
1450
|
-
return hash(`${
|
1332
|
+
return hash(`${name2}(${params.map(({ type }) => type).join(",")})`);
|
1451
1333
|
}
|
1452
1334
|
|
1453
1335
|
// src/utils/hash/getEventSignature.ts
|
@@ -1479,7 +1361,7 @@ function getAddress(address) {
|
|
1479
1361
|
}
|
1480
1362
|
|
1481
1363
|
// src/utils/address/getContractAddress.ts
|
1482
|
-
function
|
1364
|
+
function getContractAddress2(opts) {
|
1483
1365
|
if (opts.opcode === "CREATE2")
|
1484
1366
|
return getCreate2Address(opts);
|
1485
1367
|
return getCreateAddress(opts);
|
@@ -1710,7 +1592,10 @@ function encodeTuple(value, { param }) {
|
|
1710
1592
|
}
|
1711
1593
|
function getArrayComponents(type) {
|
1712
1594
|
const matches = type.match(/^(.*)\[(\d+)?\]$/);
|
1713
|
-
return matches ?
|
1595
|
+
return matches ? (
|
1596
|
+
// Return `null` if the array is dynamic.
|
1597
|
+
[matches[2] ? Number(matches[2]) : null, matches[1]]
|
1598
|
+
) : void 0;
|
1714
1599
|
}
|
1715
1600
|
|
1716
1601
|
// src/utils/abi/decodeAbi.ts
|
@@ -1863,7 +1748,7 @@ function decodeString(data, { position }) {
|
|
1863
1748
|
return { consumed: 32, value };
|
1864
1749
|
}
|
1865
1750
|
function decodeTuple(data, { param, position }) {
|
1866
|
-
const hasUnnamedChild = param.components.length === 0 || param.components.some(({ name }) => !
|
1751
|
+
const hasUnnamedChild = param.components.length === 0 || param.components.some(({ name: name2 }) => !name2);
|
1867
1752
|
let value = hasUnnamedChild ? [] : {};
|
1868
1753
|
let consumed = 0;
|
1869
1754
|
if (hasDynamicChild(param)) {
|
@@ -1952,6 +1837,61 @@ function decodeErrorResult({
|
|
1952
1837
|
};
|
1953
1838
|
}
|
1954
1839
|
|
1840
|
+
// src/utils/abi/decodeEventLog.ts
|
1841
|
+
function decodeEventLog({
|
1842
|
+
abi,
|
1843
|
+
data,
|
1844
|
+
topics
|
1845
|
+
}) {
|
1846
|
+
const [signature, ...argTopics] = topics;
|
1847
|
+
const abiItem = abi.find(
|
1848
|
+
(x) => signature === getEventSignature(formatAbiItem(x))
|
1849
|
+
);
|
1850
|
+
if (!(abiItem && "name" in abiItem))
|
1851
|
+
throw new AbiEventSignatureNotFoundError(signature, {
|
1852
|
+
docsPath: "/docs/contract/decodeEventLog"
|
1853
|
+
});
|
1854
|
+
const { name: name2, inputs } = abiItem;
|
1855
|
+
const isUnnamed = inputs?.some((x) => !("name" in x && x.name));
|
1856
|
+
let args = isUnnamed ? [] : {};
|
1857
|
+
for (let i = 0; i < inputs.length; i++) {
|
1858
|
+
const param = inputs[i];
|
1859
|
+
const topic = argTopics[i];
|
1860
|
+
if (topic === null)
|
1861
|
+
args[param.name || i] = null;
|
1862
|
+
if (!topic)
|
1863
|
+
continue;
|
1864
|
+
if (Array.isArray(topic)) {
|
1865
|
+
args[param.name || i] = topic.map((t) => decodeTopic({ param, value: t }));
|
1866
|
+
} else {
|
1867
|
+
args[param.name || i] = decodeTopic({ param, value: topic });
|
1868
|
+
}
|
1869
|
+
}
|
1870
|
+
if (data) {
|
1871
|
+
const params = inputs.filter((x) => !("indexed" in x && x.indexed));
|
1872
|
+
const decodedData = decodeAbi({ params, data });
|
1873
|
+
if (decodedData) {
|
1874
|
+
if (isUnnamed)
|
1875
|
+
args = [...args, ...decodedData];
|
1876
|
+
else {
|
1877
|
+
for (let i = 0; i < params.length; i++) {
|
1878
|
+
args[params[i].name] = decodedData[i];
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
}
|
1882
|
+
}
|
1883
|
+
return {
|
1884
|
+
eventName: name2,
|
1885
|
+
args: Object.values(args).length > 0 ? args : void 0
|
1886
|
+
};
|
1887
|
+
}
|
1888
|
+
function decodeTopic({ param, value }) {
|
1889
|
+
if (param.type === "string" || param.type === "bytes" || param.type === "tuple" || param.type.match(/^(.*)\[(\d+)?\]$/))
|
1890
|
+
return value;
|
1891
|
+
const decodedArg = decodeAbi({ params: [param], data: value }) || [];
|
1892
|
+
return decodedArg[0];
|
1893
|
+
}
|
1894
|
+
|
1955
1895
|
// src/utils/abi/decodeFunctionData.ts
|
1956
1896
|
function decodeFunctionData({ abi, data }) {
|
1957
1897
|
const signature = slice(data, 0, 4);
|
@@ -1969,8 +1909,8 @@ function decodeFunctionData({ abi, data }) {
|
|
1969
1909
|
}
|
1970
1910
|
|
1971
1911
|
// src/utils/abi/getAbiItem.ts
|
1972
|
-
function getAbiItem({ abi, args = [], name }) {
|
1973
|
-
const abiItems = abi.filter((x) => "name" in x && x.name ===
|
1912
|
+
function getAbiItem({ abi, args = [], name: name2 }) {
|
1913
|
+
const abiItems = abi.filter((x) => "name" in x && x.name === name2);
|
1974
1914
|
if (abiItems.length === 0)
|
1975
1915
|
return void 0;
|
1976
1916
|
if (abiItems.length === 1)
|
@@ -2030,6 +1970,7 @@ function isArgOfType(arg, abiParameter) {
|
|
2030
1970
|
return Array.isArray(arg) && arg.every(
|
2031
1971
|
(x) => isArgOfType(x, {
|
2032
1972
|
...abiParameter,
|
1973
|
+
// Pop off `[]` or `[M]` from end of type
|
2033
1974
|
type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
|
2034
1975
|
})
|
2035
1976
|
);
|
@@ -2199,74 +2140,180 @@ function formatAbiItemWithArgs({
|
|
2199
2140
|
).join(", ")})`;
|
2200
2141
|
}
|
2201
2142
|
|
2202
|
-
// src/utils/
|
2203
|
-
|
2204
|
-
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
if (err.code === -32002)
|
2224
|
-
throw new ResourceUnavailableRpcError(err);
|
2225
|
-
if (err.code === -32003)
|
2226
|
-
throw new TransactionRejectedRpcError(err);
|
2227
|
-
if (err.code === -32004)
|
2228
|
-
throw new MethodNotSupportedRpcError(err);
|
2229
|
-
if (err.code === -32005)
|
2230
|
-
throw new LimitExceededRpcError(err);
|
2231
|
-
if (err.code === -32006)
|
2232
|
-
throw new JsonRpcVersionUnsupportedError(err);
|
2233
|
-
if (err_ instanceof BaseError)
|
2234
|
-
throw err_;
|
2235
|
-
throw new UnknownRpcError(err);
|
2236
|
-
}
|
2143
|
+
// src/utils/promise/withCache.ts
|
2144
|
+
var promiseCache = /* @__PURE__ */ new Map();
|
2145
|
+
var responseCache = /* @__PURE__ */ new Map();
|
2146
|
+
function getCache(cacheKey) {
|
2147
|
+
const buildCache = (cacheKey2, cache) => ({
|
2148
|
+
clear: () => cache.delete(cacheKey2),
|
2149
|
+
get: () => cache.get(cacheKey2),
|
2150
|
+
set: (data) => cache.set(cacheKey2, data)
|
2151
|
+
});
|
2152
|
+
const promise = buildCache(cacheKey, promiseCache);
|
2153
|
+
const response = buildCache(
|
2154
|
+
cacheKey,
|
2155
|
+
responseCache
|
2156
|
+
);
|
2157
|
+
return {
|
2158
|
+
clear: () => {
|
2159
|
+
promise.clear();
|
2160
|
+
response.clear();
|
2161
|
+
},
|
2162
|
+
promise,
|
2163
|
+
response
|
2237
2164
|
};
|
2238
2165
|
}
|
2166
|
+
async function withCache(fn, { cacheKey, maxAge = Infinity }) {
|
2167
|
+
const cache = getCache(cacheKey);
|
2168
|
+
const response = cache.response.get();
|
2169
|
+
if (response && maxAge > 0) {
|
2170
|
+
const age = (/* @__PURE__ */ new Date()).getTime() - response.created.getTime();
|
2171
|
+
if (age < maxAge)
|
2172
|
+
return response.data;
|
2173
|
+
}
|
2174
|
+
let promise = cache.promise.get();
|
2175
|
+
if (!promise) {
|
2176
|
+
promise = fn();
|
2177
|
+
cache.promise.set(promise);
|
2178
|
+
}
|
2179
|
+
const data = await promise;
|
2180
|
+
cache.promise.clear();
|
2181
|
+
cache.response.set({ created: /* @__PURE__ */ new Date(), data });
|
2182
|
+
return data;
|
2183
|
+
}
|
2239
2184
|
|
2240
|
-
// src/utils/
|
2241
|
-
function
|
2242
|
-
return
|
2185
|
+
// src/utils/wait.ts
|
2186
|
+
async function wait(time) {
|
2187
|
+
return new Promise((res) => setTimeout(res, time));
|
2243
2188
|
}
|
2244
2189
|
|
2245
|
-
// src/utils/
|
2246
|
-
|
2247
|
-
|
2248
|
-
|
2190
|
+
// src/utils/promise/withRetry.ts
|
2191
|
+
function withRetry(fn, {
|
2192
|
+
delay: delay_ = 100,
|
2193
|
+
retryCount = 2,
|
2194
|
+
shouldRetry = () => true
|
2195
|
+
} = {}) {
|
2196
|
+
return new Promise((resolve, reject) => {
|
2197
|
+
const attemptRetry = async ({ count = 0 } = {}) => {
|
2198
|
+
const retry = async ({ error }) => {
|
2199
|
+
const delay = typeof delay_ === "function" ? delay_({ count, error }) : delay_;
|
2200
|
+
if (delay)
|
2201
|
+
await wait(delay);
|
2202
|
+
attemptRetry({ count: count + 1 });
|
2203
|
+
};
|
2204
|
+
try {
|
2205
|
+
const data = await fn();
|
2206
|
+
resolve(data);
|
2207
|
+
} catch (err) {
|
2208
|
+
if (count < retryCount && await shouldRetry({ count, error: err }))
|
2209
|
+
return retry({ error: err });
|
2210
|
+
reject(err);
|
2211
|
+
}
|
2212
|
+
};
|
2213
|
+
attemptRetry();
|
2214
|
+
});
|
2249
2215
|
}
|
2250
2216
|
|
2251
|
-
// src/utils/
|
2252
|
-
function
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2217
|
+
// src/utils/promise/withTimeout.ts
|
2218
|
+
function withTimeout(fn, {
|
2219
|
+
errorInstance,
|
2220
|
+
timeout,
|
2221
|
+
signal
|
2222
|
+
}) {
|
2223
|
+
return new Promise((resolve, reject) => {
|
2224
|
+
;
|
2225
|
+
(async () => {
|
2226
|
+
let timeoutId;
|
2227
|
+
try {
|
2228
|
+
const controller = new AbortController();
|
2229
|
+
if (timeout > 0) {
|
2230
|
+
timeoutId = setTimeout(() => {
|
2231
|
+
if (signal) {
|
2232
|
+
controller.abort();
|
2233
|
+
} else {
|
2234
|
+
reject(errorInstance);
|
2235
|
+
}
|
2236
|
+
}, timeout);
|
2237
|
+
}
|
2238
|
+
resolve(await fn({ signal: controller?.signal }));
|
2239
|
+
} catch (err) {
|
2240
|
+
if (err.name === "AbortError")
|
2241
|
+
reject(errorInstance);
|
2242
|
+
reject(err);
|
2243
|
+
} finally {
|
2244
|
+
clearTimeout(timeoutId);
|
2245
|
+
}
|
2246
|
+
})();
|
2247
|
+
});
|
2257
2248
|
}
|
2258
2249
|
|
2259
|
-
// src/utils/
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2250
|
+
// src/utils/buildRequest.ts
|
2251
|
+
var isDeterministicError = (error) => {
|
2252
|
+
if (error instanceof UnknownRpcError)
|
2253
|
+
return false;
|
2254
|
+
if ("code" in error)
|
2255
|
+
return error.code !== -32603 && error.code !== -32005;
|
2256
|
+
if (error instanceof HttpRequestError && error.status)
|
2257
|
+
return error.status !== 408 && error.status !== 413 && error.status !== 429 && error.status !== 500;
|
2258
|
+
return true;
|
2259
|
+
};
|
2260
|
+
function buildRequest(request, {
|
2261
|
+
retryDelay = 150,
|
2262
|
+
retryCount = 3
|
2263
|
+
} = {}) {
|
2264
|
+
return async (args) => withRetry(
|
2265
|
+
async () => {
|
2266
|
+
try {
|
2267
|
+
return await request(args);
|
2268
|
+
} catch (err_) {
|
2269
|
+
let err = err_;
|
2270
|
+
if (err.code === -32700)
|
2271
|
+
throw new ParseRpcError(err);
|
2272
|
+
if (err.code === -32600)
|
2273
|
+
throw new InvalidRequestRpcError(err);
|
2274
|
+
if (err.code === -32601)
|
2275
|
+
throw new MethodNotFoundRpcError(err);
|
2276
|
+
if (err.code === -32602)
|
2277
|
+
throw new InvalidParamsRpcError(err);
|
2278
|
+
if (err.code === -32603)
|
2279
|
+
throw new InternalRpcError(err);
|
2280
|
+
if (err.code === -32e3)
|
2281
|
+
throw new InvalidInputRpcError(err);
|
2282
|
+
if (err.code === -32001)
|
2283
|
+
throw new ResourceNotFoundRpcError(err);
|
2284
|
+
if (err.code === -32002)
|
2285
|
+
throw new ResourceUnavailableRpcError(err);
|
2286
|
+
if (err.code === -32003)
|
2287
|
+
throw new TransactionRejectedRpcError(err);
|
2288
|
+
if (err.code === -32004)
|
2289
|
+
throw new MethodNotSupportedRpcError(err);
|
2290
|
+
if (err.code === -32005)
|
2291
|
+
throw new LimitExceededRpcError(err);
|
2292
|
+
if (err.code === -32006)
|
2293
|
+
throw new JsonRpcVersionUnsupportedError(err);
|
2294
|
+
if (err_ instanceof BaseError)
|
2295
|
+
throw err_;
|
2296
|
+
throw new UnknownRpcError(err);
|
2297
|
+
}
|
2298
|
+
},
|
2299
|
+
{
|
2300
|
+
delay: ({ count, error }) => {
|
2301
|
+
if (error && error instanceof HttpRequestError) {
|
2302
|
+
const retryAfter = error?.headers?.get("Retry-After");
|
2303
|
+
if (retryAfter?.match(/\d/))
|
2304
|
+
return parseInt(retryAfter) * 1e3;
|
2305
|
+
}
|
2306
|
+
return ~~(1 << count) * retryDelay;
|
2307
|
+
},
|
2308
|
+
retryCount,
|
2309
|
+
shouldRetry: ({ error }) => !isDeterministicError(error)
|
2310
|
+
}
|
2311
|
+
);
|
2312
|
+
}
|
2313
|
+
|
2314
|
+
// src/utils/chain.ts
|
2315
|
+
function defineChain(chain) {
|
2316
|
+
return chain;
|
2270
2317
|
}
|
2271
2318
|
|
2272
2319
|
// src/utils/formatters/format.ts
|
@@ -2422,115 +2469,9 @@ var defineTransactionRequest = defineFormatter({
|
|
2422
2469
|
format: formatTransactionRequest
|
2423
2470
|
});
|
2424
2471
|
|
2425
|
-
// src/utils/
|
2426
|
-
|
2427
|
-
|
2428
|
-
function getCache(cacheKey) {
|
2429
|
-
const buildCache = (cacheKey2, cache) => ({
|
2430
|
-
clear: () => cache.delete(cacheKey2),
|
2431
|
-
get: () => cache.get(cacheKey2),
|
2432
|
-
set: (data) => cache.set(cacheKey2, data)
|
2433
|
-
});
|
2434
|
-
const promise = buildCache(cacheKey, promiseCache);
|
2435
|
-
const response = buildCache(
|
2436
|
-
cacheKey,
|
2437
|
-
responseCache
|
2438
|
-
);
|
2439
|
-
return {
|
2440
|
-
clear: () => {
|
2441
|
-
promise.clear();
|
2442
|
-
response.clear();
|
2443
|
-
},
|
2444
|
-
promise,
|
2445
|
-
response
|
2446
|
-
};
|
2447
|
-
}
|
2448
|
-
async function withCache(fn, { cacheKey, maxAge = Infinity }) {
|
2449
|
-
const cache = getCache(cacheKey);
|
2450
|
-
const response = cache.response.get();
|
2451
|
-
if (response && maxAge > 0) {
|
2452
|
-
const age = new Date().getTime() - response.created.getTime();
|
2453
|
-
if (age < maxAge)
|
2454
|
-
return response.data;
|
2455
|
-
}
|
2456
|
-
let promise = cache.promise.get();
|
2457
|
-
if (!promise) {
|
2458
|
-
promise = fn();
|
2459
|
-
cache.promise.set(promise);
|
2460
|
-
}
|
2461
|
-
const data = await promise;
|
2462
|
-
cache.promise.clear();
|
2463
|
-
cache.response.set({ created: new Date(), data });
|
2464
|
-
return data;
|
2465
|
-
}
|
2466
|
-
|
2467
|
-
// src/utils/wait.ts
|
2468
|
-
async function wait(time) {
|
2469
|
-
return new Promise((res) => setTimeout(res, time));
|
2470
|
-
}
|
2471
|
-
|
2472
|
-
// src/utils/promise/withRetry.ts
|
2473
|
-
function withRetry(fn, {
|
2474
|
-
delay: delay_ = 100,
|
2475
|
-
retryCount = 2,
|
2476
|
-
shouldRetryOnResponse = () => false,
|
2477
|
-
shouldRetryOnError = () => false
|
2478
|
-
} = {}) {
|
2479
|
-
return new Promise((resolve, reject) => {
|
2480
|
-
const attemptRetry = async ({ count = 0 } = {}) => {
|
2481
|
-
const retry = async ({ data } = {}) => {
|
2482
|
-
const delay = typeof delay_ === "function" ? delay_({ count, data }) : delay_;
|
2483
|
-
if (delay)
|
2484
|
-
await wait(delay);
|
2485
|
-
attemptRetry({ count: count + 1 });
|
2486
|
-
};
|
2487
|
-
try {
|
2488
|
-
const data = await fn();
|
2489
|
-
if (count < retryCount && await shouldRetryOnResponse({ count, data }))
|
2490
|
-
return retry({ data });
|
2491
|
-
resolve(data);
|
2492
|
-
} catch (err) {
|
2493
|
-
if (count < retryCount && await shouldRetryOnError({ count, error: err }))
|
2494
|
-
return retry();
|
2495
|
-
reject(err);
|
2496
|
-
}
|
2497
|
-
};
|
2498
|
-
attemptRetry();
|
2499
|
-
});
|
2500
|
-
}
|
2501
|
-
|
2502
|
-
// src/utils/promise/withTimeout.ts
|
2503
|
-
function withTimeout(fn, {
|
2504
|
-
errorInstance,
|
2505
|
-
timeout,
|
2506
|
-
signal
|
2507
|
-
}) {
|
2508
|
-
return new Promise((resolve, reject) => {
|
2509
|
-
;
|
2510
|
-
(async () => {
|
2511
|
-
let timeoutId;
|
2512
|
-
try {
|
2513
|
-
const controller = new AbortController();
|
2514
|
-
if (timeout > 0) {
|
2515
|
-
timeoutId = setTimeout(() => {
|
2516
|
-
if (signal) {
|
2517
|
-
controller.abort();
|
2518
|
-
} else {
|
2519
|
-
reject(errorInstance);
|
2520
|
-
}
|
2521
|
-
}, timeout);
|
2522
|
-
}
|
2523
|
-
resolve(await fn({ signal: controller?.signal }));
|
2524
|
-
} catch (err) {
|
2525
|
-
if (err.name === "AbortError")
|
2526
|
-
reject(errorInstance);
|
2527
|
-
reject(err);
|
2528
|
-
} finally {
|
2529
|
-
clearTimeout(timeoutId);
|
2530
|
-
}
|
2531
|
-
})();
|
2532
|
-
});
|
2533
|
-
}
|
2472
|
+
// src/utils/rpc.ts
|
2473
|
+
import fetch from "isomorphic-unfetch";
|
2474
|
+
import WebSocket from "isomorphic-ws";
|
2534
2475
|
|
2535
2476
|
// src/utils/stringify.ts
|
2536
2477
|
function stringify(value) {
|
@@ -2544,12 +2485,10 @@ function stringify(value) {
|
|
2544
2485
|
var id = 0;
|
2545
2486
|
async function http(url, {
|
2546
2487
|
body,
|
2547
|
-
retryDelay = 100,
|
2548
|
-
retryCount = 2,
|
2549
2488
|
timeout = 0
|
2550
2489
|
}) {
|
2551
|
-
|
2552
|
-
|
2490
|
+
try {
|
2491
|
+
const response = await withTimeout(
|
2553
2492
|
async ({ signal }) => {
|
2554
2493
|
const response2 = await fetch(url, {
|
2555
2494
|
headers: {
|
@@ -2566,42 +2505,39 @@ async function http(url, {
|
|
2566
2505
|
timeout,
|
2567
2506
|
signal: true
|
2568
2507
|
}
|
2569
|
-
)
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
return ~~((Math.random() + 0.5) * (1 << count)) * retryDelay;
|
2576
|
-
},
|
2577
|
-
retryCount,
|
2578
|
-
shouldRetryOnResponse: async ({ data: data2 }) => {
|
2579
|
-
if (data2.status >= 500)
|
2580
|
-
return true;
|
2581
|
-
if ([408, 413, 429].includes(data2.status))
|
2582
|
-
return true;
|
2583
|
-
return false;
|
2584
|
-
}
|
2508
|
+
);
|
2509
|
+
let data;
|
2510
|
+
if (response.headers.get("Content-Type")?.startsWith("application/json")) {
|
2511
|
+
data = await response.json();
|
2512
|
+
} else {
|
2513
|
+
data = await response.text();
|
2585
2514
|
}
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2515
|
+
if (!response.ok) {
|
2516
|
+
throw new HttpRequestError({
|
2517
|
+
body,
|
2518
|
+
details: stringify(data.error) || response.statusText,
|
2519
|
+
headers: response.headers,
|
2520
|
+
status: response.status,
|
2521
|
+
url
|
2522
|
+
});
|
2523
|
+
}
|
2524
|
+
if (data.error) {
|
2525
|
+
throw new RpcError({ body, error: data.error, url });
|
2526
|
+
}
|
2527
|
+
return data;
|
2528
|
+
} catch (err) {
|
2529
|
+
if (err instanceof HttpRequestError)
|
2530
|
+
throw err;
|
2531
|
+
if (err instanceof RpcError)
|
2532
|
+
throw err;
|
2533
|
+
if (err instanceof TimeoutError)
|
2534
|
+
throw err;
|
2594
2535
|
throw new HttpRequestError({
|
2595
2536
|
body,
|
2596
|
-
details:
|
2597
|
-
status: response.status,
|
2537
|
+
details: err.message,
|
2598
2538
|
url
|
2599
2539
|
});
|
2600
2540
|
}
|
2601
|
-
if (data.error) {
|
2602
|
-
throw new RpcError({ body, error: data.error, url });
|
2603
|
-
}
|
2604
|
-
return data;
|
2605
2541
|
}
|
2606
2542
|
var sockets = /* @__PURE__ */ new Map();
|
2607
2543
|
async function getSocket(url_) {
|
@@ -2794,7 +2730,46 @@ export {
|
|
2794
2730
|
InvalidDefinitionTypeError,
|
2795
2731
|
InvalidAddressError,
|
2796
2732
|
BlockNotFoundError,
|
2733
|
+
ChainDoesNotSupportContract,
|
2797
2734
|
multicall3Abi,
|
2735
|
+
panicReasons,
|
2736
|
+
ContractFunctionExecutionError,
|
2737
|
+
ContractFunctionRevertedError,
|
2738
|
+
ContractFunctionZeroDataError,
|
2739
|
+
RawContractError,
|
2740
|
+
SizeExceedsPaddingSizeError,
|
2741
|
+
DataLengthTooLongError,
|
2742
|
+
DataLengthTooShortError,
|
2743
|
+
InvalidBytesBooleanError,
|
2744
|
+
InvalidHexBooleanError,
|
2745
|
+
InvalidHexValueError,
|
2746
|
+
OffsetOutOfBoundsError,
|
2747
|
+
FilterTypeNotSupportedError,
|
2748
|
+
RequestError,
|
2749
|
+
RpcRequestError,
|
2750
|
+
ParseRpcError,
|
2751
|
+
InvalidRequestRpcError,
|
2752
|
+
MethodNotFoundRpcError,
|
2753
|
+
InvalidParamsRpcError,
|
2754
|
+
InternalRpcError,
|
2755
|
+
InvalidInputRpcError,
|
2756
|
+
ResourceNotFoundRpcError,
|
2757
|
+
ResourceUnavailableRpcError,
|
2758
|
+
TransactionRejectedRpcError,
|
2759
|
+
MethodNotSupportedRpcError,
|
2760
|
+
LimitExceededRpcError,
|
2761
|
+
JsonRpcVersionUnsupportedError,
|
2762
|
+
UnknownRpcError,
|
2763
|
+
HttpRequestError,
|
2764
|
+
WebSocketRequestError,
|
2765
|
+
RpcError,
|
2766
|
+
TimeoutError,
|
2767
|
+
InvalidGasArgumentsError,
|
2768
|
+
TransactionNotFoundError,
|
2769
|
+
TransactionReceiptNotFoundError,
|
2770
|
+
WaitForTransactionReceiptTimeoutError,
|
2771
|
+
UrlRequiredError,
|
2772
|
+
concat,
|
2798
2773
|
isBytes,
|
2799
2774
|
isHex,
|
2800
2775
|
pad,
|
@@ -2837,7 +2812,7 @@ export {
|
|
2837
2812
|
getFunctionSignature,
|
2838
2813
|
checksumAddress,
|
2839
2814
|
getAddress,
|
2840
|
-
getContractAddress,
|
2815
|
+
getContractAddress2 as getContractAddress,
|
2841
2816
|
getCreateAddress,
|
2842
2817
|
getCreate2Address,
|
2843
2818
|
isAddress,
|
@@ -2846,6 +2821,7 @@ export {
|
|
2846
2821
|
decodeAbi,
|
2847
2822
|
formatAbiItem,
|
2848
2823
|
decodeErrorResult,
|
2824
|
+
decodeEventLog,
|
2849
2825
|
decodeFunctionData,
|
2850
2826
|
getAbiItem,
|
2851
2827
|
decodeFunctionResult,
|
@@ -2855,11 +2831,12 @@ export {
|
|
2855
2831
|
encodeFunctionData,
|
2856
2832
|
encodeFunctionResult,
|
2857
2833
|
formatAbiItemWithArgs,
|
2834
|
+
getCache,
|
2835
|
+
withCache,
|
2836
|
+
wait,
|
2837
|
+
isDeterministicError,
|
2858
2838
|
buildRequest,
|
2859
2839
|
defineChain,
|
2860
|
-
normalize,
|
2861
|
-
labelhash,
|
2862
|
-
namehash,
|
2863
2840
|
format3 as format,
|
2864
2841
|
defineFormatter,
|
2865
2842
|
transactionType,
|
@@ -2874,9 +2851,6 @@ export {
|
|
2874
2851
|
defineTransactionReceipt,
|
2875
2852
|
formatTransactionRequest,
|
2876
2853
|
defineTransactionRequest,
|
2877
|
-
getCache,
|
2878
|
-
withCache,
|
2879
|
-
wait,
|
2880
2854
|
stringify,
|
2881
2855
|
getSocket,
|
2882
2856
|
rpc,
|
@@ -2888,42 +2862,6 @@ export {
|
|
2888
2862
|
formatGwei,
|
2889
2863
|
parseUnit,
|
2890
2864
|
parseEther,
|
2891
|
-
parseGwei
|
2892
|
-
ContractFunctionExecutionError,
|
2893
|
-
ContractFunctionRevertedError,
|
2894
|
-
ContractFunctionZeroDataError,
|
2895
|
-
RawContractError,
|
2896
|
-
SizeExceedsPaddingSizeError,
|
2897
|
-
DataLengthTooLongError,
|
2898
|
-
DataLengthTooShortError,
|
2899
|
-
InvalidBytesBooleanError,
|
2900
|
-
InvalidHexBooleanError,
|
2901
|
-
InvalidHexValueError,
|
2902
|
-
OffsetOutOfBoundsError,
|
2903
|
-
FilterTypeNotSupportedError,
|
2904
|
-
RequestError,
|
2905
|
-
RpcRequestError,
|
2906
|
-
ParseRpcError,
|
2907
|
-
InvalidRequestRpcError,
|
2908
|
-
MethodNotFoundRpcError,
|
2909
|
-
InvalidParamsRpcError,
|
2910
|
-
InternalRpcError,
|
2911
|
-
InvalidInputRpcError,
|
2912
|
-
ResourceNotFoundRpcError,
|
2913
|
-
ResourceUnavailableRpcError,
|
2914
|
-
TransactionRejectedRpcError,
|
2915
|
-
MethodNotSupportedRpcError,
|
2916
|
-
LimitExceededRpcError,
|
2917
|
-
JsonRpcVersionUnsupportedError,
|
2918
|
-
UnknownRpcError,
|
2919
|
-
HttpRequestError,
|
2920
|
-
WebSocketRequestError,
|
2921
|
-
RpcError,
|
2922
|
-
TimeoutError,
|
2923
|
-
InvalidGasArgumentsError,
|
2924
|
-
TransactionNotFoundError,
|
2925
|
-
TransactionReceiptNotFoundError,
|
2926
|
-
WaitForTransactionReceiptTimeoutError,
|
2927
|
-
UrlRequiredError
|
2865
|
+
parseGwei
|
2928
2866
|
};
|
2929
|
-
//# sourceMappingURL=chunk-
|
2867
|
+
//# sourceMappingURL=chunk-PRG3BBPZ.mjs.map
|