viem 0.0.1-alpha.25 → 0.0.1-alpha.27
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/dist/{call-ac509982.d.ts → call-3476b8ee.d.ts} +4 -5
- package/dist/{chain-f16512e8.d.ts → chain-42de87e5.d.ts} +1 -14
- package/dist/{chain-c4ccb458.d.ts → chain-b0cfb141.d.ts} +1 -1
- package/dist/chains.d.ts +3 -3
- package/dist/chains.js +46 -46
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-NUXMGPMK.js → chunk-2DSFM32P.js} +15 -15
- package/dist/{chunk-NUXMGPMK.js.map → chunk-2DSFM32P.js.map} +1 -1
- package/dist/{chunk-KSAO4Y4Q.mjs → chunk-AKGXRZDN.mjs} +355 -337
- package/dist/chunk-AKGXRZDN.mjs.map +1 -0
- package/dist/{chunk-2Y3UZMSP.mjs → chunk-BJJH7RYH.mjs} +61 -16
- package/dist/chunk-BJJH7RYH.mjs.map +1 -0
- package/dist/{chunk-CD2XJOBJ.js → chunk-JY7JGKSA.js} +136 -91
- package/dist/chunk-JY7JGKSA.js.map +1 -0
- package/dist/{chunk-LEPQJNVO.mjs → chunk-LF6P33WQ.mjs} +6 -6
- package/dist/chunk-LF6P33WQ.mjs.map +1 -0
- package/dist/{chunk-THMRUG4D.js → chunk-W7KWIGWO.js} +314 -296
- package/dist/chunk-W7KWIGWO.js.map +1 -0
- package/dist/{contract-9e76e561.d.ts → contract-9dd2f98b.d.ts} +1 -1
- package/dist/contract.d.ts +21 -15
- package/dist/contract.js +6 -4
- package/dist/contract.mjs +5 -3
- package/dist/{createClient-68ee4bb4.d.ts → createClient-6689596e.d.ts} +10 -4
- package/dist/{createPublicClient-b732194e.d.ts → createPublicClient-fd558574.d.ts} +3 -3
- package/dist/{createTestClient-dedf321e.d.ts → createTestClient-bc1d9028.d.ts} +3 -3
- package/dist/{createWalletClient-75813d83.d.ts → createWalletClient-4df88244.d.ts} +3 -3
- package/dist/{decodeErrorResult-0b934d23.d.ts → decodeErrorResult-ac835649.d.ts} +2 -2
- package/dist/{eip1193-6f9ba163.d.ts → eip1193-617a05ae.d.ts} +2 -2
- package/dist/ens.d.ts +8 -8
- package/dist/ens.js +21 -21
- package/dist/ens.js.map +1 -1
- package/dist/ens.mjs +9 -9
- package/dist/ens.mjs.map +1 -1
- package/dist/{getAbiItem-c8e6e7d4.d.ts → getAbiItem-d2e8bd76.d.ts} +2 -2
- package/dist/index.d.ts +44 -21
- package/dist/index.js +54 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -21
- package/dist/index.mjs.map +1 -1
- package/dist/public.d.ts +13 -12
- package/dist/public.js +3 -3
- package/dist/public.mjs +2 -2
- package/dist/{readContract-4f6e2692.d.ts → readContract-c460f23a.d.ts} +3 -3
- package/dist/{rpc-a5a7f376.d.ts → rpc-8c10fc98.d.ts} +3 -5
- package/dist/{sendTransaction-e713f90c.d.ts → sendTransaction-7ce442c0.d.ts} +3 -3
- package/dist/test.d.ts +4 -4
- package/dist/test.js +13 -13
- package/dist/test.mjs +1 -1
- package/dist/{transactionReceipt-2a86c7c7.d.ts → transactionReceipt-44dbf122.d.ts} +1 -1
- package/dist/{transactionRequest-c7794f5e.d.ts → transactionRequest-f437b4ba.d.ts} +1 -1
- package/dist/utils/index.d.ts +25 -22
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.mjs +13 -13
- package/dist/wallet.d.ts +6 -6
- package/dist/wallet.js +3 -3
- package/dist/wallet.mjs +2 -2
- package/dist/{watchEvent-c346c12d.d.ts → watchEvent-569c9976.d.ts} +3 -3
- package/dist/window.d.ts +2 -2
- package/package.json +4 -5
- package/public/package.json +4 -0
- package/test/package.json +4 -0
- package/dist/chunk-2Y3UZMSP.mjs.map +0 -1
- package/dist/chunk-CD2XJOBJ.js.map +0 -1
- package/dist/chunk-KSAO4Y4Q.mjs.map +0 -1
- package/dist/chunk-LEPQJNVO.mjs.map +0 -1
- package/dist/chunk-THMRUG4D.js.map +0 -1
- package/src/_test/abis.ts +0 -1420
- package/src/_test/bench.ts +0 -15
- package/src/_test/constants.ts +0 -63
- 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 -155
- package/src/actions/ens/getEnsAddress.bench.ts +0 -26
- package/src/actions/ens/getEnsAddress.test.ts +0 -97
- package/src/actions/ens/getEnsAddress.ts +0 -122
- package/src/actions/ens/getEnsName.bench.ts +0 -30
- package/src/actions/ens/getEnsName.test.ts +0 -101
- package/src/actions/ens/getEnsName.ts +0 -106
- package/src/actions/ens/index.test.ts +0 -12
- package/src/actions/ens/index.ts +0 -3
- 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 -277
- package/src/actions/public/createEventFilter.ts +0 -93
- 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/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 -383
- package/src/actions/public/getFilterChanges.ts +0 -23
- package/src/actions/public/getFilterLogs.test.ts +0 -297
- 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 -306
- 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 -43
- package/src/actions/public/index.ts +0 -146
- package/src/actions/public/multicall.test.ts +0 -452
- package/src/actions/public/multicall.ts +0 -108
- 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 -91
- 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/deployContract.test.ts +0 -55
- package/src/actions/wallet/deployContract.ts +0 -38
- 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 -21
- package/src/actions/wallet/index.ts +0 -36
- 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 -439
- 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 -164
- package/src/clients/transports/webSocket.ts +0 -118
- 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/contract.test.ts +0 -31
- package/src/contract.ts +0 -68
- package/src/ens.test.ts +0 -15
- package/src/ens.ts +0 -8
- package/src/errors/abi.test.ts +0 -81
- package/src/errors/abi.ts +0 -254
- 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/chain.test.ts +0 -46
- package/src/errors/chain.ts +0 -33
- 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 -82
- 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 -116
- package/src/index.ts +0 -132
- package/src/public.test.ts +0 -36
- package/src/public.ts +0 -76
- package/src/test.test.ts +0 -38
- package/src/test.ts +0 -52
- package/src/types/block.ts +0 -71
- package/src/types/chain.ts +0 -6
- package/src/types/contract.ts +0 -497
- 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 -84
- 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 -88
- 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/decodeEventLog.test.ts +0 -542
- package/src/utils/abi/decodeEventLog.ts +0 -107
- package/src/utils/abi/decodeFunctionData.test.ts +0 -138
- package/src/utils/abi/decodeFunctionData.ts +0 -32
- 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 -42
- 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 -24
- package/src/utils/abi/index.ts +0 -48
- 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 -14
- package/src/utils/ens/index.ts +0 -7
- 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/ens/packetToBytes.test.ts +0 -11
- package/src/utils/ens/packetToBytes.ts +0 -29
- 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 -111
- package/src/utils/index.ts +0 -142
- 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 -990
- package/src/utils/rpc.ts +0 -294
- 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.test.ts +0 -19
- package/src/wallet.ts +0 -23
- package/src/window.ts +0 -1
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
9
9
|
var package_default = {
|
10
10
|
name: "viem",
|
11
11
|
description: "TypeScript Interface for Ethereum",
|
12
|
-
version: "0.0.1-alpha.
|
12
|
+
version: "0.0.1-alpha.26",
|
13
13
|
scripts: {
|
14
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",
|
@@ -18,30 +18,45 @@ var package_default = {
|
|
18
18
|
changeset: "changeset",
|
19
19
|
"changeset:release": "pnpm build && changeset publish",
|
20
20
|
"changeset:version": "changeset version && pnpm install --lockfile-only",
|
21
|
+
clean: "rimraf dist chains contract ens public test utils wallet window",
|
21
22
|
"contracts:build": "wagmi generate",
|
22
23
|
dev: "DEV=true tsup",
|
23
24
|
"dev:docs": "pnpm -r --filter site dev",
|
24
|
-
format: "rome format src/
|
25
|
+
format: "rome format src/ --write",
|
25
26
|
lint: "rome check .",
|
26
27
|
"lint:fix": "pnpm lint --apply-suggested",
|
27
|
-
playground: "pnpm --filter playground-
|
28
|
+
playground: "pnpm --filter playground-browser dev",
|
28
29
|
postinstall: "pnpm dev && pnpm contracts:build",
|
29
30
|
preinstall: "npx only-allow pnpm",
|
30
|
-
prepublishOnly: "pnpm
|
31
|
+
prepublishOnly: "pnpm bun scripts/prepublishOnly.ts",
|
31
32
|
prepare: "npx simple-git-hooks",
|
32
33
|
test: "vitest dev --no-threads",
|
34
|
+
"test:cov": "vitest dev --coverage --no-threads",
|
33
35
|
"test:ci": "CI=true vitest --coverage --no-threads",
|
34
36
|
"test:ui": "vitest dev --ui --no-threads",
|
35
|
-
"ts-node": "
|
37
|
+
"ts-node": "bun",
|
36
38
|
typecheck: "tsc --noEmit"
|
37
39
|
},
|
40
|
+
tsup: {
|
41
|
+
entry: [
|
42
|
+
"src/index.ts",
|
43
|
+
"src/chains.ts",
|
44
|
+
"src/contract.ts",
|
45
|
+
"src/ens.ts",
|
46
|
+
"src/public.ts",
|
47
|
+
"src/test.ts",
|
48
|
+
"src/utils/index.ts",
|
49
|
+
"src/wallet.ts",
|
50
|
+
"src/window.ts"
|
51
|
+
]
|
52
|
+
},
|
38
53
|
files: [
|
54
|
+
"/dist",
|
39
55
|
"/chains",
|
40
56
|
"/contract",
|
41
|
-
"/dist",
|
42
57
|
"/ens",
|
43
|
-
"/
|
44
|
-
"/
|
58
|
+
"/public",
|
59
|
+
"/test",
|
45
60
|
"/utils",
|
46
61
|
"/wallet",
|
47
62
|
"/window"
|
@@ -49,47 +64,47 @@ var package_default = {
|
|
49
64
|
exports: {
|
50
65
|
".": {
|
51
66
|
types: "./dist/index.d.ts",
|
52
|
-
module: "./dist/index.
|
67
|
+
module: "./dist/index.mts",
|
53
68
|
default: "./dist/index.js"
|
54
69
|
},
|
55
70
|
"./chains": {
|
56
71
|
types: "./dist/chains.d.ts",
|
57
|
-
module: "./dist/chains.
|
72
|
+
module: "./dist/chains.mts",
|
58
73
|
default: "./dist/chains.js"
|
59
74
|
},
|
60
75
|
"./contract": {
|
61
76
|
types: "./dist/contract.d.ts",
|
62
|
-
module: "./dist/contract.
|
77
|
+
module: "./dist/contract.mts",
|
63
78
|
default: "./dist/contract.js"
|
64
79
|
},
|
65
80
|
"./ens": {
|
66
81
|
types: "./dist/ens.d.ts",
|
67
|
-
module: "./dist/ens.
|
82
|
+
module: "./dist/ens.mts",
|
68
83
|
default: "./dist/ens.js"
|
69
84
|
},
|
70
85
|
"./public": {
|
71
86
|
types: "./dist/public.d.ts",
|
72
|
-
module: "./dist/public.
|
87
|
+
module: "./dist/public.mts",
|
73
88
|
default: "./dist/public.js"
|
74
89
|
},
|
75
90
|
"./test": {
|
76
91
|
types: "./dist/test.d.ts",
|
77
|
-
module: "./dist/test.
|
92
|
+
module: "./dist/test.mts",
|
78
93
|
default: "./dist/test.js"
|
79
94
|
},
|
80
95
|
"./utils": {
|
81
96
|
types: "./dist/utils/index.d.ts",
|
82
|
-
module: "./dist/utils/index.
|
97
|
+
module: "./dist/utils/index.mts",
|
83
98
|
default: "./dist/utils/index.js"
|
84
99
|
},
|
85
100
|
"./wallet": {
|
86
101
|
types: "./dist/wallet.d.ts",
|
87
|
-
module: "./dist/wallet.
|
102
|
+
module: "./dist/wallet.mts",
|
88
103
|
default: "./dist/wallet.js"
|
89
104
|
},
|
90
105
|
"./window": {
|
91
106
|
types: "./dist/window.d.ts",
|
92
|
-
module: "./dist/window.
|
107
|
+
module: "./dist/window.mts",
|
93
108
|
default: "./dist/window.js"
|
94
109
|
},
|
95
110
|
"./package.json": "./package.json"
|
@@ -103,7 +118,6 @@ var package_default = {
|
|
103
118
|
"@wagmi/chains": "~0.2.8",
|
104
119
|
abitype: "~0.3.0",
|
105
120
|
"idna-uts46-hx": "^4.1.2",
|
106
|
-
"isomorphic-unfetch": "^4.0.2",
|
107
121
|
"isomorphic-ws": "^5.0.0",
|
108
122
|
ws: "^8.12.0"
|
109
123
|
},
|
@@ -120,20 +134,20 @@ var package_default = {
|
|
120
134
|
"@vitest/coverage-c8": "^0.24.3",
|
121
135
|
"@vitest/ui": "^0.19.1",
|
122
136
|
"@wagmi/cli": "^0.1.6",
|
137
|
+
bun: "^0.5.5",
|
123
138
|
bundlewatch: "^0.3.3",
|
124
139
|
dedent: "^0.7.0",
|
125
|
-
esbuild: "^0.16.17",
|
126
|
-
"esbuild-register": "^3.4.2",
|
127
140
|
ethers: "^5.7.2",
|
128
141
|
"ethers@6": "npm:ethers@^6.0.2",
|
129
142
|
execa: "^6.1.0",
|
130
143
|
"fs-extra": "^10.1.0",
|
144
|
+
rimraf: "^4.1.2",
|
131
145
|
rome: "^11.0.0",
|
132
146
|
"simple-git-hooks": "^2.8.1",
|
133
147
|
tsup: "^6.6.0",
|
134
148
|
typescript: "^4.9.4",
|
135
149
|
vite: "^3.2.5",
|
136
|
-
vitest: "
|
150
|
+
vitest: "~0.25.8",
|
137
151
|
web3: "^1.8.1"
|
138
152
|
},
|
139
153
|
license: "MIT",
|
@@ -150,7 +164,7 @@ var package_default = {
|
|
150
164
|
"web3"
|
151
165
|
],
|
152
166
|
"simple-git-hooks": {
|
153
|
-
"pre-commit": "pnpm format
|
167
|
+
"pre-commit": "pnpm format && pnpm lint:fix"
|
154
168
|
},
|
155
169
|
pnpm: {
|
156
170
|
patchedDependencies: {
|
@@ -159,8 +173,12 @@ var package_default = {
|
|
159
173
|
}
|
160
174
|
};
|
161
175
|
|
176
|
+
// src/errors/utils.ts
|
177
|
+
var getContractAddress = (address) => address;
|
178
|
+
var getUrl = (url) => url;
|
179
|
+
var getVersion = () => `${package_default.name}@${package_default.version}`;
|
180
|
+
|
162
181
|
// src/errors/base.ts
|
163
|
-
var version = process.env.TEST ? "1.0.2" : package_default.version;
|
164
182
|
var BaseError = class extends Error {
|
165
183
|
constructor(shortMessage, args = {}) {
|
166
184
|
const details = args.cause instanceof BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details;
|
@@ -171,7 +189,7 @@ var BaseError = class extends Error {
|
|
171
189
|
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
172
190
|
...docsPath5 ? [`Docs: https://viem.sh${docsPath5}`] : [],
|
173
191
|
...details ? [`Details: ${details}`] : [],
|
174
|
-
`Version:
|
192
|
+
`Version: ${getVersion()}`
|
175
193
|
].join("\n");
|
176
194
|
super(message);
|
177
195
|
__publicField(this, "details");
|
@@ -575,8 +593,7 @@ var ContractFunctionExecutionError = class extends BaseError {
|
|
575
593
|
docsPath: docsPath5,
|
576
594
|
metaMessages: [
|
577
595
|
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
578
|
-
contractAddress && `Contract: ${
|
579
|
-
process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
|
596
|
+
contractAddress && `Contract: ${getContractAddress(contractAddress)}`,
|
580
597
|
functionWithParams && `Function: ${functionWithParams}`,
|
581
598
|
formattedArgs && formattedArgs !== "()" && `Arguments: ${[...Array(functionName?.length ?? 0).keys()].map(() => " ").join("")}${formattedArgs}`,
|
582
599
|
sender && `Sender: ${sender}`
|
@@ -745,17 +762,22 @@ var FilterTypeNotSupportedError = class extends BaseError {
|
|
745
762
|
|
746
763
|
// src/errors/request.ts
|
747
764
|
var RequestError = class extends BaseError {
|
748
|
-
constructor(err, {
|
765
|
+
constructor(err, {
|
766
|
+
docsPath: docsPath5,
|
767
|
+
metaMessages,
|
768
|
+
shortMessage
|
769
|
+
}) {
|
749
770
|
super(shortMessage, {
|
750
771
|
cause: err,
|
751
|
-
docsPath: docsPath5
|
772
|
+
docsPath: docsPath5,
|
773
|
+
metaMessages
|
752
774
|
});
|
753
775
|
this.name = err.name;
|
754
776
|
}
|
755
777
|
};
|
756
778
|
var RpcRequestError = class extends RequestError {
|
757
779
|
constructor(err, { docsPath: docsPath5, shortMessage }) {
|
758
|
-
super(err, { docsPath: docsPath5, shortMessage });
|
780
|
+
super(err, { docsPath: docsPath5, metaMessages: err.metaMessages, shortMessage });
|
759
781
|
__publicField(this, "code");
|
760
782
|
this.code = err.code;
|
761
783
|
this.name = err.name;
|
@@ -875,24 +897,27 @@ var HttpRequestError = class extends BaseError {
|
|
875
897
|
constructor({
|
876
898
|
body,
|
877
899
|
details,
|
900
|
+
headers,
|
878
901
|
status,
|
879
902
|
url
|
880
903
|
}) {
|
881
|
-
super(
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
`
|
886
|
-
`URL: ${url}`,
|
904
|
+
super("HTTP request failed.", {
|
905
|
+
details,
|
906
|
+
metaMessages: [
|
907
|
+
status && `Status: ${status}`,
|
908
|
+
`URL: ${getUrl(url)}`,
|
887
909
|
`Request body: ${stringify(body)}`
|
888
|
-
].
|
889
|
-
|
890
|
-
details
|
891
|
-
}
|
892
|
-
);
|
910
|
+
].filter(Boolean)
|
911
|
+
});
|
893
912
|
__publicField(this, "name", "HttpRequestError");
|
913
|
+
__publicField(this, "body");
|
914
|
+
__publicField(this, "headers");
|
894
915
|
__publicField(this, "status");
|
916
|
+
__publicField(this, "url");
|
917
|
+
this.body = body;
|
918
|
+
this.headers = headers;
|
895
919
|
this.status = status;
|
920
|
+
this.url = url;
|
896
921
|
}
|
897
922
|
};
|
898
923
|
var WebSocketRequestError = class extends BaseError {
|
@@ -901,17 +926,10 @@ var WebSocketRequestError = class extends BaseError {
|
|
901
926
|
details,
|
902
927
|
url
|
903
928
|
}) {
|
904
|
-
super(
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
`URL: ${url}`,
|
909
|
-
`Request body: ${stringify(body)}`
|
910
|
-
].join("\n"),
|
911
|
-
{
|
912
|
-
details
|
913
|
-
}
|
914
|
-
);
|
929
|
+
super("WebSocket request failed.", {
|
930
|
+
details,
|
931
|
+
metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
|
932
|
+
});
|
915
933
|
__publicField(this, "name", "WebSocketRequestError");
|
916
934
|
}
|
917
935
|
};
|
@@ -921,18 +939,11 @@ var RpcError = class extends BaseError {
|
|
921
939
|
error,
|
922
940
|
url
|
923
941
|
}) {
|
924
|
-
super(
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
`Request body: ${stringify(body)}`
|
930
|
-
].join("\n"),
|
931
|
-
{
|
932
|
-
cause: error,
|
933
|
-
details: error.message
|
934
|
-
}
|
935
|
-
);
|
942
|
+
super("RPC Request failed.", {
|
943
|
+
cause: error,
|
944
|
+
details: error.message,
|
945
|
+
metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
|
946
|
+
});
|
936
947
|
__publicField(this, "code");
|
937
948
|
__publicField(this, "name", "RpcError");
|
938
949
|
this.code = error.code;
|
@@ -943,17 +954,10 @@ var TimeoutError = class extends BaseError {
|
|
943
954
|
body,
|
944
955
|
url
|
945
956
|
}) {
|
946
|
-
super(
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
`URL: ${url}`,
|
951
|
-
`Request body: ${stringify(body)}`
|
952
|
-
].join("\n"),
|
953
|
-
{
|
954
|
-
details: "The request timed out."
|
955
|
-
}
|
956
|
-
);
|
957
|
+
super("The request took too long to respond.", {
|
958
|
+
details: "The request timed out.",
|
959
|
+
metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
|
960
|
+
});
|
957
961
|
__publicField(this, "name", "TimeoutError");
|
958
962
|
}
|
959
963
|
};
|
@@ -1143,7 +1147,7 @@ function sliceHex(value_, start, end) {
|
|
1143
1147
|
return `0x${value}`;
|
1144
1148
|
}
|
1145
1149
|
|
1146
|
-
// src/utils/encoding/
|
1150
|
+
// src/utils/encoding/toHex.ts
|
1147
1151
|
var hexes = Array.from(
|
1148
1152
|
{ length: 256 },
|
1149
1153
|
(v, i) => i.toString(16).padStart(2, "0")
|
@@ -1158,7 +1162,7 @@ function bytesToHex(value) {
|
|
1158
1162
|
}
|
1159
1163
|
return `0x${hex}`;
|
1160
1164
|
}
|
1161
|
-
function
|
1165
|
+
function toHex(value) {
|
1162
1166
|
if (typeof value === "number" || typeof value === "bigint")
|
1163
1167
|
return numberToHex(value);
|
1164
1168
|
if (typeof value === "string") {
|
@@ -1200,14 +1204,14 @@ function stringToHex(value) {
|
|
1200
1204
|
return `0x${hex}`;
|
1201
1205
|
}
|
1202
1206
|
|
1203
|
-
// src/utils/encoding/
|
1207
|
+
// src/utils/encoding/toBytes.ts
|
1204
1208
|
var encoder = new TextEncoder();
|
1205
1209
|
function boolToBytes(value) {
|
1206
1210
|
const bytes = new Uint8Array(1);
|
1207
1211
|
bytes[0] = Number(value);
|
1208
1212
|
return bytes;
|
1209
1213
|
}
|
1210
|
-
function
|
1214
|
+
function toBytes(value) {
|
1211
1215
|
if (typeof value === "number" || typeof value === "bigint")
|
1212
1216
|
return numberToBytes(value);
|
1213
1217
|
if (typeof value === "boolean")
|
@@ -1239,15 +1243,15 @@ function stringToBytes(value) {
|
|
1239
1243
|
return encoder.encode(value);
|
1240
1244
|
}
|
1241
1245
|
|
1242
|
-
// src/utils/encoding/
|
1243
|
-
function
|
1246
|
+
// src/utils/encoding/toRlp.ts
|
1247
|
+
function toRlp(hexOrBytes, to_) {
|
1244
1248
|
const to = to_ || "hex";
|
1245
1249
|
return format(bytesToRlp(parse(hexOrBytes)), to);
|
1246
1250
|
}
|
1247
1251
|
function parse(hexOrBytes) {
|
1248
1252
|
if (Array.isArray(hexOrBytes))
|
1249
1253
|
return hexOrBytes.map(parse);
|
1250
|
-
return typeof hexOrBytes === "string" ?
|
1254
|
+
return typeof hexOrBytes === "string" ? toBytes(hexOrBytes) : hexOrBytes;
|
1251
1255
|
}
|
1252
1256
|
function format(bytes, type = "bytes") {
|
1253
1257
|
return type === "hex" ? bytesToHex(bytes) : bytes;
|
@@ -1264,11 +1268,11 @@ function bytesToRlp(bytes) {
|
|
1264
1268
|
function encodeLength(length, offset) {
|
1265
1269
|
if (length < 56)
|
1266
1270
|
return [offset + length];
|
1267
|
-
return [
|
1271
|
+
return [toBytes(length).length + offset + 55, ...toBytes(length)];
|
1268
1272
|
}
|
1269
1273
|
|
1270
|
-
// src/utils/encoding/
|
1271
|
-
function
|
1274
|
+
// src/utils/encoding/fromHex.ts
|
1275
|
+
function fromHex(hex, to) {
|
1272
1276
|
if (to === "number")
|
1273
1277
|
return hexToNumber(hex);
|
1274
1278
|
if (to === "bigint")
|
@@ -1305,8 +1309,8 @@ function hexToString(hex) {
|
|
1305
1309
|
return new TextDecoder().decode(bytes);
|
1306
1310
|
}
|
1307
1311
|
|
1308
|
-
// src/utils/encoding/
|
1309
|
-
function
|
1312
|
+
// src/utils/encoding/fromBytes.ts
|
1313
|
+
function fromBytes(bytes, to) {
|
1310
1314
|
if (to === "number")
|
1311
1315
|
return bytesToNumber(bytes);
|
1312
1316
|
if (to === "bigint")
|
@@ -1334,8 +1338,8 @@ function bytesToString(bytes) {
|
|
1334
1338
|
return new TextDecoder().decode(bytes);
|
1335
1339
|
}
|
1336
1340
|
|
1337
|
-
// src/utils/encoding/
|
1338
|
-
function
|
1341
|
+
// src/utils/encoding/fromRlp.ts
|
1342
|
+
function fromRlp(value, to) {
|
1339
1343
|
const bytes = parse2(value);
|
1340
1344
|
const [data, consumed] = rlpToBytes(bytes);
|
1341
1345
|
if (consumed < bytes.length)
|
@@ -1479,11 +1483,11 @@ function keccak256(value, to_) {
|
|
1479
1483
|
const bytes = keccak_256(value);
|
1480
1484
|
if (to === "bytes")
|
1481
1485
|
return bytes;
|
1482
|
-
return
|
1486
|
+
return toHex(bytes);
|
1483
1487
|
}
|
1484
1488
|
|
1485
1489
|
// src/utils/hash/hashFunction.ts
|
1486
|
-
var hash = (value) => keccak256(
|
1490
|
+
var hash = (value) => keccak256(toBytes(value));
|
1487
1491
|
function hashFunction(def) {
|
1488
1492
|
const name = extractFunctionName(def);
|
1489
1493
|
const params = extractFunctionParams(def);
|
@@ -1521,36 +1525,32 @@ function getAddress(address) {
|
|
1521
1525
|
}
|
1522
1526
|
|
1523
1527
|
// src/utils/address/getContractAddress.ts
|
1524
|
-
function
|
1528
|
+
function getContractAddress2(opts) {
|
1525
1529
|
if (opts.opcode === "CREATE2")
|
1526
1530
|
return getCreate2Address(opts);
|
1527
1531
|
return getCreateAddress(opts);
|
1528
1532
|
}
|
1529
1533
|
function getCreateAddress(opts) {
|
1530
|
-
const from =
|
1531
|
-
let nonce =
|
1534
|
+
const from = toBytes(getAddress(opts.from));
|
1535
|
+
let nonce = toBytes(opts.nonce);
|
1532
1536
|
if (nonce[0] === 0)
|
1533
1537
|
nonce = new Uint8Array([]);
|
1534
1538
|
return getAddress(
|
1535
|
-
`0x${keccak256(
|
1539
|
+
`0x${keccak256(toRlp([from, nonce], "bytes")).slice(26)}`
|
1536
1540
|
);
|
1537
1541
|
}
|
1538
1542
|
function getCreate2Address(opts) {
|
1539
|
-
const from =
|
1540
|
-
const salt = pad(
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
const bytecodeHash = encodeBytes(
|
1543
|
+
const from = toBytes(getAddress(opts.from));
|
1544
|
+
const salt = pad(isBytes(opts.salt) ? opts.salt : toBytes(opts.salt), {
|
1545
|
+
size: 32
|
1546
|
+
});
|
1547
|
+
const bytecodeHash = toBytes(
|
1545
1548
|
keccak256(
|
1546
|
-
isBytes(opts.bytecode) ? opts.bytecode :
|
1549
|
+
isBytes(opts.bytecode) ? opts.bytecode : toBytes(opts.bytecode)
|
1547
1550
|
)
|
1548
1551
|
);
|
1549
1552
|
return getAddress(
|
1550
|
-
slice(
|
1551
|
-
keccak256(concat([encodeBytes("0xff"), from, salt, bytecodeHash])),
|
1552
|
-
12
|
1553
|
-
)
|
1553
|
+
slice(keccak256(concat([toBytes("0xff"), from, salt, bytecodeHash])), 12)
|
1554
1554
|
);
|
1555
1555
|
}
|
1556
1556
|
|
@@ -1619,7 +1619,7 @@ function prepareParam({
|
|
1619
1619
|
return encodeNumber(value, { signed });
|
1620
1620
|
}
|
1621
1621
|
if (param.type.startsWith("bytes")) {
|
1622
|
-
return
|
1622
|
+
return toBytes2(value, { param });
|
1623
1623
|
}
|
1624
1624
|
if (param.type === "string") {
|
1625
1625
|
return encodeString(value);
|
@@ -1693,7 +1693,7 @@ function encodeArray(value, {
|
|
1693
1693
|
encoded: concat(preparedParams.map(({ encoded }) => encoded))
|
1694
1694
|
};
|
1695
1695
|
}
|
1696
|
-
function
|
1696
|
+
function toBytes2(value, { param }) {
|
1697
1697
|
const [_, size_] = param.type.split("bytes");
|
1698
1698
|
if (!size_) {
|
1699
1699
|
const partsLength = Math.floor(size(value) / 32);
|
@@ -1807,7 +1807,7 @@ function decodeParam({
|
|
1807
1807
|
return decodeString(data, { position });
|
1808
1808
|
}
|
1809
1809
|
if (param.type.startsWith("bytes")) {
|
1810
|
-
return
|
1810
|
+
return fromBytes2(data, { param, position });
|
1811
1811
|
}
|
1812
1812
|
let value = slice(data, position, position + 32);
|
1813
1813
|
if (param.type.startsWith("uint") || param.type.startsWith("int")) {
|
@@ -1880,7 +1880,7 @@ function decodeArray(data, {
|
|
1880
1880
|
function decodeBool(value) {
|
1881
1881
|
return { consumed: 32, value: hexToBool(value) };
|
1882
1882
|
}
|
1883
|
-
function
|
1883
|
+
function fromBytes2(data, { param, position }) {
|
1884
1884
|
const [_, size2] = param.type.split("bytes");
|
1885
1885
|
if (!size2) {
|
1886
1886
|
const offset = hexToNumber(slice(data, position, position + 32));
|
@@ -2236,7 +2236,7 @@ function encodeArg({
|
|
2236
2236
|
value
|
2237
2237
|
}) {
|
2238
2238
|
if (param.type === "string" || param.type === "bytes")
|
2239
|
-
return keccak256(
|
2239
|
+
return keccak256(toBytes(value));
|
2240
2240
|
if (param.type === "tuple" || param.type.match(/^(.*)\[(\d+)?\]$/))
|
2241
2241
|
throw new FilterTypeNotSupportedError(param.type);
|
2242
2242
|
return encodeAbi({ params: [param], values: [value] });
|
@@ -2300,42 +2300,175 @@ function formatAbiItemWithArgs({
|
|
2300
2300
|
).join(", ")})`;
|
2301
2301
|
}
|
2302
2302
|
|
2303
|
+
// src/utils/promise/withCache.ts
|
2304
|
+
var promiseCache = /* @__PURE__ */ new Map();
|
2305
|
+
var responseCache = /* @__PURE__ */ new Map();
|
2306
|
+
function getCache(cacheKey) {
|
2307
|
+
const buildCache = (cacheKey2, cache) => ({
|
2308
|
+
clear: () => cache.delete(cacheKey2),
|
2309
|
+
get: () => cache.get(cacheKey2),
|
2310
|
+
set: (data) => cache.set(cacheKey2, data)
|
2311
|
+
});
|
2312
|
+
const promise = buildCache(cacheKey, promiseCache);
|
2313
|
+
const response = buildCache(
|
2314
|
+
cacheKey,
|
2315
|
+
responseCache
|
2316
|
+
);
|
2317
|
+
return {
|
2318
|
+
clear: () => {
|
2319
|
+
promise.clear();
|
2320
|
+
response.clear();
|
2321
|
+
},
|
2322
|
+
promise,
|
2323
|
+
response
|
2324
|
+
};
|
2325
|
+
}
|
2326
|
+
async function withCache(fn, { cacheKey, maxAge = Infinity }) {
|
2327
|
+
const cache = getCache(cacheKey);
|
2328
|
+
const response = cache.response.get();
|
2329
|
+
if (response && maxAge > 0) {
|
2330
|
+
const age = (/* @__PURE__ */ new Date()).getTime() - response.created.getTime();
|
2331
|
+
if (age < maxAge)
|
2332
|
+
return response.data;
|
2333
|
+
}
|
2334
|
+
let promise = cache.promise.get();
|
2335
|
+
if (!promise) {
|
2336
|
+
promise = fn();
|
2337
|
+
cache.promise.set(promise);
|
2338
|
+
}
|
2339
|
+
const data = await promise;
|
2340
|
+
cache.promise.clear();
|
2341
|
+
cache.response.set({ created: /* @__PURE__ */ new Date(), data });
|
2342
|
+
return data;
|
2343
|
+
}
|
2344
|
+
|
2345
|
+
// src/utils/wait.ts
|
2346
|
+
async function wait(time) {
|
2347
|
+
return new Promise((res) => setTimeout(res, time));
|
2348
|
+
}
|
2349
|
+
|
2350
|
+
// src/utils/promise/withRetry.ts
|
2351
|
+
function withRetry(fn, {
|
2352
|
+
delay: delay_ = 100,
|
2353
|
+
retryCount = 2,
|
2354
|
+
shouldRetry = () => true
|
2355
|
+
} = {}) {
|
2356
|
+
return new Promise((resolve, reject) => {
|
2357
|
+
const attemptRetry = async ({ count = 0 } = {}) => {
|
2358
|
+
const retry = async ({ error }) => {
|
2359
|
+
const delay = typeof delay_ === "function" ? delay_({ count, error }) : delay_;
|
2360
|
+
if (delay)
|
2361
|
+
await wait(delay);
|
2362
|
+
attemptRetry({ count: count + 1 });
|
2363
|
+
};
|
2364
|
+
try {
|
2365
|
+
const data = await fn();
|
2366
|
+
resolve(data);
|
2367
|
+
} catch (err) {
|
2368
|
+
if (count < retryCount && await shouldRetry({ count, error: err }))
|
2369
|
+
return retry({ error: err });
|
2370
|
+
reject(err);
|
2371
|
+
}
|
2372
|
+
};
|
2373
|
+
attemptRetry();
|
2374
|
+
});
|
2375
|
+
}
|
2376
|
+
|
2377
|
+
// src/utils/promise/withTimeout.ts
|
2378
|
+
function withTimeout(fn, {
|
2379
|
+
errorInstance,
|
2380
|
+
timeout,
|
2381
|
+
signal
|
2382
|
+
}) {
|
2383
|
+
return new Promise((resolve, reject) => {
|
2384
|
+
;
|
2385
|
+
(async () => {
|
2386
|
+
let timeoutId;
|
2387
|
+
try {
|
2388
|
+
const controller = new AbortController();
|
2389
|
+
if (timeout > 0) {
|
2390
|
+
timeoutId = setTimeout(() => {
|
2391
|
+
if (signal) {
|
2392
|
+
controller.abort();
|
2393
|
+
} else {
|
2394
|
+
reject(errorInstance);
|
2395
|
+
}
|
2396
|
+
}, timeout);
|
2397
|
+
}
|
2398
|
+
resolve(await fn({ signal: controller?.signal }));
|
2399
|
+
} catch (err) {
|
2400
|
+
if (err.name === "AbortError")
|
2401
|
+
reject(errorInstance);
|
2402
|
+
reject(err);
|
2403
|
+
} finally {
|
2404
|
+
clearTimeout(timeoutId);
|
2405
|
+
}
|
2406
|
+
})();
|
2407
|
+
});
|
2408
|
+
}
|
2409
|
+
|
2303
2410
|
// src/utils/buildRequest.ts
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2411
|
+
var isDeterministicError = (error) => {
|
2412
|
+
if (error instanceof UnknownRpcError)
|
2413
|
+
return false;
|
2414
|
+
if ("code" in error)
|
2415
|
+
return error.code !== -32603 && error.code !== -32005;
|
2416
|
+
if (error instanceof HttpRequestError && error.status)
|
2417
|
+
return error.status !== 408 && error.status !== 413 && error.status !== 429 && error.status !== 500;
|
2418
|
+
return true;
|
2419
|
+
};
|
2420
|
+
function buildRequest(request, {
|
2421
|
+
retryDelay = 150,
|
2422
|
+
retryCount = 3
|
2423
|
+
} = {}) {
|
2424
|
+
return async (args) => withRetry(
|
2425
|
+
async () => {
|
2426
|
+
try {
|
2427
|
+
return await request(args);
|
2428
|
+
} catch (err_) {
|
2429
|
+
let err = err_;
|
2430
|
+
if (err.code === -32700)
|
2431
|
+
throw new ParseRpcError(err);
|
2432
|
+
if (err.code === -32600)
|
2433
|
+
throw new InvalidRequestRpcError(err);
|
2434
|
+
if (err.code === -32601)
|
2435
|
+
throw new MethodNotFoundRpcError(err);
|
2436
|
+
if (err.code === -32602)
|
2437
|
+
throw new InvalidParamsRpcError(err);
|
2438
|
+
if (err.code === -32603)
|
2439
|
+
throw new InternalRpcError(err);
|
2440
|
+
if (err.code === -32e3)
|
2441
|
+
throw new InvalidInputRpcError(err);
|
2442
|
+
if (err.code === -32001)
|
2443
|
+
throw new ResourceNotFoundRpcError(err);
|
2444
|
+
if (err.code === -32002)
|
2445
|
+
throw new ResourceUnavailableRpcError(err);
|
2446
|
+
if (err.code === -32003)
|
2447
|
+
throw new TransactionRejectedRpcError(err);
|
2448
|
+
if (err.code === -32004)
|
2449
|
+
throw new MethodNotSupportedRpcError(err);
|
2450
|
+
if (err.code === -32005)
|
2451
|
+
throw new LimitExceededRpcError(err);
|
2452
|
+
if (err.code === -32006)
|
2453
|
+
throw new JsonRpcVersionUnsupportedError(err);
|
2454
|
+
if (err_ instanceof BaseError)
|
2455
|
+
throw err_;
|
2456
|
+
throw new UnknownRpcError(err);
|
2457
|
+
}
|
2458
|
+
},
|
2459
|
+
{
|
2460
|
+
delay: ({ count, error }) => {
|
2461
|
+
if (error && error instanceof HttpRequestError) {
|
2462
|
+
const retryAfter = error?.headers?.get("Retry-After");
|
2463
|
+
if (retryAfter?.match(/\d/))
|
2464
|
+
return parseInt(retryAfter) * 1e3;
|
2465
|
+
}
|
2466
|
+
return ~~(1 << count) * retryDelay;
|
2467
|
+
},
|
2468
|
+
retryCount,
|
2469
|
+
shouldRetry: ({ error }) => !isDeterministicError(error)
|
2337
2470
|
}
|
2338
|
-
|
2471
|
+
);
|
2339
2472
|
}
|
2340
2473
|
|
2341
2474
|
// src/utils/chain.ts
|
@@ -2497,119 +2630,8 @@ var defineTransactionRequest = defineFormatter({
|
|
2497
2630
|
});
|
2498
2631
|
|
2499
2632
|
// src/utils/rpc.ts
|
2500
|
-
import fetch from "isomorphic-unfetch";
|
2501
2633
|
import WebSocket from "isomorphic-ws";
|
2502
2634
|
|
2503
|
-
// src/utils/promise/withCache.ts
|
2504
|
-
var promiseCache = /* @__PURE__ */ new Map();
|
2505
|
-
var responseCache = /* @__PURE__ */ new Map();
|
2506
|
-
function getCache(cacheKey) {
|
2507
|
-
const buildCache = (cacheKey2, cache) => ({
|
2508
|
-
clear: () => cache.delete(cacheKey2),
|
2509
|
-
get: () => cache.get(cacheKey2),
|
2510
|
-
set: (data) => cache.set(cacheKey2, data)
|
2511
|
-
});
|
2512
|
-
const promise = buildCache(cacheKey, promiseCache);
|
2513
|
-
const response = buildCache(
|
2514
|
-
cacheKey,
|
2515
|
-
responseCache
|
2516
|
-
);
|
2517
|
-
return {
|
2518
|
-
clear: () => {
|
2519
|
-
promise.clear();
|
2520
|
-
response.clear();
|
2521
|
-
},
|
2522
|
-
promise,
|
2523
|
-
response
|
2524
|
-
};
|
2525
|
-
}
|
2526
|
-
async function withCache(fn, { cacheKey, maxAge = Infinity }) {
|
2527
|
-
const cache = getCache(cacheKey);
|
2528
|
-
const response = cache.response.get();
|
2529
|
-
if (response && maxAge > 0) {
|
2530
|
-
const age = (/* @__PURE__ */ new Date()).getTime() - response.created.getTime();
|
2531
|
-
if (age < maxAge)
|
2532
|
-
return response.data;
|
2533
|
-
}
|
2534
|
-
let promise = cache.promise.get();
|
2535
|
-
if (!promise) {
|
2536
|
-
promise = fn();
|
2537
|
-
cache.promise.set(promise);
|
2538
|
-
}
|
2539
|
-
const data = await promise;
|
2540
|
-
cache.promise.clear();
|
2541
|
-
cache.response.set({ created: /* @__PURE__ */ new Date(), data });
|
2542
|
-
return data;
|
2543
|
-
}
|
2544
|
-
|
2545
|
-
// src/utils/wait.ts
|
2546
|
-
async function wait(time) {
|
2547
|
-
return new Promise((res) => setTimeout(res, time));
|
2548
|
-
}
|
2549
|
-
|
2550
|
-
// src/utils/promise/withRetry.ts
|
2551
|
-
function withRetry(fn, {
|
2552
|
-
delay: delay_ = 100,
|
2553
|
-
retryCount = 2,
|
2554
|
-
shouldRetryOnResponse = () => false,
|
2555
|
-
shouldRetryOnError = () => false
|
2556
|
-
} = {}) {
|
2557
|
-
return new Promise((resolve, reject) => {
|
2558
|
-
const attemptRetry = async ({ count = 0 } = {}) => {
|
2559
|
-
const retry = async ({ data } = {}) => {
|
2560
|
-
const delay = typeof delay_ === "function" ? delay_({ count, data }) : delay_;
|
2561
|
-
if (delay)
|
2562
|
-
await wait(delay);
|
2563
|
-
attemptRetry({ count: count + 1 });
|
2564
|
-
};
|
2565
|
-
try {
|
2566
|
-
const data = await fn();
|
2567
|
-
if (count < retryCount && await shouldRetryOnResponse({ count, data }))
|
2568
|
-
return retry({ data });
|
2569
|
-
resolve(data);
|
2570
|
-
} catch (err) {
|
2571
|
-
if (count < retryCount && await shouldRetryOnError({ count, error: err }))
|
2572
|
-
return retry();
|
2573
|
-
reject(err);
|
2574
|
-
}
|
2575
|
-
};
|
2576
|
-
attemptRetry();
|
2577
|
-
});
|
2578
|
-
}
|
2579
|
-
|
2580
|
-
// src/utils/promise/withTimeout.ts
|
2581
|
-
function withTimeout(fn, {
|
2582
|
-
errorInstance,
|
2583
|
-
timeout,
|
2584
|
-
signal
|
2585
|
-
}) {
|
2586
|
-
return new Promise((resolve, reject) => {
|
2587
|
-
;
|
2588
|
-
(async () => {
|
2589
|
-
let timeoutId;
|
2590
|
-
try {
|
2591
|
-
const controller = new AbortController();
|
2592
|
-
if (timeout > 0) {
|
2593
|
-
timeoutId = setTimeout(() => {
|
2594
|
-
if (signal) {
|
2595
|
-
controller.abort();
|
2596
|
-
} else {
|
2597
|
-
reject(errorInstance);
|
2598
|
-
}
|
2599
|
-
}, timeout);
|
2600
|
-
}
|
2601
|
-
resolve(await fn({ signal: controller?.signal }));
|
2602
|
-
} catch (err) {
|
2603
|
-
if (err.name === "AbortError")
|
2604
|
-
reject(errorInstance);
|
2605
|
-
reject(err);
|
2606
|
-
} finally {
|
2607
|
-
clearTimeout(timeoutId);
|
2608
|
-
}
|
2609
|
-
})();
|
2610
|
-
});
|
2611
|
-
}
|
2612
|
-
|
2613
2635
|
// src/utils/stringify.ts
|
2614
2636
|
function stringify(value) {
|
2615
2637
|
return JSON.stringify(
|
@@ -2622,12 +2644,10 @@ function stringify(value) {
|
|
2622
2644
|
var id = 0;
|
2623
2645
|
async function http(url, {
|
2624
2646
|
body,
|
2625
|
-
retryDelay = 100,
|
2626
|
-
retryCount = 2,
|
2627
2647
|
timeout = 0
|
2628
2648
|
}) {
|
2629
|
-
|
2630
|
-
|
2649
|
+
try {
|
2650
|
+
const response = await withTimeout(
|
2631
2651
|
async ({ signal }) => {
|
2632
2652
|
const response2 = await fetch(url, {
|
2633
2653
|
headers: {
|
@@ -2644,42 +2664,39 @@ async function http(url, {
|
|
2644
2664
|
timeout,
|
2645
2665
|
signal: true
|
2646
2666
|
}
|
2647
|
-
)
|
2648
|
-
|
2649
|
-
|
2650
|
-
|
2651
|
-
|
2652
|
-
|
2653
|
-
return ~~((Math.random() + 0.5) * (1 << count)) * retryDelay;
|
2654
|
-
},
|
2655
|
-
retryCount,
|
2656
|
-
shouldRetryOnResponse: async ({ data: data2 }) => {
|
2657
|
-
if (data2.status >= 500)
|
2658
|
-
return true;
|
2659
|
-
if ([408, 413, 429].includes(data2.status))
|
2660
|
-
return true;
|
2661
|
-
return false;
|
2662
|
-
}
|
2667
|
+
);
|
2668
|
+
let data;
|
2669
|
+
if (response.headers.get("Content-Type")?.startsWith("application/json")) {
|
2670
|
+
data = await response.json();
|
2671
|
+
} else {
|
2672
|
+
data = await response.text();
|
2663
2673
|
}
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2674
|
+
if (!response.ok) {
|
2675
|
+
throw new HttpRequestError({
|
2676
|
+
body,
|
2677
|
+
details: stringify(data.error) || response.statusText,
|
2678
|
+
headers: response.headers,
|
2679
|
+
status: response.status,
|
2680
|
+
url
|
2681
|
+
});
|
2682
|
+
}
|
2683
|
+
if (data.error) {
|
2684
|
+
throw new RpcError({ body, error: data.error, url });
|
2685
|
+
}
|
2686
|
+
return data;
|
2687
|
+
} catch (err) {
|
2688
|
+
if (err instanceof HttpRequestError)
|
2689
|
+
throw err;
|
2690
|
+
if (err instanceof RpcError)
|
2691
|
+
throw err;
|
2692
|
+
if (err instanceof TimeoutError)
|
2693
|
+
throw err;
|
2672
2694
|
throw new HttpRequestError({
|
2673
2695
|
body,
|
2674
|
-
details:
|
2675
|
-
status: response.status,
|
2696
|
+
details: err.message,
|
2676
2697
|
url
|
2677
2698
|
});
|
2678
2699
|
}
|
2679
|
-
if (data.error) {
|
2680
|
-
throw new RpcError({ body, error: data.error, url });
|
2681
|
-
}
|
2682
|
-
return data;
|
2683
2700
|
}
|
2684
2701
|
var sockets = /* @__PURE__ */ new Map();
|
2685
2702
|
async function getSocket(url_) {
|
@@ -2875,6 +2892,42 @@ export {
|
|
2875
2892
|
ChainDoesNotSupportContract,
|
2876
2893
|
multicall3Abi,
|
2877
2894
|
panicReasons,
|
2895
|
+
ContractFunctionExecutionError,
|
2896
|
+
ContractFunctionRevertedError,
|
2897
|
+
ContractFunctionZeroDataError,
|
2898
|
+
RawContractError,
|
2899
|
+
SizeExceedsPaddingSizeError,
|
2900
|
+
DataLengthTooLongError,
|
2901
|
+
DataLengthTooShortError,
|
2902
|
+
InvalidBytesBooleanError,
|
2903
|
+
InvalidHexBooleanError,
|
2904
|
+
InvalidHexValueError,
|
2905
|
+
OffsetOutOfBoundsError,
|
2906
|
+
FilterTypeNotSupportedError,
|
2907
|
+
RequestError,
|
2908
|
+
RpcRequestError,
|
2909
|
+
ParseRpcError,
|
2910
|
+
InvalidRequestRpcError,
|
2911
|
+
MethodNotFoundRpcError,
|
2912
|
+
InvalidParamsRpcError,
|
2913
|
+
InternalRpcError,
|
2914
|
+
InvalidInputRpcError,
|
2915
|
+
ResourceNotFoundRpcError,
|
2916
|
+
ResourceUnavailableRpcError,
|
2917
|
+
TransactionRejectedRpcError,
|
2918
|
+
MethodNotSupportedRpcError,
|
2919
|
+
LimitExceededRpcError,
|
2920
|
+
JsonRpcVersionUnsupportedError,
|
2921
|
+
UnknownRpcError,
|
2922
|
+
HttpRequestError,
|
2923
|
+
WebSocketRequestError,
|
2924
|
+
RpcError,
|
2925
|
+
TimeoutError,
|
2926
|
+
InvalidGasArgumentsError,
|
2927
|
+
TransactionNotFoundError,
|
2928
|
+
TransactionReceiptNotFoundError,
|
2929
|
+
WaitForTransactionReceiptTimeoutError,
|
2930
|
+
UrlRequiredError,
|
2878
2931
|
concat,
|
2879
2932
|
isBytes,
|
2880
2933
|
isHex,
|
@@ -2888,26 +2941,26 @@ export {
|
|
2888
2941
|
sliceHex,
|
2889
2942
|
boolToHex,
|
2890
2943
|
bytesToHex,
|
2891
|
-
|
2944
|
+
toHex,
|
2892
2945
|
numberToHex,
|
2893
2946
|
stringToHex,
|
2894
2947
|
boolToBytes,
|
2895
|
-
|
2948
|
+
toBytes,
|
2896
2949
|
hexToBytes,
|
2897
2950
|
numberToBytes,
|
2898
2951
|
stringToBytes,
|
2899
|
-
|
2900
|
-
|
2952
|
+
toRlp,
|
2953
|
+
fromHex,
|
2901
2954
|
hexToBigInt,
|
2902
2955
|
hexToBool,
|
2903
2956
|
hexToNumber,
|
2904
2957
|
hexToString,
|
2905
|
-
|
2958
|
+
fromBytes,
|
2906
2959
|
bytesToBigint,
|
2907
2960
|
bytesToBool,
|
2908
2961
|
bytesToNumber,
|
2909
2962
|
bytesToString,
|
2910
|
-
|
2963
|
+
fromRlp,
|
2911
2964
|
extractFunctionParts,
|
2912
2965
|
extractFunctionName,
|
2913
2966
|
extractFunctionParams,
|
@@ -2918,7 +2971,7 @@ export {
|
|
2918
2971
|
getFunctionSignature,
|
2919
2972
|
checksumAddress,
|
2920
2973
|
getAddress,
|
2921
|
-
getContractAddress,
|
2974
|
+
getContractAddress2 as getContractAddress,
|
2922
2975
|
getCreateAddress,
|
2923
2976
|
getCreate2Address,
|
2924
2977
|
isAddress,
|
@@ -2937,6 +2990,10 @@ export {
|
|
2937
2990
|
encodeFunctionData,
|
2938
2991
|
encodeFunctionResult,
|
2939
2992
|
formatAbiItemWithArgs,
|
2993
|
+
getCache,
|
2994
|
+
withCache,
|
2995
|
+
wait,
|
2996
|
+
isDeterministicError,
|
2940
2997
|
buildRequest,
|
2941
2998
|
defineChain,
|
2942
2999
|
format3 as format,
|
@@ -2953,9 +3010,6 @@ export {
|
|
2953
3010
|
defineTransactionReceipt,
|
2954
3011
|
formatTransactionRequest,
|
2955
3012
|
defineTransactionRequest,
|
2956
|
-
getCache,
|
2957
|
-
withCache,
|
2958
|
-
wait,
|
2959
3013
|
stringify,
|
2960
3014
|
getSocket,
|
2961
3015
|
rpc,
|
@@ -2967,42 +3021,6 @@ export {
|
|
2967
3021
|
formatGwei,
|
2968
3022
|
parseUnit,
|
2969
3023
|
parseEther,
|
2970
|
-
parseGwei
|
2971
|
-
ContractFunctionExecutionError,
|
2972
|
-
ContractFunctionRevertedError,
|
2973
|
-
ContractFunctionZeroDataError,
|
2974
|
-
RawContractError,
|
2975
|
-
SizeExceedsPaddingSizeError,
|
2976
|
-
DataLengthTooLongError,
|
2977
|
-
DataLengthTooShortError,
|
2978
|
-
InvalidBytesBooleanError,
|
2979
|
-
InvalidHexBooleanError,
|
2980
|
-
InvalidHexValueError,
|
2981
|
-
OffsetOutOfBoundsError,
|
2982
|
-
FilterTypeNotSupportedError,
|
2983
|
-
RequestError,
|
2984
|
-
RpcRequestError,
|
2985
|
-
ParseRpcError,
|
2986
|
-
InvalidRequestRpcError,
|
2987
|
-
MethodNotFoundRpcError,
|
2988
|
-
InvalidParamsRpcError,
|
2989
|
-
InternalRpcError,
|
2990
|
-
InvalidInputRpcError,
|
2991
|
-
ResourceNotFoundRpcError,
|
2992
|
-
ResourceUnavailableRpcError,
|
2993
|
-
TransactionRejectedRpcError,
|
2994
|
-
MethodNotSupportedRpcError,
|
2995
|
-
LimitExceededRpcError,
|
2996
|
-
JsonRpcVersionUnsupportedError,
|
2997
|
-
UnknownRpcError,
|
2998
|
-
HttpRequestError,
|
2999
|
-
WebSocketRequestError,
|
3000
|
-
RpcError,
|
3001
|
-
TimeoutError,
|
3002
|
-
InvalidGasArgumentsError,
|
3003
|
-
TransactionNotFoundError,
|
3004
|
-
TransactionReceiptNotFoundError,
|
3005
|
-
WaitForTransactionReceiptTimeoutError,
|
3006
|
-
UrlRequiredError
|
3024
|
+
parseGwei
|
3007
3025
|
};
|
3008
|
-
//# sourceMappingURL=chunk-
|
3026
|
+
//# sourceMappingURL=chunk-AKGXRZDN.mjs.map
|