@gitmyabi-stg/wtao 1.0.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/README.md +108 -0
- package/contracts/index.d.ts +2 -0
- package/contracts/index.js +7 -0
- package/contracts/index.ts +3 -0
- package/contracts/wTAO.d.ts +1394 -0
- package/contracts/wTAO.js +1465 -0
- package/contracts/wTAO.ts +1831 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/package.json +43 -0
|
@@ -0,0 +1,1831 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* wTAO ABI
|
|
6
|
+
*
|
|
7
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
8
|
+
*/
|
|
9
|
+
export const wTAOAbi = [
|
|
10
|
+
{
|
|
11
|
+
"inputs": [],
|
|
12
|
+
"stateMutability": "nonpayable",
|
|
13
|
+
"type": "constructor"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"anonymous": false,
|
|
17
|
+
"inputs": [
|
|
18
|
+
{
|
|
19
|
+
"indexed": true,
|
|
20
|
+
"internalType": "address",
|
|
21
|
+
"name": "owner",
|
|
22
|
+
"type": "address"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"indexed": true,
|
|
26
|
+
"internalType": "address",
|
|
27
|
+
"name": "spender",
|
|
28
|
+
"type": "address"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"indexed": false,
|
|
32
|
+
"internalType": "uint256",
|
|
33
|
+
"name": "value",
|
|
34
|
+
"type": "uint256"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"name": "Approval",
|
|
38
|
+
"type": "event"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"anonymous": false,
|
|
42
|
+
"inputs": [
|
|
43
|
+
{
|
|
44
|
+
"indexed": true,
|
|
45
|
+
"internalType": "address",
|
|
46
|
+
"name": "bridge",
|
|
47
|
+
"type": "address"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"name": "BridgeSet",
|
|
51
|
+
"type": "event"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"anonymous": false,
|
|
55
|
+
"inputs": [
|
|
56
|
+
{
|
|
57
|
+
"indexed": true,
|
|
58
|
+
"internalType": "address",
|
|
59
|
+
"name": "from",
|
|
60
|
+
"type": "address"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"indexed": false,
|
|
64
|
+
"internalType": "uint256",
|
|
65
|
+
"name": "amount",
|
|
66
|
+
"type": "uint256"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"indexed": false,
|
|
70
|
+
"internalType": "string",
|
|
71
|
+
"name": "to",
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"indexed": false,
|
|
76
|
+
"internalType": "uint256",
|
|
77
|
+
"name": "nonce",
|
|
78
|
+
"type": "uint256"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"name": "BridgedBack",
|
|
82
|
+
"type": "event"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"anonymous": false,
|
|
86
|
+
"inputs": [
|
|
87
|
+
{
|
|
88
|
+
"indexed": false,
|
|
89
|
+
"internalType": "string",
|
|
90
|
+
"name": "from",
|
|
91
|
+
"type": "string"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"indexed": true,
|
|
95
|
+
"internalType": "address",
|
|
96
|
+
"name": "to",
|
|
97
|
+
"type": "address"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"indexed": false,
|
|
101
|
+
"internalType": "uint256",
|
|
102
|
+
"name": "amount",
|
|
103
|
+
"type": "uint256"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"indexed": false,
|
|
107
|
+
"internalType": "uint256",
|
|
108
|
+
"name": "nonce",
|
|
109
|
+
"type": "uint256"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"name": "BridgedTo",
|
|
113
|
+
"type": "event"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"anonymous": false,
|
|
117
|
+
"inputs": [
|
|
118
|
+
{
|
|
119
|
+
"indexed": true,
|
|
120
|
+
"internalType": "address",
|
|
121
|
+
"name": "to",
|
|
122
|
+
"type": "address"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"indexed": false,
|
|
126
|
+
"internalType": "uint256",
|
|
127
|
+
"name": "amount",
|
|
128
|
+
"type": "uint256"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"name": "Mint",
|
|
132
|
+
"type": "event"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"anonymous": false,
|
|
136
|
+
"inputs": [
|
|
137
|
+
{
|
|
138
|
+
"indexed": true,
|
|
139
|
+
"internalType": "address",
|
|
140
|
+
"name": "previousOwner",
|
|
141
|
+
"type": "address"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"indexed": true,
|
|
145
|
+
"internalType": "address",
|
|
146
|
+
"name": "newOwner",
|
|
147
|
+
"type": "address"
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
"name": "OwnershipTransferred",
|
|
151
|
+
"type": "event"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"anonymous": false,
|
|
155
|
+
"inputs": [
|
|
156
|
+
{
|
|
157
|
+
"indexed": true,
|
|
158
|
+
"internalType": "bytes32",
|
|
159
|
+
"name": "role",
|
|
160
|
+
"type": "bytes32"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"indexed": true,
|
|
164
|
+
"internalType": "bytes32",
|
|
165
|
+
"name": "previousAdminRole",
|
|
166
|
+
"type": "bytes32"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"indexed": true,
|
|
170
|
+
"internalType": "bytes32",
|
|
171
|
+
"name": "newAdminRole",
|
|
172
|
+
"type": "bytes32"
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
"name": "RoleAdminChanged",
|
|
176
|
+
"type": "event"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"anonymous": false,
|
|
180
|
+
"inputs": [
|
|
181
|
+
{
|
|
182
|
+
"indexed": true,
|
|
183
|
+
"internalType": "bytes32",
|
|
184
|
+
"name": "role",
|
|
185
|
+
"type": "bytes32"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"indexed": true,
|
|
189
|
+
"internalType": "address",
|
|
190
|
+
"name": "account",
|
|
191
|
+
"type": "address"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"indexed": true,
|
|
195
|
+
"internalType": "address",
|
|
196
|
+
"name": "sender",
|
|
197
|
+
"type": "address"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"name": "RoleGranted",
|
|
201
|
+
"type": "event"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"anonymous": false,
|
|
205
|
+
"inputs": [
|
|
206
|
+
{
|
|
207
|
+
"indexed": true,
|
|
208
|
+
"internalType": "bytes32",
|
|
209
|
+
"name": "role",
|
|
210
|
+
"type": "bytes32"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"indexed": true,
|
|
214
|
+
"internalType": "address",
|
|
215
|
+
"name": "account",
|
|
216
|
+
"type": "address"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"indexed": true,
|
|
220
|
+
"internalType": "address",
|
|
221
|
+
"name": "sender",
|
|
222
|
+
"type": "address"
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
"name": "RoleRevoked",
|
|
226
|
+
"type": "event"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"anonymous": false,
|
|
230
|
+
"inputs": [
|
|
231
|
+
{
|
|
232
|
+
"indexed": true,
|
|
233
|
+
"internalType": "address",
|
|
234
|
+
"name": "from",
|
|
235
|
+
"type": "address"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"indexed": true,
|
|
239
|
+
"internalType": "address",
|
|
240
|
+
"name": "to",
|
|
241
|
+
"type": "address"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"indexed": false,
|
|
245
|
+
"internalType": "uint256",
|
|
246
|
+
"name": "value",
|
|
247
|
+
"type": "uint256"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
"name": "Transfer",
|
|
251
|
+
"type": "event"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"inputs": [],
|
|
255
|
+
"name": "BITTENSOR_FEE",
|
|
256
|
+
"outputs": [
|
|
257
|
+
{
|
|
258
|
+
"internalType": "uint256",
|
|
259
|
+
"name": "",
|
|
260
|
+
"type": "uint256"
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
"stateMutability": "view",
|
|
264
|
+
"type": "function"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"inputs": [],
|
|
268
|
+
"name": "BRIDGE_ROLE",
|
|
269
|
+
"outputs": [
|
|
270
|
+
{
|
|
271
|
+
"internalType": "bytes32",
|
|
272
|
+
"name": "",
|
|
273
|
+
"type": "bytes32"
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"stateMutability": "view",
|
|
277
|
+
"type": "function"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"inputs": [],
|
|
281
|
+
"name": "DEFAULT_ADMIN_ROLE",
|
|
282
|
+
"outputs": [
|
|
283
|
+
{
|
|
284
|
+
"internalType": "bytes32",
|
|
285
|
+
"name": "",
|
|
286
|
+
"type": "bytes32"
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
"stateMutability": "view",
|
|
290
|
+
"type": "function"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"inputs": [],
|
|
294
|
+
"name": "_nonce",
|
|
295
|
+
"outputs": [
|
|
296
|
+
{
|
|
297
|
+
"internalType": "uint256",
|
|
298
|
+
"name": "",
|
|
299
|
+
"type": "uint256"
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
"stateMutability": "view",
|
|
303
|
+
"type": "function"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"inputs": [
|
|
307
|
+
{
|
|
308
|
+
"internalType": "address",
|
|
309
|
+
"name": "owner",
|
|
310
|
+
"type": "address"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"internalType": "address",
|
|
314
|
+
"name": "spender",
|
|
315
|
+
"type": "address"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"name": "allowance",
|
|
319
|
+
"outputs": [
|
|
320
|
+
{
|
|
321
|
+
"internalType": "uint256",
|
|
322
|
+
"name": "",
|
|
323
|
+
"type": "uint256"
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
"stateMutability": "view",
|
|
327
|
+
"type": "function"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"inputs": [
|
|
331
|
+
{
|
|
332
|
+
"internalType": "address",
|
|
333
|
+
"name": "spender",
|
|
334
|
+
"type": "address"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"internalType": "uint256",
|
|
338
|
+
"name": "amount",
|
|
339
|
+
"type": "uint256"
|
|
340
|
+
}
|
|
341
|
+
],
|
|
342
|
+
"name": "approve",
|
|
343
|
+
"outputs": [
|
|
344
|
+
{
|
|
345
|
+
"internalType": "bool",
|
|
346
|
+
"name": "",
|
|
347
|
+
"type": "bool"
|
|
348
|
+
}
|
|
349
|
+
],
|
|
350
|
+
"stateMutability": "nonpayable",
|
|
351
|
+
"type": "function"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"inputs": [
|
|
355
|
+
{
|
|
356
|
+
"internalType": "address",
|
|
357
|
+
"name": "account",
|
|
358
|
+
"type": "address"
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
"name": "balanceOf",
|
|
362
|
+
"outputs": [
|
|
363
|
+
{
|
|
364
|
+
"internalType": "uint256",
|
|
365
|
+
"name": "",
|
|
366
|
+
"type": "uint256"
|
|
367
|
+
}
|
|
368
|
+
],
|
|
369
|
+
"stateMutability": "view",
|
|
370
|
+
"type": "function"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"inputs": [
|
|
374
|
+
{
|
|
375
|
+
"internalType": "uint256",
|
|
376
|
+
"name": "_amount",
|
|
377
|
+
"type": "uint256"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"internalType": "string",
|
|
381
|
+
"name": "_to",
|
|
382
|
+
"type": "string"
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
"name": "bridgeBack",
|
|
386
|
+
"outputs": [
|
|
387
|
+
{
|
|
388
|
+
"internalType": "bool",
|
|
389
|
+
"name": "",
|
|
390
|
+
"type": "bool"
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
"stateMutability": "nonpayable",
|
|
394
|
+
"type": "function"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"inputs": [
|
|
398
|
+
{
|
|
399
|
+
"internalType": "string[]",
|
|
400
|
+
"name": "_froms",
|
|
401
|
+
"type": "string[]"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"internalType": "address[]",
|
|
405
|
+
"name": "_tos",
|
|
406
|
+
"type": "address[]"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"internalType": "uint256[]",
|
|
410
|
+
"name": "_amounts",
|
|
411
|
+
"type": "uint256[]"
|
|
412
|
+
}
|
|
413
|
+
],
|
|
414
|
+
"name": "bridgedTo",
|
|
415
|
+
"outputs": [
|
|
416
|
+
{
|
|
417
|
+
"internalType": "bool",
|
|
418
|
+
"name": "",
|
|
419
|
+
"type": "bool"
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
"stateMutability": "nonpayable",
|
|
423
|
+
"type": "function"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"inputs": [],
|
|
427
|
+
"name": "cumulative_bridged",
|
|
428
|
+
"outputs": [
|
|
429
|
+
{
|
|
430
|
+
"internalType": "uint256",
|
|
431
|
+
"name": "",
|
|
432
|
+
"type": "uint256"
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
"stateMutability": "view",
|
|
436
|
+
"type": "function"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"inputs": [],
|
|
440
|
+
"name": "cumulative_bridged_back",
|
|
441
|
+
"outputs": [
|
|
442
|
+
{
|
|
443
|
+
"internalType": "uint256",
|
|
444
|
+
"name": "",
|
|
445
|
+
"type": "uint256"
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
"stateMutability": "view",
|
|
449
|
+
"type": "function"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"inputs": [],
|
|
453
|
+
"name": "decimals",
|
|
454
|
+
"outputs": [
|
|
455
|
+
{
|
|
456
|
+
"internalType": "uint8",
|
|
457
|
+
"name": "",
|
|
458
|
+
"type": "uint8"
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
"stateMutability": "view",
|
|
462
|
+
"type": "function"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"inputs": [
|
|
466
|
+
{
|
|
467
|
+
"internalType": "address",
|
|
468
|
+
"name": "spender",
|
|
469
|
+
"type": "address"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"internalType": "uint256",
|
|
473
|
+
"name": "subtractedValue",
|
|
474
|
+
"type": "uint256"
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
"name": "decreaseAllowance",
|
|
478
|
+
"outputs": [
|
|
479
|
+
{
|
|
480
|
+
"internalType": "bool",
|
|
481
|
+
"name": "",
|
|
482
|
+
"type": "bool"
|
|
483
|
+
}
|
|
484
|
+
],
|
|
485
|
+
"stateMutability": "nonpayable",
|
|
486
|
+
"type": "function"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"inputs": [],
|
|
490
|
+
"name": "deployer",
|
|
491
|
+
"outputs": [
|
|
492
|
+
{
|
|
493
|
+
"internalType": "address",
|
|
494
|
+
"name": "",
|
|
495
|
+
"type": "address"
|
|
496
|
+
}
|
|
497
|
+
],
|
|
498
|
+
"stateMutability": "view",
|
|
499
|
+
"type": "function"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"inputs": [
|
|
503
|
+
{
|
|
504
|
+
"internalType": "bytes32",
|
|
505
|
+
"name": "role",
|
|
506
|
+
"type": "bytes32"
|
|
507
|
+
}
|
|
508
|
+
],
|
|
509
|
+
"name": "getRoleAdmin",
|
|
510
|
+
"outputs": [
|
|
511
|
+
{
|
|
512
|
+
"internalType": "bytes32",
|
|
513
|
+
"name": "",
|
|
514
|
+
"type": "bytes32"
|
|
515
|
+
}
|
|
516
|
+
],
|
|
517
|
+
"stateMutability": "view",
|
|
518
|
+
"type": "function"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"inputs": [
|
|
522
|
+
{
|
|
523
|
+
"internalType": "bytes32",
|
|
524
|
+
"name": "role",
|
|
525
|
+
"type": "bytes32"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"internalType": "address",
|
|
529
|
+
"name": "account",
|
|
530
|
+
"type": "address"
|
|
531
|
+
}
|
|
532
|
+
],
|
|
533
|
+
"name": "grantRole",
|
|
534
|
+
"outputs": [],
|
|
535
|
+
"stateMutability": "nonpayable",
|
|
536
|
+
"type": "function"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
"inputs": [
|
|
540
|
+
{
|
|
541
|
+
"internalType": "bytes32",
|
|
542
|
+
"name": "role",
|
|
543
|
+
"type": "bytes32"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"internalType": "address",
|
|
547
|
+
"name": "account",
|
|
548
|
+
"type": "address"
|
|
549
|
+
}
|
|
550
|
+
],
|
|
551
|
+
"name": "hasRole",
|
|
552
|
+
"outputs": [
|
|
553
|
+
{
|
|
554
|
+
"internalType": "bool",
|
|
555
|
+
"name": "",
|
|
556
|
+
"type": "bool"
|
|
557
|
+
}
|
|
558
|
+
],
|
|
559
|
+
"stateMutability": "view",
|
|
560
|
+
"type": "function"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"inputs": [
|
|
564
|
+
{
|
|
565
|
+
"internalType": "address",
|
|
566
|
+
"name": "spender",
|
|
567
|
+
"type": "address"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
"internalType": "uint256",
|
|
571
|
+
"name": "addedValue",
|
|
572
|
+
"type": "uint256"
|
|
573
|
+
}
|
|
574
|
+
],
|
|
575
|
+
"name": "increaseAllowance",
|
|
576
|
+
"outputs": [
|
|
577
|
+
{
|
|
578
|
+
"internalType": "bool",
|
|
579
|
+
"name": "",
|
|
580
|
+
"type": "bool"
|
|
581
|
+
}
|
|
582
|
+
],
|
|
583
|
+
"stateMutability": "nonpayable",
|
|
584
|
+
"type": "function"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"inputs": [],
|
|
588
|
+
"name": "name",
|
|
589
|
+
"outputs": [
|
|
590
|
+
{
|
|
591
|
+
"internalType": "string",
|
|
592
|
+
"name": "",
|
|
593
|
+
"type": "string"
|
|
594
|
+
}
|
|
595
|
+
],
|
|
596
|
+
"stateMutability": "view",
|
|
597
|
+
"type": "function"
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
"inputs": [],
|
|
601
|
+
"name": "owner",
|
|
602
|
+
"outputs": [
|
|
603
|
+
{
|
|
604
|
+
"internalType": "address",
|
|
605
|
+
"name": "",
|
|
606
|
+
"type": "address"
|
|
607
|
+
}
|
|
608
|
+
],
|
|
609
|
+
"stateMutability": "view",
|
|
610
|
+
"type": "function"
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
"inputs": [
|
|
614
|
+
{
|
|
615
|
+
"internalType": "address",
|
|
616
|
+
"name": "_token",
|
|
617
|
+
"type": "address"
|
|
618
|
+
}
|
|
619
|
+
],
|
|
620
|
+
"name": "reclaimToken",
|
|
621
|
+
"outputs": [],
|
|
622
|
+
"stateMutability": "nonpayable",
|
|
623
|
+
"type": "function"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
"inputs": [],
|
|
627
|
+
"name": "renounceOwnership",
|
|
628
|
+
"outputs": [],
|
|
629
|
+
"stateMutability": "nonpayable",
|
|
630
|
+
"type": "function"
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"inputs": [
|
|
634
|
+
{
|
|
635
|
+
"internalType": "bytes32",
|
|
636
|
+
"name": "role",
|
|
637
|
+
"type": "bytes32"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"internalType": "address",
|
|
641
|
+
"name": "account",
|
|
642
|
+
"type": "address"
|
|
643
|
+
}
|
|
644
|
+
],
|
|
645
|
+
"name": "renounceRole",
|
|
646
|
+
"outputs": [],
|
|
647
|
+
"stateMutability": "nonpayable",
|
|
648
|
+
"type": "function"
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
"inputs": [
|
|
652
|
+
{
|
|
653
|
+
"internalType": "bytes32",
|
|
654
|
+
"name": "role",
|
|
655
|
+
"type": "bytes32"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"internalType": "address",
|
|
659
|
+
"name": "account",
|
|
660
|
+
"type": "address"
|
|
661
|
+
}
|
|
662
|
+
],
|
|
663
|
+
"name": "revokeRole",
|
|
664
|
+
"outputs": [],
|
|
665
|
+
"stateMutability": "nonpayable",
|
|
666
|
+
"type": "function"
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"inputs": [
|
|
670
|
+
{
|
|
671
|
+
"internalType": "address",
|
|
672
|
+
"name": "_bridge",
|
|
673
|
+
"type": "address"
|
|
674
|
+
}
|
|
675
|
+
],
|
|
676
|
+
"name": "setBridge",
|
|
677
|
+
"outputs": [
|
|
678
|
+
{
|
|
679
|
+
"internalType": "bool",
|
|
680
|
+
"name": "",
|
|
681
|
+
"type": "bool"
|
|
682
|
+
}
|
|
683
|
+
],
|
|
684
|
+
"stateMutability": "nonpayable",
|
|
685
|
+
"type": "function"
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
"inputs": [
|
|
689
|
+
{
|
|
690
|
+
"internalType": "bytes4",
|
|
691
|
+
"name": "interfaceId",
|
|
692
|
+
"type": "bytes4"
|
|
693
|
+
}
|
|
694
|
+
],
|
|
695
|
+
"name": "supportsInterface",
|
|
696
|
+
"outputs": [
|
|
697
|
+
{
|
|
698
|
+
"internalType": "bool",
|
|
699
|
+
"name": "",
|
|
700
|
+
"type": "bool"
|
|
701
|
+
}
|
|
702
|
+
],
|
|
703
|
+
"stateMutability": "view",
|
|
704
|
+
"type": "function"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"inputs": [],
|
|
708
|
+
"name": "symbol",
|
|
709
|
+
"outputs": [
|
|
710
|
+
{
|
|
711
|
+
"internalType": "string",
|
|
712
|
+
"name": "",
|
|
713
|
+
"type": "string"
|
|
714
|
+
}
|
|
715
|
+
],
|
|
716
|
+
"stateMutability": "view",
|
|
717
|
+
"type": "function"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"inputs": [],
|
|
721
|
+
"name": "totalSupply",
|
|
722
|
+
"outputs": [
|
|
723
|
+
{
|
|
724
|
+
"internalType": "uint256",
|
|
725
|
+
"name": "",
|
|
726
|
+
"type": "uint256"
|
|
727
|
+
}
|
|
728
|
+
],
|
|
729
|
+
"stateMutability": "view",
|
|
730
|
+
"type": "function"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"inputs": [
|
|
734
|
+
{
|
|
735
|
+
"internalType": "address",
|
|
736
|
+
"name": "to",
|
|
737
|
+
"type": "address"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
"internalType": "uint256",
|
|
741
|
+
"name": "amount",
|
|
742
|
+
"type": "uint256"
|
|
743
|
+
}
|
|
744
|
+
],
|
|
745
|
+
"name": "transfer",
|
|
746
|
+
"outputs": [
|
|
747
|
+
{
|
|
748
|
+
"internalType": "bool",
|
|
749
|
+
"name": "",
|
|
750
|
+
"type": "bool"
|
|
751
|
+
}
|
|
752
|
+
],
|
|
753
|
+
"stateMutability": "nonpayable",
|
|
754
|
+
"type": "function"
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"inputs": [
|
|
758
|
+
{
|
|
759
|
+
"internalType": "address",
|
|
760
|
+
"name": "from",
|
|
761
|
+
"type": "address"
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"internalType": "address",
|
|
765
|
+
"name": "to",
|
|
766
|
+
"type": "address"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
"internalType": "uint256",
|
|
770
|
+
"name": "amount",
|
|
771
|
+
"type": "uint256"
|
|
772
|
+
}
|
|
773
|
+
],
|
|
774
|
+
"name": "transferFrom",
|
|
775
|
+
"outputs": [
|
|
776
|
+
{
|
|
777
|
+
"internalType": "bool",
|
|
778
|
+
"name": "",
|
|
779
|
+
"type": "bool"
|
|
780
|
+
}
|
|
781
|
+
],
|
|
782
|
+
"stateMutability": "nonpayable",
|
|
783
|
+
"type": "function"
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
"inputs": [
|
|
787
|
+
{
|
|
788
|
+
"internalType": "address",
|
|
789
|
+
"name": "newOwner",
|
|
790
|
+
"type": "address"
|
|
791
|
+
}
|
|
792
|
+
],
|
|
793
|
+
"name": "transferOwnership",
|
|
794
|
+
"outputs": [],
|
|
795
|
+
"stateMutability": "nonpayable",
|
|
796
|
+
"type": "function"
|
|
797
|
+
}
|
|
798
|
+
] as const satisfies Abi;
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Type-safe ABI for wTAO
|
|
802
|
+
*/
|
|
803
|
+
export type wTAOAbi = typeof wTAOAbi;
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Contract instance type for wTAO
|
|
807
|
+
*/
|
|
808
|
+
// Use any for contract type to avoid complex viem type issues
|
|
809
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
810
|
+
export type wTAOContract = any;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* wTAO Contract Class
|
|
814
|
+
*
|
|
815
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* ```typescript
|
|
819
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
820
|
+
* import { mainnet } from 'viem/chains';
|
|
821
|
+
* import { wTAO } from 'wTAO';
|
|
822
|
+
*
|
|
823
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
824
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
825
|
+
*
|
|
826
|
+
* const contract = new wTAO('0x...', { publicClient, walletClient });
|
|
827
|
+
*
|
|
828
|
+
* // Read functions
|
|
829
|
+
* const result = await contract.balanceOf('0x...');
|
|
830
|
+
*
|
|
831
|
+
* // Write functions
|
|
832
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
833
|
+
*
|
|
834
|
+
* // Simulate transactions (dry-run)
|
|
835
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
836
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
837
|
+
*
|
|
838
|
+
* // Watch events
|
|
839
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
840
|
+
* console.log('Transfer event:', event);
|
|
841
|
+
* });
|
|
842
|
+
* ```
|
|
843
|
+
*/
|
|
844
|
+
export class wTAO {
|
|
845
|
+
private contract: wTAOContract;
|
|
846
|
+
private contractAddress: Address;
|
|
847
|
+
private publicClient: PublicClient;
|
|
848
|
+
|
|
849
|
+
constructor(
|
|
850
|
+
address: Address,
|
|
851
|
+
clients: {
|
|
852
|
+
publicClient: PublicClient;
|
|
853
|
+
walletClient?: WalletClient;
|
|
854
|
+
}
|
|
855
|
+
) {
|
|
856
|
+
this.contractAddress = address;
|
|
857
|
+
this.publicClient = clients.publicClient;
|
|
858
|
+
this.contract = getContract({
|
|
859
|
+
address,
|
|
860
|
+
abi: wTAOAbi,
|
|
861
|
+
client: {
|
|
862
|
+
public: clients.publicClient,
|
|
863
|
+
wallet: clients.walletClient,
|
|
864
|
+
},
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Get the contract address
|
|
870
|
+
*/
|
|
871
|
+
get address(): Address {
|
|
872
|
+
return this.contractAddress;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Get the underlying viem contract instance.
|
|
877
|
+
*/
|
|
878
|
+
getContract(): wTAOContract {
|
|
879
|
+
return this.contract;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* BITTENSOR_FEE
|
|
884
|
+
* view
|
|
885
|
+
*/
|
|
886
|
+
async BITTENSOR_FEE(): Promise<bigint> {
|
|
887
|
+
return this.contract.read.BITTENSOR_FEE() as Promise<bigint>;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* BRIDGE_ROLE
|
|
892
|
+
* view
|
|
893
|
+
*/
|
|
894
|
+
async BRIDGE_ROLE(): Promise<`0x${string}`> {
|
|
895
|
+
return this.contract.read.BRIDGE_ROLE() as Promise<`0x${string}`>;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* DEFAULT_ADMIN_ROLE
|
|
900
|
+
* view
|
|
901
|
+
*/
|
|
902
|
+
async DEFAULT_ADMIN_ROLE(): Promise<`0x${string}`> {
|
|
903
|
+
return this.contract.read.DEFAULT_ADMIN_ROLE() as Promise<`0x${string}`>;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* _nonce
|
|
908
|
+
* view
|
|
909
|
+
*/
|
|
910
|
+
async _nonce(): Promise<bigint> {
|
|
911
|
+
return this.contract.read._nonce() as Promise<bigint>;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* allowance
|
|
916
|
+
* view
|
|
917
|
+
*/
|
|
918
|
+
async allowance(owner: `0x${string}`, spender: `0x${string}`): Promise<bigint> {
|
|
919
|
+
return this.contract.read.allowance([owner, spender] as const) as Promise<bigint>;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* balanceOf
|
|
924
|
+
* view
|
|
925
|
+
*/
|
|
926
|
+
async balanceOf(account: `0x${string}`): Promise<bigint> {
|
|
927
|
+
return this.contract.read.balanceOf([account] as const) as Promise<bigint>;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* cumulative_bridged
|
|
932
|
+
* view
|
|
933
|
+
*/
|
|
934
|
+
async cumulative_bridged(): Promise<bigint> {
|
|
935
|
+
return this.contract.read.cumulative_bridged() as Promise<bigint>;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* cumulative_bridged_back
|
|
940
|
+
* view
|
|
941
|
+
*/
|
|
942
|
+
async cumulative_bridged_back(): Promise<bigint> {
|
|
943
|
+
return this.contract.read.cumulative_bridged_back() as Promise<bigint>;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* decimals
|
|
948
|
+
* view
|
|
949
|
+
*/
|
|
950
|
+
async decimals(): Promise<bigint> {
|
|
951
|
+
return this.contract.read.decimals() as Promise<bigint>;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* deployer
|
|
956
|
+
* view
|
|
957
|
+
*/
|
|
958
|
+
async deployer(): Promise<`0x${string}`> {
|
|
959
|
+
return this.contract.read.deployer() as Promise<`0x${string}`>;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* getRoleAdmin
|
|
964
|
+
* view
|
|
965
|
+
*/
|
|
966
|
+
async getRoleAdmin(role: `0x${string}`): Promise<`0x${string}`> {
|
|
967
|
+
return this.contract.read.getRoleAdmin([role] as const) as Promise<`0x${string}`>;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* hasRole
|
|
972
|
+
* view
|
|
973
|
+
*/
|
|
974
|
+
async hasRole(role: `0x${string}`, account: `0x${string}`): Promise<boolean> {
|
|
975
|
+
return this.contract.read.hasRole([role, account] as const) as Promise<boolean>;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* name
|
|
980
|
+
* view
|
|
981
|
+
*/
|
|
982
|
+
async name(): Promise<string> {
|
|
983
|
+
return this.contract.read.name() as Promise<string>;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* owner
|
|
988
|
+
* view
|
|
989
|
+
*/
|
|
990
|
+
async owner(): Promise<`0x${string}`> {
|
|
991
|
+
return this.contract.read.owner() as Promise<`0x${string}`>;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* supportsInterface
|
|
996
|
+
* view
|
|
997
|
+
*/
|
|
998
|
+
async supportsInterface(interfaceId: `0x${string}`): Promise<boolean> {
|
|
999
|
+
return this.contract.read.supportsInterface([interfaceId] as const) as Promise<boolean>;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* symbol
|
|
1004
|
+
* view
|
|
1005
|
+
*/
|
|
1006
|
+
async symbol(): Promise<string> {
|
|
1007
|
+
return this.contract.read.symbol() as Promise<string>;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
/**
|
|
1011
|
+
* totalSupply
|
|
1012
|
+
* view
|
|
1013
|
+
*/
|
|
1014
|
+
async totalSupply(): Promise<bigint> {
|
|
1015
|
+
return this.contract.read.totalSupply() as Promise<bigint>;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* approve
|
|
1020
|
+
* nonpayable
|
|
1021
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1022
|
+
*/
|
|
1023
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
1024
|
+
accessList?: import('viem').AccessList;
|
|
1025
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1026
|
+
chain?: import('viem').Chain | null;
|
|
1027
|
+
dataSuffix?: `0x${string}`;
|
|
1028
|
+
gas?: bigint;
|
|
1029
|
+
gasPrice?: bigint;
|
|
1030
|
+
maxFeePerGas?: bigint;
|
|
1031
|
+
maxPriorityFeePerGas?: bigint;
|
|
1032
|
+
nonce?: number;
|
|
1033
|
+
value?: bigint;
|
|
1034
|
+
}): Promise<`0x${string}`> {
|
|
1035
|
+
if (!this.contract.write) {
|
|
1036
|
+
throw new Error('Wallet client is required for write operations');
|
|
1037
|
+
}
|
|
1038
|
+
return this.contract.write.approve([spender, amount] as const, options) as Promise<`0x${string}`>;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* bridgeBack
|
|
1043
|
+
* nonpayable
|
|
1044
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1045
|
+
*/
|
|
1046
|
+
async bridgeBack(_amount: bigint, _to: string, options?: {
|
|
1047
|
+
accessList?: import('viem').AccessList;
|
|
1048
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1049
|
+
chain?: import('viem').Chain | null;
|
|
1050
|
+
dataSuffix?: `0x${string}`;
|
|
1051
|
+
gas?: bigint;
|
|
1052
|
+
gasPrice?: bigint;
|
|
1053
|
+
maxFeePerGas?: bigint;
|
|
1054
|
+
maxPriorityFeePerGas?: bigint;
|
|
1055
|
+
nonce?: number;
|
|
1056
|
+
value?: bigint;
|
|
1057
|
+
}): Promise<`0x${string}`> {
|
|
1058
|
+
if (!this.contract.write) {
|
|
1059
|
+
throw new Error('Wallet client is required for write operations');
|
|
1060
|
+
}
|
|
1061
|
+
return this.contract.write.bridgeBack([_amount, _to] as const, options) as Promise<`0x${string}`>;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* bridgedTo
|
|
1066
|
+
* nonpayable
|
|
1067
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1068
|
+
*/
|
|
1069
|
+
async bridgedTo(_froms: string[], _tos: `0x${string}`[], _amounts: bigint[], options?: {
|
|
1070
|
+
accessList?: import('viem').AccessList;
|
|
1071
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1072
|
+
chain?: import('viem').Chain | null;
|
|
1073
|
+
dataSuffix?: `0x${string}`;
|
|
1074
|
+
gas?: bigint;
|
|
1075
|
+
gasPrice?: bigint;
|
|
1076
|
+
maxFeePerGas?: bigint;
|
|
1077
|
+
maxPriorityFeePerGas?: bigint;
|
|
1078
|
+
nonce?: number;
|
|
1079
|
+
value?: bigint;
|
|
1080
|
+
}): Promise<`0x${string}`> {
|
|
1081
|
+
if (!this.contract.write) {
|
|
1082
|
+
throw new Error('Wallet client is required for write operations');
|
|
1083
|
+
}
|
|
1084
|
+
return this.contract.write.bridgedTo([_froms, _tos, _amounts] as const, options) as Promise<`0x${string}`>;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* decreaseAllowance
|
|
1089
|
+
* nonpayable
|
|
1090
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1091
|
+
*/
|
|
1092
|
+
async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
|
|
1093
|
+
accessList?: import('viem').AccessList;
|
|
1094
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1095
|
+
chain?: import('viem').Chain | null;
|
|
1096
|
+
dataSuffix?: `0x${string}`;
|
|
1097
|
+
gas?: bigint;
|
|
1098
|
+
gasPrice?: bigint;
|
|
1099
|
+
maxFeePerGas?: bigint;
|
|
1100
|
+
maxPriorityFeePerGas?: bigint;
|
|
1101
|
+
nonce?: number;
|
|
1102
|
+
value?: bigint;
|
|
1103
|
+
}): Promise<`0x${string}`> {
|
|
1104
|
+
if (!this.contract.write) {
|
|
1105
|
+
throw new Error('Wallet client is required for write operations');
|
|
1106
|
+
}
|
|
1107
|
+
return this.contract.write.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<`0x${string}`>;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* grantRole
|
|
1112
|
+
* nonpayable
|
|
1113
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1114
|
+
*/
|
|
1115
|
+
async grantRole(role: `0x${string}`, account: `0x${string}`, options?: {
|
|
1116
|
+
accessList?: import('viem').AccessList;
|
|
1117
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1118
|
+
chain?: import('viem').Chain | null;
|
|
1119
|
+
dataSuffix?: `0x${string}`;
|
|
1120
|
+
gas?: bigint;
|
|
1121
|
+
gasPrice?: bigint;
|
|
1122
|
+
maxFeePerGas?: bigint;
|
|
1123
|
+
maxPriorityFeePerGas?: bigint;
|
|
1124
|
+
nonce?: number;
|
|
1125
|
+
value?: bigint;
|
|
1126
|
+
}): Promise<`0x${string}`> {
|
|
1127
|
+
if (!this.contract.write) {
|
|
1128
|
+
throw new Error('Wallet client is required for write operations');
|
|
1129
|
+
}
|
|
1130
|
+
return this.contract.write.grantRole([role, account] as const, options) as Promise<`0x${string}`>;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* increaseAllowance
|
|
1135
|
+
* nonpayable
|
|
1136
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1137
|
+
*/
|
|
1138
|
+
async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
|
|
1139
|
+
accessList?: import('viem').AccessList;
|
|
1140
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1141
|
+
chain?: import('viem').Chain | null;
|
|
1142
|
+
dataSuffix?: `0x${string}`;
|
|
1143
|
+
gas?: bigint;
|
|
1144
|
+
gasPrice?: bigint;
|
|
1145
|
+
maxFeePerGas?: bigint;
|
|
1146
|
+
maxPriorityFeePerGas?: bigint;
|
|
1147
|
+
nonce?: number;
|
|
1148
|
+
value?: bigint;
|
|
1149
|
+
}): Promise<`0x${string}`> {
|
|
1150
|
+
if (!this.contract.write) {
|
|
1151
|
+
throw new Error('Wallet client is required for write operations');
|
|
1152
|
+
}
|
|
1153
|
+
return this.contract.write.increaseAllowance([spender, addedValue] as const, options) as Promise<`0x${string}`>;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* reclaimToken
|
|
1158
|
+
* nonpayable
|
|
1159
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1160
|
+
*/
|
|
1161
|
+
async reclaimToken(_token: `0x${string}`, options?: {
|
|
1162
|
+
accessList?: import('viem').AccessList;
|
|
1163
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1164
|
+
chain?: import('viem').Chain | null;
|
|
1165
|
+
dataSuffix?: `0x${string}`;
|
|
1166
|
+
gas?: bigint;
|
|
1167
|
+
gasPrice?: bigint;
|
|
1168
|
+
maxFeePerGas?: bigint;
|
|
1169
|
+
maxPriorityFeePerGas?: bigint;
|
|
1170
|
+
nonce?: number;
|
|
1171
|
+
value?: bigint;
|
|
1172
|
+
}): Promise<`0x${string}`> {
|
|
1173
|
+
if (!this.contract.write) {
|
|
1174
|
+
throw new Error('Wallet client is required for write operations');
|
|
1175
|
+
}
|
|
1176
|
+
return this.contract.write.reclaimToken([_token] as const, options) as Promise<`0x${string}`>;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* renounceOwnership
|
|
1181
|
+
* nonpayable
|
|
1182
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1183
|
+
*/
|
|
1184
|
+
async renounceOwnership(options?: {
|
|
1185
|
+
accessList?: import('viem').AccessList;
|
|
1186
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1187
|
+
chain?: import('viem').Chain | null;
|
|
1188
|
+
dataSuffix?: `0x${string}`;
|
|
1189
|
+
gas?: bigint;
|
|
1190
|
+
gasPrice?: bigint;
|
|
1191
|
+
maxFeePerGas?: bigint;
|
|
1192
|
+
maxPriorityFeePerGas?: bigint;
|
|
1193
|
+
nonce?: number;
|
|
1194
|
+
value?: bigint;
|
|
1195
|
+
}): Promise<`0x${string}`> {
|
|
1196
|
+
if (!this.contract.write) {
|
|
1197
|
+
throw new Error('Wallet client is required for write operations');
|
|
1198
|
+
}
|
|
1199
|
+
return this.contract.write.renounceOwnership(options) as Promise<`0x${string}`>;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* renounceRole
|
|
1204
|
+
* nonpayable
|
|
1205
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1206
|
+
*/
|
|
1207
|
+
async renounceRole(role: `0x${string}`, account: `0x${string}`, options?: {
|
|
1208
|
+
accessList?: import('viem').AccessList;
|
|
1209
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1210
|
+
chain?: import('viem').Chain | null;
|
|
1211
|
+
dataSuffix?: `0x${string}`;
|
|
1212
|
+
gas?: bigint;
|
|
1213
|
+
gasPrice?: bigint;
|
|
1214
|
+
maxFeePerGas?: bigint;
|
|
1215
|
+
maxPriorityFeePerGas?: bigint;
|
|
1216
|
+
nonce?: number;
|
|
1217
|
+
value?: bigint;
|
|
1218
|
+
}): Promise<`0x${string}`> {
|
|
1219
|
+
if (!this.contract.write) {
|
|
1220
|
+
throw new Error('Wallet client is required for write operations');
|
|
1221
|
+
}
|
|
1222
|
+
return this.contract.write.renounceRole([role, account] as const, options) as Promise<`0x${string}`>;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* revokeRole
|
|
1227
|
+
* nonpayable
|
|
1228
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1229
|
+
*/
|
|
1230
|
+
async revokeRole(role: `0x${string}`, account: `0x${string}`, options?: {
|
|
1231
|
+
accessList?: import('viem').AccessList;
|
|
1232
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1233
|
+
chain?: import('viem').Chain | null;
|
|
1234
|
+
dataSuffix?: `0x${string}`;
|
|
1235
|
+
gas?: bigint;
|
|
1236
|
+
gasPrice?: bigint;
|
|
1237
|
+
maxFeePerGas?: bigint;
|
|
1238
|
+
maxPriorityFeePerGas?: bigint;
|
|
1239
|
+
nonce?: number;
|
|
1240
|
+
value?: bigint;
|
|
1241
|
+
}): Promise<`0x${string}`> {
|
|
1242
|
+
if (!this.contract.write) {
|
|
1243
|
+
throw new Error('Wallet client is required for write operations');
|
|
1244
|
+
}
|
|
1245
|
+
return this.contract.write.revokeRole([role, account] as const, options) as Promise<`0x${string}`>;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* setBridge
|
|
1250
|
+
* nonpayable
|
|
1251
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1252
|
+
*/
|
|
1253
|
+
async setBridge(_bridge: `0x${string}`, options?: {
|
|
1254
|
+
accessList?: import('viem').AccessList;
|
|
1255
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1256
|
+
chain?: import('viem').Chain | null;
|
|
1257
|
+
dataSuffix?: `0x${string}`;
|
|
1258
|
+
gas?: bigint;
|
|
1259
|
+
gasPrice?: bigint;
|
|
1260
|
+
maxFeePerGas?: bigint;
|
|
1261
|
+
maxPriorityFeePerGas?: bigint;
|
|
1262
|
+
nonce?: number;
|
|
1263
|
+
value?: bigint;
|
|
1264
|
+
}): Promise<`0x${string}`> {
|
|
1265
|
+
if (!this.contract.write) {
|
|
1266
|
+
throw new Error('Wallet client is required for write operations');
|
|
1267
|
+
}
|
|
1268
|
+
return this.contract.write.setBridge([_bridge] as const, options) as Promise<`0x${string}`>;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
/**
|
|
1272
|
+
* transfer
|
|
1273
|
+
* nonpayable
|
|
1274
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1275
|
+
*/
|
|
1276
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
1277
|
+
accessList?: import('viem').AccessList;
|
|
1278
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1279
|
+
chain?: import('viem').Chain | null;
|
|
1280
|
+
dataSuffix?: `0x${string}`;
|
|
1281
|
+
gas?: bigint;
|
|
1282
|
+
gasPrice?: bigint;
|
|
1283
|
+
maxFeePerGas?: bigint;
|
|
1284
|
+
maxPriorityFeePerGas?: bigint;
|
|
1285
|
+
nonce?: number;
|
|
1286
|
+
value?: bigint;
|
|
1287
|
+
}): Promise<`0x${string}`> {
|
|
1288
|
+
if (!this.contract.write) {
|
|
1289
|
+
throw new Error('Wallet client is required for write operations');
|
|
1290
|
+
}
|
|
1291
|
+
return this.contract.write.transfer([to, amount] as const, options) as Promise<`0x${string}`>;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
/**
|
|
1295
|
+
* transferFrom
|
|
1296
|
+
* nonpayable
|
|
1297
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1298
|
+
*/
|
|
1299
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
1300
|
+
accessList?: import('viem').AccessList;
|
|
1301
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1302
|
+
chain?: import('viem').Chain | null;
|
|
1303
|
+
dataSuffix?: `0x${string}`;
|
|
1304
|
+
gas?: bigint;
|
|
1305
|
+
gasPrice?: bigint;
|
|
1306
|
+
maxFeePerGas?: bigint;
|
|
1307
|
+
maxPriorityFeePerGas?: bigint;
|
|
1308
|
+
nonce?: number;
|
|
1309
|
+
value?: bigint;
|
|
1310
|
+
}): Promise<`0x${string}`> {
|
|
1311
|
+
if (!this.contract.write) {
|
|
1312
|
+
throw new Error('Wallet client is required for write operations');
|
|
1313
|
+
}
|
|
1314
|
+
return this.contract.write.transferFrom([from, to, amount] as const, options) as Promise<`0x${string}`>;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
* transferOwnership
|
|
1319
|
+
* nonpayable
|
|
1320
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1321
|
+
*/
|
|
1322
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
1323
|
+
accessList?: import('viem').AccessList;
|
|
1324
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1325
|
+
chain?: import('viem').Chain | null;
|
|
1326
|
+
dataSuffix?: `0x${string}`;
|
|
1327
|
+
gas?: bigint;
|
|
1328
|
+
gasPrice?: bigint;
|
|
1329
|
+
maxFeePerGas?: bigint;
|
|
1330
|
+
maxPriorityFeePerGas?: bigint;
|
|
1331
|
+
nonce?: number;
|
|
1332
|
+
value?: bigint;
|
|
1333
|
+
}): Promise<`0x${string}`> {
|
|
1334
|
+
if (!this.contract.write) {
|
|
1335
|
+
throw new Error('Wallet client is required for write operations');
|
|
1336
|
+
}
|
|
1337
|
+
return this.contract.write.transferOwnership([newOwner] as const, options) as Promise<`0x${string}`>;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
1344
|
+
*
|
|
1345
|
+
* @example
|
|
1346
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
1347
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
1348
|
+
* console.log('Would succeed:', result.result);
|
|
1349
|
+
*/
|
|
1350
|
+
get simulate() {
|
|
1351
|
+
const contract = this.contract;
|
|
1352
|
+
if (!contract.simulate) {
|
|
1353
|
+
throw new Error('Public client is required for simulation');
|
|
1354
|
+
}
|
|
1355
|
+
return {
|
|
1356
|
+
/**
|
|
1357
|
+
* Simulate approve
|
|
1358
|
+
* Returns gas estimate and result without sending transaction
|
|
1359
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1360
|
+
*/
|
|
1361
|
+
async approve(spender: `0x${string}`, amount: bigint, options?: {
|
|
1362
|
+
accessList?: import('viem').AccessList;
|
|
1363
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1364
|
+
chain?: import('viem').Chain | null;
|
|
1365
|
+
dataSuffix?: `0x${string}`;
|
|
1366
|
+
gas?: bigint;
|
|
1367
|
+
gasPrice?: bigint;
|
|
1368
|
+
maxFeePerGas?: bigint;
|
|
1369
|
+
maxPriorityFeePerGas?: bigint;
|
|
1370
|
+
nonce?: number;
|
|
1371
|
+
value?: bigint;
|
|
1372
|
+
}): Promise<boolean> {
|
|
1373
|
+
return contract.simulate.approve([spender, amount] as const, options) as Promise<boolean>;
|
|
1374
|
+
},
|
|
1375
|
+
/**
|
|
1376
|
+
* Simulate bridgeBack
|
|
1377
|
+
* Returns gas estimate and result without sending transaction
|
|
1378
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1379
|
+
*/
|
|
1380
|
+
async bridgeBack(_amount: bigint, _to: string, options?: {
|
|
1381
|
+
accessList?: import('viem').AccessList;
|
|
1382
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1383
|
+
chain?: import('viem').Chain | null;
|
|
1384
|
+
dataSuffix?: `0x${string}`;
|
|
1385
|
+
gas?: bigint;
|
|
1386
|
+
gasPrice?: bigint;
|
|
1387
|
+
maxFeePerGas?: bigint;
|
|
1388
|
+
maxPriorityFeePerGas?: bigint;
|
|
1389
|
+
nonce?: number;
|
|
1390
|
+
value?: bigint;
|
|
1391
|
+
}): Promise<boolean> {
|
|
1392
|
+
return contract.simulate.bridgeBack([_amount, _to] as const, options) as Promise<boolean>;
|
|
1393
|
+
},
|
|
1394
|
+
/**
|
|
1395
|
+
* Simulate bridgedTo
|
|
1396
|
+
* Returns gas estimate and result without sending transaction
|
|
1397
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1398
|
+
*/
|
|
1399
|
+
async bridgedTo(_froms: string[], _tos: `0x${string}`[], _amounts: bigint[], options?: {
|
|
1400
|
+
accessList?: import('viem').AccessList;
|
|
1401
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1402
|
+
chain?: import('viem').Chain | null;
|
|
1403
|
+
dataSuffix?: `0x${string}`;
|
|
1404
|
+
gas?: bigint;
|
|
1405
|
+
gasPrice?: bigint;
|
|
1406
|
+
maxFeePerGas?: bigint;
|
|
1407
|
+
maxPriorityFeePerGas?: bigint;
|
|
1408
|
+
nonce?: number;
|
|
1409
|
+
value?: bigint;
|
|
1410
|
+
}): Promise<boolean> {
|
|
1411
|
+
return contract.simulate.bridgedTo([_froms, _tos, _amounts] as const, options) as Promise<boolean>;
|
|
1412
|
+
},
|
|
1413
|
+
/**
|
|
1414
|
+
* Simulate decreaseAllowance
|
|
1415
|
+
* Returns gas estimate and result without sending transaction
|
|
1416
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1417
|
+
*/
|
|
1418
|
+
async decreaseAllowance(spender: `0x${string}`, subtractedValue: bigint, options?: {
|
|
1419
|
+
accessList?: import('viem').AccessList;
|
|
1420
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1421
|
+
chain?: import('viem').Chain | null;
|
|
1422
|
+
dataSuffix?: `0x${string}`;
|
|
1423
|
+
gas?: bigint;
|
|
1424
|
+
gasPrice?: bigint;
|
|
1425
|
+
maxFeePerGas?: bigint;
|
|
1426
|
+
maxPriorityFeePerGas?: bigint;
|
|
1427
|
+
nonce?: number;
|
|
1428
|
+
value?: bigint;
|
|
1429
|
+
}): Promise<boolean> {
|
|
1430
|
+
return contract.simulate.decreaseAllowance([spender, subtractedValue] as const, options) as Promise<boolean>;
|
|
1431
|
+
},
|
|
1432
|
+
/**
|
|
1433
|
+
* Simulate grantRole
|
|
1434
|
+
* Returns gas estimate and result without sending transaction
|
|
1435
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1436
|
+
*/
|
|
1437
|
+
async grantRole(role: `0x${string}`, account: `0x${string}`, options?: {
|
|
1438
|
+
accessList?: import('viem').AccessList;
|
|
1439
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1440
|
+
chain?: import('viem').Chain | null;
|
|
1441
|
+
dataSuffix?: `0x${string}`;
|
|
1442
|
+
gas?: bigint;
|
|
1443
|
+
gasPrice?: bigint;
|
|
1444
|
+
maxFeePerGas?: bigint;
|
|
1445
|
+
maxPriorityFeePerGas?: bigint;
|
|
1446
|
+
nonce?: number;
|
|
1447
|
+
value?: bigint;
|
|
1448
|
+
}): Promise<void> {
|
|
1449
|
+
return contract.simulate.grantRole([role, account] as const, options) as Promise<void>;
|
|
1450
|
+
},
|
|
1451
|
+
/**
|
|
1452
|
+
* Simulate increaseAllowance
|
|
1453
|
+
* Returns gas estimate and result without sending transaction
|
|
1454
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1455
|
+
*/
|
|
1456
|
+
async increaseAllowance(spender: `0x${string}`, addedValue: bigint, options?: {
|
|
1457
|
+
accessList?: import('viem').AccessList;
|
|
1458
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1459
|
+
chain?: import('viem').Chain | null;
|
|
1460
|
+
dataSuffix?: `0x${string}`;
|
|
1461
|
+
gas?: bigint;
|
|
1462
|
+
gasPrice?: bigint;
|
|
1463
|
+
maxFeePerGas?: bigint;
|
|
1464
|
+
maxPriorityFeePerGas?: bigint;
|
|
1465
|
+
nonce?: number;
|
|
1466
|
+
value?: bigint;
|
|
1467
|
+
}): Promise<boolean> {
|
|
1468
|
+
return contract.simulate.increaseAllowance([spender, addedValue] as const, options) as Promise<boolean>;
|
|
1469
|
+
},
|
|
1470
|
+
/**
|
|
1471
|
+
* Simulate reclaimToken
|
|
1472
|
+
* Returns gas estimate and result without sending transaction
|
|
1473
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1474
|
+
*/
|
|
1475
|
+
async reclaimToken(_token: `0x${string}`, options?: {
|
|
1476
|
+
accessList?: import('viem').AccessList;
|
|
1477
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1478
|
+
chain?: import('viem').Chain | null;
|
|
1479
|
+
dataSuffix?: `0x${string}`;
|
|
1480
|
+
gas?: bigint;
|
|
1481
|
+
gasPrice?: bigint;
|
|
1482
|
+
maxFeePerGas?: bigint;
|
|
1483
|
+
maxPriorityFeePerGas?: bigint;
|
|
1484
|
+
nonce?: number;
|
|
1485
|
+
value?: bigint;
|
|
1486
|
+
}): Promise<void> {
|
|
1487
|
+
return contract.simulate.reclaimToken([_token] as const, options) as Promise<void>;
|
|
1488
|
+
},
|
|
1489
|
+
/**
|
|
1490
|
+
* Simulate renounceOwnership
|
|
1491
|
+
* Returns gas estimate and result without sending transaction
|
|
1492
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1493
|
+
*/
|
|
1494
|
+
async renounceOwnership(options?: {
|
|
1495
|
+
accessList?: import('viem').AccessList;
|
|
1496
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1497
|
+
chain?: import('viem').Chain | null;
|
|
1498
|
+
dataSuffix?: `0x${string}`;
|
|
1499
|
+
gas?: bigint;
|
|
1500
|
+
gasPrice?: bigint;
|
|
1501
|
+
maxFeePerGas?: bigint;
|
|
1502
|
+
maxPriorityFeePerGas?: bigint;
|
|
1503
|
+
nonce?: number;
|
|
1504
|
+
value?: bigint;
|
|
1505
|
+
}): Promise<void> {
|
|
1506
|
+
return contract.simulate.renounceOwnership(options) as Promise<void>;
|
|
1507
|
+
},
|
|
1508
|
+
/**
|
|
1509
|
+
* Simulate renounceRole
|
|
1510
|
+
* Returns gas estimate and result without sending transaction
|
|
1511
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1512
|
+
*/
|
|
1513
|
+
async renounceRole(role: `0x${string}`, account: `0x${string}`, options?: {
|
|
1514
|
+
accessList?: import('viem').AccessList;
|
|
1515
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1516
|
+
chain?: import('viem').Chain | null;
|
|
1517
|
+
dataSuffix?: `0x${string}`;
|
|
1518
|
+
gas?: bigint;
|
|
1519
|
+
gasPrice?: bigint;
|
|
1520
|
+
maxFeePerGas?: bigint;
|
|
1521
|
+
maxPriorityFeePerGas?: bigint;
|
|
1522
|
+
nonce?: number;
|
|
1523
|
+
value?: bigint;
|
|
1524
|
+
}): Promise<void> {
|
|
1525
|
+
return contract.simulate.renounceRole([role, account] as const, options) as Promise<void>;
|
|
1526
|
+
},
|
|
1527
|
+
/**
|
|
1528
|
+
* Simulate revokeRole
|
|
1529
|
+
* Returns gas estimate and result without sending transaction
|
|
1530
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1531
|
+
*/
|
|
1532
|
+
async revokeRole(role: `0x${string}`, account: `0x${string}`, options?: {
|
|
1533
|
+
accessList?: import('viem').AccessList;
|
|
1534
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1535
|
+
chain?: import('viem').Chain | null;
|
|
1536
|
+
dataSuffix?: `0x${string}`;
|
|
1537
|
+
gas?: bigint;
|
|
1538
|
+
gasPrice?: bigint;
|
|
1539
|
+
maxFeePerGas?: bigint;
|
|
1540
|
+
maxPriorityFeePerGas?: bigint;
|
|
1541
|
+
nonce?: number;
|
|
1542
|
+
value?: bigint;
|
|
1543
|
+
}): Promise<void> {
|
|
1544
|
+
return contract.simulate.revokeRole([role, account] as const, options) as Promise<void>;
|
|
1545
|
+
},
|
|
1546
|
+
/**
|
|
1547
|
+
* Simulate setBridge
|
|
1548
|
+
* Returns gas estimate and result without sending transaction
|
|
1549
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1550
|
+
*/
|
|
1551
|
+
async setBridge(_bridge: `0x${string}`, options?: {
|
|
1552
|
+
accessList?: import('viem').AccessList;
|
|
1553
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1554
|
+
chain?: import('viem').Chain | null;
|
|
1555
|
+
dataSuffix?: `0x${string}`;
|
|
1556
|
+
gas?: bigint;
|
|
1557
|
+
gasPrice?: bigint;
|
|
1558
|
+
maxFeePerGas?: bigint;
|
|
1559
|
+
maxPriorityFeePerGas?: bigint;
|
|
1560
|
+
nonce?: number;
|
|
1561
|
+
value?: bigint;
|
|
1562
|
+
}): Promise<boolean> {
|
|
1563
|
+
return contract.simulate.setBridge([_bridge] as const, options) as Promise<boolean>;
|
|
1564
|
+
},
|
|
1565
|
+
/**
|
|
1566
|
+
* Simulate transfer
|
|
1567
|
+
* Returns gas estimate and result without sending transaction
|
|
1568
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1569
|
+
*/
|
|
1570
|
+
async transfer(to: `0x${string}`, amount: bigint, options?: {
|
|
1571
|
+
accessList?: import('viem').AccessList;
|
|
1572
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1573
|
+
chain?: import('viem').Chain | null;
|
|
1574
|
+
dataSuffix?: `0x${string}`;
|
|
1575
|
+
gas?: bigint;
|
|
1576
|
+
gasPrice?: bigint;
|
|
1577
|
+
maxFeePerGas?: bigint;
|
|
1578
|
+
maxPriorityFeePerGas?: bigint;
|
|
1579
|
+
nonce?: number;
|
|
1580
|
+
value?: bigint;
|
|
1581
|
+
}): Promise<boolean> {
|
|
1582
|
+
return contract.simulate.transfer([to, amount] as const, options) as Promise<boolean>;
|
|
1583
|
+
},
|
|
1584
|
+
/**
|
|
1585
|
+
* Simulate transferFrom
|
|
1586
|
+
* Returns gas estimate and result without sending transaction
|
|
1587
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1588
|
+
*/
|
|
1589
|
+
async transferFrom(from: `0x${string}`, to: `0x${string}`, amount: bigint, options?: {
|
|
1590
|
+
accessList?: import('viem').AccessList;
|
|
1591
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1592
|
+
chain?: import('viem').Chain | null;
|
|
1593
|
+
dataSuffix?: `0x${string}`;
|
|
1594
|
+
gas?: bigint;
|
|
1595
|
+
gasPrice?: bigint;
|
|
1596
|
+
maxFeePerGas?: bigint;
|
|
1597
|
+
maxPriorityFeePerGas?: bigint;
|
|
1598
|
+
nonce?: number;
|
|
1599
|
+
value?: bigint;
|
|
1600
|
+
}): Promise<boolean> {
|
|
1601
|
+
return contract.simulate.transferFrom([from, to, amount] as const, options) as Promise<boolean>;
|
|
1602
|
+
},
|
|
1603
|
+
/**
|
|
1604
|
+
* Simulate transferOwnership
|
|
1605
|
+
* Returns gas estimate and result without sending transaction
|
|
1606
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
1607
|
+
*/
|
|
1608
|
+
async transferOwnership(newOwner: `0x${string}`, options?: {
|
|
1609
|
+
accessList?: import('viem').AccessList;
|
|
1610
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
1611
|
+
chain?: import('viem').Chain | null;
|
|
1612
|
+
dataSuffix?: `0x${string}`;
|
|
1613
|
+
gas?: bigint;
|
|
1614
|
+
gasPrice?: bigint;
|
|
1615
|
+
maxFeePerGas?: bigint;
|
|
1616
|
+
maxPriorityFeePerGas?: bigint;
|
|
1617
|
+
nonce?: number;
|
|
1618
|
+
value?: bigint;
|
|
1619
|
+
}): Promise<void> {
|
|
1620
|
+
return contract.simulate.transferOwnership([newOwner] as const, options) as Promise<void>;
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* Watch contract events
|
|
1627
|
+
*
|
|
1628
|
+
* @example
|
|
1629
|
+
* // Watch all Transfer events
|
|
1630
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
1631
|
+
* console.log('Transfer:', event);
|
|
1632
|
+
* });
|
|
1633
|
+
*
|
|
1634
|
+
* // Stop watching
|
|
1635
|
+
* unwatch();
|
|
1636
|
+
*/
|
|
1637
|
+
get watch() {
|
|
1638
|
+
return {
|
|
1639
|
+
/**
|
|
1640
|
+
* Watch Approval events
|
|
1641
|
+
* @param callback Function to call when event is emitted
|
|
1642
|
+
* @param filter Optional filter for indexed parameters
|
|
1643
|
+
* @returns Unwatch function to stop listening
|
|
1644
|
+
*/
|
|
1645
|
+
Approval: (callback: (event: { owner: `0x${string}`; spender: `0x${string}`; value: bigint }) => void, filter?: { owner?: `0x${string}` | `0x${string}`[] | null; spender?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1646
|
+
return this.publicClient.watchContractEvent({
|
|
1647
|
+
address: this.contractAddress,
|
|
1648
|
+
abi: wTAOAbi,
|
|
1649
|
+
eventName: 'Approval',
|
|
1650
|
+
args: filter as any,
|
|
1651
|
+
onLogs: (logs: any[]) => {
|
|
1652
|
+
logs.forEach((log: any) => {
|
|
1653
|
+
callback(log.args as any);
|
|
1654
|
+
});
|
|
1655
|
+
},
|
|
1656
|
+
}) as () => void;
|
|
1657
|
+
},
|
|
1658
|
+
/**
|
|
1659
|
+
* Watch BridgeSet events
|
|
1660
|
+
* @param callback Function to call when event is emitted
|
|
1661
|
+
* @param filter Optional filter for indexed parameters
|
|
1662
|
+
* @returns Unwatch function to stop listening
|
|
1663
|
+
*/
|
|
1664
|
+
BridgeSet: (callback: (event: { bridge: `0x${string}` }) => void, filter?: { bridge?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1665
|
+
return this.publicClient.watchContractEvent({
|
|
1666
|
+
address: this.contractAddress,
|
|
1667
|
+
abi: wTAOAbi,
|
|
1668
|
+
eventName: 'BridgeSet',
|
|
1669
|
+
args: filter as any,
|
|
1670
|
+
onLogs: (logs: any[]) => {
|
|
1671
|
+
logs.forEach((log: any) => {
|
|
1672
|
+
callback(log.args as any);
|
|
1673
|
+
});
|
|
1674
|
+
},
|
|
1675
|
+
}) as () => void;
|
|
1676
|
+
},
|
|
1677
|
+
/**
|
|
1678
|
+
* Watch BridgedBack events
|
|
1679
|
+
* @param callback Function to call when event is emitted
|
|
1680
|
+
* @param filter Optional filter for indexed parameters
|
|
1681
|
+
* @returns Unwatch function to stop listening
|
|
1682
|
+
*/
|
|
1683
|
+
BridgedBack: (callback: (event: { from: `0x${string}`; amount: bigint; to: string; nonce: bigint }) => void, filter?: { from?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1684
|
+
return this.publicClient.watchContractEvent({
|
|
1685
|
+
address: this.contractAddress,
|
|
1686
|
+
abi: wTAOAbi,
|
|
1687
|
+
eventName: 'BridgedBack',
|
|
1688
|
+
args: filter as any,
|
|
1689
|
+
onLogs: (logs: any[]) => {
|
|
1690
|
+
logs.forEach((log: any) => {
|
|
1691
|
+
callback(log.args as any);
|
|
1692
|
+
});
|
|
1693
|
+
},
|
|
1694
|
+
}) as () => void;
|
|
1695
|
+
},
|
|
1696
|
+
/**
|
|
1697
|
+
* Watch BridgedTo events
|
|
1698
|
+
* @param callback Function to call when event is emitted
|
|
1699
|
+
* @param filter Optional filter for indexed parameters
|
|
1700
|
+
* @returns Unwatch function to stop listening
|
|
1701
|
+
*/
|
|
1702
|
+
BridgedTo: (callback: (event: { from: string; to: `0x${string}`; amount: bigint; nonce: bigint }) => void, filter?: { to?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1703
|
+
return this.publicClient.watchContractEvent({
|
|
1704
|
+
address: this.contractAddress,
|
|
1705
|
+
abi: wTAOAbi,
|
|
1706
|
+
eventName: 'BridgedTo',
|
|
1707
|
+
args: filter as any,
|
|
1708
|
+
onLogs: (logs: any[]) => {
|
|
1709
|
+
logs.forEach((log: any) => {
|
|
1710
|
+
callback(log.args as any);
|
|
1711
|
+
});
|
|
1712
|
+
},
|
|
1713
|
+
}) as () => void;
|
|
1714
|
+
},
|
|
1715
|
+
/**
|
|
1716
|
+
* Watch Mint events
|
|
1717
|
+
* @param callback Function to call when event is emitted
|
|
1718
|
+
* @param filter Optional filter for indexed parameters
|
|
1719
|
+
* @returns Unwatch function to stop listening
|
|
1720
|
+
*/
|
|
1721
|
+
Mint: (callback: (event: { to: `0x${string}`; amount: bigint }) => void, filter?: { to?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1722
|
+
return this.publicClient.watchContractEvent({
|
|
1723
|
+
address: this.contractAddress,
|
|
1724
|
+
abi: wTAOAbi,
|
|
1725
|
+
eventName: 'Mint',
|
|
1726
|
+
args: filter as any,
|
|
1727
|
+
onLogs: (logs: any[]) => {
|
|
1728
|
+
logs.forEach((log: any) => {
|
|
1729
|
+
callback(log.args as any);
|
|
1730
|
+
});
|
|
1731
|
+
},
|
|
1732
|
+
}) as () => void;
|
|
1733
|
+
},
|
|
1734
|
+
/**
|
|
1735
|
+
* Watch OwnershipTransferred events
|
|
1736
|
+
* @param callback Function to call when event is emitted
|
|
1737
|
+
* @param filter Optional filter for indexed parameters
|
|
1738
|
+
* @returns Unwatch function to stop listening
|
|
1739
|
+
*/
|
|
1740
|
+
OwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void, filter?: { previousOwner?: `0x${string}` | `0x${string}`[] | null; newOwner?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1741
|
+
return this.publicClient.watchContractEvent({
|
|
1742
|
+
address: this.contractAddress,
|
|
1743
|
+
abi: wTAOAbi,
|
|
1744
|
+
eventName: 'OwnershipTransferred',
|
|
1745
|
+
args: filter as any,
|
|
1746
|
+
onLogs: (logs: any[]) => {
|
|
1747
|
+
logs.forEach((log: any) => {
|
|
1748
|
+
callback(log.args as any);
|
|
1749
|
+
});
|
|
1750
|
+
},
|
|
1751
|
+
}) as () => void;
|
|
1752
|
+
},
|
|
1753
|
+
/**
|
|
1754
|
+
* Watch RoleAdminChanged events
|
|
1755
|
+
* @param callback Function to call when event is emitted
|
|
1756
|
+
* @param filter Optional filter for indexed parameters
|
|
1757
|
+
* @returns Unwatch function to stop listening
|
|
1758
|
+
*/
|
|
1759
|
+
RoleAdminChanged: (callback: (event: { role: `0x${string}`; previousAdminRole: `0x${string}`; newAdminRole: `0x${string}` }) => void, filter?: { role?: `0x${string}` | `0x${string}`[] | null; previousAdminRole?: `0x${string}` | `0x${string}`[] | null; newAdminRole?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1760
|
+
return this.publicClient.watchContractEvent({
|
|
1761
|
+
address: this.contractAddress,
|
|
1762
|
+
abi: wTAOAbi,
|
|
1763
|
+
eventName: 'RoleAdminChanged',
|
|
1764
|
+
args: filter as any,
|
|
1765
|
+
onLogs: (logs: any[]) => {
|
|
1766
|
+
logs.forEach((log: any) => {
|
|
1767
|
+
callback(log.args as any);
|
|
1768
|
+
});
|
|
1769
|
+
},
|
|
1770
|
+
}) as () => void;
|
|
1771
|
+
},
|
|
1772
|
+
/**
|
|
1773
|
+
* Watch RoleGranted events
|
|
1774
|
+
* @param callback Function to call when event is emitted
|
|
1775
|
+
* @param filter Optional filter for indexed parameters
|
|
1776
|
+
* @returns Unwatch function to stop listening
|
|
1777
|
+
*/
|
|
1778
|
+
RoleGranted: (callback: (event: { role: `0x${string}`; account: `0x${string}`; sender: `0x${string}` }) => void, filter?: { role?: `0x${string}` | `0x${string}`[] | null; account?: `0x${string}` | `0x${string}`[] | null; sender?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1779
|
+
return this.publicClient.watchContractEvent({
|
|
1780
|
+
address: this.contractAddress,
|
|
1781
|
+
abi: wTAOAbi,
|
|
1782
|
+
eventName: 'RoleGranted',
|
|
1783
|
+
args: filter as any,
|
|
1784
|
+
onLogs: (logs: any[]) => {
|
|
1785
|
+
logs.forEach((log: any) => {
|
|
1786
|
+
callback(log.args as any);
|
|
1787
|
+
});
|
|
1788
|
+
},
|
|
1789
|
+
}) as () => void;
|
|
1790
|
+
},
|
|
1791
|
+
/**
|
|
1792
|
+
* Watch RoleRevoked events
|
|
1793
|
+
* @param callback Function to call when event is emitted
|
|
1794
|
+
* @param filter Optional filter for indexed parameters
|
|
1795
|
+
* @returns Unwatch function to stop listening
|
|
1796
|
+
*/
|
|
1797
|
+
RoleRevoked: (callback: (event: { role: `0x${string}`; account: `0x${string}`; sender: `0x${string}` }) => void, filter?: { role?: `0x${string}` | `0x${string}`[] | null; account?: `0x${string}` | `0x${string}`[] | null; sender?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1798
|
+
return this.publicClient.watchContractEvent({
|
|
1799
|
+
address: this.contractAddress,
|
|
1800
|
+
abi: wTAOAbi,
|
|
1801
|
+
eventName: 'RoleRevoked',
|
|
1802
|
+
args: filter as any,
|
|
1803
|
+
onLogs: (logs: any[]) => {
|
|
1804
|
+
logs.forEach((log: any) => {
|
|
1805
|
+
callback(log.args as any);
|
|
1806
|
+
});
|
|
1807
|
+
},
|
|
1808
|
+
}) as () => void;
|
|
1809
|
+
},
|
|
1810
|
+
/**
|
|
1811
|
+
* Watch Transfer events
|
|
1812
|
+
* @param callback Function to call when event is emitted
|
|
1813
|
+
* @param filter Optional filter for indexed parameters
|
|
1814
|
+
* @returns Unwatch function to stop listening
|
|
1815
|
+
*/
|
|
1816
|
+
Transfer: (callback: (event: { from: `0x${string}`; to: `0x${string}`; value: bigint }) => void, filter?: { from?: `0x${string}` | `0x${string}`[] | null; to?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
1817
|
+
return this.publicClient.watchContractEvent({
|
|
1818
|
+
address: this.contractAddress,
|
|
1819
|
+
abi: wTAOAbi,
|
|
1820
|
+
eventName: 'Transfer',
|
|
1821
|
+
args: filter as any,
|
|
1822
|
+
onLogs: (logs: any[]) => {
|
|
1823
|
+
logs.forEach((log: any) => {
|
|
1824
|
+
callback(log.args as any);
|
|
1825
|
+
});
|
|
1826
|
+
},
|
|
1827
|
+
}) as () => void;
|
|
1828
|
+
}
|
|
1829
|
+
};
|
|
1830
|
+
}
|
|
1831
|
+
}
|