viem 0.0.1-alpha.27 → 0.0.1-alpha.29

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 (81) hide show
  1. package/dist/chain-4d46a747.d.ts +543 -0
  2. package/dist/{chain-b0cfb141.d.ts → chain-c7c44165.d.ts} +1 -1
  3. package/dist/chains.d.ts +5 -3
  4. package/dist/chains.js +46 -46
  5. package/dist/chains.mjs +1 -1
  6. package/dist/{chunk-JY7JGKSA.js → chunk-4VQKZYE2.js} +219 -157
  7. package/dist/chunk-4VQKZYE2.js.map +1 -0
  8. package/dist/{chunk-2DSFM32P.js → chunk-CKYH337I.js} +15 -15
  9. package/dist/{chunk-2DSFM32P.js.map → chunk-CKYH337I.js.map} +1 -1
  10. package/dist/{chunk-W7KWIGWO.js → chunk-EYORBAD4.js} +45 -44
  11. package/dist/chunk-EYORBAD4.js.map +1 -0
  12. package/dist/{chunk-LF6P33WQ.mjs → chunk-HPUQL3IM.mjs} +3 -3
  13. package/dist/chunk-HPUQL3IM.mjs.map +1 -0
  14. package/dist/chunk-OJ7H3CQF.js +265 -0
  15. package/dist/chunk-OJ7H3CQF.js.map +1 -0
  16. package/dist/chunk-Q67VUTW3.mjs +210 -0
  17. package/dist/chunk-Q67VUTW3.mjs.map +1 -0
  18. package/dist/{chunk-AKGXRZDN.mjs → chunk-RR4MGS6O.mjs} +27 -26
  19. package/dist/chunk-RR4MGS6O.mjs.map +1 -0
  20. package/dist/chunk-S252SZEL.mjs +265 -0
  21. package/dist/chunk-S252SZEL.mjs.map +1 -0
  22. package/dist/chunk-SEIPUKZE.js +210 -0
  23. package/dist/chunk-SEIPUKZE.js.map +1 -0
  24. package/dist/{chunk-BJJH7RYH.mjs → chunk-TQC7KZ24.mjs} +164 -102
  25. package/dist/chunk-TQC7KZ24.mjs.map +1 -0
  26. package/dist/contract.d.ts +12 -128
  27. package/dist/contract.js +6 -4
  28. package/dist/contract.mjs +5 -3
  29. package/dist/{createClient-6689596e.d.ts → createClient-5d5c14d6.d.ts} +5 -3
  30. package/dist/createPublicClient-2b4afeac.d.ts +629 -0
  31. package/dist/{eip1193-617a05ae.d.ts → eip1193-f09a55af.d.ts} +2 -2
  32. package/dist/ens.d.ts +10 -68
  33. package/dist/ens.js +5 -199
  34. package/dist/ens.js.map +1 -1
  35. package/dist/ens.mjs +7 -201
  36. package/dist/ens.mjs.map +1 -1
  37. package/dist/formatAbiItem-d231fef2.d.ts +14 -0
  38. package/dist/{getAbiItem-d2e8bd76.d.ts → getAbiItem-0e085959.d.ts} +15 -15
  39. package/dist/index.d.ts +22 -13
  40. package/dist/index.js +368 -26
  41. package/dist/index.js.map +1 -1
  42. package/dist/index.mjs +358 -16
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/namehash-88f4639d.d.ts +22 -0
  45. package/dist/parseGwei-4d0b0d73.d.ts +344 -0
  46. package/dist/public.d.ts +11 -334
  47. package/dist/public.js +5 -3
  48. package/dist/public.mjs +4 -2
  49. package/dist/test-b9208949.d.ts +213 -0
  50. package/dist/test.d.ts +8 -149
  51. package/dist/test.js +20 -222
  52. package/dist/test.js.map +1 -1
  53. package/dist/test.mjs +30 -232
  54. package/dist/test.mjs.map +1 -1
  55. package/dist/{transactionReceipt-44dbf122.d.ts → transactionReceipt-84fc92e1.d.ts} +1 -1
  56. package/dist/{transactionRequest-f437b4ba.d.ts → transactionRequest-44c539b4.d.ts} +1 -1
  57. package/dist/utils/index.d.ts +12 -238
  58. package/dist/utils/index.js +2 -2
  59. package/dist/utils/index.mjs +1 -1
  60. package/dist/wallet-9b1c6905.d.ts +104 -0
  61. package/dist/wallet.d.ts +7 -41
  62. package/dist/wallet.js +3 -3
  63. package/dist/wallet.mjs +2 -2
  64. package/dist/window.d.ts +4 -2
  65. package/package.json +1 -1
  66. package/dist/call-3476b8ee.d.ts +0 -22
  67. package/dist/chain-42de87e5.d.ts +0 -359
  68. package/dist/chunk-AKGXRZDN.mjs.map +0 -1
  69. package/dist/chunk-BJJH7RYH.mjs.map +0 -1
  70. package/dist/chunk-JY7JGKSA.js.map +0 -1
  71. package/dist/chunk-LF6P33WQ.mjs.map +0 -1
  72. package/dist/chunk-W7KWIGWO.js.map +0 -1
  73. package/dist/contract-9dd2f98b.d.ts +0 -166
  74. package/dist/createPublicClient-fd558574.d.ts +0 -19
  75. package/dist/createTestClient-bc1d9028.d.ts +0 -34
  76. package/dist/createWalletClient-4df88244.d.ts +0 -30
  77. package/dist/decodeErrorResult-ac835649.d.ts +0 -16
  78. package/dist/readContract-c460f23a.d.ts +0 -10
  79. package/dist/rpc-8c10fc98.d.ts +0 -119
  80. package/dist/sendTransaction-7ce442c0.d.ts +0 -12
  81. package/dist/watchEvent-569c9976.d.ts +0 -41
