@avalabs/evm-module 0.12.0 → 1.1.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/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import * as _avalabs_vm_module_types_dist_token from '@avalabs/vm-module-types/d
3
3
  import * as _avalabs_vm_module_types_dist_transaction_history from '@avalabs/vm-module-types/dist/transaction-history';
4
4
  import { Module, ConstructorParams, Network, GetAddressParams, GetAddressResponse, GetBalancesParams, GetBalancesResponse, Manifest, NetworkFeeParam, NetworkFees, GetTransactionHistory, RpcRequest, TransactionType, TypedDataV1, TypedData, MessageTypes, Error } from '@avalabs/vm-module-types';
5
5
  import { JsonRpcBatchInternal } from '@avalabs/core-wallets-sdk';
6
+ import { z } from 'zod';
6
7
 
7
8
  declare class EvmModule implements Module {
8
9
  #private;
@@ -25,23 +26,352 @@ declare class EvmModule implements Module {
25
26
  } | {
26
27
  result: any;
27
28
  error?: undefined;
29
+ } | {
30
+ error: _metamask_rpc_errors.JsonRpcError<{
31
+ originalError: unknown;
32
+ }>;
33
+ result?: undefined;
28
34
  }>;
29
35
  }
30
36
 
37
+ declare const transactionSchema: z.ZodObject<{
38
+ from: z.ZodString;
39
+ to: z.ZodOptional<z.ZodString>;
40
+ data: z.ZodOptional<z.ZodString>;
41
+ value: z.ZodOptional<z.ZodString>;
42
+ gas: z.ZodOptional<z.ZodString>;
43
+ gasPrice: z.ZodOptional<z.ZodString>;
44
+ maxFeePerGas: z.ZodOptional<z.ZodString>;
45
+ maxPriorityFeePerGas: z.ZodOptional<z.ZodString>;
46
+ nonce: z.ZodOptional<z.ZodString>;
47
+ chainId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodOptional<z.ZodNumber>]>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ from: string;
50
+ chainId?: string | number | undefined;
51
+ to?: string | undefined;
52
+ gasPrice?: string | undefined;
53
+ data?: string | undefined;
54
+ value?: string | undefined;
55
+ gas?: string | undefined;
56
+ maxFeePerGas?: string | undefined;
57
+ maxPriorityFeePerGas?: string | undefined;
58
+ nonce?: string | undefined;
59
+ }, {
60
+ from: string;
61
+ chainId?: string | number | undefined;
62
+ to?: string | undefined;
63
+ gasPrice?: string | undefined;
64
+ data?: string | undefined;
65
+ value?: string | undefined;
66
+ gas?: string | undefined;
67
+ maxFeePerGas?: string | undefined;
68
+ maxPriorityFeePerGas?: string | undefined;
69
+ nonce?: string | undefined;
70
+ }>;
71
+
72
+ declare const transactionBatchSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodTuple<[z.ZodObject<{
73
+ from: z.ZodString;
74
+ to: z.ZodOptional<z.ZodString>;
75
+ data: z.ZodOptional<z.ZodString>;
76
+ value: z.ZodOptional<z.ZodString>;
77
+ gas: z.ZodOptional<z.ZodString>;
78
+ gasPrice: z.ZodOptional<z.ZodString>;
79
+ maxFeePerGas: z.ZodOptional<z.ZodString>;
80
+ maxPriorityFeePerGas: z.ZodOptional<z.ZodString>;
81
+ nonce: z.ZodOptional<z.ZodString>;
82
+ chainId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodOptional<z.ZodNumber>]>;
83
+ }, "strip", z.ZodTypeAny, {
84
+ from: string;
85
+ chainId?: string | number | undefined;
86
+ to?: string | undefined;
87
+ gasPrice?: string | undefined;
88
+ data?: string | undefined;
89
+ value?: string | undefined;
90
+ gas?: string | undefined;
91
+ maxFeePerGas?: string | undefined;
92
+ maxPriorityFeePerGas?: string | undefined;
93
+ nonce?: string | undefined;
94
+ }, {
95
+ from: string;
96
+ chainId?: string | number | undefined;
97
+ to?: string | undefined;
98
+ gasPrice?: string | undefined;
99
+ data?: string | undefined;
100
+ value?: string | undefined;
101
+ gas?: string | undefined;
102
+ maxFeePerGas?: string | undefined;
103
+ maxPriorityFeePerGas?: string | undefined;
104
+ nonce?: string | undefined;
105
+ }>, z.ZodObject<{
106
+ from: z.ZodString;
107
+ to: z.ZodOptional<z.ZodString>;
108
+ data: z.ZodOptional<z.ZodString>;
109
+ value: z.ZodOptional<z.ZodString>;
110
+ gas: z.ZodOptional<z.ZodString>;
111
+ gasPrice: z.ZodOptional<z.ZodString>;
112
+ maxFeePerGas: z.ZodOptional<z.ZodString>;
113
+ maxPriorityFeePerGas: z.ZodOptional<z.ZodString>;
114
+ nonce: z.ZodOptional<z.ZodString>;
115
+ chainId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodOptional<z.ZodNumber>]>;
116
+ }, "strip", z.ZodTypeAny, {
117
+ from: string;
118
+ chainId?: string | number | undefined;
119
+ to?: string | undefined;
120
+ gasPrice?: string | undefined;
121
+ data?: string | undefined;
122
+ value?: string | undefined;
123
+ gas?: string | undefined;
124
+ maxFeePerGas?: string | undefined;
125
+ maxPriorityFeePerGas?: string | undefined;
126
+ nonce?: string | undefined;
127
+ }, {
128
+ from: string;
129
+ chainId?: string | number | undefined;
130
+ to?: string | undefined;
131
+ gasPrice?: string | undefined;
132
+ data?: string | undefined;
133
+ value?: string | undefined;
134
+ gas?: string | undefined;
135
+ maxFeePerGas?: string | undefined;
136
+ maxPriorityFeePerGas?: string | undefined;
137
+ nonce?: string | undefined;
138
+ }>], z.ZodObject<{
139
+ from: z.ZodString;
140
+ to: z.ZodOptional<z.ZodString>;
141
+ data: z.ZodOptional<z.ZodString>;
142
+ value: z.ZodOptional<z.ZodString>;
143
+ gas: z.ZodOptional<z.ZodString>;
144
+ gasPrice: z.ZodOptional<z.ZodString>;
145
+ maxFeePerGas: z.ZodOptional<z.ZodString>;
146
+ maxPriorityFeePerGas: z.ZodOptional<z.ZodString>;
147
+ nonce: z.ZodOptional<z.ZodString>;
148
+ chainId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodOptional<z.ZodNumber>]>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ from: string;
151
+ chainId?: string | number | undefined;
152
+ to?: string | undefined;
153
+ gasPrice?: string | undefined;
154
+ data?: string | undefined;
155
+ value?: string | undefined;
156
+ gas?: string | undefined;
157
+ maxFeePerGas?: string | undefined;
158
+ maxPriorityFeePerGas?: string | undefined;
159
+ nonce?: string | undefined;
160
+ }, {
161
+ from: string;
162
+ chainId?: string | number | undefined;
163
+ to?: string | undefined;
164
+ gasPrice?: string | undefined;
165
+ data?: string | undefined;
166
+ value?: string | undefined;
167
+ gas?: string | undefined;
168
+ maxFeePerGas?: string | undefined;
169
+ maxPriorityFeePerGas?: string | undefined;
170
+ nonce?: string | undefined;
171
+ }>>, [{
172
+ from: string;
173
+ chainId?: string | number | undefined;
174
+ to?: string | undefined;
175
+ gasPrice?: string | undefined;
176
+ data?: string | undefined;
177
+ value?: string | undefined;
178
+ gas?: string | undefined;
179
+ maxFeePerGas?: string | undefined;
180
+ maxPriorityFeePerGas?: string | undefined;
181
+ nonce?: string | undefined;
182
+ }, {
183
+ from: string;
184
+ chainId?: string | number | undefined;
185
+ to?: string | undefined;
186
+ gasPrice?: string | undefined;
187
+ data?: string | undefined;
188
+ value?: string | undefined;
189
+ gas?: string | undefined;
190
+ maxFeePerGas?: string | undefined;
191
+ maxPriorityFeePerGas?: string | undefined;
192
+ nonce?: string | undefined;
193
+ }, ...{
194
+ from: string;
195
+ chainId?: string | number | undefined;
196
+ to?: string | undefined;
197
+ gasPrice?: string | undefined;
198
+ data?: string | undefined;
199
+ value?: string | undefined;
200
+ gas?: string | undefined;
201
+ maxFeePerGas?: string | undefined;
202
+ maxPriorityFeePerGas?: string | undefined;
203
+ nonce?: string | undefined;
204
+ }[]], [{
205
+ from: string;
206
+ chainId?: string | number | undefined;
207
+ to?: string | undefined;
208
+ gasPrice?: string | undefined;
209
+ data?: string | undefined;
210
+ value?: string | undefined;
211
+ gas?: string | undefined;
212
+ maxFeePerGas?: string | undefined;
213
+ maxPriorityFeePerGas?: string | undefined;
214
+ nonce?: string | undefined;
215
+ }, {
216
+ from: string;
217
+ chainId?: string | number | undefined;
218
+ to?: string | undefined;
219
+ gasPrice?: string | undefined;
220
+ data?: string | undefined;
221
+ value?: string | undefined;
222
+ gas?: string | undefined;
223
+ maxFeePerGas?: string | undefined;
224
+ maxPriorityFeePerGas?: string | undefined;
225
+ nonce?: string | undefined;
226
+ }, ...{
227
+ from: string;
228
+ chainId?: string | number | undefined;
229
+ to?: string | undefined;
230
+ gasPrice?: string | undefined;
231
+ data?: string | undefined;
232
+ value?: string | undefined;
233
+ gas?: string | undefined;
234
+ maxFeePerGas?: string | undefined;
235
+ maxPriorityFeePerGas?: string | undefined;
236
+ nonce?: string | undefined;
237
+ }[]]>, [{
238
+ from: string;
239
+ chainId?: string | number | undefined;
240
+ to?: string | undefined;
241
+ gasPrice?: string | undefined;
242
+ data?: string | undefined;
243
+ value?: string | undefined;
244
+ gas?: string | undefined;
245
+ maxFeePerGas?: string | undefined;
246
+ maxPriorityFeePerGas?: string | undefined;
247
+ nonce?: string | undefined;
248
+ }, {
249
+ from: string;
250
+ chainId?: string | number | undefined;
251
+ to?: string | undefined;
252
+ gasPrice?: string | undefined;
253
+ data?: string | undefined;
254
+ value?: string | undefined;
255
+ gas?: string | undefined;
256
+ maxFeePerGas?: string | undefined;
257
+ maxPriorityFeePerGas?: string | undefined;
258
+ nonce?: string | undefined;
259
+ }, ...{
260
+ from: string;
261
+ chainId?: string | number | undefined;
262
+ to?: string | undefined;
263
+ gasPrice?: string | undefined;
264
+ data?: string | undefined;
265
+ value?: string | undefined;
266
+ gas?: string | undefined;
267
+ maxFeePerGas?: string | undefined;
268
+ maxPriorityFeePerGas?: string | undefined;
269
+ nonce?: string | undefined;
270
+ }[]], [{
271
+ from: string;
272
+ chainId?: string | number | undefined;
273
+ to?: string | undefined;
274
+ gasPrice?: string | undefined;
275
+ data?: string | undefined;
276
+ value?: string | undefined;
277
+ gas?: string | undefined;
278
+ maxFeePerGas?: string | undefined;
279
+ maxPriorityFeePerGas?: string | undefined;
280
+ nonce?: string | undefined;
281
+ }, {
282
+ from: string;
283
+ chainId?: string | number | undefined;
284
+ to?: string | undefined;
285
+ gasPrice?: string | undefined;
286
+ data?: string | undefined;
287
+ value?: string | undefined;
288
+ gas?: string | undefined;
289
+ maxFeePerGas?: string | undefined;
290
+ maxPriorityFeePerGas?: string | undefined;
291
+ nonce?: string | undefined;
292
+ }, ...{
293
+ from: string;
294
+ chainId?: string | number | undefined;
295
+ to?: string | undefined;
296
+ gasPrice?: string | undefined;
297
+ data?: string | undefined;
298
+ value?: string | undefined;
299
+ gas?: string | undefined;
300
+ maxFeePerGas?: string | undefined;
301
+ maxPriorityFeePerGas?: string | undefined;
302
+ nonce?: string | undefined;
303
+ }[]]>, [{
304
+ from: string;
305
+ chainId?: string | number | undefined;
306
+ to?: string | undefined;
307
+ gasPrice?: string | undefined;
308
+ data?: string | undefined;
309
+ value?: string | undefined;
310
+ gas?: string | undefined;
311
+ maxFeePerGas?: string | undefined;
312
+ maxPriorityFeePerGas?: string | undefined;
313
+ nonce?: string | undefined;
314
+ }, {
315
+ from: string;
316
+ chainId?: string | number | undefined;
317
+ to?: string | undefined;
318
+ gasPrice?: string | undefined;
319
+ data?: string | undefined;
320
+ value?: string | undefined;
321
+ gas?: string | undefined;
322
+ maxFeePerGas?: string | undefined;
323
+ maxPriorityFeePerGas?: string | undefined;
324
+ nonce?: string | undefined;
325
+ }, ...{
326
+ from: string;
327
+ chainId?: string | number | undefined;
328
+ to?: string | undefined;
329
+ gasPrice?: string | undefined;
330
+ data?: string | undefined;
331
+ value?: string | undefined;
332
+ gas?: string | undefined;
333
+ maxFeePerGas?: string | undefined;
334
+ maxPriorityFeePerGas?: string | undefined;
335
+ nonce?: string | undefined;
336
+ }[]], [{
337
+ from: string;
338
+ chainId?: string | number | undefined;
339
+ to?: string | undefined;
340
+ gasPrice?: string | undefined;
341
+ data?: string | undefined;
342
+ value?: string | undefined;
343
+ gas?: string | undefined;
344
+ maxFeePerGas?: string | undefined;
345
+ maxPriorityFeePerGas?: string | undefined;
346
+ nonce?: string | undefined;
347
+ }, {
348
+ from: string;
349
+ chainId?: string | number | undefined;
350
+ to?: string | undefined;
351
+ gasPrice?: string | undefined;
352
+ data?: string | undefined;
353
+ value?: string | undefined;
354
+ gas?: string | undefined;
355
+ maxFeePerGas?: string | undefined;
356
+ maxPriorityFeePerGas?: string | undefined;
357
+ nonce?: string | undefined;
358
+ }, ...{
359
+ from: string;
360
+ chainId?: string | number | undefined;
361
+ to?: string | undefined;
362
+ gasPrice?: string | undefined;
363
+ data?: string | undefined;
364
+ value?: string | undefined;
365
+ gas?: string | undefined;
366
+ maxFeePerGas?: string | undefined;
367
+ maxPriorityFeePerGas?: string | undefined;
368
+ nonce?: string | undefined;
369
+ }[]]>;
370
+
31
371
  declare const NonContractCallTypes: TransactionType[];
