@wagmi/core 2.11.6 → 2.11.8
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/dist/esm/actions/codegen/createWriteContract.js.map +1 -1
- package/dist/esm/connectors/injected.js +7 -0
- package/dist/esm/connectors/injected.js.map +1 -1
- package/dist/esm/createConfig.js +7 -2
- package/dist/esm/createConfig.js.map +1 -1
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/query/estimateGas.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/actions/codegen/createReadContract.d.ts +2 -2
- package/dist/types/actions/codegen/createReadContract.d.ts.map +1 -1
- package/dist/types/actions/codegen/createSimulateContract.d.ts +2 -2
- package/dist/types/actions/codegen/createSimulateContract.d.ts.map +1 -1
- package/dist/types/actions/codegen/createWatchContractEvent.d.ts +2 -2
- package/dist/types/actions/codegen/createWatchContractEvent.d.ts.map +1 -1
- package/dist/types/actions/codegen/createWriteContract.d.ts +4 -4
- package/dist/types/actions/codegen/createWriteContract.d.ts.map +1 -1
- package/dist/types/actions/connect.d.ts +2 -2
- package/dist/types/actions/connect.d.ts.map +1 -1
- package/dist/types/actions/deployContract.d.ts +2 -2
- package/dist/types/actions/deployContract.d.ts.map +1 -1
- package/dist/types/actions/estimateFeesPerGas.d.ts +5 -5
- package/dist/types/actions/estimateFeesPerGas.d.ts.map +1 -1
- package/dist/types/actions/estimateGas.d.ts +2 -2
- package/dist/types/actions/estimateGas.d.ts.map +1 -1
- package/dist/types/actions/estimateMaxPriorityFeePerGas.d.ts +2 -2
- package/dist/types/actions/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
- package/dist/types/actions/getBalance.d.ts +2 -2
- 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 +2 -2
- package/dist/types/actions/getBlockNumber.d.ts.map +1 -1
- package/dist/types/actions/getBlockTransactionCount.d.ts +2 -2
- package/dist/types/actions/getBlockTransactionCount.d.ts.map +1 -1
- package/dist/types/actions/getBytecode.d.ts +2 -2
- package/dist/types/actions/getBytecode.d.ts.map +1 -1
- package/dist/types/actions/getClient.d.ts +2 -2
- 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 +3 -3
- package/dist/types/actions/getConnectorClient.d.ts.map +1 -1
- package/dist/types/actions/getEnsAddress.d.ts +2 -2
- package/dist/types/actions/getEnsAddress.d.ts.map +1 -1
- package/dist/types/actions/getEnsAvatar.d.ts +2 -2
- package/dist/types/actions/getEnsAvatar.d.ts.map +1 -1
- package/dist/types/actions/getEnsName.d.ts +2 -2
- package/dist/types/actions/getEnsName.d.ts.map +1 -1
- package/dist/types/actions/getEnsResolver.d.ts +2 -2
- package/dist/types/actions/getEnsResolver.d.ts.map +1 -1
- package/dist/types/actions/getEnsText.d.ts +2 -2
- package/dist/types/actions/getEnsText.d.ts.map +1 -1
- package/dist/types/actions/getFeeHistory.d.ts +2 -2
- package/dist/types/actions/getFeeHistory.d.ts.map +1 -1
- package/dist/types/actions/getGasPrice.d.ts +2 -2
- package/dist/types/actions/getGasPrice.d.ts.map +1 -1
- package/dist/types/actions/getProof.d.ts +2 -2
- package/dist/types/actions/getProof.d.ts.map +1 -1
- package/dist/types/actions/getPublicClient.d.ts +2 -2
- package/dist/types/actions/getPublicClient.d.ts.map +1 -1
- package/dist/types/actions/getStorageAt.d.ts +2 -2
- package/dist/types/actions/getStorageAt.d.ts.map +1 -1
- package/dist/types/actions/getToken.d.ts +2 -2
- package/dist/types/actions/getToken.d.ts.map +1 -1
- package/dist/types/actions/getTransaction.d.ts +3 -3
- package/dist/types/actions/getTransaction.d.ts.map +1 -1
- package/dist/types/actions/getTransactionCount.d.ts +2 -2
- package/dist/types/actions/getTransactionCount.d.ts.map +1 -1
- package/dist/types/actions/getTransactionReceipt.d.ts +3 -3
- package/dist/types/actions/getTransactionReceipt.d.ts.map +1 -1
- package/dist/types/actions/getWalletClient.d.ts +2 -2
- package/dist/types/actions/getWalletClient.d.ts.map +1 -1
- package/dist/types/actions/prepareTransactionRequest.d.ts +3 -3
- package/dist/types/actions/prepareTransactionRequest.d.ts.map +1 -1
- package/dist/types/actions/reconnect.d.ts +2 -2
- package/dist/types/actions/reconnect.d.ts.map +1 -1
- package/dist/types/actions/sendTransaction.d.ts +2 -2
- package/dist/types/actions/sendTransaction.d.ts.map +1 -1
- package/dist/types/actions/signMessage.d.ts +2 -2
- package/dist/types/actions/signMessage.d.ts.map +1 -1
- package/dist/types/actions/signTypedData.d.ts +2 -2
- package/dist/types/actions/signTypedData.d.ts.map +1 -1
- package/dist/types/actions/simulateContract.d.ts +3 -3
- package/dist/types/actions/simulateContract.d.ts.map +1 -1
- package/dist/types/actions/switchChain.d.ts +3 -3
- package/dist/types/actions/switchChain.d.ts.map +1 -1
- package/dist/types/actions/verifyMessage.d.ts +2 -2
- package/dist/types/actions/verifyMessage.d.ts.map +1 -1
- package/dist/types/actions/verifyTypedData.d.ts +2 -2
- package/dist/types/actions/verifyTypedData.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/watchBlockNumber.d.ts +2 -2
- package/dist/types/actions/watchBlockNumber.d.ts.map +1 -1
- package/dist/types/actions/watchBlocks.d.ts +2 -2
- package/dist/types/actions/watchBlocks.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/writeContract.d.ts +3 -3
- package/dist/types/actions/writeContract.d.ts.map +1 -1
- package/dist/types/connectors/createConnector.d.ts +5 -5
- package/dist/types/connectors/createConnector.d.ts.map +1 -1
- package/dist/types/connectors/injected.d.ts +3 -3
- package/dist/types/connectors/injected.d.ts.map +1 -1
- package/dist/types/createConfig.d.ts +4 -4
- 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 +2 -2
- package/dist/types/errors/base.d.ts.map +1 -1
- package/dist/types/experimental/actions/sendCalls.d.ts +2 -2
- package/dist/types/experimental/actions/sendCalls.d.ts.map +1 -1
- package/dist/types/experimental/actions/writeContracts.d.ts +2 -2
- package/dist/types/experimental/actions/writeContracts.d.ts.map +1 -1
- package/dist/types/experimental/query/getCallsStatus.d.ts +2 -2
- package/dist/types/experimental/query/getCallsStatus.d.ts.map +1 -1
- package/dist/types/experimental/query/getCapabilities.d.ts +2 -2
- package/dist/types/experimental/query/getCapabilities.d.ts.map +1 -1
- package/dist/types/experimental/query/sendCalls.d.ts +4 -4
- package/dist/types/experimental/query/sendCalls.d.ts.map +1 -1
- package/dist/types/experimental/query/showCallsStatus.d.ts +4 -4
- package/dist/types/experimental/query/showCallsStatus.d.ts.map +1 -1
- package/dist/types/experimental/query/writeContracts.d.ts +4 -4
- package/dist/types/experimental/query/writeContracts.d.ts.map +1 -1
- package/dist/types/exports/internal.d.ts +1 -1
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/query/call.d.ts +2 -2
- package/dist/types/query/call.d.ts.map +1 -1
- package/dist/types/query/deployContract.d.ts +4 -4
- package/dist/types/query/deployContract.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 +2 -2
- package/dist/types/query/estimateMaxPriorityFeePerGas.d.ts.map +1 -1
- package/dist/types/query/getBalance.d.ts +3 -3
- package/dist/types/query/getBalance.d.ts.map +1 -1
- package/dist/types/query/getBlock.d.ts +2 -2
- package/dist/types/query/getBlock.d.ts.map +1 -1
- package/dist/types/query/getBlockNumber.d.ts +2 -2
- package/dist/types/query/getBlockNumber.d.ts.map +1 -1
- package/dist/types/query/getBlockTransactionCount.d.ts +2 -2
- package/dist/types/query/getBlockTransactionCount.d.ts.map +1 -1
- package/dist/types/query/getBytecode.d.ts +2 -2
- package/dist/types/query/getBytecode.d.ts.map +1 -1
- package/dist/types/query/getConnectorClient.d.ts +17 -7
- 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/getEnsText.d.ts +2 -2
- package/dist/types/query/getEnsText.d.ts.map +1 -1
- package/dist/types/query/getFeeHistory.d.ts +2 -2
- package/dist/types/query/getFeeHistory.d.ts.map +1 -1
- package/dist/types/query/getGasPrice.d.ts +2 -2
- package/dist/types/query/getGasPrice.d.ts.map +1 -1
- package/dist/types/query/getProof.d.ts +2 -2
- package/dist/types/query/getProof.d.ts.map +1 -1
- package/dist/types/query/getStorageAt.d.ts +2 -2
- package/dist/types/query/getStorageAt.d.ts.map +1 -1
- package/dist/types/query/getToken.d.ts +2 -2
- package/dist/types/query/getToken.d.ts.map +1 -1
- package/dist/types/query/getTransaction.d.ts +2 -2
- package/dist/types/query/getTransaction.d.ts.map +1 -1
- package/dist/types/query/getTransactionConfirmations.d.ts +2 -2
- package/dist/types/query/getTransactionConfirmations.d.ts.map +1 -1
- package/dist/types/query/getTransactionCount.d.ts +3 -3
- package/dist/types/query/getTransactionCount.d.ts.map +1 -1
- package/dist/types/query/getTransactionReceipt.d.ts +2 -2
- package/dist/types/query/getTransactionReceipt.d.ts.map +1 -1
- package/dist/types/query/getWalletClient.d.ts +6 -6
- 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/prepareTransactionRequest.d.ts +2 -2
- package/dist/types/query/prepareTransactionRequest.d.ts.map +1 -1
- package/dist/types/query/readContract.d.ts +66 -4
- package/dist/types/query/readContract.d.ts.map +1 -1
- package/dist/types/query/readContracts.d.ts +3 -6
- 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 +4 -4
- package/dist/types/query/sendTransaction.d.ts.map +1 -1
- package/dist/types/query/signMessage.d.ts +2 -2
- package/dist/types/query/signMessage.d.ts.map +1 -1
- package/dist/types/query/signTypedData.d.ts +7 -7
- package/dist/types/query/signTypedData.d.ts.map +1 -1
- package/dist/types/query/simulateContract.d.ts +2 -2
- package/dist/types/query/simulateContract.d.ts.map +1 -1
- package/dist/types/query/switchAccount.d.ts +3 -3
- 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 +5 -5
- package/dist/types/query/types.d.ts.map +1 -1
- package/dist/types/query/verifyMessage.d.ts +8 -2
- package/dist/types/query/verifyMessage.d.ts.map +1 -1
- package/dist/types/query/waitForTransactionReceipt.d.ts +2 -2
- package/dist/types/query/waitForTransactionReceipt.d.ts.map +1 -1
- package/dist/types/query/writeContract.d.ts +3 -3
- package/dist/types/query/writeContract.d.ts.map +1 -1
- package/dist/types/types/utils.d.ts +12 -9
- package/dist/types/types/utils.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/actions/codegen/createReadContract.ts +3 -3
- package/src/actions/codegen/createSimulateContract.ts +3 -3
- package/src/actions/codegen/createWatchContractEvent.ts +3 -3
- package/src/actions/codegen/createWriteContract.ts +8 -4
- package/src/actions/connect.ts +2 -2
- package/src/actions/deployContract.ts +2 -2
- package/src/actions/estimateFeesPerGas.ts +5 -5
- package/src/actions/estimateGas.ts +2 -2
- package/src/actions/estimateMaxPriorityFeePerGas.ts +2 -2
- package/src/actions/getBalance.ts +2 -2
- package/src/actions/getBlock.ts +3 -3
- package/src/actions/getBlockNumber.ts +2 -2
- package/src/actions/getBlockTransactionCount.ts +2 -2
- package/src/actions/getBytecode.ts +2 -2
- package/src/actions/getClient.ts +2 -2
- package/src/actions/getConnections.ts +2 -2
- package/src/actions/getConnectorClient.ts +3 -3
- package/src/actions/getEnsAddress.ts +2 -2
- package/src/actions/getEnsAvatar.ts +2 -2
- package/src/actions/getEnsName.ts +2 -2
- package/src/actions/getEnsResolver.ts +2 -2
- package/src/actions/getEnsText.ts +2 -2
- package/src/actions/getFeeHistory.ts +2 -2
- package/src/actions/getGasPrice.ts +2 -2
- package/src/actions/getProof.ts +2 -2
- package/src/actions/getPublicClient.ts +2 -2
- package/src/actions/getStorageAt.ts +2 -2
- package/src/actions/getToken.ts +2 -2
- package/src/actions/getTransaction.ts +3 -3
- package/src/actions/getTransactionCount.ts +2 -2
- package/src/actions/getTransactionReceipt.ts +3 -3
- package/src/actions/getWalletClient.ts +2 -2
- package/src/actions/prepareTransactionRequest.ts +6 -6
- package/src/actions/reconnect.ts +2 -2
- package/src/actions/sendTransaction.ts +2 -2
- package/src/actions/signMessage.ts +2 -2
- package/src/actions/signTypedData.ts +2 -2
- package/src/actions/simulateContract.ts +6 -6
- package/src/actions/switchChain.ts +3 -3
- package/src/actions/verifyMessage.ts +2 -2
- package/src/actions/verifyTypedData.ts +2 -2
- package/src/actions/waitForTransactionReceipt.ts +3 -3
- package/src/actions/watchBlockNumber.ts +2 -2
- package/src/actions/watchBlocks.ts +2 -2
- package/src/actions/watchContractEvent.ts +2 -2
- package/src/actions/watchPendingTransactions.ts +2 -2
- package/src/actions/writeContract.ts +4 -4
- package/src/connectors/createConnector.ts +5 -5
- package/src/connectors/injected.ts +11 -4
- package/src/createConfig.ts +19 -8
- package/src/createStorage.ts +3 -3
- package/src/errors/base.ts +2 -2
- package/src/experimental/actions/sendCalls.ts +2 -2
- package/src/experimental/actions/writeContracts.ts +2 -2
- package/src/experimental/query/getCallsStatus.ts +2 -2
- package/src/experimental/query/getCapabilities.ts +2 -2
- package/src/experimental/query/sendCalls.ts +6 -6
- package/src/experimental/query/showCallsStatus.ts +6 -6
- package/src/experimental/query/writeContracts.ts +6 -6
- package/src/exports/internal.ts +6 -5
- package/src/query/call.ts +2 -2
- package/src/query/deployContract.ts +6 -6
- package/src/query/estimateFeesPerGas.ts +2 -2
- package/src/query/estimateGas.ts +3 -2
- package/src/query/estimateMaxPriorityFeePerGas.ts +2 -2
- package/src/query/getBalance.ts +3 -3
- package/src/query/getBlock.ts +2 -2
- package/src/query/getBlockNumber.ts +2 -2
- package/src/query/getBlockTransactionCount.ts +2 -2
- package/src/query/getBytecode.ts +2 -2
- package/src/query/getConnectorClient.ts +2 -2
- package/src/query/getEnsAddress.ts +2 -2
- package/src/query/getEnsAvatar.ts +2 -2
- package/src/query/getEnsName.ts +2 -2
- package/src/query/getEnsResolver.ts +2 -2
- package/src/query/getEnsText.ts +2 -2
- package/src/query/getFeeHistory.ts +2 -2
- package/src/query/getGasPrice.ts +2 -2
- package/src/query/getProof.ts +2 -2
- package/src/query/getStorageAt.ts +2 -2
- package/src/query/getToken.ts +2 -2
- package/src/query/getTransaction.ts +2 -2
- package/src/query/getTransactionConfirmations.ts +2 -2
- package/src/query/getTransactionCount.ts +3 -3
- package/src/query/getTransactionReceipt.ts +2 -2
- package/src/query/getWalletClient.ts +2 -2
- package/src/query/infiniteReadContracts.ts +2 -2
- package/src/query/prepareTransactionRequest.ts +2 -2
- package/src/query/readContract.ts +2 -2
- package/src/query/reconnect.ts +2 -2
- package/src/query/sendTransaction.ts +6 -6
- package/src/query/signMessage.ts +2 -2
- package/src/query/signTypedData.ts +2 -2
- package/src/query/simulateContract.ts +2 -2
- package/src/query/switchAccount.ts +3 -3
- package/src/query/switchChain.ts +7 -7
- package/src/query/types.ts +7 -7
- package/src/query/verifyMessage.ts +2 -2
- package/src/query/waitForTransactionReceipt.ts +2 -2
- package/src/query/writeContract.ts +2 -2
- package/src/types/utils.ts +17 -10
- package/src/version.ts +1 -1
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import type { Config } from '../createConfig.js'
|
|
9
9
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
10
|
-
import type {
|
|
10
|
+
import type { Compute } from '../types/utils.js'
|
|
11
11
|
import { getAction } from '../utils/getAction.js'
|
|
12
12
|
|
|
13
13
|
export type GetFeeHistoryParameters<
|
|
14
14
|
config extends Config = Config,
|
|
15
15
|
chainId extends
|
|
16
16
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
17
|
-
> =
|
|
17
|
+
> = Compute<viem_GetFeeHistoryParameters & ChainIdParameter<config, chainId>>
|
|
18
18
|
|
|
19
19
|
export type GetFeeHistoryReturnType = viem_GetFeeHistoryReturnType
|
|
20
20
|
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import type { Config } from '../createConfig.js'
|
|
8
8
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
9
|
-
import type {
|
|
9
|
+
import type { Compute } from '../types/utils.js'
|
|
10
10
|
import { getAction } from '../utils/getAction.js'
|
|
11
11
|
|
|
12
12
|
export type GetGasPriceParameters<
|
|
13
13
|
config extends Config = Config,
|
|
14
14
|
chainId extends
|
|
15
15
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
16
|
-
> =
|
|
16
|
+
> = Compute<ChainIdParameter<config, chainId>>
|
|
17
17
|
|
|
18
18
|
export type GetGasPriceReturnType = viem_GetGasPriceReturnType
|
|
19
19
|
|
package/src/actions/getProof.ts
CHANGED
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import type { Config } from '../createConfig.js'
|
|
9
9
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
10
|
-
import type {
|
|
10
|
+
import type { Compute } from '../types/utils.js'
|
|
11
11
|
import { getAction } from '../utils/getAction.js'
|
|
12
12
|
|
|
13
|
-
export type GetProofParameters<config extends Config = Config> =
|
|
13
|
+
export type GetProofParameters<config extends Config = Config> = Compute<
|
|
14
14
|
viem_GetProofParameters & ChainIdParameter<config>
|
|
15
15
|
>
|
|
16
16
|
|
|
@@ -2,7 +2,7 @@ import { type Client, type PublicClient, publicActions } from 'viem'
|
|
|
2
2
|
|
|
3
3
|
import type { Config } from '../createConfig.js'
|
|
4
4
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
5
|
-
import type {
|
|
5
|
+
import type { Compute, IsNarrowable } from '../types/utils.js'
|
|
6
6
|
import { getClient } from './getClient.js'
|
|
7
7
|
|
|
8
8
|
export type GetPublicClientParameters<
|
|
@@ -29,7 +29,7 @@ export type GetPublicClientReturnType<
|
|
|
29
29
|
: config['chains'][number]['id']
|
|
30
30
|
: config['chains'][number]['id'] | undefined,
|
|
31
31
|
> = resolvedChainId extends config['chains'][number]['id']
|
|
32
|
-
?
|
|
32
|
+
? Compute<
|
|
33
33
|
PublicClient<
|
|
34
34
|
config['_internal']['transports'][resolvedChainId],
|
|
35
35
|
Extract<config['chains'][number], { id: resolvedChainId }>
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import type { Config } from '../createConfig.js'
|
|
9
9
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
10
|
-
import type {
|
|
10
|
+
import type { Compute } from '../types/utils.js'
|
|
11
11
|
import { getAction } from '../utils/getAction.js'
|
|
12
12
|
|
|
13
|
-
export type GetStorageAtParameters<config extends Config = Config> =
|
|
13
|
+
export type GetStorageAtParameters<config extends Config = Config> = Compute<
|
|
14
14
|
viem_GetStorageAtParameters & ChainIdParameter<config>
|
|
15
15
|
>
|
|
16
16
|
|
package/src/actions/getToken.ts
CHANGED
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
import type { Config } from '../createConfig.js'
|
|
10
10
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
11
11
|
import type { Unit } from '../types/unit.js'
|
|
12
|
-
import type {
|
|
12
|
+
import type { Compute } from '../types/utils.js'
|
|
13
13
|
import { getUnit } from '../utils/getUnit.js'
|
|
14
14
|
import { type ReadContractsErrorType, readContracts } from './readContracts.js'
|
|
15
15
|
|
|
16
|
-
export type GetTokenParameters<config extends Config = Config> =
|
|
16
|
+
export type GetTokenParameters<config extends Config = Config> = Compute<
|
|
17
17
|
ChainIdParameter<config> & {
|
|
18
18
|
address: Address
|
|
19
19
|
formatUnits?: Unit | undefined
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
import type { Config } from '../createConfig.js'
|
|
10
10
|
import type { SelectChains } from '../types/chain.js'
|
|
11
11
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
12
|
-
import type {
|
|
12
|
+
import type { Compute, IsNarrowable } from '../types/utils.js'
|
|
13
13
|
import { getAction } from '../utils/getAction.js'
|
|
14
14
|
|
|
15
15
|
export type GetTransactionParameters<
|
|
16
16
|
config extends Config = Config,
|
|
17
17
|
chainId extends
|
|
18
18
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
19
|
-
> =
|
|
19
|
+
> = Compute<viem_GetTransactionParameters & ChainIdParameter<config, chainId>>
|
|
20
20
|
|
|
21
21
|
export type GetTransactionReturnType<
|
|
22
22
|
config extends Config = Config,
|
|
@@ -24,7 +24,7 @@ export type GetTransactionReturnType<
|
|
|
24
24
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
25
|
///
|
|
26
26
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
27
|
-
> =
|
|
27
|
+
> = Compute<
|
|
28
28
|
{
|
|
29
29
|
[key in keyof chains]: viem_GetTransactionReturnType<
|
|
30
30
|
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import type { Config } from '../createConfig.js'
|
|
9
9
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
10
|
-
import type {
|
|
10
|
+
import type { Compute } from '../types/utils.js'
|
|
11
11
|
import { getAction } from '../utils/getAction.js'
|
|
12
12
|
|
|
13
13
|
export type GetTransactionCountParameters<config extends Config = Config> =
|
|
14
|
-
|
|
14
|
+
Compute<ChainIdParameter<config> & viem_GetTransactionCountParameters>
|
|
15
15
|
|
|
16
16
|
export type GetTransactionCountReturnType = viem_GetTransactionCountReturnType
|
|
17
17
|
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
import type { Config } from '../createConfig.js'
|
|
10
10
|
import type { SelectChains } from '../types/chain.js'
|
|
11
11
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
12
|
-
import type {
|
|
12
|
+
import type { Compute, IsNarrowable } from '../types/utils.js'
|
|
13
13
|
import { getAction } from '../utils/getAction.js'
|
|
14
14
|
|
|
15
15
|
export type GetTransactionReceiptParameters<
|
|
16
16
|
config extends Config = Config,
|
|
17
17
|
chainId extends
|
|
18
18
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
19
|
-
> =
|
|
19
|
+
> = Compute<
|
|
20
20
|
viem_GetTransactionReceiptParameters & ChainIdParameter<config, chainId>
|
|
21
21
|
>
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ export type GetTransactionReceiptReturnType<
|
|
|
26
26
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
27
27
|
///
|
|
28
28
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
29
|
-
> =
|
|
29
|
+
> = Compute<
|
|
30
30
|
{
|
|
31
31
|
[key in keyof chains]: viem_GetTransactionReceiptReturnType<
|
|
32
32
|
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined
|
|
@@ -2,7 +2,7 @@ import { type Account, type WalletClient, walletActions } from 'viem'
|
|
|
2
2
|
|
|
3
3
|
import type { Config } from '../createConfig.js'
|
|
4
4
|
import type { BaseErrorType, ErrorType } from '../errors/base.js'
|
|
5
|
-
import type {
|
|
5
|
+
import type { Compute } from '../types/utils.js'
|
|
6
6
|
import {
|
|
7
7
|
type GetConnectorClientErrorType,
|
|
8
8
|
type GetConnectorClientParameters,
|
|
@@ -19,7 +19,7 @@ export type GetWalletClientReturnType<
|
|
|
19
19
|
config extends Config = Config,
|
|
20
20
|
chainId extends
|
|
21
21
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
22
|
-
> =
|
|
22
|
+
> = Compute<
|
|
23
23
|
WalletClient<
|
|
24
24
|
config['_internal']['transports'][chainId],
|
|
25
25
|
Extract<config['chains'][number], { id: chainId }>,
|
|
@@ -13,10 +13,10 @@ import type { Config } from '../createConfig.js'
|
|
|
13
13
|
import type { SelectChains } from '../types/chain.js'
|
|
14
14
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
15
15
|
import type {
|
|
16
|
-
|
|
16
|
+
Compute,
|
|
17
17
|
IsNarrowable,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
UnionCompute,
|
|
19
|
+
UnionStrictOmit,
|
|
20
20
|
} from '../types/utils.js'
|
|
21
21
|
import { getAction } from '../utils/getAction.js'
|
|
22
22
|
import { getAccount } from './getAccount.js'
|
|
@@ -36,8 +36,8 @@ export type PrepareTransactionRequestParameters<
|
|
|
36
36
|
///
|
|
37
37
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
38
38
|
> = {
|
|
39
|
-
[key in keyof chains]:
|
|
40
|
-
|
|
39
|
+
[key in keyof chains]: UnionCompute<
|
|
40
|
+
UnionStrictOmit<
|
|
41
41
|
viem_PrepareTransactionRequestParameters<
|
|
42
42
|
chains[key],
|
|
43
43
|
Account,
|
|
@@ -73,7 +73,7 @@ export type PrepareTransactionRequestReturnType<
|
|
|
73
73
|
///
|
|
74
74
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
75
75
|
> = {
|
|
76
|
-
[key in keyof chains]:
|
|
76
|
+
[key in keyof chains]: Compute<
|
|
77
77
|
viem_PrepareTransactionRequestReturnType<
|
|
78
78
|
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined,
|
|
79
79
|
Account,
|
package/src/actions/reconnect.ts
CHANGED
|
@@ -3,14 +3,14 @@ import type { Address } from 'viem'
|
|
|
3
3
|
import type { CreateConnectorFn } from '../connectors/createConnector.js'
|
|
4
4
|
import type { Config, Connection, Connector } from '../createConfig.js'
|
|
5
5
|
import type { ErrorType } from '../errors/base.js'
|
|
6
|
-
import type {
|
|
6
|
+
import type { Compute } from '../types/utils.js'
|
|
7
7
|
|
|
8
8
|
export type ReconnectParameters = {
|
|
9
9
|
/** Connectors to attempt reconnect with */
|
|
10
10
|
connectors?: readonly (CreateConnectorFn | Connector)[] | undefined
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export type ReconnectReturnType =
|
|
13
|
+
export type ReconnectReturnType = Compute<Connection>[]
|
|
14
14
|
|
|
15
15
|
export type ReconnectErrorType = ErrorType
|
|
16
16
|
|
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
ChainIdParameter,
|
|
20
20
|
ConnectorParameter,
|
|
21
21
|
} from '../types/properties.js'
|
|
22
|
-
import type {
|
|
22
|
+
import type { Compute } from '../types/utils.js'
|
|
23
23
|
import { getAction } from '../utils/getAction.js'
|
|
24
24
|
import { getAccount } from './getAccount.js'
|
|
25
25
|
import {
|
|
@@ -34,7 +34,7 @@ export type SendTransactionParameters<
|
|
|
34
34
|
///
|
|
35
35
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
36
36
|
> = {
|
|
37
|
-
[key in keyof chains]:
|
|
37
|
+
[key in keyof chains]: Compute<
|
|
38
38
|
Omit<
|
|
39
39
|
viem_SendTransactionParameters<chains[key], Account, chains[key]>,
|
|
40
40
|
'chain' | 'gas'
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
import type { Config } from '../createConfig.js'
|
|
10
10
|
import type { BaseErrorType, ErrorType } from '../errors/base.js'
|
|
11
11
|
import type { ConnectorParameter } from '../types/properties.js'
|
|
12
|
-
import type {
|
|
12
|
+
import type { Compute } from '../types/utils.js'
|
|
13
13
|
import { getAction } from '../utils/getAction.js'
|
|
14
14
|
import {
|
|
15
15
|
type GetConnectorClientErrorType,
|
|
16
16
|
getConnectorClient,
|
|
17
17
|
} from './getConnectorClient.js'
|
|
18
18
|
|
|
19
|
-
export type SignMessageParameters =
|
|
19
|
+
export type SignMessageParameters = Compute<
|
|
20
20
|
viem_SignMessageParameters<Account> & ConnectorParameter
|
|
21
21
|
>
|
|
22
22
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import type { Config } from '../createConfig.js'
|
|
10
10
|
import type { BaseErrorType, ErrorType } from '../errors/base.js'
|
|
11
11
|
import type { ConnectorParameter } from '../types/properties.js'
|
|
12
|
-
import type {
|
|
12
|
+
import type { UnionCompute } from '../types/utils.js'
|
|
13
13
|
import { getAction } from '../utils/getAction.js'
|
|
14
14
|
import {
|
|
15
15
|
type GetConnectorClientErrorType,
|
|
@@ -21,7 +21,7 @@ export type SignTypedDataParameters<
|
|
|
21
21
|
primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData,
|
|
22
22
|
///
|
|
23
23
|
primaryTypes = typedData extends TypedData ? keyof typedData : string,
|
|
24
|
-
> =
|
|
24
|
+
> = UnionCompute<
|
|
25
25
|
viem_SignTypedDataParameters<typedData, primaryType, Account, primaryTypes> &
|
|
26
26
|
ConnectorParameter
|
|
27
27
|
>
|
|
@@ -21,10 +21,10 @@ import type {
|
|
|
21
21
|
ConnectorParameter,
|
|
22
22
|
} from '../types/properties.js'
|
|
23
23
|
import type {
|
|
24
|
-
|
|
24
|
+
Compute,
|
|
25
25
|
PartialBy,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
UnionCompute,
|
|
27
|
+
UnionStrictOmit,
|
|
28
28
|
} from '../types/utils.js'
|
|
29
29
|
import { getAction } from '../utils/getAction.js'
|
|
30
30
|
import {
|
|
@@ -50,8 +50,8 @@ export type SimulateContractParameters<
|
|
|
50
50
|
///
|
|
51
51
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
52
52
|
> = {
|
|
53
|
-
[key in keyof chains]:
|
|
54
|
-
|
|
53
|
+
[key in keyof chains]: UnionCompute<
|
|
54
|
+
UnionStrictOmit<
|
|
55
55
|
viem_SimulateContractParameters<
|
|
56
56
|
abi,
|
|
57
57
|
functionName,
|
|
@@ -94,7 +94,7 @@ export type SimulateContractReturnType<
|
|
|
94
94
|
chains[key]
|
|
95
95
|
> & {
|
|
96
96
|
chainId: chains[key]['id']
|
|
97
|
-
request:
|
|
97
|
+
request: Compute<
|
|
98
98
|
PartialBy<
|
|
99
99
|
{ __mode: 'prepared'; chainId: chainId; chain: chains[key] },
|
|
100
100
|
chainId extends config['chains'][number]['id'] ? never : 'chainId'
|
|
@@ -16,17 +16,17 @@ import {
|
|
|
16
16
|
type SwitchChainNotSupportedErrorType,
|
|
17
17
|
} from '../errors/connector.js'
|
|
18
18
|
import type { ConnectorParameter } from '../types/properties.js'
|
|
19
|
-
import type {
|
|
19
|
+
import type { Compute, ExactPartial } from '../types/utils.js'
|
|
20
20
|
|
|
21
21
|
export type SwitchChainParameters<
|
|
22
22
|
config extends Config = Config,
|
|
23
23
|
chainId extends
|
|
24
24
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
-
> =
|
|
25
|
+
> = Compute<
|
|
26
26
|
ConnectorParameter & {
|
|
27
27
|
chainId: chainId | config['chains'][number]['id']
|
|
28
28
|
addEthereumChainParameter?:
|
|
29
|
-
|
|
|
29
|
+
| Compute<ExactPartial<Omit<AddEthereumChainParameter, 'chainId'>>>
|
|
30
30
|
| undefined
|
|
31
31
|
}
|
|
32
32
|
>
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import type { Config } from '../createConfig.js'
|
|
9
9
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
10
|
-
import type {
|
|
10
|
+
import type { Compute } from '../types/utils.js'
|
|
11
11
|
import { getAction } from '../utils/getAction.js'
|
|
12
12
|
|
|
13
|
-
export type VerifyMessageParameters<config extends Config = Config> =
|
|
13
|
+
export type VerifyMessageParameters<config extends Config = Config> = Compute<
|
|
14
14
|
viem_VerifyMessageParameters & ChainIdParameter<config>
|
|
15
15
|
>
|
|
16
16
|
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import type { Config } from '../createConfig.js'
|
|
10
10
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
11
|
-
import type {
|
|
11
|
+
import type { Compute } from '../types/utils.js'
|
|
12
12
|
import { getAction } from '../utils/getAction.js'
|
|
13
13
|
|
|
14
14
|
export type VerifyTypedDataParameters<
|
|
15
15
|
typedData extends TypedData | Record<string, unknown> = TypedData,
|
|
16
16
|
primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData,
|
|
17
17
|
config extends Config = Config,
|
|
18
|
-
> =
|
|
18
|
+
> = Compute<
|
|
19
19
|
viem_VerifyTypedDataParameters<typedData, primaryType> &
|
|
20
20
|
ChainIdParameter<config>
|
|
21
21
|
>
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
import type { Config } from '../createConfig.js'
|
|
13
13
|
import type { SelectChains } from '../types/chain.js'
|
|
14
14
|
import type { ChainIdParameter } from '../types/properties.js'
|
|
15
|
-
import type {
|
|
15
|
+
import type { Compute, IsNarrowable } from '../types/utils.js'
|
|
16
16
|
import { getAction } from '../utils/getAction.js'
|
|
17
17
|
|
|
18
18
|
export type WaitForTransactionReceiptParameters<
|
|
19
19
|
config extends Config = Config,
|
|
20
20
|
chainId extends
|
|
21
21
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
22
|
-
> =
|
|
22
|
+
> = Compute<
|
|
23
23
|
viem_WaitForTransactionReceiptParameters & ChainIdParameter<config, chainId>
|
|
24
24
|
>
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ export type WaitForTransactionReceiptReturnType<
|
|
|
29
29
|
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
30
30
|
///
|
|
31
31
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
32
|
-
> =
|
|
32
|
+
> = Compute<
|
|
33
33
|
{
|
|
34
34
|
[key in keyof chains]: viem_WaitForTransactionReceiptReturnType<
|
|
35
35
|
IsNarrowable<chains[key], Chain> extends true ? chains[key] : undefined
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
ChainIdParameter,
|
|
12
12
|
SyncConnectedChainParameter,
|
|
13
13
|
} from '../types/properties.js'
|
|
14
|
-
import type {
|
|
14
|
+
import type { UnionCompute } from '../types/utils.js'
|
|
15
15
|
import { getAction } from '../utils/getAction.js'
|
|
16
16
|
|
|
17
17
|
export type WatchBlockNumberParameters<
|
|
@@ -21,7 +21,7 @@ export type WatchBlockNumberParameters<
|
|
|
21
21
|
///
|
|
22
22
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
23
23
|
> = {
|
|
24
|
-
[key in keyof chains]:
|
|
24
|
+
[key in keyof chains]: UnionCompute<
|
|
25
25
|
viem_WatchBlockNumberParameters<
|
|
26
26
|
config['_internal']['transports'][chains[key]['id']] extends infer transport extends
|
|
27
27
|
Transport
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
ChainIdParameter,
|
|
12
12
|
SyncConnectedChainParameter,
|
|
13
13
|
} from '../types/properties.js'
|
|
14
|
-
import type { IsNarrowable,
|
|
14
|
+
import type { IsNarrowable, UnionCompute } from '../types/utils.js'
|
|
15
15
|
import { getAction } from '../utils/getAction.js'
|
|
16
16
|
|
|
17
17
|
export type WatchBlocksParameters<
|
|
@@ -23,7 +23,7 @@ export type WatchBlocksParameters<
|
|
|
23
23
|
///
|
|
24
24
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
25
25
|
> = {
|
|
26
|
-
[key in keyof chains]:
|
|
26
|
+
[key in keyof chains]: UnionCompute<
|
|
27
27
|
viem_WatchBlocksParameters<
|
|
28
28
|
config['_internal']['transports'][chains[key]['id']] extends infer transport extends
|
|
29
29
|
Transport
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
ChainIdParameter,
|
|
18
18
|
SyncConnectedChainParameter,
|
|
19
19
|
} from '../types/properties.js'
|
|
20
|
-
import type {
|
|
20
|
+
import type { UnionCompute } from '../types/utils.js'
|
|
21
21
|
import { getAction } from '../utils/getAction.js'
|
|
22
22
|
|
|
23
23
|
export type WatchContractEventParameters<
|
|
@@ -30,7 +30,7 @@ export type WatchContractEventParameters<
|
|
|
30
30
|
///
|
|
31
31
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
32
32
|
> = {
|
|
33
|
-
[key in keyof chains]:
|
|
33
|
+
[key in keyof chains]: UnionCompute<
|
|
34
34
|
viem_WatchContractEventParameters<
|
|
35
35
|
abi,
|
|
36
36
|
eventName,
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
ChainIdParameter,
|
|
12
12
|
SyncConnectedChainParameter,
|
|
13
13
|
} from '../types/properties.js'
|
|
14
|
-
import type {
|
|
14
|
+
import type { UnionCompute } from '../types/utils.js'
|
|
15
15
|
import { getAction } from '../utils/getAction.js'
|
|
16
16
|
|
|
17
17
|
export type WatchPendingTransactionsParameters<
|
|
@@ -21,7 +21,7 @@ export type WatchPendingTransactionsParameters<
|
|
|
21
21
|
///
|
|
22
22
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
23
23
|
> = {
|
|
24
|
-
[key in keyof chains]:
|
|
24
|
+
[key in keyof chains]: UnionCompute<
|
|
25
25
|
viem_WatchPendingTransactionsParameters<
|
|
26
26
|
config['_internal']['transports'][chains[key]['id']] extends infer transport extends
|
|
27
27
|
Transport
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
ChainIdParameter,
|
|
21
21
|
ConnectorParameter,
|
|
22
22
|
} from '../types/properties.js'
|
|
23
|
-
import type {
|
|
23
|
+
import type { Compute, UnionCompute } from '../types/utils.js'
|
|
24
24
|
import { getAction } from '../utils/getAction.js'
|
|
25
25
|
import { getAccount } from './getAccount.js'
|
|
26
26
|
import {
|
|
@@ -49,9 +49,9 @@ export type WriteContractParameters<
|
|
|
49
49
|
///
|
|
50
50
|
allFunctionNames = ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
51
51
|
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
52
|
-
> =
|
|
52
|
+
> = UnionCompute<
|
|
53
53
|
{
|
|
54
|
-
// TODO: Should use `
|
|
54
|
+
// TODO: Should use `UnionStrictOmit<..., 'chain'>` on `viem_WriteContractParameters` result instead
|
|
55
55
|
// temp workaround that doesn't affect runtime behavior for for https://github.com/wevm/wagmi/issues/3981
|
|
56
56
|
[key in keyof chains]: viem_WriteContractParameters<
|
|
57
57
|
abi,
|
|
@@ -63,7 +63,7 @@ export type WriteContractParameters<
|
|
|
63
63
|
allFunctionNames
|
|
64
64
|
>
|
|
65
65
|
}[number] &
|
|
66
|
-
|
|
66
|
+
Compute<ChainIdParameter<config, chainId>> &
|
|
67
67
|
ConnectorParameter & { __mode?: 'prepared' }
|
|
68
68
|
>
|
|
69
69
|
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
|
|
10
10
|
import type { Emitter } from '../createEmitter.js'
|
|
11
11
|
import type { Storage } from '../createStorage.js'
|
|
12
|
-
import type {
|
|
12
|
+
import type { Compute, ExactPartial, StrictOmit } from '../types/utils.js'
|
|
13
13
|
|
|
14
14
|
export type ConnectorEventMap = {
|
|
15
15
|
change: {
|
|
@@ -29,8 +29,8 @@ export type CreateConnectorFn<
|
|
|
29
29
|
> = (config: {
|
|
30
30
|
chains: readonly [Chain, ...Chain[]]
|
|
31
31
|
emitter: Emitter<ConnectorEventMap>
|
|
32
|
-
storage?:
|
|
33
|
-
}) =>
|
|
32
|
+
storage?: Compute<Storage<storageItem>> | null | undefined
|
|
33
|
+
}) => Compute<
|
|
34
34
|
{
|
|
35
35
|
readonly icon?: string | undefined
|
|
36
36
|
readonly id: string
|
|
@@ -58,9 +58,9 @@ export type CreateConnectorFn<
|
|
|
58
58
|
): Promise<Client>
|
|
59
59
|
isAuthorized(): Promise<boolean>
|
|
60
60
|
switchChain?(
|
|
61
|
-
parameters:
|
|
61
|
+
parameters: Compute<{
|
|
62
62
|
addEthereumChainParameter?:
|
|
63
|
-
| ExactPartial<
|
|
63
|
+
| ExactPartial<StrictOmit<AddEthereumChainParameter, 'chainId'>>
|
|
64
64
|
| undefined
|
|
65
65
|
chainId: number
|
|
66
66
|
}>,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import type { Connector } from '../createConfig.js'
|
|
18
18
|
import { ChainNotConfiguredError } from '../errors/config.js'
|
|
19
19
|
import { ProviderNotFoundError } from '../errors/connector.js'
|
|
20
|
-
import type {
|
|
20
|
+
import type { Compute } from '../types/utils.js'
|
|
21
21
|
import { createConnector } from './createConnector.js'
|
|
22
22
|
|
|
23
23
|
export type InjectedParameters = {
|
|
@@ -94,7 +94,7 @@ injected.type = 'injected' as const
|
|
|
94
94
|
export function injected(parameters: InjectedParameters = {}) {
|
|
95
95
|
const { shimDisconnect = true, unstable_shimAsyncInject } = parameters
|
|
96
96
|
|
|
97
|
-
function getTarget():
|
|
97
|
+
function getTarget(): Compute<Target & { id: string }> {
|
|
98
98
|
const target = parameters.target
|
|
99
99
|
if (typeof target === 'function') {
|
|
100
100
|
const result = target()
|
|
@@ -181,6 +181,13 @@ export function injected(parameters: InjectedParameters = {}) {
|
|
|
181
181
|
accounts = (permissions[0]?.caveats?.[0]?.value as string[])?.map(
|
|
182
182
|
(x) => getAddress(x),
|
|
183
183
|
)
|
|
184
|
+
// `'wallet_requestPermissions'` can return a different order of accounts than `'eth_accounts'`
|
|
185
|
+
// switch to `'eth_accounts'` ordering if more than one account is connected
|
|
186
|
+
// https://github.com/wevm/wagmi/issues/4140
|
|
187
|
+
if (accounts.length > 0) {
|
|
188
|
+
const sortedAccounts = await this.getAccounts()
|
|
189
|
+
accounts = sortedAccounts
|
|
190
|
+
}
|
|
184
191
|
} catch (err) {
|
|
185
192
|
const error = err as RpcError
|
|
186
193
|
// Not all injected providers support `wallet_requestPermissions` (e.g. MetaMask iOS).
|
|
@@ -582,7 +589,7 @@ type Target = {
|
|
|
582
589
|
}
|
|
583
590
|
|
|
584
591
|
/** @deprecated */
|
|
585
|
-
type TargetId =
|
|
592
|
+
type TargetId = Compute<WalletProviderFlags> extends `is${infer name}`
|
|
586
593
|
? name extends `${infer char}${infer rest}`
|
|
587
594
|
? `${Lowercase<char>}${rest}`
|
|
588
595
|
: never
|
|
@@ -630,7 +637,7 @@ type WalletProviderFlags =
|
|
|
630
637
|
| 'isXDEFI'
|
|
631
638
|
| 'isZerion'
|
|
632
639
|
|
|
633
|
-
type WalletProvider =
|
|
640
|
+
type WalletProvider = Compute<
|
|
634
641
|
EIP1193Provider & {
|
|
635
642
|
[key in WalletProviderFlags]?: true | undefined
|
|
636
643
|
} & {
|