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
package/src/_test/bench.ts
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
import { providers } from 'ethers'
|
2
|
-
import { JsonRpcProvider } from 'ethers@6'
|
3
|
-
import Web3 from 'web3'
|
4
|
-
|
5
|
-
import { localhost } from '../chains'
|
6
|
-
|
7
|
-
export const ethersProvider = new providers.JsonRpcProvider(
|
8
|
-
localhost.rpcUrls.default.http[0],
|
9
|
-
)
|
10
|
-
|
11
|
-
export const ethersV6Provider = new JsonRpcProvider(
|
12
|
-
localhost.rpcUrls.default.http[0],
|
13
|
-
)
|
14
|
-
|
15
|
-
export const web3Provider = new Web3(localhost.rpcUrls.default.http[0])
|
package/src/_test/constants.ts
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
import type { Hex } from '../types'
|
2
|
-
|
3
|
-
export const accounts = [
|
4
|
-
{
|
5
|
-
address: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
|
6
|
-
balance: 10000000000000000000000n,
|
7
|
-
},
|
8
|
-
{
|
9
|
-
address: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
10
|
-
balance: 10000000000000000000000n,
|
11
|
-
},
|
12
|
-
{
|
13
|
-
address: '0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc',
|
14
|
-
balance: 10000000000000000000000n,
|
15
|
-
},
|
16
|
-
{
|
17
|
-
address: '0x90f79bf6eb2c4f870365e785982e1f101e93b906',
|
18
|
-
balance: 10000000000000000000000n,
|
19
|
-
},
|
20
|
-
{
|
21
|
-
address: '0x15d34aaf54267db7d7c367839aaf71a00a2c6a65',
|
22
|
-
balance: 10000000000000000000000n,
|
23
|
-
},
|
24
|
-
{
|
25
|
-
address: '0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc',
|
26
|
-
balance: 10000000000000000000000n,
|
27
|
-
},
|
28
|
-
{
|
29
|
-
address: '0x976ea74026e726554db657fa54763abd0c3a0aa9',
|
30
|
-
balance: 10000000000000000000000n,
|
31
|
-
},
|
32
|
-
{
|
33
|
-
address: '0x14dc79964da2c08b23698b3d3cc7ca32193d9955',
|
34
|
-
balance: 10000000000000000000000n,
|
35
|
-
},
|
36
|
-
{
|
37
|
-
address: '0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f',
|
38
|
-
balance: 10000000000000000000000n,
|
39
|
-
},
|
40
|
-
{
|
41
|
-
address: '0xa0ee7a142d267c1f36714e4a8f75612f20a79720',
|
42
|
-
balance: 10000000000000000000000n,
|
43
|
-
},
|
44
|
-
] as const
|
45
|
-
|
46
|
-
export const address = {
|
47
|
-
vitalik: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045',
|
48
|
-
} as const
|
49
|
-
|
50
|
-
export const initialBlockNumber = BigInt(
|
51
|
-
Number(process.env.VITE_ANVIL_BLOCK_NUMBER),
|
52
|
-
)
|
53
|
-
|
54
|
-
export const localHttpUrl = 'http://127.0.0.1:8545'
|
55
|
-
export const localWsUrl = 'ws://127.0.0.1:8545'
|
56
|
-
|
57
|
-
// ERC20 `transferFrom` method
|
58
|
-
export const transfer1Data = (address: string): Hex =>
|
59
|
-
`0xa9059cbb000000000000000000000000${address
|
60
|
-
.slice(2)
|
61
|
-
.toLowerCase()}0000000000000000000000000000000000000000000000000000000000000001`
|
package/src/_test/globalSetup.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import { testClient } from './utils'
|
2
|
-
import { reset, setAutomine, setIntervalMining } from '../actions'
|
3
|
-
|
4
|
-
export async function setup() {
|
5
|
-
await reset(testClient, {
|
6
|
-
blockNumber: BigInt(parseInt(process.env.VITE_ANVIL_BLOCK_NUMBER!)),
|
7
|
-
jsonRpcUrl: process.env.VITE_ANVIL_FORK_URL,
|
8
|
-
})
|
9
|
-
await setAutomine(testClient, false)
|
10
|
-
await setIntervalMining(testClient, { interval: 1 })
|
11
|
-
}
|
package/src/_test/index.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
export {
|
2
|
-
wagmiContractConfig,
|
3
|
-
uniswapV3PositionsContractConfig,
|
4
|
-
usdcContractConfig,
|
5
|
-
} from './abis'
|
6
|
-
|
7
|
-
export { ethersProvider, ethersV6Provider, web3Provider } from './bench'
|
8
|
-
|
9
|
-
export {
|
10
|
-
accounts,
|
11
|
-
address,
|
12
|
-
initialBlockNumber,
|
13
|
-
localHttpUrl,
|
14
|
-
localWsUrl,
|
15
|
-
transfer1Data,
|
16
|
-
} from './constants'
|
17
|
-
|
18
|
-
export {
|
19
|
-
createHttpServer,
|
20
|
-
deploy,
|
21
|
-
deployBAYC,
|
22
|
-
publicClient,
|
23
|
-
testClient,
|
24
|
-
walletClient,
|
25
|
-
} from './utils'
|
package/src/_test/setup.ts
DELETED
package/src/_test/utils.ts
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
/* c8 ignore start */
|
2
|
-
import { Abi } from 'abitype'
|
3
|
-
import errorsExample from '../../contracts/out/ErrorsExample.sol/ErrorsExample.json'
|
4
|
-
import {
|
5
|
-
deployContract,
|
6
|
-
DeployContractArgs,
|
7
|
-
getTransactionReceipt,
|
8
|
-
mine,
|
9
|
-
} from '../actions'
|
10
|
-
import { Chain, localhost } from '../chains'
|
11
|
-
import {
|
12
|
-
createPublicClient,
|
13
|
-
createTestClient,
|
14
|
-
createWalletClient,
|
15
|
-
custom,
|
16
|
-
http,
|
17
|
-
webSocket,
|
18
|
-
} from '../clients'
|
19
|
-
import { rpc } from '../utils'
|
20
|
-
import { RpcError } from '../types/eip1193'
|
21
|
-
import { accounts, localWsUrl } from './constants'
|
22
|
-
import { errorsExampleABI } from './generated'
|
23
|
-
|
24
|
-
import type { RequestListener } from 'http'
|
25
|
-
import { createServer } from 'http'
|
26
|
-
import type { AddressInfo } from 'net'
|
27
|
-
import { baycContractConfig } from './abis'
|
28
|
-
import { Hex } from '../types'
|
29
|
-
|
30
|
-
export const publicClient =
|
31
|
-
process.env.VITE_NETWORK_TRANSPORT_MODE === 'webSocket'
|
32
|
-
? createPublicClient({
|
33
|
-
chain: localhost,
|
34
|
-
pollingInterval: 1_000,
|
35
|
-
transport: webSocket(localWsUrl),
|
36
|
-
})
|
37
|
-
: createPublicClient({
|
38
|
-
chain: localhost,
|
39
|
-
pollingInterval: 1_000,
|
40
|
-
transport: http(),
|
41
|
-
})
|
42
|
-
|
43
|
-
export const walletClient = createWalletClient({
|
44
|
-
transport: custom({
|
45
|
-
on: (message: string, listener: (...args: any[]) => null) => {
|
46
|
-
if (message === 'accountsChanged') {
|
47
|
-
listener([accounts[0].address] as any)
|
48
|
-
}
|
49
|
-
},
|
50
|
-
removeListener: () => null,
|
51
|
-
request: async ({ method, params }: any) => {
|
52
|
-
if (method === 'eth_requestAccounts') {
|
53
|
-
return [accounts[0].address]
|
54
|
-
}
|
55
|
-
if (method === 'personal_sign') {
|
56
|
-
method = 'eth_sign'
|
57
|
-
params = [params[1], params[0]]
|
58
|
-
}
|
59
|
-
if (method === 'wallet_watchAsset') {
|
60
|
-
if (params[0].type === 'ERC721') {
|
61
|
-
throw new RpcError(-32602, 'Token type ERC721 not supported.')
|
62
|
-
}
|
63
|
-
return true
|
64
|
-
}
|
65
|
-
if (method === 'wallet_addEthereumChain') return null
|
66
|
-
if (method === 'wallet_switchEthereumChain') {
|
67
|
-
if (params[0].chainId === '0xfa') {
|
68
|
-
throw new RpcError(-4902, 'Unrecognized chain.')
|
69
|
-
}
|
70
|
-
return null
|
71
|
-
}
|
72
|
-
if (
|
73
|
-
method === 'wallet_getPermissions' ||
|
74
|
-
method === 'wallet_requestPermissions'
|
75
|
-
)
|
76
|
-
return [
|
77
|
-
{
|
78
|
-
invoker: 'https://example.com',
|
79
|
-
parentCapability: 'eth_accounts',
|
80
|
-
caveats: [
|
81
|
-
{
|
82
|
-
type: 'filterResponse',
|
83
|
-
value: ['0x0c54fccd2e384b4bb6f2e405bf5cbc15a017aafb'],
|
84
|
-
},
|
85
|
-
],
|
86
|
-
},
|
87
|
-
]
|
88
|
-
|
89
|
-
const { result } = await rpc.http(localhost.rpcUrls.default.http[0], {
|
90
|
-
body: {
|
91
|
-
method,
|
92
|
-
params,
|
93
|
-
},
|
94
|
-
})
|
95
|
-
return result
|
96
|
-
},
|
97
|
-
}),
|
98
|
-
})
|
99
|
-
|
100
|
-
export const testClient = createTestClient({
|
101
|
-
chain: localhost,
|
102
|
-
mode: 'anvil',
|
103
|
-
transport: http(),
|
104
|
-
})
|
105
|
-
|
106
|
-
export function createHttpServer(
|
107
|
-
handler: RequestListener,
|
108
|
-
): Promise<{ close: () => Promise<unknown>; url: string }> {
|
109
|
-
const server = createServer(handler)
|
110
|
-
|
111
|
-
const closeAsync = () =>
|
112
|
-
new Promise((resolve, reject) =>
|
113
|
-
server.close((err) => (err ? reject(err) : resolve(undefined))),
|
114
|
-
)
|
115
|
-
|
116
|
-
return new Promise((resolve) => {
|
117
|
-
server.listen(() => {
|
118
|
-
const { port } = server.address() as AddressInfo
|
119
|
-
resolve({ close: closeAsync, url: `http://localhost:${port}` })
|
120
|
-
})
|
121
|
-
})
|
122
|
-
}
|
123
|
-
|
124
|
-
export async function deploy<TAbi extends Abi = Abi>(
|
125
|
-
args: DeployContractArgs<Chain, TAbi>,
|
126
|
-
) {
|
127
|
-
const hash = await deployContract(walletClient, args)
|
128
|
-
await mine(testClient, { blocks: 1 })
|
129
|
-
const { contractAddress } = await getTransactionReceipt(publicClient, {
|
130
|
-
hash,
|
131
|
-
})
|
132
|
-
return { contractAddress }
|
133
|
-
}
|
134
|
-
|
135
|
-
export async function deployBAYC() {
|
136
|
-
return deploy({
|
137
|
-
...baycContractConfig,
|
138
|
-
args: ['Bored Ape Wagmi Club', 'BAYC', 69420n, 0n],
|
139
|
-
from: accounts[0].address,
|
140
|
-
})
|
141
|
-
}
|
142
|
-
|
143
|
-
export async function deployErrorExample() {
|
144
|
-
return deploy({
|
145
|
-
abi: errorsExampleABI,
|
146
|
-
bytecode: errorsExample.bytecode.object as Hex,
|
147
|
-
from: accounts[0].address,
|
148
|
-
})
|
149
|
-
}
|
150
|
-
/* c8 ignore stop */
|
@@ -1,81 +0,0 @@
|
|
1
|
-
import { expect, test } from 'vitest'
|
2
|
-
|
3
|
-
import * as actions from './index'
|
4
|
-
|
5
|
-
test('exports actions', () => {
|
6
|
-
expect(actions).toMatchInlineSnapshot(`
|
7
|
-
{
|
8
|
-
"addChain": [Function],
|
9
|
-
"call": [Function],
|
10
|
-
"createBlockFilter": [Function],
|
11
|
-
"createContractEventFilter": [Function],
|
12
|
-
"createEventFilter": [Function],
|
13
|
-
"createPendingTransactionFilter": [Function],
|
14
|
-
"deployContract": [Function],
|
15
|
-
"dropTransaction": [Function],
|
16
|
-
"estimateGas": [Function],
|
17
|
-
"getAccounts": [Function],
|
18
|
-
"getAutomine": [Function],
|
19
|
-
"getBalance": [Function],
|
20
|
-
"getBlock": [Function],
|
21
|
-
"getBlockNumber": [Function],
|
22
|
-
"getBlockNumberCache": [Function],
|
23
|
-
"getBlockTransactionCount": [Function],
|
24
|
-
"getBytecode": [Function],
|
25
|
-
"getChainId": [Function],
|
26
|
-
"getFeeHistory": [Function],
|
27
|
-
"getFilterChanges": [Function],
|
28
|
-
"getFilterLogs": [Function],
|
29
|
-
"getGasPrice": [Function],
|
30
|
-
"getLogs": [Function],
|
31
|
-
"getPermissions": [Function],
|
32
|
-
"getStorageAt": [Function],
|
33
|
-
"getTransaction": [Function],
|
34
|
-
"getTransactionConfirmations": [Function],
|
35
|
-
"getTransactionCount": [Function],
|
36
|
-
"getTransactionReceipt": [Function],
|
37
|
-
"getTxpoolContent": [Function],
|
38
|
-
"getTxpoolStatus": [Function],
|
39
|
-
"impersonateAccount": [Function],
|
40
|
-
"increaseTime": [Function],
|
41
|
-
"inspectTxpool": [Function],
|
42
|
-
"mine": [Function],
|
43
|
-
"multicall": [Function],
|
44
|
-
"readContract": [Function],
|
45
|
-
"removeBlockTimestampInterval": [Function],
|
46
|
-
"requestAccounts": [Function],
|
47
|
-
"requestPermissions": [Function],
|
48
|
-
"reset": [Function],
|
49
|
-
"revert": [Function],
|
50
|
-
"sendTransaction": [Function],
|
51
|
-
"sendUnsignedTransaction": [Function],
|
52
|
-
"setAutomine": [Function],
|
53
|
-
"setBalance": [Function],
|
54
|
-
"setBlockGasLimit": [Function],
|
55
|
-
"setBlockTimestampInterval": [Function],
|
56
|
-
"setCode": [Function],
|
57
|
-
"setCoinbase": [Function],
|
58
|
-
"setIntervalMining": [Function],
|
59
|
-
"setLoggingEnabled": [Function],
|
60
|
-
"setMinGasPrice": [Function],
|
61
|
-
"setNextBlockBaseFeePerGas": [Function],
|
62
|
-
"setNextBlockTimestamp": [Function],
|
63
|
-
"setNonce": [Function],
|
64
|
-
"setStorageAt": [Function],
|
65
|
-
"signMessage": [Function],
|
66
|
-
"simulateContract": [Function],
|
67
|
-
"snapshot": [Function],
|
68
|
-
"stopImpersonatingAccount": [Function],
|
69
|
-
"switchChain": [Function],
|
70
|
-
"uninstallFilter": [Function],
|
71
|
-
"waitForTransactionReceipt": [Function],
|
72
|
-
"watchAsset": [Function],
|
73
|
-
"watchBlockNumber": [Function],
|
74
|
-
"watchBlocks": [Function],
|
75
|
-
"watchContractEvent": [Function],
|
76
|
-
"watchEvent": [Function],
|
77
|
-
"watchPendingTransactions": [Function],
|
78
|
-
"writeContract": [Function],
|
79
|
-
}
|
80
|
-
`)
|
81
|
-
})
|
package/src/actions/index.ts
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
export {
|
2
|
-
call,
|
3
|
-
createBlockFilter,
|
4
|
-
createContractEventFilter,
|
5
|
-
createEventFilter,
|
6
|
-
createPendingTransactionFilter,
|
7
|
-
deployContract,
|
8
|
-
estimateGas,
|
9
|
-
getBalance,
|
10
|
-
getBlock,
|
11
|
-
getBlockNumber,
|
12
|
-
getBlockNumberCache,
|
13
|
-
getBlockTransactionCount,
|
14
|
-
getBytecode,
|
15
|
-
getChainId,
|
16
|
-
getFeeHistory,
|
17
|
-
getFilterChanges,
|
18
|
-
getFilterLogs,
|
19
|
-
getGasPrice,
|
20
|
-
getLogs,
|
21
|
-
getStorageAt,
|
22
|
-
getTransaction,
|
23
|
-
getTransactionConfirmations,
|
24
|
-
getTransactionCount,
|
25
|
-
getTransactionReceipt,
|
26
|
-
multicall,
|
27
|
-
readContract,
|
28
|
-
simulateContract,
|
29
|
-
uninstallFilter,
|
30
|
-
waitForTransactionReceipt,
|
31
|
-
watchBlockNumber,
|
32
|
-
watchBlocks,
|
33
|
-
watchContractEvent,
|
34
|
-
watchEvent,
|
35
|
-
watchPendingTransactions,
|
36
|
-
} from './public'
|
37
|
-
export type {
|
38
|
-
CallArgs,
|
39
|
-
CallResponse,
|
40
|
-
CreateBlockFilterResponse,
|
41
|
-
CreateContractEventFilterArgs,
|
42
|
-
CreateContractEventFilterResponse,
|
43
|
-
CreateEventFilterArgs,
|
44
|
-
CreateEventFilterResponse,
|
45
|
-
CreatePendingTransactionFilterResponse,
|
46
|
-
DeployContractArgs,
|
47
|
-
DeployContractResponse,
|
48
|
-
EstimateGasArgs,
|
49
|
-
EstimateGasResponse,
|
50
|
-
GetBalanceArgs,
|
51
|
-
GetBalanceResponse,
|
52
|
-
GetBlockArgs,
|
53
|
-
GetBlockNumberArgs,
|
54
|
-
GetBlockNumberResponse,
|
55
|
-
GetBlockResponse,
|
56
|
-
GetBlockTransactionCountArgs,
|
57
|
-
GetBlockTransactionCountResponse,
|
58
|
-
GetBytecodeArgs,
|
59
|
-
GetBytecodeResponse,
|
60
|
-
GetFeeHistoryArgs,
|
61
|
-
GetFeeHistoryResponse,
|
62
|
-
GetFilterChangesArgs,
|
63
|
-
GetFilterChangesResponse,
|
64
|
-
GetFilterLogsArgs,
|
65
|
-
GetFilterLogsResponse,
|
66
|
-
GetGasPriceResponse,
|
67
|
-
GetLogsArgs,
|
68
|
-
GetLogsResponse,
|
69
|
-
GetStorageAtArgs,
|
70
|
-
GetStorageAtResponse,
|
71
|
-
GetTransactionArgs,
|
72
|
-
GetTransactionConfirmationsArgs,
|
73
|
-
GetTransactionConfirmationsResponse,
|
74
|
-
GetTransactionCountArgs,
|
75
|
-
GetTransactionCountResponse,
|
76
|
-
GetTransactionReceiptArgs,
|
77
|
-
GetTransactionReceiptResponse,
|
78
|
-
GetTransactionResponse,
|
79
|
-
MulticallArgs,
|
80
|
-
OnBlock,
|
81
|
-
OnBlockNumber,
|
82
|
-
OnBlockNumberResponse,
|
83
|
-
OnBlockResponse,
|
84
|
-
OnLogs,
|
85
|
-
OnLogsResponse,
|
86
|
-
OnTransactions,
|
87
|
-
OnTransactionsResponse,
|
88
|
-
ReadContractArgs,
|
89
|
-
ReadContractResponse,
|
90
|
-
ReplacementReason,
|
91
|
-
ReplacementResponse,
|
92
|
-
SimulateContractArgs,
|
93
|
-
SimulateContractResponse,
|
94
|
-
UninstallFilterArgs,
|
95
|
-
UninstallFilterResponse,
|
96
|
-
WaitForTransactionReceiptArgs,
|
97
|
-
WaitForTransactionReceiptResponse,
|
98
|
-
WatchBlockNumberArgs,
|
99
|
-
WatchBlocksArgs,
|
100
|
-
WatchContractEventArgs,
|
101
|
-
WatchEventArgs,
|
102
|
-
WatchPendingTransactionsArgs,
|
103
|
-
} from './public'
|
104
|
-
|
105
|
-
export {
|
106
|
-
dropTransaction,
|
107
|
-
getAutomine,
|
108
|
-
getTxpoolContent,
|
109
|
-
getTxpoolStatus,
|
110
|
-
impersonateAccount,
|
111
|
-
increaseTime,
|
112
|
-
inspectTxpool,
|
113
|
-
mine,
|
114
|
-
removeBlockTimestampInterval,
|
115
|
-
reset,
|
116
|
-
revert,
|
117
|
-
sendUnsignedTransaction,
|
118
|
-
setAutomine,
|
119
|
-
setBalance,
|
120
|
-
setBlockGasLimit,
|
121
|
-
setBlockTimestampInterval,
|
122
|
-
setCode,
|
123
|
-
setCoinbase,
|
124
|
-
setIntervalMining,
|
125
|
-
setLoggingEnabled,
|
126
|
-
setMinGasPrice,
|
127
|
-
setNextBlockBaseFeePerGas,
|
128
|
-
setNextBlockTimestamp,
|
129
|
-
setNonce,
|
130
|
-
setStorageAt,
|
131
|
-
snapshot,
|
132
|
-
stopImpersonatingAccount,
|
133
|
-
} from './test'
|
134
|
-
export type {
|
135
|
-
DropTransactionArgs,
|
136
|
-
ImpersonateAccountArgs,
|
137
|
-
IncreaseTimeArgs,
|
138
|
-
MineArgs,
|
139
|
-
ResetArgs,
|
140
|
-
RevertArgs,
|
141
|
-
SendUnsignedTransactionArgs,
|
142
|
-
SendUnsignedTransactionResponse,
|
143
|
-
SetBalanceArgs,
|
144
|
-
SetBlockGasLimitArgs,
|
145
|
-
SetBlockTimestampIntervalArgs,
|
146
|
-
SetCodeArgs,
|
147
|
-
SetCoinbaseArgs,
|
148
|
-
SetIntervalMiningArgs,
|
149
|
-
SetMinGasPriceArgs,
|
150
|
-
SetNextBlockBaseFeePerGasArgs,
|
151
|
-
SetNextBlockTimestampArgs,
|
152
|
-
SetNonceArgs,
|
153
|
-
SetStorageAtArgs,
|
154
|
-
StopImpersonatingAccountArgs,
|
155
|
-
} from './test'
|
156
|
-
|
157
|
-
export {
|
158
|
-
addChain,
|
159
|
-
getAccounts,
|
160
|
-
getPermissions,
|
161
|
-
requestAccounts,
|
162
|
-
requestPermissions,
|
163
|
-
sendTransaction,
|
164
|
-
signMessage,
|
165
|
-
switchChain,
|
166
|
-
watchAsset,
|
167
|
-
writeContract,
|
168
|
-
} from './wallet'
|
169
|
-
export type {
|
170
|
-
FormattedTransactionRequest,
|
171
|
-
GetPermissionsResponse,
|
172
|
-
RequestPermissionsResponse,
|
173
|
-
SendTransactionArgs,
|
174
|
-
SendTransactionResponse,
|
175
|
-
SignMessageArgs,
|
176
|
-
SignMessageResponse,
|
177
|
-
SwitchChainArgs,
|
178
|
-
WatchAssetArgs,
|
179
|
-
WatchAssetResponse,
|
180
|
-
WriteContractArgs,
|
181
|
-
WriteContractResponse,
|
182
|
-
} from './wallet'
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import { bench, describe } from 'vitest'
|
2
|
-
|
3
|
-
import {
|
4
|
-
accounts,
|
5
|
-
ethersProvider,
|
6
|
-
ethersV6Provider,
|
7
|
-
publicClient,
|
8
|
-
web3Provider,
|
9
|
-
} from '../../_test'
|
10
|
-
|
11
|
-
import { call } from './call'
|
12
|
-
|
13
|
-
const wagmiContractAddress = '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2'
|
14
|
-
const name4bytes = '0x06fdde03'
|
15
|
-
|
16
|
-
describe('Call', () => {
|
17
|
-
bench('viem: `call`', async () => {
|
18
|
-
await call(publicClient, {
|
19
|
-
data: name4bytes,
|
20
|
-
from: accounts[0].address,
|
21
|
-
to: wagmiContractAddress,
|
22
|
-
})
|
23
|
-
})
|
24
|
-
|
25
|
-
bench('ethers: `call`', async () => {
|
26
|
-
await ethersProvider.call({
|
27
|
-
data: name4bytes,
|
28
|
-
from: accounts[0].address,
|
29
|
-
to: wagmiContractAddress,
|
30
|
-
})
|
31
|
-
})
|
32
|
-
|
33
|
-
bench('ethers@6: `call`', async () => {
|
34
|
-
await ethersV6Provider.call({
|
35
|
-
data: name4bytes,
|
36
|
-
from: accounts[0].address,
|
37
|
-
to: wagmiContractAddress,
|
38
|
-
})
|
39
|
-
})
|
40
|
-
|
41
|
-
bench('web3.js: `call`', async () => {
|
42
|
-
await web3Provider.eth.call({
|
43
|
-
data: name4bytes,
|
44
|
-
from: accounts[0].address,
|
45
|
-
to: wagmiContractAddress,
|
46
|
-
})
|
47
|
-
})
|
48
|
-
})
|
@@ -1,99 +0,0 @@
|
|
1
|
-
import { expect, test } from 'vitest'
|
2
|
-
|
3
|
-
import { accounts, publicClient } from '../../_test'
|
4
|
-
import { celo } from '../../chains'
|
5
|
-
import { createPublicClient, http } from '../../clients'
|
6
|
-
import { numberToHex, parseGwei } from '../../utils'
|
7
|
-
|
8
|
-
import { call } from './call'
|
9
|
-
|
10
|
-
const wagmiContractAddress = '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2'
|
11
|
-
const name4bytes = '0x06fdde03'
|
12
|
-
const mint4bytes = '0x1249c58b'
|
13
|
-
const mintWithParams4bytes = '0xa0712d68'
|
14
|
-
const fourTwenty =
|
15
|
-
'00000000000000000000000000000000000000000000000000000000000001a4'
|
16
|
-
|
17
|
-
const sourceAccount = accounts[0]
|
18
|
-
|
19
|
-
test('default', async () => {
|
20
|
-
const { data } = await call(publicClient, {
|
21
|
-
data: name4bytes,
|
22
|
-
from: sourceAccount.address,
|
23
|
-
to: wagmiContractAddress,
|
24
|
-
})
|
25
|
-
expect(data).toMatchInlineSnapshot(
|
26
|
-
'"0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000057761676d69000000000000000000000000000000000000000000000000000000"',
|
27
|
-
)
|
28
|
-
})
|
29
|
-
|
30
|
-
test('custom formatter', async () => {
|
31
|
-
const client = createPublicClient({
|
32
|
-
chain: celo,
|
33
|
-
transport: http(),
|
34
|
-
})
|
35
|
-
|
36
|
-
const { data } = await call(client, {
|
37
|
-
chain: celo,
|
38
|
-
gatewayFee: numberToHex(1n),
|
39
|
-
data: name4bytes,
|
40
|
-
from: sourceAccount.address,
|
41
|
-
to: wagmiContractAddress,
|
42
|
-
})
|
43
|
-
expect(data).toBeUndefined()
|
44
|
-
})
|
45
|
-
|
46
|
-
test('zero data', async () => {
|
47
|
-
const { data } = await call(publicClient, {
|
48
|
-
data: mint4bytes,
|
49
|
-
from: sourceAccount.address,
|
50
|
-
to: wagmiContractAddress,
|
51
|
-
})
|
52
|
-
expect(data).toMatchInlineSnapshot('undefined')
|
53
|
-
})
|
54
|
-
|
55
|
-
test('args: blockNumber', async () => {
|
56
|
-
const { data } = await call(publicClient, {
|
57
|
-
blockNumber: 15564164n,
|
58
|
-
data: `${mintWithParams4bytes}${fourTwenty}`,
|
59
|
-
from: sourceAccount.address,
|
60
|
-
to: wagmiContractAddress,
|
61
|
-
})
|
62
|
-
expect(data).toMatchInlineSnapshot('undefined')
|
63
|
-
})
|
64
|
-
|
65
|
-
test('errors: maxFeePerGas less than maxPriorityFeePerGas', async () => {
|
66
|
-
await expect(
|
67
|
-
call(publicClient, {
|
68
|
-
data: `${mintWithParams4bytes}${fourTwenty}`,
|
69
|
-
from: sourceAccount.address,
|
70
|
-
to: wagmiContractAddress,
|
71
|
-
maxFeePerGas: parseGwei('20'),
|
72
|
-
maxPriorityFeePerGas: parseGwei('22'),
|
73
|
-
}),
|
74
|
-
).rejects.toThrowErrorMatchingInlineSnapshot(`
|
75
|
-
"\`maxFeePerGas\` cannot be less than \`maxPriorityFeePerGas\`
|
76
|
-
|
77
|
-
Version: viem@1.0.2"
|
78
|
-
`)
|
79
|
-
})
|
80
|
-
|
81
|
-
test('errors: contract revert (contract error)', async () => {
|
82
|
-
await expect(
|
83
|
-
call(publicClient, {
|
84
|
-
data: `${mintWithParams4bytes}${fourTwenty}`,
|
85
|
-
from: sourceAccount.address,
|
86
|
-
to: wagmiContractAddress,
|
87
|
-
}),
|
88
|
-
).rejects.toThrowError('execution reverted: Token ID is taken')
|
89
|
-
})
|
90
|
-
|
91
|
-
test('errors: contract revert (insufficient params)', async () => {
|
92
|
-
await expect(
|
93
|
-
call(publicClient, {
|
94
|
-
data: mintWithParams4bytes,
|
95
|
-
from: sourceAccount.address,
|
96
|
-
to: wagmiContractAddress,
|
97
|
-
}),
|
98
|
-
).rejects.toThrowError('execution reverted')
|
99
|
-
})
|