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