viem 0.0.1-cjs.10 → 0.0.1-sushi.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-ac509982.d.ts +23 -0
- package/dist/chain-c4ccb458.d.ts +5 -0
- package/dist/{rpc-b77c5aee.d.ts → chain-f16512e8.d.ts} +97 -17
- package/dist/chains.d.ts +1303 -74
- package/dist/chains.js +81 -85
- package/dist/chains.js.map +1 -0
- package/dist/chains.mjs +121 -125
- package/dist/chains.mjs.map +1 -0
- package/dist/chunk-2PFNLP3F.js +192 -0
- package/dist/chunk-2PFNLP3F.js.map +1 -0
- package/dist/chunk-5ND4P6QL.mjs +192 -0
- package/dist/chunk-5ND4P6QL.mjs.map +1 -0
- package/dist/{chunk-5ZBNF5WM.js → chunk-NXCI5KQC.js} +769 -359
- package/dist/chunk-NXCI5KQC.js.map +1 -0
- package/dist/{chunk-HLVCJ7RV.mjs → chunk-O7T5NQLB.mjs} +484 -477
- package/dist/chunk-O7T5NQLB.mjs.map +1 -0
- package/dist/{chunk-2FDH6XP5.mjs → chunk-SD5X7F4U.mjs} +777 -367
- package/dist/chunk-SD5X7F4U.mjs.map +1 -0
- package/dist/{chunk-46ZFLVHC.js → chunk-UTL6F7UN.js} +519 -512
- package/dist/chunk-UTL6F7UN.js.map +1 -0
- package/dist/contract-9e76e561.d.ts +166 -0
- package/dist/contract.d.ts +123 -0
- package/dist/contract.js +53 -0
- package/dist/contract.js.map +1 -0
- package/dist/contract.mjs +53 -0
- package/dist/contract.mjs.map +1 -0
- package/dist/createClient-68ee4bb4.d.ts +62 -0
- package/dist/createPublicClient-b732194e.d.ts +19 -0
- package/dist/createTestClient-dedf321e.d.ts +34 -0
- package/dist/createWalletClient-75813d83.d.ts +30 -0
- package/dist/decodeErrorResult-0b934d23.d.ts +16 -0
- package/dist/{eip1193-020a6f13.d.ts → eip1193-6f9ba163.d.ts} +12 -9
- package/dist/ens.d.ts +82 -0
- package/dist/ens.js +216 -0
- package/dist/ens.js.map +1 -0
- package/dist/ens.mjs +216 -0
- package/dist/ens.mjs.map +1 -0
- package/dist/getAbiItem-c8e6e7d4.d.ts +97 -0
- package/dist/index.d.ts +128 -33
- package/dist/index.js +240 -244
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +257 -261
- package/dist/index.mjs.map +1 -0
- package/dist/public.d.ts +353 -0
- package/dist/public.js +58 -0
- package/dist/public.js.map +1 -0
- package/dist/public.mjs +58 -0
- package/dist/public.mjs.map +1 -0
- package/dist/readContract-4f6e2692.d.ts +10 -0
- package/dist/rpc-a5a7f376.d.ts +121 -0
- package/dist/sendTransaction-e713f90c.d.ts +12 -0
- package/dist/test.d.ts +161 -0
- package/dist/test.js +264 -0
- package/dist/test.js.map +1 -0
- package/dist/test.mjs +264 -0
- package/dist/test.mjs.map +1 -0
- package/dist/transactionReceipt-2a86c7c7.d.ts +26 -0
- package/dist/transactionRequest-c7794f5e.d.ts +15 -0
- package/dist/utils/index.d.ts +238 -24
- package/dist/utils/index.js +27 -2
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +30 -5
- package/dist/utils/index.mjs.map +1 -0
- package/dist/wallet.d.ts +42 -0
- package/dist/wallet.js +24 -0
- package/dist/wallet.js.map +1 -0
- package/dist/wallet.mjs +24 -0
- package/dist/wallet.mjs.map +1 -0
- package/dist/watchEvent-c346c12d.d.ts +41 -0
- package/dist/window.d.ts +3 -2
- package/dist/window.js +1 -1
- package/dist/window.js.map +1 -0
- package/dist/window.mjs +1 -0
- package/dist/window.mjs.map +1 -0
- package/ens/package.json +4 -0
- package/package.json +40 -72
- package/src/_test/abis.ts +1420 -0
- package/src/_test/bench.ts +15 -0
- package/src/_test/constants.ts +63 -0
- package/src/_test/generated.ts +128 -0
- package/src/_test/globalSetup.ts +11 -0
- package/src/_test/index.ts +25 -0
- package/src/_test/setup.ts +8 -0
- package/src/_test/utils.ts +155 -0
- package/src/actions/ens/getEnsAddress.bench.ts +26 -0
- package/src/actions/ens/getEnsAddress.test.ts +97 -0
- package/src/actions/ens/getEnsAddress.ts +122 -0
- package/src/actions/ens/getEnsName.bench.ts +30 -0
- package/src/actions/ens/getEnsName.test.ts +101 -0
- package/src/actions/ens/getEnsName.ts +106 -0
- package/src/actions/ens/index.test.ts +12 -0
- package/src/actions/ens/index.ts +3 -0
- package/src/actions/index.test.ts +81 -0
- package/src/actions/index.ts +182 -0
- package/src/actions/public/call.bench.ts +48 -0
- package/src/actions/public/call.test.ts +99 -0
- package/src/actions/public/call.ts +97 -0
- package/src/actions/public/createBlockFilter.bench.ts +11 -0
- package/src/actions/public/createBlockFilter.test.ts +9 -0
- package/src/actions/public/createBlockFilter.ts +14 -0
- package/src/actions/public/createContractEventFilter.test.ts +119 -0
- package/src/actions/public/createContractEventFilter.ts +69 -0
- package/src/actions/public/createEventFilter.test.ts +277 -0
- package/src/actions/public/createEventFilter.ts +93 -0
- package/src/actions/public/createPendingTransactionFilter.bench.ts +11 -0
- package/src/actions/public/createPendingTransactionFilter.test.ts +9 -0
- package/src/actions/public/createPendingTransactionFilter.ts +14 -0
- package/src/actions/public/estimateGas.bench.ts +46 -0
- package/src/actions/public/estimateGas.test.ts +92 -0
- package/src/actions/public/estimateGas.ts +61 -0
- package/src/actions/public/getBalance.test.ts +83 -0
- package/src/actions/public/getBalance.ts +37 -0
- package/src/actions/public/getBlock.bench.ts +28 -0
- package/src/actions/public/getBlock.test.ts +575 -0
- package/src/actions/public/getBlock.ts +65 -0
- package/src/actions/public/getBlockNumber.bench.ts +28 -0
- package/src/actions/public/getBlockNumber.test.ts +27 -0
- package/src/actions/public/getBlockNumber.ts +32 -0
- package/src/actions/public/getBlockTransactionCount.bench.ts +15 -0
- package/src/actions/public/getBlockTransactionCount.test.ts +57 -0
- package/src/actions/public/getBlockTransactionCount.ts +52 -0
- package/src/actions/public/getBytecode.test.ts +27 -0
- package/src/actions/public/getBytecode.ts +32 -0
- package/src/actions/public/getChainId.bench.ts +15 -0
- package/src/actions/public/getChainId.test.ts +8 -0
- package/src/actions/public/getChainId.ts +7 -0
- package/src/actions/public/getFeeHistory.bench.ts +18 -0
- package/src/actions/public/getFeeHistory.test.ts +137 -0
- package/src/actions/public/getFeeHistory.ts +44 -0
- package/src/actions/public/getFilterChanges.bench.ts +13 -0
- package/src/actions/public/getFilterChanges.test.ts +383 -0
- package/src/actions/public/getFilterChanges.ts +23 -0
- package/src/actions/public/getFilterLogs.test.ts +297 -0
- package/src/actions/public/getFilterLogs.ts +20 -0
- package/src/actions/public/getGasPrice.bench.ts +19 -0
- package/src/actions/public/getGasPrice.test.ts +8 -0
- package/src/actions/public/getGasPrice.ts +15 -0
- package/src/actions/public/getLogs.test.ts +306 -0
- package/src/actions/public/getLogs.ts +84 -0
- package/src/actions/public/getStorageAt.test.ts +34 -0
- package/src/actions/public/getStorageAt.ts +32 -0
- package/src/actions/public/getTransaction.bench.ts +33 -0
- package/src/actions/public/getTransaction.test.ts +311 -0
- package/src/actions/public/getTransaction.ts +95 -0
- package/src/actions/public/getTransactionConfirmations.test.ts +69 -0
- package/src/actions/public/getTransactionConfirmations.ts +38 -0
- package/src/actions/public/getTransactionCount.test.ts +56 -0
- package/src/actions/public/getTransactionCount.ts +34 -0
- package/src/actions/public/getTransactionReceipt.bench.ts +33 -0
- package/src/actions/public/getTransactionReceipt.test.ts +179 -0
- package/src/actions/public/getTransactionReceipt.ts +34 -0
- package/src/actions/public/index.test.ts +43 -0
- package/src/actions/public/index.ts +146 -0
- package/src/actions/public/multicall.test.ts +452 -0
- package/src/actions/public/multicall.ts +108 -0
- package/src/actions/public/readContract.test.ts +328 -0
- package/src/actions/public/readContract.ts +73 -0
- package/src/actions/public/simulateContract.bench.ts +41 -0
- package/src/actions/public/simulateContract.test.ts +410 -0
- package/src/actions/public/simulateContract.ts +91 -0
- package/src/actions/public/uninstallFilter.bench.ts +13 -0
- package/src/actions/public/uninstallFilter.test.ts +65 -0
- package/src/actions/public/uninstallFilter.ts +17 -0
- package/src/actions/public/waitForTransactionReceipt.test.ts +322 -0
- package/src/actions/public/waitForTransactionReceipt.ts +170 -0
- package/src/actions/public/watchBlockNumber.test.ts +166 -0
- package/src/actions/public/watchBlockNumber.ts +79 -0
- package/src/actions/public/watchBlocks.test.ts +210 -0
- package/src/actions/public/watchBlocks.ts +114 -0
- package/src/actions/public/watchContractEvent.test.ts +305 -0
- package/src/actions/public/watchContractEvent.ts +108 -0
- package/src/actions/public/watchEvent.test.ts +195 -0
- package/src/actions/public/watchEvent.ts +95 -0
- package/src/actions/public/watchPendingTransactions.test.ts +116 -0
- package/src/actions/public/watchPendingTransactions.ts +74 -0
- package/src/actions/test/dropTransaction.test.ts +34 -0
- package/src/actions/test/dropTransaction.ts +17 -0
- package/src/actions/test/getAutomine.test.ts +14 -0
- package/src/actions/test/getAutomine.ts +11 -0
- package/src/actions/test/getTxpoolContent.test.ts +45 -0
- package/src/actions/test/getTxpoolContent.ts +7 -0
- package/src/actions/test/getTxpoolStatus.test.ts +41 -0
- package/src/actions/test/getTxpoolStatus.ts +12 -0
- package/src/actions/test/impersonateAccount.test.ts +26 -0
- package/src/actions/test/impersonateAccount.ts +17 -0
- package/src/actions/test/increaseTime.test.ts +18 -0
- package/src/actions/test/increaseTime.ts +17 -0
- package/src/actions/test/index.test.ts +38 -0
- package/src/actions/test/index.ts +77 -0
- package/src/actions/test/inspectTxpool.test.ts +50 -0
- package/src/actions/test/inspectTxpool.ts +7 -0
- package/src/actions/test/mine.test.ts +20 -0
- package/src/actions/test/mine.ts +16 -0
- package/src/actions/test/removeBlockTimestampInterval.test.ts +23 -0
- package/src/actions/test/removeBlockTimestampInterval.ts +7 -0
- package/src/actions/test/reset.test.ts +19 -0
- package/src/actions/test/reset.ts +18 -0
- package/src/actions/test/revert.test.ts +39 -0
- package/src/actions/test/revert.ts +14 -0
- package/src/actions/test/sendUnsignedTransaction.test.ts +52 -0
- package/src/actions/test/sendUnsignedTransaction.ts +19 -0
- package/src/actions/test/setAutomine.test.ts +14 -0
- package/src/actions/test/setAutomine.ts +8 -0
- package/src/actions/test/setBalance.test.ts +29 -0
- package/src/actions/test/setBalance.ts +20 -0
- package/src/actions/test/setBlockGasLimit.test.ts +21 -0
- package/src/actions/test/setBlockGasLimit.ts +17 -0
- package/src/actions/test/setBlockTimestampInterval.test.ts +23 -0
- package/src/actions/test/setBlockTimestampInterval.ts +16 -0
- package/src/actions/test/setCode.test.ts +26 -0
- package/src/actions/test/setCode.ts +19 -0
- package/src/actions/test/setCoinbase.test.ts +11 -0
- package/src/actions/test/setCoinbase.ts +17 -0
- package/src/actions/test/setIntervalMining.test.ts +30 -0
- package/src/actions/test/setIntervalMining.ts +16 -0
- package/src/actions/test/setLoggingEnabled.test.ts +10 -0
- package/src/actions/test/setLoggingEnabled.ts +8 -0
- package/src/actions/test/setMinGasPrice.test.ts +22 -0
- package/src/actions/test/setMinGasPrice.ts +17 -0
- package/src/actions/test/setNextBlockBaseFeePerGas.test.ts +23 -0
- package/src/actions/test/setNextBlockBaseFeePerGas.ts +17 -0
- package/src/actions/test/setNextBlockTimestamp.test.ts +19 -0
- package/src/actions/test/setNextBlockTimestamp.ts +17 -0
- package/src/actions/test/setNonce.test.ts +28 -0
- package/src/actions/test/setNonce.ts +20 -0
- package/src/actions/test/setRpcUrl.test.ts +9 -0
- package/src/actions/test/setRpcUrl.ts +8 -0
- package/src/actions/test/setStorageAt.test.ts +36 -0
- package/src/actions/test/setStorageAt.ts +26 -0
- package/src/actions/test/snapshot.test.ts +18 -0
- package/src/actions/test/snapshot.ts +7 -0
- package/src/actions/test/stopImpersonatingAccount.test.ts +29 -0
- package/src/actions/test/stopImpersonatingAccount.ts +17 -0
- package/src/actions/wallet/addChain.test.ts +14 -0
- package/src/actions/wallet/addChain.ts +21 -0
- package/src/actions/wallet/deployContract.test.ts +55 -0
- package/src/actions/wallet/deployContract.ts +38 -0
- package/src/actions/wallet/getAccounts.test.ts +22 -0
- package/src/actions/wallet/getAccounts.ts +7 -0
- package/src/actions/wallet/getPermissions.test.ts +24 -0
- package/src/actions/wallet/getPermissions.ts +9 -0
- package/src/actions/wallet/index.test.ts +21 -0
- package/src/actions/wallet/index.ts +36 -0
- package/src/actions/wallet/requestAccounts.test.ts +13 -0
- package/src/actions/wallet/requestAccounts.ts +7 -0
- package/src/actions/wallet/requestPermissions.test.ts +26 -0
- package/src/actions/wallet/requestPermissions.ts +19 -0
- package/src/actions/wallet/sendTransaction.bench.ts +57 -0
- package/src/actions/wallet/sendTransaction.test.ts +440 -0
- package/src/actions/wallet/sendTransaction.ts +77 -0
- package/src/actions/wallet/signMessage.test.ts +61 -0
- package/src/actions/wallet/signMessage.ts +35 -0
- package/src/actions/wallet/switchChain.test.ts +21 -0
- package/src/actions/wallet/switchChain.ts +19 -0
- package/src/actions/wallet/watchAsset.test.ts +40 -0
- package/src/actions/wallet/watchAsset.ts +16 -0
- package/src/actions/wallet/writeContract.test.ts +84 -0
- package/src/actions/wallet/writeContract.ts +47 -0
- package/src/chains.test.ts +439 -0
- package/src/chains.ts +99 -0
- package/src/clients/createClient.test.ts +295 -0
- package/src/clients/createClient.ts +81 -0
- package/src/clients/createPublicClient.test.ts +165 -0
- package/src/clients/createPublicClient.ts +49 -0
- package/src/clients/createTestClient.test.ts +145 -0
- package/src/clients/createTestClient.ts +72 -0
- package/src/clients/createWalletClient.test.ts +121 -0
- package/src/clients/createWalletClient.ts +54 -0
- package/src/clients/index.test.ts +19 -0
- package/src/clients/index.ts +31 -0
- package/src/clients/transports/createTransport.test.ts +58 -0
- package/src/clients/transports/createTransport.ts +48 -0
- package/src/clients/transports/custom.test.ts +98 -0
- package/src/clients/transports/custom.ts +34 -0
- package/src/clients/transports/fallback.test.ts +393 -0
- package/src/clients/transports/fallback.ts +58 -0
- package/src/clients/transports/http.test.ts +109 -0
- package/src/clients/transports/http.ts +51 -0
- package/src/clients/transports/index.test.ts +15 -0
- package/src/clients/transports/index.ts +17 -0
- package/src/clients/transports/webSocket.test.ts +164 -0
- package/src/clients/transports/webSocket.ts +118 -0
- package/src/constants/abis.test.ts +53 -0
- package/src/constants/abis.ts +44 -0
- package/src/constants/index.test.ts +14 -0
- package/src/constants/index.ts +3 -0
- package/src/constants/solidity.test.ts +41 -0
- package/src/constants/solidity.ts +35 -0
- package/src/contract.test.ts +32 -0
- package/src/contract.ts +68 -0
- package/src/ens.test.ts +15 -0
- package/src/ens.ts +8 -0
- package/src/errors/abi.test.ts +81 -0
- package/src/errors/abi.ts +254 -0
- package/src/errors/address.test.ts +14 -0
- package/src/errors/address.ts +9 -0
- package/src/errors/base.test.ts +114 -0
- package/src/errors/base.ts +57 -0
- package/src/errors/block.test.ts +24 -0
- package/src/errors/block.ts +18 -0
- package/src/errors/chain.test.ts +46 -0
- package/src/errors/chain.ts +33 -0
- package/src/errors/contract.test.ts +233 -0
- package/src/errors/contract.ts +178 -0
- package/src/errors/data.ts +20 -0
- package/src/errors/encoding.ts +60 -0
- package/src/errors/index.ts +82 -0
- package/src/errors/log.ts +8 -0
- package/src/errors/request.test.ts +330 -0
- package/src/errors/request.ts +163 -0
- package/src/errors/rpc.test.ts +87 -0
- package/src/errors/rpc.ts +113 -0
- package/src/errors/transaction.test.ts +83 -0
- package/src/errors/transaction.ts +54 -0
- package/src/errors/transport.test.ts +11 -0
- package/src/errors/transport.ts +12 -0
- package/src/index.test.ts +116 -0
- package/src/index.ts +132 -0
- package/src/public.test.ts +36 -0
- package/src/public.ts +76 -0
- package/src/test.test.ts +38 -0
- package/src/test.ts +52 -0
- package/src/types/block.ts +71 -0
- package/src/types/chain.ts +6 -0
- package/src/types/contract.ts +497 -0
- package/src/types/eip1193.ts +1041 -0
- package/src/types/fee.ts +47 -0
- package/src/types/filter.ts +8 -0
- package/src/types/formatter.ts +23 -0
- package/src/types/index.ts +84 -0
- package/src/types/log.ts +22 -0
- package/src/types/misc.ts +5 -0
- package/src/types/multicall.ts +82 -0
- package/src/types/rpc.ts +35 -0
- package/src/types/transaction.ts +145 -0
- package/src/types/utils.ts +88 -0
- package/src/types/window.ts +9 -0
- package/src/utils/abi/decodeAbi.bench.ts +135 -0
- package/src/utils/abi/decodeAbi.test.ts +1614 -0
- package/src/utils/abi/decodeAbi.ts +300 -0
- package/src/utils/abi/decodeDeployData.test.ts +151 -0
- package/src/utils/abi/decodeDeployData.ts +44 -0
- package/src/utils/abi/decodeErrorResult.test.ts +230 -0
- package/src/utils/abi/decodeErrorResult.ts +45 -0
- package/src/utils/abi/decodeEventLog.test.ts +542 -0
- package/src/utils/abi/decodeEventLog.ts +107 -0
- package/src/utils/abi/decodeFunctionData.test.ts +138 -0
- package/src/utils/abi/decodeFunctionData.ts +32 -0
- package/src/utils/abi/decodeFunctionResult.test.ts +333 -0
- package/src/utils/abi/decodeFunctionResult.ts +57 -0
- package/src/utils/abi/encodeAbi.bench.ts +163 -0
- package/src/utils/abi/encodeAbi.test.ts +1447 -0
- package/src/utils/abi/encodeAbi.ts +273 -0
- package/src/utils/abi/encodeDeployData.test.ts +124 -0
- package/src/utils/abi/encodeDeployData.ts +40 -0
- package/src/utils/abi/encodeErrorResult.test.ts +192 -0
- package/src/utils/abi/encodeErrorResult.ts +47 -0
- package/src/utils/abi/encodeEventTopics.test.ts +345 -0
- package/src/utils/abi/encodeEventTopics.ts +75 -0
- package/src/utils/abi/encodeFunctionData.test.ts +138 -0
- package/src/utils/abi/encodeFunctionData.ts +42 -0
- package/src/utils/abi/encodeFunctionResult.test.ts +279 -0
- package/src/utils/abi/encodeFunctionResult.ts +41 -0
- package/src/utils/abi/formatAbiItem.test.ts +335 -0
- package/src/utils/abi/formatAbiItem.ts +41 -0
- package/src/utils/abi/formatAbiItemWithArgs.test.ts +291 -0
- package/src/utils/abi/formatAbiItemWithArgs.ts +27 -0
- package/src/utils/abi/getAbiItem.test.ts +547 -0
- package/src/utils/abi/getAbiItem.ts +95 -0
- package/src/utils/abi/index.test.ts +24 -0
- package/src/utils/abi/index.ts +48 -0
- package/src/utils/address/getAddress.bench.ts +22 -0
- package/src/utils/address/getAddress.test.ts +46 -0
- package/src/utils/address/getAddress.ts +28 -0
- package/src/utils/address/getContractAddress.bench.ts +20 -0
- package/src/utils/address/getContractAddress.test.ts +78 -0
- package/src/utils/address/getContractAddress.ts +59 -0
- package/src/utils/address/index.test.ts +17 -0
- package/src/utils/address/index.ts +16 -0
- package/src/utils/address/isAddress.test.ts +10 -0
- package/src/utils/address/isAddress.ts +10 -0
- package/src/utils/address/isAddressEqual.test.ts +55 -0
- package/src/utils/address/isAddressEqual.ts +6 -0
- package/src/utils/buildRequest.test.ts +428 -0
- package/src/utils/buildRequest.ts +72 -0
- package/src/utils/chain.test.ts +43 -0
- package/src/utils/chain.ts +8 -0
- package/src/utils/contract/extractFunctionParts.test.ts +109 -0
- package/src/utils/contract/extractFunctionParts.ts +27 -0
- package/src/utils/contract/getContractError.test.ts +282 -0
- package/src/utils/contract/getContractError.ts +58 -0
- package/src/utils/contract/index.test.ts +15 -0
- package/src/utils/contract/index.ts +8 -0
- package/src/utils/data/concat.test.ts +35 -0
- package/src/utils/data/concat.ts +34 -0
- package/src/utils/data/index.test.ts +23 -0
- package/src/utils/data/index.ts +13 -0
- package/src/utils/data/isBytes.test.ts +9 -0
- package/src/utils/data/isBytes.ts +7 -0
- package/src/utils/data/isHex.test.ts +13 -0
- package/src/utils/data/isHex.ts +5 -0
- package/src/utils/data/pad.bench.ts +30 -0
- package/src/utils/data/pad.test.ts +367 -0
- package/src/utils/data/pad.ts +53 -0
- package/src/utils/data/size.test.ts +18 -0
- package/src/utils/data/size.ts +13 -0
- package/src/utils/data/slice.test.ts +203 -0
- package/src/utils/data/slice.ts +60 -0
- package/src/utils/data/trim.bench.ts +34 -0
- package/src/utils/data/trim.test.ts +175 -0
- package/src/utils/data/trim.ts +33 -0
- package/src/utils/encoding/decodeBytes.bench.ts +40 -0
- package/src/utils/encoding/decodeBytes.test.ts +144 -0
- package/src/utils/encoding/decodeBytes.ts +63 -0
- package/src/utils/encoding/decodeHex.bench.ts +24 -0
- package/src/utils/encoding/decodeHex.test.ts +167 -0
- package/src/utils/encoding/decodeHex.ts +76 -0
- package/src/utils/encoding/decodeRlp.bench.ts +34 -0
- package/src/utils/encoding/decodeRlp.test.ts +350 -0
- package/src/utils/encoding/decodeRlp.ts +121 -0
- package/src/utils/encoding/encodeBytes.bench.ts +29 -0
- package/src/utils/encoding/encodeBytes.test.ts +676 -0
- package/src/utils/encoding/encodeBytes.ts +59 -0
- package/src/utils/encoding/encodeHex.bench.ts +49 -0
- package/src/utils/encoding/encodeHex.test.ts +232 -0
- package/src/utils/encoding/encodeHex.ts +104 -0
- package/src/utils/encoding/encodeRlp.bench.ts +54 -0
- package/src/utils/encoding/encodeRlp.test.ts +254 -0
- package/src/utils/encoding/encodeRlp.ts +48 -0
- package/src/utils/encoding/index.test.ts +32 -0
- package/src/utils/encoding/index.ts +36 -0
- package/src/utils/ens/index.test.ts +14 -0
- package/src/utils/ens/index.ts +7 -0
- package/src/utils/ens/labelhash.test.ts +55 -0
- package/src/utils/ens/labelhash.ts +16 -0
- package/src/utils/ens/namehash.test.ts +65 -0
- package/src/utils/ens/namehash.ts +28 -0
- package/src/utils/ens/normalize.bench.ts +14 -0
- package/src/utils/ens/normalize.test.ts +35 -0
- package/src/utils/ens/normalize.ts +14 -0
- package/src/utils/ens/packetToBytes.test.ts +11 -0
- package/src/utils/ens/packetToBytes.ts +29 -0
- package/src/utils/formatters/block.bench.ts +51 -0
- package/src/utils/formatters/block.test.ts +115 -0
- package/src/utils/formatters/block.ts +37 -0
- package/src/utils/formatters/extract.test.ts +14 -0
- package/src/utils/formatters/extract.ts +18 -0
- package/src/utils/formatters/feeHistory.test.ts +66 -0
- package/src/utils/formatters/feeHistory.ts +12 -0
- package/src/utils/formatters/format.test.ts +93 -0
- package/src/utils/formatters/format.ts +90 -0
- package/src/utils/formatters/index.test.ts +27 -0
- package/src/utils/formatters/index.ts +34 -0
- package/src/utils/formatters/log.test.ts +79 -0
- package/src/utils/formatters/log.ts +12 -0
- package/src/utils/formatters/transaction.test.ts +271 -0
- package/src/utils/formatters/transaction.ts +63 -0
- package/src/utils/formatters/transactionReceipt.bench.ts +73 -0
- package/src/utils/formatters/transactionReceipt.test.ts +151 -0
- package/src/utils/formatters/transactionReceipt.ts +63 -0
- package/src/utils/formatters/transactionRequest.bench.ts +29 -0
- package/src/utils/formatters/transactionRequest.test.ts +237 -0
- package/src/utils/formatters/transactionRequest.ts +56 -0
- package/src/utils/hash/getEventSignature.test.ts +61 -0
- package/src/utils/hash/getEventSignature.ts +4 -0
- package/src/utils/hash/getFunctionSignature.test.ts +22 -0
- package/src/utils/hash/getFunctionSignature.ts +5 -0
- package/src/utils/hash/hashFunction.test.ts +65 -0
- package/src/utils/hash/hashFunction.ts +12 -0
- package/src/utils/hash/index.test.ts +13 -0
- package/src/utils/hash/index.ts +5 -0
- package/src/utils/hash/keccak256.test.ts +59 -0
- package/src/utils/hash/keccak256.ts +21 -0
- package/src/utils/index.test.ts +111 -0
- package/src/utils/index.ts +142 -0
- package/src/utils/observe.test.ts +176 -0
- package/src/utils/observe.ts +66 -0
- package/src/utils/poll.test.ts +127 -0
- package/src/utils/poll.ts +42 -0
- package/src/utils/promise/index.test.ts +14 -0
- package/src/utils/promise/index.ts +3 -0
- package/src/utils/promise/withCache.test.ts +97 -0
- package/src/utils/promise/withCache.ts +73 -0
- package/src/utils/promise/withRetry.test.ts +231 -0
- package/src/utils/promise/withRetry.ts +61 -0
- package/src/utils/promise/withTimeout.test.ts +37 -0
- package/src/utils/promise/withTimeout.ts +39 -0
- package/src/utils/rpc.test.ts +990 -0
- package/src/utils/rpc.ts +294 -0
- package/src/utils/stringify.test.ts +13 -0
- package/src/utils/stringify.ts +5 -0
- package/src/utils/uid.ts +14 -0
- package/src/utils/unit/constants.test.ts +22 -0
- package/src/utils/unit/constants.ts +12 -0
- package/src/utils/unit/formatEther.test.ts +75 -0
- package/src/utils/unit/formatEther.ts +6 -0
- package/src/utils/unit/formatGwei.test.ts +32 -0
- package/src/utils/unit/formatGwei.ts +6 -0
- package/src/utils/unit/formatUnit.bench.ts +21 -0
- package/src/utils/unit/formatUnit.test.ts +40 -0
- package/src/utils/unit/formatUnit.ts +16 -0
- package/src/utils/unit/index.test.ts +28 -0
- package/src/utils/unit/index.ts +7 -0
- package/src/utils/unit/parseEther.test.ts +126 -0
- package/src/utils/unit/parseEther.ts +6 -0
- package/src/utils/unit/parseGwei.test.ts +50 -0
- package/src/utils/unit/parseGwei.ts +6 -0
- package/src/utils/unit/parseUnit.bench.ts +21 -0
- package/src/utils/unit/parseUnit.test.ts +54 -0
- package/src/utils/unit/parseUnit.ts +27 -0
- package/src/utils/wait.ts +3 -0
- package/src/wallet.test.ts +19 -0
- package/src/wallet.ts +23 -0
- package/src/window.ts +1 -0
- package/wallet/package.json +4 -0
- package/actions/package.json +0 -4
- package/clients/package.json +0 -4
- package/dist/actions/index.d.ts +0 -8
- package/dist/actions/index.js +0 -125
- package/dist/actions/index.mjs +0 -125
- package/dist/chunk-CWCWWGBC.mjs +0 -258
- package/dist/chunk-SGTIBKHG.js +0 -258
- package/dist/clients/index.d.ts +0 -7
- package/dist/clients/index.js +0 -23
- package/dist/clients/index.mjs +0 -23
- package/dist/createWalletClient-d612fe08.d.ts +0 -130
- package/dist/parseGwei-7c87ff41.d.ts +0 -278
- package/dist/rpc-26932bae.d.ts +0 -61
- package/dist/transactionRequest-08d30731.d.ts +0 -132
- package/dist/watchAsset-bc6373f4.d.ts +0 -534
- package/dist/webSocket-7f88e9e0.d.ts +0 -83
@@ -23,7 +23,10 @@
|
|
23
23
|
|
24
24
|
|
25
25
|
|
26
|
-
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
var _chunkNXCI5KQCjs = require('./chunk-NXCI5KQC.js');
|
27
30
|
|
28
31
|
// src/actions/public/call.ts
|
29
32
|
async function call(client, {
|
@@ -43,9 +46,10 @@ async function call(client, {
|
|
43
46
|
...rest
|
44
47
|
}) {
|
45
48
|
if (maxFeePerGas !== void 0 && maxPriorityFeePerGas !== void 0 && maxFeePerGas < maxPriorityFeePerGas)
|
46
|
-
throw new (0,
|
47
|
-
const blockNumberHex = blockNumber ?
|
48
|
-
const
|
49
|
+
throw new (0, _chunkNXCI5KQCjs.InvalidGasArgumentsError)();
|
50
|
+
const blockNumberHex = blockNumber ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : void 0;
|
51
|
+
const formatter = _optionalChain([chain, 'optionalAccess', _ => _.formatters, 'optionalAccess', _2 => _2.transactionRequest]);
|
52
|
+
const request_ = _chunkNXCI5KQCjs.format.call(void 0,
|
49
53
|
{
|
50
54
|
from,
|
51
55
|
accessList,
|
@@ -57,10 +61,11 @@ async function call(client, {
|
|
57
61
|
nonce,
|
58
62
|
to,
|
59
63
|
value,
|
60
|
-
|
64
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
65
|
+
..._chunkNXCI5KQCjs.extract.call(void 0, rest, { formatter })
|
61
66
|
},
|
62
67
|
{
|
63
|
-
formatter:
|
68
|
+
formatter: formatter || _chunkNXCI5KQCjs.formatTransactionRequest
|
64
69
|
}
|
65
70
|
);
|
66
71
|
const response = await client.request({
|
@@ -72,15 +77,15 @@ async function call(client, {
|
|
72
77
|
return { data: response };
|
73
78
|
}
|
74
79
|
|
75
|
-
// src/actions/public/
|
76
|
-
async function
|
80
|
+
// src/actions/public/simulateContract.ts
|
81
|
+
async function simulateContract(client, {
|
77
82
|
abi,
|
78
83
|
address,
|
79
84
|
args,
|
80
85
|
functionName,
|
81
86
|
...callRequest
|
82
87
|
}) {
|
83
|
-
const calldata =
|
88
|
+
const calldata = _chunkNXCI5KQCjs.encodeFunctionData.call(void 0, {
|
84
89
|
abi,
|
85
90
|
args,
|
86
91
|
functionName
|
@@ -91,16 +96,28 @@ async function callContract(client, {
|
|
91
96
|
to: address,
|
92
97
|
...callRequest
|
93
98
|
});
|
94
|
-
|
99
|
+
const result = _chunkNXCI5KQCjs.decodeFunctionResult.call(void 0, {
|
95
100
|
abi,
|
101
|
+
args,
|
96
102
|
functionName,
|
97
103
|
data: data || "0x"
|
98
104
|
});
|
105
|
+
return {
|
106
|
+
result,
|
107
|
+
request: {
|
108
|
+
abi,
|
109
|
+
address,
|
110
|
+
args,
|
111
|
+
functionName,
|
112
|
+
...callRequest
|
113
|
+
}
|
114
|
+
};
|
99
115
|
} catch (err) {
|
100
|
-
throw
|
116
|
+
throw _chunkNXCI5KQCjs.getContractError.call(void 0, err, {
|
101
117
|
abi,
|
102
118
|
address,
|
103
119
|
args,
|
120
|
+
docsPath: "/docs/contract/simulateContract",
|
104
121
|
functionName,
|
105
122
|
sender: callRequest.from
|
106
123
|
});
|
@@ -136,16 +153,16 @@ async function estimateGas(client, {
|
|
136
153
|
to,
|
137
154
|
value
|
138
155
|
}) {
|
139
|
-
const blockNumberHex = blockNumber ?
|
156
|
+
const blockNumberHex = blockNumber ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : void 0;
|
140
157
|
const parameters = {
|
141
158
|
data,
|
142
159
|
from,
|
143
|
-
gas: gas ?
|
144
|
-
gasPrice: gasPrice ?
|
145
|
-
maxFeePerGas: maxFeePerGas ?
|
146
|
-
maxPriorityFeePerGas: maxPriorityFeePerGas ?
|
160
|
+
gas: gas ? _chunkNXCI5KQCjs.numberToHex.call(void 0, gas) : void 0,
|
161
|
+
gasPrice: gasPrice ? _chunkNXCI5KQCjs.numberToHex.call(void 0, gasPrice) : void 0,
|
162
|
+
maxFeePerGas: maxFeePerGas ? _chunkNXCI5KQCjs.numberToHex.call(void 0, maxFeePerGas) : void 0,
|
163
|
+
maxPriorityFeePerGas: maxPriorityFeePerGas ? _chunkNXCI5KQCjs.numberToHex.call(void 0, maxPriorityFeePerGas) : void 0,
|
147
164
|
to,
|
148
|
-
value: value ?
|
165
|
+
value: value ? _chunkNXCI5KQCjs.numberToHex.call(void 0, value) : void 0
|
149
166
|
};
|
150
167
|
const balance = await client.request({
|
151
168
|
method: "eth_estimateGas",
|
@@ -156,7 +173,7 @@ async function estimateGas(client, {
|
|
156
173
|
|
157
174
|
// src/actions/public/getBalance.ts
|
158
175
|
async function getBalance(client, { address, blockNumber, blockTag = "latest" }) {
|
159
|
-
const blockNumberHex = blockNumber ?
|
176
|
+
const blockNumberHex = blockNumber ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : void 0;
|
160
177
|
const balance = await client.request({
|
161
178
|
method: "eth_getBalance",
|
162
179
|
params: [address, blockNumberHex || blockTag]
|
@@ -171,7 +188,7 @@ async function getBlock(client, {
|
|
171
188
|
blockTag = "latest",
|
172
189
|
includeTransactions = false
|
173
190
|
} = {}) {
|
174
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
191
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : void 0;
|
175
192
|
let block = null;
|
176
193
|
if (blockHash) {
|
177
194
|
block = await client.request({
|
@@ -185,19 +202,19 @@ async function getBlock(client, {
|
|
185
202
|
});
|
186
203
|
}
|
187
204
|
if (!block)
|
188
|
-
throw new (0,
|
189
|
-
return
|
190
|
-
formatter: _optionalChain([client, 'access', _3 => _3.chain, 'optionalAccess', _4 => _4.formatters, 'optionalAccess', _5 => _5.block]) ||
|
205
|
+
throw new (0, _chunkNXCI5KQCjs.BlockNotFoundError)({ blockHash, blockNumber });
|
206
|
+
return _chunkNXCI5KQCjs.format.call(void 0, block, {
|
207
|
+
formatter: _optionalChain([client, 'access', _3 => _3.chain, 'optionalAccess', _4 => _4.formatters, 'optionalAccess', _5 => _5.block]) || _chunkNXCI5KQCjs.formatBlock
|
191
208
|
});
|
192
209
|
}
|
193
210
|
|
194
211
|
// src/actions/public/getBlockNumber.ts
|
195
212
|
var cacheKey = (id) => `blockNumber.${id}`;
|
196
213
|
function getBlockNumberCache(id) {
|
197
|
-
return
|
214
|
+
return _chunkNXCI5KQCjs.getCache.call(void 0, cacheKey(id));
|
198
215
|
}
|
199
216
|
async function getBlockNumber(client, { maxAge = client.pollingInterval } = {}) {
|
200
|
-
const blockNumberHex = await
|
217
|
+
const blockNumberHex = await _chunkNXCI5KQCjs.withCache.call(void 0,
|
201
218
|
() => client.request({
|
202
219
|
method: "eth_blockNumber"
|
203
220
|
}),
|
@@ -212,7 +229,7 @@ async function getBlockTransactionCount(client, {
|
|
212
229
|
blockNumber,
|
213
230
|
blockTag = "latest"
|
214
231
|
} = {}) {
|
215
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
232
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : void 0;
|
216
233
|
let count = null;
|
217
234
|
if (blockHash) {
|
218
235
|
count = await client.request({
|
@@ -225,13 +242,25 @@ async function getBlockTransactionCount(client, {
|
|
225
242
|
params: [blockNumberHex || blockTag]
|
226
243
|
});
|
227
244
|
}
|
228
|
-
return
|
245
|
+
return _chunkNXCI5KQCjs.hexToNumber.call(void 0, count);
|
246
|
+
}
|
247
|
+
|
248
|
+
// src/actions/public/getBytecode.ts
|
249
|
+
async function getBytecode(client, { address, blockNumber, blockTag = "latest" }) {
|
250
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : void 0;
|
251
|
+
const hex = await client.request({
|
252
|
+
method: "eth_getCode",
|
253
|
+
params: [address, blockNumberHex || blockTag]
|
254
|
+
});
|
255
|
+
if (hex === "0x")
|
256
|
+
return void 0;
|
257
|
+
return hex;
|
229
258
|
}
|
230
259
|
|
231
260
|
// src/actions/public/getChainId.ts
|
232
261
|
async function getChainId(client) {
|
233
262
|
const chainIdHex = await client.request({ method: "eth_chainId" });
|
234
|
-
return
|
263
|
+
return _chunkNXCI5KQCjs.hexToNumber.call(void 0, chainIdHex);
|
235
264
|
}
|
236
265
|
|
237
266
|
// src/actions/public/getFeeHistory.ts
|
@@ -241,16 +270,16 @@ async function getFeeHistory(client, {
|
|
241
270
|
blockTag = "latest",
|
242
271
|
rewardPercentiles
|
243
272
|
}) {
|
244
|
-
const blockNumberHex = blockNumber ?
|
273
|
+
const blockNumberHex = blockNumber ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : void 0;
|
245
274
|
const feeHistory = await client.request({
|
246
275
|
method: "eth_feeHistory",
|
247
276
|
params: [
|
248
|
-
|
277
|
+
_chunkNXCI5KQCjs.numberToHex.call(void 0, blockCount),
|
249
278
|
blockNumberHex || blockTag,
|
250
279
|
rewardPercentiles
|
251
280
|
]
|
252
281
|
});
|
253
|
-
return
|
282
|
+
return _chunkNXCI5KQCjs.formatFeeHistory.call(void 0, feeHistory);
|
254
283
|
}
|
255
284
|
|
256
285
|
// src/actions/public/getFilterChanges.ts
|
@@ -260,7 +289,7 @@ async function getFilterChanges(client, { filter }) {
|
|
260
289
|
params: [filter.id]
|
261
290
|
});
|
262
291
|
return logs.map(
|
263
|
-
(log) => typeof log === "string" ? log :
|
292
|
+
(log) => typeof log === "string" ? log : _chunkNXCI5KQCjs.formatLog.call(void 0, log)
|
264
293
|
);
|
265
294
|
}
|
266
295
|
|
@@ -270,7 +299,7 @@ async function getFilterLogs(client, { filter }) {
|
|
270
299
|
method: "eth_getFilterLogs",
|
271
300
|
params: [filter.id]
|
272
301
|
});
|
273
|
-
return logs.map(
|
302
|
+
return logs.map(_chunkNXCI5KQCjs.formatLog);
|
274
303
|
}
|
275
304
|
|
276
305
|
// src/actions/public/getGasPrice.ts
|
@@ -281,6 +310,95 @@ async function getGasPrice(client) {
|
|
281
310
|
return BigInt(gasPrice);
|
282
311
|
}
|
283
312
|
|
313
|
+
// src/actions/public/createEventFilter.ts
|
314
|
+
async function createEventFilter(client, {
|
315
|
+
address,
|
316
|
+
event,
|
317
|
+
args,
|
318
|
+
fromBlock,
|
319
|
+
toBlock
|
320
|
+
} = {}) {
|
321
|
+
let topics = [];
|
322
|
+
if (event)
|
323
|
+
topics = buildFilterTopics({ event, args });
|
324
|
+
const id = await client.request({
|
325
|
+
method: "eth_newFilter",
|
326
|
+
params: [
|
327
|
+
{
|
328
|
+
address,
|
329
|
+
fromBlock: typeof fromBlock === "bigint" ? _chunkNXCI5KQCjs.numberToHex.call(void 0, fromBlock) : fromBlock,
|
330
|
+
toBlock: typeof toBlock === "bigint" ? _chunkNXCI5KQCjs.numberToHex.call(void 0, toBlock) : toBlock,
|
331
|
+
...topics.length ? { topics } : {}
|
332
|
+
}
|
333
|
+
]
|
334
|
+
});
|
335
|
+
return { id, type: "event" };
|
336
|
+
}
|
337
|
+
function buildFilterTopics({
|
338
|
+
event,
|
339
|
+
args
|
340
|
+
}) {
|
341
|
+
const eventName = _chunkNXCI5KQCjs.extractFunctionName.call(void 0, event);
|
342
|
+
const abi = unstable_parseAbi(event);
|
343
|
+
return _chunkNXCI5KQCjs.encodeEventTopics.call(void 0, { abi, eventName, args });
|
344
|
+
}
|
345
|
+
function unstable_parseAbi(definition) {
|
346
|
+
const name = _chunkNXCI5KQCjs.extractFunctionName.call(void 0, definition);
|
347
|
+
const params = _chunkNXCI5KQCjs.extractFunctionParams.call(void 0, definition);
|
348
|
+
return [
|
349
|
+
{
|
350
|
+
type: "event",
|
351
|
+
name,
|
352
|
+
inputs: params || []
|
353
|
+
}
|
354
|
+
];
|
355
|
+
}
|
356
|
+
|
357
|
+
// src/actions/public/getLogs.ts
|
358
|
+
async function getLogs(client, {
|
359
|
+
address,
|
360
|
+
blockHash,
|
361
|
+
fromBlock,
|
362
|
+
toBlock,
|
363
|
+
event,
|
364
|
+
args
|
365
|
+
} = {}) {
|
366
|
+
let topics = [];
|
367
|
+
if (event) {
|
368
|
+
topics = buildFilterTopics({ event, args });
|
369
|
+
}
|
370
|
+
let logs;
|
371
|
+
if (blockHash) {
|
372
|
+
logs = await client.request({
|
373
|
+
method: "eth_getLogs",
|
374
|
+
params: [{ address, topics, blockHash }]
|
375
|
+
});
|
376
|
+
} else {
|
377
|
+
logs = await client.request({
|
378
|
+
method: "eth_getLogs",
|
379
|
+
params: [
|
380
|
+
{
|
381
|
+
address,
|
382
|
+
topics,
|
383
|
+
fromBlock: typeof fromBlock === "bigint" ? _chunkNXCI5KQCjs.numberToHex.call(void 0, fromBlock) : fromBlock,
|
384
|
+
toBlock: typeof toBlock === "bigint" ? _chunkNXCI5KQCjs.numberToHex.call(void 0, toBlock) : toBlock
|
385
|
+
}
|
386
|
+
]
|
387
|
+
});
|
388
|
+
}
|
389
|
+
return logs.map(_chunkNXCI5KQCjs.formatLog);
|
390
|
+
}
|
391
|
+
|
392
|
+
// src/actions/public/getStorageAt.ts
|
393
|
+
async function getStorageAt(client, { address, blockNumber, blockTag = "latest", slot }) {
|
394
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : void 0;
|
395
|
+
const data = await client.request({
|
396
|
+
method: "eth_getStorageAt",
|
397
|
+
params: [address, slot, blockNumberHex || blockTag]
|
398
|
+
});
|
399
|
+
return data;
|
400
|
+
}
|
401
|
+
|
284
402
|
// src/actions/public/getTransaction.ts
|
285
403
|
async function getTransaction(client, {
|
286
404
|
blockHash,
|
@@ -289,7 +407,7 @@ async function getTransaction(client, {
|
|
289
407
|
hash,
|
290
408
|
index
|
291
409
|
}) {
|
292
|
-
const blockNumberHex = blockNumber !== void 0 ?
|
410
|
+
const blockNumberHex = blockNumber !== void 0 ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : void 0;
|
293
411
|
let transaction = null;
|
294
412
|
if (hash) {
|
295
413
|
transaction = await client.request({
|
@@ -299,24 +417,24 @@ async function getTransaction(client, {
|
|
299
417
|
} else if (blockHash) {
|
300
418
|
transaction = await client.request({
|
301
419
|
method: "eth_getTransactionByBlockHashAndIndex",
|
302
|
-
params: [blockHash,
|
420
|
+
params: [blockHash, _chunkNXCI5KQCjs.numberToHex.call(void 0, index)]
|
303
421
|
});
|
304
422
|
} else if (blockNumberHex || blockTag) {
|
305
423
|
transaction = await client.request({
|
306
424
|
method: "eth_getTransactionByBlockNumberAndIndex",
|
307
|
-
params: [blockNumberHex || blockTag,
|
425
|
+
params: [blockNumberHex || blockTag, _chunkNXCI5KQCjs.numberToHex.call(void 0, index)]
|
308
426
|
});
|
309
427
|
}
|
310
428
|
if (!transaction)
|
311
|
-
throw new (0,
|
429
|
+
throw new (0, _chunkNXCI5KQCjs.TransactionNotFoundError)({
|
312
430
|
blockHash,
|
313
431
|
blockNumber,
|
314
432
|
blockTag,
|
315
433
|
hash,
|
316
434
|
index
|
317
435
|
});
|
318
|
-
return
|
319
|
-
formatter: _optionalChain([client, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.formatters, 'optionalAccess', _8 => _8.transaction]) ||
|
436
|
+
return _chunkNXCI5KQCjs.format.call(void 0, transaction, {
|
437
|
+
formatter: _optionalChain([client, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.formatters, 'optionalAccess', _8 => _8.transaction]) || _chunkNXCI5KQCjs.formatTransaction
|
320
438
|
});
|
321
439
|
}
|
322
440
|
|
@@ -336,9 +454,9 @@ async function getTransactionConfirmations(client, { hash, transactionReceipt })
|
|
336
454
|
async function getTransactionCount(client, { address, blockTag = "latest", blockNumber }) {
|
337
455
|
const count = await client.request({
|
338
456
|
method: "eth_getTransactionCount",
|
339
|
-
params: [address, blockNumber ?
|
457
|
+
params: [address, blockNumber ? _chunkNXCI5KQCjs.numberToHex.call(void 0, blockNumber) : blockTag]
|
340
458
|
});
|
341
|
-
return
|
459
|
+
return _chunkNXCI5KQCjs.hexToNumber.call(void 0, count);
|
342
460
|
}
|
343
461
|
|
344
462
|
// src/actions/public/getTransactionReceipt.ts
|
@@ -348,9 +466,120 @@ async function getTransactionReceipt(client, { hash }) {
|
|
348
466
|
params: [hash]
|
349
467
|
});
|
350
468
|
if (!receipt)
|
351
|
-
throw new (0,
|
352
|
-
return
|
353
|
-
formatter: _optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.formatters, 'optionalAccess', _13 => _13.transactionReceipt]) ||
|
469
|
+
throw new (0, _chunkNXCI5KQCjs.TransactionReceiptNotFoundError)({ hash });
|
470
|
+
return _chunkNXCI5KQCjs.format.call(void 0, receipt, {
|
471
|
+
formatter: _optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.formatters, 'optionalAccess', _13 => _13.transactionReceipt]) || _chunkNXCI5KQCjs.formatTransactionReceipt
|
472
|
+
});
|
473
|
+
}
|
474
|
+
|
475
|
+
// src/actions/public/readContract.ts
|
476
|
+
async function readContract(client, {
|
477
|
+
abi,
|
478
|
+
address,
|
479
|
+
args,
|
480
|
+
functionName,
|
481
|
+
...callRequest
|
482
|
+
}) {
|
483
|
+
const calldata = _chunkNXCI5KQCjs.encodeFunctionData.call(void 0, {
|
484
|
+
abi,
|
485
|
+
args,
|
486
|
+
functionName
|
487
|
+
});
|
488
|
+
try {
|
489
|
+
const { data } = await call(client, {
|
490
|
+
data: calldata,
|
491
|
+
to: address,
|
492
|
+
...callRequest
|
493
|
+
});
|
494
|
+
return _chunkNXCI5KQCjs.decodeFunctionResult.call(void 0, {
|
495
|
+
abi,
|
496
|
+
args,
|
497
|
+
functionName,
|
498
|
+
data: data || "0x"
|
499
|
+
});
|
500
|
+
} catch (err) {
|
501
|
+
throw _chunkNXCI5KQCjs.getContractError.call(void 0, err, {
|
502
|
+
abi,
|
503
|
+
address,
|
504
|
+
args,
|
505
|
+
docsPath: "/docs/contract/readContract",
|
506
|
+
functionName
|
507
|
+
});
|
508
|
+
}
|
509
|
+
}
|
510
|
+
|
511
|
+
// src/actions/public/multicall.ts
|
512
|
+
async function multicall(client, args) {
|
513
|
+
const {
|
514
|
+
allowFailure = true,
|
515
|
+
blockNumber,
|
516
|
+
blockTag,
|
517
|
+
contracts,
|
518
|
+
multicallAddress
|
519
|
+
} = args;
|
520
|
+
const calls = contracts.map(({ abi, address, args: args2, functionName }) => {
|
521
|
+
try {
|
522
|
+
const callData = _chunkNXCI5KQCjs.encodeFunctionData.call(void 0, {
|
523
|
+
abi,
|
524
|
+
args: args2,
|
525
|
+
functionName
|
526
|
+
});
|
527
|
+
return {
|
528
|
+
allowFailure: true,
|
529
|
+
callData,
|
530
|
+
target: address
|
531
|
+
};
|
532
|
+
} catch (err) {
|
533
|
+
const error = _chunkNXCI5KQCjs.getContractError.call(void 0, err, {
|
534
|
+
abi,
|
535
|
+
address,
|
536
|
+
args: args2,
|
537
|
+
docsPath: "/docs/contract/multicall",
|
538
|
+
functionName
|
539
|
+
});
|
540
|
+
if (!allowFailure)
|
541
|
+
throw error;
|
542
|
+
return {
|
543
|
+
allowFailure: true,
|
544
|
+
callData: "0x",
|
545
|
+
target: address
|
546
|
+
};
|
547
|
+
}
|
548
|
+
});
|
549
|
+
const results = await readContract(client, {
|
550
|
+
abi: _chunkNXCI5KQCjs.multicall3Abi,
|
551
|
+
address: multicallAddress,
|
552
|
+
args: [calls],
|
553
|
+
blockNumber,
|
554
|
+
blockTag,
|
555
|
+
functionName: "aggregate3"
|
556
|
+
});
|
557
|
+
return results.map(({ returnData, success }, i) => {
|
558
|
+
const { callData } = calls[i];
|
559
|
+
const { abi, address, functionName, args: args2 } = contracts[i];
|
560
|
+
try {
|
561
|
+
if (callData === "0x")
|
562
|
+
throw new (0, _chunkNXCI5KQCjs.AbiDecodingZeroDataError)();
|
563
|
+
if (!success)
|
564
|
+
throw new (0, _chunkNXCI5KQCjs.RawContractError)({ data: returnData });
|
565
|
+
const result = _chunkNXCI5KQCjs.decodeFunctionResult.call(void 0, {
|
566
|
+
abi,
|
567
|
+
data: returnData,
|
568
|
+
functionName
|
569
|
+
});
|
570
|
+
return { result, status: "success" };
|
571
|
+
} catch (err) {
|
572
|
+
const error = _chunkNXCI5KQCjs.getContractError.call(void 0, err, {
|
573
|
+
abi,
|
574
|
+
address,
|
575
|
+
args: args2,
|
576
|
+
docsPath: "/docs/contract/multicall",
|
577
|
+
functionName
|
578
|
+
});
|
579
|
+
if (!allowFailure)
|
580
|
+
throw error;
|
581
|
+
return { error, result: void 0, status: "failure" };
|
582
|
+
}
|
354
583
|
});
|
355
584
|
}
|
356
585
|
|
@@ -404,96 +633,32 @@ function observe(observerId, callbacks, fn) {
|
|
404
633
|
return unwatch;
|
405
634
|
}
|
406
635
|
|
407
|
-
// src/actions/public/
|
408
|
-
async function
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
636
|
+
// src/actions/public/createContractEventFilter.ts
|
637
|
+
async function createContractEventFilter(client, {
|
638
|
+
address,
|
639
|
+
abi,
|
640
|
+
args,
|
641
|
+
eventName,
|
642
|
+
fromBlock,
|
643
|
+
toBlock
|
414
644
|
}) {
|
415
|
-
const
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
);
|
429
|
-
const unobserve = observe(
|
430
|
-
observerId,
|
431
|
-
{ onReplaced, resolve, reject },
|
432
|
-
(emit) => {
|
433
|
-
const unwatch = watchBlockNumber(client, {
|
434
|
-
emitMissed: true,
|
435
|
-
emitOnBegin: true,
|
436
|
-
pollingInterval,
|
437
|
-
async onBlockNumber(blockNumber) {
|
438
|
-
const done = async (fn) => {
|
439
|
-
unwatch();
|
440
|
-
fn();
|
441
|
-
unobserve();
|
442
|
-
};
|
443
|
-
try {
|
444
|
-
if (receipt) {
|
445
|
-
if (blockNumber - receipt.blockNumber + 1n < confirmations)
|
446
|
-
return;
|
447
|
-
done(() => emit.resolve(receipt));
|
448
|
-
return;
|
449
|
-
}
|
450
|
-
transaction = await getTransaction(client, { hash });
|
451
|
-
receipt = await getTransactionReceipt(client, { hash });
|
452
|
-
if (blockNumber - receipt.blockNumber + 1n < confirmations)
|
453
|
-
return;
|
454
|
-
done(() => emit.resolve(receipt));
|
455
|
-
} catch (err) {
|
456
|
-
if (transaction && (err instanceof _chunk5ZBNF5WMjs.TransactionNotFoundError || err instanceof _chunk5ZBNF5WMjs.TransactionReceiptNotFoundError)) {
|
457
|
-
replacedTransaction = transaction;
|
458
|
-
const block = await getBlock(client, {
|
459
|
-
blockNumber,
|
460
|
-
includeTransactions: true
|
461
|
-
});
|
462
|
-
const replacementTransaction = block.transactions.find(
|
463
|
-
({ from, nonce }) => from === replacedTransaction.from && nonce === replacedTransaction.nonce
|
464
|
-
);
|
465
|
-
if (!replacementTransaction)
|
466
|
-
return;
|
467
|
-
receipt = await getTransactionReceipt(client, {
|
468
|
-
hash: replacementTransaction.hash
|
469
|
-
});
|
470
|
-
if (blockNumber - receipt.blockNumber + 1n < confirmations)
|
471
|
-
return;
|
472
|
-
let reason = "replaced";
|
473
|
-
if (replacementTransaction.to === replacedTransaction.to && replacementTransaction.value === replacedTransaction.value) {
|
474
|
-
reason = "repriced";
|
475
|
-
} else if (replacementTransaction.from === replacementTransaction.to && replacementTransaction.value === 0n) {
|
476
|
-
reason = "cancelled";
|
477
|
-
}
|
478
|
-
done(() => {
|
479
|
-
_optionalChain([emit, 'access', _17 => _17.onReplaced, 'optionalCall', _18 => _18({
|
480
|
-
reason,
|
481
|
-
replacedTransaction,
|
482
|
-
transaction: replacementTransaction,
|
483
|
-
transactionReceipt: receipt
|
484
|
-
})]);
|
485
|
-
emit.resolve(receipt);
|
486
|
-
});
|
487
|
-
} else {
|
488
|
-
done(() => emit.reject(err));
|
489
|
-
}
|
490
|
-
}
|
491
|
-
}
|
492
|
-
});
|
493
|
-
return unwatch;
|
645
|
+
const topics = eventName ? _chunkNXCI5KQCjs.encodeEventTopics.call(void 0, {
|
646
|
+
abi,
|
647
|
+
args,
|
648
|
+
eventName
|
649
|
+
}) : void 0;
|
650
|
+
const id = await client.request({
|
651
|
+
method: "eth_newFilter",
|
652
|
+
params: [
|
653
|
+
{
|
654
|
+
address,
|
655
|
+
fromBlock: typeof fromBlock === "bigint" ? _chunkNXCI5KQCjs.numberToHex.call(void 0, fromBlock) : fromBlock,
|
656
|
+
toBlock: typeof toBlock === "bigint" ? _chunkNXCI5KQCjs.numberToHex.call(void 0, toBlock) : toBlock,
|
657
|
+
topics
|
494
658
|
}
|
495
|
-
|
659
|
+
]
|
496
660
|
});
|
661
|
+
return { id, type: "event" };
|
497
662
|
}
|
498
663
|
|
499
664
|
// src/utils/poll.ts
|
@@ -504,13 +669,13 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
|
|
504
669
|
let data;
|
505
670
|
if (emitOnBegin)
|
506
671
|
data = await fn({ unpoll: unwatch });
|
507
|
-
const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall',
|
508
|
-
await
|
672
|
+
const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _17 => _17(data)]), async () => ( interval));
|
673
|
+
await _chunkNXCI5KQCjs.wait.call(void 0, initialWait);
|
509
674
|
const poll2 = async () => {
|
510
675
|
if (!active)
|
511
676
|
return;
|
512
677
|
await fn({ unpoll: unwatch });
|
513
|
-
await
|
678
|
+
await _chunkNXCI5KQCjs.wait.call(void 0, interval);
|
514
679
|
poll2();
|
515
680
|
};
|
516
681
|
poll2();
|
@@ -555,7 +720,7 @@ function watchBlockNumber(client, {
|
|
555
720
|
prevBlockNumber = blockNumber;
|
556
721
|
emit.onBlockNumber(blockNumber, prevBlockNumber);
|
557
722
|
} catch (err) {
|
558
|
-
_optionalChain([emit, 'access',
|
723
|
+
_optionalChain([emit, 'access', _18 => _18.onError, 'optionalCall', _19 => _19(err)]);
|
559
724
|
}
|
560
725
|
},
|
561
726
|
{
|
@@ -595,11 +760,11 @@ function watchBlocks(client, {
|
|
595
760
|
blockTag,
|
596
761
|
includeTransactions
|
597
762
|
});
|
598
|
-
if (block.number && _optionalChain([prevBlock, 'optionalAccess',
|
763
|
+
if (block.number && _optionalChain([prevBlock, 'optionalAccess', _20 => _20.number])) {
|
599
764
|
if (block.number === prevBlock.number)
|
600
765
|
return;
|
601
766
|
if (block.number - prevBlock.number > 1 && emitMissed) {
|
602
|
-
for (let i = _optionalChain([prevBlock, 'optionalAccess',
|
767
|
+
for (let i = _optionalChain([prevBlock, 'optionalAccess', _21 => _21.number]) + 1n; i < block.number; i++) {
|
603
768
|
const block2 = await getBlock(client, {
|
604
769
|
blockNumber: i,
|
605
770
|
includeTransactions
|
@@ -612,7 +777,7 @@ function watchBlocks(client, {
|
|
612
777
|
emit.onBlock(block, prevBlock);
|
613
778
|
prevBlock = block;
|
614
779
|
} catch (err) {
|
615
|
-
_optionalChain([emit, 'access',
|
780
|
+
_optionalChain([emit, 'access', _22 => _22.onError, 'optionalCall', _23 => _23(err)]);
|
616
781
|
}
|
617
782
|
},
|
618
783
|
{
|
@@ -623,40 +788,54 @@ function watchBlocks(client, {
|
|
623
788
|
);
|
624
789
|
}
|
625
790
|
|
626
|
-
// src/actions/public/
|
627
|
-
function
|
791
|
+
// src/actions/public/watchContractEvent.ts
|
792
|
+
function watchContractEvent(client, {
|
793
|
+
abi,
|
794
|
+
address,
|
795
|
+
args,
|
628
796
|
batch = true,
|
797
|
+
eventName,
|
629
798
|
onError,
|
630
|
-
|
799
|
+
onLogs,
|
631
800
|
pollingInterval = client.pollingInterval
|
632
801
|
}) {
|
633
802
|
const observerId = JSON.stringify([
|
634
|
-
"
|
635
|
-
|
803
|
+
"watchContractEvent",
|
804
|
+
address,
|
805
|
+
args,
|
636
806
|
batch,
|
807
|
+
client.uid,
|
808
|
+
eventName,
|
637
809
|
pollingInterval
|
638
810
|
]);
|
639
|
-
return observe(observerId, {
|
811
|
+
return observe(observerId, { onLogs, onError }, (emit) => {
|
640
812
|
let filter;
|
641
813
|
const unwatch = poll(
|
642
814
|
async () => {
|
643
815
|
try {
|
644
816
|
if (!filter) {
|
645
817
|
try {
|
646
|
-
filter = await
|
818
|
+
filter = await createContractEventFilter(client, {
|
819
|
+
abi,
|
820
|
+
address,
|
821
|
+
args,
|
822
|
+
eventName
|
823
|
+
});
|
647
824
|
return;
|
648
825
|
} catch (err) {
|
649
826
|
unwatch();
|
650
827
|
throw err;
|
651
828
|
}
|
652
829
|
}
|
653
|
-
const
|
830
|
+
const logs = await getFilterChanges(client, { filter });
|
831
|
+
if (logs.length === 0)
|
832
|
+
return;
|
654
833
|
if (batch)
|
655
|
-
emit.
|
834
|
+
emit.onLogs(logs);
|
656
835
|
else
|
657
|
-
|
836
|
+
logs.forEach((log) => emit.onLogs([log]));
|
658
837
|
} catch (err) {
|
659
|
-
_optionalChain([emit, 'access',
|
838
|
+
_optionalChain([emit, 'access', _24 => _24.onError, 'optionalCall', _25 => _25(err)]);
|
660
839
|
}
|
661
840
|
},
|
662
841
|
{
|
@@ -672,352 +851,208 @@ function watchPendingTransactions(client, {
|
|
672
851
|
});
|
673
852
|
}
|
674
853
|
|
675
|
-
// src/actions/
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
})
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
}
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
return await client.request({
|
734
|
-
method: `${client.mode}_mine`,
|
735
|
-
params: [_chunk5ZBNF5WMjs.numberToHex.call(void 0, blocks), _chunk5ZBNF5WMjs.numberToHex.call(void 0, interval || 0)]
|
736
|
-
});
|
737
|
-
}
|
738
|
-
|
739
|
-
// src/actions/test/removeBlockTimestampInterval.ts
|
740
|
-
async function removeBlockTimestampInterval(client) {
|
741
|
-
return await client.request({
|
742
|
-
method: `${client.mode}_removeBlockTimestampInterval`
|
854
|
+
// src/actions/public/watchEvent.ts
|
855
|
+
function watchEvent(client, {
|
856
|
+
address,
|
857
|
+
args,
|
858
|
+
batch = true,
|
859
|
+
event,
|
860
|
+
onError,
|
861
|
+
onLogs,
|
862
|
+
pollingInterval = client.pollingInterval
|
863
|
+
}) {
|
864
|
+
const observerId = JSON.stringify([
|
865
|
+
"watchEvent",
|
866
|
+
address,
|
867
|
+
args,
|
868
|
+
batch,
|
869
|
+
client.uid,
|
870
|
+
event,
|
871
|
+
pollingInterval
|
872
|
+
]);
|
873
|
+
return observe(observerId, { onLogs, onError }, (emit) => {
|
874
|
+
let filter;
|
875
|
+
const unwatch = poll(
|
876
|
+
async () => {
|
877
|
+
try {
|
878
|
+
if (!filter) {
|
879
|
+
try {
|
880
|
+
filter = await createEventFilter(client, {
|
881
|
+
address,
|
882
|
+
args,
|
883
|
+
event
|
884
|
+
});
|
885
|
+
return;
|
886
|
+
} catch (err) {
|
887
|
+
unwatch();
|
888
|
+
throw err;
|
889
|
+
}
|
890
|
+
}
|
891
|
+
const logs = await getFilterChanges(client, { filter });
|
892
|
+
if (logs.length === 0)
|
893
|
+
return;
|
894
|
+
if (batch)
|
895
|
+
emit.onLogs(logs);
|
896
|
+
else
|
897
|
+
logs.forEach((log) => emit.onLogs([log]));
|
898
|
+
} catch (err) {
|
899
|
+
_optionalChain([emit, 'access', _26 => _26.onError, 'optionalCall', _27 => _27(err)]);
|
900
|
+
}
|
901
|
+
},
|
902
|
+
{
|
903
|
+
emitOnBegin: true,
|
904
|
+
interval: pollingInterval
|
905
|
+
}
|
906
|
+
);
|
907
|
+
return async () => {
|
908
|
+
if (filter)
|
909
|
+
await uninstallFilter(client, { filter });
|
910
|
+
unwatch();
|
911
|
+
};
|
743
912
|
});
|
744
913
|
}
|
745
914
|
|
746
|
-
// src/actions/
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
}
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
})
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
params: [address, _chunk5ZBNF5WMjs.numberToHex.call(void 0, value)]
|
785
|
-
});
|
786
|
-
}
|
787
|
-
|
788
|
-
// src/actions/test/setBlockGasLimit.ts
|
789
|
-
async function setBlockGasLimit(client, { gasLimit }) {
|
790
|
-
return await client.request({
|
791
|
-
method: "evm_setBlockGasLimit",
|
792
|
-
params: [_chunk5ZBNF5WMjs.numberToHex.call(void 0, gasLimit)]
|
793
|
-
});
|
794
|
-
}
|
795
|
-
|
796
|
-
// src/actions/test/setBlockTimestampInterval.ts
|
797
|
-
async function setBlockTimestampInterval(client, { interval }) {
|
798
|
-
return await client.request({
|
799
|
-
method: `${client.mode}_setBlockTimestampInterval`,
|
800
|
-
params: [interval]
|
801
|
-
});
|
802
|
-
}
|
803
|
-
|
804
|
-
// src/actions/test/setCode.ts
|
805
|
-
async function setCode(client, { address, bytecode }) {
|
806
|
-
return await client.request({
|
807
|
-
method: `${client.mode}_setCode`,
|
808
|
-
params: [address, bytecode]
|
809
|
-
});
|
810
|
-
}
|
811
|
-
|
812
|
-
// src/actions/test/setCoinbase.ts
|
813
|
-
async function setCoinbase(client, { address }) {
|
814
|
-
return await client.request({
|
815
|
-
method: `${client.mode}_setCoinbase`,
|
816
|
-
params: [address]
|
817
|
-
});
|
818
|
-
}
|
819
|
-
|
820
|
-
// src/actions/test/setIntervalMining.ts
|
821
|
-
async function setIntervalMining(client, { interval }) {
|
822
|
-
return await client.request({
|
823
|
-
method: "evm_setIntervalMining",
|
824
|
-
params: [interval]
|
825
|
-
});
|
826
|
-
}
|
827
|
-
|
828
|
-
// src/actions/test/setLoggingEnabled.ts
|
829
|
-
async function setLoggingEnabled(client, enabled) {
|
830
|
-
return await client.request({
|
831
|
-
method: `${client.mode}_setLoggingEnabled`,
|
832
|
-
params: [enabled]
|
833
|
-
});
|
834
|
-
}
|
835
|
-
|
836
|
-
// src/actions/test/setMinGasPrice.ts
|
837
|
-
async function setMinGasPrice(client, { gasPrice }) {
|
838
|
-
return await client.request({
|
839
|
-
method: `${client.mode}_setMinGasPrice`,
|
840
|
-
params: [_chunk5ZBNF5WMjs.numberToHex.call(void 0, gasPrice)]
|
841
|
-
});
|
842
|
-
}
|
843
|
-
|
844
|
-
// src/actions/test/setNextBlockBaseFeePerGas.ts
|
845
|
-
async function setNextBlockBaseFeePerGas(client, { baseFeePerGas }) {
|
846
|
-
return await client.request({
|
847
|
-
method: `${client.mode}_setNextBlockBaseFeePerGas`,
|
848
|
-
params: [_chunk5ZBNF5WMjs.numberToHex.call(void 0, baseFeePerGas)]
|
849
|
-
});
|
850
|
-
}
|
851
|
-
|
852
|
-
// src/actions/test/setNextBlockTimestamp.ts
|
853
|
-
async function setNextBlockTimestamp(client, { timestamp }) {
|
854
|
-
return await client.request({
|
855
|
-
method: "evm_setNextBlockTimestamp",
|
856
|
-
params: [_chunk5ZBNF5WMjs.numberToHex.call(void 0, timestamp)]
|
857
|
-
});
|
858
|
-
}
|
859
|
-
|
860
|
-
// src/actions/test/setNonce.ts
|
861
|
-
async function setNonce(client, { address, nonce }) {
|
862
|
-
return await client.request({
|
863
|
-
method: `${client.mode}_setNonce`,
|
864
|
-
params: [address, _chunk5ZBNF5WMjs.numberToHex.call(void 0, nonce)]
|
865
|
-
});
|
866
|
-
}
|
867
|
-
|
868
|
-
// src/actions/test/setStorageAt.ts
|
869
|
-
async function setStorageAt(client, { address, index, value }) {
|
870
|
-
return await client.request({
|
871
|
-
method: `${client.mode}_setStorageAt`,
|
872
|
-
params: [
|
873
|
-
address,
|
874
|
-
typeof index === "number" ? _chunk5ZBNF5WMjs.numberToHex.call(void 0, index) : index,
|
875
|
-
value
|
876
|
-
]
|
877
|
-
});
|
878
|
-
}
|
879
|
-
|
880
|
-
// src/actions/test/snapshot.ts
|
881
|
-
async function snapshot(client) {
|
882
|
-
return await client.request({
|
883
|
-
method: "evm_snapshot"
|
884
|
-
});
|
885
|
-
}
|
886
|
-
|
887
|
-
// src/actions/test/stopImpersonatingAccount.ts
|
888
|
-
async function stopImpersonatingAccount(client, { address }) {
|
889
|
-
return await client.request({
|
890
|
-
method: `${client.mode}_stopImpersonatingAccount`,
|
891
|
-
params: [address]
|
892
|
-
});
|
893
|
-
}
|
894
|
-
|
895
|
-
// src/actions/wallet/addChain.ts
|
896
|
-
async function addChain(client, chain) {
|
897
|
-
const { id, name, nativeCurrency, rpcUrls, blockExplorers } = chain;
|
898
|
-
await client.request({
|
899
|
-
method: "wallet_addEthereumChain",
|
900
|
-
params: [
|
915
|
+
// src/actions/public/watchPendingTransactions.ts
|
916
|
+
function watchPendingTransactions(client, {
|
917
|
+
batch = true,
|
918
|
+
onError,
|
919
|
+
onTransactions,
|
920
|
+
pollingInterval = client.pollingInterval
|
921
|
+
}) {
|
922
|
+
const observerId = JSON.stringify([
|
923
|
+
"watchPendingTransactions",
|
924
|
+
client.uid,
|
925
|
+
batch,
|
926
|
+
pollingInterval
|
927
|
+
]);
|
928
|
+
return observe(observerId, { onTransactions, onError }, (emit) => {
|
929
|
+
let filter;
|
930
|
+
const unwatch = poll(
|
931
|
+
async () => {
|
932
|
+
try {
|
933
|
+
if (!filter) {
|
934
|
+
try {
|
935
|
+
filter = await createPendingTransactionFilter(client);
|
936
|
+
return;
|
937
|
+
} catch (err) {
|
938
|
+
unwatch();
|
939
|
+
throw err;
|
940
|
+
}
|
941
|
+
}
|
942
|
+
const hashes = await getFilterChanges(client, { filter });
|
943
|
+
if (hashes.length === 0)
|
944
|
+
return;
|
945
|
+
if (batch)
|
946
|
+
emit.onTransactions(hashes);
|
947
|
+
else
|
948
|
+
hashes.forEach((hash) => emit.onTransactions([hash]));
|
949
|
+
} catch (err) {
|
950
|
+
_optionalChain([emit, 'access', _28 => _28.onError, 'optionalCall', _29 => _29(err)]);
|
951
|
+
}
|
952
|
+
},
|
901
953
|
{
|
902
|
-
|
903
|
-
|
904
|
-
nativeCurrency,
|
905
|
-
rpcUrls: rpcUrls.default.http,
|
906
|
-
blockExplorerUrls: blockExplorers ? Object.values(blockExplorers).map(({ url }) => url) : void 0
|
954
|
+
emitOnBegin: true,
|
955
|
+
interval: pollingInterval
|
907
956
|
}
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
const addresses = await client.request({ method: "eth_accounts" });
|
915
|
-
return addresses.map((address) => _chunk5ZBNF5WMjs.checksumAddress.call(void 0, address));
|
916
|
-
}
|
917
|
-
|
918
|
-
// src/actions/wallet/getPermissions.ts
|
919
|
-
async function getPermissions(client) {
|
920
|
-
const permissions = await client.request({ method: "wallet_getPermissions" });
|
921
|
-
return permissions;
|
922
|
-
}
|
923
|
-
|
924
|
-
// src/actions/wallet/requestAccounts.ts
|
925
|
-
async function requestAccounts(client) {
|
926
|
-
const addresses = await client.request({ method: "eth_requestAccounts" });
|
927
|
-
return addresses.map((address) => _chunk5ZBNF5WMjs.getAddress.call(void 0, address));
|
928
|
-
}
|
929
|
-
|
930
|
-
// src/actions/wallet/requestPermissions.ts
|
931
|
-
async function requestPermissions(client, permissions) {
|
932
|
-
return client.request({
|
933
|
-
method: "wallet_requestPermissions",
|
934
|
-
params: [permissions]
|
957
|
+
);
|
958
|
+
return async () => {
|
959
|
+
if (filter)
|
960
|
+
await uninstallFilter(client, { filter });
|
961
|
+
unwatch();
|
962
|
+
};
|
935
963
|
});
|
936
964
|
}
|
937
965
|
|
938
|
-
// src/actions/
|
939
|
-
async function
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
gasPrice,
|
946
|
-
maxFeePerGas,
|
947
|
-
maxPriorityFeePerGas,
|
948
|
-
nonce,
|
949
|
-
to,
|
950
|
-
value,
|
951
|
-
...rest
|
966
|
+
// src/actions/public/waitForTransactionReceipt.ts
|
967
|
+
async function waitForTransactionReceipt(client, {
|
968
|
+
confirmations = 1,
|
969
|
+
hash,
|
970
|
+
onReplaced,
|
971
|
+
pollingInterval = client.pollingInterval,
|
972
|
+
timeout
|
952
973
|
}) {
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
value,
|
967
|
-
...rest
|
968
|
-
},
|
969
|
-
{
|
970
|
-
formatter: _optionalChain([chain, 'optionalAccess', _28 => _28.formatters, 'optionalAccess', _29 => _29.transactionRequest]) || _chunk5ZBNF5WMjs.formatTransactionRequest
|
971
|
-
}
|
972
|
-
);
|
973
|
-
const hash = await client.request({
|
974
|
-
method: "eth_sendTransaction",
|
975
|
-
params: [request_]
|
976
|
-
});
|
977
|
-
return hash;
|
978
|
-
}
|
979
|
-
|
980
|
-
// src/actions/wallet/signMessage.ts
|
981
|
-
async function signMessage(client, { from, data: data_ }) {
|
982
|
-
let data;
|
983
|
-
if (typeof data_ === "string") {
|
984
|
-
if (!data_.startsWith("0x"))
|
985
|
-
throw new (0, _chunk5ZBNF5WMjs.BaseError)(
|
986
|
-
`data ("${data_}") must be a hex value. Encode it first to a hex with the \`encodeHex\` util.`,
|
987
|
-
{
|
988
|
-
docsPath: "/TODO"
|
989
|
-
}
|
974
|
+
const observerId = JSON.stringify([
|
975
|
+
"waitForTransactionReceipt",
|
976
|
+
client.uid,
|
977
|
+
hash
|
978
|
+
]);
|
979
|
+
let transaction;
|
980
|
+
let replacedTransaction;
|
981
|
+
let receipt;
|
982
|
+
return new Promise((resolve, reject) => {
|
983
|
+
if (timeout)
|
984
|
+
setTimeout(
|
985
|
+
() => reject(new (0, _chunkNXCI5KQCjs.WaitForTransactionReceiptTimeoutError)({ hash })),
|
986
|
+
timeout
|
990
987
|
);
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
988
|
+
const unobserve = observe(
|
989
|
+
observerId,
|
990
|
+
{ onReplaced, resolve, reject },
|
991
|
+
(emit) => {
|
992
|
+
const unwatch = watchBlockNumber(client, {
|
993
|
+
emitMissed: true,
|
994
|
+
emitOnBegin: true,
|
995
|
+
pollingInterval,
|
996
|
+
async onBlockNumber(blockNumber) {
|
997
|
+
const done = async (fn) => {
|
998
|
+
unwatch();
|
999
|
+
fn();
|
1000
|
+
unobserve();
|
1001
|
+
};
|
1002
|
+
try {
|
1003
|
+
if (receipt) {
|
1004
|
+
if (blockNumber - receipt.blockNumber + 1n < confirmations)
|
1005
|
+
return;
|
1006
|
+
done(() => emit.resolve(receipt));
|
1007
|
+
return;
|
1008
|
+
}
|
1009
|
+
transaction = await getTransaction(client, { hash });
|
1010
|
+
receipt = await getTransactionReceipt(client, { hash });
|
1011
|
+
if (blockNumber - receipt.blockNumber + 1n < confirmations)
|
1012
|
+
return;
|
1013
|
+
done(() => emit.resolve(receipt));
|
1014
|
+
} catch (err) {
|
1015
|
+
if (transaction && (err instanceof _chunkNXCI5KQCjs.TransactionNotFoundError || err instanceof _chunkNXCI5KQCjs.TransactionReceiptNotFoundError)) {
|
1016
|
+
replacedTransaction = transaction;
|
1017
|
+
const block = await getBlock(client, {
|
1018
|
+
blockNumber,
|
1019
|
+
includeTransactions: true
|
1020
|
+
});
|
1021
|
+
const replacementTransaction = block.transactions.find(
|
1022
|
+
({ from, nonce }) => from === replacedTransaction.from && nonce === replacedTransaction.nonce
|
1023
|
+
);
|
1024
|
+
if (!replacementTransaction)
|
1025
|
+
return;
|
1026
|
+
receipt = await getTransactionReceipt(client, {
|
1027
|
+
hash: replacementTransaction.hash
|
1028
|
+
});
|
1029
|
+
if (blockNumber - receipt.blockNumber + 1n < confirmations)
|
1030
|
+
return;
|
1031
|
+
let reason = "replaced";
|
1032
|
+
if (replacementTransaction.to === replacedTransaction.to && replacementTransaction.value === replacedTransaction.value) {
|
1033
|
+
reason = "repriced";
|
1034
|
+
} else if (replacementTransaction.from === replacementTransaction.to && replacementTransaction.value === 0n) {
|
1035
|
+
reason = "cancelled";
|
1036
|
+
}
|
1037
|
+
done(() => {
|
1038
|
+
_optionalChain([emit, 'access', _30 => _30.onReplaced, 'optionalCall', _31 => _31({
|
1039
|
+
reason,
|
1040
|
+
replacedTransaction,
|
1041
|
+
transaction: replacementTransaction,
|
1042
|
+
transactionReceipt: receipt
|
1043
|
+
})]);
|
1044
|
+
emit.resolve(receipt);
|
1045
|
+
});
|
1046
|
+
} else {
|
1047
|
+
done(() => emit.reject(err));
|
1048
|
+
}
|
1049
|
+
}
|
1050
|
+
}
|
1051
|
+
});
|
1052
|
+
return unwatch;
|
1009
1053
|
}
|
1010
|
-
|
1011
|
-
});
|
1012
|
-
}
|
1013
|
-
|
1014
|
-
// src/actions/wallet/watchAsset.ts
|
1015
|
-
async function watchAsset(client, params) {
|
1016
|
-
const added = await client.request({
|
1017
|
-
method: "wallet_watchAsset",
|
1018
|
-
params: [params]
|
1054
|
+
);
|
1019
1055
|
});
|
1020
|
-
return added;
|
1021
1056
|
}
|
1022
1057
|
|
1023
1058
|
|
@@ -1052,33 +1087,5 @@ async function watchAsset(client, params) {
|
|
1052
1087
|
|
1053
1088
|
|
1054
1089
|
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
exports.call = call; exports.callContract = callContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.estimateGas = estimateGas; exports.getBalance = getBalance; exports.getBlock = getBlock; exports.getBlockNumberCache = getBlockNumberCache; exports.getBlockNumber = getBlockNumber; exports.getBlockTransactionCount = getBlockTransactionCount; exports.getChainId = getChainId; exports.getFeeHistory = getFeeHistory; exports.getFilterChanges = getFilterChanges; exports.getFilterLogs = getFilterLogs; exports.getGasPrice = getGasPrice; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchPendingTransactions = watchPendingTransactions; exports.dropTransaction = dropTransaction; exports.getAutomine = getAutomine; exports.getTxpoolContent = getTxpoolContent; exports.getTxpoolStatus = getTxpoolStatus; exports.impersonateAccount = impersonateAccount; exports.increaseTime = increaseTime; exports.inspectTxpool = inspectTxpool; exports.mine = mine; exports.removeBlockTimestampInterval = removeBlockTimestampInterval; exports.reset = reset; exports.revert = revert; exports.sendUnsignedTransaction = sendUnsignedTransaction; exports.setAutomine = setAutomine; exports.setBalance = setBalance; exports.setBlockGasLimit = setBlockGasLimit; exports.setBlockTimestampInterval = setBlockTimestampInterval; exports.setCode = setCode; exports.setCoinbase = setCoinbase; exports.setIntervalMining = setIntervalMining; exports.setLoggingEnabled = setLoggingEnabled; exports.setMinGasPrice = setMinGasPrice; exports.setNextBlockBaseFeePerGas = setNextBlockBaseFeePerGas; exports.setNextBlockTimestamp = setNextBlockTimestamp; exports.setNonce = setNonce; exports.setStorageAt = setStorageAt; exports.snapshot = snapshot; exports.stopImpersonatingAccount = stopImpersonatingAccount; exports.addChain = addChain; exports.getAccounts = getAccounts; exports.getPermissions = getPermissions; exports.requestAccounts = requestAccounts; exports.requestPermissions = requestPermissions; exports.sendTransaction = sendTransaction; exports.signMessage = signMessage; exports.switchChain = switchChain; exports.watchAsset = watchAsset;
|
1090
|
+
exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.estimateGas = estimateGas; exports.getBalance = getBalance; exports.getBlock = getBlock; exports.getBlockNumberCache = getBlockNumberCache; exports.getBlockNumber = getBlockNumber; exports.getBlockTransactionCount = getBlockTransactionCount; exports.getBytecode = getBytecode; exports.getChainId = getChainId; exports.getFeeHistory = getFeeHistory; exports.getFilterChanges = getFilterChanges; exports.getFilterLogs = getFilterLogs; exports.getGasPrice = getGasPrice; exports.getLogs = getLogs; exports.getStorageAt = getStorageAt; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.multicall = multicall; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchContractEvent = watchContractEvent; exports.watchEvent = watchEvent; exports.watchPendingTransactions = watchPendingTransactions;
|
1091
|
+
//# sourceMappingURL=chunk-UTL6F7UN.js.map
|