@wagmi/core 2.0.0-alpha.8 → 2.0.0-beta.0
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 +2 -2
- package/dist/esm/actions/connect.js +4 -3
- package/dist/esm/actions/connect.js.map +1 -1
- package/dist/esm/actions/disconnect.js +1 -1
- 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/getAccount.js +1 -1
- package/dist/esm/actions/getAccount.js.map +1 -1
- package/dist/esm/actions/getBalance.js +3 -1
- package/dist/esm/actions/getBalance.js.map +1 -1
- package/dist/esm/actions/getBlock.js +3 -1
- package/dist/esm/actions/getBlock.js.map +1 -1
- package/dist/esm/actions/getBlockNumber.js +3 -1
- package/dist/esm/actions/getBlockNumber.js.map +1 -1
- 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 +1 -1
- package/dist/esm/actions/getConnectors.js.map +1 -1
- 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/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/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/reconnect.js +3 -1
- package/dist/esm/actions/reconnect.js.map +1 -1
- package/dist/esm/actions/sendTransaction.js +4 -5
- 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 +2 -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/waitForTransactionReceipt.js +3 -0
- 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 +1 -1
- package/dist/esm/actions/watchBlockNumber.js.map +1 -1
- package/dist/esm/actions/watchBlocks.js +1 -1
- package/dist/esm/actions/watchBlocks.js.map +1 -1
- 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 +2 -1
- package/dist/esm/actions/watchConnectors.js.map +1 -1
- package/dist/esm/actions/watchContractEvent.js +2 -1
- package/dist/esm/actions/watchContractEvent.js.map +1 -1
- package/dist/esm/actions/watchPendingTransactions.js +2 -1
- 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 +4 -7
- package/dist/esm/actions/writeContract.js.map +1 -1
- package/dist/esm/connectors/createConnector.js +2 -2
- package/dist/esm/connectors/createConnector.js.map +1 -1
- package/dist/esm/connectors/injected.js +2 -1
- package/dist/esm/connectors/injected.js.map +1 -1
- package/dist/esm/createConfig.js +11 -3
- package/dist/esm/createConfig.js.map +1 -1
- package/dist/esm/createStorage.js +2 -0
- 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/index.js +5 -1
- package/dist/esm/exports/index.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/getBalance.js +1 -0
- package/dist/esm/query/getBalance.js.map +1 -1
- package/dist/esm/query/getBlock.js +1 -0
- package/dist/esm/query/getBlock.js.map +1 -1
- package/dist/esm/query/getBlockNumber.js +1 -0
- package/dist/esm/query/getBlockNumber.js.map +1 -1
- package/dist/esm/query/getConnectorClient.js +1 -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/getToken.js +1 -0
- package/dist/esm/query/getToken.js.map +1 -1
- package/dist/esm/query/getTransaction.js +1 -0
- package/dist/esm/query/getTransaction.js.map +1 -1
- package/dist/esm/query/getWalletClient.js +1 -0
- package/dist/esm/query/getWalletClient.js.map +1 -1
- package/dist/esm/query/infiniteReadContracts.js +2 -0
- package/dist/esm/query/infiniteReadContracts.js.map +1 -1
- package/dist/esm/query/readContract.js +1 -0
- package/dist/esm/query/readContract.js.map +1 -1
- package/dist/esm/query/readContracts.js +2 -0
- 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 +1 -0
- 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 +1 -0
- package/dist/esm/query/utils.js.map +1 -1
- 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/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/esm/version.js.map +1 -1
- package/dist/types/actions/connect.d.ts +7 -8
- package/dist/types/actions/connect.d.ts.map +1 -1
- package/dist/types/actions/disconnect.d.ts +4 -2
- package/dist/types/actions/disconnect.d.ts.map +1 -1
- package/dist/types/actions/estimateFeesPerGas.d.ts +5 -3
- package/dist/types/actions/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/actions/estimateGas.d.ts +4 -2
- package/dist/types/actions/estimateGas.d.ts.map +1 -1
- package/dist/types/actions/getAccount.d.ts +1 -1
- package/dist/types/actions/getAccount.d.ts.map +1 -1
- package/dist/types/actions/getBalance.d.ts +5 -3
- package/dist/types/actions/getBalance.d.ts.map +1 -1
- package/dist/types/actions/getBlock.d.ts +3 -3
- package/dist/types/actions/getBlock.d.ts.map +1 -1
- package/dist/types/actions/getBlockNumber.d.ts +3 -3
- package/dist/types/actions/getBlockNumber.d.ts.map +1 -1
- 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 +1 -1
- package/dist/types/actions/getConnectors.d.ts.map +1 -1
- package/dist/types/actions/getEnsAddress.d.ts +3 -3
- package/dist/types/actions/getEnsAddress.d.ts.map +1 -1
- package/dist/types/actions/getEnsAvatar.d.ts +3 -3
- package/dist/types/actions/getEnsAvatar.d.ts.map +1 -1
- package/dist/types/actions/getEnsName.d.ts +3 -3
- package/dist/types/actions/getEnsName.d.ts.map +1 -1
- package/dist/types/actions/getEnsResolver.d.ts +3 -3
- package/dist/types/actions/getEnsResolver.d.ts.map +1 -1
- 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 +5 -4
- package/dist/types/actions/getToken.d.ts.map +1 -1
- package/dist/types/actions/getTransaction.d.ts +2 -2
- package/dist/types/actions/getTransaction.d.ts.map +1 -1
- package/dist/types/actions/getWalletClient.d.ts +4 -3
- package/dist/types/actions/getWalletClient.d.ts.map +1 -1
- package/dist/types/actions/multicall.d.ts +2 -2
- package/dist/types/actions/multicall.d.ts.map +1 -1
- package/dist/types/actions/readContract.d.ts +2 -2
- package/dist/types/actions/readContract.d.ts.map +1 -1
- package/dist/types/actions/reconnect.d.ts +4 -3
- package/dist/types/actions/reconnect.d.ts.map +1 -1
- package/dist/types/actions/sendTransaction.d.ts +6 -4
- package/dist/types/actions/sendTransaction.d.ts.map +1 -1
- package/dist/types/actions/signMessage.d.ts +6 -4
- package/dist/types/actions/signMessage.d.ts.map +1 -1
- package/dist/types/actions/signTypedData.d.ts +4 -2
- package/dist/types/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/actions/simulateContract.d.ts +6 -4
- 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 +7 -6
- package/dist/types/actions/switchChain.d.ts.map +1 -1
- package/dist/types/actions/waitForTransactionReceipt.d.ts +3 -3
- 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 +1 -1
- package/dist/types/actions/watchBlocks.d.ts.map +1 -1
- 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 +2 -2
- package/dist/types/actions/watchConnectors.d.ts.map +1 -1
- package/dist/types/actions/watchContractEvent.d.ts +2 -2
- 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 +6 -3
- package/dist/types/actions/writeContract.d.ts.map +1 -1
- package/dist/types/connectors/createConnector.d.ts +1 -1
- package/dist/types/connectors/createConnector.d.ts.map +1 -1
- package/dist/types/connectors/injected.d.ts +5 -1
- package/dist/types/connectors/injected.d.ts.map +1 -1
- package/dist/types/createConfig.d.ts +7 -0
- package/dist/types/createConfig.d.ts.map +1 -1
- package/dist/types/createStorage.d.ts +3 -3
- package/dist/types/createStorage.d.ts.map +1 -1
- package/dist/types/errors/base.d.ts +6 -0
- 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/index.d.ts +4 -2
- package/dist/types/exports/index.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/disconnect.d.ts +1 -1
- package/dist/types/query/disconnect.d.ts.map +1 -1
- package/dist/types/query/estimateFeesPerGas.d.ts +1 -1
- package/dist/types/query/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/query/estimateGas.d.ts +1 -1
- package/dist/types/query/estimateGas.d.ts.map +1 -1
- package/dist/types/query/getBalance.d.ts +1 -1
- package/dist/types/query/getBalance.d.ts.map +1 -1
- package/dist/types/query/getBlock.d.ts +2 -94
- package/dist/types/query/getBlock.d.ts.map +1 -1
- package/dist/types/query/getBlockNumber.d.ts +1 -1
- package/dist/types/query/getBlockNumber.d.ts.map +1 -1
- package/dist/types/query/getConnectorClient.d.ts +6 -2
- package/dist/types/query/getConnectorClient.d.ts.map +1 -1
- package/dist/types/query/getEnsAddress.d.ts +1 -1
- package/dist/types/query/getEnsAddress.d.ts.map +1 -1
- package/dist/types/query/getEnsAvatar.d.ts +1 -1
- package/dist/types/query/getEnsAvatar.d.ts.map +1 -1
- package/dist/types/query/getEnsName.d.ts +1 -1
- package/dist/types/query/getEnsName.d.ts.map +1 -1
- package/dist/types/query/getEnsResolver.d.ts +1 -1
- package/dist/types/query/getEnsResolver.d.ts.map +1 -1
- package/dist/types/query/getToken.d.ts +1 -1
- package/dist/types/query/getToken.d.ts.map +1 -1
- package/dist/types/query/getTransaction.d.ts +2 -94
- package/dist/types/query/getTransaction.d.ts.map +1 -1
- package/dist/types/query/getWalletClient.d.ts +7 -237
- package/dist/types/query/getWalletClient.d.ts.map +1 -1
- package/dist/types/query/infiniteReadContracts.d.ts +2 -2
- package/dist/types/query/infiniteReadContracts.d.ts.map +1 -1
- package/dist/types/query/readContract.d.ts +1 -1
- package/dist/types/query/readContract.d.ts.map +1 -1
- package/dist/types/query/readContracts.d.ts +2 -2
- package/dist/types/query/readContracts.d.ts.map +1 -1
- package/dist/types/query/reconnect.d.ts +2 -2
- package/dist/types/query/reconnect.d.ts.map +1 -1
- package/dist/types/query/sendTransaction.d.ts +1 -1
- package/dist/types/query/sendTransaction.d.ts.map +1 -1
- package/dist/types/query/signTypedData.d.ts +1 -1
- package/dist/types/query/signTypedData.d.ts.map +1 -1
- package/dist/types/query/simulateContract.d.ts +1 -1
- package/dist/types/query/simulateContract.d.ts.map +1 -1
- package/dist/types/query/switchAccount.d.ts +2 -2
- package/dist/types/query/switchAccount.d.ts.map +1 -1
- package/dist/types/query/switchChain.d.ts +2 -2
- package/dist/types/query/switchChain.d.ts.map +1 -1
- package/dist/types/query/types.d.ts +2 -2
- 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/waitForTransactionReceipt.d.ts +4 -96
- package/dist/types/query/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/query/writeContract.d.ts +4 -50
- package/dist/types/query/writeContract.d.ts.map +1 -1
- 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 +1 -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/dist/types/version.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/actions/connect.ts +18 -12
- package/src/actions/disconnect.ts +10 -2
- package/src/actions/estimateFeesPerGas.ts +5 -3
- package/src/actions/estimateGas.ts +14 -3
- package/src/actions/getAccount.ts +1 -1
- package/src/actions/getBalance.ts +5 -3
- package/src/actions/getBlock.ts +3 -3
- package/src/actions/getBlockNumber.ts +3 -3
- 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 +16 -7
- package/src/actions/getConnectors.ts +1 -1
- package/src/actions/getEnsAddress.ts +3 -3
- package/src/actions/getEnsAvatar.ts +3 -3
- package/src/actions/getEnsName.ts +3 -3
- package/src/actions/getEnsResolver.ts +3 -3
- package/src/actions/getPublicClient.ts +3 -3
- package/src/actions/getToken.ts +5 -4
- package/src/actions/getTransaction.ts +2 -2
- package/src/actions/getWalletClient.ts +12 -3
- package/src/actions/multicall.ts +2 -2
- package/src/actions/readContract.ts +2 -2
- package/src/actions/reconnect.ts +5 -4
- package/src/actions/sendTransaction.ts +16 -8
- package/src/actions/signMessage.ts +16 -5
- package/src/actions/signTypedData.ts +14 -3
- package/src/actions/simulateContract.ts +16 -8
- package/src/actions/switchAccount.ts +11 -4
- package/src/actions/switchChain.ts +24 -13
- package/src/actions/waitForTransactionReceipt.ts +3 -3
- package/src/actions/watchAccount.ts +1 -1
- package/src/actions/watchBlockNumber.ts +1 -1
- package/src/actions/watchBlocks.ts +1 -1
- 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 +2 -2
- package/src/actions/watchContractEvent.ts +2 -2
- package/src/actions/watchPendingTransactions.ts +2 -2
- package/src/actions/watchPublicClient.ts +2 -2
- package/src/actions/writeContract.ts +20 -10
- package/src/connectors/createConnector.ts +2 -2
- package/src/connectors/injected.ts +2 -2
- package/src/createConfig.ts +23 -3
- package/src/createStorage.ts +4 -2
- package/src/errors/base.ts +4 -1
- package/src/errors/config.ts +20 -18
- package/src/errors/connector.ts +6 -0
- package/src/exports/index.ts +19 -2
- package/src/hydrate.ts +42 -0
- package/src/query/disconnect.ts +1 -1
- package/src/query/estimateFeesPerGas.ts +1 -1
- package/src/query/estimateGas.ts +1 -1
- package/src/query/getBalance.ts +1 -1
- package/src/query/getBlock.ts +1 -1
- package/src/query/getBlockNumber.ts +1 -1
- package/src/query/getConnectorClient.ts +1 -1
- package/src/query/getEnsAddress.ts +1 -1
- package/src/query/getEnsAvatar.ts +1 -1
- package/src/query/getEnsName.ts +1 -1
- package/src/query/getEnsResolver.ts +1 -1
- package/src/query/getToken.ts +1 -1
- package/src/query/getTransaction.ts +1 -1
- package/src/query/getWalletClient.ts +1 -1
- package/src/query/infiniteReadContracts.ts +2 -2
- package/src/query/readContract.ts +1 -1
- package/src/query/readContracts.ts +2 -2
- package/src/query/reconnect.ts +2 -2
- package/src/query/sendTransaction.ts +1 -1
- package/src/query/signTypedData.ts +1 -1
- package/src/query/simulateContract.ts +1 -1
- package/src/query/switchAccount.ts +3 -3
- package/src/query/switchChain.ts +2 -2
- package/src/query/types.ts +7 -7
- package/src/query/utils.ts +1 -1
- package/src/query/waitForTransactionReceipt.ts +3 -3
- package/src/query/writeContract.ts +7 -3
- package/src/types/chain.ts +5 -4
- package/src/types/properties.ts +1 -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/utils/assertActiveChain.js +0 -14
- package/dist/esm/utils/assertActiveChain.js.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
package/src/query/estimateGas.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type EstimateGasReturnType,
|
|
7
7
|
estimateGas,
|
|
8
8
|
} from '../actions/estimateGas.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { UnionPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
package/src/query/getBalance.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetBalanceReturnType,
|
|
7
7
|
getBalance,
|
|
8
8
|
} from '../actions/getBalance.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, PartialBy } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
package/src/query/getBlock.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type GetBlockReturnType,
|
|
8
8
|
getBlock,
|
|
9
9
|
} from '../actions/getBlock.js'
|
|
10
|
-
import type
|
|
10
|
+
import { type Config } from '../createConfig.js'
|
|
11
11
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
12
12
|
import type { ScopeKeyParameter } from './types.js'
|
|
13
13
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetBlockNumberReturnType,
|
|
7
7
|
getBlockNumber,
|
|
8
8
|
} from '../actions/getBlockNumber.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetConnectorClientReturnType,
|
|
7
7
|
getConnectorClient,
|
|
8
8
|
} from '../actions/getConnectorClient.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetEnsAddressReturnType,
|
|
7
7
|
getEnsAddress,
|
|
8
8
|
} from '../actions/getEnsAddress.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetEnsAvatarReturnType,
|
|
7
7
|
getEnsAvatar,
|
|
8
8
|
} from '../actions/getEnsAvatar.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
package/src/query/getEnsName.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetEnsNameReturnType,
|
|
7
7
|
getEnsName,
|
|
8
8
|
} from '../actions/getEnsName.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetEnsResolverReturnType,
|
|
7
7
|
getEnsResolver,
|
|
8
8
|
} from '../actions/getEnsResolver.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
package/src/query/getToken.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetTokenReturnType,
|
|
7
7
|
getToken,
|
|
8
8
|
} from '../actions/getToken.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetTransactionReturnType,
|
|
7
7
|
getTransaction,
|
|
8
8
|
} from '../actions/getTransaction.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type GetWalletClientReturnType,
|
|
7
7
|
getWalletClient,
|
|
8
8
|
} from '../actions/getWalletClient.js'
|
|
9
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
10
|
import type { Evaluate, ExactPartial } from '../types/utils.js'
|
|
11
11
|
import type { ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
type ReadContractsReturnType,
|
|
6
6
|
readContracts,
|
|
7
7
|
} from '../actions/readContracts.js'
|
|
8
|
-
import type
|
|
9
|
-
import type
|
|
8
|
+
import { type Config } from '../createConfig.js'
|
|
9
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
10
10
|
import type { Omit } from '../types/utils.js'
|
|
11
11
|
import type { InfiniteQueryOptions, ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type ReadContractReturnType,
|
|
12
12
|
readContract,
|
|
13
13
|
} from '../actions/readContract.js'
|
|
14
|
-
import type
|
|
14
|
+
import { type Config } from '../createConfig.js'
|
|
15
15
|
import type { UnionPartial } from '../types/utils.js'
|
|
16
16
|
import type { ScopeKeyParameter } from './types.js'
|
|
17
17
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
type ReadContractsReturnType,
|
|
10
10
|
readContracts,
|
|
11
11
|
} from '../actions/readContracts.js'
|
|
12
|
-
import type
|
|
13
|
-
import type
|
|
12
|
+
import { type Config } from '../createConfig.js'
|
|
13
|
+
import { type ChainIdParameter } from '../types/properties.js'
|
|
14
14
|
import type { ExactPartial } from '../types/utils.js'
|
|
15
15
|
import type { ScopeKeyParameter } from './types.js'
|
|
16
16
|
import { filterQueryOptions } from './utils.js'
|
package/src/query/reconnect.ts
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
type ReconnectReturnType,
|
|
7
7
|
reconnect,
|
|
8
8
|
} from '../actions/reconnect.js'
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
|
+
import { type Evaluate } from '../types/utils.js'
|
|
11
11
|
import type { Mutate, MutateAsync } from './types.js'
|
|
12
12
|
|
|
13
13
|
export function reconnectMutationOptions(config: Config) {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
sendTransaction,
|
|
8
8
|
} from '../actions/sendTransaction.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
-
import type
|
|
10
|
+
import { type Evaluate } from '../types/utils.js'
|
|
11
11
|
|
|
12
12
|
export function sendTransactionMutationOptions<config extends Config>(
|
|
13
13
|
config: config,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
signTypedData,
|
|
9
9
|
} from '../actions/signTypedData.js'
|
|
10
10
|
import { type Config } from '../createConfig.js'
|
|
11
|
-
import type
|
|
11
|
+
import { type Evaluate } from '../types/utils.js'
|
|
12
12
|
|
|
13
13
|
export function signTypedDataMutationOptions<config extends Config>(
|
|
14
14
|
config: config,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type SimulateContractReturnType,
|
|
8
8
|
simulateContract,
|
|
9
9
|
} from '../actions/simulateContract.js'
|
|
10
|
-
import type
|
|
10
|
+
import { type Config } from '../createConfig.js'
|
|
11
11
|
import type { UnionPartial } from '../types/utils.js'
|
|
12
12
|
import type { ScopeKeyParameter } from './types.js'
|
|
13
13
|
import { filterQueryOptions } from './utils.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type MutationOptions } from '@tanstack/query-core'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
type SwitchAccountErrorType,
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
switchAccount,
|
|
8
8
|
} from '../actions/switchAccount.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
10
|
+
import { type Evaluate } from '../types/utils.js'
|
|
11
|
+
import { type Mutate, type MutateAsync } from './types.js'
|
|
12
12
|
|
|
13
13
|
export function switchAccountMutationOptions<config extends Config>(
|
|
14
14
|
config: config,
|
package/src/query/switchChain.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type MutateOptions, type MutationOptions } from '@tanstack/query-core'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
type SwitchChainErrorType,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
switchChain,
|
|
8
8
|
} from '../actions/switchChain.js'
|
|
9
9
|
import { type Config } from '../createConfig.js'
|
|
10
|
-
import type
|
|
10
|
+
import { type Evaluate } from '../types/utils.js'
|
|
11
11
|
|
|
12
12
|
export function switchChainMutationOptions<config extends Config>(
|
|
13
13
|
config: config,
|
package/src/query/types.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
DefaultError,
|
|
3
|
-
InfiniteQueryObserverOptions,
|
|
4
|
-
MutateOptions,
|
|
5
|
-
QueryKey,
|
|
6
|
-
QueryMeta,
|
|
1
|
+
import {
|
|
2
|
+
type DefaultError,
|
|
3
|
+
type InfiniteQueryObserverOptions,
|
|
4
|
+
type MutateOptions,
|
|
5
|
+
type QueryKey,
|
|
6
|
+
type QueryMeta,
|
|
7
7
|
} from '@tanstack/query-core'
|
|
8
8
|
|
|
9
|
-
import type
|
|
9
|
+
import { type Evaluate, type Omit } from '../types/utils.js'
|
|
10
10
|
|
|
11
11
|
export type InfiniteQueryOptions<
|
|
12
12
|
queryFnData = unknown,
|
package/src/query/utils.ts
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
type WaitForTransactionReceiptReturnType,
|
|
7
7
|
waitForTransactionReceipt,
|
|
8
8
|
} from '../actions/waitForTransactionReceipt.js'
|
|
9
|
-
import type
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
9
|
+
import { type Config } from '../createConfig.js'
|
|
10
|
+
import { type Evaluate, type ExactPartial } from '../types/utils.js'
|
|
11
|
+
import { type ScopeKeyParameter } from './types.js'
|
|
12
12
|
import { filterQueryOptions } from './utils.js'
|
|
13
13
|
|
|
14
14
|
export type WaitForTransactionReceiptOptions<
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import
|
|
1
|
+
import { type MutateOptions, type MutationOptions } from '@tanstack/query-core'
|
|
2
|
+
import {
|
|
3
|
+
type Abi,
|
|
4
|
+
type ContractFunctionArgs,
|
|
5
|
+
type ContractFunctionName,
|
|
6
|
+
} from 'viem'
|
|
3
7
|
|
|
4
8
|
import {
|
|
5
9
|
type WriteContractErrorType,
|
|
@@ -8,7 +12,7 @@ import {
|
|
|
8
12
|
writeContract,
|
|
9
13
|
} from '../actions/writeContract.js'
|
|
10
14
|
import { type Config } from '../createConfig.js'
|
|
11
|
-
import type
|
|
15
|
+
import { type Evaluate } from '../types/utils.js'
|
|
12
16
|
|
|
13
17
|
export function writeContractMutationOptions<config extends Config>(
|
|
14
18
|
config: config,
|
package/src/types/chain.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Chain, type ChainFormatters } from 'viem'
|
|
2
2
|
|
|
3
|
-
import type
|
|
4
|
-
import type
|
|
3
|
+
import { type Config } from '../createConfig.js'
|
|
4
|
+
import { type IsNarrowable, type Merge } from './utils.js'
|
|
5
5
|
|
|
6
6
|
/** Filters {@link Config} chains by {@link chainId} or simplifies if no `ChainFormatters` are present. */
|
|
7
7
|
export type SelectChains<
|
|
@@ -13,7 +13,8 @@ export type SelectChains<
|
|
|
13
13
|
? readonly [Extract<config['chains'][number], { id: chainId }>] // select specific chain
|
|
14
14
|
: HasFormatter<config['chains']> extends true
|
|
15
15
|
? config['chains'] // return all chains since one has formatter
|
|
16
|
-
:
|
|
16
|
+
: // return default chain with ID set to union (allows for more simple type since the only thing that is different is the chain ID for each chain)
|
|
17
|
+
readonly [Merge<Chain, { id: config['chains'][number]['id'] }>]
|
|
17
18
|
|
|
18
19
|
type HasFormatter<chains extends readonly Chain[]> = chains extends readonly [
|
|
19
20
|
infer head extends Chain,
|
package/src/types/properties.ts
CHANGED
package/src/types/register.ts
CHANGED
package/src/types/utils.ts
CHANGED
|
@@ -13,6 +13,8 @@ export type ExactPartial<type> = {
|
|
|
13
13
|
|
|
14
14
|
/** Checks if {@link type} can be narrowed further than {@link type2} */
|
|
15
15
|
export type IsNarrowable<type, type2> = IsUnknown<type> extends true
|
|
16
|
+
? false
|
|
17
|
+
: undefined extends type
|
|
16
18
|
? false
|
|
17
19
|
: IsNever<
|
|
18
20
|
(type extends type2 ? true : false) & (type2 extends type ? false : true)
|
|
@@ -20,10 +22,16 @@ export type IsNarrowable<type, type2> = IsUnknown<type> extends true
|
|
|
20
22
|
? false
|
|
21
23
|
: true
|
|
22
24
|
|
|
23
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
* Checks if {@link type} is `never`
|
|
28
|
+
*/
|
|
24
29
|
export type IsNever<type> = [type] extends [never] ? true : false
|
|
25
30
|
|
|
26
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
* Checks if {@link type} is `unknown`
|
|
34
|
+
*/
|
|
27
35
|
export type IsUnknown<type> = unknown extends type ? true : false
|
|
28
36
|
|
|
29
37
|
/** Merges two object types into new type */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Config, type State } from '../createConfig.js'
|
|
2
|
+
import { type BaseStorage } from '../createStorage.js'
|
|
3
|
+
import { deserialize } from './deserialize.js'
|
|
4
|
+
|
|
5
|
+
export const cookieStorage = {
|
|
6
|
+
getItem(key) {
|
|
7
|
+
if (typeof window === 'undefined') return null
|
|
8
|
+
const value = parseCookie(document.cookie, key)
|
|
9
|
+
return value ?? null
|
|
10
|
+
},
|
|
11
|
+
setItem(key, value) {
|
|
12
|
+
if (typeof window === 'undefined') return
|
|
13
|
+
document.cookie = `${key}=${value}`
|
|
14
|
+
},
|
|
15
|
+
removeItem(key) {
|
|
16
|
+
if (typeof window === 'undefined') return
|
|
17
|
+
document.cookie = `${key}=;max-age=-1`
|
|
18
|
+
},
|
|
19
|
+
} satisfies BaseStorage
|
|
20
|
+
|
|
21
|
+
export function cookieToInitialState(config: Config, cookie?: string | null) {
|
|
22
|
+
if (!cookie) return undefined
|
|
23
|
+
const key = `${config.storage?.key}.store`
|
|
24
|
+
const parsed = parseCookie(cookie, key)
|
|
25
|
+
if (!parsed) return undefined
|
|
26
|
+
return deserialize<{ state: State }>(parsed).state
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function parseCookie(cookie: string, key: string) {
|
|
30
|
+
return cookie
|
|
31
|
+
.split('; ')
|
|
32
|
+
.find((x) => x.startsWith(key))
|
|
33
|
+
?.split('=')[1]
|
|
34
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.0.0-
|
|
1
|
+
export const version = '2.0.0-beta.0'
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { getChainId } from '../actions/getChainId.js';
|
|
2
|
-
import { ChainMismatchError } from '../errors/config.js';
|
|
3
|
-
export function assertActiveChain(config, parameters) {
|
|
4
|
-
const { chainId } = parameters;
|
|
5
|
-
// Check that active chain and target chain match
|
|
6
|
-
const activeChainId = parameters.activeChainId ?? getChainId(config);
|
|
7
|
-
if (activeChainId && chainId !== activeChainId) {
|
|
8
|
-
const activeChain = config.chains.find((x) => x.id === activeChainId)?.name ??
|
|
9
|
-
`Chain ${activeChainId}`;
|
|
10
|
-
const targetChain = config.chains.find((x) => x.id === chainId)?.name ?? `Chain ${chainId}`;
|
|
11
|
-
throw new ChainMismatchError({ activeChain, targetChain });
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=assertActiveChain.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertActiveChain.js","sourceRoot":"","sources":["../../../src/utils/assertActiveChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAOxD,MAAM,UAAU,iBAAiB,CAC/B,MAAc,EACd,UAAsC;IAEtC,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAA;IAE9B,iDAAiD;IACjD,MAAM,aAAa,GAAG,UAAU,CAAC,aAAa,IAAI,UAAU,CAAC,MAAM,CAAC,CAAA;IACpE,IAAI,aAAa,IAAI,OAAO,KAAK,aAAa,EAAE;QAC9C,MAAM,WAAW,GACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,aAAa,CAAC,EAAE,IAAI;YACvD,SAAS,aAAa,EAAE,CAAA;QAC1B,MAAM,WAAW,GACf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,IAAI,IAAI,SAAS,OAAO,EAAE,CAAA;QACzE,MAAM,IAAI,kBAAkB,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAA;KAC3D;AACH,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../createConfig.js';
|
|
2
|
-
type AssertActiveChainParamters = {
|
|
3
|
-
activeChainId?: number | undefined;
|
|
4
|
-
chainId: number;
|
|
5
|
-
};
|
|
6
|
-
export declare function assertActiveChain(config: Config, parameters: AssertActiveChainParamters): void;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=assertActiveChain.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertActiveChain.d.ts","sourceRoot":"","sources":["../../../src/utils/assertActiveChain.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAGhD,KAAK,0BAA0B,GAAG;IAChC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,0BAA0B,QAcvC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { getChainId } from '../actions/getChainId.js'
|
|
2
|
-
import type { Config } from '../createConfig.js'
|
|
3
|
-
import { ChainMismatchError } from '../errors/config.js'
|
|
4
|
-
|
|
5
|
-
type AssertActiveChainParamters = {
|
|
6
|
-
activeChainId?: number | undefined
|
|
7
|
-
chainId: number
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function assertActiveChain(
|
|
11
|
-
config: Config,
|
|
12
|
-
parameters: AssertActiveChainParamters,
|
|
13
|
-
) {
|
|
14
|
-
const { chainId } = parameters
|
|
15
|
-
|
|
16
|
-
// Check that active chain and target chain match
|
|
17
|
-
const activeChainId = parameters.activeChainId ?? getChainId(config)
|
|
18
|
-
if (activeChainId && chainId !== activeChainId) {
|
|
19
|
-
const activeChain =
|
|
20
|
-
config.chains.find((x) => x.id === activeChainId)?.name ??
|
|
21
|
-
`Chain ${activeChainId}`
|
|
22
|
-
const targetChain =
|
|
23
|
-
config.chains.find((x) => x.id === chainId)?.name ?? `Chain ${chainId}`
|
|
24
|
-
throw new ChainMismatchError({ activeChain, targetChain })
|
|
25
|
-
}
|
|
26
|
-
}
|