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