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