@wagmi/core 0.8.7 → 0.8.9-cjs

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.
Files changed (37) hide show
  1. package/dist/chains.js +59 -59
  2. package/dist/chunk-7J7OLO4T.js +60 -60
  3. package/dist/chunk-BVC4KGLQ.js +8 -8
  4. package/dist/chunk-EQOEZP46.js +5 -5
  5. package/dist/chunk-KFW652VN.js +6 -6
  6. package/dist/chunk-KX4UEHS5.js +1 -0
  7. package/dist/chunk-MQXBDTVK.js +7 -7
  8. package/dist/{chunk-VR4LK7Q2.js → chunk-VRBYTA34.js} +250 -247
  9. package/dist/connectors/coinbaseWallet.js +5 -5
  10. package/dist/connectors/index.js +9 -9
  11. package/dist/connectors/injected.js +7 -7
  12. package/dist/connectors/ledger.js +5 -5
  13. package/dist/connectors/metaMask.js +5 -5
  14. package/dist/connectors/mock.js +9 -9
  15. package/dist/connectors/walletConnect.js +5 -5
  16. package/dist/contracts-9eb7706c.d.ts +199 -0
  17. package/dist/index.d.ts +75 -91
  18. package/dist/index.js +164 -164
  19. package/dist/internal/index.d.ts +1 -1
  20. package/dist/internal/index.js +8 -8
  21. package/dist/internal/test.js +25 -25
  22. package/dist/providers/alchemy.js +11 -11
  23. package/dist/providers/infura.js +11 -11
  24. package/dist/providers/jsonRpc.js +8 -8
  25. package/dist/providers/public.js +7 -7
  26. package/internal/dist/wagmi-core-internal.cjs.d.ts +11 -0
  27. package/internal/dist/wagmi-core-internal.cjs.js +16 -0
  28. package/package.json +4 -5
  29. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.d.ts +11 -0
  30. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.js +16 -0
  31. package/providers/infura/dist/wagmi-core-providers-infura.cjs.d.ts +11 -0
  32. package/providers/infura/dist/wagmi-core-providers-infura.cjs.js +16 -0
  33. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.d.ts +11 -0
  34. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.js +16 -0
  35. package/providers/public/dist/wagmi-core-providers-public.cjs.d.ts +11 -0
  36. package/providers/public/dist/wagmi-core-providers-public.cjs.js +16 -0
  37. package/dist/contracts-3880ee54.d.ts +0 -334
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // this file might look strange and you might be wondering what it's for
3
+ // it's lets you import your source files by importing this entrypoint
4
+ // as you would import it if it was built with preconstruct build
5
+ // this file is slightly different to some others though
6
+ // it has a require hook which compiles your code with Babel
7
+ // this means that you don't have to set up @babel/register or anything like that
8
+ // but you can still require this module and it'll be compiled
9
+
10
+ // this bit of code imports the require hook and registers it
11
+ let unregister = require("../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../..", "../..");
12
+
13
+ // this re-exports the source file
14
+ module.exports = require("../../src/internal.ts");
15
+
16
+ unregister();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wagmi/core",
3
3
  "description": "Vanilla JS library for Ethereum",
4
4
  "license": "MIT",
5
- "version": "0.8.7",
5
+ "version": "0.8.9-cjs",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/wagmi-dev/wagmi.git",
@@ -23,7 +23,6 @@
23
23
  "url": "https://github.com/sponsors/wagmi-dev"
24
24
  }
25
25
  ],
26
- "type": "module",
27
26
  "main": "dist/index.js",
28
27
  "types": "dist/index.d.ts",
29
28
  "exports": {
@@ -111,11 +110,11 @@
111
110
  }
112
111
  },
113
112
  "dependencies": {
113
+ "@wagmi/chains": "^0.1.7-cjs",
114
+ "@wagmi/connectors": "^0.1.3-cjs",
114
115
  "abitype": "^0.2.5",
115
116
  "eventemitter3": "^4.0.7",
116
- "zustand": "^4.1.4",
117
- "@wagmi/chains": "0.1.7",
118
- "@wagmi/connectors": "0.1.3"
117
+ "zustand": "^4.1.4"
119
118
  },
