@chainflip/sdk 1.8.0-assethub.2 → 1.8.0-beta.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/dist/chunk-HBQFFIRA.mjs +292 -0
- package/dist/{contracts-BmyTFuGH.d.mts → enums-_AFEOA70.d.mts} +3 -18
- package/dist/{contracts-BmyTFuGH.d.ts → enums-_AFEOA70.d.ts} +3 -18
- package/dist/funding.d.mts +10 -1
- package/dist/funding.d.ts +10 -1
- package/dist/funding.js +94 -374
- package/dist/funding.mjs +832 -43
- package/dist/swap.d.mts +86 -73
- package/dist/swap.d.ts +86 -73
- package/dist/swap.js +914 -14135
- package/dist/swap.mjs +500 -12237
- package/package.json +17 -12
- package/dist/chunk-5BNVUJZY.mjs +0 -2453
package/dist/funding.mjs
CHANGED
|
@@ -1,82 +1,873 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChainflipNetworks, getFundingEnvironment, assert, ADDRESSES } from './chunk-HBQFFIRA.mjs';
|
|
2
|
+
import { Interface, Contract } from 'ethers';
|
|
3
|
+
|
|
4
|
+
var _abi = [
|
|
5
|
+
{
|
|
6
|
+
inputs: [
|
|
7
|
+
{
|
|
8
|
+
internalType: "address",
|
|
9
|
+
name: "owner",
|
|
10
|
+
type: "address"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
internalType: "address",
|
|
14
|
+
name: "spender",
|
|
15
|
+
type: "address"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
name: "allowance",
|
|
19
|
+
outputs: [
|
|
20
|
+
{
|
|
21
|
+
internalType: "uint256",
|
|
22
|
+
name: "",
|
|
23
|
+
type: "uint256"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
stateMutability: "view",
|
|
27
|
+
type: "function"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
inputs: [
|
|
31
|
+
{
|
|
32
|
+
internalType: "address",
|
|
33
|
+
name: "spender",
|
|
34
|
+
type: "address"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
internalType: "uint256",
|
|
38
|
+
name: "amount",
|
|
39
|
+
type: "uint256"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
name: "approve",
|
|
43
|
+
outputs: [
|
|
44
|
+
{
|
|
45
|
+
internalType: "bool",
|
|
46
|
+
name: "",
|
|
47
|
+
type: "bool"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
stateMutability: "nonpayable",
|
|
51
|
+
type: "function"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
inputs: [
|
|
55
|
+
{
|
|
56
|
+
internalType: "address",
|
|
57
|
+
name: "account",
|
|
58
|
+
type: "address"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
name: "balanceOf",
|
|
62
|
+
outputs: [
|
|
63
|
+
{
|
|
64
|
+
internalType: "uint256",
|
|
65
|
+
name: "",
|
|
66
|
+
type: "uint256"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
stateMutability: "view",
|
|
70
|
+
type: "function"
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
var ERC20__factory = class {
|
|
74
|
+
static createInterface() {
|
|
75
|
+
return new Interface(_abi);
|
|
76
|
+
}
|
|
77
|
+
static connect(address, runner) {
|
|
78
|
+
return new Contract(address, _abi, runner);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
ERC20__factory.abi = _abi;
|
|
82
|
+
var _abi2 = [
|
|
83
|
+
{
|
|
84
|
+
inputs: [
|
|
85
|
+
{
|
|
86
|
+
internalType: "contract IKeyManager",
|
|
87
|
+
name: "keyManager",
|
|
88
|
+
type: "address"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
internalType: "uint256",
|
|
92
|
+
name: "minFunding",
|
|
93
|
+
type: "uint256"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
stateMutability: "nonpayable",
|
|
97
|
+
type: "constructor"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
anonymous: false,
|
|
101
|
+
inputs: [
|
|
102
|
+
{
|
|
103
|
+
indexed: false,
|
|
104
|
+
internalType: "bool",
|
|
105
|
+
name: "communityGuardDisabled",
|
|
106
|
+
type: "bool"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
name: "CommunityGuardDisabled",
|
|
110
|
+
type: "event"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
anonymous: false,
|
|
114
|
+
inputs: [
|
|
115
|
+
{
|
|
116
|
+
indexed: false,
|
|
117
|
+
internalType: "address",
|
|
118
|
+
name: "flip",
|
|
119
|
+
type: "address"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
name: "FLIPSet",
|
|
123
|
+
type: "event"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
anonymous: false,
|
|
127
|
+
inputs: [
|
|
128
|
+
{
|
|
129
|
+
indexed: false,
|
|
130
|
+
internalType: "uint256",
|
|
131
|
+
name: "oldSupply",
|
|
132
|
+
type: "uint256"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
indexed: false,
|
|
136
|
+
internalType: "uint256",
|
|
137
|
+
name: "newSupply",
|
|
138
|
+
type: "uint256"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
indexed: false,
|
|
142
|
+
internalType: "uint256",
|
|
143
|
+
name: "stateChainBlockNumber",
|
|
144
|
+
type: "uint256"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
name: "FlipSupplyUpdated",
|
|
148
|
+
type: "event"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
anonymous: false,
|
|
152
|
+
inputs: [
|
|
153
|
+
{
|
|
154
|
+
indexed: true,
|
|
155
|
+
internalType: "bytes32",
|
|
156
|
+
name: "nodeID",
|
|
157
|
+
type: "bytes32"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
indexed: false,
|
|
161
|
+
internalType: "uint256",
|
|
162
|
+
name: "amount",
|
|
163
|
+
type: "uint256"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
indexed: false,
|
|
167
|
+
internalType: "address",
|
|
168
|
+
name: "funder",
|
|
169
|
+
type: "address"
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
name: "Funded",
|
|
173
|
+
type: "event"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
anonymous: false,
|
|
177
|
+
inputs: [
|
|
178
|
+
{
|
|
179
|
+
indexed: false,
|
|
180
|
+
internalType: "address",
|
|
181
|
+
name: "to",
|
|
182
|
+
type: "address"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
indexed: false,
|
|
186
|
+
internalType: "uint256",
|
|
187
|
+
name: "amount",
|
|
188
|
+
type: "uint256"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
name: "GovernanceWithdrawal",
|
|
192
|
+
type: "event"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
anonymous: false,
|
|
196
|
+
inputs: [
|
|
197
|
+
{
|
|
198
|
+
indexed: false,
|
|
199
|
+
internalType: "uint256",
|
|
200
|
+
name: "oldMinFunding",
|
|
201
|
+
type: "uint256"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
indexed: false,
|
|
205
|
+
internalType: "uint256",
|
|
206
|
+
name: "newMinFunding",
|
|
207
|
+
type: "uint256"
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
name: "MinFundingChanged",
|
|
211
|
+
type: "event"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
anonymous: false,
|
|
215
|
+
inputs: [
|
|
216
|
+
{
|
|
217
|
+
indexed: true,
|
|
218
|
+
internalType: "bytes32",
|
|
219
|
+
name: "nodeID",
|
|
220
|
+
type: "bytes32"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
indexed: false,
|
|
224
|
+
internalType: "uint256",
|
|
225
|
+
name: "amount",
|
|
226
|
+
type: "uint256"
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
name: "RedemptionExecuted",
|
|
230
|
+
type: "event"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
anonymous: false,
|
|
234
|
+
inputs: [
|
|
235
|
+
{
|
|
236
|
+
indexed: true,
|
|
237
|
+
internalType: "bytes32",
|
|
238
|
+
name: "nodeID",
|
|
239
|
+
type: "bytes32"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
indexed: false,
|
|
243
|
+
internalType: "uint256",
|
|
244
|
+
name: "amount",
|
|
245
|
+
type: "uint256"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
name: "RedemptionExpired",
|
|
249
|
+
type: "event"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
anonymous: false,
|
|
253
|
+
inputs: [
|
|
254
|
+
{
|
|
255
|
+
indexed: true,
|
|
256
|
+
internalType: "bytes32",
|
|
257
|
+
name: "nodeID",
|
|
258
|
+
type: "bytes32"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
indexed: false,
|
|
262
|
+
internalType: "uint256",
|
|
263
|
+
name: "amount",
|
|
264
|
+
type: "uint256"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
indexed: true,
|
|
268
|
+
internalType: "address",
|
|
269
|
+
name: "redeemAddress",
|
|
270
|
+
type: "address"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
indexed: false,
|
|
274
|
+
internalType: "uint48",
|
|
275
|
+
name: "startTime",
|
|
276
|
+
type: "uint48"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
indexed: false,
|
|
280
|
+
internalType: "uint48",
|
|
281
|
+
name: "expiryTime",
|
|
282
|
+
type: "uint48"
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
name: "RedemptionRegistered",
|
|
286
|
+
type: "event"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
anonymous: false,
|
|
290
|
+
inputs: [
|
|
291
|
+
{
|
|
292
|
+
indexed: false,
|
|
293
|
+
internalType: "bool",
|
|
294
|
+
name: "suspended",
|
|
295
|
+
type: "bool"
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
name: "Suspended",
|
|
299
|
+
type: "event"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
anonymous: false,
|
|
303
|
+
inputs: [
|
|
304
|
+
{
|
|
305
|
+
indexed: false,
|
|
306
|
+
internalType: "address",
|
|
307
|
+
name: "keyManager",
|
|
308
|
+
type: "address"
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
name: "UpdatedKeyManager",
|
|
312
|
+
type: "event"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
inputs: [],
|
|
316
|
+
name: "REDEMPTION_DELAY",
|
|
317
|
+
outputs: [
|
|
318
|
+
{
|
|
319
|
+
internalType: "uint48",
|
|
320
|
+
name: "",
|
|
321
|
+
type: "uint48"
|
|
322
|
+
}
|
|
323
|
+
],
|
|
324
|
+
stateMutability: "view",
|
|
325
|
+
type: "function"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
inputs: [],
|
|
329
|
+
name: "disableCommunityGuard",
|
|
330
|
+
outputs: [],
|
|
331
|
+
stateMutability: "nonpayable",
|
|
332
|
+
type: "function"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
inputs: [],
|
|
336
|
+
name: "enableCommunityGuard",
|
|
337
|
+
outputs: [],
|
|
338
|
+
stateMutability: "nonpayable",
|
|
339
|
+
type: "function"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
inputs: [
|
|
343
|
+
{
|
|
344
|
+
internalType: "bytes32",
|
|
345
|
+
name: "nodeID",
|
|
346
|
+
type: "bytes32"
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
name: "executeRedemption",
|
|
350
|
+
outputs: [],
|
|
351
|
+
stateMutability: "nonpayable",
|
|
352
|
+
type: "function"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
inputs: [
|
|
356
|
+
{
|
|
357
|
+
internalType: "bytes32",
|
|
358
|
+
name: "nodeID",
|
|
359
|
+
type: "bytes32"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
internalType: "uint256",
|
|
363
|
+
name: "amount",
|
|
364
|
+
type: "uint256"
|
|
365
|
+
}
|
|
366
|
+
],
|
|
367
|
+
name: "fundStateChainAccount",
|
|
368
|
+
outputs: [],
|
|
369
|
+
stateMutability: "nonpayable",
|
|
370
|
+
type: "function"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
inputs: [],
|
|
374
|
+
name: "getCommunityGuardDisabled",
|
|
375
|
+
outputs: [
|
|
376
|
+
{
|
|
377
|
+
internalType: "bool",
|
|
378
|
+
name: "",
|
|
379
|
+
type: "bool"
|
|
380
|
+
}
|
|
381
|
+
],
|
|
382
|
+
stateMutability: "view",
|
|
383
|
+
type: "function"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
inputs: [],
|
|
387
|
+
name: "getCommunityKey",
|
|
388
|
+
outputs: [
|
|
389
|
+
{
|
|
390
|
+
internalType: "address",
|
|
391
|
+
name: "",
|
|
392
|
+
type: "address"
|
|
393
|
+
}
|
|
394
|
+
],
|
|
395
|
+
stateMutability: "view",
|
|
396
|
+
type: "function"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
inputs: [],
|
|
400
|
+
name: "getFLIP",
|
|
401
|
+
outputs: [
|
|
402
|
+
{
|
|
403
|
+
internalType: "contract IFLIP",
|
|
404
|
+
name: "",
|
|
405
|
+
type: "address"
|
|
406
|
+
}
|
|
407
|
+
],
|
|
408
|
+
stateMutability: "view",
|
|
409
|
+
type: "function"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
inputs: [],
|
|
413
|
+
name: "getGovernor",
|
|
414
|
+
outputs: [
|
|
415
|
+
{
|
|
416
|
+
internalType: "address",
|
|
417
|
+
name: "",
|
|
418
|
+
type: "address"
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
stateMutability: "view",
|
|
422
|
+
type: "function"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
inputs: [],
|
|
426
|
+
name: "getKeyManager",
|
|
427
|
+
outputs: [
|
|
428
|
+
{
|
|
429
|
+
internalType: "contract IKeyManager",
|
|
430
|
+
name: "",
|
|
431
|
+
type: "address"
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
stateMutability: "view",
|
|
435
|
+
type: "function"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
inputs: [],
|
|
439
|
+
name: "getLastSupplyUpdateBlockNumber",
|
|
440
|
+
outputs: [
|
|
441
|
+
{
|
|
442
|
+
internalType: "uint256",
|
|
443
|
+
name: "",
|
|
444
|
+
type: "uint256"
|
|
445
|
+
}
|
|
446
|
+
],
|
|
447
|
+
stateMutability: "view",
|
|
448
|
+
type: "function"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
inputs: [],
|
|
452
|
+
name: "getMinimumFunding",
|
|
453
|
+
outputs: [
|
|
454
|
+
{
|
|
455
|
+
internalType: "uint256",
|
|
456
|
+
name: "",
|
|
457
|
+
type: "uint256"
|
|
458
|
+
}
|
|
459
|
+
],
|
|
460
|
+
stateMutability: "view",
|
|
461
|
+
type: "function"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
inputs: [
|
|
465
|
+
{
|
|
466
|
+
internalType: "bytes32",
|
|
467
|
+
name: "nodeID",
|
|
468
|
+
type: "bytes32"
|
|
469
|
+
}
|
|
470
|
+
],
|
|
471
|
+
name: "getPendingRedemption",
|
|
472
|
+
outputs: [
|
|
473
|
+
{
|
|
474
|
+
components: [
|
|
475
|
+
{
|
|
476
|
+
internalType: "uint256",
|
|
477
|
+
name: "amount",
|
|
478
|
+
type: "uint256"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
internalType: "address",
|
|
482
|
+
name: "redeemAddress",
|
|
483
|
+
type: "address"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
internalType: "uint48",
|
|
487
|
+
name: "startTime",
|
|
488
|
+
type: "uint48"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
internalType: "uint48",
|
|
492
|
+
name: "expiryTime",
|
|
493
|
+
type: "uint48"
|
|
494
|
+
}
|
|
495
|
+
],
|
|
496
|
+
internalType: "struct IStateChainGateway.Redemption",
|
|
497
|
+
name: "",
|
|
498
|
+
type: "tuple"
|
|
499
|
+
}
|
|
500
|
+
],
|
|
501
|
+
stateMutability: "view",
|
|
502
|
+
type: "function"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
inputs: [],
|
|
506
|
+
name: "getSuspendedState",
|
|
507
|
+
outputs: [
|
|
508
|
+
{
|
|
509
|
+
internalType: "bool",
|
|
510
|
+
name: "",
|
|
511
|
+
type: "bool"
|
|
512
|
+
}
|
|
513
|
+
],
|
|
514
|
+
stateMutability: "view",
|
|
515
|
+
type: "function"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
inputs: [],
|
|
519
|
+
name: "govUpdateFlipIssuer",
|
|
520
|
+
outputs: [],
|
|
521
|
+
stateMutability: "nonpayable",
|
|
522
|
+
type: "function"
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
inputs: [],
|
|
526
|
+
name: "govWithdraw",
|
|
527
|
+
outputs: [],
|
|
528
|
+
stateMutability: "nonpayable",
|
|
529
|
+
type: "function"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
inputs: [
|
|
533
|
+
{
|
|
534
|
+
components: [
|
|
535
|
+
{
|
|
536
|
+
internalType: "uint256",
|
|
537
|
+
name: "sig",
|
|
538
|
+
type: "uint256"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
internalType: "uint256",
|
|
542
|
+
name: "nonce",
|
|
543
|
+
type: "uint256"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
internalType: "address",
|
|
547
|
+
name: "kTimesGAddress",
|
|
548
|
+
type: "address"
|
|
549
|
+
}
|
|
550
|
+
],
|
|
551
|
+
internalType: "struct IShared.SigData",
|
|
552
|
+
name: "sigData",
|
|
553
|
+
type: "tuple"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
internalType: "bytes32",
|
|
557
|
+
name: "nodeID",
|
|
558
|
+
type: "bytes32"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
internalType: "uint256",
|
|
562
|
+
name: "amount",
|
|
563
|
+
type: "uint256"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
internalType: "address",
|
|
567
|
+
name: "redeemAddress",
|
|
568
|
+
type: "address"
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
internalType: "uint48",
|
|
572
|
+
name: "expiryTime",
|
|
573
|
+
type: "uint48"
|
|
574
|
+
}
|
|
575
|
+
],
|
|
576
|
+
name: "registerRedemption",
|
|
577
|
+
outputs: [],
|
|
578
|
+
stateMutability: "nonpayable",
|
|
579
|
+
type: "function"
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
inputs: [],
|
|
583
|
+
name: "resume",
|
|
584
|
+
outputs: [],
|
|
585
|
+
stateMutability: "nonpayable",
|
|
586
|
+
type: "function"
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
inputs: [
|
|
590
|
+
{
|
|
591
|
+
internalType: "contract IFLIP",
|
|
592
|
+
name: "flip",
|
|
593
|
+
type: "address"
|
|
594
|
+
}
|
|
595
|
+
],
|
|
596
|
+
name: "setFlip",
|
|
597
|
+
outputs: [],
|
|
598
|
+
stateMutability: "nonpayable",
|
|
599
|
+
type: "function"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
inputs: [
|
|
603
|
+
{
|
|
604
|
+
internalType: "uint256",
|
|
605
|
+
name: "newMinFunding",
|
|
606
|
+
type: "uint256"
|
|
607
|
+
}
|
|
608
|
+
],
|
|
609
|
+
name: "setMinFunding",
|
|
610
|
+
outputs: [],
|
|
611
|
+
stateMutability: "nonpayable",
|
|
612
|
+
type: "function"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
inputs: [],
|
|
616
|
+
name: "suspend",
|
|
617
|
+
outputs: [],
|
|
618
|
+
stateMutability: "nonpayable",
|
|
619
|
+
type: "function"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
inputs: [
|
|
623
|
+
{
|
|
624
|
+
components: [
|
|
625
|
+
{
|
|
626
|
+
internalType: "uint256",
|
|
627
|
+
name: "sig",
|
|
628
|
+
type: "uint256"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
internalType: "uint256",
|
|
632
|
+
name: "nonce",
|
|
633
|
+
type: "uint256"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
internalType: "address",
|
|
637
|
+
name: "kTimesGAddress",
|
|
638
|
+
type: "address"
|
|
639
|
+
}
|
|
640
|
+
],
|
|
641
|
+
internalType: "struct IShared.SigData",
|
|
642
|
+
name: "sigData",
|
|
643
|
+
type: "tuple"
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
internalType: "address",
|
|
647
|
+
name: "newIssuer",
|
|
648
|
+
type: "address"
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
internalType: "bool",
|
|
652
|
+
name: "omitChecks",
|
|
653
|
+
type: "bool"
|
|
654
|
+
}
|
|
655
|
+
],
|
|
656
|
+
name: "updateFlipIssuer",
|
|
657
|
+
outputs: [],
|
|
658
|
+
stateMutability: "nonpayable",
|
|
659
|
+
type: "function"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
inputs: [
|
|
663
|
+
{
|
|
664
|
+
components: [
|
|
665
|
+
{
|
|
666
|
+
internalType: "uint256",
|
|
667
|
+
name: "sig",
|
|
668
|
+
type: "uint256"
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
internalType: "uint256",
|
|
672
|
+
name: "nonce",
|
|
673
|
+
type: "uint256"
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
internalType: "address",
|
|
677
|
+
name: "kTimesGAddress",
|
|
678
|
+
type: "address"
|
|
679
|
+
}
|
|
680
|
+
],
|
|
681
|
+
internalType: "struct IShared.SigData",
|
|
682
|
+
name: "sigData",
|
|
683
|
+
type: "tuple"
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
internalType: "uint256",
|
|
687
|
+
name: "newTotalSupply",
|
|
688
|
+
type: "uint256"
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
internalType: "uint256",
|
|
692
|
+
name: "stateChainBlockNumber",
|
|
693
|
+
type: "uint256"
|
|
694
|
+
}
|
|
695
|
+
],
|
|
696
|
+
name: "updateFlipSupply",
|
|
697
|
+
outputs: [],
|
|
698
|
+
stateMutability: "nonpayable",
|
|
699
|
+
type: "function"
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
inputs: [
|
|
703
|
+
{
|
|
704
|
+
components: [
|
|
705
|
+
{
|
|
706
|
+
internalType: "uint256",
|
|
707
|
+
name: "sig",
|
|
708
|
+
type: "uint256"
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
internalType: "uint256",
|
|
712
|
+
name: "nonce",
|
|
713
|
+
type: "uint256"
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
internalType: "address",
|
|
717
|
+
name: "kTimesGAddress",
|
|
718
|
+
type: "address"
|
|
719
|
+
}
|
|
720
|
+
],
|
|
721
|
+
internalType: "struct IShared.SigData",
|
|
722
|
+
name: "sigData",
|
|
723
|
+
type: "tuple"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
internalType: "contract IKeyManager",
|
|
727
|
+
name: "keyManager",
|
|
728
|
+
type: "address"
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
internalType: "bool",
|
|
732
|
+
name: "omitChecks",
|
|
733
|
+
type: "bool"
|
|
734
|
+
}
|
|
735
|
+
],
|
|
736
|
+
name: "updateKeyManager",
|
|
737
|
+
outputs: [],
|
|
738
|
+
stateMutability: "nonpayable",
|
|
739
|
+
type: "function"
|
|
740
|
+
}
|
|
741
|
+
];
|
|
742
|
+
var StateChainGateway__factory = class {
|
|
743
|
+
static createInterface() {
|
|
744
|
+
return new Interface(_abi2);
|
|
745
|
+
}
|
|
746
|
+
static connect(address, runner) {
|
|
747
|
+
return new Contract(address, _abi2, runner);
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
StateChainGateway__factory.abi = _abi2;
|
|
751
|
+
|
|
752
|
+
// ../shared/src/contracts.ts
|
|
753
|
+
var extractOverrides = (transactionOverrides) => {
|
|
754
|
+
const { wait, ...ethersOverrides } = transactionOverrides;
|
|
755
|
+
return ethersOverrides;
|
|
756
|
+
};
|
|
757
|
+
var getFlipContractAddress = (network) => ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
|
|
758
|
+
var getStateChainGatewayContractAddress = (network) => ADDRESSES[network].STATE_CHAIN_GATEWAY_ADDRESS;
|
|
759
|
+
var checkAllowance = async (amount, spenderAddress, erc20Address, signer) => {
|
|
760
|
+
const erc20 = ERC20__factory.connect(erc20Address, signer);
|
|
761
|
+
const signerAddress = await signer.getAddress();
|
|
762
|
+
const allowance = await erc20.allowance(signerAddress, spenderAddress);
|
|
763
|
+
return { allowance, hasSufficientAllowance: allowance >= amount, erc20 };
|
|
764
|
+
};
|
|
765
|
+
var approve = async (amount, spenderAddress, erc20, allowance, txOpts) => {
|
|
766
|
+
if (allowance >= amount) return null;
|
|
767
|
+
const transaction = await erc20.approve(
|
|
768
|
+
spenderAddress,
|
|
769
|
+
amount - allowance,
|
|
770
|
+
extractOverrides(txOpts)
|
|
771
|
+
);
|
|
772
|
+
await transaction.wait(txOpts.wait);
|
|
773
|
+
return transaction;
|
|
774
|
+
};
|
|
775
|
+
var getFlipBalance = async (network, signer) => {
|
|
776
|
+
const flipAddress = getFlipContractAddress(network);
|
|
777
|
+
const flip = ERC20__factory.connect(flipAddress, signer);
|
|
778
|
+
return flip.balanceOf(await signer.getAddress());
|
|
779
|
+
};
|
|
2
780
|
|
|
3
781
|
// ../shared/src/stateChainGateway/utils.ts
|
|
4
|
-
var getStateChainGateway =
|
|
782
|
+
var getStateChainGateway = (networkOpts) => {
|
|
5
783
|
const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
|
|
6
784
|
return StateChainGateway__factory.connect(stateChainGatewayContractAddress, networkOpts.signer);
|
|
7
|
-
}
|
|
785
|
+
};
|
|
8
786
|
|
|
9
787
|
// ../shared/src/stateChainGateway/approval.ts
|
|
10
|
-
var checkStateChainGatewayAllowance =
|
|
11
|
-
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress :
|
|
788
|
+
var checkStateChainGatewayAllowance = async (amount, networkOpts) => {
|
|
789
|
+
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getFlipContractAddress(networkOpts.network);
|
|
12
790
|
const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
|
|
13
|
-
return checkAllowance(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
791
|
+
return checkAllowance(
|
|
792
|
+
amount,
|
|
793
|
+
stateChainGatewayContractAddress,
|
|
794
|
+
flipContractAddress,
|
|
795
|
+
networkOpts.signer
|
|
796
|
+
);
|
|
797
|
+
};
|
|
798
|
+
var approveStateChainGateway = async (amount, networkOpts, txOpts) => {
|
|
799
|
+
const { allowance, erc20, hasSufficientAllowance } = await checkStateChainGatewayAllowance(
|
|
800
|
+
amount,
|
|
801
|
+
networkOpts
|
|
802
|
+
);
|
|
17
803
|
if (hasSufficientAllowance) return null;
|
|
18
804
|
const stateChainGatewayContractAddress = networkOpts.network === "localnet" ? networkOpts.stateChainGatewayContractAddress : getStateChainGatewayContractAddress(networkOpts.network);
|
|
19
805
|
return approve(amount, stateChainGatewayContractAddress, erc20, allowance, txOpts);
|
|
20
|
-
}
|
|
806
|
+
};
|
|
21
807
|
|
|
22
808
|
// ../shared/src/stateChainGateway/index.ts
|
|
23
|
-
var fundStateChainAccount =
|
|
24
|
-
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress :
|
|
809
|
+
var fundStateChainAccount = async (accountId, amount, networkOpts, txOpts) => {
|
|
810
|
+
const flipContractAddress = networkOpts.network === "localnet" ? networkOpts.flipContractAddress : getFlipContractAddress(networkOpts.network);
|
|
25
811
|
const stateChainGateway = getStateChainGateway(networkOpts);
|
|
26
|
-
const { hasSufficientAllowance } = await checkAllowance(
|
|
812
|
+
const { hasSufficientAllowance } = await checkAllowance(
|
|
813
|
+
amount,
|
|
814
|
+
await stateChainGateway.getAddress(),
|
|
815
|
+
flipContractAddress,
|
|
816
|
+
networkOpts.signer
|
|
817
|
+
);
|
|
27
818
|
assert(hasSufficientAllowance, "Insufficient allowance");
|
|
28
|
-
const transaction = await stateChainGateway.fundStateChainAccount(
|
|
819
|
+
const transaction = await stateChainGateway.fundStateChainAccount(
|
|
820
|
+
accountId,
|
|
821
|
+
amount,
|
|
822
|
+
extractOverrides(txOpts)
|
|
823
|
+
);
|
|
29
824
|
await transaction.wait(txOpts.wait);
|
|
30
825
|
return transaction;
|
|
31
|
-
}
|
|
32
|
-
var executeRedemption =
|
|
826
|
+
};
|
|
827
|
+
var executeRedemption = async (accountId, networkOpts, txOpts) => {
|
|
33
828
|
const stateChainGateway = getStateChainGateway(networkOpts);
|
|
34
|
-
const transaction = await stateChainGateway.executeRedemption(
|
|
829
|
+
const transaction = await stateChainGateway.executeRedemption(
|
|
830
|
+
accountId,
|
|
831
|
+
extractOverrides(txOpts)
|
|
832
|
+
);
|
|
35
833
|
await transaction.wait(txOpts.wait);
|
|
36
834
|
return transaction;
|
|
37
|
-
}
|
|
38
|
-
var getMinimumFunding =
|
|
835
|
+
};
|
|
836
|
+
var getMinimumFunding = (networkOpts) => {
|
|
39
837
|
const stateChainGateway = getStateChainGateway(networkOpts);
|
|
40
838
|
return stateChainGateway.getMinimumFunding();
|
|
41
|
-
}
|
|
42
|
-
var getRedemptionDelay =
|
|
839
|
+
};
|
|
840
|
+
var getRedemptionDelay = (networkOpts) => {
|
|
43
841
|
const stateChainGateway = getStateChainGateway(networkOpts);
|
|
44
842
|
return stateChainGateway.REDEMPTION_DELAY();
|
|
45
|
-
}
|
|
46
|
-
var getPendingRedemption =
|
|
843
|
+
};
|
|
844
|
+
var getPendingRedemption = async (accountId, networkOpts) => {
|
|
47
845
|
const stateChainGateway = getStateChainGateway(networkOpts);
|
|
48
846
|
const pendingRedemption = await stateChainGateway.getPendingRedemption(accountId);
|
|
49
847
|
return pendingRedemption.amount !== 0n ? stateChainGateway.getPendingRedemption(accountId) : void 0;
|
|
50
|
-
}
|
|
848
|
+
};
|
|
51
849
|
|
|
52
850
|
// src/funding/sdk.ts
|
|
53
|
-
var
|
|
851
|
+
var FundingSDK = class {
|
|
54
852
|
constructor(options) {
|
|
55
|
-
__publicField(this, "options");
|
|
56
|
-
__publicField(this, "rpcConfig");
|
|
57
|
-
__publicField(this, "redemptionTax");
|
|
58
853
|
const network = options.network ?? ChainflipNetworks.perseverance;
|
|
59
854
|
this.options = {
|
|
60
855
|
...options,
|
|
61
856
|
network
|
|
62
857
|
};
|
|
63
|
-
this.rpcConfig = options.rpcUrl ? {
|
|
64
|
-
rpcUrl: options.rpcUrl
|
|
65
|
-
} : {
|
|
66
|
-
network
|
|
67
|
-
};
|
|
858
|
+
this.rpcConfig = options.rpcUrl ? { rpcUrl: options.rpcUrl } : { network };
|
|
68
859
|
}
|
|
69
860
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
861
|
+
* @param accountId the hex-encoded validator account id
|
|
862
|
+
* @param amount the amount to fund in base units of FLIP
|
|
863
|
+
*/
|
|
73
864
|
async fundStateChainAccount(accountId, amount, txOpts = {}) {
|
|
74
865
|
const tx = await fundStateChainAccount(accountId, amount, this.options, txOpts);
|
|
75
866
|
return tx.hash;
|
|
76
867
|
}
|
|
77
868
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
869
|
+
* @param accountId the hex-encoded validator account id
|
|
870
|
+
*/
|
|
80
871
|
async executeRedemption(accountId, txOpts = {}) {
|
|
81
872
|
const tx = await executeRedemption(accountId, this.options, txOpts);
|
|
82
873
|
return tx.hash;
|
|
@@ -94,9 +885,9 @@ var _FundingSDK = class _FundingSDK {
|
|
|
94
885
|
return getPendingRedemption(accountId, this.options);
|
|
95
886
|
}
|
|
96
887
|
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
888
|
+
* @param the amount of FLIP to request approval for
|
|
889
|
+
* @returns the transaction hash or null if no approval was required
|
|
890
|
+
*/
|
|
100
891
|
async approveStateChainGateway(amount, txOpts = {}) {
|
|
101
892
|
const tx = await approveStateChainGateway(amount, this.options, txOpts);
|
|
102
893
|
return tx ? tx.hash : null;
|
|
@@ -106,7 +897,5 @@ var _FundingSDK = class _FundingSDK {
|
|
|
106
897
|
return this.redemptionTax;
|
|
107
898
|
}
|
|
108
899
|
};
|
|
109
|
-
__name(_FundingSDK, "FundingSDK");
|
|
110
|
-
var FundingSDK = _FundingSDK;
|
|
111
900
|
|
|
112
901
|
export { FundingSDK };
|