viem 0.0.1-alpha.2 → 0.0.1-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chains/package.json +1 -1
- package/clients/package.json +1 -1
- package/dist/{rpc-655c0ba4.d.ts → chain-32f56cfa.d.ts} +78 -17
- package/dist/chain-f12cdc7f.d.ts +5 -0
- package/dist/chains.d.ts +1291 -74
- package/dist/chains.js +125 -129
- package/dist/chains.js.map +1 -0
- package/dist/chains.mjs +129 -0
- package/dist/chains.mjs.map +1 -0
- package/dist/{chunk-YQRTXQ2G.js → chunk-46BO7YAQ.mjs} +3 -15
- package/dist/chunk-46BO7YAQ.mjs.map +1 -0
- package/dist/chunk-57ZOFERP.mjs +256 -0
- package/dist/chunk-57ZOFERP.mjs.map +1 -0
- package/dist/{chunk-3EOU525X.js → chunk-62VTYU2V.mjs} +1207 -564
- package/dist/chunk-62VTYU2V.mjs.map +1 -0
- package/dist/{chunk-4HNVS7AM.js → chunk-DGO77E2H.mjs} +330 -539
- package/dist/chunk-DGO77E2H.mjs.map +1 -0
- package/dist/chunk-DSPMAIDO.mjs +176 -0
- package/dist/chunk-DSPMAIDO.mjs.map +1 -0
- package/dist/chunk-EC3NUIJE.js +176 -0
- package/dist/chunk-EC3NUIJE.js.map +1 -0
- package/dist/chunk-KEHGSYDO.js +259 -0
- package/dist/chunk-KEHGSYDO.js.map +1 -0
- package/dist/chunk-KZMJR27B.js +889 -0
- package/dist/chunk-KZMJR27B.js.map +1 -0
- package/dist/chunk-O2GYLJVD.js +2689 -0
- package/dist/chunk-O2GYLJVD.js.map +1 -0
- package/dist/chunk-W7BWWAC4.js +256 -0
- package/dist/chunk-W7BWWAC4.js.map +1 -0
- package/dist/clients/index.d.ts +8 -7
- package/dist/clients/index.js +24 -25
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/index.mjs +24 -0
- package/dist/clients/index.mjs.map +1 -0
- package/dist/contract-9af4608b.d.ts +142 -0
- package/dist/createClient-5d316c7e.d.ts +62 -0
- package/dist/createPublicClient-9d2b42e1.d.ts +19 -0
- package/dist/createTestClient-79498dab.d.ts +34 -0
- package/dist/createWalletClient-f69a5230.d.ts +30 -0
- package/dist/{eip1193-8f7c22ce.d.ts → eip1193-6c485d63.d.ts} +13 -10
- package/dist/index.d.ts +424 -11
- package/dist/index.js +395 -292
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +395 -0
- package/dist/index.mjs.map +1 -0
- package/dist/{parseGwei-fd7a0f7d.d.ts → parseGwei-4308ad80.d.ts} +82 -139
- package/dist/public.d.ts +11 -0
- package/dist/public.js +59 -0
- package/dist/public.js.map +1 -0
- package/dist/public.mjs +59 -0
- package/dist/public.mjs.map +1 -0
- package/dist/{rpc-3c0e3985.d.ts → rpc-26932bae.d.ts} +1 -38
- package/dist/sendTransaction-1c8290a9.d.ts +12 -0
- package/dist/stopImpersonatingAccount-7781842a.d.ts +156 -0
- package/dist/test.d.ts +6 -0
- package/dist/test.js +60 -0
- package/dist/test.js.map +1 -0
- package/dist/test.mjs +60 -0
- package/dist/test.mjs.map +1 -0
- package/dist/transactionRequest-341b6ed2.d.ts +15 -0
- package/dist/utils/index.d.ts +51 -8
- package/dist/utils/index.js +171 -156
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +171 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/wallet.d.ts +8 -0
- package/dist/wallet.js +24 -0
- package/dist/wallet.js.map +1 -0
- package/dist/wallet.mjs +24 -0
- package/dist/wallet.mjs.map +1 -0
- package/dist/watchAsset-afaad3c7.d.ts +38 -0
- package/dist/{watchAsset-04ab8db5.d.ts → watchPendingTransactions-3b722547.d.ts} +67 -217
- package/dist/{webSocket-c6e0d26f.d.ts → webSocket-b180e679.d.ts} +4 -9
- package/dist/window.d.ts +3 -2
- package/dist/window.js +1 -0
- package/dist/window.js.map +1 -0
- package/dist/window.mjs +1 -0
- package/dist/window.mjs.map +1 -0
- package/package.json +30 -66
- package/src/_test/abis.ts +1413 -0
- package/src/_test/bench.ts +15 -0
- package/src/_test/constants.ts +60 -0
- package/src/_test/globalSetup.ts +11 -0
- package/src/_test/index.ts +23 -0
- package/src/_test/setup.ts +8 -0
- package/src/_test/utils.ts +112 -0
- package/src/actions/index.test.ts +78 -0
- package/src/actions/index.ts +174 -0
- package/src/actions/public/call.bench.ts +48 -0
- package/src/actions/public/call.test.ts +99 -0
- package/src/actions/public/call.ts +97 -0
- package/src/actions/public/createBlockFilter.bench.ts +11 -0
- package/src/actions/public/createBlockFilter.test.ts +9 -0
- package/src/actions/public/createBlockFilter.ts +14 -0
- package/src/actions/public/createContractEventFilter.test.ts +119 -0
- package/src/actions/public/createContractEventFilter.ts +69 -0
- package/src/actions/public/createEventFilter.test.ts +245 -0
- package/src/actions/public/createEventFilter.ts +76 -0
- package/src/actions/public/createPendingTransactionFilter.bench.ts +11 -0
- package/src/actions/public/createPendingTransactionFilter.test.ts +9 -0
- package/src/actions/public/createPendingTransactionFilter.ts +14 -0
- package/src/actions/public/deployContract.test.ts +56 -0
- package/src/actions/public/deployContract.ts +38 -0
- package/src/actions/public/estimateGas.bench.ts +46 -0
- package/src/actions/public/estimateGas.test.ts +92 -0
- package/src/actions/public/estimateGas.ts +61 -0
- package/src/actions/public/getBalance.test.ts +83 -0
- package/src/actions/public/getBalance.ts +37 -0
- package/src/actions/public/getBlock.bench.ts +28 -0
- package/src/actions/public/getBlock.test.ts +575 -0
- package/src/actions/public/getBlock.ts +65 -0
- package/src/actions/public/getBlockNumber.bench.ts +28 -0
- package/src/actions/public/getBlockNumber.test.ts +27 -0
- package/src/actions/public/getBlockNumber.ts +32 -0
- package/src/actions/public/getBlockTransactionCount.bench.ts +15 -0
- package/src/actions/public/getBlockTransactionCount.test.ts +57 -0
- package/src/actions/public/getBlockTransactionCount.ts +52 -0
- package/src/actions/public/getBytecode.test.ts +27 -0
- package/src/actions/public/getBytecode.ts +32 -0
- package/src/actions/public/getChainId.bench.ts +15 -0
- package/src/actions/public/getChainId.test.ts +8 -0
- package/src/actions/public/getChainId.ts +7 -0
- package/src/actions/public/getFeeHistory.bench.ts +18 -0
- package/src/actions/public/getFeeHistory.test.ts +137 -0
- package/src/actions/public/getFeeHistory.ts +44 -0
- package/src/actions/public/getFilterChanges.bench.ts +13 -0
- package/src/actions/public/getFilterChanges.test.ts +189 -0
- package/src/actions/public/getFilterChanges.ts +23 -0
- package/src/actions/public/getFilterLogs.test.ts +104 -0
- package/src/actions/public/getFilterLogs.ts +20 -0
- package/src/actions/public/getGasPrice.bench.ts +28 -0
- package/src/actions/public/getGasPrice.test.ts +8 -0
- package/src/actions/public/getGasPrice.ts +15 -0
- package/src/actions/public/getLogs.test.ts +107 -0
- package/src/actions/public/getLogs.ts +84 -0
- package/src/actions/public/getStorageAt.test.ts +34 -0
- package/src/actions/public/getStorageAt.ts +32 -0
- package/src/actions/public/getTransaction.bench.ts +33 -0
- package/src/actions/public/getTransaction.test.ts +311 -0
- package/src/actions/public/getTransaction.ts +95 -0
- package/src/actions/public/getTransactionConfirmations.test.ts +69 -0
- package/src/actions/public/getTransactionConfirmations.ts +38 -0
- package/src/actions/public/getTransactionCount.test.ts +56 -0
- package/src/actions/public/getTransactionCount.ts +34 -0
- package/src/actions/public/getTransactionReceipt.bench.ts +33 -0
- package/src/actions/public/getTransactionReceipt.test.ts +179 -0
- package/src/actions/public/getTransactionReceipt.ts +34 -0
- package/src/actions/public/index.test.ts +43 -0
- package/src/actions/public/index.ts +149 -0
- package/src/actions/public/readContract.test.ts +128 -0
- package/src/actions/public/readContract.ts +87 -0
- package/src/actions/public/simulateContract.bench.ts +31 -0
- package/src/actions/public/simulateContract.test.ts +238 -0
- package/src/actions/public/simulateContract.ts +98 -0
- package/src/actions/public/uninstallFilter.bench.ts +13 -0
- package/src/actions/public/uninstallFilter.test.ts +65 -0
- package/src/actions/public/uninstallFilter.ts +17 -0
- package/src/actions/public/waitForTransactionReceipt.test.ts +322 -0
- package/src/actions/public/waitForTransactionReceipt.ts +170 -0
- package/src/actions/public/watchBlockNumber.test.ts +166 -0
- package/src/actions/public/watchBlockNumber.ts +79 -0
- package/src/actions/public/watchBlocks.test.ts +210 -0
- package/src/actions/public/watchBlocks.ts +114 -0
- package/src/actions/public/watchContractEvent.test.ts +301 -0
- package/src/actions/public/watchContractEvent.ts +108 -0
- package/src/actions/public/watchEvent.test.ts +190 -0
- package/src/actions/public/watchEvent.ts +95 -0
- package/src/actions/public/watchPendingTransactions.test.ts +116 -0
- package/src/actions/public/watchPendingTransactions.ts +74 -0
- package/src/actions/test/dropTransaction.test.ts +34 -0
- package/src/actions/test/dropTransaction.ts +17 -0
- package/src/actions/test/getAutomine.test.ts +14 -0
- package/src/actions/test/getAutomine.ts +11 -0
- package/src/actions/test/getTxpoolContent.test.ts +45 -0
- package/src/actions/test/getTxpoolContent.ts +7 -0
- package/src/actions/test/getTxpoolStatus.test.ts +41 -0
- package/src/actions/test/getTxpoolStatus.ts +12 -0
- package/src/actions/test/impersonateAccount.test.ts +28 -0
- package/src/actions/test/impersonateAccount.ts +17 -0
- package/src/actions/test/increaseTime.test.ts +18 -0
- package/src/actions/test/increaseTime.ts +17 -0
- package/src/actions/test/index.test.ts +38 -0
- package/src/actions/test/index.ts +77 -0
- package/src/actions/test/inspectTxpool.test.ts +50 -0
- package/src/actions/test/inspectTxpool.ts +7 -0
- package/src/actions/test/mine.test.ts +20 -0
- package/src/actions/test/mine.ts +16 -0
- package/src/actions/test/removeBlockTimestampInterval.test.ts +23 -0
- package/src/actions/test/removeBlockTimestampInterval.ts +7 -0
- package/src/actions/test/reset.test.ts +19 -0
- package/src/actions/test/reset.ts +18 -0
- package/src/actions/test/revert.test.ts +39 -0
- package/src/actions/test/revert.ts +14 -0
- package/src/actions/test/sendUnsignedTransaction.test.ts +52 -0
- package/src/actions/test/sendUnsignedTransaction.ts +19 -0
- package/src/actions/test/setAutomine.test.ts +14 -0
- package/src/actions/test/setAutomine.ts +8 -0
- package/src/actions/test/setBalance.test.ts +29 -0
- package/src/actions/test/setBalance.ts +20 -0
- package/src/actions/test/setBlockGasLimit.test.ts +21 -0
- package/src/actions/test/setBlockGasLimit.ts +17 -0
- package/src/actions/test/setBlockTimestampInterval.test.ts +23 -0
- package/src/actions/test/setBlockTimestampInterval.ts +16 -0
- package/src/actions/test/setCode.test.ts +26 -0
- package/src/actions/test/setCode.ts +19 -0
- package/src/actions/test/setCoinbase.test.ts +11 -0
- package/src/actions/test/setCoinbase.ts +17 -0
- package/src/actions/test/setIntervalMining.test.ts +30 -0
- package/src/actions/test/setIntervalMining.ts +16 -0
- package/src/actions/test/setLoggingEnabled.test.ts +10 -0
- package/src/actions/test/setLoggingEnabled.ts +8 -0
- package/src/actions/test/setMinGasPrice.test.ts +22 -0
- package/src/actions/test/setMinGasPrice.ts +17 -0
- package/src/actions/test/setNextBlockBaseFeePerGas.test.ts +23 -0
- package/src/actions/test/setNextBlockBaseFeePerGas.ts +17 -0
- package/src/actions/test/setNextBlockTimestamp.test.ts +19 -0
- package/src/actions/test/setNextBlockTimestamp.ts +17 -0
- package/src/actions/test/setNonce.test.ts +28 -0
- package/src/actions/test/setNonce.ts +20 -0
- package/src/actions/test/setRpcUrl.test.ts +9 -0
- package/src/actions/test/setRpcUrl.ts +8 -0
- package/src/actions/test/setStorageAt.test.ts +36 -0
- package/src/actions/test/setStorageAt.ts +26 -0
- package/src/actions/test/snapshot.test.ts +18 -0
- package/src/actions/test/snapshot.ts +7 -0
- package/src/actions/test/stopImpersonatingAccount.test.ts +31 -0
- package/src/actions/test/stopImpersonatingAccount.ts +17 -0
- package/src/actions/wallet/addChain.test.ts +14 -0
- package/src/actions/wallet/addChain.ts +21 -0
- package/src/actions/wallet/getAccounts.test.ts +22 -0
- package/src/actions/wallet/getAccounts.ts +7 -0
- package/src/actions/wallet/getPermissions.test.ts +24 -0
- package/src/actions/wallet/getPermissions.ts +9 -0
- package/src/actions/wallet/index.test.ts +20 -0
- package/src/actions/wallet/index.ts +30 -0
- package/src/actions/wallet/requestAccounts.test.ts +13 -0
- package/src/actions/wallet/requestAccounts.ts +7 -0
- package/src/actions/wallet/requestPermissions.test.ts +26 -0
- package/src/actions/wallet/requestPermissions.ts +19 -0
- package/src/actions/wallet/sendTransaction.bench.ts +57 -0
- package/src/actions/wallet/sendTransaction.test.ts +440 -0
- package/src/actions/wallet/sendTransaction.ts +77 -0
- package/src/actions/wallet/signMessage.test.ts +62 -0
- package/src/actions/wallet/signMessage.ts +35 -0
- package/src/actions/wallet/switchChain.test.ts +22 -0
- package/src/actions/wallet/switchChain.ts +19 -0
- package/src/actions/wallet/watchAsset.test.ts +41 -0
- package/src/actions/wallet/watchAsset.ts +16 -0
- package/src/actions/wallet/writeContract.test.ts +54 -0
- package/src/actions/wallet/writeContract.ts +56 -0
- package/src/chains.test.ts +1912 -0
- package/src/chains.ts +99 -0
- package/src/clients/createClient.test.ts +295 -0
- package/src/clients/createClient.ts +81 -0
- package/src/clients/createPublicClient.test.ts +165 -0
- package/src/clients/createPublicClient.ts +49 -0
- package/src/clients/createTestClient.test.ts +145 -0
- package/src/clients/createTestClient.ts +72 -0
- package/src/clients/createWalletClient.test.ts +121 -0
- package/src/clients/createWalletClient.ts +54 -0
- package/src/clients/index.test.ts +19 -0
- package/src/clients/index.ts +31 -0
- package/src/clients/transports/createTransport.test.ts +58 -0
- package/src/clients/transports/createTransport.ts +48 -0
- package/src/clients/transports/custom.test.ts +98 -0
- package/src/clients/transports/custom.ts +34 -0
- package/src/clients/transports/fallback.test.ts +223 -0
- package/src/clients/transports/fallback.ts +48 -0
- package/src/clients/transports/http.test.ts +110 -0
- package/src/clients/transports/http.ts +51 -0
- package/src/clients/transports/index.test.ts +15 -0
- package/src/clients/transports/index.ts +17 -0
- package/src/clients/transports/webSocket.test.ts +164 -0
- package/src/clients/transports/webSocket.ts +117 -0
- package/src/errors/abi.test.ts +83 -0
- package/src/errors/abi.ts +238 -0
- package/src/errors/address.test.ts +14 -0
- package/src/errors/address.ts +9 -0
- package/src/errors/base.test.ts +72 -0
- package/src/errors/base.ts +57 -0
- package/src/errors/block.test.ts +24 -0
- package/src/errors/block.ts +18 -0
- package/src/errors/contract.ts +125 -0
- package/src/errors/data.ts +20 -0
- package/src/errors/encoding.ts +60 -0
- package/src/errors/index.ts +77 -0
- package/src/errors/log.ts +8 -0
- package/src/errors/request.test.ts +331 -0
- package/src/errors/request.ts +163 -0
- package/src/errors/rpc.test.ts +88 -0
- package/src/errors/rpc.ts +113 -0
- package/src/errors/transaction.test.ts +83 -0
- package/src/errors/transaction.ts +54 -0
- package/src/errors/transport.test.ts +12 -0
- package/src/errors/transport.ts +12 -0
- package/src/index.test.ts +214 -0
- package/src/index.ts +373 -0
- package/src/public.ts +80 -0
- package/src/test.ts +51 -0
- package/src/types/block.ts +71 -0
- package/src/types/chain.ts +6 -0
- package/src/types/contract.ts +342 -0
- package/src/types/eip1193.ts +1041 -0
- package/src/types/fee.ts +47 -0
- package/src/types/filter.ts +8 -0
- package/src/types/formatter.ts +23 -0
- package/src/types/index.ts +78 -0
- package/src/types/log.ts +22 -0
- package/src/types/misc.ts +5 -0
- package/src/types/rpc.ts +35 -0
- package/src/types/transaction.ts +145 -0
- package/src/types/utils.ts +67 -0
- package/src/types/window.ts +9 -0
- package/src/utils/abi/decodeAbi.bench.ts +135 -0
- package/src/utils/abi/decodeAbi.test.ts +1615 -0
- package/src/utils/abi/decodeAbi.ts +296 -0
- package/src/utils/abi/decodeDeployData.test.ts +159 -0
- package/src/utils/abi/decodeDeployData.ts +41 -0
- package/src/utils/abi/decodeErrorResult.test.ts +130 -0
- package/src/utils/abi/decodeErrorResult.ts +28 -0
- package/src/utils/abi/decodeFunctionData.test.ts +140 -0
- package/src/utils/abi/decodeFunctionData.ts +29 -0
- package/src/utils/abi/decodeFunctionResult.test.ts +262 -0
- package/src/utils/abi/decodeFunctionResult.ts +53 -0
- package/src/utils/abi/encodeAbi.bench.ts +163 -0
- package/src/utils/abi/encodeAbi.test.ts +1448 -0
- package/src/utils/abi/encodeAbi.ts +264 -0
- package/src/utils/abi/encodeDeployData.test.ts +131 -0
- package/src/utils/abi/encodeDeployData.ts +37 -0
- package/src/utils/abi/encodeErrorResult.test.ts +197 -0
- package/src/utils/abi/encodeErrorResult.ts +40 -0
- package/src/utils/abi/encodeEventTopics.test.ts +348 -0
- package/src/utils/abi/encodeEventTopics.ts +69 -0
- package/src/utils/abi/encodeFunctionData.test.ts +140 -0
- package/src/utils/abi/encodeFunctionData.ts +38 -0
- package/src/utils/abi/encodeFunctionResult.test.ts +284 -0
- package/src/utils/abi/encodeFunctionResult.ts +39 -0
- package/src/utils/abi/formatAbiItem.test.ts +335 -0
- package/src/utils/abi/formatAbiItem.ts +41 -0
- package/src/utils/abi/formatAbiItemWithArgs.test.ts +291 -0
- package/src/utils/abi/formatAbiItemWithArgs.ts +27 -0
- package/src/utils/abi/getAbiItem.ts +5 -0
- package/src/utils/abi/index.test.ts +23 -0
- package/src/utils/abi/index.ts +38 -0
- package/src/utils/address/getAddress.bench.ts +22 -0
- package/src/utils/address/getAddress.test.ts +46 -0
- package/src/utils/address/getAddress.ts +28 -0
- package/src/utils/address/getContractAddress.bench.ts +20 -0
- package/src/utils/address/getContractAddress.test.ts +78 -0
- package/src/utils/address/getContractAddress.ts +59 -0
- package/src/utils/address/index.test.ts +17 -0
- package/src/utils/address/index.ts +16 -0
- package/src/utils/address/isAddress.test.ts +10 -0
- package/src/utils/address/isAddress.ts +10 -0
- package/src/utils/address/isAddressEqual.test.ts +55 -0
- package/src/utils/address/isAddressEqual.ts +6 -0
- package/src/utils/buildRequest.test.ts +365 -0
- package/src/utils/buildRequest.ts +45 -0
- package/src/utils/chain.test.ts +43 -0
- package/src/utils/chain.ts +8 -0
- package/src/utils/contract/extractFunctionParts.test.ts +109 -0
- package/src/utils/contract/extractFunctionParts.ts +27 -0
- package/src/utils/contract/getContractError.test.ts +97 -0
- package/src/utils/contract/getContractError.ts +66 -0
- package/src/utils/contract/index.test.ts +15 -0
- package/src/utils/contract/index.ts +8 -0
- package/src/utils/data/concat.test.ts +35 -0
- package/src/utils/data/concat.ts +34 -0
- package/src/utils/data/index.test.ts +23 -0
- package/src/utils/data/index.ts +13 -0
- package/src/utils/data/isBytes.test.ts +9 -0
- package/src/utils/data/isBytes.ts +7 -0
- package/src/utils/data/isHex.test.ts +13 -0
- package/src/utils/data/isHex.ts +5 -0
- package/src/utils/data/pad.bench.ts +39 -0
- package/src/utils/data/pad.test.ts +367 -0
- package/src/utils/data/pad.ts +53 -0
- package/src/utils/data/size.test.ts +18 -0
- package/src/utils/data/size.ts +13 -0
- package/src/utils/data/slice.test.ts +203 -0
- package/src/utils/data/slice.ts +60 -0
- package/src/utils/data/trim.bench.ts +50 -0
- package/src/utils/data/trim.test.ts +175 -0
- package/src/utils/data/trim.ts +33 -0
- package/src/utils/encoding/decodeBytes.bench.ts +40 -0
- package/src/utils/encoding/decodeBytes.test.ts +144 -0
- package/src/utils/encoding/decodeBytes.ts +63 -0
- package/src/utils/encoding/decodeHex.bench.ts +24 -0
- package/src/utils/encoding/decodeHex.test.ts +167 -0
- package/src/utils/encoding/decodeHex.ts +76 -0
- package/src/utils/encoding/decodeRlp.bench.ts +34 -0
- package/src/utils/encoding/decodeRlp.test.ts +350 -0
- package/src/utils/encoding/decodeRlp.ts +121 -0
- package/src/utils/encoding/encodeBytes.bench.ts +41 -0
- package/src/utils/encoding/encodeBytes.test.ts +676 -0
- package/src/utils/encoding/encodeBytes.ts +59 -0
- package/src/utils/encoding/encodeHex.bench.ts +60 -0
- package/src/utils/encoding/encodeHex.test.ts +232 -0
- package/src/utils/encoding/encodeHex.ts +104 -0
- package/src/utils/encoding/encodeRlp.bench.ts +54 -0
- package/src/utils/encoding/encodeRlp.test.ts +254 -0
- package/src/utils/encoding/encodeRlp.ts +48 -0
- package/src/utils/encoding/index.test.ts +32 -0
- package/src/utils/encoding/index.ts +36 -0
- package/src/utils/formatters/block.bench.ts +51 -0
- package/src/utils/formatters/block.test.ts +115 -0
- package/src/utils/formatters/block.ts +37 -0
- package/src/utils/formatters/extract.test.ts +14 -0
- package/src/utils/formatters/extract.ts +18 -0
- package/src/utils/formatters/feeHistory.test.ts +66 -0
- package/src/utils/formatters/feeHistory.ts +12 -0
- package/src/utils/formatters/format.test.ts +93 -0
- package/src/utils/formatters/format.ts +90 -0
- package/src/utils/formatters/index.test.ts +27 -0
- package/src/utils/formatters/index.ts +34 -0
- package/src/utils/formatters/log.test.ts +79 -0
- package/src/utils/formatters/log.ts +12 -0
- package/src/utils/formatters/transaction.test.ts +271 -0
- package/src/utils/formatters/transaction.ts +63 -0
- package/src/utils/formatters/transactionReceipt.bench.ts +73 -0
- package/src/utils/formatters/transactionReceipt.test.ts +151 -0
- package/src/utils/formatters/transactionReceipt.ts +63 -0
- package/src/utils/formatters/transactionRequest.bench.ts +29 -0
- package/src/utils/formatters/transactionRequest.test.ts +237 -0
- package/src/utils/formatters/transactionRequest.ts +56 -0
- package/src/utils/hash/getEventSignature.test.ts +61 -0
- package/src/utils/hash/getEventSignature.ts +4 -0
- package/src/utils/hash/getFunctionSignature.test.ts +22 -0
- package/src/utils/hash/getFunctionSignature.ts +5 -0
- package/src/utils/hash/hashFunction.test.ts +65 -0
- package/src/utils/hash/hashFunction.ts +12 -0
- package/src/utils/hash/index.test.ts +13 -0
- package/src/utils/hash/index.ts +5 -0
- package/src/utils/hash/keccak256.test.ts +59 -0
- package/src/utils/hash/keccak256.ts +23 -0
- package/src/utils/index.test.ts +110 -0
- package/src/utils/index.ts +137 -0
- package/src/utils/observe.test.ts +176 -0
- package/src/utils/observe.ts +66 -0
- package/src/utils/poll.test.ts +127 -0
- package/src/utils/poll.ts +42 -0
- package/src/utils/promise/index.test.ts +14 -0
- package/src/utils/promise/index.ts +3 -0
- package/src/utils/promise/withCache.test.ts +97 -0
- package/src/utils/promise/withCache.ts +73 -0
- package/src/utils/promise/withRetry.test.ts +231 -0
- package/src/utils/promise/withRetry.ts +61 -0
- package/src/utils/promise/withTimeout.test.ts +37 -0
- package/src/utils/promise/withTimeout.ts +39 -0
- package/src/utils/rpc.test.ts +992 -0
- package/src/utils/rpc.ts +292 -0
- package/src/utils/stringify.test.ts +13 -0
- package/src/utils/stringify.ts +5 -0
- package/src/utils/uid.ts +14 -0
- package/src/utils/unit/constants.test.ts +22 -0
- package/src/utils/unit/constants.ts +12 -0
- package/src/utils/unit/formatEther.test.ts +75 -0
- package/src/utils/unit/formatEther.ts +6 -0
- package/src/utils/unit/formatGwei.test.ts +32 -0
- package/src/utils/unit/formatGwei.ts +6 -0
- package/src/utils/unit/formatUnit.bench.ts +26 -0
- package/src/utils/unit/formatUnit.test.ts +40 -0
- package/src/utils/unit/formatUnit.ts +16 -0
- package/src/utils/unit/index.test.ts +28 -0
- package/src/utils/unit/index.ts +7 -0
- package/src/utils/unit/parseEther.test.ts +126 -0
- package/src/utils/unit/parseEther.ts +6 -0
- package/src/utils/unit/parseGwei.test.ts +50 -0
- package/src/utils/unit/parseGwei.ts +6 -0
- package/src/utils/unit/parseUnit.bench.ts +26 -0
- package/src/utils/unit/parseUnit.test.ts +54 -0
- package/src/utils/unit/parseUnit.ts +27 -0
- package/src/utils/wait.ts +3 -0
- package/src/wallet.ts +23 -0
- package/src/window.ts +1 -0
- package/utils/package.json +1 -1
- package/window/package.json +1 -1
- package/actions/package.json +0 -4
- package/dist/BaseError-7688f84e.d.ts +0 -18
- package/dist/actions/index.d.ts +0 -8
- package/dist/actions/index.js +0 -123
- package/dist/createWalletClient-915223f3.d.ts +0 -130
- package/dist/transactionRequest-ade896ac.d.ts +0 -44
@@ -1,9 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import { P as PublicClient
|
5
|
-
import {
|
6
|
-
import {
|
1
|
+
import { Abi } from 'abitype';
|
2
|
+
import { b as Hex, J as Chain, A as Address, a as BlockTag, K as Formatter, M as MergeIntersectionProperties, N as Formatted, s as TransactionRequest, O as EstimateGasParameters, H as Hash, F as FeeHistory, L as Log, E as FormattedTransaction, P as TransactionFormatter, Q as ExtractFormatter, p as RpcTransactionReceipt, T as TransactionReceipt, S as TransactionType, x as Transaction } from './chain-32f56cfa.js';
|
3
|
+
import { d as ExtractFunctionNameFromAbi, G as GetValue, e as ExtractArgsFromAbi, f as ExtractResultFromAbi, h as ExtractConstructorArgsFromAbi, F as FormattedBlock, B as BlockFormatter, i as FormattedTransactionReceipt, T as TransactionReceiptFormatter } from './contract-9af4608b.js';
|
4
|
+
import { P as PublicClient } from './createPublicClient-9d2b42e1.js';
|
5
|
+
import { W as WalletClient } from './createWalletClient-f69a5230.js';
|
6
|
+
import { S as SendTransactionArgs, a as SendTransactionResponse } from './sendTransaction-1c8290a9.js';
|
7
|
+
import { T as TransactionRequestFormatter } from './transactionRequest-341b6ed2.js';
|
7
8
|
|
8
9
|
type FilterType = 'transaction' | 'block' | 'event';
|
9
10
|
type Filter<TFilterType extends FilterType = 'event'> = {
|
@@ -14,6 +15,7 @@ type Filter<TFilterType extends FilterType = 'event'> = {
|
|
14
15
|
type FormattedCall<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Formatted<TFormatter, TransactionRequest, true>, TransactionRequest>;
|
15
16
|
type CallArgs<TChain extends Chain = Chain> = FormattedCall<TransactionRequestFormatter<TChain>> & {
|
16
17
|
chain?: TChain;
|
18
|
+
from?: Address;
|
17
19
|
} & ({
|
18
20
|
/** The balance of the account at a block number. */
|
19
21
|
blockNumber?: bigint;
|
@@ -28,12 +30,44 @@ type CallResponse = {
|
|
28
30
|
};
|
29
31
|
declare function call<TChain extends Chain>(client: PublicClient, { blockNumber, blockTag, chain, from, accessList, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest }: CallArgs<TChain>): Promise<CallResponse>;
|
30
32
|
|
33
|
+
type WriteContractArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<SendTransactionArgs<TChain>, 'to' | 'data' | 'value'> & {
|
34
|
+
address: Address;
|
35
|
+
abi: TAbi;
|
36
|
+
functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName>;
|
37
|
+
value?: GetValue<TAbi, TFunctionName, SendTransactionArgs<TChain>['value']>;
|
38
|
+
} & ExtractArgsFromAbi<TAbi, TFunctionName>;
|
39
|
+
type WriteContractResponse = SendTransactionResponse;
|
40
|
+
declare function writeContract<TChain extends Chain, TAbi extends Abi = Abi, TFunctionName extends string = any>(client: WalletClient, { abi, address, args, functionName, ...request }: WriteContractArgs<TChain, TAbi, TFunctionName>): Promise<WriteContractResponse>;
|
41
|
+
|
42
|
+
type SimulateContractArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<CallArgs<TChain>, 'to' | 'data' | 'value'> & {
|
43
|
+
address: Address;
|
44
|
+
abi: TAbi;
|
45
|
+
functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
|
46
|
+
value?: GetValue<TAbi, TFunctionName, CallArgs<TChain>['value']>;
|
47
|
+
} & ExtractArgsFromAbi<TAbi, TFunctionName>;
|
48
|
+
type SimulateContractResponse<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = {
|
49
|
+
result: ExtractResultFromAbi<TAbi, TFunctionName>;
|
50
|
+
request: WriteContractArgs<TChain, TAbi, TFunctionName> & {
|
51
|
+
address: Address;
|
52
|
+
abi: TAbi;
|
53
|
+
functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName>;
|
54
|
+
} & ExtractArgsFromAbi<TAbi, TFunctionName>;
|
55
|
+
};
|
56
|
+
declare function simulateContract<TChain extends Chain, TAbi extends Abi = Abi, TFunctionName extends string = any>(client: PublicClient, { abi, address, args, functionName, ...callRequest }: SimulateContractArgs<TChain, TAbi, TFunctionName>): Promise<SimulateContractResponse<TChain, TAbi, TFunctionName>>;
|
57
|
+
|
31
58
|
type CreatePendingTransactionFilterResponse = Filter<'transaction'>;
|
32
59
|
declare function createPendingTransactionFilter(client: PublicClient): Promise<CreatePendingTransactionFilterResponse>;
|
33
60
|
|
34
61
|
type CreateBlockFilterResponse = Filter<'block'>;
|
35
62
|
declare function createBlockFilter(client: PublicClient): Promise<CreateBlockFilterResponse>;
|
36
63
|
|
64
|
+
type DeployContractArgs<TChain extends Chain = Chain, TAbi extends Abi = Abi> = Omit<SendTransactionArgs<TChain>, 'accessList' | 'to' | 'data' | 'value'> & {
|
65
|
+
abi: TAbi;
|
66
|
+
bytecode: Hex;
|
67
|
+
} & ExtractConstructorArgsFromAbi<TAbi>;
|
68
|
+
type DeployContractResponse = SendTransactionResponse;
|
69
|
+
declare function deployContract<TChain extends Chain, TAbi extends Abi = Abi>(walletClient: WalletClient, { abi, args, bytecode, ...request }: DeployContractArgs<TChain, TAbi>): Promise<DeployContractResponse>;
|
70
|
+
|
37
71
|
type EstimateGasArgs = EstimateGasParameters & ({
|
38
72
|
/** The balance of the account at a block number. */
|
39
73
|
blockNumber?: bigint;
|
@@ -140,6 +174,18 @@ type GetBlockTransactionCountArgs = {
|
|
140
174
|
type GetBlockTransactionCountResponse = number;
|
141
175
|
declare function getBlockTransactionCount<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, }?: GetBlockTransactionCountArgs): Promise<GetBlockTransactionCountResponse>;
|
142
176
|
|
177
|
+
type GetBytecodeArgs = {
|
178
|
+
address: Address;
|
179
|
+
} & ({
|
180
|
+
blockNumber?: never;
|
181
|
+
blockTag?: BlockTag;
|
182
|
+
} | {
|
183
|
+
blockNumber?: bigint;
|
184
|
+
blockTag?: never;
|
185
|
+
});
|
186
|
+
type GetBytecodeResponse = Hex | undefined;
|
187
|
+
declare function getBytecode(client: PublicClient, { address, blockNumber, blockTag }: GetBytecodeArgs): Promise<GetBytecodeResponse>;
|
188
|
+
|
143
189
|
declare function getChainId(client: PublicClient): Promise<number>;
|
144
190
|
|
145
191
|
type GetFeeHistoryArgs = {
|
@@ -275,12 +321,6 @@ type WaitForTransactionReceiptArgs<TChain extends Chain = Chain> = {
|
|
275
321
|
timeout?: number;
|
276
322
|
};
|
277
323
|
declare function waitForTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { confirmations, hash, onReplaced, pollingInterval, timeout, }: WaitForTransactionReceiptArgs<TChain>): Promise<WaitForTransactionReceiptResponse<TChain>>;
|
278
|
-
declare class WaitForTransactionReceiptTimeoutError extends BaseError {
|
279
|
-
name: string;
|
280
|
-
constructor({ hash }: {
|
281
|
-
hash: Hash;
|
282
|
-
});
|
283
|
-
}
|
284
324
|
|
285
325
|
type OnBlockNumberResponse = GetBlockNumberResponse;
|
286
326
|
type OnBlockNumber = (blockNumber: OnBlockNumberResponse, prevBlockNumber: OnBlockNumberResponse | undefined) => void;
|
@@ -299,8 +339,8 @@ type WatchBlockNumberArgs = {
|
|
299
339
|
/** @description Watches and returns incoming block numbers. */
|
300
340
|
declare function watchBlockNumber(client: PublicClient, { emitOnBegin, emitMissed, onBlockNumber, onError, pollingInterval, }: WatchBlockNumberArgs): () => void;
|
301
341
|
|
302
|
-
type OnBlockResponse<TChain extends Chain = Chain> = GetBlockResponse<TChain>;
|
303
|
-
type OnBlock<TChain extends Chain = Chain> = (block: OnBlockResponse<TChain>, prevBlock: OnBlockResponse<TChain> | undefined) => void;
|
342
|
+
type OnBlockResponse<TChain extends Chain = Chain, TIncludeTransactions = false> = Omit<GetBlockResponse<TChain>, TIncludeTransactions extends false ? 'transactions' : ''>;
|
343
|
+
type OnBlock<TChain extends Chain = Chain, TIncludeTransactions = false> = (block: OnBlockResponse<TChain, TIncludeTransactions>, prevBlock: OnBlockResponse<TChain, TIncludeTransactions> | undefined) => void;
|
304
344
|
type WatchBlocksArgs<TChain extends Chain = Chain> = {
|
305
345
|
/** The block tag. Defaults to "latest". */
|
306
346
|
blockTag?: BlockTag;
|
@@ -308,17 +348,23 @@ type WatchBlocksArgs<TChain extends Chain = Chain> = {
|
|
308
348
|
emitMissed?: boolean;
|
309
349
|
/** Whether or not to emit the block to the callback when the subscription opens. */
|
310
350
|
emitOnBegin?: boolean;
|
311
|
-
/** The callback to call when a new block is received. */
|
312
|
-
onBlock: OnBlock<TChain>;
|
313
351
|
/** The callback to call when an error occurred when trying to get for a new block. */
|
314
352
|
onError?: (error: Error) => void;
|
315
|
-
/** Whether or not to include transaction data in the response. */
|
316
|
-
includeTransactions?: boolean;
|
317
353
|
/** Polling frequency (in ms). Defaults to the client's pollingInterval config. */
|
318
354
|
pollingInterval?: number;
|
319
|
-
}
|
355
|
+
} & ({
|
356
|
+
/** Whether or not to include transaction data in the response. */
|
357
|
+
includeTransactions: true;
|
358
|
+
/** The callback to call when a new block is received. */
|
359
|
+
onBlock: OnBlock<TChain, true>;
|
360
|
+
} | {
|
361
|
+
/** Whether or not to include transaction data in the response. */
|
362
|
+
includeTransactions?: false;
|
363
|
+
/** The callback to call when a new block is received. */
|
364
|
+
onBlock: OnBlock<TChain>;
|
365
|
+
});
|
320
366
|
/** @description Watches and returns information for incoming blocks. */
|
321
|
-
declare function watchBlocks<TChain extends Chain
|
367
|
+
declare function watchBlocks<TChain extends Chain, TWatchBlocksArgs extends WatchBlocksArgs<TChain>>(client: PublicClient<any, TChain>, { blockTag, emitMissed, emitOnBegin, onBlock, onError, includeTransactions, pollingInterval, }: TWatchBlocksArgs): () => void;
|
322
368
|
|
323
369
|
type OnTransactionsResponse = Hash[];
|
324
370
|
type OnTransactions = (transactions: OnTransactionsResponse) => void;
|
@@ -334,200 +380,4 @@ type WatchPendingTransactionsArgs = {
|
|
334
380
|
};
|
335
381
|
declare function watchPendingTransactions(client: PublicClient, { batch, onError, onTransactions, pollingInterval, }: WatchPendingTransactionsArgs): () => void;
|
336
382
|
|
337
|
-
|
338
|
-
/** The hash of the transaction to drop. */
|
339
|
-
hash: Hash;
|
340
|
-
};
|
341
|
-
declare function dropTransaction(client: TestClient, { hash }: DropTransactionArgs): Promise<void>;
|
342
|
-
|
343
|
-
type GetAutomineResponse = boolean;
|
344
|
-
declare function getAutomine(client: TestClient): Promise<GetAutomineResponse>;
|
345
|
-
|
346
|
-
declare function getTxpoolContent(client: TestClient): Promise<{
|
347
|
-
pending: Record<`0x${string}`, Record<string, RpcTransaction>>;
|
348
|
-
queued: Record<`0x${string}`, Record<string, RpcTransaction>>;
|
349
|
-
}>;
|
350
|
-
|
351
|
-
declare function getTxpoolStatus(client: TestClient): Promise<{
|
352
|
-
pending: number;
|
353
|
-
queued: number;
|
354
|
-
}>;
|
355
|
-
|
356
|
-
type ImpersonateAccountArgs = {
|
357
|
-
/** The account to impersonate. */
|
358
|
-
address: Address;
|
359
|
-
};
|
360
|
-
declare function impersonateAccount(client: TestClient, { address }: ImpersonateAccountArgs): Promise<void>;
|
361
|
-
|
362
|
-
type IncreaseTimeArgs = {
|
363
|
-
/** The amount of seconds to jump forward in time. */
|
364
|
-
seconds: number;
|
365
|
-
};
|
366
|
-
declare function increaseTime(client: TestClient, { seconds }: IncreaseTimeArgs): Promise<`0x${string}`>;
|
367
|
-
|
368
|
-
declare function inspectTxpool(client: TestClient): Promise<{
|
369
|
-
pending: Record<`0x${string}`, Record<string, string>>;
|
370
|
-
queued: Record<`0x${string}`, Record<string, string>>;
|
371
|
-
}>;
|
372
|
-
|
373
|
-
type MineArgs = {
|
374
|
-
/** Number of blocks to mine. */
|
375
|
-
blocks: number;
|
376
|
-
/** Interval between each block in seconds. */
|
377
|
-
interval?: number;
|
378
|
-
};
|
379
|
-
declare function mine(client: TestClient, { blocks, interval }: MineArgs): Promise<void>;
|
380
|
-
|
381
|
-
declare function removeBlockTimestampInterval(client: TestClient): Promise<void>;
|
382
|
-
|
383
|
-
type ResetArgs = {
|
384
|
-
/** The block number to reset from. */
|
385
|
-
blockNumber?: bigint;
|
386
|
-
/** The JSON RPC URL. */
|
387
|
-
jsonRpcUrl?: string;
|
388
|
-
};
|
389
|
-
declare function reset(client: TestClient, { blockNumber, jsonRpcUrl }?: ResetArgs): Promise<void>;
|
390
|
-
|
391
|
-
type RevertArgs = {
|
392
|
-
/** The snapshot ID to revert to. */
|
393
|
-
id: Quantity;
|
394
|
-
};
|
395
|
-
declare function revert(client: TestClient, { id }: RevertArgs): Promise<void>;
|
396
|
-
|
397
|
-
type SendUnsignedTransactionArgs = TransactionRequest;
|
398
|
-
type SendUnsignedTransactionResponse = Hash;
|
399
|
-
declare function sendUnsignedTransaction(client: TestClient, request: SendUnsignedTransactionArgs): Promise<SendUnsignedTransactionResponse>;
|
400
|
-
|
401
|
-
declare function setAutomine(client: TestClient, enabled: boolean): Promise<void>;
|
402
|
-
|
403
|
-
type SetBalanceArgs = {
|
404
|
-
/** The account address. */
|
405
|
-
address: Address;
|
406
|
-
/** Amount (in wei) to set */
|
407
|
-
value: bigint;
|
408
|
-
};
|
409
|
-
declare function setBalance(client: TestClient, { address, value }: SetBalanceArgs): Promise<void>;
|
410
|
-
|
411
|
-
type SetBlockGasLimitArgs = {
|
412
|
-
/** Gas limit (in wei). */
|
413
|
-
gasLimit: bigint;
|
414
|
-
};
|
415
|
-
declare function setBlockGasLimit(client: TestClient, { gasLimit }: SetBlockGasLimitArgs): Promise<void>;
|
416
|
-
|
417
|
-
type SetBlockTimestampIntervalArgs = {
|
418
|
-
/** The interval (in seconds). */
|
419
|
-
interval: number;
|
420
|
-
};
|
421
|
-
declare function setBlockTimestampInterval(client: TestClient, { interval }: SetBlockTimestampIntervalArgs): Promise<void>;
|
422
|
-
|
423
|
-
type SetCodeArgs = {
|
424
|
-
/** The account address. */
|
425
|
-
address: Address;
|
426
|
-
/** The bytecode to set */
|
427
|
-
bytecode: Hex;
|
428
|
-
};
|
429
|
-
declare function setCode(client: TestClient, { address, bytecode }: SetCodeArgs): Promise<void>;
|
430
|
-
|
431
|
-
type SetCoinbaseArgs = {
|
432
|
-
/** The coinbase address. */
|
433
|
-
address: Address;
|
434
|
-
};
|
435
|
-
declare function setCoinbase(client: TestClient, { address }: SetCoinbaseArgs): Promise<void>;
|
436
|
-
|
437
|
-
type SetIntervalMiningArgs = {
|
438
|
-
/** The mining interval. */
|
439
|
-
interval: number;
|
440
|
-
};
|
441
|
-
declare function setIntervalMining(client: TestClient, { interval }: SetIntervalMiningArgs): Promise<void>;
|
442
|
-
|
443
|
-
declare function setLoggingEnabled(client: TestClient, enabled: boolean): Promise<void>;
|
444
|
-
|
445
|
-
type SetMinGasPriceArgs = {
|
446
|
-
/** The gas price. */
|
447
|
-
gasPrice: bigint;
|
448
|
-
};
|
449
|
-
declare function setMinGasPrice(client: TestClient, { gasPrice }: SetMinGasPriceArgs): Promise<void>;
|
450
|
-
|
451
|
-
type SetNextBlockBaseFeePerGasArgs = {
|
452
|
-
/** Base fee per gas (in wei). */
|
453
|
-
baseFeePerGas: bigint;
|
454
|
-
};
|
455
|
-
declare function setNextBlockBaseFeePerGas(client: TestClient, { baseFeePerGas }: SetNextBlockBaseFeePerGasArgs): Promise<void>;
|
456
|
-
|
457
|
-
type SetNextBlockTimestampArgs = {
|
458
|
-
/** The timestamp (in seconds). */
|
459
|
-
timestamp: bigint;
|
460
|
-
};
|
461
|
-
declare function setNextBlockTimestamp(client: TestClient, { timestamp }: SetNextBlockTimestampArgs): Promise<void>;
|
462
|
-
|
463
|
-
type SetNonceArgs = {
|
464
|
-
/** The account address. */
|
465
|
-
address: Address;
|
466
|
-
/** The nonce to set. */
|
467
|
-
nonce: number;
|
468
|
-
};
|
469
|
-
declare function setNonce(client: TestClient, { address, nonce }: SetNonceArgs): Promise<void>;
|
470
|
-
|
471
|
-
type SetStorageAtArgs = {
|
472
|
-
/** The account address. */
|
473
|
-
address: Address;
|
474
|
-
/** The storage slot (index). Can either be a number or hash value. */
|
475
|
-
index: number | Hash;
|
476
|
-
/** The value to store as a 32 byte hex string. */
|
477
|
-
value: Hex;
|
478
|
-
};
|
479
|
-
declare function setStorageAt(client: TestClient, { address, index, value }: SetStorageAtArgs): Promise<void>;
|
480
|
-
|
481
|
-
declare function snapshot(client: TestClient): Promise<`0x${string}`>;
|
482
|
-
|
483
|
-
type StopImpersonatingAccountArgs = {
|
484
|
-
/** The account to impersonate. */
|
485
|
-
address: Address;
|
486
|
-
};
|
487
|
-
declare function stopImpersonatingAccount(client: TestClient, { address }: StopImpersonatingAccountArgs): Promise<void>;
|
488
|
-
|
489
|
-
declare function addChain(client: WalletClient, chain: Chain): Promise<void>;
|
490
|
-
|
491
|
-
declare function getAccounts(client: WalletClient): Promise<`0x${string}`[]>;
|
492
|
-
|
493
|
-
type GetPermissionsResponse = WalletPermission[];
|
494
|
-
declare function getPermissions(client: WalletClient): Promise<WalletPermission[]>;
|
495
|
-
|
496
|
-
declare function requestAccounts(client: WalletClient): Promise<`0x${string}`[]>;
|
497
|
-
|
498
|
-
type RequestPermissionsArgs = {
|
499
|
-
eth_accounts: Record<string, any>;
|
500
|
-
} & {
|
501
|
-
[key: string]: Record<string, any>;
|
502
|
-
};
|
503
|
-
type RequestPermissionsResponse = WalletPermission[];
|
504
|
-
declare function requestPermissions(client: WalletClient, permissions: RequestPermissionsArgs): Promise<WalletPermission[]>;
|
505
|
-
|
506
|
-
type FormattedTransactionRequest<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Formatted<TFormatter, TransactionRequest, true>, TransactionRequest>;
|
507
|
-
type SendTransactionArgs<TChain extends Chain = Chain> = FormattedTransactionRequest<TransactionRequestFormatter<TChain>> & {
|
508
|
-
chain?: TChain;
|
509
|
-
};
|
510
|
-
type SendTransactionResponse = Hash;
|
511
|
-
declare function sendTransaction<TChain extends Chain>(client: WalletClient, { chain, from, accessList, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, ...rest }: SendTransactionArgs<TChain>): Promise<SendTransactionResponse>;
|
512
|
-
declare class InvalidGasArgumentsError extends BaseError {
|
513
|
-
name: string;
|
514
|
-
constructor();
|
515
|
-
}
|
516
|
-
|
517
|
-
type SignMessageArgs = {
|
518
|
-
from: Address;
|
519
|
-
data: Hex | ByteArray;
|
520
|
-
};
|
521
|
-
type SignMessageResponse = Hex;
|
522
|
-
declare function signMessage(client: WalletClient, { from, data: data_ }: SignMessageArgs): Promise<SignMessageResponse>;
|
523
|
-
|
524
|
-
type SwitchChainArgs = {
|
525
|
-
id: Chain['id'];
|
526
|
-
};
|
527
|
-
declare function switchChain(client: WalletClient, { id }: SwitchChainArgs): Promise<void>;
|
528
|
-
|
529
|
-
type WatchAssetArgs = WatchAssetParams;
|
530
|
-
type WatchAssetResponse = boolean;
|
531
|
-
declare function watchAsset(client: WalletClient, params: WatchAssetParams): Promise<WatchAssetResponse>;
|
532
|
-
|
533
|
-
export { SetBlockTimestampIntervalArgs as $, GetTransactionReceiptResponse as A, IncreaseTimeArgs as B, CallArgs as C, DropTransactionArgs as D, EstimateGasArgs as E, OnBlockNumber as F, GetBalanceArgs as G, OnBlockNumberResponse as H, ImpersonateAccountArgs as I, OnBlockResponse as J, OnTransactions as K, OnTransactionsResponse as L, MineArgs as M, RequestPermissionsResponse as N, OnBlock as O, RevertArgs as P, SendTransactionResponse as Q, ResetArgs as R, SendTransactionArgs as S, SendUnsignedTransactionArgs as T, SendUnsignedTransactionResponse as U, SetBalanceArgs as V, SetBlockGasLimitArgs as W, SetCodeArgs as X, SetCoinbaseArgs as Y, SetIntervalMiningArgs as Z, SetMinGasPriceArgs as _, CallResponse as a, setNonce as a$, SetNextBlockTimestampArgs as a0, SetNextBlockBaseFeePerGasArgs as a1, SetNonceArgs as a2, SetStorageAtArgs as a3, SignMessageArgs as a4, SignMessageResponse as a5, StopImpersonatingAccountArgs as a6, SwitchChainArgs as a7, UninstallFilterArgs as a8, UninstallFilterResponse as a9, getTransactionConfirmations as aA, getTransactionCount as aB, getTransactionReceipt as aC, getTxpoolContent as aD, getTxpoolStatus as aE, impersonateAccount as aF, increaseTime as aG, inspectTxpool as aH, mine as aI, removeBlockTimestampInterval as aJ, reset as aK, requestAccounts as aL, requestPermissions as aM, revert as aN, sendTransaction as aO, sendUnsignedTransaction as aP, setAutomine as aQ, setBalance as aR, setBlockGasLimit as aS, setBlockTimestampInterval as aT, setCode as aU, setCoinbase as aV, setIntervalMining as aW, setLoggingEnabled as aX, setMinGasPrice as aY, setNextBlockBaseFeePerGas as aZ, setNextBlockTimestamp as a_, WaitForTransactionReceiptArgs as aa, WaitForTransactionReceiptResponse as ab, WatchAssetArgs as ac, WatchAssetResponse as ad, WatchBlockNumberArgs as ae, WatchBlocksArgs as af, WatchPendingTransactionsArgs as ag, addChain as ah, call as ai, createBlockFilter as aj, createPendingTransactionFilter as ak, estimateGas as al, dropTransaction as am, getAccounts as an, getAutomine as ao, getBalance as ap, getBlock as aq, getBlockNumber as ar, getBlockTransactionCount as as, getChainId as at, getFeeHistory as au, getFilterChanges as av, getFilterLogs as aw, getGasPrice as ax, getPermissions as ay, getTransaction as az, CreateBlockFilterResponse as b, setStorageAt as b0, signMessage as b1, snapshot as b2, stopImpersonatingAccount as b3, switchChain as b4, uninstallFilter as b5, waitForTransactionReceipt as b6, watchAsset as b7, watchBlockNumber as b8, watchBlocks as b9, watchPendingTransactions as ba, getBlockNumberCache as bb, ReplacementReason as bc, ReplacementResponse as bd, WaitForTransactionReceiptTimeoutError as be, FormattedTransactionRequest as bf, InvalidGasArgumentsError as bg, CreatePendingTransactionFilterResponse as c, EstimateGasResponse as d, GetBalanceResponse as e, GetBlockArgs as f, GetBlockNumberArgs as g, GetBlockNumberResponse as h, GetBlockResponse as i, GetBlockTransactionCountArgs as j, GetBlockTransactionCountResponse as k, GetFeeHistoryArgs as l, GetFeeHistoryResponse as m, GetFilterChangesArgs as n, GetFilterChangesResponse as o, GetFilterLogsArgs as p, GetFilterLogsResponse as q, GetGasPriceResponse as r, GetPermissionsResponse as s, GetTransactionArgs as t, GetTransactionConfirmationsArgs as u, GetTransactionConfirmationsResponse as v, GetTransactionCountArgs as w, GetTransactionCountResponse as x, GetTransactionResponse as y, GetTransactionReceiptArgs as z };
|
383
|
+
export { createPendingTransactionFilter as $, GetTransactionResponse as A, GetTransactionReceiptArgs as B, CallArgs as C, DeployContractArgs as D, EstimateGasArgs as E, Filter as F, GetBalanceArgs as G, GetTransactionReceiptResponse as H, OnBlockNumber as I, OnBlockNumberResponse as J, OnBlockResponse as K, OnTransactions as L, OnTransactionsResponse as M, SimulateContractResponse as N, OnBlock as O, UninstallFilterResponse as P, WaitForTransactionReceiptResponse as Q, WatchBlockNumberArgs as R, SimulateContractArgs as S, WatchBlocksArgs as T, UninstallFilterArgs as U, WatchPendingTransactionsArgs as V, WaitForTransactionReceiptArgs as W, WriteContractArgs as X, WriteContractResponse as Y, call as Z, createBlockFilter as _, CallResponse as a, deployContract as a0, estimateGas as a1, getBalance as a2, getBlock as a3, getBlockNumber as a4, getBlockTransactionCount as a5, getBytecode as a6, getChainId as a7, getFeeHistory as a8, getFilterChanges as a9, getFilterLogs as aa, getGasPrice as ab, getTransaction as ac, getTransactionConfirmations as ad, getTransactionCount as ae, getTransactionReceipt as af, simulateContract as ag, uninstallFilter as ah, waitForTransactionReceipt as ai, watchBlockNumber as aj, watchBlocks as ak, watchPendingTransactions as al, writeContract as am, getBlockNumberCache as an, ReplacementReason as ao, ReplacementResponse as ap, CreateBlockFilterResponse as b, CreatePendingTransactionFilterResponse as c, EstimateGasResponse as d, DeployContractResponse as e, GetBalanceResponse as f, GetBlockArgs as g, GetBlockNumberArgs as h, GetBlockNumberResponse as i, GetBlockResponse as j, GetBlockTransactionCountArgs as k, GetBlockTransactionCountResponse as l, GetBytecodeArgs as m, GetBytecodeResponse as n, GetFeeHistoryArgs as o, GetFeeHistoryResponse as p, GetFilterChangesArgs as q, GetFilterChangesResponse as r, GetFilterLogsArgs as s, GetFilterLogsResponse as t, GetGasPriceResponse as u, GetTransactionArgs as v, GetTransactionConfirmationsArgs as w, GetTransactionConfirmationsResponse as x, GetTransactionCountArgs as y, GetTransactionCountResponse as z };
|
@@ -1,11 +1,6 @@
|
|
1
|
-
import { B as
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import { a as RpcResponse } from './rpc-3c0e3985.js';
|
5
|
-
|
6
|
-
declare class UrlRequiredError extends BaseError {
|
7
|
-
constructor();
|
8
|
-
}
|
1
|
+
import { b as TransportConfig, T as Transport, B as BaseRpcRequests } from './createClient-5d316c7e.js';
|
2
|
+
import { H as Hash } from './chain-32f56cfa.js';
|
3
|
+
import { R as RpcResponse } from './rpc-26932bae.js';
|
9
4
|
|
10
5
|
type EthereumProvider = {
|
11
6
|
request: BaseRpcRequests['request'];
|
@@ -85,4 +80,4 @@ declare function webSocket(
|
|
85
80
|
/** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */
|
86
81
|
url?: string, { key, name, }?: WebSocketTransportConfig): WebSocketTransport;
|
87
82
|
|
88
|
-
export { CustomTransport as C, FallbackTransport as F, HttpTransport as H,
|
83
|
+
export { CustomTransport as C, FallbackTransport as F, HttpTransport as H, WebSocketTransport as W, CustomTransportConfig as a, FallbackTransportConfig as b, HttpTransportConfig as c, WebSocketTransportConfig as d, custom as e, fallback as f, http as h, webSocket as w };
|
package/dist/window.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
import { R as Requests, E as Events } from './eip1193-
|
2
|
-
import './
|
1
|
+
import { R as Requests, E as Events } from './eip1193-6c485d63.js';
|
2
|
+
import './chain-32f56cfa.js';
|
3
|
+
import '@wagmi/chains';
|
3
4
|
|
4
5
|
type WindowProvider = Requests & Events;
|
5
6
|
declare global {
|
package/dist/window.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";//# sourceMappingURL=window.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/window.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
//# sourceMappingURL=window.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "viem",
|
3
|
-
"description": "TypeScript
|
4
|
-
"
|
3
|
+
"description": "TypeScript Interface for Ethereum",
|
4
|
+
"dependencies": {
|
5
|
+
"@noble/hashes": "^1.1.2",
|
6
|
+
"@wagmi/chains": "~0.2.6",
|
7
|
+
"abitype": "~0.2.5"
|
8
|
+
},
|
9
|
+
"version": "0.0.1-alpha.21",
|
5
10
|
"files": [
|
6
11
|
"/actions",
|
7
12
|
"/chains",
|
8
13
|
"/dist",
|
9
14
|
"/clients",
|
15
|
+
"/src",
|
10
16
|
"/types",
|
11
17
|
"/utils",
|
12
18
|
"/window"
|
@@ -14,67 +20,50 @@
|
|
14
20
|
"exports": {
|
15
21
|
".": {
|
16
22
|
"types": "./dist/index.d.ts",
|
23
|
+
"module": "./dist/index.mjs",
|
17
24
|
"default": "./dist/index.js"
|
18
25
|
},
|
19
|
-
"./actions": {
|
20
|
-
"types": "./dist/actions/index.d.ts",
|
21
|
-
"default": "./dist/actions/index.js"
|
22
|
-
},
|
23
26
|
"./chains": {
|
24
27
|
"types": "./dist/chains.d.ts",
|
28
|
+
"module": "./dist/chains.mjs",
|
25
29
|
"default": "./dist/chains.js"
|
26
30
|
},
|
27
31
|
"./clients": {
|
28
32
|
"types": "./dist/clients/index.d.ts",
|
33
|
+
"module": "./dist/clients/index.mjs",
|
29
34
|
"default": "./dist/clients/index.js"
|
30
35
|
},
|
36
|
+
"./public": {
|
37
|
+
"types": "./dist/public.d.ts",
|
38
|
+
"module": "./dist/public.mjs",
|
39
|
+
"default": "./dist/public.js"
|
40
|
+
},
|
41
|
+
"./test": {
|
42
|
+
"types": "./dist/test.d.ts",
|
43
|
+
"module": "./dist/test.mjs",
|
44
|
+
"default": "./dist/test.js"
|
45
|
+
},
|
31
46
|
"./utils": {
|
32
47
|
"types": "./dist/utils/index.d.ts",
|
48
|
+
"module": "./dist/utils/index.mjs",
|
33
49
|
"default": "./dist/utils/index.js"
|
34
50
|
},
|
51
|
+
"./wallet": {
|
52
|
+
"types": "./dist/wallet.d.ts",
|
53
|
+
"module": "./dist/wallet.mjs",
|
54
|
+
"default": "./dist/wallet.js"
|
55
|
+
},
|
35
56
|
"./window": {
|
36
57
|
"types": "./dist/window.d.ts",
|
58
|
+
"module": "./dist/window.mjs",
|
37
59
|
"default": "./dist/window.js"
|
38
60
|
},
|
39
61
|
"./package.json": "./package.json"
|
40
62
|
},
|
41
|
-
"type": "module",
|
42
63
|
"main": "dist/index.js",
|
64
|
+
"module": "dist/index.mjs",
|
43
65
|
"types": "dist/index.d.ts",
|
44
66
|
"sideEffects": false,
|
45
|
-
"dependencies": {
|
46
|
-
"@noble/hashes": "^1.1.2",
|
47
|
-
"@wagmi/chains": "^0.1.0",
|
48
|
-
"abitype": "^0.2.5"
|
49
|
-
},
|
50
|
-
"devDependencies": {
|
51
|
-
"@actions/core": "^1.10.0",
|
52
|
-
"@actions/github": "^5.1.1",
|
53
|
-
"@changesets/changelog-github": "^0.4.5",
|
54
|
-
"@changesets/cli": "^2.23.2",
|
55
|
-
"@testing-library/jest-dom": "^5.16.5",
|
56
|
-
"@types/dedent": "^0.7.0",
|
57
|
-
"@types/fs-extra": "^9.0.13",
|
58
|
-
"@types/node": "^17.0.45",
|
59
|
-
"@vitest/coverage-c8": "^0.24.3",
|
60
|
-
"@vitest/ui": "^0.19.1",
|
61
|
-
"bundlewatch": "^0.3.3",
|
62
|
-
"dedent": "^0.7.0",
|
63
|
-
"esbuild": "^0.16.12",
|
64
|
-
"esbuild-register": "^3.4.2",
|
65
|
-
"essential-eth": "^0.6.2",
|
66
|
-
"ethers": "^5.7.2",
|
67
|
-
"execa": "^6.1.0",
|
68
|
-
"fs-extra": "^10.1.0",
|
69
|
-
"jsdom": "^20.0.0",
|
70
|
-
"rome": "^11.0.0",
|
71
|
-
"simple-git-hooks": "^2.8.1",
|
72
|
-
"tsup": "^6.5.0",
|
73
|
-
"typescript": "^4.9.3",
|
74
|
-
"vite": "^3.0.4",
|
75
|
-
"vitest": "^0.25.2",
|
76
|
-
"web3": "^1.8.1"
|
77
|
-
},
|
78
67
|
"license": "MIT",
|
79
68
|
"repository": "wagmi-dev/viem",
|
80
69
|
"authors": [
|
@@ -87,30 +76,5 @@
|
|
87
76
|
"dapps",
|
88
77
|
"wallet",
|
89
78
|
"web3"
|
90
|
-
]
|
91
|
-
"simple-git-hooks": {
|
92
|
-
"pre-commit": "pnpm format & pnpm lint:fix"
|
93
|
-
},
|
94
|
-
"scripts": {
|
95
|
-
"anvil": "source .env && anvil --fork-url $ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
|
96
|
-
"bench": "vitest bench --no-threads",
|
97
|
-
"bench:ci": "CI=true vitest bench --no-threads",
|
98
|
-
"build": "tsup",
|
99
|
-
"changeset": "changeset",
|
100
|
-
"changeset:release": "pnpm build && changeset publish",
|
101
|
-
"changeset:version": "changeset version && pnpm install --lockfile-only",
|
102
|
-
"dev": "DEV=true tsup",
|
103
|
-
"dev:docs": "pnpm -r --filter site dev",
|
104
|
-
"format": "rome format src/ test/ --write",
|
105
|
-
"lint": "rome check .",
|
106
|
-
"lint:fix": "pnpm lint --apply-suggested",
|
107
|
-
"playground": "pnpm --filter playground-dev dev",
|
108
|
-
"playground:benchmark": "pnpm --filter playground-benchmark dev",
|
109
|
-
"postinstall": "pnpm dev",
|
110
|
-
"preinstall": "npx only-allow pnpm",
|
111
|
-
"test": "vitest dev --coverage --no-threads",
|
112
|
-
"test:ci": "CI=true vitest --coverage --no-threads",
|
113
|
-
"test:ui": "vitest dev --ui --no-threads",
|
114
|
-
"typecheck": "tsc --noEmit"
|
115
|
-
}
|
79
|
+
]
|
116
80
|
}
|