@wagmi/core 0.5.8 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chains/dist/wagmi-core-chains.cjs.dev.js +2 -2
- package/chains/dist/wagmi-core-chains.cjs.prod.js +2 -2
- package/chains/dist/wagmi-core-chains.esm.js +2 -2
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +11 -12
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +11 -12
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +11 -12
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +4 -3
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +4 -3
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +4 -3
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +9 -13
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +9 -13
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +9 -13
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +9 -11
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +9 -11
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +9 -11
- package/dist/{chains-8c76af1b.esm.js → chains-2970e5fa.esm.js} +17 -11
- package/dist/{chains-ec1de502.cjs.dev.js → chains-45d5aa86.cjs.prod.js} +17 -11
- package/dist/{chains-789e0c2e.cjs.prod.js → chains-524f4950.cjs.dev.js} +17 -11
- package/dist/declarations/src/actions/accounts/fetchBalance.d.ts +4 -4
- package/dist/declarations/src/actions/accounts/fetchSigner.d.ts +5 -1
- package/dist/declarations/src/actions/accounts/index.d.ts +1 -1
- package/dist/declarations/src/actions/accounts/signMessage.d.ts +3 -5
- package/dist/declarations/src/actions/accounts/signTypedData.d.ts +19 -20
- package/dist/declarations/src/actions/accounts/watchSigner.d.ts +5 -3
- package/dist/declarations/src/actions/contracts/fetchToken.d.ts +5 -5
- package/dist/declarations/src/actions/contracts/getContract.d.ts +111 -8
- package/dist/declarations/src/actions/contracts/index.d.ts +5 -4
- package/dist/declarations/src/actions/contracts/multicall.d.ts +11 -15
- package/dist/declarations/src/actions/contracts/prepareWriteContract.d.ts +26 -16
- package/dist/declarations/src/actions/contracts/readContract.d.ts +12 -14
- package/dist/declarations/src/actions/contracts/readContracts.d.ts +25 -16
- package/dist/declarations/src/actions/contracts/watchContractEvent.d.ts +22 -8
- package/dist/declarations/src/actions/contracts/watchMulticall.d.ts +10 -0
- package/dist/declarations/src/actions/contracts/watchReadContract.d.ts +4 -3
- package/dist/declarations/src/actions/contracts/watchReadContracts.d.ts +7 -3
- package/dist/declarations/src/actions/contracts/writeContract.d.ts +43 -23
- package/dist/declarations/src/actions/ens/fetchEnsAddress.d.ts +1 -1
- package/dist/declarations/src/actions/ens/fetchEnsName.d.ts +2 -1
- package/dist/declarations/src/actions/index.d.ts +3 -3
- package/dist/declarations/src/actions/transactions/index.d.ts +0 -1
- package/dist/declarations/src/actions/transactions/prepareSendTransaction.d.ts +5 -4
- package/dist/declarations/src/actions/transactions/sendTransaction.d.ts +3 -2
- package/dist/declarations/src/actions/transactions/waitForTransaction.d.ts +2 -1
- package/dist/declarations/src/connectors/base.d.ts +5 -4
- package/dist/declarations/src/connectors/coinbaseWallet.d.ts +5 -3
- package/dist/declarations/src/connectors/injected.d.ts +10 -9
- package/dist/declarations/src/connectors/metaMask.d.ts +1 -1
- package/dist/declarations/src/connectors/mock/connector.d.ts +1 -1
- package/dist/declarations/src/connectors/mock/provider.d.ts +1 -1
- package/dist/declarations/src/connectors/walletConnect.d.ts +2 -2
- package/dist/declarations/src/constants/abis.d.ts +421 -2
- package/dist/declarations/src/constants/blockExplorers.d.ts +1 -1
- package/dist/declarations/src/constants/index.d.ts +1 -2
- package/dist/declarations/src/errors.d.ts +8 -8
- package/dist/declarations/src/index.d.ts +4 -3
- package/dist/declarations/src/internal.d.ts +2 -0
- package/dist/declarations/src/types/contracts.d.ts +241 -0
- package/dist/declarations/src/types/index.d.ts +31 -9
- package/dist/declarations/src/types/utils.d.ts +103 -0
- package/dist/declarations/src/utils/assertActiveChain.d.ts +3 -0
- package/dist/declarations/src/utils/configureChains.d.ts +3 -5
- package/dist/declarations/src/utils/index.d.ts +2 -0
- package/dist/declarations/src/utils/minimizeContractInterface.d.ts +5 -5
- package/dist/declarations/src/utils/normalizeFunctionName.d.ts +17 -0
- package/dist/declarations/src/utils/parseContractResult.d.ts +4 -4
- package/dist/{getProvider-5b4b62c3.esm.js → getProvider-24ec6544.esm.js} +49 -50
- package/dist/{getProvider-1b3eeda8.cjs.dev.js → getProvider-ed469b94.cjs.prod.js} +48 -49
- package/dist/{getProvider-ad4ce6a4.cjs.prod.js → getProvider-f6f17fa1.cjs.dev.js} +48 -49
- package/dist/{rpcs-d2cd65f1.cjs.dev.js → rpcs-0d21dfe8.cjs.dev.js} +5 -5
- package/dist/{rpcs-8d636858.esm.js → rpcs-b4aa70b9.esm.js} +6 -6
- package/dist/{rpcs-edec227e.cjs.prod.js → rpcs-c62bf9b0.cjs.prod.js} +5 -5
- package/dist/wagmi-core.cjs.dev.js +847 -395
- package/dist/wagmi-core.cjs.prod.js +847 -395
- package/dist/wagmi-core.esm.js +849 -397
- package/package.json +3 -2
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.dev.js +2 -2
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.prod.js +2 -2
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.esm.js +2 -2
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.dev.js +2 -2
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.prod.js +2 -2
- package/providers/infura/dist/wagmi-core-providers-infura.esm.js +2 -2
- package/dist/declarations/src/actions/contracts/deprecatedWriteContract.d.ts +0 -16
- package/dist/declarations/src/actions/transactions/deprecatedSendTransaction.d.ts +0 -12
- package/dist/declarations/src/constants/multicall.d.ts +0 -25
- package/providers/coinbaseNode/dist/wagmi-core-providers-coinbaseNode.cjs.d.ts +0 -11
- package/providers/coinbaseNode/dist/wagmi-core-providers-coinbaseNode.cjs.js +0 -16
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** Arguments to pass contract method */
|
|
7
|
-
args?: any | any[];
|
|
1
|
+
import { Abi } from 'abitype';
|
|
2
|
+
import { DefaultOptions, GetConfig, GetOverridesForAbiStateMutability, GetReturnType, Options } from '../../types/contracts';
|
|
3
|
+
export declare type ReadContractConfig<TAbi = Abi, TFunctionName = string, TOptions extends Options = DefaultOptions> = GetConfig<{
|
|
4
|
+
abi: TAbi;
|
|
5
|
+
functionName: TFunctionName;
|
|
8
6
|
/** Chain id to use for provider */
|
|
9
7
|
chainId?: number;
|
|
10
|
-
contractInterface: GetContractArgs['contractInterface'];
|
|
11
|
-
/** Function to invoke on the contract */
|
|
12
|
-
functionName: string;
|
|
13
8
|
/** Call overrides */
|
|
14
|
-
overrides?:
|
|
15
|
-
}
|
|
16
|
-
export declare type ReadContractResult<
|
|
17
|
-
|
|
9
|
+
overrides?: GetOverridesForAbiStateMutability<'pure' | 'view'>;
|
|
10
|
+
}, 'pure' | 'view', TOptions>;
|
|
11
|
+
export declare type ReadContractResult<TAbi = Abi, TFunctionName = string> = GetReturnType<{
|
|
12
|
+
abi: TAbi;
|
|
13
|
+
functionName: TFunctionName;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function readContract<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ address, args, chainId, abi, functionName, overrides, }: ReadContractConfig<TAbi, TFunctionName>): Promise<ReadContractResult<TAbi, TFunctionName>>;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
addressOrName: ReadContractConfig['addressOrName'];
|
|
6
|
-
args?: ReadContractConfig['args'];
|
|
7
|
-
chainId?: ReadContractConfig['chainId'];
|
|
8
|
-
contractInterface: ReadContractConfig['contractInterface'];
|
|
9
|
-
functionName: ReadContractConfig['functionName'];
|
|
1
|
+
import { Abi } from 'abitype';
|
|
2
|
+
import { ContractsConfig, ContractsResult, DefaultOptions, GetOverridesForAbiStateMutability, Options as Options_ } from '../../types/contracts';
|
|
3
|
+
declare type Options = Options_ & {
|
|
4
|
+
isContractsOptional?: boolean;
|
|
10
5
|
};
|
|
11
|
-
export declare type ReadContractsConfig =
|
|
12
|
-
|
|
6
|
+
export declare type ReadContractsConfig<TContracts extends unknown[], TOptions extends Options = DefaultOptions, _Contracts = readonly [
|
|
7
|
+
...ContractsConfig<TContracts, {
|
|
8
|
+
/** Chain id to use for provider */
|
|
9
|
+
chainId?: number;
|
|
10
|
+
}, TOptions>
|
|
11
|
+
]> = {
|
|
12
|
+
/** Failures in the multicall will fail silently */
|
|
13
13
|
allowFailure?: boolean;
|
|
14
|
-
contracts: ReadContractsContract[];
|
|
15
14
|
/** Call overrides */
|
|
16
|
-
overrides?:
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
overrides?: GetOverridesForAbiStateMutability<'pure' | 'view'>;
|
|
16
|
+
} & (TOptions['isContractsOptional'] extends true ? {
|
|
17
|
+
/** Contracts to query */
|
|
18
|
+
contracts?: _Contracts;
|
|
19
|
+
} : {
|
|
20
|
+
/** Contracts to query */
|
|
21
|
+
contracts: _Contracts;
|
|
22
|
+
});
|
|
23
|
+
export declare type ReadContractsResult<TContracts extends unknown[]> = ContractsResult<TContracts>;
|
|
24
|
+
export declare function readContracts<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TContracts extends {
|
|
25
|
+
abi: TAbi;
|
|
26
|
+
functionName: TFunctionName;
|
|
27
|
+
}[]>({ allowFailure, contracts, overrides, }: ReadContractsConfig<TContracts>): Promise<ReadContractsResult<TContracts>>;
|
|
28
|
+
export {};
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Abi, AbiEvent, ExtractAbiEvent, ExtractAbiEventNames, Narrow } from 'abitype';
|
|
2
|
+
import { AbiEventParametersToPrimitiveTypes, Event } from '../../types/contracts';
|
|
3
|
+
import { IsNever, NotEqual, Or } from '../../types/utils';
|
|
4
|
+
declare type ContractEventConfig<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string = string> = {
|
|
5
|
+
/** Contract address */
|
|
6
|
+
address: string;
|
|
7
|
+
/** Contract ABI */
|
|
8
|
+
abi: Narrow<TAbi>;
|
|
4
9
|
/** Chain id to use for provider */
|
|
5
10
|
chainId?: number;
|
|
11
|
+
/** Event to listen for */
|
|
12
|
+
eventName: IsNever<TEventName> extends true ? string : TEventName;
|
|
6
13
|
/** Receive only a single event */
|
|
7
14
|
once?: boolean;
|
|
8
15
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
eventName:
|
|
16
|
+
declare type GetConfig<T> = T extends {
|
|
17
|
+
abi: infer TAbi extends Abi;
|
|
18
|
+
} ? ContractEventConfig<TAbi, ExtractAbiEventNames<TAbi>> : T extends {
|
|
19
|
+
abi: infer TAbi extends readonly unknown[];
|
|
20
|
+
eventName: infer TEventName extends string;
|
|
21
|
+
} ? ContractEventConfig<TAbi, TEventName> : ContractEventConfig;
|
|
22
|
+
export declare type WatchContractEventConfig<TAbi = Abi, TEventName = string> = GetConfig<{
|
|
23
|
+
abi: TAbi;
|
|
24
|
+
eventName: TEventName;
|
|
25
|
+
}>;
|
|
26
|
+
export declare type WatchContractEventCallback<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string = string, TAbiEvent extends AbiEvent = TAbi extends Abi ? ExtractAbiEvent<TAbi, TEventName> : never> = AbiEventParametersToPrimitiveTypes<TAbiEvent['inputs']> extends infer TArgs extends readonly unknown[] ? Or<IsNever<TArgs>, NotEqual<TAbi, Abi>> extends true ? (...args: any) => void : (...args: [...args: TArgs, event: Event<TAbiEvent>]) => void : never;
|
|
27
|
+
export declare function watchContractEvent<TAbi extends Abi | readonly unknown[], TEventName extends string>({ address, abi, chainId, eventName, once, }: WatchContractEventConfig<TAbi, TEventName>, callback: WatchContractEventCallback<TAbi, TEventName>): () => void;
|
|
14
28
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Abi } from 'abitype';
|
|
2
|
+
import { MulticallConfig, MulticallResult } from './multicall';
|
|
3
|
+
export declare type WatchMulticallConfig<TContracts extends unknown[]> = MulticallConfig<TContracts> & {
|
|
4
|
+
listenToBlock?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare type WatchMulticallCallback<TContracts extends unknown[]> = (results: MulticallResult<TContracts>) => void;
|
|
7
|
+
export declare function watchMulticall<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TContracts extends {
|
|
8
|
+
abi: TAbi;
|
|
9
|
+
functionName: TFunctionName;
|
|
10
|
+
}[]>(config: WatchMulticallConfig<TContracts>, callback: WatchMulticallCallback<TContracts>): () => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Abi, ExtractAbiFunctionNames } from 'abitype';
|
|
1
2
|
import { ReadContractConfig, ReadContractResult } from './readContract';
|
|
2
|
-
export declare type WatchReadContractConfig = ReadContractConfig & {
|
|
3
|
+
export declare type WatchReadContractConfig<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ReadContractConfig<TAbi, TFunctionName> & {
|
|
3
4
|
listenToBlock?: boolean;
|
|
4
5
|
};
|
|
5
|
-
export declare type
|
|
6
|
-
export declare function watchReadContract(config: WatchReadContractConfig, callback:
|
|
6
|
+
export declare type WatchReadContractCallback<TAbi extends Abi | readonly unknown[], TFunctionName extends string> = (result: ReadContractResult<TAbi, TFunctionName>) => void;
|
|
7
|
+
export declare function watchReadContract<TAbi extends Abi | readonly unknown[], TFunctionName extends TAbi extends Abi ? ExtractAbiFunctionNames<TAbi, 'view' | 'pure'> : string>(config: WatchReadContractConfig<TAbi, TFunctionName>, callback: WatchReadContractCallback<TAbi, TFunctionName>): () => void;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { Abi } from 'abitype';
|
|
1
2
|
import { ReadContractsConfig, ReadContractsResult } from './readContracts';
|
|
2
|
-
export declare type WatchReadContractsConfig = ReadContractsConfig & {
|
|
3
|
+
export declare type WatchReadContractsConfig<TContracts extends unknown[]> = ReadContractsConfig<TContracts> & {
|
|
3
4
|
listenToBlock?: boolean;
|
|
4
5
|
};
|
|
5
|
-
export declare type
|
|
6
|
-
export declare function watchReadContracts
|
|
6
|
+
export declare type WatchReadContractsCallback<TContracts extends unknown[]> = (results: ReadContractsResult<TContracts>) => void;
|
|
7
|
+
export declare function watchReadContracts<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TContracts extends {
|
|
8
|
+
abi: TAbi;
|
|
9
|
+
functionName: TFunctionName;
|
|
10
|
+
}[]>(config: WatchReadContractsConfig<TContracts>, callback: WatchReadContractsCallback<TContracts>): () => void;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Abi, Address, ExtractAbiFunction } from 'abitype';
|
|
2
|
+
import { PopulatedTransaction } from 'ethers';
|
|
3
|
+
import { Signer } from '../../types';
|
|
4
|
+
import { DefaultOptions, GetConfig, GetOverridesForAbiStateMutability, Options as Options_ } from '../../types/contracts';
|
|
3
5
|
import { SendTransactionResult } from '../transactions';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
declare type Options = Options_ & {
|
|
7
|
+
isRequestOptional?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare type Request = PopulatedTransaction & {
|
|
10
|
+
to: Address;
|
|
11
|
+
gasLimit: NonNullable<PopulatedTransaction['gasLimit']>;
|
|
12
|
+
};
|
|
13
|
+
export declare type WriteContractPreparedArgs<TOptions extends Options = DefaultOptions> = {
|
|
6
14
|
/**
|
|
7
15
|
* `recklesslyUnprepared`: Allow to pass through unprepared config. Note: This has
|
|
8
16
|
* [UX pitfalls](https://wagmi.sh/docs/prepare-hooks/intro#ux-pitfalls-without-prepare-hooks),
|
|
@@ -13,25 +21,36 @@ export declare type WriteContractPreparedArgs = {
|
|
|
13
21
|
* via the {@link prepareWriteContract} function
|
|
14
22
|
* */
|
|
15
23
|
mode: 'prepared';
|
|
24
|
+
args?: never;
|
|
25
|
+
overrides?: never;
|
|
26
|
+
} & (TOptions['isRequestOptional'] extends true ? {
|
|
16
27
|
/** The prepared request. */
|
|
17
|
-
request
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
export declare type WriteContractUnpreparedArgs = {
|
|
28
|
+
request?: Request;
|
|
29
|
+
} : {
|
|
30
|
+
/** The prepared request. */
|
|
31
|
+
request: Request;
|
|
32
|
+
});
|
|
33
|
+
export declare type WriteContractUnpreparedArgs<TAbi = Abi, TFunctionName = string, TOptions extends Options = DefaultOptions> = {
|
|
23
34
|
mode: 'recklesslyUnprepared';
|
|
24
|
-
request?:
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
request?: never;
|
|
36
|
+
} & GetConfig<{
|
|
37
|
+
abi: TAbi;
|
|
38
|
+
functionName: TFunctionName;
|
|
39
|
+
/** Call overrides */
|
|
40
|
+
overrides?: GetOverridesForAbiStateMutability<[
|
|
41
|
+
TAbi,
|
|
42
|
+
TFunctionName
|
|
43
|
+
] extends [
|
|
44
|
+
infer TAbi_ extends Abi,
|
|
45
|
+
infer TFunctionName_ extends string
|
|
46
|
+
] ? ExtractAbiFunction<TAbi_, TFunctionName_>['stateMutability'] : 'nonpayable' | 'payable'>;
|
|
47
|
+
}, 'nonpayable' | 'payable', TOptions>;
|
|
48
|
+
export declare type WriteContractArgs<TAbi = Abi, TFunctionName = string, TOptions extends Options = DefaultOptions> = Omit<GetConfig<{
|
|
49
|
+
abi: TAbi;
|
|
50
|
+
functionName: TFunctionName;
|
|
51
|
+
/** Chain id to use for provider */
|
|
28
52
|
chainId?: number;
|
|
29
|
-
|
|
30
|
-
functionName: string;
|
|
31
|
-
/** Arguments to pass contract method */
|
|
32
|
-
args?: any | any[];
|
|
33
|
-
overrides?: CallOverrides;
|
|
34
|
-
} & (WriteContractUnpreparedArgs | WriteContractPreparedArgs);
|
|
53
|
+
}, 'nonpayable' | 'payable', TOptions>, 'args'> & (WriteContractUnpreparedArgs<TAbi, TFunctionName, TOptions> | WriteContractPreparedArgs<TOptions>);
|
|
35
54
|
export declare type WriteContractResult = SendTransactionResult;
|
|
36
55
|
/**
|
|
37
56
|
* @description Function to call a contract write method.
|
|
@@ -43,10 +62,11 @@ export declare type WriteContractResult = SendTransactionResult;
|
|
|
43
62
|
* import { prepareWriteContract, writeContract } from '@wagmi/core'
|
|
44
63
|
*
|
|
45
64
|
* const config = await prepareWriteContract({
|
|
46
|
-
*
|
|
47
|
-
*
|
|
65
|
+
* address: '0x...',
|
|
66
|
+
* abi: wagmiAbi,
|
|
48
67
|
* functionName: 'mint',
|
|
49
68
|
* })
|
|
50
69
|
* const result = await writeContract(config)
|
|
51
70
|
*/
|
|
52
|
-
export declare function writeContract({
|
|
71
|
+
export declare function writeContract<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TSigner extends Signer = Signer>({ address, args, chainId, abi, functionName, mode, overrides, request: request_, }: WriteContractArgs<TAbi, TFunctionName>): Promise<WriteContractResult>;
|
|
72
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { connect, disconnect, fetchBalance, fetchSigner, getAccount, getNetwork, signMessage, signTypedData, switchNetwork, watchAccount, watchNetwork, watchSigner, type ConnectArgs, type ConnectResult, type FetchBalanceArgs, type FetchBalanceResult, type FetchSignerResult, type GetAccountResult, type GetNetworkResult, type SignMessageArgs, type SignMessageResult, type SignTypedDataArgs, type SignTypedDataResult, type SwitchNetworkArgs, type SwitchNetworkResult, type WatchAccountCallback, type WatchNetworkCallback, type WatchSignerCallback, } from './accounts';
|
|
2
|
-
export {
|
|
1
|
+
export { connect, disconnect, fetchBalance, fetchSigner, getAccount, getNetwork, signMessage, signTypedData, switchNetwork, watchAccount, watchNetwork, watchSigner, type ConnectArgs, type ConnectResult, type FetchBalanceArgs, type FetchBalanceResult, type FetchSignerArgs, type FetchSignerResult, type GetAccountResult, type GetNetworkResult, type SignMessageArgs, type SignMessageResult, type SignTypedDataArgs, type SignTypedDataResult, type SwitchNetworkArgs, type SwitchNetworkResult, type WatchAccountCallback, type WatchNetworkCallback, type WatchSignerCallback, } from './accounts';
|
|
2
|
+
export { fetchToken, getContract, multicall, prepareWriteContract, readContract, readContracts, watchContractEvent, watchMulticall, watchReadContract, watchReadContracts, writeContract, type FetchTokenArgs, type FetchTokenResult, type GetContractArgs, type GetContractResult, type MulticallConfig, type MulticallResult, type PrepareWriteContractConfig, type PrepareWriteContractResult, type ReadContractConfig, type ReadContractResult, type ReadContractsConfig, type ReadContractsResult, type WatchMulticallConfig, type WatchMulticallCallback, type WatchReadContractConfig, type WatchReadContractCallback, type WatchReadContractsConfig, type WatchReadContractsCallback, type WriteContractArgs, type WriteContractPreparedArgs, type WriteContractResult, type WriteContractUnpreparedArgs, } from './contracts';
|
|
3
3
|
export { fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, type FetchEnsAddressArgs, type FetchEnsAddressResult, type FetchEnsAvatarArgs, type FetchEnsAvatarResult, type FetchEnsNameArgs, type FetchEnsNameResult, type FetchEnsResolverArgs, type FetchEnsResolverResult, } from './ens';
|
|
4
4
|
export { fetchBlockNumber, fetchFeeData, watchBlockNumber, type FetchBlockNumberArgs, type FetchBlockNumberResult, type FetchFeeDataArgs, type FetchFeeDataResult, type WatchBlockNumberArgs, type WatchBlockNumberCallback, } from './network-status';
|
|
5
5
|
export { getProvider, getWebSocketProvider, watchProvider, watchWebSocketProvider, type GetProviderArgs, type GetProviderResult, type GetWebSocketProviderArgs, type GetWebSocketProviderResult, type WatchProviderCallback, type WatchWebSocketProviderCallback, } from './providers';
|
|
6
|
-
export {
|
|
6
|
+
export { fetchTransaction, prepareSendTransaction, sendTransaction, waitForTransaction, type FetchTransactionArgs, type FetchTransactionResult, type PrepareSendTransactionArgs, type PrepareSendTransactionResult, type SendTransactionArgs, type SendTransactionPreparedRequest, type SendTransactionResult, type SendTransactionUnpreparedRequest, type WaitForTransactionArgs, type WaitForTransactionResult, } from './transactions';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { deprecatedSendTransaction, type DeprecatedSendTransactionArgs, type DeprecatedSendTransactionResult, } from './deprecatedSendTransaction';
|
|
2
1
|
export { fetchTransaction, type FetchTransactionArgs, type FetchTransactionResult, } from './fetchTransaction';
|
|
3
2
|
export { prepareSendTransaction, type PrepareSendTransactionArgs, type PrepareSendTransactionResult, } from './prepareSendTransaction';
|
|
4
3
|
export { sendTransaction, type SendTransactionArgs, type SendTransactionPreparedRequest, type SendTransactionResult, type SendTransactionUnpreparedRequest, } from './sendTransaction';
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { Address } from 'abitype';
|
|
1
2
|
import { providers } from 'ethers';
|
|
2
|
-
import {
|
|
3
|
-
export declare type PrepareSendTransactionArgs = {
|
|
3
|
+
import { Signer } from '../../types';
|
|
4
|
+
export declare type PrepareSendTransactionArgs<TSigner extends Signer = Signer> = {
|
|
4
5
|
/** Chain ID used to validate if the signer is connected to the target chain */
|
|
5
6
|
chainId?: number;
|
|
6
7
|
/** Request data to prepare the transaction */
|
|
7
8
|
request: providers.TransactionRequest & {
|
|
8
9
|
to: NonNullable<providers.TransactionRequest['to']>;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
signer?: TSigner | null;
|
|
11
12
|
};
|
|
12
13
|
export declare type PrepareSendTransactionResult = {
|
|
13
14
|
chainId?: number;
|
|
@@ -33,4 +34,4 @@ export declare type PrepareSendTransactionResult = {
|
|
|
33
34
|
* })
|
|
34
35
|
* const result = await sendTransaction(config)
|
|
35
36
|
*/
|
|
36
|
-
export declare function prepareSendTransaction({ chainId, request,
|
|
37
|
+
export declare function prepareSendTransaction({ chainId, request, signer: signer_, }: PrepareSendTransactionArgs): Promise<PrepareSendTransactionResult>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Address } from 'abitype';
|
|
1
2
|
import { providers } from 'ethers';
|
|
2
|
-
import {
|
|
3
|
+
import { Hash } from '../../types';
|
|
3
4
|
export declare type SendTransactionPreparedRequest = {
|
|
4
5
|
/**
|
|
5
6
|
* `recklesslyUnprepared`: Allow to pass through an unprepared `request`. Note: This has
|
|
@@ -26,7 +27,7 @@ export declare type SendTransactionArgs = {
|
|
|
26
27
|
chainId?: number;
|
|
27
28
|
} & (SendTransactionPreparedRequest | SendTransactionUnpreparedRequest);
|
|
28
29
|
export declare type SendTransactionResult = {
|
|
29
|
-
hash:
|
|
30
|
+
hash: Hash;
|
|
30
31
|
wait: providers.TransactionResponse['wait'];
|
|
31
32
|
};
|
|
32
33
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { providers } from 'ethers';
|
|
2
|
+
import { Hash } from '../../types';
|
|
2
3
|
export declare type WaitForTransactionArgs = {
|
|
3
4
|
/** Chain id to use for provider */
|
|
4
5
|
chainId?: number;
|
|
@@ -8,7 +9,7 @@ export declare type WaitForTransactionArgs = {
|
|
|
8
9
|
*/
|
|
9
10
|
confirmations?: number;
|
|
10
11
|
/** Transaction hash to monitor */
|
|
11
|
-
hash?:
|
|
12
|
+
hash?: Hash;
|
|
12
13
|
timeout?: number;
|
|
13
14
|
/** Function resolving to transaction receipt */
|
|
14
15
|
wait?: providers.TransactionResponse['wait'];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Address } from 'abitype';
|
|
1
2
|
import { default as EventEmitter } from 'eventemitter3';
|
|
2
3
|
import { Chain } from '../types';
|
|
3
4
|
export declare type ConnectorData<Provider = any> = {
|
|
4
|
-
account?:
|
|
5
|
+
account?: Address;
|
|
5
6
|
chain?: {
|
|
6
7
|
id: number;
|
|
7
8
|
unsupported: boolean;
|
|
@@ -37,7 +38,7 @@ export declare abstract class Connector<Provider = any, Options = any, Signer =
|
|
|
37
38
|
chainId?: number;
|
|
38
39
|
}): Promise<Required<ConnectorData>>;
|
|
39
40
|
abstract disconnect(): Promise<void>;
|
|
40
|
-
abstract getAccount(): Promise<
|
|
41
|
+
abstract getAccount(): Promise<Address>;
|
|
41
42
|
abstract getChainId(): Promise<number>;
|
|
42
43
|
abstract getProvider(config?: {
|
|
43
44
|
chainId?: number;
|
|
@@ -53,9 +54,9 @@ export declare abstract class Connector<Provider = any, Options = any, Signer =
|
|
|
53
54
|
image?: string;
|
|
54
55
|
symbol: string;
|
|
55
56
|
}): Promise<boolean>;
|
|
56
|
-
protected abstract onAccountsChanged(accounts:
|
|
57
|
+
protected abstract onAccountsChanged(accounts: Address[]): void;
|
|
57
58
|
protected abstract onChainChanged(chain: number | string): void;
|
|
58
59
|
protected abstract onDisconnect(error: Error): void;
|
|
59
|
-
protected getBlockExplorerUrls(chain: Chain):
|
|
60
|
+
protected getBlockExplorerUrls(chain: Chain): string[];
|
|
60
61
|
protected isChainUnsupported(chainId: number): boolean;
|
|
61
62
|
}
|
|
@@ -27,7 +27,7 @@ export declare class CoinbaseWalletConnector extends Connector<CoinbaseWalletPro
|
|
|
27
27
|
connect({ chainId }?: {
|
|
28
28
|
chainId?: number;
|
|
29
29
|
}): Promise<{
|
|
30
|
-
account: string
|
|
30
|
+
account: `0x${string}`;
|
|
31
31
|
chain: {
|
|
32
32
|
id: number;
|
|
33
33
|
unsupported: boolean;
|
|
@@ -35,10 +35,12 @@ export declare class CoinbaseWalletConnector extends Connector<CoinbaseWalletPro
|
|
|
35
35
|
provider: providers.Web3Provider;
|
|
36
36
|
}>;
|
|
37
37
|
disconnect(): Promise<void>;
|
|
38
|
-
getAccount(): Promise
|
|
38
|
+
getAccount(): Promise<`0x${string}`>;
|
|
39
39
|
getChainId(): Promise<number>;
|
|
40
40
|
getProvider(): Promise<CoinbaseWalletProvider>;
|
|
41
|
-
getSigner(
|
|
41
|
+
getSigner({ chainId }?: {
|
|
42
|
+
chainId?: number;
|
|
43
|
+
}): Promise<providers.JsonRpcSigner>;
|
|
42
44
|
isAuthorized(): Promise<boolean>;
|
|
43
45
|
switchChain(chainId: number): Promise<Chain>;
|
|
44
46
|
watchAsset({ address, decimals, image, symbol, }: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Address } from 'abitype';
|
|
1
2
|
import { providers } from 'ethers';
|
|
2
3
|
import { Chain } from '../types';
|
|
3
4
|
import { Connector } from './base';
|
|
@@ -6,14 +7,12 @@ export declare type InjectedConnectorOptions = {
|
|
|
6
7
|
name?: string | ((detectedName: string | string[]) => string);
|
|
7
8
|
/**
|
|
8
9
|
* MetaMask 10.9.3 emits disconnect event when chain is changed.
|
|
9
|
-
* This flag prevents the `"disconnect"` event from being emitted upon switching chains.
|
|
10
|
-
* @see https://github.com/MetaMask/metamask-extension/issues/13375#issuecomment-1027663334
|
|
10
|
+
* This flag prevents the `"disconnect"` event from being emitted upon switching chains. See [GitHub issue](https://github.com/MetaMask/metamask-extension/issues/13375#issuecomment-1027663334) for more info.
|
|
11
11
|
*/
|
|
12
12
|
shimChainChangedDisconnect?: boolean;
|
|
13
13
|
/**
|
|
14
14
|
* MetaMask and other injected providers do not support programmatic disconnect.
|
|
15
|
-
* This flag simulates the disconnect behavior by keeping track of connection status in storage.
|
|
16
|
-
* @see https://github.com/MetaMask/metamask-extension/issues/10353
|
|
15
|
+
* This flag simulates the disconnect behavior by keeping track of connection status in storage. See [GitHub issue](https://github.com/MetaMask/metamask-extension/issues/10353) for more info.
|
|
17
16
|
* @default true
|
|
18
17
|
*/
|
|
19
18
|
shimDisconnect?: boolean;
|
|
@@ -24,14 +23,14 @@ export declare class InjectedConnector extends Connector<Window['ethereum'], Inj
|
|
|
24
23
|
readonly name: string;
|
|
25
24
|
readonly ready: boolean;
|
|
26
25
|
protected shimDisconnectKey: string;
|
|
27
|
-
constructor({ chains, options, }?: {
|
|
26
|
+
constructor({ chains, options: options_, }?: {
|
|
28
27
|
chains?: Chain[];
|
|
29
28
|
options?: InjectedConnectorOptions;
|
|
30
29
|
});
|
|
31
30
|
connect({ chainId }?: {
|
|
32
31
|
chainId?: number;
|
|
33
32
|
}): Promise<{
|
|
34
|
-
account: string
|
|
33
|
+
account: `0x${string}`;
|
|
35
34
|
chain: {
|
|
36
35
|
id: number;
|
|
37
36
|
unsupported: boolean;
|
|
@@ -39,14 +38,16 @@ export declare class InjectedConnector extends Connector<Window['ethereum'], Inj
|
|
|
39
38
|
provider: import("../types").Ethereum;
|
|
40
39
|
}>;
|
|
41
40
|
disconnect(): Promise<void>;
|
|
42
|
-
getAccount(): Promise
|
|
41
|
+
getAccount(): Promise<`0x${string}`>;
|
|
43
42
|
getChainId(): Promise<number>;
|
|
44
43
|
getProvider(): Promise<import("../types").Ethereum | undefined>;
|
|
45
|
-
getSigner(
|
|
44
|
+
getSigner({ chainId }?: {
|
|
45
|
+
chainId?: number;
|
|
46
|
+
}): Promise<providers.JsonRpcSigner>;
|
|
46
47
|
isAuthorized(): Promise<boolean>;
|
|
47
48
|
switchChain(chainId: number): Promise<Chain>;
|
|
48
49
|
watchAsset({ address, decimals, image, symbol, }: {
|
|
49
|
-
address:
|
|
50
|
+
address: Address;
|
|
50
51
|
decimals?: number;
|
|
51
52
|
image?: string;
|
|
52
53
|
symbol: string;
|
|
@@ -14,7 +14,7 @@ export declare class MockConnector extends Connector<MockProvider, MockProviderO
|
|
|
14
14
|
chainId?: number;
|
|
15
15
|
}): Promise<Required<ConnectorData<any>>>;
|
|
16
16
|
disconnect(): Promise<void>;
|
|
17
|
-
getAccount(): Promise
|
|
17
|
+
getAccount(): Promise<`0x${string}`>;
|
|
18
18
|
getChainId(): Promise<number>;
|
|
19
19
|
getProvider({ chainId }?: {
|
|
20
20
|
chainId?: number;
|
|
@@ -23,7 +23,7 @@ export declare class MockProvider extends providers.BaseProvider {
|
|
|
23
23
|
constructor(options: MockProviderOptions);
|
|
24
24
|
enable(): Promise<string[]>;
|
|
25
25
|
disconnect(): Promise<void>;
|
|
26
|
-
getAccounts(): Promise
|
|
26
|
+
getAccounts(): Promise<`0x${string}`[]>;
|
|
27
27
|
getSigner(): import("ethers").Signer;
|
|
28
28
|
switchChain(chainId: number): Promise<void>;
|
|
29
29
|
watchAsset(_asset: {
|
|
@@ -16,7 +16,7 @@ export declare class WalletConnectConnector extends Connector<WalletConnectProvi
|
|
|
16
16
|
connect({ chainId }?: {
|
|
17
17
|
chainId?: number;
|
|
18
18
|
}): Promise<{
|
|
19
|
-
account: string
|
|
19
|
+
account: `0x${string}`;
|
|
20
20
|
chain: {
|
|
21
21
|
id: number;
|
|
22
22
|
unsupported: boolean;
|
|
@@ -24,7 +24,7 @@ export declare class WalletConnectConnector extends Connector<WalletConnectProvi
|
|
|
24
24
|
provider: providers.Web3Provider;
|
|
25
25
|
}>;
|
|
26
26
|
disconnect(): Promise<void>;
|
|
27
|
-
getAccount(): Promise
|
|
27
|
+
getAccount(): Promise<`0x${string}`>;
|
|
28
28
|
getChainId(): Promise<number>;
|
|
29
29
|
getProvider({ chainId, create, }?: {
|
|
30
30
|
chainId?: number;
|