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