@wagmi/core 2.0.0 → 2.0.2
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/README.md +13 -0
- package/actions/package.json +5 -0
- package/chains/package.json +5 -0
- package/dist/esm/actions/codegen/createReadContract.js +31 -0
- package/dist/esm/actions/codegen/createReadContract.js.map +1 -0
- package/dist/esm/actions/codegen/createSimulateContract.js +33 -0
- package/dist/esm/actions/codegen/createSimulateContract.js.map +1 -0
- package/dist/esm/actions/codegen/createWatchContractEvent.js +31 -0
- package/dist/esm/actions/codegen/createWatchContractEvent.js.map +1 -0
- package/dist/esm/actions/codegen/createWriteContract.js +43 -0
- package/dist/esm/actions/codegen/createWriteContract.js.map +1 -0
- package/dist/esm/actions/connect.js +15 -19
- package/dist/esm/actions/connect.js.map +1 -1
- package/dist/esm/actions/disconnect.js +10 -12
- package/dist/esm/actions/disconnect.js.map +1 -1
- package/dist/esm/actions/estimateFeesPerGas.js +3 -0
- package/dist/esm/actions/estimateFeesPerGas.js.map +1 -1
- package/dist/esm/actions/estimateGas.js +2 -2
- package/dist/esm/actions/estimateGas.js.map +1 -1
- package/dist/esm/actions/estimateMaxPriorityFeePerGas.js +12 -0
- package/dist/esm/actions/estimateMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/actions/getAccount.js +6 -1
- package/dist/esm/actions/getAccount.js.map +1 -1
- package/dist/esm/actions/getBalance.js +14 -5
- package/dist/esm/actions/getBalance.js.map +1 -1
- package/dist/esm/actions/getBlock.js +15 -0
- package/dist/esm/actions/getBlock.js.map +1 -0
- package/dist/esm/actions/getBlockNumber.js +3 -1
- package/dist/esm/actions/getBlockNumber.js.map +1 -1
- package/dist/esm/actions/getBlockTransactionCount.js +11 -0
- package/dist/esm/actions/getBlockTransactionCount.js.map +1 -0
- package/dist/esm/actions/getChainId.js +2 -1
- package/dist/esm/actions/getChainId.js.map +1 -1
- package/dist/esm/actions/getClient.js +3 -0
- package/dist/esm/actions/getClient.js.map +1 -1
- package/dist/esm/actions/getConnections.js +2 -1
- package/dist/esm/actions/getConnections.js.map +1 -1
- package/dist/esm/actions/getConnectorClient.js +7 -3
- package/dist/esm/actions/getConnectorClient.js.map +1 -1
- package/dist/esm/actions/getConnectors.js +11 -0
- package/dist/esm/actions/getConnectors.js.map +1 -0
- package/dist/esm/actions/getEnsAddress.js +3 -1
- package/dist/esm/actions/getEnsAddress.js.map +1 -1
- package/dist/esm/actions/getEnsAvatar.js +3 -1
- package/dist/esm/actions/getEnsAvatar.js.map +1 -1
- package/dist/esm/actions/getEnsName.js +3 -1
- package/dist/esm/actions/getEnsName.js.map +1 -1
- package/dist/esm/actions/getEnsResolver.js +3 -1
- package/dist/esm/actions/getEnsResolver.js.map +1 -1
- package/dist/esm/actions/getFeeHistory.js +11 -0
- package/dist/esm/actions/getFeeHistory.js.map +1 -0
- package/dist/esm/actions/getGasPrice.js +11 -0
- package/dist/esm/actions/getGasPrice.js.map +1 -0
- package/dist/esm/actions/getPublicClient.js +3 -0
- package/dist/esm/actions/getPublicClient.js.map +1 -1
- package/dist/esm/actions/getToken.js +5 -0
- package/dist/esm/actions/getToken.js.map +1 -1
- package/dist/esm/actions/getTransaction.js +2 -1
- package/dist/esm/actions/getTransaction.js.map +1 -1
- package/dist/esm/actions/getTransactionCount.js +11 -0
- package/dist/esm/actions/getTransactionCount.js.map +1 -0
- package/dist/esm/actions/getWalletClient.js +4 -0
- package/dist/esm/actions/getWalletClient.js.map +1 -1
- package/dist/esm/actions/multicall.js +2 -0
- package/dist/esm/actions/multicall.js.map +1 -1
- package/dist/esm/actions/readContract.js +2 -1
- package/dist/esm/actions/readContract.js.map +1 -1
- package/dist/esm/actions/readContracts.js.map +1 -1
- package/dist/esm/actions/reconnect.js +13 -7
- package/dist/esm/actions/reconnect.js.map +1 -1
- package/dist/esm/actions/sendTransaction.js +5 -8
- package/dist/esm/actions/sendTransaction.js.map +1 -1
- package/dist/esm/actions/signMessage.js +4 -2
- package/dist/esm/actions/signMessage.js.map +1 -1
- package/dist/esm/actions/signTypedData.js +2 -2
- package/dist/esm/actions/signTypedData.js.map +1 -1
- package/dist/esm/actions/simulateContract.js +6 -7
- package/dist/esm/actions/simulateContract.js.map +1 -1
- package/dist/esm/actions/switchAccount.js +3 -2
- package/dist/esm/actions/switchAccount.js.map +1 -1
- package/dist/esm/actions/switchChain.js +5 -5
- package/dist/esm/actions/switchChain.js.map +1 -1
- package/dist/esm/actions/verifyMessage.js +11 -0
- package/dist/esm/actions/verifyMessage.js.map +1 -0
- package/dist/esm/actions/verifyTypedData.js +12 -0
- package/dist/esm/actions/verifyTypedData.js.map +1 -0
- package/dist/esm/actions/waitForTransactionReceipt.js +7 -1
- package/dist/esm/actions/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/actions/watchAccount.js +1 -1
- package/dist/esm/actions/watchAccount.js.map +1 -1
- package/dist/esm/actions/watchBlockNumber.js +2 -4
- package/dist/esm/actions/watchBlockNumber.js.map +1 -1
- package/dist/esm/actions/watchBlocks.js +26 -0
- package/dist/esm/actions/watchBlocks.js.map +1 -0
- package/dist/esm/actions/watchChainId.js +2 -1
- package/dist/esm/actions/watchChainId.js.map +1 -1
- package/dist/esm/actions/watchClient.js +2 -1
- package/dist/esm/actions/watchClient.js.map +1 -1
- package/dist/esm/actions/watchConnections.js +2 -1
- package/dist/esm/actions/watchConnections.js.map +1 -1
- package/dist/esm/actions/watchConnectors.js +10 -0
- package/dist/esm/actions/watchConnectors.js.map +1 -0
- package/dist/esm/actions/watchContractEvent.js +6 -4
- package/dist/esm/actions/watchContractEvent.js.map +1 -1
- package/dist/esm/actions/watchPendingTransactions.js +3 -4
- package/dist/esm/actions/watchPendingTransactions.js.map +1 -1
- package/dist/esm/actions/watchPublicClient.js +2 -1
- package/dist/esm/actions/watchPublicClient.js.map +1 -1
- package/dist/esm/actions/writeContract.js +9 -11
- package/dist/esm/actions/writeContract.js.map +1 -1
- package/dist/esm/connectors/createConnector.js +8 -0
- package/dist/esm/connectors/createConnector.js.map +1 -0
- package/dist/esm/connectors/injected.js +402 -0
- package/dist/esm/connectors/injected.js.map +1 -0
- package/dist/esm/connectors/mock.js +131 -0
- package/dist/esm/connectors/mock.js.map +1 -0
- package/dist/esm/createConfig.js +65 -23
- package/dist/esm/createConfig.js.map +1 -1
- package/dist/esm/createStorage.js +4 -2
- package/dist/esm/createStorage.js.map +1 -1
- package/dist/esm/errors/base.js +1 -1
- package/dist/esm/errors/base.js.map +1 -1
- package/dist/esm/errors/config.js +3 -15
- package/dist/esm/errors/config.js.map +1 -1
- package/dist/esm/errors/connector.js.map +1 -1
- package/dist/esm/exports/actions.js +43 -11
- package/dist/esm/exports/actions.js.map +1 -1
- package/dist/esm/exports/chains.js +1 -0
- package/dist/esm/exports/chains.js.map +1 -1
- package/dist/esm/exports/codegen.js +5 -0
- package/dist/esm/exports/codegen.js.map +1 -0
- package/dist/esm/exports/index.js +67 -18
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/exports/internal.js +5 -0
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/exports/query.js +10 -0
- package/dist/esm/exports/query.js.map +1 -1
- package/dist/esm/hydrate.js +34 -0
- package/dist/esm/hydrate.js.map +1 -0
- package/dist/esm/query/disconnect.js +1 -0
- package/dist/esm/query/disconnect.js.map +1 -1
- package/dist/esm/query/estimateFeesPerGas.js +1 -0
- package/dist/esm/query/estimateFeesPerGas.js.map +1 -1
- package/dist/esm/query/estimateGas.js +1 -0
- package/dist/esm/query/estimateGas.js.map +1 -1
- package/dist/esm/query/estimateMaxPriorityFeePerGas.js +19 -0
- package/dist/esm/query/estimateMaxPriorityFeePerGas.js.map +1 -0
- package/dist/esm/query/getBalance.js +6 -4
- package/dist/esm/query/getBalance.js.map +1 -1
- package/dist/esm/query/getBlock.js +18 -0
- package/dist/esm/query/getBlock.js.map +1 -0
- package/dist/esm/query/getBlockNumber.js +1 -0
- package/dist/esm/query/getBlockNumber.js.map +1 -1
- package/dist/esm/query/getBlockTransactionCount.js +20 -0
- package/dist/esm/query/getBlockTransactionCount.js.map +1 -0
- package/dist/esm/query/getConnectorClient.js +2 -0
- package/dist/esm/query/getConnectorClient.js.map +1 -1
- package/dist/esm/query/getEnsAddress.js +1 -0
- package/dist/esm/query/getEnsAddress.js.map +1 -1
- package/dist/esm/query/getEnsAvatar.js +1 -0
- package/dist/esm/query/getEnsAvatar.js.map +1 -1
- package/dist/esm/query/getEnsName.js +1 -0
- package/dist/esm/query/getEnsName.js.map +1 -1
- package/dist/esm/query/getEnsResolver.js +1 -0
- package/dist/esm/query/getEnsResolver.js.map +1 -1
- package/dist/esm/query/getFeeHistory.js +27 -0
- package/dist/esm/query/getFeeHistory.js.map +1 -0
- package/dist/esm/query/getGasPrice.js +20 -0
- package/dist/esm/query/getGasPrice.js.map +1 -0
- package/dist/esm/query/getToken.js +1 -0
- package/dist/esm/query/getToken.js.map +1 -1
- package/dist/esm/query/getTransaction.js +4 -2
- package/dist/esm/query/getTransaction.js.map +1 -1
- package/dist/esm/query/getTransactionCount.js +23 -0
- package/dist/esm/query/getTransactionCount.js.map +1 -0
- package/dist/esm/query/getWalletClient.js +2 -0
- package/dist/esm/query/getWalletClient.js.map +1 -1
- package/dist/esm/query/infiniteReadContracts.js +25 -0
- package/dist/esm/query/infiniteReadContracts.js.map +1 -0
- package/dist/esm/query/readContract.js +7 -2
- package/dist/esm/query/readContract.js.map +1 -1
- package/dist/esm/query/readContracts.js +5 -3
- package/dist/esm/query/readContracts.js.map +1 -1
- package/dist/esm/query/reconnect.js +2 -0
- package/dist/esm/query/reconnect.js.map +1 -1
- package/dist/esm/query/sendTransaction.js +1 -0
- package/dist/esm/query/sendTransaction.js.map +1 -1
- package/dist/esm/query/signTypedData.js +1 -0
- package/dist/esm/query/signTypedData.js.map +1 -1
- package/dist/esm/query/simulateContract.js +6 -1
- package/dist/esm/query/simulateContract.js.map +1 -1
- package/dist/esm/query/switchAccount.js +3 -0
- package/dist/esm/query/switchAccount.js.map +1 -1
- package/dist/esm/query/switchChain.js +2 -0
- package/dist/esm/query/switchChain.js.map +1 -1
- package/dist/esm/query/types.js +2 -1
- package/dist/esm/query/types.js.map +1 -1
- package/dist/esm/query/utils.js +13 -0
- package/dist/esm/query/utils.js.map +1 -1
- package/dist/esm/query/verifyMessage.js +21 -0
- package/dist/esm/query/verifyMessage.js.map +1 -0
- package/dist/esm/query/verifyTypedData.js +38 -0
- package/dist/esm/query/verifyTypedData.js.map +1 -0
- package/dist/esm/query/waitForTransactionReceipt.js +3 -0
- package/dist/esm/query/waitForTransactionReceipt.js.map +1 -1
- package/dist/esm/query/writeContract.js +3 -0
- package/dist/esm/query/writeContract.js.map +1 -1
- package/dist/esm/transports/connector.js +37 -0
- package/dist/esm/transports/connector.js.map +1 -0
- package/dist/esm/transports/fallback.js +6 -0
- package/dist/esm/transports/fallback.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/chain.js +3 -1
- package/dist/esm/types/chain.js.map +1 -1
- package/dist/esm/types/properties.js +1 -1
- package/dist/esm/types/properties.js.map +1 -1
- package/dist/esm/types/register.js +1 -1
- package/dist/esm/types/register.js.map +1 -1
- package/dist/esm/utils/cookie.js +37 -0
- package/dist/esm/utils/cookie.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/actions/codegen/createReadContract.d.ts +16 -0
- package/dist/types/actions/codegen/createReadContract.d.ts.map +1 -0
- package/dist/types/actions/codegen/createSimulateContract.d.ts +20 -0
- package/dist/types/actions/codegen/createSimulateContract.d.ts.map +1 -0
- package/dist/types/actions/codegen/createWatchContractEvent.d.ts +14 -0
- package/dist/types/actions/codegen/createWatchContractEvent.d.ts.map +1 -0
- package/dist/types/actions/codegen/createWriteContract.d.ts +22 -0
- package/dist/types/actions/codegen/createWriteContract.d.ts.map +1 -0
- package/dist/types/actions/connect.d.ts +10 -11
- package/dist/types/actions/connect.d.ts.map +1 -1
- package/dist/types/actions/disconnect.d.ts +7 -6
- package/dist/types/actions/disconnect.d.ts.map +1 -1
- package/dist/types/actions/estimateFeesPerGas.d.ts +7 -5
- package/dist/types/actions/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/actions/estimateGas.d.ts +7 -5
- package/dist/types/actions/estimateGas.d.ts.map +1 -1
- package/dist/types/actions/estimateMaxPriorityFeePerGas.d.ts +11 -0
- package/dist/types/actions/estimateMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/types/actions/getAccount.d.ts +6 -2
- package/dist/types/actions/getAccount.d.ts.map +1 -1
- package/dist/types/actions/getBalance.d.ts +7 -5
- package/dist/types/actions/getBalance.d.ts.map +1 -1
- package/dist/types/actions/getBlock.d.ts +16 -0
- package/dist/types/actions/getBlock.d.ts.map +1 -0
- package/dist/types/actions/getBlockNumber.d.ts +7 -7
- package/dist/types/actions/getBlockNumber.d.ts.map +1 -1
- package/dist/types/actions/getBlockTransactionCount.d.ts +10 -0
- package/dist/types/actions/getBlockTransactionCount.d.ts.map +1 -0
- package/dist/types/actions/getChainId.d.ts +2 -2
- package/dist/types/actions/getChainId.d.ts.map +1 -1
- package/dist/types/actions/getClient.d.ts +3 -3
- package/dist/types/actions/getClient.d.ts.map +1 -1
- package/dist/types/actions/getConnections.d.ts +2 -2
- package/dist/types/actions/getConnections.d.ts.map +1 -1
- package/dist/types/actions/getConnectorClient.d.ts +6 -5
- package/dist/types/actions/getConnectorClient.d.ts.map +1 -1
- package/dist/types/actions/getConnectors.d.ts +5 -0
- package/dist/types/actions/getConnectors.d.ts.map +1 -0
- package/dist/types/actions/getEnsAddress.d.ts +5 -5
- package/dist/types/actions/getEnsAddress.d.ts.map +1 -1
- package/dist/types/actions/getEnsAvatar.d.ts +5 -5
- package/dist/types/actions/getEnsAvatar.d.ts.map +1 -1
- package/dist/types/actions/getEnsName.d.ts +5 -5
- package/dist/types/actions/getEnsName.d.ts.map +1 -1
- package/dist/types/actions/getEnsResolver.d.ts +5 -5
- package/dist/types/actions/getEnsResolver.d.ts.map +1 -1
- package/dist/types/actions/getFeeHistory.d.ts +10 -0
- package/dist/types/actions/getFeeHistory.d.ts.map +1 -0
- package/dist/types/actions/getGasPrice.d.ts +10 -0
- package/dist/types/actions/getGasPrice.d.ts.map +1 -0
- package/dist/types/actions/getPublicClient.d.ts +3 -3
- package/dist/types/actions/getPublicClient.d.ts.map +1 -1
- package/dist/types/actions/getToken.d.ts +10 -8
- package/dist/types/actions/getToken.d.ts.map +1 -1
- package/dist/types/actions/getTransaction.d.ts +8 -6
- package/dist/types/actions/getTransaction.d.ts.map +1 -1
- package/dist/types/actions/getTransactionCount.d.ts +10 -0
- package/dist/types/actions/getTransactionCount.d.ts.map +1 -0
- package/dist/types/actions/getWalletClient.d.ts +5 -4
- package/dist/types/actions/getWalletClient.d.ts.map +1 -1
- package/dist/types/actions/multicall.d.ts +5 -4
- package/dist/types/actions/multicall.d.ts.map +1 -1
- package/dist/types/actions/readContract.d.ts +4 -4
- package/dist/types/actions/readContract.d.ts.map +1 -1
- package/dist/types/actions/readContracts.d.ts +3 -1
- package/dist/types/actions/readContracts.d.ts.map +1 -1
- package/dist/types/actions/reconnect.d.ts +5 -4
- package/dist/types/actions/reconnect.d.ts.map +1 -1
- package/dist/types/actions/sendTransaction.d.ts +7 -5
- package/dist/types/actions/sendTransaction.d.ts.map +1 -1
- package/dist/types/actions/signMessage.d.ts +7 -5
- package/dist/types/actions/signMessage.d.ts.map +1 -1
- package/dist/types/actions/signTypedData.d.ts +7 -4
- package/dist/types/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/actions/simulateContract.d.ts +15 -11
- package/dist/types/actions/simulateContract.d.ts.map +1 -1
- package/dist/types/actions/switchAccount.d.ts +5 -4
- package/dist/types/actions/switchAccount.d.ts.map +1 -1
- package/dist/types/actions/switchChain.d.ts +9 -8
- package/dist/types/actions/switchChain.d.ts.map +1 -1
- package/dist/types/actions/verifyMessage.d.ts +10 -0
- package/dist/types/actions/verifyMessage.d.ts.map +1 -0
- package/dist/types/actions/verifyTypedData.d.ts +11 -0
- package/dist/types/actions/verifyTypedData.d.ts.map +1 -0
- package/dist/types/actions/waitForTransactionReceipt.d.ts +9 -6
- package/dist/types/actions/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/actions/watchAccount.d.ts +1 -1
- package/dist/types/actions/watchAccount.d.ts.map +1 -1
- package/dist/types/actions/watchBlockNumber.d.ts +1 -1
- package/dist/types/actions/watchBlockNumber.d.ts.map +1 -1
- package/dist/types/actions/watchBlocks.d.ts +13 -0
- package/dist/types/actions/watchBlocks.d.ts.map +1 -0
- package/dist/types/actions/watchChainId.d.ts +2 -2
- package/dist/types/actions/watchChainId.d.ts.map +1 -1
- package/dist/types/actions/watchClient.d.ts +2 -2
- package/dist/types/actions/watchClient.d.ts.map +1 -1
- package/dist/types/actions/watchConnections.d.ts +2 -2
- package/dist/types/actions/watchConnections.d.ts.map +1 -1
- package/dist/types/actions/watchConnectors.d.ts +9 -0
- package/dist/types/actions/watchConnectors.d.ts.map +1 -0
- package/dist/types/actions/watchContractEvent.d.ts +5 -5
- package/dist/types/actions/watchContractEvent.d.ts.map +1 -1
- package/dist/types/actions/watchPendingTransactions.d.ts +2 -2
- package/dist/types/actions/watchPendingTransactions.d.ts.map +1 -1
- package/dist/types/actions/watchPublicClient.d.ts +2 -2
- package/dist/types/actions/watchPublicClient.d.ts.map +1 -1
- package/dist/types/actions/writeContract.d.ts +14 -10
- package/dist/types/actions/writeContract.d.ts.map +1 -1
- package/dist/types/{createConnector.d.ts → connectors/createConnector.d.ts} +7 -4
- package/dist/types/connectors/createConnector.d.ts.map +1 -0
- package/dist/types/connectors/injected.d.ts +356 -0
- package/dist/types/connectors/injected.d.ts.map +1 -0
- package/dist/types/connectors/mock.d.ts +20 -0
- package/dist/types/connectors/mock.d.ts.map +1 -0
- package/dist/types/createConfig.d.ts +30 -20
- package/dist/types/createConfig.d.ts.map +1 -1
- package/dist/types/createStorage.d.ts +4 -4
- package/dist/types/createStorage.d.ts.map +1 -1
- package/dist/types/errors/base.d.ts +13 -7
- package/dist/types/errors/base.d.ts.map +1 -1
- package/dist/types/errors/config.d.ts +17 -9
- package/dist/types/errors/config.d.ts.map +1 -1
- package/dist/types/errors/connector.d.ts +6 -0
- package/dist/types/errors/connector.d.ts.map +1 -1
- package/dist/types/exports/actions.d.ts +56 -25
- package/dist/types/exports/actions.d.ts.map +1 -1
- package/dist/types/exports/chains.d.ts.map +1 -1
- package/dist/types/exports/codegen.d.ts +5 -0
- package/dist/types/exports/codegen.d.ts.map +1 -0
- package/dist/types/exports/index.d.ts +67 -29
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +3 -1
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/exports/query.d.ts +9 -0
- package/dist/types/exports/query.d.ts.map +1 -1
- package/dist/types/hydrate.d.ts +10 -0
- package/dist/types/hydrate.d.ts.map +1 -0
- package/dist/types/query/connect.d.ts +4 -4
- package/dist/types/query/connect.d.ts.map +1 -1
- package/dist/types/query/disconnect.d.ts +4 -4
- package/dist/types/query/disconnect.d.ts.map +1 -1
- package/dist/types/query/estimateFeesPerGas.d.ts +2 -2
- package/dist/types/query/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/query/estimateGas.d.ts +2 -2
- package/dist/types/query/estimateGas.d.ts.map +1 -1
- package/dist/types/query/estimateMaxPriorityFeePerGas.d.ts +27 -0
- package/dist/types/query/estimateMaxPriorityFeePerGas.d.ts.map +1 -0
- package/dist/types/query/getBalance.d.ts +2 -2
- package/dist/types/query/getBalance.d.ts.map +1 -1
- package/dist/types/query/getBlock.d.ts +19 -0
- package/dist/types/query/getBlock.d.ts.map +1 -0
- package/dist/types/query/getBlockNumber.d.ts +9 -12
- package/dist/types/query/getBlockNumber.d.ts.map +1 -1
- package/dist/types/query/getBlockTransactionCount.d.ts +18 -0
- package/dist/types/query/getBlockTransactionCount.d.ts.map +1 -0
- package/dist/types/query/getConnectorClient.d.ts +12 -3
- package/dist/types/query/getConnectorClient.d.ts.map +1 -1
- package/dist/types/query/getEnsAddress.d.ts +2 -2
- package/dist/types/query/getEnsAddress.d.ts.map +1 -1
- package/dist/types/query/getEnsAvatar.d.ts +2 -2
- package/dist/types/query/getEnsAvatar.d.ts.map +1 -1
- package/dist/types/query/getEnsName.d.ts +2 -2
- package/dist/types/query/getEnsName.d.ts.map +1 -1
- package/dist/types/query/getEnsResolver.d.ts +2 -2
- package/dist/types/query/getEnsResolver.d.ts.map +1 -1
- package/dist/types/query/getFeeHistory.d.ts +39 -0
- package/dist/types/query/getFeeHistory.d.ts.map +1 -0
- package/dist/types/query/getGasPrice.d.ts +27 -0
- package/dist/types/query/getGasPrice.d.ts.map +1 -0
- package/dist/types/query/getToken.d.ts +5 -5
- package/dist/types/query/getToken.d.ts.map +1 -1
- package/dist/types/query/getTransaction.d.ts +7 -95
- package/dist/types/query/getTransaction.d.ts.map +1 -1
- package/dist/types/query/getTransactionCount.d.ts +36 -0
- package/dist/types/query/getTransactionCount.d.ts.map +1 -0
- package/dist/types/query/getWalletClient.d.ts +27 -256
- package/dist/types/query/getWalletClient.d.ts.map +1 -1
- package/dist/types/query/infiniteReadContracts.d.ts +60 -0
- package/dist/types/query/infiniteReadContracts.d.ts.map +1 -0
- package/dist/types/query/readContract.d.ts +6 -6
- package/dist/types/query/readContract.d.ts.map +1 -1
- package/dist/types/query/readContracts.d.ts +15 -15
- package/dist/types/query/readContracts.d.ts.map +1 -1
- package/dist/types/query/reconnect.d.ts +5 -5
- package/dist/types/query/reconnect.d.ts.map +1 -1
- package/dist/types/query/sendTransaction.d.ts +4 -4
- package/dist/types/query/sendTransaction.d.ts.map +1 -1
- package/dist/types/query/signMessage.d.ts +3 -3
- package/dist/types/query/signMessage.d.ts.map +1 -1
- package/dist/types/query/signTypedData.d.ts +224 -211
- package/dist/types/query/signTypedData.d.ts.map +1 -1
- package/dist/types/query/simulateContract.d.ts +5 -5
- package/dist/types/query/simulateContract.d.ts.map +1 -1
- package/dist/types/query/switchAccount.d.ts +5 -5
- package/dist/types/query/switchAccount.d.ts.map +1 -1
- package/dist/types/query/switchChain.d.ts +6 -6
- package/dist/types/query/switchChain.d.ts.map +1 -1
- package/dist/types/query/types.d.ts +12 -5
- package/dist/types/query/types.d.ts.map +1 -1
- package/dist/types/query/utils.d.ts +1 -1
- package/dist/types/query/utils.d.ts.map +1 -1
- package/dist/types/query/verifyMessage.d.ts +42 -0
- package/dist/types/query/verifyMessage.d.ts.map +1 -0
- package/dist/types/query/verifyTypedData.d.ts +19 -0
- package/dist/types/query/verifyTypedData.d.ts.map +1 -0
- package/dist/types/query/waitForTransactionReceipt.d.ts +9 -97
- package/dist/types/query/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/query/writeContract.d.ts +12 -8
- package/dist/types/query/writeContract.d.ts.map +1 -1
- package/dist/types/transports/connector.d.ts +15 -0
- package/dist/types/transports/connector.d.ts.map +1 -0
- package/dist/types/transports/fallback.d.ts +4 -0
- package/dist/types/transports/fallback.d.ts.map +1 -0
- package/dist/types/types/chain.d.ts +3 -3
- package/dist/types/types/chain.d.ts.map +1 -1
- package/dist/types/types/properties.d.ts +4 -1
- package/dist/types/types/properties.d.ts.map +1 -1
- package/dist/types/types/register.d.ts +1 -1
- package/dist/types/types/register.d.ts.map +1 -1
- package/dist/types/types/utils.d.ts +9 -3
- package/dist/types/types/utils.d.ts.map +1 -1
- package/dist/types/utils/cookie.d.ts +9 -0
- package/dist/types/utils/cookie.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/internal/package.json +5 -0
- package/package.json +25 -27
- package/query/package.json +5 -0
- package/src/actions/codegen/createReadContract.ts +100 -0
- package/src/actions/codegen/createSimulateContract.ts +122 -0
- package/src/actions/codegen/createWatchContractEvent.ts +87 -0
- package/src/actions/codegen/createWriteContract.ts +142 -0
- package/src/actions/connect.ts +32 -32
- package/src/actions/disconnect.ts +23 -20
- package/src/actions/estimateFeesPerGas.ts +7 -4
- package/src/actions/estimateGas.ts +16 -4
- package/src/actions/estimateMaxPriorityFeePerGas.ts +41 -0
- package/src/actions/getAccount.ts +11 -2
- package/src/actions/getBalance.ts +19 -8
- package/src/actions/getBlock.ts +71 -0
- package/src/actions/getBlockNumber.ts +14 -9
- package/src/actions/getBlockTransactionCount.ts +36 -0
- package/src/actions/getChainId.ts +2 -2
- package/src/actions/getClient.ts +3 -3
- package/src/actions/getConnections.ts +2 -2
- package/src/actions/getConnectorClient.ts +18 -9
- package/src/actions/getConnectors.ts +14 -0
- package/src/actions/getEnsAddress.ts +5 -4
- package/src/actions/getEnsAvatar.ts +5 -4
- package/src/actions/getEnsName.ts +5 -4
- package/src/actions/getEnsResolver.ts +5 -4
- package/src/actions/getFeeHistory.ts +32 -0
- package/src/actions/getGasPrice.ts +31 -0
- package/src/actions/getPublicClient.ts +3 -3
- package/src/actions/getToken.ts +10 -9
- package/src/actions/getTransaction.ts +8 -5
- package/src/actions/getTransactionCount.ts +31 -0
- package/src/actions/getWalletClient.ts +13 -4
- package/src/actions/multicall.ts +6 -3
- package/src/actions/readContract.ts +4 -3
- package/src/actions/readContracts.ts +4 -4
- package/src/actions/reconnect.ts +15 -10
- package/src/actions/sendTransaction.ts +20 -13
- package/src/actions/signMessage.ts +17 -5
- package/src/actions/signTypedData.ts +22 -5
- package/src/actions/simulateContract.ts +38 -31
- package/src/actions/switchAccount.ts +12 -4
- package/src/actions/switchChain.ts +27 -16
- package/src/actions/verifyMessage.ts +28 -0
- package/src/actions/verifyTypedData.ts +38 -0
- package/src/actions/waitForTransactionReceipt.ts +22 -16
- package/src/actions/watchAccount.ts +2 -1
- package/src/actions/watchBlockNumber.ts +4 -6
- package/src/actions/watchBlocks.ts +85 -0
- package/src/actions/watchChainId.ts +2 -2
- package/src/actions/watchClient.ts +2 -2
- package/src/actions/watchConnections.ts +2 -2
- package/src/actions/watchConnectors.ts +22 -0
- package/src/actions/watchContractEvent.ts +9 -10
- package/src/actions/watchPendingTransactions.ts +3 -5
- package/src/actions/watchPublicClient.ts +2 -2
- package/src/actions/writeContract.ts +52 -44
- package/src/{createConnector.ts → connectors/createConnector.ts} +12 -16
- package/src/connectors/injected.ts +556 -0
- package/src/connectors/mock.ts +176 -0
- package/src/createConfig.ts +153 -76
- package/src/createStorage.ts +7 -6
- package/src/errors/base.ts +9 -6
- package/src/errors/config.ts +20 -18
- package/src/errors/connector.ts +6 -0
- package/src/exports/actions.ts +121 -29
- package/src/exports/chains.ts +1 -0
- package/src/exports/codegen.ts +7 -0
- package/src/exports/index.ts +177 -47
- package/src/exports/internal.ts +12 -0
- package/src/exports/query.ts +82 -0
- package/src/hydrate.ts +42 -0
- package/src/query/connect.ts +4 -4
- package/src/query/disconnect.ts +5 -5
- package/src/query/estimateFeesPerGas.ts +4 -4
- package/src/query/estimateGas.ts +5 -5
- package/src/query/estimateMaxPriorityFeePerGas.ts +51 -0
- package/src/query/getBalance.ts +9 -17
- package/src/query/getBlock.ts +84 -0
- package/src/query/getBlockNumber.ts +22 -17
- package/src/query/getBlockTransactionCount.ts +62 -0
- package/src/query/getConnectorClient.ts +5 -4
- package/src/query/getEnsAddress.ts +4 -4
- package/src/query/getEnsAvatar.ts +4 -4
- package/src/query/getEnsName.ts +4 -4
- package/src/query/getEnsResolver.ts +4 -4
- package/src/query/getFeeHistory.ts +69 -0
- package/src/query/getGasPrice.ts +54 -0
- package/src/query/getToken.ts +4 -4
- package/src/query/getTransaction.ts +7 -13
- package/src/query/getTransactionCount.ts +55 -0
- package/src/query/getWalletClient.ts +5 -4
- package/src/query/infiniteReadContracts.ts +129 -0
- package/src/query/readContract.ts +14 -12
- package/src/query/readContracts.ts +16 -16
- package/src/query/reconnect.ts +6 -6
- package/src/query/sendTransaction.ts +5 -5
- package/src/query/signMessage.ts +4 -4
- package/src/query/signTypedData.ts +20 -8
- package/src/query/simulateContract.ts +12 -8
- package/src/query/switchAccount.ts +7 -7
- package/src/query/switchChain.ts +6 -6
- package/src/query/types.ts +63 -34
- package/src/query/utils.ts +16 -1
- package/src/query/verifyMessage.ts +54 -0
- package/src/query/verifyTypedData.ts +81 -0
- package/src/query/waitForTransactionReceipt.ts +6 -6
- package/src/query/writeContract.ts +39 -10
- package/src/transports/connector.ts +87 -0
- package/src/transports/fallback.ts +10 -0
- package/src/types/chain.ts +5 -4
- package/src/types/properties.ts +3 -1
- package/src/types/register.ts +1 -1
- package/src/types/utils.ts +10 -2
- package/src/utils/cookie.ts +34 -0
- package/src/version.ts +1 -1
- package/dist/esm/createConnector.js +0 -8
- package/dist/esm/createConnector.js.map +0 -1
- package/dist/esm/utils/assertActiveChain.js +0 -14
- package/dist/esm/utils/assertActiveChain.js.map +0 -1
- package/dist/types/createConnector.d.ts.map +0 -1
- package/dist/types/utils/assertActiveChain.d.ts +0 -8
- package/dist/types/utils/assertActiveChain.d.ts.map +0 -1
- package/src/utils/assertActiveChain.ts +0 -26
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type GetFeeHistoryErrorType as viem_GetFeeHistoryErrorType,
|
|
3
|
+
type GetFeeHistoryParameters as viem_GetFeeHistoryParameters,
|
|
4
|
+
type GetFeeHistoryReturnType as viem_GetFeeHistoryReturnType,
|
|
5
|
+
getFeeHistory as viem_getFeeHistory,
|
|
6
|
+
} from 'viem/actions'
|
|
7
|
+
|
|
8
|
+
import { type Config } from '../createConfig.js'
|
|
9
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
10
|
+
import { type Evaluate } from '../types/utils.js'
|
|
11
|
+
|
|
12
|
+
export type GetFeeHistoryParameters<
|
|
13
|
+
config extends Config = Config,
|
|
14
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
15
|
+
> = Evaluate<viem_GetFeeHistoryParameters & ChainIdParameter<config, chainId>>
|
|
16
|
+
|
|
17
|
+
export type GetFeeHistoryReturnType = viem_GetFeeHistoryReturnType
|
|
18
|
+
|
|
19
|
+
export type GetFeeHistoryErrorType = viem_GetFeeHistoryErrorType
|
|
20
|
+
|
|
21
|
+
/** https://wagmi.sh/core/api/actions/getFeeHistory */
|
|
22
|
+
export function getFeeHistory<
|
|
23
|
+
config extends Config,
|
|
24
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
+
>(
|
|
26
|
+
config: config,
|
|
27
|
+
parameters: GetFeeHistoryParameters<config, chainId>,
|
|
28
|
+
): Promise<GetFeeHistoryReturnType> {
|
|
29
|
+
const { chainId } = parameters
|
|
30
|
+
const client = config.getClient({ chainId })
|
|
31
|
+
return viem_getFeeHistory(client, parameters)
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type GetGasPriceErrorType as viem_GetGasPriceErrorType,
|
|
3
|
+
type GetGasPriceReturnType as viem_GetGasPriceReturnType,
|
|
4
|
+
getGasPrice as viem_getGasPrice,
|
|
5
|
+
} from 'viem/actions'
|
|
6
|
+
|
|
7
|
+
import { type Config } from '../createConfig.js'
|
|
8
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
9
|
+
import { type Evaluate } from '../types/utils.js'
|
|
10
|
+
|
|
11
|
+
export type GetGasPriceParameters<
|
|
12
|
+
config extends Config = Config,
|
|
13
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
14
|
+
> = Evaluate<ChainIdParameter<config, chainId>>
|
|
15
|
+
|
|
16
|
+
export type GetGasPriceReturnType = viem_GetGasPriceReturnType
|
|
17
|
+
|
|
18
|
+
export type GetGasPriceErrorType = viem_GetGasPriceErrorType
|
|
19
|
+
|
|
20
|
+
/** https://wagmi.sh/core/api/actions/getGasPrice */
|
|
21
|
+
export function getGasPrice<
|
|
22
|
+
config extends Config,
|
|
23
|
+
chainId extends config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
24
|
+
>(
|
|
25
|
+
config: config,
|
|
26
|
+
parameters: GetGasPriceParameters<config, chainId> = {},
|
|
27
|
+
): Promise<GetGasPriceReturnType> {
|
|
28
|
+
const { chainId } = parameters
|
|
29
|
+
const client = config.getClient({ chainId })
|
|
30
|
+
return viem_getGasPrice(client)
|
|
31
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type PublicClient, publicActions } from 'viem'
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import type
|
|
5
|
-
import type
|
|
3
|
+
import { type Config } from '../createConfig.js'
|
|
4
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
5
|
+
import { type Evaluate } from '../types/utils.js'
|
|
6
6
|
|
|
7
7
|
export type GetPublicClientParameters<
|
|
8
8
|
config extends Config = Config,
|
package/src/actions/getToken.ts
CHANGED
|
@@ -6,18 +6,18 @@ import {
|
|
|
6
6
|
trim,
|
|
7
7
|
} from 'viem'
|
|
8
8
|
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
12
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
11
|
+
import { type Unit } from '../types/unit.js'
|
|
12
|
+
import { type Evaluate } from '../types/utils.js'
|
|
13
13
|
import { getUnit } from '../utils/getUnit.js'
|
|
14
|
-
import { readContracts } from './readContracts.js'
|
|
14
|
+
import { type ReadContractsErrorType, readContracts } from './readContracts.js'
|
|
15
15
|
|
|
16
16
|
export type GetTokenParameters<config extends Config = Config> = Evaluate<
|
|
17
|
-
{
|
|
17
|
+
ChainIdParameter<config> & {
|
|
18
18
|
address: Address
|
|
19
|
-
formatUnits?: Unit
|
|
20
|
-
}
|
|
19
|
+
formatUnits?: Unit | undefined
|
|
20
|
+
}
|
|
21
21
|
>
|
|
22
22
|
|
|
23
23
|
export type GetTokenReturnType = {
|
|
@@ -31,8 +31,9 @@ export type GetTokenReturnType = {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export type
|
|
34
|
+
export type GetTokenErrorType = ReadContractsErrorType
|
|
35
35
|
|
|
36
|
+
/** @deprecated */
|
|
36
37
|
export async function getToken<config extends Config>(
|
|
37
38
|
config: config,
|
|
38
39
|
parameters: GetTokenParameters<config>,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Chain } from 'viem'
|
|
2
2
|
import {
|
|
3
|
+
type GetTransactionErrorType as viem_GetTransactionErrorType,
|
|
3
4
|
type GetTransactionParameters as viem_GetTransactionParameters,
|
|
4
5
|
type GetTransactionReturnType as viem_GetTransactionReturnType,
|
|
5
6
|
getTransaction as viem_getTransaction,
|
|
@@ -7,8 +8,8 @@ import {
|
|
|
7
8
|
|
|
8
9
|
import { type Config } from '../createConfig.js'
|
|
9
10
|
import type { SelectChains } from '../types/chain.js'
|
|
10
|
-
import type
|
|
11
|
-
import { type Evaluate } from '../types/utils.js'
|
|
11
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
12
|
+
import { type Evaluate, type IsNarrowable } from '../types/utils.js'
|
|
12
13
|
|
|
13
14
|
export type GetTransactionParameters<
|
|
14
15
|
config extends Config = Config,
|
|
@@ -22,13 +23,15 @@ export type GetTransactionReturnType<
|
|
|
22
23
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
23
24
|
> = Evaluate<
|
|
24
25
|
{
|
|
25
|
-
[key in keyof chains]: viem_GetTransactionReturnType<
|
|
26
|
+
[key in keyof chains]: viem_GetTransactionReturnType<
|
|
27
|
+
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined
|
|
28
|
+
> & { chainId: chains[key]['id'] }
|
|
26
29
|
}[number]
|
|
27
30
|
>
|
|
28
31
|
|
|
29
|
-
export type
|
|
32
|
+
export type GetTransactionErrorType = viem_GetTransactionErrorType
|
|
30
33
|
|
|
31
|
-
/** https://
|
|
34
|
+
/** https://wagmi.sh/core/api/actions/getTransaction */
|
|
32
35
|
export function getTransaction<
|
|
33
36
|
config extends Config,
|
|
34
37
|
chainId extends config['chains'][number]['id'],
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type GetTransactionCountErrorType as viem_GetTransactionCountErrorType,
|
|
3
|
+
type GetTransactionCountParameters as viem_GetTransactionCountParameters,
|
|
4
|
+
type GetTransactionCountReturnType as viem_GetTransactionCountReturnType,
|
|
5
|
+
getTransactionCount as viem_getTransactionCount,
|
|
6
|
+
} from 'viem/actions'
|
|
7
|
+
|
|
8
|
+
import { type Config } from '../createConfig.js'
|
|
9
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
10
|
+
import { type Evaluate } from '../types/utils.js'
|
|
11
|
+
|
|
12
|
+
export type GetTransactionCountParameters<config extends Config = Config> =
|
|
13
|
+
Evaluate<ChainIdParameter<config> & viem_GetTransactionCountParameters>
|
|
14
|
+
|
|
15
|
+
export type GetTransactionCountReturnType = viem_GetTransactionCountReturnType
|
|
16
|
+
|
|
17
|
+
export type GetTransactionCountErrorType = viem_GetTransactionCountErrorType
|
|
18
|
+
|
|
19
|
+
/** https://wagmi.sh/core/api/actions/getTransactionCount */
|
|
20
|
+
export async function getTransactionCount<config extends Config>(
|
|
21
|
+
config: config,
|
|
22
|
+
parameters: GetTransactionCountParameters<config>,
|
|
23
|
+
): Promise<GetTransactionCountReturnType> {
|
|
24
|
+
const { address, blockNumber, blockTag, chainId } = parameters
|
|
25
|
+
|
|
26
|
+
const client = config.getClient({ chainId })
|
|
27
|
+
return await viem_getTransactionCount(
|
|
28
|
+
client,
|
|
29
|
+
blockNumber ? { address, blockNumber } : { address, blockTag },
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type Account, type WalletClient, walletActions } from 'viem'
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import type {
|
|
3
|
+
import { type Config } from '../createConfig.js'
|
|
4
|
+
import type { BaseErrorType, ErrorType } from '../errors/base.js'
|
|
5
|
+
import { type Evaluate } from '../types/utils.js'
|
|
5
6
|
import {
|
|
6
|
-
type
|
|
7
|
+
type GetConnectorClientErrorType,
|
|
7
8
|
type GetConnectorClientParameters,
|
|
8
9
|
getConnectorClient,
|
|
9
10
|
} from './getConnectorClient.js'
|
|
@@ -24,7 +25,12 @@ export type GetWalletClientReturnType<
|
|
|
24
25
|
>
|
|
25
26
|
>
|
|
26
27
|
|
|
27
|
-
export type
|
|
28
|
+
export type GetWalletClientErrorType =
|
|
29
|
+
// getConnectorClient()
|
|
30
|
+
| GetConnectorClientErrorType
|
|
31
|
+
// base
|
|
32
|
+
| BaseErrorType
|
|
33
|
+
| ErrorType
|
|
28
34
|
|
|
29
35
|
export async function getWalletClient<
|
|
30
36
|
config extends Config,
|
|
@@ -34,6 +40,9 @@ export async function getWalletClient<
|
|
|
34
40
|
parameters: GetWalletClientParameters<config, chainId> = {},
|
|
35
41
|
): Promise<GetWalletClientReturnType<config, chainId>> {
|
|
36
42
|
const client = await getConnectorClient(config, parameters)
|
|
43
|
+
client.extend(walletActions)
|
|
44
|
+
|
|
45
|
+
// @ts-ignore
|
|
37
46
|
return client.extend(walletActions) as unknown as GetWalletClientReturnType<
|
|
38
47
|
config,
|
|
39
48
|
chainId
|
package/src/actions/multicall.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ContractFunctionParameters,
|
|
3
|
+
MulticallErrorType as viem_MulticallErrorType,
|
|
3
4
|
MulticallParameters as viem_MulticallParameters,
|
|
4
5
|
MulticallReturnType as viem_MulticallReturnType,
|
|
5
6
|
} from 'viem'
|
|
6
7
|
import { multicall as viem_multicall } from 'viem/actions'
|
|
7
8
|
|
|
8
|
-
import type
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
10
11
|
|
|
11
12
|
export type MulticallParameters<
|
|
12
13
|
contracts extends readonly unknown[] = readonly ContractFunctionParameters[],
|
|
@@ -19,9 +20,11 @@ export type MulticallReturnType<
|
|
|
19
20
|
allowFailure extends boolean = true,
|
|
20
21
|
> = viem_MulticallReturnType<contracts, allowFailure>
|
|
21
22
|
|
|
23
|
+
export type MulticallErrorType = viem_MulticallErrorType
|
|
24
|
+
|
|
22
25
|
export async function multicall<
|
|
23
26
|
config extends Config,
|
|
24
|
-
const contracts extends readonly
|
|
27
|
+
const contracts extends readonly ContractFunctionParameters[],
|
|
25
28
|
allowFailure extends boolean = true,
|
|
26
29
|
>(
|
|
27
30
|
config: config,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { type Abi } from 'viem'
|
|
2
2
|
import type { ContractFunctionArgs, ContractFunctionName } from 'viem'
|
|
3
3
|
import {
|
|
4
|
+
type ReadContractErrorType as viem_ReadContractErrorType,
|
|
4
5
|
type ReadContractParameters as viem_ReadContractParameters,
|
|
5
6
|
type ReadContractReturnType as viem_ReadContractReturnType,
|
|
6
7
|
readContract as viem_readContract,
|
|
7
8
|
} from 'viem/actions'
|
|
8
9
|
|
|
9
10
|
import { type Config } from '../createConfig.js'
|
|
10
|
-
import type
|
|
11
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
11
12
|
|
|
12
13
|
export type ReadContractParameters<
|
|
13
14
|
abi extends Abi | readonly unknown[] = Abi,
|
|
@@ -37,9 +38,9 @@ export type ReadContractReturnType<
|
|
|
37
38
|
> = ContractFunctionArgs<abi, 'pure' | 'view', functionName>,
|
|
38
39
|
> = viem_ReadContractReturnType<abi, functionName, args>
|
|
39
40
|
|
|
40
|
-
export type
|
|
41
|
+
export type ReadContractErrorType = viem_ReadContractErrorType
|
|
41
42
|
|
|
42
|
-
/** https://
|
|
43
|
+
/** https://wagmi.sh/core/api/actions/readContract */
|
|
43
44
|
export function readContract<
|
|
44
45
|
config extends Config,
|
|
45
46
|
const abi extends Abi | readonly unknown[],
|
|
@@ -7,8 +7,8 @@ import { ContractFunctionExecutionError } from 'viem'
|
|
|
7
7
|
|
|
8
8
|
import { type Config } from '../createConfig.js'
|
|
9
9
|
import { type ChainIdParameter } from '../types/properties.js'
|
|
10
|
-
import { multicall } from './multicall.js'
|
|
11
|
-
import { readContract } from './readContract.js'
|
|
10
|
+
import { type MulticallErrorType, multicall } from './multicall.js'
|
|
11
|
+
import { type ReadContractErrorType, readContract } from './readContract.js'
|
|
12
12
|
|
|
13
13
|
export type ReadContractsParameters<
|
|
14
14
|
contracts extends readonly unknown[] = readonly ContractFunctionParameters[],
|
|
@@ -25,7 +25,7 @@ export type ReadContractsReturnType<
|
|
|
25
25
|
allowFailure extends boolean = true,
|
|
26
26
|
> = viem_MulticallReturnType<contracts, allowFailure>
|
|
27
27
|
|
|
28
|
-
export type
|
|
28
|
+
export type ReadContractsErrorType = MulticallErrorType | ReadContractErrorType
|
|
29
29
|
|
|
30
30
|
export async function readContracts<
|
|
31
31
|
config extends Config,
|
|
@@ -73,7 +73,7 @@ export async function readContracts<
|
|
|
73
73
|
(contracts) => contracts.map(({ index }) => index),
|
|
74
74
|
)
|
|
75
75
|
return multicallResults.reduce((results, result, index) => {
|
|
76
|
-
if (results) results[resultIndexes[index]!] = result
|
|
76
|
+
if (results) (results as unknown[])[resultIndexes[index]!] = result
|
|
77
77
|
return results
|
|
78
78
|
}, [] as unknown[]) as ReadContractsReturnType<contracts, allowFailure>
|
|
79
79
|
} catch (error) {
|
package/src/actions/reconnect.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address } from 'viem'
|
|
2
2
|
|
|
3
|
+
import { type CreateConnectorFn } from '../connectors/createConnector.js'
|
|
3
4
|
import type { Config, Connection, Connector } from '../createConfig.js'
|
|
4
|
-
import {
|
|
5
|
-
import type
|
|
5
|
+
import type { ErrorType } from '../errors/base.js'
|
|
6
|
+
import { type Evaluate } from '../types/utils.js'
|
|
6
7
|
|
|
7
8
|
export type ReconnectParameters = {
|
|
8
9
|
/** Connectors to attempt reconnect with */
|
|
@@ -11,11 +12,11 @@ export type ReconnectParameters = {
|
|
|
11
12
|
|
|
12
13
|
export type ReconnectReturnType = Evaluate<Connection>[]
|
|
13
14
|
|
|
14
|
-
export type
|
|
15
|
+
export type ReconnectErrorType = ErrorType
|
|
15
16
|
|
|
16
17
|
let isReconnecting = false
|
|
17
18
|
|
|
18
|
-
/** https://
|
|
19
|
+
/** https://wagmi.sh/core/api/actions/reconnect */
|
|
19
20
|
export async function reconnect(
|
|
20
21
|
config: Config,
|
|
21
22
|
parameters: ReconnectParameters = {},
|
|
@@ -35,7 +36,7 @@ export async function reconnect(
|
|
|
35
36
|
let connector: Connector
|
|
36
37
|
// "Register" connector if not already created
|
|
37
38
|
if (typeof connector_ === 'function')
|
|
38
|
-
connector = config._internal.setup(connector_)
|
|
39
|
+
connector = config._internal.connectors.setup(connector_)
|
|
39
40
|
else connector = connector_
|
|
40
41
|
connectors.push(connector)
|
|
41
42
|
}
|
|
@@ -63,10 +64,14 @@ export async function reconnect(
|
|
|
63
64
|
const isAuthorized = await connector.isAuthorized()
|
|
64
65
|
if (!isAuthorized) continue
|
|
65
66
|
|
|
66
|
-
const data = await connector
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
const data = await connector
|
|
68
|
+
.connect({ isReconnecting: true })
|
|
69
|
+
.catch(() => null)
|
|
70
|
+
if (!data) continue
|
|
71
|
+
|
|
72
|
+
connector.emitter.off('connect', config._internal.events.connect)
|
|
73
|
+
connector.emitter.on('change', config._internal.events.change)
|
|
74
|
+
connector.emitter.on('disconnect', config._internal.events.disconnect)
|
|
70
75
|
|
|
71
76
|
config.setState((x) => {
|
|
72
77
|
const connections = new Map(connected ? x.connections : new Map()).set(
|
|
@@ -2,20 +2,24 @@ import type {
|
|
|
2
2
|
Account,
|
|
3
3
|
Address,
|
|
4
4
|
Chain,
|
|
5
|
+
SendTransactionErrorType as viem_SendTransactionErrorType,
|
|
5
6
|
SendTransactionParameters as viem_SendTransactionParameters,
|
|
6
7
|
SendTransactionReturnType as viem_SendTransactionReturnType,
|
|
7
8
|
} from 'viem'
|
|
8
9
|
import { sendTransaction as viem_sendTransaction } from 'viem/actions'
|
|
9
10
|
|
|
10
|
-
import type
|
|
11
|
+
import { type Config } from '../createConfig.js'
|
|
12
|
+
import type { BaseErrorType, ErrorType } from '../errors/base.js'
|
|
11
13
|
import type { SelectChains } from '../types/chain.js'
|
|
12
14
|
import type {
|
|
13
15
|
ChainIdParameter,
|
|
14
16
|
ConnectorParameter,
|
|
15
17
|
} from '../types/properties.js'
|
|
16
|
-
import type
|
|
17
|
-
import {
|
|
18
|
-
|
|
18
|
+
import { type Evaluate } from '../types/utils.js'
|
|
19
|
+
import {
|
|
20
|
+
type GetConnectorClientErrorType,
|
|
21
|
+
getConnectorClient,
|
|
22
|
+
} from './getConnectorClient.js'
|
|
19
23
|
|
|
20
24
|
export type SendTransactionParameters<
|
|
21
25
|
config extends Config = Config,
|
|
@@ -37,9 +41,16 @@ export type SendTransactionParameters<
|
|
|
37
41
|
|
|
38
42
|
export type SendTransactionReturnType = viem_SendTransactionReturnType
|
|
39
43
|
|
|
40
|
-
export type
|
|
44
|
+
export type SendTransactionErrorType =
|
|
45
|
+
// getConnectorClient()
|
|
46
|
+
| GetConnectorClientErrorType
|
|
47
|
+
// base
|
|
48
|
+
| BaseErrorType
|
|
49
|
+
| ErrorType
|
|
50
|
+
// viem
|
|
51
|
+
| viem_SendTransactionErrorType
|
|
41
52
|
|
|
42
|
-
/** https://
|
|
53
|
+
/** https://wagmi.sh/core/api/actions/sendTransaction */
|
|
43
54
|
export async function sendTransaction<
|
|
44
55
|
config extends Config,
|
|
45
56
|
chainId extends config['chains'][number]['id'],
|
|
@@ -54,15 +65,11 @@ export async function sendTransaction<
|
|
|
54
65
|
chainId,
|
|
55
66
|
connector,
|
|
56
67
|
})
|
|
57
|
-
if (chainId)
|
|
58
|
-
assertActiveChain(config, { activeChainId: client.chain.id, chainId })
|
|
59
68
|
|
|
60
69
|
const hash = await viem_sendTransaction(client, {
|
|
61
|
-
...(rest as
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
chain: null,
|
|
65
|
-
} as viem_SendTransactionParameters)
|
|
70
|
+
...(rest as any),
|
|
71
|
+
chain: chainId ? { id: chainId } : null,
|
|
72
|
+
})
|
|
66
73
|
|
|
67
74
|
return hash
|
|
68
75
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Account } from 'viem'
|
|
2
2
|
import {
|
|
3
|
+
type SignMessageErrorType as viem_SignMessageErrorType,
|
|
3
4
|
type SignMessageParameters as viem_SignMessageParameters,
|
|
4
5
|
type SignMessageReturnType as viem_SignMessageReturnType,
|
|
5
6
|
signMessage as viem_signMessage,
|
|
6
7
|
} from 'viem/actions'
|
|
7
8
|
|
|
8
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { BaseErrorType, ErrorType } from '../errors/base.js'
|
|
9
11
|
import type { ConnectorParameter } from '../types/properties.js'
|
|
10
|
-
import type
|
|
11
|
-
import {
|
|
12
|
+
import { type Evaluate } from '../types/utils.js'
|
|
13
|
+
import {
|
|
14
|
+
type GetConnectorClientErrorType,
|
|
15
|
+
getConnectorClient,
|
|
16
|
+
} from './getConnectorClient.js'
|
|
12
17
|
|
|
13
18
|
export type SignMessageParameters = Evaluate<
|
|
14
19
|
viem_SignMessageParameters<Account> & ConnectorParameter
|
|
@@ -16,9 +21,16 @@ export type SignMessageParameters = Evaluate<
|
|
|
16
21
|
|
|
17
22
|
export type SignMessageReturnType = viem_SignMessageReturnType
|
|
18
23
|
|
|
19
|
-
export type
|
|
24
|
+
export type SignMessageErrorType =
|
|
25
|
+
// getConnectorClient()
|
|
26
|
+
| GetConnectorClientErrorType
|
|
27
|
+
// base
|
|
28
|
+
| BaseErrorType
|
|
29
|
+
| ErrorType
|
|
30
|
+
// viem
|
|
31
|
+
| viem_SignMessageErrorType
|
|
20
32
|
|
|
21
|
-
/** https://
|
|
33
|
+
/** https://wagmi.sh/core/api/actions/signMessage */
|
|
22
34
|
export async function signMessage(
|
|
23
35
|
config: Config,
|
|
24
36
|
parameters: SignMessageParameters,
|
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
import type { Account, TypedData } from 'viem'
|
|
2
2
|
import {
|
|
3
|
+
type SignMessageErrorType as viem_SignMessageErrorType,
|
|
3
4
|
type SignTypedDataParameters as viem_SignTypedDataParameters,
|
|
4
5
|
type SignTypedDataReturnType as viem_SignTypedDataReturnType,
|
|
5
6
|
signTypedData as viem_signTypedData,
|
|
6
7
|
} from 'viem/actions'
|
|
7
8
|
|
|
8
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
+
import type { BaseErrorType, ErrorType } from '../errors/base.js'
|
|
9
11
|
import type { ConnectorParameter } from '../types/properties.js'
|
|
10
|
-
import {
|
|
12
|
+
import type { UnionEvaluate } from '../types/utils.js'
|
|
13
|
+
import {
|
|
14
|
+
type GetConnectorClientErrorType,
|
|
15
|
+
getConnectorClient,
|
|
16
|
+
} from './getConnectorClient.js'
|
|
11
17
|
|
|
12
18
|
export type SignTypedDataParameters<
|
|
13
19
|
typedData extends TypedData | Record<string, unknown> = TypedData,
|
|
14
20
|
primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData,
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
///
|
|
22
|
+
primaryTypes = typedData extends TypedData ? keyof typedData : string,
|
|
23
|
+
> = UnionEvaluate<
|
|
24
|
+
viem_SignTypedDataParameters<typedData, primaryType, Account, primaryTypes> &
|
|
25
|
+
ConnectorParameter
|
|
26
|
+
>
|
|
17
27
|
|
|
18
28
|
export type SignTypedDataReturnType = viem_SignTypedDataReturnType
|
|
19
29
|
|
|
20
|
-
export type
|
|
30
|
+
export type SignTypedDataErrorType =
|
|
31
|
+
// getConnectorClient()
|
|
32
|
+
| GetConnectorClientErrorType
|
|
33
|
+
// base
|
|
34
|
+
| BaseErrorType
|
|
35
|
+
| ErrorType
|
|
36
|
+
// viem
|
|
37
|
+
| viem_SignMessageErrorType
|
|
21
38
|
|
|
22
|
-
/** https://
|
|
39
|
+
/** https://wagmi.sh/core/api/actions/signTypedData */
|
|
23
40
|
export async function signTypedData<
|
|
24
41
|
const typedData extends TypedData | Record<string, unknown>,
|
|
25
42
|
primaryType extends keyof typedData | 'EIP712Domain',
|
|
@@ -7,20 +7,29 @@ import type {
|
|
|
7
7
|
ContractFunctionName,
|
|
8
8
|
} from 'viem'
|
|
9
9
|
import {
|
|
10
|
+
type SimulateContractErrorType as viem_SimulateContractErrorType,
|
|
10
11
|
type SimulateContractParameters as viem_SimulateContractParameters,
|
|
11
12
|
type SimulateContractReturnType as viem_SimulateContractReturnType,
|
|
12
13
|
simulateContract as viem_simulateContract,
|
|
13
14
|
} from 'viem/actions'
|
|
14
15
|
|
|
15
16
|
import { type Config } from '../createConfig.js'
|
|
16
|
-
import type
|
|
17
|
-
import type
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
import { type BaseErrorType, type ErrorType } from '../errors/base.js'
|
|
18
|
+
import { type SelectChains } from '../types/chain.js'
|
|
19
|
+
import {
|
|
20
|
+
type ChainIdParameter,
|
|
21
|
+
type ConnectorParameter,
|
|
20
22
|
} from '../types/properties.js'
|
|
21
|
-
import type {
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
import type {
|
|
24
|
+
Evaluate,
|
|
25
|
+
PartialBy,
|
|
26
|
+
UnionEvaluate,
|
|
27
|
+
UnionOmit,
|
|
28
|
+
} from '../types/utils.js'
|
|
29
|
+
import {
|
|
30
|
+
type GetConnectorClientErrorType,
|
|
31
|
+
getConnectorClient,
|
|
32
|
+
} from './getConnectorClient.js'
|
|
24
33
|
|
|
25
34
|
export type SimulateContractParameters<
|
|
26
35
|
abi extends Abi | readonly unknown[] = Abi,
|
|
@@ -47,7 +56,8 @@ export type SimulateContractParameters<
|
|
|
47
56
|
functionName,
|
|
48
57
|
args,
|
|
49
58
|
chains[key],
|
|
50
|
-
chains[key]
|
|
59
|
+
chains[key],
|
|
60
|
+
Account | Address
|
|
51
61
|
>,
|
|
52
62
|
'chain'
|
|
53
63
|
>
|
|
@@ -78,31 +88,30 @@ export type SimulateContractReturnType<
|
|
|
78
88
|
abi,
|
|
79
89
|
functionName,
|
|
80
90
|
args,
|
|
91
|
+
chains[key],
|
|
92
|
+
Account,
|
|
81
93
|
chains[key]
|
|
82
|
-
>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
UnionOmit<type, 'request'> & {
|
|
89
|
-
request: UnionEvaluate<
|
|
90
|
-
UnionOmit<type['request'], 'chain'> &
|
|
91
|
-
PartialBy<
|
|
92
|
-
{ __mode: 'prepared'; chainId: chainId },
|
|
93
|
-
chainId extends config['chains'][number]['id']
|
|
94
|
-
? never
|
|
95
|
-
: 'chainId'
|
|
96
|
-
>
|
|
97
|
-
>
|
|
98
|
-
}
|
|
94
|
+
> & {
|
|
95
|
+
chainId: chains[key]['id']
|
|
96
|
+
request: Evaluate<
|
|
97
|
+
PartialBy<
|
|
98
|
+
{ __mode: 'prepared'; chainId: chainId; chain: chains[key] },
|
|
99
|
+
chainId extends config['chains'][number]['id'] ? never : 'chainId'
|
|
99
100
|
>
|
|
100
|
-
|
|
101
|
+
>
|
|
102
|
+
}
|
|
101
103
|
}[number]
|
|
102
104
|
|
|
103
|
-
export type
|
|
105
|
+
export type SimulateContractErrorType =
|
|
106
|
+
// getConnectorClient()
|
|
107
|
+
| GetConnectorClientErrorType
|
|
108
|
+
// base
|
|
109
|
+
| BaseErrorType
|
|
110
|
+
| ErrorType
|
|
111
|
+
// viem
|
|
112
|
+
| viem_SimulateContractErrorType
|
|
104
113
|
|
|
105
|
-
/** https://
|
|
114
|
+
/** https://wagmi.sh/core/api/actions/simulateContract */
|
|
106
115
|
export async function simulateContract<
|
|
107
116
|
config extends Config,
|
|
108
117
|
const abi extends Abi | readonly unknown[],
|
|
@@ -129,7 +138,6 @@ export async function simulateContract<
|
|
|
129
138
|
parameters as SimulateContractParameters
|
|
130
139
|
|
|
131
140
|
let account: Address | Account
|
|
132
|
-
let activeChainId: number | undefined
|
|
133
141
|
if (parameters.account) account = parameters.account
|
|
134
142
|
else {
|
|
135
143
|
const connectorClient = await getConnectorClient(config, {
|
|
@@ -137,9 +145,7 @@ export async function simulateContract<
|
|
|
137
145
|
connector,
|
|
138
146
|
})
|
|
139
147
|
account = connectorClient.account
|
|
140
|
-
activeChainId = connectorClient.chain.id
|
|
141
148
|
}
|
|
142
|
-
if (chainId) assertActiveChain(config, { activeChainId, chainId })
|
|
143
149
|
|
|
144
150
|
const client = config.getClient({ chainId })
|
|
145
151
|
const { result, request } = await viem_simulateContract(client, {
|
|
@@ -149,6 +155,7 @@ export async function simulateContract<
|
|
|
149
155
|
})
|
|
150
156
|
|
|
151
157
|
return {
|
|
158
|
+
chainId: client.chain.id,
|
|
152
159
|
result,
|
|
153
160
|
request: { __mode: 'prepared', ...request, chainId },
|
|
154
161
|
} as unknown as SimulateContractReturnType<
|