@wagmi/core 0.6.12 → 0.7.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/chains/package.json +2 -2
- package/connectors/coinbaseWallet/package.json +2 -2
- package/connectors/metaMask/package.json +2 -2
- package/connectors/mock/package.json +2 -2
- package/connectors/walletConnect/package.json +2 -2
- package/dist/{declarations/src/connectors/base.d.ts → base-5bd9b5ed.d.ts} +8 -5
- package/dist/chains.d.ts +3 -0
- package/dist/chains.js +29 -0
- package/dist/chunk-2EDVJWOA.js +3496 -0
- package/dist/chunk-4DNFSL2K.js +376 -0
- package/dist/chunk-MQXBDTVK.js +29 -0
- package/dist/{declarations/src/connectors → connectors}/coinbaseWallet.d.ts +10 -6
- package/dist/connectors/coinbaseWallet.js +215 -0
- package/dist/{declarations/src/connectors → connectors}/metaMask.d.ts +11 -4
- package/dist/connectors/metaMask.js +115 -0
- package/dist/connectors/mock/index.d.ts +78 -0
- package/dist/connectors/mock/index.js +190 -0
- package/dist/{declarations/src/connectors → connectors}/walletConnect.d.ts +9 -5
- package/dist/connectors/walletConnect.js +160 -0
- package/dist/{declarations/src/types/contracts.d.ts → contracts-fb6a6ff0.d.ts} +122 -17
- package/dist/{declarations/src/types/index.d.ts → index-bacc1c49.d.ts} +83 -15
- package/dist/index.d.ts +1738 -0
- package/dist/index.js +165 -0
- package/dist/{declarations/src/connectors/injected.d.ts → injected-6980e5c3.d.ts} +9 -6
- package/dist/internal.d.ts +8 -0
- package/dist/internal.js +8 -0
- package/dist/providers/alchemy.d.ts +11 -0
- package/dist/providers/alchemy.js +32 -0
- package/dist/providers/infura.d.ts +11 -0
- package/dist/providers/infura.js +32 -0
- package/dist/providers/jsonRpc.d.ts +14 -0
- package/dist/providers/jsonRpc.js +44 -0
- package/dist/providers/public.d.ts +8 -0
- package/dist/providers/public.js +30 -0
- package/internal/package.json +2 -2
- package/package.json +40 -51
- package/providers/alchemy/package.json +2 -2
- package/providers/infura/package.json +2 -2
- package/providers/jsonRpc/package.json +2 -2
- package/providers/public/package.json +2 -2
- package/chains/dist/wagmi-core-chains.cjs.d.ts +0 -1
- package/chains/dist/wagmi-core-chains.cjs.dev.js +0 -26
- package/chains/dist/wagmi-core-chains.cjs.js +0 -7
- package/chains/dist/wagmi-core-chains.cjs.prod.js +0 -26
- package/chains/dist/wagmi-core-chains.esm.js +0 -2
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.d.ts +0 -1
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +0 -274
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.js +0 -7
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +0 -274
- package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +0 -252
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.d.ts +0 -1
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +0 -153
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.js +0 -7
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +0 -153
- package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +0 -149
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.d.ts +0 -1
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +0 -262
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.js +0 -7
- package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +0 -262
- package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +0 -253
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.d.ts +0 -1
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +0 -228
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.js +0 -7
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +0 -228
- package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +0 -206
- package/dist/chains-73cc6c23.cjs.prod.js +0 -526
- package/dist/chains-8fce19d8.esm.js +0 -502
- package/dist/chains-fe1f4131.cjs.dev.js +0 -526
- package/dist/debounce-0862bf88.esm.js +0 -18
- package/dist/debounce-2d836dc9.cjs.prod.js +0 -20
- package/dist/debounce-46ac0312.cjs.dev.js +0 -20
- package/dist/declarations/src/actions/accounts/connect.d.ts +0 -18
- package/dist/declarations/src/actions/accounts/disconnect.d.ts +0 -1
- package/dist/declarations/src/actions/accounts/fetchBalance.d.ts +0 -19
- package/dist/declarations/src/actions/accounts/fetchSigner.d.ts +0 -7
- package/dist/declarations/src/actions/accounts/getAccount.d.ts +0 -36
- package/dist/declarations/src/actions/accounts/getNetwork.d.ts +0 -8
- package/dist/declarations/src/actions/accounts/index.d.ts +0 -12
- package/dist/declarations/src/actions/accounts/signMessage.d.ts +0 -7
- package/dist/declarations/src/actions/accounts/signTypedData.d.ts +0 -23
- package/dist/declarations/src/actions/accounts/switchNetwork.d.ts +0 -6
- package/dist/declarations/src/actions/accounts/watchAccount.d.ts +0 -12
- package/dist/declarations/src/actions/accounts/watchNetwork.d.ts +0 -10
- package/dist/declarations/src/actions/accounts/watchSigner.d.ts +0 -5
- package/dist/declarations/src/actions/contracts/fetchToken.d.ts +0 -21
- package/dist/declarations/src/actions/contracts/getContract.d.ts +0 -113
- package/dist/declarations/src/actions/contracts/index.d.ts +0 -11
- package/dist/declarations/src/actions/contracts/multicall.d.ts +0 -17
- package/dist/declarations/src/actions/contracts/prepareWriteContract.d.ts +0 -47
- package/dist/declarations/src/actions/contracts/readContract.d.ts +0 -15
- package/dist/declarations/src/actions/contracts/readContracts.d.ts +0 -28
- package/dist/declarations/src/actions/contracts/watchContractEvent.d.ts +0 -28
- package/dist/declarations/src/actions/contracts/watchMulticall.d.ts +0 -10
- package/dist/declarations/src/actions/contracts/watchReadContract.d.ts +0 -7
- package/dist/declarations/src/actions/contracts/watchReadContracts.d.ts +0 -10
- package/dist/declarations/src/actions/contracts/writeContract.d.ts +0 -72
- package/dist/declarations/src/actions/ens/fetchEnsAddress.d.ts +0 -9
- package/dist/declarations/src/actions/ens/fetchEnsAvatar.d.ts +0 -8
- package/dist/declarations/src/actions/ens/fetchEnsName.d.ts +0 -9
- package/dist/declarations/src/actions/ens/fetchEnsResolver.d.ts +0 -9
- package/dist/declarations/src/actions/ens/index.d.ts +0 -4
- package/dist/declarations/src/actions/index.d.ts +0 -6
- package/dist/declarations/src/actions/network-status/fetchBlockNumber.d.ts +0 -5
- package/dist/declarations/src/actions/network-status/fetchFeeData.d.ts +0 -16
- package/dist/declarations/src/actions/network-status/index.d.ts +0 -3
- package/dist/declarations/src/actions/network-status/watchBlockNumber.d.ts +0 -7
- package/dist/declarations/src/actions/providers/getProvider.d.ts +0 -7
- package/dist/declarations/src/actions/providers/getWebSocketProvider.d.ts +0 -7
- package/dist/declarations/src/actions/providers/index.d.ts +0 -4
- package/dist/declarations/src/actions/providers/watchProvider.d.ts +0 -4
- package/dist/declarations/src/actions/providers/watchWebSocketProvider.d.ts +0 -4
- package/dist/declarations/src/actions/transactions/fetchTransaction.d.ts +0 -21
- package/dist/declarations/src/actions/transactions/index.d.ts +0 -4
- package/dist/declarations/src/actions/transactions/prepareSendTransaction.d.ts +0 -37
- package/dist/declarations/src/actions/transactions/sendTransaction.d.ts +0 -48
- package/dist/declarations/src/actions/transactions/waitForTransaction.d.ts +0 -18
- package/dist/declarations/src/chains.d.ts +0 -1
- package/dist/declarations/src/client.d.ts +0 -91
- package/dist/declarations/src/connectors/index.d.ts +0 -2
- package/dist/declarations/src/connectors/mock/connector.d.ts +0 -34
- package/dist/declarations/src/connectors/mock/index.d.ts +0 -2
- package/dist/declarations/src/connectors/mock/provider.d.ts +0 -41
- package/dist/declarations/src/constants/abis.d.ts +0 -941
- package/dist/declarations/src/constants/blockExplorers.d.ts +0 -9
- package/dist/declarations/src/constants/chains.d.ts +0 -64
- package/dist/declarations/src/constants/index.d.ts +0 -7
- package/dist/declarations/src/constants/rpcs.d.ts +0 -11
- package/dist/declarations/src/constants/units.d.ts +0 -1
- package/dist/declarations/src/errors.d.ts +0 -134
- package/dist/declarations/src/index.d.ts +0 -14
- package/dist/declarations/src/internal.d.ts +0 -3
- package/dist/declarations/src/providers/alchemy.d.ts +0 -6
- package/dist/declarations/src/providers/infura.d.ts +0 -6
- package/dist/declarations/src/providers/jsonRpc.d.ts +0 -10
- package/dist/declarations/src/providers/public.d.ts +0 -4
- package/dist/declarations/src/storage.d.ts +0 -12
- package/dist/declarations/src/types/utils.d.ts +0 -103
- package/dist/declarations/src/utils/assertActiveChain.d.ts +0 -5
- package/dist/declarations/src/utils/configureChains.d.ts +0 -26
- package/dist/declarations/src/utils/debounce.d.ts +0 -1
- package/dist/declarations/src/utils/deepEqual.d.ts +0 -2
- package/dist/declarations/src/utils/getInjectedName.d.ts +0 -2
- package/dist/declarations/src/utils/index.d.ts +0 -11
- package/dist/declarations/src/utils/logger.d.ts +0 -1
- package/dist/declarations/src/utils/minimizeContractInterface.d.ts +0 -5
- package/dist/declarations/src/utils/normalizeChainId.d.ts +0 -1
- package/dist/declarations/src/utils/normalizeFunctionName.d.ts +0 -17
- package/dist/declarations/src/utils/parseContractResult.d.ts +0 -7
- package/dist/getProvider-3b1af4e6.cjs.dev.js +0 -1143
- package/dist/getProvider-84f303a1.cjs.prod.js +0 -1143
- package/dist/getProvider-97db849e.esm.js +0 -1105
- package/dist/rpcs-38f4faba.cjs.prod.js +0 -57
- package/dist/rpcs-52ea3d8d.cjs.dev.js +0 -57
- package/dist/rpcs-d533516e.esm.js +0 -51
- package/dist/wagmi-core.cjs.d.ts +0 -1
- package/dist/wagmi-core.cjs.dev.js +0 -2683
- package/dist/wagmi-core.cjs.js +0 -7
- package/dist/wagmi-core.cjs.prod.js +0 -2683
- package/dist/wagmi-core.esm.js +0 -2599
- package/internal/dist/wagmi-core-internal.cjs.d.ts +0 -1
- package/internal/dist/wagmi-core-internal.cjs.dev.js +0 -9
- package/internal/dist/wagmi-core-internal.cjs.js +0 -7
- package/internal/dist/wagmi-core-internal.cjs.prod.js +0 -9
- package/internal/dist/wagmi-core-internal.esm.js +0 -1
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.d.ts +0 -1
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.dev.js +0 -36
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.js +0 -7
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.prod.js +0 -36
- package/providers/alchemy/dist/wagmi-core-providers-alchemy.esm.js +0 -32
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.d.ts +0 -1
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.dev.js +0 -36
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.js +0 -7
- package/providers/infura/dist/wagmi-core-providers-infura.cjs.prod.js +0 -36
- package/providers/infura/dist/wagmi-core-providers-infura.esm.js +0 -32
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.d.ts +0 -1
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.dev.js +0 -46
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.js +0 -7
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.prod.js +0 -46
- package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.esm.js +0 -42
- package/providers/public/dist/wagmi-core-providers-public.cjs.d.ts +0 -1
- package/providers/public/dist/wagmi-core-providers-public.cjs.dev.js +0 -32
- package/providers/public/dist/wagmi-core-providers-public.cjs.js +0 -7
- package/providers/public/dist/wagmi-core-providers-public.cjs.prod.js +0 -32
- package/providers/public/dist/wagmi-core-providers-public.esm.js +0 -28
|
@@ -1,10 +1,114 @@
|
|
|
1
|
-
import { Abi,
|
|
1
|
+
import { Abi, AbiFunction, AbiParametersToPrimitiveTypes, ExtractAbiFunction, Narrow, AbiStateMutability, ExtractAbiFunctionNames, AbiEvent, AbiParameterToPrimitiveType, Address, ResolvedConfig } from 'abitype';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Count occurrences of {@link TType} in {@link TArray}
|
|
6
|
+
*
|
|
7
|
+
* @param TArray - Array to count occurrences in
|
|
8
|
+
* @param TType - Type to count occurrences of
|
|
9
|
+
* @returns Number of occurrences of {@link TType} in {@link TArray}
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* type Result = CountOccurrences<['foo', 'bar', 'foo'], 'foo'>
|
|
13
|
+
*/
|
|
14
|
+
declare type CountOccurrences<TArray extends readonly unknown[], TType> = FilterNever<[
|
|
15
|
+
...{
|
|
16
|
+
[K in keyof TArray]: TArray[K] extends TType ? TArray[K] : never;
|
|
17
|
+
}
|
|
18
|
+
]>['length'];
|
|
19
|
+
/**
|
|
20
|
+
* Removes all occurrences of `never` from {@link TArray}
|
|
21
|
+
*
|
|
22
|
+
* @param TArray - Array to filter
|
|
23
|
+
* @returns Array with `never` removed
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* type Result = FilterNever<[1, 2, never, 3, never, 4]>
|
|
27
|
+
*/
|
|
28
|
+
declare type FilterNever<TArray extends readonly unknown[]> = TArray['length'] extends 0 ? [] : TArray extends [infer THead, ...infer TRest] ? IsNever<THead> extends true ? FilterNever<TRest> : [THead, ...FilterNever<TRest>] : never;
|
|
29
|
+
/**
|
|
30
|
+
* Check if {@link T} is `never`
|
|
31
|
+
*
|
|
32
|
+
* @param T - Type to check
|
|
33
|
+
* @returns `true` if {@link T} is `never`, otherwise `false`
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* type Result = IsNever<'foo'>
|
|
37
|
+
*/
|
|
38
|
+
declare type IsNever<T> = [T] extends [never] ? true : false;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if {@link T} is `unknown`
|
|
41
|
+
*
|
|
42
|
+
* @param T - Type to check
|
|
43
|
+
* @returns `true` if {@link T} is `unknown`, otherwise `false`
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* type Result = IsUnknown<unknown>
|
|
47
|
+
*/
|
|
48
|
+
declare type IsUnknown<T> = unknown extends T ? true : false;
|
|
49
|
+
/**
|
|
50
|
+
* Joins {@link Items} into string separated by {@link Separator}
|
|
51
|
+
*
|
|
52
|
+
* @param Items - Items to join
|
|
53
|
+
* @param Separator - Separator to use
|
|
54
|
+
* @returns Joined string
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* type Result = Join<['foo', 'bar'], '-'>
|
|
58
|
+
*/
|
|
59
|
+
declare type Join<Items extends string[], Separator extends string | number> = Items extends [infer First, ...infer Rest] ? First extends string ? Rest extends string[] ? Rest extends [] ? `${First}` : `${First}${Separator}${Join<Rest, Separator>}` : never : never : '';
|
|
60
|
+
/**
|
|
61
|
+
* Check if {@link T} and {@link U} are equal
|
|
62
|
+
*
|
|
63
|
+
* @param T
|
|
64
|
+
* @param U
|
|
65
|
+
* @returns `true` if {@link T} and {@link U} are not equal, otherwise `false`
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* type Result = NotEqual<'foo', 'bar'>
|
|
69
|
+
*/
|
|
70
|
+
declare type NotEqual<T, U> = [T] extends [U] ? false : true;
|
|
71
|
+
/**
|
|
72
|
+
* Convert {@link TKeys} of {@link TObject} to optional properties
|
|
73
|
+
*
|
|
74
|
+
* @param TObject
|
|
75
|
+
* @param TKeys
|
|
76
|
+
* @returns {@link TObject} with {@link TKeys} converted to optional properties
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* type Result = Optional<{ foo: string; bar: number }, 'foo'>
|
|
80
|
+
*/
|
|
81
|
+
declare type Optional<TObject, TKeys extends keyof TObject> = {
|
|
82
|
+
[K in keyof TObject as K extends TKeys ? never : K]: TObject[K];
|
|
83
|
+
} & {
|
|
84
|
+
[K in keyof TObject as K extends TKeys ? K : never]?: TObject[K];
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Boolean "or" operator
|
|
88
|
+
*
|
|
89
|
+
* @param T
|
|
90
|
+
* @param U
|
|
91
|
+
* @returns `true` if either {@link T} or {@link U} are `true`, otherwise `false`
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* type Result = Or<true, false>
|
|
95
|
+
*/
|
|
96
|
+
declare type Or<T, U> = T extends true ? true : U extends true ? true : false;
|
|
97
|
+
/**
|
|
98
|
+
* Converts {@link Union} to intersection
|
|
99
|
+
*
|
|
100
|
+
* @param Union - Union to convert
|
|
101
|
+
* @returns Intersection of {@link Union}
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* type Result = UnionToIntersection<'foo' | 'bar'>
|
|
105
|
+
*/
|
|
106
|
+
declare type UnionToIntersection<Union> = (Union extends unknown ? (arg: Union) => unknown : never) extends (arg: infer R) => unknown ? R : never;
|
|
107
|
+
|
|
4
108
|
/**
|
|
5
109
|
* Configuration options for contract types
|
|
6
110
|
*/
|
|
7
|
-
|
|
111
|
+
declare type Options = {
|
|
8
112
|
/** Flag for making `abi` optional */
|
|
9
113
|
isAbiOptional?: boolean;
|
|
10
114
|
/** Flag for making `address` optional */
|
|
@@ -17,7 +121,7 @@ export declare type Options = {
|
|
|
17
121
|
/**
|
|
18
122
|
* Default {@link Options}
|
|
19
123
|
*/
|
|
20
|
-
|
|
124
|
+
declare type DefaultOptions = {
|
|
21
125
|
isAbiOptional: false;
|
|
22
126
|
isAddressOptional: false;
|
|
23
127
|
isArgsOptional: false;
|
|
@@ -34,7 +138,7 @@ export declare type DefaultOptions = {
|
|
|
34
138
|
* @example
|
|
35
139
|
* type Result = GetArgs<[…], 'tokenURI'>
|
|
36
140
|
*/
|
|
37
|
-
|
|
141
|
+
declare type GetArgs<TAbi extends Abi | readonly unknown[], TFunction extends AbiFunction & {
|
|
38
142
|
type: 'function';
|
|
39
143
|
}, TOptions extends Options = DefaultOptions> = TFunction['inputs'] extends infer TInputs extends readonly AbiParameter[] ? Or<IsNever<TInputs>, NotEqual<TAbi, Abi>> extends true ? {
|
|
40
144
|
/**
|
|
@@ -55,7 +159,7 @@ export declare type GetArgs<TAbi extends Abi | readonly unknown[], TFunction ext
|
|
|
55
159
|
/**
|
|
56
160
|
* Contract configuration object for inferring function name and arguments based on {@link TAbi}.
|
|
57
161
|
*/
|
|
58
|
-
|
|
162
|
+
declare type ContractConfig<TContract = {
|
|
59
163
|
[key: string]: unknown;
|
|
60
164
|
}, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TFunction extends AbiFunction & {
|
|
61
165
|
type: 'function';
|
|
@@ -90,7 +194,7 @@ declare type OmitConfigProperties = 'abi' | 'args' | 'functionName';
|
|
|
90
194
|
* @example
|
|
91
195
|
* type Result = GetConfig<{ abi: […], functionName: 'tokenURI' }, 'view'>
|
|
92
196
|
*/
|
|
93
|
-
|
|
197
|
+
declare type GetConfig<TContract = unknown, TAbiStateMutibility extends AbiStateMutability = AbiStateMutability, TOptions extends Options = DefaultOptions> = TContract extends {
|
|
94
198
|
abi: infer TAbi extends Abi;
|
|
95
199
|
functionName: infer TFunctionName extends string;
|
|
96
200
|
} ? ContractConfig<Omit<TContract, OmitConfigProperties>, TAbi, ExtractAbiFunctionNames<TAbi, TAbiStateMutibility>, ExtractAbiFunction<TAbi, TFunctionName>, TOptions> : TContract extends {
|
|
@@ -128,7 +232,7 @@ declare type GetResult<TAbi extends Abi | readonly unknown[] = Abi, TFunctionNam
|
|
|
128
232
|
* @example
|
|
129
233
|
* type Result = GetReturnType<{ abi: […], functionName: 'tokenURI' }>
|
|
130
234
|
*/
|
|
131
|
-
|
|
235
|
+
declare type GetReturnType<TContract = unknown> = TContract extends {
|
|
132
236
|
abi: infer TAbi extends Abi;
|
|
133
237
|
functionName: infer TFunctionName extends string;
|
|
134
238
|
} ? GetResult<TAbi, TFunctionName, ExtractAbiFunction<TAbi, TFunctionName>> : TContract extends {
|
|
@@ -142,7 +246,7 @@ declare type MAXIMUM_DEPTH = 20;
|
|
|
142
246
|
* @param TContracts - Array of contracts in shape of {@link ContractConfig}
|
|
143
247
|
* @returns Array of inferred contract configurations
|
|
144
248
|
*/
|
|
145
|
-
|
|
249
|
+
declare type ContractsConfig<TContracts extends unknown[], TContractProperties extends {
|
|
146
250
|
[key: string]: unknown;
|
|
147
251
|
} = {
|
|
148
252
|
[key: string]: unknown;
|
|
@@ -164,7 +268,7 @@ export declare type ContractsConfig<TContracts extends unknown[], TContractPrope
|
|
|
164
268
|
* @param TContracts - Array of contracts in shape of {@link ContractConfig}
|
|
165
269
|
* @returns Array of inferred contract results
|
|
166
270
|
*/
|
|
167
|
-
|
|
271
|
+
declare type ContractsResult<TContracts extends unknown[], Result extends any[] = [], Depth extends ReadonlyArray<number> = []> = Depth['length'] extends MAXIMUM_DEPTH ? GetReturnType[] : TContracts extends [] ? [] : TContracts extends [infer Head] ? [...Result, GetReturnType<Head>] : TContracts extends [infer Head, ...infer Tail] ? ContractsResult<[...Tail], [...Result, GetReturnType<Head>], [...Depth, 1]> : TContracts extends ContractConfig<infer _TContract, infer TAbi, infer TFunctionName>[] ? GetReturnType<{
|
|
168
272
|
abi: TAbi;
|
|
169
273
|
functionName: TFunctionName;
|
|
170
274
|
}>[] : GetReturnType[];
|
|
@@ -178,7 +282,7 @@ export declare type ContractsResult<TContracts extends unknown[], Result extends
|
|
|
178
282
|
* @example
|
|
179
283
|
* type Result = AbiItemName<{ type: 'function'; name: 'Foo'; … }>
|
|
180
284
|
*/
|
|
181
|
-
|
|
285
|
+
declare type AbiItemName<TAbiItem extends (AbiFunction & {
|
|
182
286
|
type: 'function';
|
|
183
287
|
}) | AbiEvent, IsSignature extends boolean = false> = IsSignature extends true ? TAbiItem['inputs'] extends infer TAbiParameters extends readonly AbiParameter[] ? `${TAbiItem['name']}(${Join<[
|
|
184
288
|
...{
|
|
@@ -194,7 +298,7 @@ export declare type AbiItemName<TAbiItem extends (AbiFunction & {
|
|
|
194
298
|
* @example
|
|
195
299
|
* type Result = GetOverridesForAbiStateMutability<'pure'>
|
|
196
300
|
*/
|
|
197
|
-
|
|
301
|
+
declare type GetOverridesForAbiStateMutability<TAbiStateMutability extends AbiStateMutability> = {
|
|
198
302
|
nonpayable: Overrides & {
|
|
199
303
|
from?: Address;
|
|
200
304
|
};
|
|
@@ -204,23 +308,24 @@ export declare type GetOverridesForAbiStateMutability<TAbiStateMutability extend
|
|
|
204
308
|
pure: CallOverrides;
|
|
205
309
|
view: CallOverrides;
|
|
206
310
|
}[TAbiStateMutability];
|
|
207
|
-
|
|
311
|
+
interface Overrides extends ethers.Overrides {
|
|
208
312
|
gasLimit?: ResolvedConfig['BigIntType'];
|
|
209
313
|
gasPrice?: ResolvedConfig['BigIntType'];
|
|
210
314
|
maxFeePerGas?: ResolvedConfig['BigIntType'];
|
|
211
315
|
maxPriorityFeePerGas?: ResolvedConfig['BigIntType'];
|
|
212
316
|
nonce?: ResolvedConfig['IntType'];
|
|
213
317
|
}
|
|
214
|
-
|
|
318
|
+
interface PayableOverrides extends Overrides {
|
|
215
319
|
value?: ResolvedConfig['IntType'] | ResolvedConfig['BigIntType'];
|
|
216
320
|
}
|
|
217
|
-
|
|
321
|
+
interface CallOverrides extends PayableOverrides {
|
|
218
322
|
blockTag?: ethers.CallOverrides['blockTag'];
|
|
219
323
|
from?: Address;
|
|
220
324
|
}
|
|
221
|
-
|
|
325
|
+
declare type Event<TAbiEvent extends AbiEvent> = Omit<ethers.Event, 'args' | 'event' | 'eventSignature'> & {
|
|
222
326
|
args: AbiParametersToPrimitiveTypes<TAbiEvent['inputs']>;
|
|
223
327
|
event: TAbiEvent['name'];
|
|
224
328
|
eventSignature: AbiItemName<TAbiEvent, true>;
|
|
225
329
|
};
|
|
226
|
-
|
|
330
|
+
|
|
331
|
+
export { AbiItemName as A, CountOccurrences as C, DefaultOptions as D, Event as E, GetConfig as G, IsUnknown as I, NotEqual as N, Options as O, UnionToIntersection as U, GetOverridesForAbiStateMutability as a, ContractsConfig as b, ContractsResult as c, GetReturnType as d, Or as e, IsNever as f, ContractConfig as g, GetArgs as h, Optional as i };
|
|
@@ -1,13 +1,80 @@
|
|
|
1
|
-
import { Address,
|
|
2
|
-
import { Signer as
|
|
3
|
-
|
|
1
|
+
import { Address, TypedData, TypedDataToPrimitiveTypes, TypedDataDomain, ResolvedConfig } from 'abitype';
|
|
2
|
+
import { BigNumber, providers, Signer as Signer$1 } from 'ethers';
|
|
3
|
+
|
|
4
|
+
declare const chainId: {
|
|
5
|
+
readonly mainnet: 1;
|
|
6
|
+
readonly goerli: 5;
|
|
7
|
+
readonly sepolia: 11155111;
|
|
8
|
+
readonly optimism: 10;
|
|
9
|
+
readonly optimismGoerli: 420;
|
|
10
|
+
readonly polygon: 137;
|
|
11
|
+
readonly polygonMumbai: 80001;
|
|
12
|
+
readonly arbitrum: 42161;
|
|
13
|
+
readonly arbitrumGoerli: 421613;
|
|
14
|
+
readonly localhost: 1337;
|
|
15
|
+
readonly hardhat: 31337;
|
|
16
|
+
readonly foundry: 31337;
|
|
17
|
+
};
|
|
18
|
+
declare type ChainName = keyof typeof chainId;
|
|
19
|
+
declare const mainnet: Chain;
|
|
20
|
+
declare const goerli: Chain;
|
|
21
|
+
declare const sepolia: Chain;
|
|
22
|
+
declare const optimism: Chain;
|
|
23
|
+
declare const optimismGoerli: Chain;
|
|
24
|
+
declare const polygon: Chain;
|
|
25
|
+
declare const polygonMumbai: Chain;
|
|
26
|
+
declare const arbitrum: Chain;
|
|
27
|
+
declare const arbitrumGoerli: Chain;
|
|
28
|
+
declare const localhost: Chain;
|
|
29
|
+
declare const hardhat: Chain;
|
|
30
|
+
declare const foundry: Chain;
|
|
31
|
+
/**
|
|
32
|
+
* Common chains for convenience
|
|
33
|
+
* Should not contain all possible chains
|
|
34
|
+
*/
|
|
35
|
+
declare const chain: {
|
|
36
|
+
readonly mainnet: Chain;
|
|
37
|
+
readonly goerli: Chain;
|
|
38
|
+
readonly sepolia: Chain;
|
|
39
|
+
readonly optimism: Chain;
|
|
40
|
+
readonly optimismGoerli: Chain;
|
|
41
|
+
readonly polygon: Chain;
|
|
42
|
+
readonly polygonMumbai: Chain;
|
|
43
|
+
readonly arbitrum: Chain;
|
|
44
|
+
readonly arbitrumGoerli: Chain;
|
|
45
|
+
readonly localhost: Chain;
|
|
46
|
+
readonly hardhat: Chain;
|
|
47
|
+
readonly foundry: Chain;
|
|
48
|
+
};
|
|
49
|
+
declare const allChains: Chain[];
|
|
50
|
+
declare const defaultChains: Chain[];
|
|
51
|
+
declare const defaultL2Chains: Chain[];
|
|
52
|
+
|
|
53
|
+
declare type BlockExplorerName = 'etherscan';
|
|
54
|
+
declare type BlockExplorer = {
|
|
55
|
+
name: string;
|
|
56
|
+
url: string;
|
|
57
|
+
};
|
|
58
|
+
declare type EtherscanChains = Extract<ChainName, 'mainnet' | 'goerli' | 'sepolia' | 'optimism' | 'optimismGoerli' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumGoerli'>;
|
|
59
|
+
declare const etherscanBlockExplorers: Record<EtherscanChains, BlockExplorer>;
|
|
60
|
+
|
|
61
|
+
declare type RpcProviderName = 'alchemy' | 'infura' | 'public';
|
|
62
|
+
declare type AlchemyChains = Extract<ChainName, 'mainnet' | 'goerli' | 'optimism' | 'optimismGoerli' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumGoerli'>;
|
|
63
|
+
declare const alchemyRpcUrls: Record<AlchemyChains, string>;
|
|
64
|
+
declare type InfuraChains = Extract<ChainName, 'mainnet' | 'goerli' | 'sepolia' | 'optimism' | 'optimismGoerli' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumGoerli'>;
|
|
65
|
+
declare const infuraRpcUrls: Record<InfuraChains, string>;
|
|
66
|
+
declare type PublicChains = Extract<ChainName, 'mainnet' | 'goerli' | 'sepolia' | 'optimism' | 'optimismGoerli' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumGoerli'>;
|
|
67
|
+
declare const publicRpcUrls: Record<PublicChains, string>;
|
|
68
|
+
|
|
69
|
+
declare const units: readonly ["wei", "kwei", "mwei", "gwei", "szabo", "finney", "ether"];
|
|
70
|
+
|
|
4
71
|
declare module 'abitype' {
|
|
5
72
|
interface Config {
|
|
6
73
|
BigIntType: BigNumber;
|
|
7
74
|
IntType: number;
|
|
8
75
|
}
|
|
9
76
|
}
|
|
10
|
-
declare module 'ethers/lib/utils' {
|
|
77
|
+
declare module 'ethers/lib/utils.js' {
|
|
11
78
|
function getAddress(address: string): Address;
|
|
12
79
|
function isAddress(address: string): address is Address;
|
|
13
80
|
function verifyTypedData<TTypedData extends TypedData, TSchema extends TypedDataToPrimitiveTypes<TTypedData>>(domain: TypedDataDomain, types: TTypedData, value: TSchema[keyof TSchema] extends infer TValue ? {
|
|
@@ -20,8 +87,8 @@ declare module 'ethers/lib/utils' {
|
|
|
20
87
|
v?: number;
|
|
21
88
|
} | ResolvedConfig['BytesType'] | string): string;
|
|
22
89
|
}
|
|
23
|
-
|
|
24
|
-
|
|
90
|
+
declare type Hash = `0x${string}`;
|
|
91
|
+
declare type Chain = {
|
|
25
92
|
/** ID in number form */
|
|
26
93
|
id: number;
|
|
27
94
|
/** Human-readable name */
|
|
@@ -58,21 +125,21 @@ export declare type Chain = {
|
|
|
58
125
|
/** Flag for test networks */
|
|
59
126
|
testnet?: boolean;
|
|
60
127
|
};
|
|
61
|
-
|
|
128
|
+
declare type ChainProviderFn<TProvider extends Provider = providers.BaseProvider, TWebSocketProvider extends WebSocketProvider = providers.WebSocketProvider, TChain extends Chain = Chain> = (chain: TChain) => {
|
|
62
129
|
chain: TChain;
|
|
63
130
|
provider: () => ProviderWithFallbackConfig<TProvider>;
|
|
64
131
|
webSocketProvider?: () => TWebSocketProvider;
|
|
65
132
|
} | null;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
133
|
+
declare type FallbackProviderConfig = Omit<providers.FallbackProviderConfig, 'provider'>;
|
|
134
|
+
declare type ProviderWithFallbackConfig<TProvider extends Provider = Provider> = TProvider & FallbackProviderConfig;
|
|
135
|
+
declare type Provider = providers.BaseProvider & {
|
|
69
136
|
chains?: Chain[];
|
|
70
137
|
};
|
|
71
|
-
|
|
138
|
+
declare type WebSocketProvider = providers.WebSocketProvider & {
|
|
72
139
|
chains?: Chain[];
|
|
73
140
|
};
|
|
74
|
-
|
|
75
|
-
|
|
141
|
+
declare type Signer = Signer$1;
|
|
142
|
+
declare type Unit = typeof units[number];
|
|
76
143
|
declare type AddEthereumChainParameter = {
|
|
77
144
|
/** A 0x-prefixed hexadecimal string */
|
|
78
145
|
chainId: string;
|
|
@@ -148,7 +215,7 @@ declare type InjectedProviders = InjectedProviderFlags & {
|
|
|
148
215
|
isUnlocked?: boolean;
|
|
149
216
|
};
|
|
150
217
|
};
|
|
151
|
-
|
|
218
|
+
interface Ethereum extends InjectedProviders {
|
|
152
219
|
on?: (...args: any[]) => void;
|
|
153
220
|
removeListener?: (...args: any[]) => void;
|
|
154
221
|
providers?: Ethereum[];
|
|
@@ -217,4 +284,5 @@ declare global {
|
|
|
217
284
|
ethereum?: Ethereum;
|
|
218
285
|
}
|
|
219
286
|
}
|
|
220
|
-
|
|
287
|
+
|
|
288
|
+
export { Chain as C, Ethereum as E, FallbackProviderConfig as F, Hash as H, Provider as P, Signer as S, Unit as U, WebSocketProvider as W, ChainProviderFn as a, ProviderWithFallbackConfig as b, alchemyRpcUrls as c, allChains as d, chain as e, chainId as f, defaultChains as g, defaultL2Chains as h, etherscanBlockExplorers as i, infuraRpcUrls as j, arbitrum as k, arbitrumGoerli as l, foundry as m, goerli as n, hardhat as o, publicRpcUrls as p, localhost as q, mainnet as r, sepolia as s, optimism as t, units as u, optimismGoerli as v, polygon as w, polygonMumbai as x };
|