120
119
  "devDependencies": {
121
120
  "@coinbase/wallet-sdk": "^3.6.0",
@@ -0,0 +1,11 @@
1
+ // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
+ // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
+
4
+ // curious why you need to?
5
+ // this file exists so that you can import from the entrypoint normally
6
+ // except that it points to your source file and you don't need to run build constantly
7
+ // which means we need to re-export all of the modules from your source file
8
+ // and since export * doesn't include default exports, we need to read your source file
9
+ // to check for a default export and re-export it if it exists
10
+ // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
+ export * from "../../../src/providers/alchemy";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // this file might look strange and you might be wondering what it's for
3
+ // it's lets you import your source files by importing this entrypoint
4
+ // as you would import it if it was built with preconstruct build
5
+ // this file is slightly different to some others though
6
+ // it has a require hook which compiles your code with Babel
7
+ // this means that you don't have to set up @babel/register or anything like that
8
+ // but you can still require this module and it'll be compiled
9
+
10
+ // this bit of code imports the require hook and registers it
11
+ let unregister = require("../../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../../..", "../../..");
12
+
13
+ // this re-exports the source file
14
+ module.exports = require("../../../src/providers/alchemy.ts");
15
+
16
+ unregister();
@@ -0,0 +1,11 @@
1
+ // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
+ // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
+
4
+ // curious why you need to?
5
+ // this file exists so that you can import from the entrypoint normally
6
+ // except that it points to your source file and you don't need to run build constantly
7
+ // which means we need to re-export all of the modules from your source file
8
+ // and since export * doesn't include default exports, we need to read your source file
9
+ // to check for a default export and re-export it if it exists
10
+ // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
+ export * from "../../../src/providers/infura";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // this file might look strange and you might be wondering what it's for
3
+ // it's lets you import your source files by importing this entrypoint
4
+ // as you would import it if it was built with preconstruct build
5
+ // this file is slightly different to some others though
6
+ // it has a require hook which compiles your code with Babel
7
+ // this means that you don't have to set up @babel/register or anything like that
8
+ // but you can still require this module and it'll be compiled
9
+
10
+ // this bit of code imports the require hook and registers it
11
+ let unregister = require("../../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../../..", "../../..");
12
+
13
+ // this re-exports the source file
14
+ module.exports = require("../../../src/providers/infura.ts");
15
+
16
+ unregister();
@@ -0,0 +1,11 @@
1
+ // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
+ // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
+
4
+ // curious why you need to?
5
+ // this file exists so that you can import from the entrypoint normally
6
+ // except that it points to your source file and you don't need to run build constantly
7
+ // which means we need to re-export all of the modules from your source file
8
+ // and since export * doesn't include default exports, we need to read your source file
9
+ // to check for a default export and re-export it if it exists
10
+ // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
+ export * from "../../../src/providers/jsonRpc";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // this file might look strange and you might be wondering what it's for
3
+ // it's lets you import your source files by importing this entrypoint
4
+ // as you would import it if it was built with preconstruct build
5
+ // this file is slightly different to some others though
6
+ // it has a require hook which compiles your code with Babel
7
+ // this means that you don't have to set up @babel/register or anything like that
8
+ // but you can still require this module and it'll be compiled
9
+
10
+ // this bit of code imports the require hook and registers it
11
+ let unregister = require("../../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../../..", "../../..");
12
+
13
+ // this re-exports the source file
14
+ module.exports = require("../../../src/providers/jsonRpc.ts");
15
+
16
+ unregister();
@@ -0,0 +1,11 @@
1
+ // are you seeing an error that a default export doesn't exist but your source file has a default export?
2
+ // you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook
3
+
4
+ // curious why you need to?
5
+ // this file exists so that you can import from the entrypoint normally
6
+ // except that it points to your source file and you don't need to run build constantly
7
+ // which means we need to re-export all of the modules from your source file
8
+ // and since export * doesn't include default exports, we need to read your source file
9
+ // to check for a default export and re-export it if it exists
10
+ // it's not ideal, but it works pretty well ¯\_(ツ)_/¯
11
+ export * from "../../../src/providers/public";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // this file might look strange and you might be wondering what it's for
3
+ // it's lets you import your source files by importing this entrypoint
4
+ // as you would import it if it was built with preconstruct build
5
+ // this file is slightly different to some others though
6
+ // it has a require hook which compiles your code with Babel
7
+ // this means that you don't have to set up @babel/register or anything like that
8
+ // but you can still require this module and it'll be compiled
9
+
10
+ // this bit of code imports the require hook and registers it
11
+ let unregister = require("../../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../../..", "../../..");
12
+
13
+ // this re-exports the source file
14
+ module.exports = require("../../../src/providers/public.ts");
15
+
16
+ unregister();
@@ -1,334 +0,0 @@
1
- import { AbiParameter as AbiParameter$1, Abi, AbiFunction, AbiParametersToPrimitiveTypes, ExtractAbiFunction, Narrow, AbiStateMutability, ExtractAbiFunctionNames, AbiEvent, AbiParameterToPrimitiveType, Address, ResolvedConfig } from 'abitype';
2
- import { ethers } from 'ethers';
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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- type UnionToIntersection<Union> = (Union extends unknown ? (arg: Union) => unknown : never) extends (arg: infer R) => unknown ? R : never;
107
-
108
- type AbiParameter = AbiParameter$1;
109
- /**
110
- * Configuration options for contract types
111
- */
112
- type Options = {
113
- /** Flag for making `abi` optional */
114
- isAbiOptional?: boolean;
115
- /** Flag for making `address` optional */
116
- isAddressOptional?: boolean;
117
- /** Flag for making `args` optional */
118
- isArgsOptional?: boolean;
119
- /** Flag for making `functionName` optional */
120
- isFunctionNameOptional?: boolean;
121
- };
122
- /**
123
- * Default {@link Options}
124
- */
125
- type DefaultOptions = {
126
- isAbiOptional: false;
127
- isAddressOptional: false;
128
- isArgsOptional: false;
129
- isFunctionNameOptional: false;
130
- };
131
- /**
132
- * Gets arguments of contract function
133
- *
134
- * @param TAbi - Contract {@link Abi}
135
- * @param TFunctionName - Name of contract function
136
- * @param TOptions - Options for configuring arguments. Defaults to {@link DefaultOptions}.
137
- * @returns Inferred args of contract function
138
- *
139
- * @example
140
- * type Result = GetArgs<[…], 'tokenURI'>
141
- */
142
- type GetArgs<TAbi extends Abi | readonly unknown[], TFunction extends AbiFunction & {
143
- type: 'function';
144
- }, TOptions extends Options = DefaultOptions> = TFunction['inputs'] extends infer TInputs extends readonly AbiParameter[] ? Or<IsNever<TInputs>, NotEqual<TAbi, Abi>> extends true ? {
145
- /**
146
- * Arguments to pass contract method
147
- *
148
- * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link abi} for type inference.
149
- */
150
- args?: readonly unknown[];
151
- } : TInputs['length'] extends 0 ? {
152
- args?: never;
153
- } : AbiParametersToPrimitiveTypes<TInputs> extends infer TArgs ? TOptions['isArgsOptional'] extends true ? {
154
- /** Arguments to pass contract method */
155
- args?: TArgs;
156
- } : {
157
- /** Arguments to pass contract method */
158
- args: TArgs;
159
- } : never : never;
160
- /**
161
- * Contract configuration object for inferring function name and arguments based on {@link TAbi}.
162
- */
163
- type ContractConfig<TContract = {
164
- [key: string]: unknown;
165
- }, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TFunction extends AbiFunction & {
166
- type: 'function';
167
- } = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : never, TOptions extends Options = DefaultOptions> = (TOptions['isAbiOptional'] extends true ? {
168
- /** Contract ABI */
169
- abi?: Narrow<TAbi>;
170
- } : {
171
- /** Contract ABI */
172
- abi: Narrow<TAbi>;
173
- }) & (TOptions['isAddressOptional'] extends true ? {
174
- /** Contract address */
175
- address?: string;
176
- } : {
177
- /** Contract address */
178
- address: string;
179
- }) & (TOptions['isFunctionNameOptional'] extends true ? {
180
- /** Function to invoke on the contract */
181
- functionName?: IsNever<TFunctionName> extends true ? string : TFunctionName;
182
- } : {
183
- /** Function to invoke on the contract */
184
- functionName: IsNever<TFunctionName> extends true ? string : TFunctionName;
185
- }) & GetArgs<TAbi, TFunction, TOptions> & TContract;
186
- type OmitConfigProperties = 'abi' | 'args' | 'functionName';
187
- /**
188
- * Gets configuration type of contract function
189
- *
190
- * @param TContract - Contract config in `{ abi: Abi, functionName: string }` format
191
- * @param TAbiStateMutibility - State mutability of contract function
192
- * @param TOptions - Options for configuring arguments. Defaults to {@link DefaultOptions}.
193
- * @returns Inferred configuration type of contract function
194
- *
195
- * @example
196
- * type Result = GetConfig<{ abi: […], functionName: 'tokenURI' }, 'view'>
197
- */
198
- type GetConfig<TContract = unknown, TAbiStateMutibility extends AbiStateMutability = AbiStateMutability, TOptions extends Options = DefaultOptions> = TContract extends {
199
- abi: infer TAbi extends Abi;
200
- functionName: infer TFunctionName extends string;
201
- } ? ContractConfig<Omit<TContract, OmitConfigProperties>, TAbi, ExtractAbiFunctionNames<TAbi, TAbiStateMutibility>, ExtractAbiFunction<TAbi, TFunctionName>, TOptions> : TContract extends {
202
- abi: infer TAbi extends readonly unknown[];
203
- functionName: infer TFunctionName extends string;
204
- } ? ContractConfig<Omit<TContract, OmitConfigProperties>, TAbi, TFunctionName, never, TOptions> : ContractConfig<Omit<TContract, OmitConfigProperties>, Abi, string, never, TOptions>;
205
- /**
206
- * Unwraps return type of contract function
207
- *
208
- * @param TAbi - Contract {@link Abi}
209
- * @param TFunctionName - Name of contract function
210
- * @returns Inferred return type of contract function
211
- *
212
- * @example
213
- * type Result = GetResult<[…], 'tokenURI'>
214
- */
215
- type GetResult<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TFunction extends AbiFunction & {
216
- type: 'function';
217
- } = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : never> = TFunction['outputs'] extends infer TOutputs extends readonly AbiParameter[] ? Or<IsNever<TOutputs>, NotEqual<TAbi, Abi>> extends true ? unknown : TOutputs['length'] extends infer TLength ? TLength extends 0 ? void : TLength extends 1 ? AbiParameterToPrimitiveType<TOutputs[0]> : TOutputs extends readonly [...infer _] ? /**
218
- * Return output as array assigned to an object with named keys
219
- *
220
- * | Outputs | Result |
221
- * | --------------------------------------------------------------------- | ---------------------------------------------------------- |
222
- * | `[{ name: 'foo', type: 'uint256' }, { name: 'bar', type: 'string' }]` | `readonly [bigint, string] & { foo: bigint; bar: string }` |
223
- * | `[{ name: 'foo', type: 'uint256' }, { name: '', type: 'string' }]` | `readonly [bigint, string] & { foo: bigint }` |
224
- */ {
225
- [Output in TOutputs[number] as Output extends {
226
- name: string;
227
- } ? Output['name'] extends '' ? never : Output['name'] : never]: AbiParameterToPrimitiveType<Output>;
228
- } & AbiParametersToPrimitiveTypes<TOutputs> : unknown : never : never;
229
- /**
230
- * Gets return type of contract function
231
- *
232
- * @param TContract - Contract config in `{ abi: Abi, functionName: string }` format
233
- * @returns Inferred return type of contract function
234
- *
235
- * @example
236
- * type Result = GetReturnType<{ abi: […], functionName: 'tokenURI' }>
237
- */
238
- type GetReturnType<TContract = unknown> = TContract extends {
239
- abi: infer TAbi extends Abi;
240
- functionName: infer TFunctionName extends string;
241
- } ? GetResult<TAbi, TFunctionName, ExtractAbiFunction<TAbi, TFunctionName>> : TContract extends {
242
- abi: infer TAbi extends readonly unknown[];
243
- functionName: infer TFunctionName extends string;
244
- } ? GetResult<TAbi, TFunctionName> : GetResult;
245
- type MAXIMUM_DEPTH = 20;
246
- /**
247
- * ContractsConfig reducer recursively unwraps function arguments to infer/enforce type param
248
- *
249
- * @param TContracts - Array of contracts in shape of {@link ContractConfig}
250
- * @returns Array of inferred contract configurations
251
- */
252
- type ContractsConfig<TContracts extends unknown[], TContractProperties extends {
253
- [key: string]: unknown;
254
- } = {
255
- [key: string]: unknown;
256
- }, TOptions extends Options = DefaultOptions, Result extends any[] = [], Depth extends ReadonlyArray<number> = []> = Depth['length'] extends MAXIMUM_DEPTH ? GetConfig<TContractProperties, 'pure' | 'view', TOptions>[] : TContracts extends [] ? [] : TContracts extends [infer Head] ? [
257
- ...Result,
258
- GetConfig<Head & TContractProperties, 'pure' | 'view', TOptions>
259
- ] : TContracts extends [infer Head, ...infer Tail] ? ContractsConfig<[
260
- ...Tail
261
- ], TContractProperties, TOptions, [
262
- ...Result,
263
- GetConfig<Head & TContractProperties, 'pure' | 'view', TOptions>
264
- ], [
265
- ...Depth,
266
- 1
267
- ]> : unknown[] extends TContracts ? TContracts : TContracts extends ContractConfig<infer TContract, infer TAbi, infer TFunctionName, infer TFunction>[] ? ContractConfig<Omit<TContract & TContractProperties, OmitConfigProperties>, TAbi, TFunctionName, TFunction, TOptions>[] : GetConfig<TContractProperties, 'pure' | 'view', TOptions>[];
268
- /**
269
- * ContractsResult reducer recursively maps type param to results
270
- *
271
- * @param TContracts - Array of contracts in shape of {@link ContractConfig}
272
- * @returns Array of inferred contract results
273
- */
274
- 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<{
275
- abi: TAbi;
276
- functionName: TFunctionName;
277
- }>[] : GetReturnType[];
278
- /**
279
- * Get name for {@link AbiFunction} or {@link AbiEvent}
280
- *
281
- * @param TAbiItem - {@link AbiFunction} or {@link AbiEvent}
282
- * @param IsSignature - Whether to return the signature instead of the name
283
- * @returns Name or signature of function or event
284
- *
285
- * @example
286
- * type Result = AbiItemName<{ type: 'function'; name: 'Foo'; … }>
287
- */
288
- type AbiItemName<TAbiItem extends (AbiFunction & {
289
- type: 'function';
290
- }) | AbiEvent, IsSignature extends boolean = false> = IsSignature extends true ? TAbiItem['inputs'] extends infer TAbiParameters extends readonly AbiParameter[] ? `${TAbiItem['name']}(${Join<[
291
- ...{
292
- [K in keyof TAbiParameters]: TAbiParameters[K]['type'];
293
- }
294
- ], ','>})` : never : TAbiItem['name'];
295
- /**
296
- * Get overrides for {@link AbiStateMutability}
297
- *
298
- * @param TAbiStateMutability - {@link AbiStateMutability}
299
- * @returns Overrides for {@link TAbiStateMutability}
300
- *
301
- * @example
302
- * type Result = GetOverridesForAbiStateMutability<'pure'>
303
- */
304
- type GetOverridesForAbiStateMutability<TAbiStateMutability extends AbiStateMutability> = {
305
- nonpayable: Overrides & {
306
- from?: Address;
307
- };
308
- payable: PayableOverrides & {
309
- from?: Address;
310
- };
311
- pure: CallOverrides;
312
- view: CallOverrides;
313
- }[TAbiStateMutability];
314
- interface Overrides extends ethers.Overrides {
315
- gasLimit?: ResolvedConfig['BigIntType'];
316
- gasPrice?: ResolvedConfig['BigIntType'];
317
- maxFeePerGas?: ResolvedConfig['BigIntType'];
318
- maxPriorityFeePerGas?: ResolvedConfig['BigIntType'];
319
- nonce?: ResolvedConfig['IntType'];
320
- }
321
- interface PayableOverrides extends Overrides {
322
- value?: ResolvedConfig['IntType'] | ResolvedConfig['BigIntType'];
323
- }
324
- interface CallOverrides extends PayableOverrides {
325
- blockTag?: ethers.CallOverrides['blockTag'];
326
- from?: Address;
327
- }
328
- type Event<TAbiEvent extends AbiEvent> = Omit<ethers.Event, 'args' | 'event' | 'eventSignature'> & {
329
- args: AbiParametersToPrimitiveTypes<TAbiEvent['inputs']>;
330
- event: TAbiEvent['name'];
331
- eventSignature: AbiItemName<TAbiEvent, true>;
332
- };
333
-
334
- 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, AbiParameter as g, ContractConfig as h, GetArgs as i, Optional as j };