32
- type TransactionParams = {
33
- from: string;
34
- to?: string;
35
- data?: string;
36
- value?: string;
37
- gas?: string;
38
- gasPrice?: string;
39
- maxFeePerGas?: string;
40
- maxPriorityFeePerGas?: string;
41
- nonce?: string;
42
- chainId?: string | number;
43
- };
372
+ type TransactionParams = z.infer<typeof transactionSchema>;
44
373
  type RequiredBy<T, K extends keyof T> = T & Required<Pick<T, K>>;
374
+ type TransactionBatchParams = typeof transactionBatchSchema._type;
45
375
  declare enum ERC20TransactionType {
46
376
  TOTAL_SUPPLY = "totalSupply",
47
377
  BALANCE_OF = "balanceOf",
@@ -87,4 +417,4 @@ declare function addIdToPromise<T>(promise: Promise<T>, id: string): Promise<IdP
87
417
  */
88
418
  declare function settleAllIdPromises<T>(promises: Promise<IdPromise<T>>[]): Promise<Record<Id, T | Error>>;
89
419
 
90
- export { ERC20TransactionType, EvmModule, IdPromise, NonContractCallTypes, RequiredBy, TransactionParams, addIdToPromise, isTypedData, isTypedDataV1, settleAllIdPromises };
420
+ export { ERC20TransactionType, EvmModule, IdPromise, NonContractCallTypes, RequiredBy, TransactionBatchParams, TransactionParams, addIdToPromise, isTypedData, isTypedDataV1, settleAllIdPromises };