@awarizon/web3 1.0.2 → 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.mts +608 -1
- package/dist/index.d.ts +608 -1
- package/dist/index.js +134 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -77,6 +77,543 @@ interface SDKWalletInfo {
|
|
|
77
77
|
chain: Chain;
|
|
78
78
|
isExternal: boolean;
|
|
79
79
|
}
|
|
80
|
+
interface ContractRegistryEntry {
|
|
81
|
+
address: Address;
|
|
82
|
+
abi: Abi;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
declare const ERC20_ABI: readonly [{
|
|
86
|
+
readonly type: "event";
|
|
87
|
+
readonly name: "Approval";
|
|
88
|
+
readonly inputs: readonly [{
|
|
89
|
+
readonly indexed: true;
|
|
90
|
+
readonly name: "owner";
|
|
91
|
+
readonly type: "address";
|
|
92
|
+
}, {
|
|
93
|
+
readonly indexed: true;
|
|
94
|
+
readonly name: "spender";
|
|
95
|
+
readonly type: "address";
|
|
96
|
+
}, {
|
|
97
|
+
readonly indexed: false;
|
|
98
|
+
readonly name: "value";
|
|
99
|
+
readonly type: "uint256";
|
|
100
|
+
}];
|
|
101
|
+
}, {
|
|
102
|
+
readonly type: "event";
|
|
103
|
+
readonly name: "Transfer";
|
|
104
|
+
readonly inputs: readonly [{
|
|
105
|
+
readonly indexed: true;
|
|
106
|
+
readonly name: "from";
|
|
107
|
+
readonly type: "address";
|
|
108
|
+
}, {
|
|
109
|
+
readonly indexed: true;
|
|
110
|
+
readonly name: "to";
|
|
111
|
+
readonly type: "address";
|
|
112
|
+
}, {
|
|
113
|
+
readonly indexed: false;
|
|
114
|
+
readonly name: "value";
|
|
115
|
+
readonly type: "uint256";
|
|
116
|
+
}];
|
|
117
|
+
}, {
|
|
118
|
+
readonly type: "function";
|
|
119
|
+
readonly name: "allowance";
|
|
120
|
+
readonly stateMutability: "view";
|
|
121
|
+
readonly inputs: readonly [{
|
|
122
|
+
readonly name: "owner";
|
|
123
|
+
readonly type: "address";
|
|
124
|
+
}, {
|
|
125
|
+
readonly name: "spender";
|
|
126
|
+
readonly type: "address";
|
|
127
|
+
}];
|
|
128
|
+
readonly outputs: readonly [{
|
|
129
|
+
readonly type: "uint256";
|
|
130
|
+
}];
|
|
131
|
+
}, {
|
|
132
|
+
readonly type: "function";
|
|
133
|
+
readonly name: "approve";
|
|
134
|
+
readonly stateMutability: "nonpayable";
|
|
135
|
+
readonly inputs: readonly [{
|
|
136
|
+
readonly name: "spender";
|
|
137
|
+
readonly type: "address";
|
|
138
|
+
}, {
|
|
139
|
+
readonly name: "amount";
|
|
140
|
+
readonly type: "uint256";
|
|
141
|
+
}];
|
|
142
|
+
readonly outputs: readonly [{
|
|
143
|
+
readonly type: "bool";
|
|
144
|
+
}];
|
|
145
|
+
}, {
|
|
146
|
+
readonly type: "function";
|
|
147
|
+
readonly name: "balanceOf";
|
|
148
|
+
readonly stateMutability: "view";
|
|
149
|
+
readonly inputs: readonly [{
|
|
150
|
+
readonly name: "account";
|
|
151
|
+
readonly type: "address";
|
|
152
|
+
}];
|
|
153
|
+
readonly outputs: readonly [{
|
|
154
|
+
readonly type: "uint256";
|
|
155
|
+
}];
|
|
156
|
+
}, {
|
|
157
|
+
readonly type: "function";
|
|
158
|
+
readonly name: "decimals";
|
|
159
|
+
readonly stateMutability: "view";
|
|
160
|
+
readonly inputs: readonly [];
|
|
161
|
+
readonly outputs: readonly [{
|
|
162
|
+
readonly type: "uint8";
|
|
163
|
+
}];
|
|
164
|
+
}, {
|
|
165
|
+
readonly type: "function";
|
|
166
|
+
readonly name: "name";
|
|
167
|
+
readonly stateMutability: "view";
|
|
168
|
+
readonly inputs: readonly [];
|
|
169
|
+
readonly outputs: readonly [{
|
|
170
|
+
readonly type: "string";
|
|
171
|
+
}];
|
|
172
|
+
}, {
|
|
173
|
+
readonly type: "function";
|
|
174
|
+
readonly name: "symbol";
|
|
175
|
+
readonly stateMutability: "view";
|
|
176
|
+
readonly inputs: readonly [];
|
|
177
|
+
readonly outputs: readonly [{
|
|
178
|
+
readonly type: "string";
|
|
179
|
+
}];
|
|
180
|
+
}, {
|
|
181
|
+
readonly type: "function";
|
|
182
|
+
readonly name: "totalSupply";
|
|
183
|
+
readonly stateMutability: "view";
|
|
184
|
+
readonly inputs: readonly [];
|
|
185
|
+
readonly outputs: readonly [{
|
|
186
|
+
readonly type: "uint256";
|
|
187
|
+
}];
|
|
188
|
+
}, {
|
|
189
|
+
readonly type: "function";
|
|
190
|
+
readonly name: "transfer";
|
|
191
|
+
readonly stateMutability: "nonpayable";
|
|
192
|
+
readonly inputs: readonly [{
|
|
193
|
+
readonly name: "recipient";
|
|
194
|
+
readonly type: "address";
|
|
195
|
+
}, {
|
|
196
|
+
readonly name: "amount";
|
|
197
|
+
readonly type: "uint256";
|
|
198
|
+
}];
|
|
199
|
+
readonly outputs: readonly [{
|
|
200
|
+
readonly type: "bool";
|
|
201
|
+
}];
|
|
202
|
+
}, {
|
|
203
|
+
readonly type: "function";
|
|
204
|
+
readonly name: "transferFrom";
|
|
205
|
+
readonly stateMutability: "nonpayable";
|
|
206
|
+
readonly inputs: readonly [{
|
|
207
|
+
readonly name: "sender";
|
|
208
|
+
readonly type: "address";
|
|
209
|
+
}, {
|
|
210
|
+
readonly name: "recipient";
|
|
211
|
+
readonly type: "address";
|
|
212
|
+
}, {
|
|
213
|
+
readonly name: "amount";
|
|
214
|
+
readonly type: "uint256";
|
|
215
|
+
}];
|
|
216
|
+
readonly outputs: readonly [{
|
|
217
|
+
readonly type: "bool";
|
|
218
|
+
}];
|
|
219
|
+
}];
|
|
220
|
+
interface Erc20Contract {
|
|
221
|
+
name(): Promise<string>;
|
|
222
|
+
symbol(): Promise<string>;
|
|
223
|
+
decimals(): Promise<number>;
|
|
224
|
+
totalSupply(): Promise<bigint>;
|
|
225
|
+
balanceOf(owner: Address): Promise<bigint>;
|
|
226
|
+
allowance(owner: Address, spender: Address): Promise<bigint>;
|
|
227
|
+
transfer(to: Address, amount: bigint): Promise<TransactionResult>;
|
|
228
|
+
transferFrom(from: Address, to: Address, amount: bigint): Promise<TransactionResult>;
|
|
229
|
+
approve(spender: Address, amount: bigint): Promise<TransactionResult>;
|
|
230
|
+
on: ContractInstance['on'];
|
|
231
|
+
estimateGas: ContractInstance['estimateGas'];
|
|
232
|
+
readonly _address: Address;
|
|
233
|
+
readonly _abi: Abi;
|
|
234
|
+
}
|
|
235
|
+
declare const ERC721_ABI: readonly [{
|
|
236
|
+
readonly type: "function";
|
|
237
|
+
readonly name: "name";
|
|
238
|
+
readonly stateMutability: "view";
|
|
239
|
+
readonly inputs: readonly [];
|
|
240
|
+
readonly outputs: readonly [{
|
|
241
|
+
readonly type: "string";
|
|
242
|
+
}];
|
|
243
|
+
}, {
|
|
244
|
+
readonly type: "function";
|
|
245
|
+
readonly name: "symbol";
|
|
246
|
+
readonly stateMutability: "view";
|
|
247
|
+
readonly inputs: readonly [];
|
|
248
|
+
readonly outputs: readonly [{
|
|
249
|
+
readonly type: "string";
|
|
250
|
+
}];
|
|
251
|
+
}, {
|
|
252
|
+
readonly type: "function";
|
|
253
|
+
readonly name: "tokenURI";
|
|
254
|
+
readonly stateMutability: "view";
|
|
255
|
+
readonly inputs: readonly [{
|
|
256
|
+
readonly name: "tokenId";
|
|
257
|
+
readonly type: "uint256";
|
|
258
|
+
}];
|
|
259
|
+
readonly outputs: readonly [{
|
|
260
|
+
readonly type: "string";
|
|
261
|
+
}];
|
|
262
|
+
}, {
|
|
263
|
+
readonly type: "function";
|
|
264
|
+
readonly name: "totalSupply";
|
|
265
|
+
readonly stateMutability: "view";
|
|
266
|
+
readonly inputs: readonly [];
|
|
267
|
+
readonly outputs: readonly [{
|
|
268
|
+
readonly type: "uint256";
|
|
269
|
+
}];
|
|
270
|
+
}, {
|
|
271
|
+
readonly type: "function";
|
|
272
|
+
readonly name: "ownerOf";
|
|
273
|
+
readonly stateMutability: "view";
|
|
274
|
+
readonly inputs: readonly [{
|
|
275
|
+
readonly name: "tokenId";
|
|
276
|
+
readonly type: "uint256";
|
|
277
|
+
}];
|
|
278
|
+
readonly outputs: readonly [{
|
|
279
|
+
readonly type: "address";
|
|
280
|
+
}];
|
|
281
|
+
}, {
|
|
282
|
+
readonly type: "function";
|
|
283
|
+
readonly name: "balanceOf";
|
|
284
|
+
readonly stateMutability: "view";
|
|
285
|
+
readonly inputs: readonly [{
|
|
286
|
+
readonly name: "owner";
|
|
287
|
+
readonly type: "address";
|
|
288
|
+
}];
|
|
289
|
+
readonly outputs: readonly [{
|
|
290
|
+
readonly type: "uint256";
|
|
291
|
+
}];
|
|
292
|
+
}, {
|
|
293
|
+
readonly type: "function";
|
|
294
|
+
readonly name: "getApproved";
|
|
295
|
+
readonly stateMutability: "view";
|
|
296
|
+
readonly inputs: readonly [{
|
|
297
|
+
readonly name: "tokenId";
|
|
298
|
+
readonly type: "uint256";
|
|
299
|
+
}];
|
|
300
|
+
readonly outputs: readonly [{
|
|
301
|
+
readonly type: "address";
|
|
302
|
+
}];
|
|
303
|
+
}, {
|
|
304
|
+
readonly type: "function";
|
|
305
|
+
readonly name: "isApprovedForAll";
|
|
306
|
+
readonly stateMutability: "view";
|
|
307
|
+
readonly inputs: readonly [{
|
|
308
|
+
readonly name: "owner";
|
|
309
|
+
readonly type: "address";
|
|
310
|
+
}, {
|
|
311
|
+
readonly name: "operator";
|
|
312
|
+
readonly type: "address";
|
|
313
|
+
}];
|
|
314
|
+
readonly outputs: readonly [{
|
|
315
|
+
readonly type: "bool";
|
|
316
|
+
}];
|
|
317
|
+
}, {
|
|
318
|
+
readonly type: "function";
|
|
319
|
+
readonly name: "transferFrom";
|
|
320
|
+
readonly stateMutability: "nonpayable";
|
|
321
|
+
readonly inputs: readonly [{
|
|
322
|
+
readonly name: "from";
|
|
323
|
+
readonly type: "address";
|
|
324
|
+
}, {
|
|
325
|
+
readonly name: "to";
|
|
326
|
+
readonly type: "address";
|
|
327
|
+
}, {
|
|
328
|
+
readonly name: "tokenId";
|
|
329
|
+
readonly type: "uint256";
|
|
330
|
+
}];
|
|
331
|
+
readonly outputs: readonly [];
|
|
332
|
+
}, {
|
|
333
|
+
readonly type: "function";
|
|
334
|
+
readonly name: "safeTransferFrom";
|
|
335
|
+
readonly stateMutability: "nonpayable";
|
|
336
|
+
readonly inputs: readonly [{
|
|
337
|
+
readonly name: "from";
|
|
338
|
+
readonly type: "address";
|
|
339
|
+
}, {
|
|
340
|
+
readonly name: "to";
|
|
341
|
+
readonly type: "address";
|
|
342
|
+
}, {
|
|
343
|
+
readonly name: "tokenId";
|
|
344
|
+
readonly type: "uint256";
|
|
345
|
+
}];
|
|
346
|
+
readonly outputs: readonly [];
|
|
347
|
+
}, {
|
|
348
|
+
readonly type: "function";
|
|
349
|
+
readonly name: "approve";
|
|
350
|
+
readonly stateMutability: "nonpayable";
|
|
351
|
+
readonly inputs: readonly [{
|
|
352
|
+
readonly name: "to";
|
|
353
|
+
readonly type: "address";
|
|
354
|
+
}, {
|
|
355
|
+
readonly name: "tokenId";
|
|
356
|
+
readonly type: "uint256";
|
|
357
|
+
}];
|
|
358
|
+
readonly outputs: readonly [];
|
|
359
|
+
}, {
|
|
360
|
+
readonly type: "function";
|
|
361
|
+
readonly name: "setApprovalForAll";
|
|
362
|
+
readonly stateMutability: "nonpayable";
|
|
363
|
+
readonly inputs: readonly [{
|
|
364
|
+
readonly name: "operator";
|
|
365
|
+
readonly type: "address";
|
|
366
|
+
}, {
|
|
367
|
+
readonly name: "approved";
|
|
368
|
+
readonly type: "bool";
|
|
369
|
+
}];
|
|
370
|
+
readonly outputs: readonly [];
|
|
371
|
+
}, {
|
|
372
|
+
readonly type: "event";
|
|
373
|
+
readonly name: "Transfer";
|
|
374
|
+
readonly inputs: readonly [{
|
|
375
|
+
readonly indexed: true;
|
|
376
|
+
readonly name: "from";
|
|
377
|
+
readonly type: "address";
|
|
378
|
+
}, {
|
|
379
|
+
readonly indexed: true;
|
|
380
|
+
readonly name: "to";
|
|
381
|
+
readonly type: "address";
|
|
382
|
+
}, {
|
|
383
|
+
readonly indexed: true;
|
|
384
|
+
readonly name: "tokenId";
|
|
385
|
+
readonly type: "uint256";
|
|
386
|
+
}];
|
|
387
|
+
}, {
|
|
388
|
+
readonly type: "event";
|
|
389
|
+
readonly name: "Approval";
|
|
390
|
+
readonly inputs: readonly [{
|
|
391
|
+
readonly indexed: true;
|
|
392
|
+
readonly name: "owner";
|
|
393
|
+
readonly type: "address";
|
|
394
|
+
}, {
|
|
395
|
+
readonly indexed: true;
|
|
396
|
+
readonly name: "approved";
|
|
397
|
+
readonly type: "address";
|
|
398
|
+
}, {
|
|
399
|
+
readonly indexed: true;
|
|
400
|
+
readonly name: "tokenId";
|
|
401
|
+
readonly type: "uint256";
|
|
402
|
+
}];
|
|
403
|
+
}, {
|
|
404
|
+
readonly type: "event";
|
|
405
|
+
readonly name: "ApprovalForAll";
|
|
406
|
+
readonly inputs: readonly [{
|
|
407
|
+
readonly indexed: true;
|
|
408
|
+
readonly name: "owner";
|
|
409
|
+
readonly type: "address";
|
|
410
|
+
}, {
|
|
411
|
+
readonly indexed: true;
|
|
412
|
+
readonly name: "operator";
|
|
413
|
+
readonly type: "address";
|
|
414
|
+
}, {
|
|
415
|
+
readonly name: "approved";
|
|
416
|
+
readonly type: "bool";
|
|
417
|
+
}];
|
|
418
|
+
}];
|
|
419
|
+
interface Erc721Contract {
|
|
420
|
+
name(): Promise<string>;
|
|
421
|
+
symbol(): Promise<string>;
|
|
422
|
+
tokenURI(tokenId: bigint): Promise<string>;
|
|
423
|
+
totalSupply(): Promise<bigint>;
|
|
424
|
+
ownerOf(tokenId: bigint): Promise<Address>;
|
|
425
|
+
balanceOf(owner: Address): Promise<bigint>;
|
|
426
|
+
getApproved(tokenId: bigint): Promise<Address>;
|
|
427
|
+
isApprovedForAll(owner: Address, operator: Address): Promise<boolean>;
|
|
428
|
+
transferFrom(from: Address, to: Address, tokenId: bigint): Promise<TransactionResult>;
|
|
429
|
+
safeTransferFrom(from: Address, to: Address, tokenId: bigint): Promise<TransactionResult>;
|
|
430
|
+
approve(to: Address, tokenId: bigint): Promise<TransactionResult>;
|
|
431
|
+
setApprovalForAll(operator: Address, approved: boolean): Promise<TransactionResult>;
|
|
432
|
+
on: ContractInstance['on'];
|
|
433
|
+
estimateGas: ContractInstance['estimateGas'];
|
|
434
|
+
readonly _address: Address;
|
|
435
|
+
readonly _abi: Abi;
|
|
436
|
+
}
|
|
437
|
+
declare const ERC1155_ABI: readonly [{
|
|
438
|
+
readonly type: "function";
|
|
439
|
+
readonly name: "uri";
|
|
440
|
+
readonly stateMutability: "view";
|
|
441
|
+
readonly inputs: readonly [{
|
|
442
|
+
readonly name: "id";
|
|
443
|
+
readonly type: "uint256";
|
|
444
|
+
}];
|
|
445
|
+
readonly outputs: readonly [{
|
|
446
|
+
readonly type: "string";
|
|
447
|
+
}];
|
|
448
|
+
}, {
|
|
449
|
+
readonly type: "function";
|
|
450
|
+
readonly name: "balanceOf";
|
|
451
|
+
readonly stateMutability: "view";
|
|
452
|
+
readonly inputs: readonly [{
|
|
453
|
+
readonly name: "account";
|
|
454
|
+
readonly type: "address";
|
|
455
|
+
}, {
|
|
456
|
+
readonly name: "id";
|
|
457
|
+
readonly type: "uint256";
|
|
458
|
+
}];
|
|
459
|
+
readonly outputs: readonly [{
|
|
460
|
+
readonly type: "uint256";
|
|
461
|
+
}];
|
|
462
|
+
}, {
|
|
463
|
+
readonly type: "function";
|
|
464
|
+
readonly name: "balanceOfBatch";
|
|
465
|
+
readonly stateMutability: "view";
|
|
466
|
+
readonly inputs: readonly [{
|
|
467
|
+
readonly name: "accounts";
|
|
468
|
+
readonly type: "address[]";
|
|
469
|
+
}, {
|
|
470
|
+
readonly name: "ids";
|
|
471
|
+
readonly type: "uint256[]";
|
|
472
|
+
}];
|
|
473
|
+
readonly outputs: readonly [{
|
|
474
|
+
readonly type: "uint256[]";
|
|
475
|
+
}];
|
|
476
|
+
}, {
|
|
477
|
+
readonly type: "function";
|
|
478
|
+
readonly name: "isApprovedForAll";
|
|
479
|
+
readonly stateMutability: "view";
|
|
480
|
+
readonly inputs: readonly [{
|
|
481
|
+
readonly name: "account";
|
|
482
|
+
readonly type: "address";
|
|
483
|
+
}, {
|
|
484
|
+
readonly name: "operator";
|
|
485
|
+
readonly type: "address";
|
|
486
|
+
}];
|
|
487
|
+
readonly outputs: readonly [{
|
|
488
|
+
readonly type: "bool";
|
|
489
|
+
}];
|
|
490
|
+
}, {
|
|
491
|
+
readonly type: "function";
|
|
492
|
+
readonly name: "setApprovalForAll";
|
|
493
|
+
readonly stateMutability: "nonpayable";
|
|
494
|
+
readonly inputs: readonly [{
|
|
495
|
+
readonly name: "operator";
|
|
496
|
+
readonly type: "address";
|
|
497
|
+
}, {
|
|
498
|
+
readonly name: "approved";
|
|
499
|
+
readonly type: "bool";
|
|
500
|
+
}];
|
|
501
|
+
readonly outputs: readonly [];
|
|
502
|
+
}, {
|
|
503
|
+
readonly type: "function";
|
|
504
|
+
readonly name: "safeTransferFrom";
|
|
505
|
+
readonly stateMutability: "nonpayable";
|
|
506
|
+
readonly inputs: readonly [{
|
|
507
|
+
readonly name: "from";
|
|
508
|
+
readonly type: "address";
|
|
509
|
+
}, {
|
|
510
|
+
readonly name: "to";
|
|
511
|
+
readonly type: "address";
|
|
512
|
+
}, {
|
|
513
|
+
readonly name: "id";
|
|
514
|
+
readonly type: "uint256";
|
|
515
|
+
}, {
|
|
516
|
+
readonly name: "amount";
|
|
517
|
+
readonly type: "uint256";
|
|
518
|
+
}, {
|
|
519
|
+
readonly name: "data";
|
|
520
|
+
readonly type: "bytes";
|
|
521
|
+
}];
|
|
522
|
+
readonly outputs: readonly [];
|
|
523
|
+
}, {
|
|
524
|
+
readonly type: "function";
|
|
525
|
+
readonly name: "safeBatchTransferFrom";
|
|
526
|
+
readonly stateMutability: "nonpayable";
|
|
527
|
+
readonly inputs: readonly [{
|
|
528
|
+
readonly name: "from";
|
|
529
|
+
readonly type: "address";
|
|
530
|
+
}, {
|
|
531
|
+
readonly name: "to";
|
|
532
|
+
readonly type: "address";
|
|
533
|
+
}, {
|
|
534
|
+
readonly name: "ids";
|
|
535
|
+
readonly type: "uint256[]";
|
|
536
|
+
}, {
|
|
537
|
+
readonly name: "amounts";
|
|
538
|
+
readonly type: "uint256[]";
|
|
539
|
+
}, {
|
|
540
|
+
readonly name: "data";
|
|
541
|
+
readonly type: "bytes";
|
|
542
|
+
}];
|
|
543
|
+
readonly outputs: readonly [];
|
|
544
|
+
}, {
|
|
545
|
+
readonly type: "event";
|
|
546
|
+
readonly name: "TransferSingle";
|
|
547
|
+
readonly inputs: readonly [{
|
|
548
|
+
readonly indexed: true;
|
|
549
|
+
readonly name: "operator";
|
|
550
|
+
readonly type: "address";
|
|
551
|
+
}, {
|
|
552
|
+
readonly indexed: true;
|
|
553
|
+
readonly name: "from";
|
|
554
|
+
readonly type: "address";
|
|
555
|
+
}, {
|
|
556
|
+
readonly indexed: true;
|
|
557
|
+
readonly name: "to";
|
|
558
|
+
readonly type: "address";
|
|
559
|
+
}, {
|
|
560
|
+
readonly name: "id";
|
|
561
|
+
readonly type: "uint256";
|
|
562
|
+
}, {
|
|
563
|
+
readonly name: "value";
|
|
564
|
+
readonly type: "uint256";
|
|
565
|
+
}];
|
|
566
|
+
}, {
|
|
567
|
+
readonly type: "event";
|
|
568
|
+
readonly name: "TransferBatch";
|
|
569
|
+
readonly inputs: readonly [{
|
|
570
|
+
readonly indexed: true;
|
|
571
|
+
readonly name: "operator";
|
|
572
|
+
readonly type: "address";
|
|
573
|
+
}, {
|
|
574
|
+
readonly indexed: true;
|
|
575
|
+
readonly name: "from";
|
|
576
|
+
readonly type: "address";
|
|
577
|
+
}, {
|
|
578
|
+
readonly indexed: true;
|
|
579
|
+
readonly name: "to";
|
|
580
|
+
readonly type: "address";
|
|
581
|
+
}, {
|
|
582
|
+
readonly name: "ids";
|
|
583
|
+
readonly type: "uint256[]";
|
|
584
|
+
}, {
|
|
585
|
+
readonly name: "values";
|
|
586
|
+
readonly type: "uint256[]";
|
|
587
|
+
}];
|
|
588
|
+
}, {
|
|
589
|
+
readonly type: "event";
|
|
590
|
+
readonly name: "ApprovalForAll";
|
|
591
|
+
readonly inputs: readonly [{
|
|
592
|
+
readonly indexed: true;
|
|
593
|
+
readonly name: "account";
|
|
594
|
+
readonly type: "address";
|
|
595
|
+
}, {
|
|
596
|
+
readonly indexed: true;
|
|
597
|
+
readonly name: "operator";
|
|
598
|
+
readonly type: "address";
|
|
599
|
+
}, {
|
|
600
|
+
readonly name: "approved";
|
|
601
|
+
readonly type: "bool";
|
|
602
|
+
}];
|
|
603
|
+
}];
|
|
604
|
+
interface Erc1155Contract {
|
|
605
|
+
uri(id: bigint): Promise<string>;
|
|
606
|
+
balanceOf(account: Address, id: bigint): Promise<bigint>;
|
|
607
|
+
balanceOfBatch(accounts: Address[], ids: bigint[]): Promise<bigint[]>;
|
|
608
|
+
isApprovedForAll(account: Address, operator: Address): Promise<boolean>;
|
|
609
|
+
setApprovalForAll(operator: Address, approved: boolean): Promise<TransactionResult>;
|
|
610
|
+
safeTransferFrom(from: Address, to: Address, id: bigint, amount: bigint, data: `0x${string}`): Promise<TransactionResult>;
|
|
611
|
+
safeBatchTransferFrom(from: Address, to: Address, ids: bigint[], amounts: bigint[], data: `0x${string}`): Promise<TransactionResult>;
|
|
612
|
+
on: ContractInstance['on'];
|
|
613
|
+
estimateGas: ContractInstance['estimateGas'];
|
|
614
|
+
readonly _address: Address;
|
|
615
|
+
readonly _abi: Abi;
|
|
616
|
+
}
|
|
80
617
|
|
|
81
618
|
declare class NetworkMismatchError extends Error {
|
|
82
619
|
readonly code: "NETWORK_MISMATCH";
|
|
@@ -155,6 +692,7 @@ declare class AwarizonWeb3 {
|
|
|
155
692
|
private readonly _txEngine;
|
|
156
693
|
private readonly _telemetry;
|
|
157
694
|
private _contractCache;
|
|
695
|
+
private _registry;
|
|
158
696
|
constructor(config: AwarizonConfig);
|
|
159
697
|
connectWallet(walletClient: WalletClient): this;
|
|
160
698
|
disconnectWallet(): this;
|
|
@@ -247,6 +785,75 @@ declare class AwarizonWeb3 {
|
|
|
247
785
|
method: string;
|
|
248
786
|
args?: unknown[];
|
|
249
787
|
}>): Promise<unknown[]>;
|
|
788
|
+
/**
|
|
789
|
+
* Load an ERC-20 token with fully typed methods — no ABI import needed.
|
|
790
|
+
*
|
|
791
|
+
* ```ts
|
|
792
|
+
* const token = await awarizon.erc20("0x...")
|
|
793
|
+
* const balance = await token.balanceOf(userAddress)
|
|
794
|
+
* const symbol = await token.symbol()
|
|
795
|
+
* await token.transfer(recipient, 100n)
|
|
796
|
+
* ```
|
|
797
|
+
*/
|
|
798
|
+
erc20(address: Address): Promise<Erc20Contract>;
|
|
799
|
+
/**
|
|
800
|
+
* Load an ERC-721 NFT contract with fully typed methods — no ABI import needed.
|
|
801
|
+
*
|
|
802
|
+
* ```ts
|
|
803
|
+
* const nft = await awarizon.erc721("0x...")
|
|
804
|
+
* const owner = await nft.ownerOf(1n)
|
|
805
|
+
* const uri = await nft.tokenURI(1n)
|
|
806
|
+
* await nft.transferFrom(from, to, 1n)
|
|
807
|
+
* ```
|
|
808
|
+
*/
|
|
809
|
+
erc721(address: Address): Promise<Erc721Contract>;
|
|
810
|
+
/**
|
|
811
|
+
* Load an ERC-1155 multi-token contract with fully typed methods — no ABI import needed.
|
|
812
|
+
*
|
|
813
|
+
* ```ts
|
|
814
|
+
* const items = await awarizon.erc1155("0x...")
|
|
815
|
+
* const balance = await items.balanceOf(userAddress, 42n)
|
|
816
|
+
* const uri = await items.uri(42n)
|
|
817
|
+
* await items.safeTransferFrom(from, to, 42n, 1n, "0x")
|
|
818
|
+
* ```
|
|
819
|
+
*/
|
|
820
|
+
erc1155(address: Address): Promise<Erc1155Contract>;
|
|
821
|
+
/**
|
|
822
|
+
* Register a contract under a human-readable name.
|
|
823
|
+
* After registering, use `awarizon.use(name)` anywhere instead of repeating
|
|
824
|
+
* address + ABI every time.
|
|
825
|
+
*
|
|
826
|
+
* ```ts
|
|
827
|
+
* awarizon.register("USDC", { address: "0x...", abi: erc20Abi })
|
|
828
|
+
* awarizon.register("Vault", { address: "0x...", abi: vaultAbi })
|
|
829
|
+
*
|
|
830
|
+
* const usdc = await awarizon.use("USDC")
|
|
831
|
+
* const vault = await awarizon.use("Vault")
|
|
832
|
+
* ```
|
|
833
|
+
*/
|
|
834
|
+
register(name: string, config: ContractRegistryEntry): this;
|
|
835
|
+
/**
|
|
836
|
+
* Retrieve a previously registered contract by name.
|
|
837
|
+
* Throws a descriptive error if the name was never registered.
|
|
838
|
+
*
|
|
839
|
+
* ```ts
|
|
840
|
+
* const usdc = await awarizon.use("USDC")
|
|
841
|
+
* await usdc.transfer(recipient, 100n)
|
|
842
|
+
* ```
|
|
843
|
+
*/
|
|
844
|
+
use(name: string): Promise<ContractInstance>;
|
|
845
|
+
/**
|
|
846
|
+
* Remove a registered contract from the registry.
|
|
847
|
+
*
|
|
848
|
+
* ```ts
|
|
849
|
+
* awarizon.unregister("USDC")
|
|
850
|
+
* ```
|
|
851
|
+
*/
|
|
852
|
+
unregister(name: string): this;
|
|
853
|
+
/**
|
|
854
|
+
* Return all registered contract names.
|
|
855
|
+
*/
|
|
856
|
+
registeredContracts(): string[];
|
|
250
857
|
get chainId(): number;
|
|
251
858
|
get isConnected(): boolean;
|
|
252
859
|
/**
|
|
@@ -327,4 +934,4 @@ declare class TelemetryClient {
|
|
|
327
934
|
private _flushBeacon;
|
|
328
935
|
}
|
|
329
936
|
|
|
330
|
-
export { ApiKeyRequiredError, type AwarizonConfig, AwarizonWeb3, CHAINS, type ContractConfig, type ContractInstance, ContractNotLoadedError, type EventUnsubscribe, InvalidApiKeyError, NetworkMismatchError, type PayableOptions, ProviderError, type SDKWalletInfo, TelemetryClient, type TelemetryEvent, type TelemetryEventType, UnsupportedChainError, getSupportedChainIds, resolveChain };
|
|
937
|
+
export { ApiKeyRequiredError, type AwarizonConfig, AwarizonWeb3, CHAINS, type ContractConfig, type ContractInstance, ContractNotLoadedError, type ContractRegistryEntry, ERC1155_ABI, ERC20_ABI, ERC721_ABI, type Erc1155Contract, type Erc20Contract, type Erc721Contract, type EventUnsubscribe, InvalidApiKeyError, NetworkMismatchError, type PayableOptions, ProviderError, type SDKWalletInfo, TelemetryClient, type TelemetryEvent, type TelemetryEventType, UnsupportedChainError, getSupportedChainIds, resolveChain };
|