@gitmyabi-stg/ausd 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/AgoraDollar.d.ts +4199 -0
- package/contracts/AgoraDollar.js +4435 -0
- package/contracts/AgoraDollar.ts +5590 -0
- package/contracts/AgoraDollarErc1967Proxy.d.ts +752 -0
- package/contracts/AgoraDollarErc1967Proxy.js +865 -0
- package/contracts/AgoraDollarErc1967Proxy.ts +1000 -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,1000 @@
|
|
|
1
|
+
import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
|
|
2
|
+
import { getContract } from 'viem';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ConstructorParams struct type
|
|
7
|
+
*/
|
|
8
|
+
export type ConstructorParams = {
|
|
9
|
+
proxyAdminOwnerAddress: `0x${string}`;
|
|
10
|
+
eip712Name: string;
|
|
11
|
+
eip712Version: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* AgoraDollarErc1967Proxy ABI
|
|
15
|
+
*
|
|
16
|
+
* This ABI is typed using viem's type system for full type safety.
|
|
17
|
+
*/
|
|
18
|
+
export const AgoraDollarErc1967ProxyAbi = [
|
|
19
|
+
{
|
|
20
|
+
"inputs": [
|
|
21
|
+
{
|
|
22
|
+
"components": [
|
|
23
|
+
{
|
|
24
|
+
"internalType": "address",
|
|
25
|
+
"name": "proxyAdminOwnerAddress",
|
|
26
|
+
"type": "address"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"internalType": "string",
|
|
30
|
+
"name": "eip712Name",
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"internalType": "string",
|
|
35
|
+
"name": "eip712Version",
|
|
36
|
+
"type": "string"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"internalType": "struct ConstructorParams",
|
|
40
|
+
"name": "_params",
|
|
41
|
+
"type": "tuple"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"stateMutability": "payable",
|
|
45
|
+
"type": "constructor"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"inputs": [
|
|
49
|
+
{
|
|
50
|
+
"internalType": "address",
|
|
51
|
+
"name": "frozenAccount",
|
|
52
|
+
"type": "address"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"name": "AccountIsFrozen",
|
|
56
|
+
"type": "error"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"inputs": [
|
|
60
|
+
{
|
|
61
|
+
"internalType": "address",
|
|
62
|
+
"name": "target",
|
|
63
|
+
"type": "address"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"name": "AddressEmptyCode",
|
|
67
|
+
"type": "error"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"inputs": [],
|
|
71
|
+
"name": "AgoraDollarErc1967NonPayable",
|
|
72
|
+
"type": "error"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"inputs": [
|
|
76
|
+
{
|
|
77
|
+
"internalType": "address",
|
|
78
|
+
"name": "spender",
|
|
79
|
+
"type": "address"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"internalType": "uint256",
|
|
83
|
+
"name": "allowance",
|
|
84
|
+
"type": "uint256"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"internalType": "uint256",
|
|
88
|
+
"name": "needed",
|
|
89
|
+
"type": "uint256"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"name": "ERC20InsufficientAllowance",
|
|
93
|
+
"type": "error"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"inputs": [
|
|
97
|
+
{
|
|
98
|
+
"internalType": "address",
|
|
99
|
+
"name": "sender",
|
|
100
|
+
"type": "address"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"internalType": "uint256",
|
|
104
|
+
"name": "balance",
|
|
105
|
+
"type": "uint256"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"internalType": "uint256",
|
|
109
|
+
"name": "needed",
|
|
110
|
+
"type": "uint256"
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"name": "ERC20InsufficientBalance",
|
|
114
|
+
"type": "error"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"inputs": [
|
|
118
|
+
{
|
|
119
|
+
"internalType": "address",
|
|
120
|
+
"name": "approver",
|
|
121
|
+
"type": "address"
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"name": "ERC20InvalidApprover",
|
|
125
|
+
"type": "error"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"inputs": [
|
|
129
|
+
{
|
|
130
|
+
"internalType": "address",
|
|
131
|
+
"name": "receiver",
|
|
132
|
+
"type": "address"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"name": "ERC20InvalidReceiver",
|
|
136
|
+
"type": "error"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"inputs": [
|
|
140
|
+
{
|
|
141
|
+
"internalType": "address",
|
|
142
|
+
"name": "sender",
|
|
143
|
+
"type": "address"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"name": "ERC20InvalidSender",
|
|
147
|
+
"type": "error"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"inputs": [
|
|
151
|
+
{
|
|
152
|
+
"internalType": "address",
|
|
153
|
+
"name": "spender",
|
|
154
|
+
"type": "address"
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"name": "ERC20InvalidSpender",
|
|
158
|
+
"type": "error"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"inputs": [],
|
|
162
|
+
"name": "ExpiredAuthorization",
|
|
163
|
+
"type": "error"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"inputs": [],
|
|
167
|
+
"name": "FailedInnerCall",
|
|
168
|
+
"type": "error"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"inputs": [],
|
|
172
|
+
"name": "ImplementationTargetNotAContract",
|
|
173
|
+
"type": "error"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"inputs": [],
|
|
177
|
+
"name": "InvalidAuthorization",
|
|
178
|
+
"type": "error"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"inputs": [
|
|
182
|
+
{
|
|
183
|
+
"internalType": "address",
|
|
184
|
+
"name": "caller",
|
|
185
|
+
"type": "address"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"internalType": "address",
|
|
189
|
+
"name": "payee",
|
|
190
|
+
"type": "address"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"name": "InvalidPayee",
|
|
194
|
+
"type": "error"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"inputs": [],
|
|
198
|
+
"name": "InvalidSignature",
|
|
199
|
+
"type": "error"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"inputs": [],
|
|
203
|
+
"name": "ProxyDeniedAdminAccess",
|
|
204
|
+
"type": "error"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"inputs": [],
|
|
208
|
+
"name": "SignatureVerificationPaused",
|
|
209
|
+
"type": "error"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"inputs": [
|
|
213
|
+
{
|
|
214
|
+
"internalType": "string",
|
|
215
|
+
"name": "str",
|
|
216
|
+
"type": "string"
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
"name": "StringTooLong",
|
|
220
|
+
"type": "error"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"inputs": [],
|
|
224
|
+
"name": "TransferPaused",
|
|
225
|
+
"type": "error"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"inputs": [],
|
|
229
|
+
"name": "UsedOrCanceledAuthorization",
|
|
230
|
+
"type": "error"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"anonymous": false,
|
|
234
|
+
"inputs": [
|
|
235
|
+
{
|
|
236
|
+
"indexed": false,
|
|
237
|
+
"internalType": "address",
|
|
238
|
+
"name": "previousAdmin",
|
|
239
|
+
"type": "address"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"indexed": false,
|
|
243
|
+
"internalType": "address",
|
|
244
|
+
"name": "newAdmin",
|
|
245
|
+
"type": "address"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"name": "AdminChanged",
|
|
249
|
+
"type": "event"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"anonymous": false,
|
|
253
|
+
"inputs": [
|
|
254
|
+
{
|
|
255
|
+
"indexed": true,
|
|
256
|
+
"internalType": "address",
|
|
257
|
+
"name": "owner",
|
|
258
|
+
"type": "address"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"indexed": true,
|
|
262
|
+
"internalType": "address",
|
|
263
|
+
"name": "spender",
|
|
264
|
+
"type": "address"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"indexed": false,
|
|
268
|
+
"internalType": "uint256",
|
|
269
|
+
"name": "value",
|
|
270
|
+
"type": "uint256"
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
"name": "Approval",
|
|
274
|
+
"type": "event"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"anonymous": false,
|
|
278
|
+
"inputs": [
|
|
279
|
+
{
|
|
280
|
+
"indexed": true,
|
|
281
|
+
"internalType": "address",
|
|
282
|
+
"name": "authorizer",
|
|
283
|
+
"type": "address"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"indexed": true,
|
|
287
|
+
"internalType": "bytes32",
|
|
288
|
+
"name": "nonce",
|
|
289
|
+
"type": "bytes32"
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"name": "AuthorizationCanceled",
|
|
293
|
+
"type": "event"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"anonymous": false,
|
|
297
|
+
"inputs": [
|
|
298
|
+
{
|
|
299
|
+
"indexed": true,
|
|
300
|
+
"internalType": "address",
|
|
301
|
+
"name": "authorizer",
|
|
302
|
+
"type": "address"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"indexed": true,
|
|
306
|
+
"internalType": "bytes32",
|
|
307
|
+
"name": "nonce",
|
|
308
|
+
"type": "bytes32"
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
"name": "AuthorizationUsed",
|
|
312
|
+
"type": "event"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"anonymous": false,
|
|
316
|
+
"inputs": [
|
|
317
|
+
{
|
|
318
|
+
"indexed": true,
|
|
319
|
+
"internalType": "address",
|
|
320
|
+
"name": "from",
|
|
321
|
+
"type": "address"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"indexed": true,
|
|
325
|
+
"internalType": "address",
|
|
326
|
+
"name": "to",
|
|
327
|
+
"type": "address"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"indexed": false,
|
|
331
|
+
"internalType": "uint256",
|
|
332
|
+
"name": "value",
|
|
333
|
+
"type": "uint256"
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
"name": "Transfer",
|
|
337
|
+
"type": "event"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"anonymous": false,
|
|
341
|
+
"inputs": [
|
|
342
|
+
{
|
|
343
|
+
"indexed": true,
|
|
344
|
+
"internalType": "address",
|
|
345
|
+
"name": "implementation",
|
|
346
|
+
"type": "address"
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
"name": "Upgraded",
|
|
350
|
+
"type": "event"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"stateMutability": "payable",
|
|
354
|
+
"type": "fallback"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"inputs": [
|
|
358
|
+
{
|
|
359
|
+
"internalType": "address",
|
|
360
|
+
"name": "_from",
|
|
361
|
+
"type": "address"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"internalType": "address",
|
|
365
|
+
"name": "_to",
|
|
366
|
+
"type": "address"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"internalType": "uint256",
|
|
370
|
+
"name": "_value",
|
|
371
|
+
"type": "uint256"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"internalType": "uint256",
|
|
375
|
+
"name": "_validAfter",
|
|
376
|
+
"type": "uint256"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"internalType": "uint256",
|
|
380
|
+
"name": "_validBefore",
|
|
381
|
+
"type": "uint256"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"internalType": "bytes32",
|
|
385
|
+
"name": "_nonce",
|
|
386
|
+
"type": "bytes32"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"internalType": "bytes",
|
|
390
|
+
"name": "_signature",
|
|
391
|
+
"type": "bytes"
|
|
392
|
+
}
|
|
393
|
+
],
|
|
394
|
+
"name": "receiveWithAuthorization",
|
|
395
|
+
"outputs": [],
|
|
396
|
+
"stateMutability": "nonpayable",
|
|
397
|
+
"type": "function"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"inputs": [
|
|
401
|
+
{
|
|
402
|
+
"internalType": "address",
|
|
403
|
+
"name": "_from",
|
|
404
|
+
"type": "address"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"internalType": "address",
|
|
408
|
+
"name": "_to",
|
|
409
|
+
"type": "address"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"internalType": "uint256",
|
|
413
|
+
"name": "_value",
|
|
414
|
+
"type": "uint256"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"internalType": "uint256",
|
|
418
|
+
"name": "_validAfter",
|
|
419
|
+
"type": "uint256"
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"internalType": "uint256",
|
|
423
|
+
"name": "_validBefore",
|
|
424
|
+
"type": "uint256"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"internalType": "bytes32",
|
|
428
|
+
"name": "_nonce",
|
|
429
|
+
"type": "bytes32"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"internalType": "uint8",
|
|
433
|
+
"name": "_v",
|
|
434
|
+
"type": "uint8"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"internalType": "bytes32",
|
|
438
|
+
"name": "_r",
|
|
439
|
+
"type": "bytes32"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"internalType": "bytes32",
|
|
443
|
+
"name": "_s",
|
|
444
|
+
"type": "bytes32"
|
|
445
|
+
}
|
|
446
|
+
],
|
|
447
|
+
"name": "receiveWithAuthorization",
|
|
448
|
+
"outputs": [],
|
|
449
|
+
"stateMutability": "nonpayable",
|
|
450
|
+
"type": "function"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"inputs": [
|
|
454
|
+
{
|
|
455
|
+
"internalType": "address",
|
|
456
|
+
"name": "_to",
|
|
457
|
+
"type": "address"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"internalType": "uint256",
|
|
461
|
+
"name": "_transferValue",
|
|
462
|
+
"type": "uint256"
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
"name": "transfer",
|
|
466
|
+
"outputs": [
|
|
467
|
+
{
|
|
468
|
+
"internalType": "bool",
|
|
469
|
+
"name": "",
|
|
470
|
+
"type": "bool"
|
|
471
|
+
}
|
|
472
|
+
],
|
|
473
|
+
"stateMutability": "nonpayable",
|
|
474
|
+
"type": "function"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"inputs": [
|
|
478
|
+
{
|
|
479
|
+
"internalType": "address",
|
|
480
|
+
"name": "_from",
|
|
481
|
+
"type": "address"
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"internalType": "address",
|
|
485
|
+
"name": "_to",
|
|
486
|
+
"type": "address"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"internalType": "uint256",
|
|
490
|
+
"name": "_transferValue",
|
|
491
|
+
"type": "uint256"
|
|
492
|
+
}
|
|
493
|
+
],
|
|
494
|
+
"name": "transferFrom",
|
|
495
|
+
"outputs": [
|
|
496
|
+
{
|
|
497
|
+
"internalType": "bool",
|
|
498
|
+
"name": "",
|
|
499
|
+
"type": "bool"
|
|
500
|
+
}
|
|
501
|
+
],
|
|
502
|
+
"stateMutability": "nonpayable",
|
|
503
|
+
"type": "function"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"inputs": [
|
|
507
|
+
{
|
|
508
|
+
"internalType": "address",
|
|
509
|
+
"name": "_from",
|
|
510
|
+
"type": "address"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"internalType": "address",
|
|
514
|
+
"name": "_to",
|
|
515
|
+
"type": "address"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"internalType": "uint256",
|
|
519
|
+
"name": "_value",
|
|
520
|
+
"type": "uint256"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"internalType": "uint256",
|
|
524
|
+
"name": "_validAfter",
|
|
525
|
+
"type": "uint256"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"internalType": "uint256",
|
|
529
|
+
"name": "_validBefore",
|
|
530
|
+
"type": "uint256"
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"internalType": "bytes32",
|
|
534
|
+
"name": "_nonce",
|
|
535
|
+
"type": "bytes32"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"internalType": "bytes",
|
|
539
|
+
"name": "_signature",
|
|
540
|
+
"type": "bytes"
|
|
541
|
+
}
|
|
542
|
+
],
|
|
543
|
+
"name": "transferWithAuthorization",
|
|
544
|
+
"outputs": [],
|
|
545
|
+
"stateMutability": "nonpayable",
|
|
546
|
+
"type": "function"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"inputs": [
|
|
550
|
+
{
|
|
551
|
+
"internalType": "address",
|
|
552
|
+
"name": "_from",
|
|
553
|
+
"type": "address"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"internalType": "address",
|
|
557
|
+
"name": "_to",
|
|
558
|
+
"type": "address"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
"internalType": "uint256",
|
|
562
|
+
"name": "_value",
|
|
563
|
+
"type": "uint256"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"internalType": "uint256",
|
|
567
|
+
"name": "_validAfter",
|
|
568
|
+
"type": "uint256"
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"internalType": "uint256",
|
|
572
|
+
"name": "_validBefore",
|
|
573
|
+
"type": "uint256"
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
"internalType": "bytes32",
|
|
577
|
+
"name": "_nonce",
|
|
578
|
+
"type": "bytes32"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"internalType": "uint8",
|
|
582
|
+
"name": "_v",
|
|
583
|
+
"type": "uint8"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"internalType": "bytes32",
|
|
587
|
+
"name": "_r",
|
|
588
|
+
"type": "bytes32"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"internalType": "bytes32",
|
|
592
|
+
"name": "_s",
|
|
593
|
+
"type": "bytes32"
|
|
594
|
+
}
|
|
595
|
+
],
|
|
596
|
+
"name": "transferWithAuthorization",
|
|
597
|
+
"outputs": [],
|
|
598
|
+
"stateMutability": "nonpayable",
|
|
599
|
+
"type": "function"
|
|
600
|
+
}
|
|
601
|
+
] as const satisfies Abi;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Type-safe ABI for AgoraDollarErc1967Proxy
|
|
605
|
+
*/
|
|
606
|
+
export type AgoraDollarErc1967ProxyAbi = typeof AgoraDollarErc1967ProxyAbi;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Contract instance type for AgoraDollarErc1967Proxy
|
|
610
|
+
*/
|
|
611
|
+
// Use any for contract type to avoid complex viem type issues
|
|
612
|
+
// The runtime behavior is type-safe through viem's ABI typing
|
|
613
|
+
export type AgoraDollarErc1967ProxyContract = any;
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* AgoraDollarErc1967Proxy Contract Class
|
|
617
|
+
*
|
|
618
|
+
* Provides a class-based API similar to TypeChain for interacting with the contract.
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```typescript
|
|
622
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
623
|
+
* import { mainnet } from 'viem/chains';
|
|
624
|
+
* import { AgoraDollarErc1967Proxy } from 'AgoraDollarErc1967Proxy';
|
|
625
|
+
*
|
|
626
|
+
* const publicClient = createPublicClient({ chain: mainnet, transport: http() });
|
|
627
|
+
* const walletClient = createWalletClient({ chain: mainnet, transport: http() });
|
|
628
|
+
*
|
|
629
|
+
* const contract = new AgoraDollarErc1967Proxy('0x...', { publicClient, walletClient });
|
|
630
|
+
*
|
|
631
|
+
* // Read functions
|
|
632
|
+
* const result = await contract.balanceOf('0x...');
|
|
633
|
+
*
|
|
634
|
+
* // Write functions
|
|
635
|
+
* const hash = await contract.transfer('0x...', 1000n);
|
|
636
|
+
*
|
|
637
|
+
* // Simulate transactions (dry-run)
|
|
638
|
+
* const simulation = await contract.simulate.transfer('0x...', 1000n);
|
|
639
|
+
* console.log('Gas estimate:', simulation.request.gas);
|
|
640
|
+
*
|
|
641
|
+
* // Watch events
|
|
642
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
643
|
+
* console.log('Transfer event:', event);
|
|
644
|
+
* });
|
|
645
|
+
* ```
|
|
646
|
+
*/
|
|
647
|
+
export class AgoraDollarErc1967Proxy {
|
|
648
|
+
private contract: AgoraDollarErc1967ProxyContract;
|
|
649
|
+
private contractAddress: Address;
|
|
650
|
+
private publicClient: PublicClient;
|
|
651
|
+
|
|
652
|
+
constructor(
|
|
653
|
+
address: Address,
|
|
654
|
+
clients: {
|
|
655
|
+
publicClient: PublicClient;
|
|
656
|
+
walletClient?: WalletClient;
|
|
657
|
+
}
|
|
658
|
+
) {
|
|
659
|
+
this.contractAddress = address;
|
|
660
|
+
this.publicClient = clients.publicClient;
|
|
661
|
+
this.contract = getContract({
|
|
662
|
+
address,
|
|
663
|
+
abi: AgoraDollarErc1967ProxyAbi,
|
|
664
|
+
client: {
|
|
665
|
+
public: clients.publicClient,
|
|
666
|
+
wallet: clients.walletClient,
|
|
667
|
+
},
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Get the contract address
|
|
673
|
+
*/
|
|
674
|
+
get address(): Address {
|
|
675
|
+
return this.contractAddress;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Get the underlying viem contract instance.
|
|
680
|
+
*/
|
|
681
|
+
getContract(): AgoraDollarErc1967ProxyContract {
|
|
682
|
+
return this.contract;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// No read functions
|
|
686
|
+
|
|
687
|
+
async receiveWithAuthorization(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, _validAfter: bigint, _validBefore: bigint, _nonce: `0x${string}`, _signature: `0x${string}`, options?: {
|
|
688
|
+
accessList?: import('viem').AccessList;
|
|
689
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
690
|
+
chain?: import('viem').Chain | null;
|
|
691
|
+
dataSuffix?: `0x${string}`;
|
|
692
|
+
gas?: bigint;
|
|
693
|
+
gasPrice?: bigint;
|
|
694
|
+
maxFeePerGas?: bigint;
|
|
695
|
+
maxPriorityFeePerGas?: bigint;
|
|
696
|
+
nonce?: number;
|
|
697
|
+
value?: bigint;
|
|
698
|
+
}): Promise<`0x${string}`>;
|
|
699
|
+
async receiveWithAuthorization(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, _validAfter: bigint, _validBefore: bigint, _nonce: `0x${string}`, _v: bigint, _r: `0x${string}`, _s: `0x${string}`, options?: {
|
|
700
|
+
accessList?: import('viem').AccessList;
|
|
701
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
702
|
+
chain?: import('viem').Chain | null;
|
|
703
|
+
dataSuffix?: `0x${string}`;
|
|
704
|
+
gas?: bigint;
|
|
705
|
+
gasPrice?: bigint;
|
|
706
|
+
maxFeePerGas?: bigint;
|
|
707
|
+
maxPriorityFeePerGas?: bigint;
|
|
708
|
+
nonce?: number;
|
|
709
|
+
value?: bigint;
|
|
710
|
+
}): Promise<`0x${string}`>;
|
|
711
|
+
async receiveWithAuthorization(...args: any[]): Promise<`0x${string}`> {
|
|
712
|
+
if (!this.contract.write) {
|
|
713
|
+
throw new Error('Wallet client is required for write operations');
|
|
714
|
+
}
|
|
715
|
+
return this.contract.write.receiveWithAuthorization(args as any) as Promise<`0x${string}`>;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* transfer
|
|
720
|
+
* nonpayable
|
|
721
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
722
|
+
*/
|
|
723
|
+
async transfer(_to: `0x${string}`, _transferValue: bigint, options?: {
|
|
724
|
+
accessList?: import('viem').AccessList;
|
|
725
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
726
|
+
chain?: import('viem').Chain | null;
|
|
727
|
+
dataSuffix?: `0x${string}`;
|
|
728
|
+
gas?: bigint;
|
|
729
|
+
gasPrice?: bigint;
|
|
730
|
+
maxFeePerGas?: bigint;
|
|
731
|
+
maxPriorityFeePerGas?: bigint;
|
|
732
|
+
nonce?: number;
|
|
733
|
+
value?: bigint;
|
|
734
|
+
}): Promise<`0x${string}`> {
|
|
735
|
+
if (!this.contract.write) {
|
|
736
|
+
throw new Error('Wallet client is required for write operations');
|
|
737
|
+
}
|
|
738
|
+
return this.contract.write.transfer([_to, _transferValue] as const, options) as Promise<`0x${string}`>;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* transferFrom
|
|
743
|
+
* nonpayable
|
|
744
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
745
|
+
*/
|
|
746
|
+
async transferFrom(_from: `0x${string}`, _to: `0x${string}`, _transferValue: bigint, options?: {
|
|
747
|
+
accessList?: import('viem').AccessList;
|
|
748
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
749
|
+
chain?: import('viem').Chain | null;
|
|
750
|
+
dataSuffix?: `0x${string}`;
|
|
751
|
+
gas?: bigint;
|
|
752
|
+
gasPrice?: bigint;
|
|
753
|
+
maxFeePerGas?: bigint;
|
|
754
|
+
maxPriorityFeePerGas?: bigint;
|
|
755
|
+
nonce?: number;
|
|
756
|
+
value?: bigint;
|
|
757
|
+
}): Promise<`0x${string}`> {
|
|
758
|
+
if (!this.contract.write) {
|
|
759
|
+
throw new Error('Wallet client is required for write operations');
|
|
760
|
+
}
|
|
761
|
+
return this.contract.write.transferFrom([_from, _to, _transferValue] as const, options) as Promise<`0x${string}`>;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
async transferWithAuthorization(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, _validAfter: bigint, _validBefore: bigint, _nonce: `0x${string}`, _signature: `0x${string}`, options?: {
|
|
765
|
+
accessList?: import('viem').AccessList;
|
|
766
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
767
|
+
chain?: import('viem').Chain | null;
|
|
768
|
+
dataSuffix?: `0x${string}`;
|
|
769
|
+
gas?: bigint;
|
|
770
|
+
gasPrice?: bigint;
|
|
771
|
+
maxFeePerGas?: bigint;
|
|
772
|
+
maxPriorityFeePerGas?: bigint;
|
|
773
|
+
nonce?: number;
|
|
774
|
+
value?: bigint;
|
|
775
|
+
}): Promise<`0x${string}`>;
|
|
776
|
+
async transferWithAuthorization(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, _validAfter: bigint, _validBefore: bigint, _nonce: `0x${string}`, _v: bigint, _r: `0x${string}`, _s: `0x${string}`, options?: {
|
|
777
|
+
accessList?: import('viem').AccessList;
|
|
778
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
779
|
+
chain?: import('viem').Chain | null;
|
|
780
|
+
dataSuffix?: `0x${string}`;
|
|
781
|
+
gas?: bigint;
|
|
782
|
+
gasPrice?: bigint;
|
|
783
|
+
maxFeePerGas?: bigint;
|
|
784
|
+
maxPriorityFeePerGas?: bigint;
|
|
785
|
+
nonce?: number;
|
|
786
|
+
value?: bigint;
|
|
787
|
+
}): Promise<`0x${string}`>;
|
|
788
|
+
async transferWithAuthorization(...args: any[]): Promise<`0x${string}`> {
|
|
789
|
+
if (!this.contract.write) {
|
|
790
|
+
throw new Error('Wallet client is required for write operations');
|
|
791
|
+
}
|
|
792
|
+
return this.contract.write.transferWithAuthorization(args as any) as Promise<`0x${string}`>;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Simulate contract write operations (dry-run without sending transaction)
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* const result = await contract.simulate.transfer('0x...', 1000n);
|
|
802
|
+
* console.log('Gas estimate:', result.request.gas);
|
|
803
|
+
* console.log('Would succeed:', result.result);
|
|
804
|
+
*/
|
|
805
|
+
get simulate() {
|
|
806
|
+
const contract = this.contract;
|
|
807
|
+
if (!contract.simulate) {
|
|
808
|
+
throw new Error('Public client is required for simulation');
|
|
809
|
+
}
|
|
810
|
+
return {
|
|
811
|
+
/**
|
|
812
|
+
* Simulate receiveWithAuthorization
|
|
813
|
+
* Returns gas estimate and result without sending transaction
|
|
814
|
+
* Supports multiple overloads: (address, address, uint256, uint256, uint256, bytes32, bytes), (address, address, uint256, uint256, uint256, bytes32, uint8, bytes32, bytes32)
|
|
815
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
816
|
+
*/
|
|
817
|
+
async receiveWithAuthorization(...args: any[]): Promise<any> {
|
|
818
|
+
return contract.simulate.receiveWithAuthorization(args as any) as Promise<any>;
|
|
819
|
+
},
|
|
820
|
+
/**
|
|
821
|
+
* Simulate transfer
|
|
822
|
+
* Returns gas estimate and result without sending transaction
|
|
823
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
824
|
+
*/
|
|
825
|
+
async transfer(_to: `0x${string}`, _transferValue: bigint, options?: {
|
|
826
|
+
accessList?: import('viem').AccessList;
|
|
827
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
828
|
+
chain?: import('viem').Chain | null;
|
|
829
|
+
dataSuffix?: `0x${string}`;
|
|
830
|
+
gas?: bigint;
|
|
831
|
+
gasPrice?: bigint;
|
|
832
|
+
maxFeePerGas?: bigint;
|
|
833
|
+
maxPriorityFeePerGas?: bigint;
|
|
834
|
+
nonce?: number;
|
|
835
|
+
value?: bigint;
|
|
836
|
+
}): Promise<boolean> {
|
|
837
|
+
return contract.simulate.transfer([_to, _transferValue] as const, options) as Promise<boolean>;
|
|
838
|
+
},
|
|
839
|
+
/**
|
|
840
|
+
* Simulate transferFrom
|
|
841
|
+
* Returns gas estimate and result without sending transaction
|
|
842
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
843
|
+
*/
|
|
844
|
+
async transferFrom(_from: `0x${string}`, _to: `0x${string}`, _transferValue: bigint, options?: {
|
|
845
|
+
accessList?: import('viem').AccessList;
|
|
846
|
+
authorizationList?: import('viem').AuthorizationList;
|
|
847
|
+
chain?: import('viem').Chain | null;
|
|
848
|
+
dataSuffix?: `0x${string}`;
|
|
849
|
+
gas?: bigint;
|
|
850
|
+
gasPrice?: bigint;
|
|
851
|
+
maxFeePerGas?: bigint;
|
|
852
|
+
maxPriorityFeePerGas?: bigint;
|
|
853
|
+
nonce?: number;
|
|
854
|
+
value?: bigint;
|
|
855
|
+
}): Promise<boolean> {
|
|
856
|
+
return contract.simulate.transferFrom([_from, _to, _transferValue] as const, options) as Promise<boolean>;
|
|
857
|
+
},
|
|
858
|
+
/**
|
|
859
|
+
* Simulate transferWithAuthorization
|
|
860
|
+
* Returns gas estimate and result without sending transaction
|
|
861
|
+
* Supports multiple overloads: (address, address, uint256, uint256, uint256, bytes32, bytes), (address, address, uint256, uint256, uint256, bytes32, uint8, bytes32, bytes32)
|
|
862
|
+
* @param options Optional transaction parameters (value, gas, nonce, etc.)
|
|
863
|
+
*/
|
|
864
|
+
async transferWithAuthorization(...args: any[]): Promise<any> {
|
|
865
|
+
return contract.simulate.transferWithAuthorization(args as any) as Promise<any>;
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Watch contract events
|
|
872
|
+
*
|
|
873
|
+
* @example
|
|
874
|
+
* // Watch all Transfer events
|
|
875
|
+
* const unwatch = contract.watch.Transfer((event) => {
|
|
876
|
+
* console.log('Transfer:', event);
|
|
877
|
+
* });
|
|
878
|
+
*
|
|
879
|
+
* // Stop watching
|
|
880
|
+
* unwatch();
|
|
881
|
+
*/
|
|
882
|
+
get watch() {
|
|
883
|
+
return {
|
|
884
|
+
/**
|
|
885
|
+
* Watch AdminChanged events
|
|
886
|
+
* @param callback Function to call when event is emitted
|
|
887
|
+
* @param filter Optional filter for indexed parameters
|
|
888
|
+
* @returns Unwatch function to stop listening
|
|
889
|
+
*/
|
|
890
|
+
AdminChanged: (callback: (event: { previousAdmin: `0x${string}`; newAdmin: `0x${string}` }) => void) => {
|
|
891
|
+
return this.publicClient.watchContractEvent({
|
|
892
|
+
address: this.contractAddress,
|
|
893
|
+
abi: AgoraDollarErc1967ProxyAbi,
|
|
894
|
+
eventName: 'AdminChanged',
|
|
895
|
+
|
|
896
|
+
onLogs: (logs: any[]) => {
|
|
897
|
+
logs.forEach((log: any) => {
|
|
898
|
+
callback(log.args as any);
|
|
899
|
+
});
|
|
900
|
+
},
|
|
901
|
+
}) as () => void;
|
|
902
|
+
},
|
|
903
|
+
/**
|
|
904
|
+
* Watch Approval events
|
|
905
|
+
* @param callback Function to call when event is emitted
|
|
906
|
+
* @param filter Optional filter for indexed parameters
|
|
907
|
+
* @returns Unwatch function to stop listening
|
|
908
|
+
*/
|
|
909
|
+
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 }) => {
|
|
910
|
+
return this.publicClient.watchContractEvent({
|
|
911
|
+
address: this.contractAddress,
|
|
912
|
+
abi: AgoraDollarErc1967ProxyAbi,
|
|
913
|
+
eventName: 'Approval',
|
|
914
|
+
args: filter as any,
|
|
915
|
+
onLogs: (logs: any[]) => {
|
|
916
|
+
logs.forEach((log: any) => {
|
|
917
|
+
callback(log.args as any);
|
|
918
|
+
});
|
|
919
|
+
},
|
|
920
|
+
}) as () => void;
|
|
921
|
+
},
|
|
922
|
+
/**
|
|
923
|
+
* Watch AuthorizationCanceled events
|
|
924
|
+
* @param callback Function to call when event is emitted
|
|
925
|
+
* @param filter Optional filter for indexed parameters
|
|
926
|
+
* @returns Unwatch function to stop listening
|
|
927
|
+
*/
|
|
928
|
+
AuthorizationCanceled: (callback: (event: { authorizer: `0x${string}`; nonce: `0x${string}` }) => void, filter?: { authorizer?: `0x${string}` | `0x${string}`[] | null; nonce?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
929
|
+
return this.publicClient.watchContractEvent({
|
|
930
|
+
address: this.contractAddress,
|
|
931
|
+
abi: AgoraDollarErc1967ProxyAbi,
|
|
932
|
+
eventName: 'AuthorizationCanceled',
|
|
933
|
+
args: filter as any,
|
|
934
|
+
onLogs: (logs: any[]) => {
|
|
935
|
+
logs.forEach((log: any) => {
|
|
936
|
+
callback(log.args as any);
|
|
937
|
+
});
|
|
938
|
+
},
|
|
939
|
+
}) as () => void;
|
|
940
|
+
},
|
|
941
|
+
/**
|
|
942
|
+
* Watch AuthorizationUsed events
|
|
943
|
+
* @param callback Function to call when event is emitted
|
|
944
|
+
* @param filter Optional filter for indexed parameters
|
|
945
|
+
* @returns Unwatch function to stop listening
|
|
946
|
+
*/
|
|
947
|
+
AuthorizationUsed: (callback: (event: { authorizer: `0x${string}`; nonce: `0x${string}` }) => void, filter?: { authorizer?: `0x${string}` | `0x${string}`[] | null; nonce?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
948
|
+
return this.publicClient.watchContractEvent({
|
|
949
|
+
address: this.contractAddress,
|
|
950
|
+
abi: AgoraDollarErc1967ProxyAbi,
|
|
951
|
+
eventName: 'AuthorizationUsed',
|
|
952
|
+
args: filter as any,
|
|
953
|
+
onLogs: (logs: any[]) => {
|
|
954
|
+
logs.forEach((log: any) => {
|
|
955
|
+
callback(log.args as any);
|
|
956
|
+
});
|
|
957
|
+
},
|
|
958
|
+
}) as () => void;
|
|
959
|
+
},
|
|
960
|
+
/**
|
|
961
|
+
* Watch Transfer events
|
|
962
|
+
* @param callback Function to call when event is emitted
|
|
963
|
+
* @param filter Optional filter for indexed parameters
|
|
964
|
+
* @returns Unwatch function to stop listening
|
|
965
|
+
*/
|
|
966
|
+
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 }) => {
|
|
967
|
+
return this.publicClient.watchContractEvent({
|
|
968
|
+
address: this.contractAddress,
|
|
969
|
+
abi: AgoraDollarErc1967ProxyAbi,
|
|
970
|
+
eventName: 'Transfer',
|
|
971
|
+
args: filter as any,
|
|
972
|
+
onLogs: (logs: any[]) => {
|
|
973
|
+
logs.forEach((log: any) => {
|
|
974
|
+
callback(log.args as any);
|
|
975
|
+
});
|
|
976
|
+
},
|
|
977
|
+
}) as () => void;
|
|
978
|
+
},
|
|
979
|
+
/**
|
|
980
|
+
* Watch Upgraded events
|
|
981
|
+
* @param callback Function to call when event is emitted
|
|
982
|
+
* @param filter Optional filter for indexed parameters
|
|
983
|
+
* @returns Unwatch function to stop listening
|
|
984
|
+
*/
|
|
985
|
+
Upgraded: (callback: (event: { implementation: `0x${string}` }) => void, filter?: { implementation?: `0x${string}` | `0x${string}`[] | null }) => {
|
|
986
|
+
return this.publicClient.watchContractEvent({
|
|
987
|
+
address: this.contractAddress,
|
|
988
|
+
abi: AgoraDollarErc1967ProxyAbi,
|
|
989
|
+
eventName: 'Upgraded',
|
|
990
|
+
args: filter as any,
|
|
991
|
+
onLogs: (logs: any[]) => {
|
|
992
|
+
logs.forEach((log: any) => {
|
|
993
|
+
callback(log.args as any);
|
|
994
|
+
});
|
|
995
|
+
},
|
|
996
|
+
}) as () => void;
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
}
|