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