@@ -0,0 +1,543 @@
1
+ import { Chain as Chain$1 } from '@wagmi/chains';
2
+ import { Abi, AbiFunction, ExtractAbiFunction, AbiParametersToPrimitiveTypes, AbiError, ExtractAbiError, AbiEvent, ExtractAbiEvent, ExtractAbiErrorNames, ExtractAbiEventNames, AbiStateMutability, ExtractAbiFunctionNames, Narrow, AbiParameter, AbiParameterToPrimitiveType, Address as Address$1 } from 'abitype';
3
+ import { TopicFilter } from 'ethers@6/types/providers';
4
+
5
+ type Address = `0x${string}`;
6
+ type ByteArray = Uint8Array;
7
+ type Hex = `0x${string}`;
8
+ type Hash = `0x${string}`;
9
+ type LogTopic = Hex | Hex[] | null;
10
+
11
+ type ExtractFormatter<TChain extends Chain, TKey extends keyof NonNullable<TChain['formatters']>, TFallbackFormatter extends Formatter = Formatter> = NonNullable<TChain['formatters']>[TKey] extends NonNullable<unknown> ? NonNullable<TChain['formatters']>[TKey] : TFallbackFormatter;
12
+ type FormatOptions<TSource, TTarget> = {
13
+ formatter: Formatter<TSource, TTarget>;
14
+ };
15
+ /**
16
+ * Creates a type that is the result of applying `TFormatter` to `TSource`.
17
+ *
18
+ * @example
19
+ * Formatted<() => { a: undefined, b: bigint }, { a: bigint }>
20
+ * => { a: undefined, b: bigint }
21
+ *
22
+ * @example
23
+ * Formatted<() => {}, { a: bigint }>
24
+ * => { a: bigint }
25
+ *
26
+ * @example
27
+ * Formatted<() => { a: bigint | undefined, b: bigint }, { a: bigint, b: bigint }, true>
28
+ * => { a?: bigint | undefined, b: bigint }
29
+ */
30
+ type Formatted<TFormatter, TFallback, TAllowOptional = false> = TFormatter extends Formatter ? ReturnType<TFormatter> extends Record<string, never> ? TFallback : TAllowOptional extends true ? OptionalNullable<ReturnType<TFormatter>> : ReturnType<TFormatter> : never;
31
+ /**
32
+ * @description Formats a data object using the given replacer and an optional formatter.
33
+ */
34
+ declare function format<TFormatter, TSource extends Record<string, any>, TTarget>(data: TSource, { formatter }: FormatOptions<TSource, TTarget>): Formatted<TFormatter, TTarget, false>;
35
+ declare function defineFormatter<TSource extends Record<string, unknown>, TFormatted>({ format, }: {
36
+ format: (data: TSource) => TFormatted;
37
+ }): <TFormat extends Formatter<TSource, Partial<TFormatted> & {
38
+ [key: string]: unknown;
39
+ }>, TExclude extends (keyof TSource)[] = []>({ exclude, format: formatOverride, }: {
40
+ exclude?: TExclude | undefined;
41
+ format?: TFormat | undefined;
42
+ }) => (data: TSource & {
43
+ [key: string]: unknown;
44
+ }) => TFormatted & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
45
+
46
+ type TransactionFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'transaction', NonNullable<Formatters['transaction']>>;
47
+ type FormattedTransaction<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, Transaction>;
48
+ declare const transactionType: {
49
+ readonly '0x0': "legacy";
50
+ readonly '0x1': "eip2930";
51
+ readonly '0x2': "eip1559";
52
+ };
53
+ declare function formatTransaction(transaction: Partial<RpcTransaction>): Transaction<bigint, number>;
54
+ declare const defineTransaction: <TFormat extends Formatter<Partial<RpcTransaction>, Partial<Transaction<bigint, number>> & {
55
+ [key: string]: unknown;
56
+ }>, TExclude extends ("type" | "blockHash" | "blockNumber" | "gas" | "hash" | "value" | "from" | "input" | "nonce" | "r" | "s" | "to" | "transactionIndex" | "v" | "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" | "accessList")[] = []>({ exclude, format: formatOverride, }: {
57
+ exclude?: TExclude | undefined;
58
+ format?: TFormat | undefined;
59
+ }) => (data: Partial<RpcTransaction> & {
60
+ [key: string]: unknown;
61
+ }) => Transaction<bigint, number> & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
62
+
63
+ type FeeHistory<TQuantity = bigint> = {
64
+ /**
65
+ * An array of block base fees per gas (in wei). This includes the next block after
66
+ * the newest of the returned range, because this value can be derived from the newest block.
67
+ * Zeroes are returned for pre-EIP-1559 blocks. */
68
+ baseFeePerGas: TQuantity[];
69
+ /** An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit. */
70
+ gasUsedRatio: number[];
71
+ /** Lowest number block of the returned range. */
72
+ oldestBlock: TQuantity;
73
+ /** An array of effective priority fees (in wei) per gas data points from a single block. All zeroes are returned if the block is empty. */
74
+ reward?: TQuantity[][];
75
+ };
76
+ type FeeValuesLegacy<TQuantity = bigint> = {
77
+ /** Base fee per gas. */
78
+ gasPrice: TQuantity;
79
+ maxFeePerGas?: never;
80
+ maxPriorityFeePerGas?: never;
81
+ };
82
+ type FeeValuesEIP1559<TQuantity = bigint> = {
83
+ gasPrice?: never;
84
+ /** Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas). */
85
+ maxFeePerGas: TQuantity;
86
+ /** Max priority fee per gas (in wei). */
87
+ maxPriorityFeePerGas: TQuantity;
88
+ };
89
+ type FeeValues<TQuantity = bigint> = FeeValuesLegacy<TQuantity> | FeeValuesEIP1559<TQuantity>;
90
+
91
+ /**
92
+ * @description Excludes empty attributes from T if TMaybeExclude is true.
93
+ *
94
+ * @example
95
+ * MaybeExcludeEmpty<{ a: string, b: number, c: [] }, true>
96
+ * => { a: string, b: number }
97
+ *
98
+ * MaybeExcludeEmpty<{ a: string, b: number, c: [] }, false>
99
+ * => { a: string, b: number, c: [] }
100
+ *
101
+ * MaybeExcludeEmpty<{ a: string, b: number, c: undefined }, true>
102
+ * => { a: string, b: number }
103
+ */
104
+ type MaybeExcludeEmpty<T, TMaybeExclude extends boolean> = TMaybeExclude extends true ? Exclude<T, [] | null | undefined> : T;
105
+ /**
106
+ * @description Makes attributes on the type T required if TRequired is true.
107
+ *
108
+ * @example
109
+ * MaybeRequired<{ a: string, b?: number }, true>
110
+ * => { a: string, b: number }
111
+ *
112
+ * MaybeRequired<{ a: string, b?: number }, false>
113
+ * => { a: string, b?: number }
114
+ */
115
+ type MaybeRequired<T, TRequired extends boolean> = TRequired extends true ? Required<T> : T;
116
+ /**
117
+ * @description Merges the intersection properties of T and U.
118
+ *
119
+ * @example
120
+ * MergeIntersectionProperties<{ a: string, b: number }, { a: number, c: boolean }>
121
+ * => { a: number, b: number }
122
+ */
123
+ type MergeIntersectionProperties<T, U> = {
124
+ [K in keyof T as K extends keyof U ? U[K] extends void ? never : K : K]: K extends keyof U ? U[K] : T[K];
125
+ };
126
+ /**
127
+ * @description Makes nullable properties from T optional.
128
+ *
129
+ * @example
130
+ * OptionalNullable<{ a: string | undefined, c: number }>
131
+ * => { a?: string | undefined, c: number }
132
+ */
133
+ type OptionalNullable<T> = {
134
+ [K in keyof T as T[K] extends NonNullable<unknown> ? K : never]: T[K];
135
+ } & {
136
+ [K in keyof T as T[K] extends NonNullable<unknown> ? never : K]?: T[K];
137
+ };
138
+ /**
139
+ * @description Constructs a type by excluding `undefined` from `T`.
140
+ *
141
+ * @example
142
+ * NoUndefined<string | undefined>
143
+ * => string
144
+ */
145
+ type NoUndefined<T> = T extends undefined ? never : T;
146
+ /**
147
+ * @description Combines members of an intersection into a readable type.
148
+ *
149
+ * @link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg
150
+ * @example
151
+ * Prettify<{ a: string } | { b: string } | { c: number, d: bigint }>
152
+ * => { a: string, b: string, c: number, d: bigint }
153
+ */
154
+ type Prettify<T> = {
155
+ [K in keyof T]: T[K];
156
+ } & {};
157
+ /**
158
+ * @description Creates a type that extracts the values of T.
159
+ *
160
+ * @example
161
+ * ValueOf<{ a: string, b: number }>
162
+ * => string | number
163
+ */
164
+ type ValueOf<T> = T[keyof T];
165
+
166
+ type EventParametersConfig = {
167
+ enableUnion: boolean;
168
+ indexedOnly: boolean;
169
+ required: boolean;
170
+ };
171
+ type EventParametersDefaultConfig = {
172
+ enableUnion: true;
173
+ indexedOnly: true;
174
+ required: false;
175
+ };
176
+ type AbiItem = Abi[number];
177
+ type EventDefinition = `${string}(${string})`;
178
+ type HashedEventTypes = 'string' | 'bytes' | 'tuple' | `${string}[${string}]`;
179
+ type EventTopicParam<TPrimitiveType = Hex, TTopic extends LogTopic = LogTopic> = NoUndefined<(TTopic extends Hex ? TPrimitiveType : undefined) | (TTopic extends Hex[] ? TPrimitiveType[] : undefined) | (TTopic extends null ? null : undefined)>;
180
+ type AbiEventParameterToPrimitiveType<TParam extends AbiParameter, TConfig extends EventParametersConfig = EventParametersDefaultConfig> = TConfig extends {
181
+ enableUnion: true;
182
+ } ? EventTopicParam<AbiParameterToPrimitiveType<TParam>> : AbiParameterToPrimitiveType<TParam>;
183
+ type AbiEventParametersToPrimitiveTypes<TAbiParameters extends readonly AbiParameter[], TConfig extends EventParametersConfig = EventParametersDefaultConfig, TBase = TAbiParameters[0] extends {
184
+ name: string;
185
+ } ? {} : []> = Prettify<TAbiParameters extends readonly [infer Head, ...infer Tail] ? Head extends {
186
+ indexed: true;
187
+ } ? Head extends AbiParameter ? Head extends {
188
+ name: infer Name;
189
+ } ? Name extends string ? MaybeRequired<{
190
+ [name in Name]?: AbiEventParameterToPrimitiveType<Head, TConfig>;
191
+ }, TConfig['required']> & (Tail extends readonly [] ? {} : Tail extends readonly AbiParameter[] ? AbiEventParametersToPrimitiveTypes<Tail, TConfig> : {}) : never : MaybeExcludeEmpty<(TConfig extends {
192
+ enableUnion: true;
193
+ } ? [AbiEventParameterToPrimitiveType<Head, TConfig>] : []) | [
194
+ AbiEventParameterToPrimitiveType<Head, TConfig>,
195
+ ...(Tail extends readonly [] ? [] : Tail extends readonly AbiParameter[] ? AbiEventParametersToPrimitiveTypes<Tail, TConfig> : [])
196
+ ], TConfig['required']> : TBase : TConfig extends {
197
+ indexedOnly: false;
198
+ } ? Head extends AbiParameter ? Head extends {
199
+ name: infer Name;
200
+ } ? Name extends string ? {
201
+ [name in Name]: AbiParameterToPrimitiveType<Head>;
202
+ } & (Tail extends readonly [] ? {} : Tail extends readonly AbiParameter[] ? AbiEventParametersToPrimitiveTypes<Tail, TConfig> : {}) : never : [
203
+ AbiParameterToPrimitiveType<Head>,
204
+ ...(Tail extends readonly [] ? [] : Tail extends readonly AbiParameter[] ? AbiEventParametersToPrimitiveTypes<Tail, TConfig> : [])
205
+ ] : TBase : TBase : TBase>;
206
+ type AbiEventTopicToPrimitiveType<TParam extends AbiParameter, TTopic extends LogTopic, TPrimitiveType = TParam['type'] extends HashedEventTypes ? TTopic : AbiParameterToPrimitiveType<TParam>> = EventTopicParam<TPrimitiveType, TTopic>;
207
+ type AbiEventTopicsToPrimitiveTypes<TAbiParameters extends readonly AbiParameter[], TTopics extends LogTopic[] | undefined = undefined, TData extends Hex | undefined = undefined, TBase = TAbiParameters[0] extends {
208
+ name: string;
209
+ } ? {} : []> = Prettify<TAbiParameters extends readonly [infer Head, ...infer Tail] ? TTopics extends readonly [infer TopicHead, ...infer TopicTail] ? Head extends {
210
+ indexed: true;
211
+ } ? Head extends AbiParameter ? Head extends {
212
+ name: infer Name;
213
+ } ? Name extends string ? {
214
+ [name in Name]: TopicHead extends LogTopic ? AbiEventTopicToPrimitiveType<Head, TopicHead> : never;
215
+ } & (Tail extends readonly [] ? {} : Tail extends readonly AbiParameter[] ? TopicTail extends LogTopic[] ? AbiEventTopicsToPrimitiveTypes<Tail, TopicTail, TData> : {} : {}) : never : [
216
+ TopicHead extends LogTopic ? AbiEventTopicToPrimitiveType<Head, TopicHead> : never,
217
+ ...(Tail extends readonly [] ? [] : Tail extends readonly AbiParameter[] ? TopicTail extends LogTopic[] ? AbiEventTopicsToPrimitiveTypes<Tail, TopicTail, TData> : [] : [])
218
+ ] : TBase : TBase : TTopics extends readonly [] ? TData extends '0x' ? TBase : TData extends Hex ? Head extends AbiParameter ? Head extends {
219
+ indexed: true;
220
+ } ? Tail extends readonly AbiParameter[] ? AbiEventTopicsToPrimitiveTypes<Tail, [], TData> : TBase : Head extends {
221
+ name: infer Name;
222
+ } ? Name extends string ? {
223
+ [name in Name]: AbiParameterToPrimitiveType<Head>;
224
+ } & (Tail extends readonly [] ? {} : Tail extends readonly AbiParameter[] ? AbiEventTopicsToPrimitiveTypes<Tail, [], TData> : {}) : never : [
225
+ AbiParameterToPrimitiveType<Head>,
226
+ ...(Tail extends readonly [] ? [] : Tail extends readonly AbiParameter[] ? AbiEventTopicsToPrimitiveTypes<Tail, [], TData> : [])
227
+ ] : TBase : TBase : TBase : undefined>;
228
+ type ExtractArgsFromAbi<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TAbiFunction extends AbiFunction & {
229
+ type: 'function';
230
+ } = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : AbiFunction & {
231
+ type: 'function';
232
+ }, TArgs = AbiParametersToPrimitiveTypes<TAbiFunction['inputs']>, FailedToParseArgs = ([TArgs] extends [never] ? true : false) | (readonly unknown[] extends TArgs ? true : false)> = true extends FailedToParseArgs ? {
233
+ /**
234
+ * Arguments to pass contract method
235
+ *
236
+ * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link abi} for type inference.
237
+ */
238
+ args?: readonly unknown[];
239
+ } : TArgs extends readonly [] ? {
240
+ args?: never;
241
+ } : {
242
+ /** Arguments to pass contract method */ args: TArgs;
243
+ };
244
+ type ExtractConstructorArgsFromAbi<TAbi extends Abi | readonly unknown[], TAbiFunction extends AbiFunction & {
245
+ type: 'constructor';
246
+ } = TAbi extends Abi ? Extract<TAbi[number], {
247
+ type: 'constructor';
248
+ }> : AbiFunction & {
249
+ type: 'constructor';
250
+ }, TArgs = AbiParametersToPrimitiveTypes<TAbiFunction['inputs']>, FailedToParseArgs = ([TArgs] extends [never] ? true : false) | (readonly unknown[] extends TArgs ? true : false)> = true extends FailedToParseArgs ? {
251
+ /**
252
+ * Arguments to pass contract method
253
+ *
254
+ * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link abi} for type inference.
255
+ */
256
+ args?: readonly unknown[];
257
+ } : TArgs extends readonly [] ? {
258
+ args?: never;
259
+ } : {
260
+ /** Arguments to pass contract method */ args: TArgs;
261
+ };
262
+ type ExtractErrorArgsFromAbi<TAbi extends Abi | readonly unknown[], TErrorName extends string, TAbiError extends AbiError = TAbi extends Abi ? ExtractAbiError<TAbi, TErrorName> : AbiError, TArgs = AbiParametersToPrimitiveTypes<TAbiError['inputs']>, FailedToParseArgs = ([TArgs] extends [never] ? true : false) | (readonly unknown[] extends TArgs ? true : false)> = true extends FailedToParseArgs ? {
263
+ /**
264
+ * Arguments to pass contract method
265
+ *
266
+ * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link abi} for type inference.
267
+ */
268
+ args?: readonly unknown[];
269
+ } : TArgs extends readonly [] ? {
270
+ args?: never;
271
+ } : {
272
+ /** Arguments to pass contract method */ args: TArgs;
273
+ };
274
+ type ExtractEventArgsFromAbi<TAbi extends Abi | readonly unknown[], TEventName extends string, TConfig extends EventParametersConfig = EventParametersDefaultConfig, TAbiEvent extends AbiEvent & {
275
+ type: 'event';
276
+ } = TAbi extends Abi ? ExtractAbiEvent<TAbi, TEventName> : AbiEvent & {
277
+ type: 'event';
278
+ }, TArgs = AbiEventParametersToPrimitiveTypes<TAbiEvent['inputs'], TConfig>, FailedToParseArgs = ([TArgs] extends [never] ? true : false) | (readonly unknown[] extends TArgs ? true : false)> = true extends FailedToParseArgs ? readonly unknown[] : TArgs extends readonly [] ? never : TArgs;
279
+ type ExtractEventArgsFromTopics<TAbi extends Abi | readonly unknown[], TEventName extends string, TTopics extends LogTopic[], TData extends Hex | undefined, TAbiEvent extends AbiEvent & {
280
+ type: 'event';
281
+ } = TAbi extends Abi ? ExtractAbiEvent<TAbi, TEventName> : AbiEvent & {
282
+ type: 'event';
283
+ }, TArgs = AbiEventTopicsToPrimitiveTypes<TAbiEvent['inputs'], TTopics, TData>> = TTopics extends readonly [] ? TData extends undefined ? {
284
+ args?: never;
285
+ } : {
286
+ args?: TArgs;
287
+ } : {
288
+ args?: TArgs;
289
+ };
290
+ type ExtractErrorNameFromAbi<TAbi extends Abi | readonly unknown[] = Abi, TErrorName extends string = string> = TAbi extends Abi ? ExtractAbiErrorNames<TAbi> extends infer AbiErrorNames ? AbiErrorNames | (TErrorName extends AbiErrorNames ? TErrorName : never) | (Abi extends TAbi ? string : never) : never : TErrorName;
291
+ type ExtractEventNameFromAbi<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = string> = TAbi extends Abi ? ExtractAbiEventNames<TAbi> extends infer AbiEventNames ? AbiEventNames | (TEventName extends AbiEventNames ? TEventName : never) : never : TEventName;
292
+ type ExtractFunctionNameFromAbi<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TAbiStateMutability extends AbiStateMutability = AbiStateMutability> = TAbi extends Abi ? ExtractAbiFunctionNames<TAbi, TAbiStateMutability> extends infer AbiFunctionNames ? AbiFunctionNames | (TFunctionName extends AbiFunctionNames ? TFunctionName : never) | (Abi extends TAbi ? string : never) : never : TFunctionName;
293
+ type ExtractNames<TAbi extends Abi> = ExtractAbiFunctionNames<TAbi> | ExtractAbiEventNames<TAbi> | ExtractAbiErrorNames<TAbi>;
294
+ type ExtractNameFromAbi<TAbi extends Abi | readonly unknown[] = Abi, TName extends string = string> = TAbi extends Abi ? ExtractNames<TAbi> extends infer AbiNames ? AbiNames | (TName extends AbiNames ? TName : never) | (Abi extends TAbi ? string : never) : never : TName;
295
+ type ExtractResultFromAbi<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TAbiFunction extends AbiFunction & {
296
+ type: 'function';
297
+ } = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : AbiFunction & {
298
+ type: 'function';
299
+ }, TArgs = AbiParametersToPrimitiveTypes<TAbiFunction['outputs']>, FailedToParseArgs = ([TArgs] extends [never] ? true : false) | (readonly unknown[] extends TArgs ? true : false)> = true extends FailedToParseArgs ? unknown : TArgs extends readonly [] ? void : TArgs extends readonly [infer Arg] ? Arg : TArgs;
300
+ type MaybeAbiEventName<TAbiEvent extends AbiEvent | undefined> = TAbiEvent extends AbiEvent ? TAbiEvent['name'] : undefined;
301
+ type MaybeExtractEventArgsFromAbi<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined> = TEventName extends string ? ExtractEventArgsFromAbi<TAbi, TEventName> : undefined;
302
+ type ContractConfig<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, TAbiStateMutability extends AbiStateMutability = AbiStateMutability> = {
303
+ /** Contract ABI */
304
+ abi: Narrow<TAbi>;
305
+ /** Contract address */
306
+ address: Address;
307
+ /** Function to invoke on the contract */
308
+ functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName, TAbiStateMutability>;
309
+ } & ExtractArgsFromAbi<TAbi, TFunctionName>;
310
+ type GetValue<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TValueType = TransactionRequest['value'], TAbiFunction extends AbiFunction & {
311
+ type: 'function';
312
+ } = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : AbiFunction & {
313
+ type: 'function';
314
+ }> = TAbiFunction['stateMutability'] extends 'payable' ? TValueType : TAbiFunction['payable'] extends true ? TValueType : never;
315
+
316
+ type DecodedAbiEvent<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = TAbiEvent extends AbiEvent ? TAbiEvent['name'] : undefined> = TAbi extends Abi ? TEventName extends string ? {
317
+ args: ExtractEventArgsFromAbi<TAbi, TEventName, {
318
+ enableUnion: false;
319
+ indexedOnly: false;
320
+ required: true;
321
+ }>;
322
+ /** The event name decoded from `topics`. */
323
+ eventName: TEventName;
324
+ } : {
325
+ args: ExtractEventArgsFromAbi<TAbi, string, {
326
+ enableUnion: false;
327
+ indexedOnly: false;
328
+ required: true;
329
+ }>;
330
+ /** The event name decoded from `topics`. */
331
+ eventName: ExtractAbiEventNames<TAbi>;
332
+ } : {};
333
+ type Log<TQuantity = bigint, TIndex = number, TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = TAbiEvent extends AbiEvent ? TAbiEvent['name'] : undefined> = {
334
+ /** The address from which this log originated */
335
+ address: Address$1;
336
+ /** Hash of block containing this log or `null` if pending */
337
+ blockHash: Hash | null;
338
+ /** Number of block containing this log or `null` if pending */
339
+ blockNumber: TQuantity | null;
340
+ /** Contains the non-indexed arguments of the log */
341
+ data: Hex;
342
+ /** Index of this log within its block or `null` if pending */
343
+ logIndex: TIndex | null;
344
+ /** Hash of the transaction that created this log or `null` if pending */
345
+ transactionHash: Hash | null;
346
+ /** Index of the transaction that created this log or `null` if pending */
347
+ transactionIndex: TIndex | null;
348
+ /** List of order-dependent topics */
349
+ topics: TopicFilter;
350
+ /** `true` if this filter has been destroyed and is invalid */
351
+ removed: boolean;
352
+ } & DecodedAbiEvent<TAbiEvent, TAbi, TEventName>;
353
+
354
+ type AccessList = Array<{
355
+ address: Address;
356
+ storageKeys: Array<Hex>;
357
+ }>;
358
+ type TransactionType$1 = ValueOf<typeof transactionType>;
359
+ type TransactionReceipt<TQuantity = bigint, TIndex = number, TStatus = 'success' | 'reverted', TType = TransactionType$1> = {
360
+ /** Hash of block containing this transaction */
361
+ blockHash: Hash;
362
+ /** Number of block containing this transaction */
363
+ blockNumber: TQuantity;
364
+ /** Address of new contract or `null` if no contract was created */
365
+ contractAddress: Address | null;
366
+ /** Gas used by this and all preceding transactions in this block */
367
+ cumulativeGasUsed: TQuantity;
368
+ /** Pre-London, it is equal to the transaction's gasPrice. Post-London, it is equal to the actual gas price paid for inclusion. */
369
+ effectiveGasPrice: TQuantity;
370
+ /** Transaction sender */
371
+ from: Address;
372
+ /** Gas used by this transaction */
373
+ gasUsed: TQuantity;
374
+ /** List of log objects generated by this transaction */
375
+ logs: Log<TQuantity, TIndex>[];
376
+ /** Logs bloom filter */
377
+ logsBloom: Hex;
378
+ /** `1` if this transaction was successful or `0` if it failed */
379
+ status: TStatus;
380
+ /** Transaction recipient or `null` if deploying a contract */
381
+ to: Address | null;
382
+ /** Hash of this transaction */
383
+ transactionHash: Hash;
384
+ /** Index of this transaction in the block */
385
+ transactionIndex: TIndex;
386
+ /** Transaction type */
387
+ type: TType;
388
+ };
389
+ type TransactionBase<TQuantity = bigint, TIndex = number> = {
390
+ /** Hash of block containing this transaction or `null` if pending */
391
+ blockHash: Hash | null;
392
+ /** Number of block containing this transaction or `null` if pending */
393
+ blockNumber: TQuantity | null;
394
+ /** Transaction sender */
395
+ from: Address;
396
+ /** Gas provided for transaction execution */
397
+ gas: TQuantity;
398
+ /** Hash of this transaction */
399
+ hash: Hash;
400
+ /** Contract code or a hashed method call */
401
+ input: Hex;
402
+ /** Unique number identifying this transaction */
403
+ nonce: TIndex;
404
+ /** ECDSA signature r */
405
+ r: Hex;
406
+ /** ECDSA signature s */
407
+ s: Hex;
408
+ /** Transaction recipient or `null` if deploying a contract */
409
+ to: Address | null;
410
+ /** Index of this transaction in the block or `null` if pending */
411
+ transactionIndex: TIndex | null;
412
+ /** ECDSA recovery ID */
413
+ v: TQuantity;
414
+ /** Value in wei sent with this transaction */
415
+ value: TQuantity;
416
+ };
417
+ type TransactionLegacy<TQuantity = bigint, TIndex = number, TType = 'legacy'> = TransactionBase<TQuantity, TIndex> & FeeValuesLegacy<TQuantity> & {
418
+ accessList?: never;
419
+ type: TType;
420
+ };
421
+ type TransactionEIP2930<TQuantity = bigint, TIndex = number, TType = 'eip2930'> = TransactionBase<TQuantity, TIndex> & FeeValuesLegacy<TQuantity> & {
422
+ accessList: AccessList;
423
+ type: TType;
424
+ };
425
+ type TransactionEIP1559<TQuantity = bigint, TIndex = number, TType = 'eip1559'> = TransactionBase<TQuantity, TIndex> & FeeValuesEIP1559<TQuantity> & {
426
+ accessList: AccessList;
427
+ type: TType;
428
+ };
429
+ type Transaction<TQuantity = bigint, TIndex = number> = TransactionLegacy<TQuantity, TIndex> | TransactionEIP2930<TQuantity, TIndex> | TransactionEIP1559<TQuantity, TIndex>;
430
+ type TransactionRequestBase<TQuantity = bigint, TIndex = number> = {
431
+ /** Contract code or a hashed method call with encoded args */
432
+ data?: Hex;
433
+ /** Transaction sender */
434
+ from: Address;
435
+ /** Gas provided for transaction execution */
436
+ gas?: TQuantity;
437
+ /** Unique number identifying this transaction */
438
+ nonce?: TIndex;
439
+ /** Transaction recipient */
440
+ to?: Address;
441
+ /** Value in wei sent with this transaction */
442
+ value?: TQuantity;
443
+ };
444
+ type TransactionRequestLegacy<TQuantity = bigint, TIndex = number> = TransactionRequestBase<TQuantity, TIndex> & Partial<FeeValuesLegacy<TQuantity>> & {
445
+ accessList?: never;
446
+ };
447
+ type TransactionRequestEIP2930<TQuantity = bigint, TIndex = number> = TransactionRequestBase<TQuantity, TIndex> & Partial<FeeValuesLegacy<TQuantity>> & {
448
+ accessList?: AccessList;
449
+ };
450
+ type TransactionRequestEIP1559<TQuantity = bigint, TIndex = number> = TransactionRequestBase<TQuantity, TIndex> & Partial<FeeValuesEIP1559<TQuantity>> & {
451
+ accessList?: AccessList;
452
+ };
453
+ type TransactionRequest<TQuantity = bigint, TIndex = number> = TransactionRequestLegacy<TQuantity, TIndex> | TransactionRequestEIP2930<TQuantity, TIndex> | TransactionRequestEIP1559<TQuantity, TIndex>;
454
+
455
+ type Block<TQuantity = bigint, TTransaction = Transaction> = {
456
+ /** Base fee per gas */
457
+ baseFeePerGas: TQuantity | null;
458
+ /** Difficulty for this block */
459
+ difficulty: TQuantity;
460
+ /** "Extra data" field of this block */
461
+ extraData: Hex;
462
+ /** Maximum gas allowed in this block */
463
+ gasLimit: TQuantity;
464
+ /** Total used gas by all transactions in this block */
465
+ gasUsed: TQuantity;
466
+ /** Block hash or `null` if pending */
467
+ hash: Hash | null;
468
+ /** Logs bloom filter or `null` if pending */
469
+ logsBloom: Hex | null;
470
+ /** Address that received this block’s mining rewards */
471
+ miner: Address;
472
+ /** Unique identifier for the block. */
473
+ mixHash: Hash;
474
+ /** Proof-of-work hash or `null` if pending */
475
+ nonce: Hex | null;
476
+ /** Block number or `null` if pending */
477
+ number: TQuantity | null;
478
+ /** Parent block hash */
479
+ parentHash: Hash;
480
+ /** Root of the this block’s receipts trie */
481
+ receiptsRoot: Hex;
482
+ sealFields: Hex[];
483
+ /** SHA3 of the uncles data in this block */
484
+ sha3Uncles: Hash;
485
+ /** Size of this block in bytes */
486
+ size: TQuantity;
487
+ /** Root of this block’s final state trie */
488
+ stateRoot: Hash;
489
+ /** Unix timestamp of when this block was collated */
490
+ timestamp: TQuantity;
491
+ /** Total difficulty of the chain until this block */
492
+ totalDifficulty: TQuantity | null;
493
+ /** List of transaction objects or hashes */
494
+ transactions: Hash[] | TTransaction[];
495
+ /** Root of this block’s transaction trie */
496
+ transactionsRoot: Hash;
497
+ /** List of uncle hashes */
498
+ uncles: Hash[];
499
+ };
500
+ type BlockIdentifier<TQuantity = bigint> = {
501
+ /** Whether or not to throw an error if the block is not in the canonical chain as described below. Only allowed in conjunction with the blockHash tag. Defaults to false. */
502
+ requireCanonical?: boolean;
503
+ } & ({
504
+ /** The block in the canonical chain with this number */
505
+ blockNumber: BlockNumber<TQuantity>;
506
+ } | {
507
+ /** The block uniquely identified by this hash. The `blockNumber` and `blockHash` properties are mutually exclusive; exactly one of them must be set. */
508
+ blockHash: Hash;
509
+ });
510
+ type BlockNumber<TQuantity = bigint> = TQuantity;
511
+ type BlockTag = 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized';
512
+ type Uncle<TQuantity = bigint, TTransaction = Transaction> = Block<TQuantity, TTransaction>;
513
+
514
+ type Index = `0x${string}`;
515
+ type Quantity = `0x${string}`;
516
+ type Status = '0x0' | '0x1';
517
+ type TransactionType = '0x0' | '0x1' | '0x2';
518
+ type RpcBlock = Block<Quantity, RpcTransaction>;
519
+ type RpcBlockNumber = BlockNumber<Quantity>;
520
+ type RpcBlockIdentifier = BlockIdentifier<Quantity>;
521
+ type RpcUncle = Uncle<Quantity>;
522
+ type RpcFeeHistory = FeeHistory<Quantity>;
523
+ type RpcFeeValues = FeeValues<Quantity>;
524
+ type RpcLog = Log<Quantity, Index>;
525
+ type RpcTransactionReceipt = TransactionReceipt<Quantity, Index, Status, TransactionType>;
526
+ type RpcTransactionRequest = TransactionRequest<Quantity, Index>;
527
+ type RpcTransaction = TransactionLegacy<Quantity, Index, '0x0'> | TransactionEIP2930<Quantity, Index, '0x1'> | TransactionEIP1559<Quantity, Index, '0x2'>;
528
+
529
+ type Formatter<TSource = any, TTarget = any> = (value: TSource & {
530
+ [key: string]: unknown;
531
+ }) => TTarget;
532
+ type Formatters = {
533
+ block?: Formatter<RpcBlock, Block>;
534
+ transaction?: Formatter<RpcTransaction, Transaction>;
535
+ transactionReceipt?: Formatter<RpcTransactionReceipt, TransactionReceipt>;
536
+ transactionRequest?: Formatter<TransactionRequest, RpcTransactionRequest>;
537
+ };
538
+
539
+ type Chain<TFormatters extends Formatters = Formatters> = Chain$1 & {
540
+ formatters?: TFormatters;
541
+ };
542
+
543
+ export { TransactionType$1 as $, Address as A, ByteArray as B, Chain as C, TransactionBase as D, TransactionEIP1559 as E, FeeHistory as F, TransactionEIP2930 as G, Hex as H, TransactionLegacy as I, ExtractFormatter as J, Formatted as K, Log as L, FormattedTransaction as M, TransactionFormatter as N, defineTransaction as O, formatTransaction as P, transactionType as Q, RpcBlock as R, MaybeExtractEventArgsFromAbi as S, TransactionReceipt as T, Uncle as U, ExtractResultFromAbi as V, Formatter as W, MergeIntersectionProperties as X, GetValue as Y, MaybeAbiEventName as Z, ExtractEventNameFromAbi as _, Hash as a, ExtractEventArgsFromAbi as a0, Prettify as a1, Quantity as a2, ExtractConstructorArgsFromAbi as a3, EventDefinition as a4, LogTopic as a5, ExtractEventArgsFromTopics as a6, ExtractFunctionNameFromAbi as a7, ExtractArgsFromAbi as a8, ExtractErrorNameFromAbi as a9, ExtractErrorArgsFromAbi as aa, ExtractNameFromAbi as ab, Formatters as ac, defineFormatter as ad, format as ae, BlockTag as b, AbiItem as c, AccessList as d, Block as e, BlockIdentifier as f, BlockNumber as g, ContractConfig as h, FeeValues as i, FeeValuesEIP1559 as j, FeeValuesLegacy as k, RpcBlockIdentifier as l, RpcBlockNumber as m, RpcFeeHistory as n, RpcFeeValues as o, RpcLog as p, RpcTransaction as q, RpcTransactionReceipt as r, RpcTransactionRequest as s, RpcUncle as t, TransactionRequest as u, TransactionRequestBase as v, TransactionRequestEIP1559 as w, TransactionRequestEIP2930 as x, TransactionRequestLegacy as y, Transaction as z };
@@ -1,4 +1,4 @@
1
- import { K as Formatters, C as Chain } from './chain-42de87e5.js';
1
+ import { ac as Formatters, C as Chain } from './chain-4d46a747.js';
2
2
 
3
3
  declare function defineChain<TFormatters extends Formatters = Formatters, TChain extends Chain<TFormatters> = Chain<TFormatters>>(chain: TChain): TChain;
4
4
 
package/dist/chains.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { R as RpcBlock, d as Block, x as Transaction, H as Hex, o as RpcTransaction, p as RpcTransactionReceipt, T as TransactionReceipt, J as TransactionType, s as TransactionRequest, q as RpcTransactionRequest } from './chain-42de87e5.js';
2
- export { C as Chain } from './chain-42de87e5.js';
3
- export { d as defineChain } from './chain-b0cfb141.js';
1
+ import { R as RpcBlock, e as Block, z as Transaction, H as Hex, q as RpcTransaction, r as RpcTransactionReceipt, T as TransactionReceipt, $ as TransactionType, u as TransactionRequest, s as RpcTransactionRequest } from './chain-4d46a747.js';
2
+ export { C as Chain } from './chain-4d46a747.js';
3
+ export { d as defineChain } from './chain-c7c44165.js';
4
4
  import '@wagmi/chains';
5
+ import 'abitype';
6
+ import 'ethers@6/types/providers';
5
7
 
6
8
  declare const arbitrum: {
7
9
  readonly id: 42161;