@lombard.finance/sdk-solana 2.0.1 → 2.0.2
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/index.cjs +1 -1
- package/dist/index.js +23 -22
- package/dist/index2.cjs +47 -47
- package/dist/index2.js +6103 -6029
- package/dist/sendBridgeTransaction.cjs +1 -1
- package/dist/sendBridgeTransaction.js +19 -19
- package/package.json +1 -1
- package/src/bridge/sendBridgeTransaction.ts +2 -2
- package/src/const/__tests__/rpcUrls.test.ts +73 -0
- package/src/const/errors.ts +0 -1
- package/src/const/getConfig.ts +30 -15
- package/src/const/rpcUrls.ts +53 -7
- package/src/idl/asset_router.json +182 -1532
- package/src/idl/bridge.json +139 -1185
- package/src/idl/consortium.json +62 -498
- package/src/idl/getAssetRouterIdl.ts +1 -3
- package/src/idl/getConsortiumIdl.ts +1 -3
- package/src/idl/getLbtcIdl.ts +4 -1
- package/src/idl/getMailboxIdl.ts +1 -3
- package/src/idl/lombard_token_pool.json +92 -932
- package/src/idl/mailbox.json +114 -1018
- package/src/idl/ratio_oracle.json +35 -332
- package/src/services/SolanaServiceImpl.test.ts +5 -4
- package/src/stories/components/ConnectButton/ConnectButton.tsx +2 -2
- package/src/stories/components/NetworkSelector/NetworkSelector.tsx +1 -1
- package/src/stories/components/OutputSelector/OutputSelector.tsx +4 -4
- package/src/stories/components/SelectField/SelectField.tsx +2 -3
- package/src/stories/hooks/useFetchOutputs.ts +1 -1
- package/src/stories/utils/fromCamelCase.ts +1 -1
- package/src/types/sdkTypes.ts +7 -0
- package/src/utils/createDebugLogger.ts +1 -1
- package/src/web3Sdk/claimToken/claimBtcb.ts +19 -5
- package/src/web3Sdk/claimToken/claimLbtcGmp.ts +55 -25
- package/src/web3Sdk/claimToken/claimToken.stories.tsx +4 -3
- package/src/web3Sdk/claimToken/claimToken.ts +16 -6
- package/src/web3Sdk/claimToken/shared.ts +18 -12
- package/src/web3Sdk/claimToken/utils/__tests__/signatureUtils.test.ts +10 -4
- package/src/web3Sdk/claimToken/utils/signatureUtils.ts +3 -1
- package/src/web3Sdk/deposit/deposit.stories.tsx +1 -4
- package/src/web3Sdk/deposit/deposit.test.ts +67 -37
- package/src/web3Sdk/deposit/deposit.ts +14 -14
- package/src/web3Sdk/detectWallet/detectWallet.test.ts +2 -2
- package/src/web3Sdk/getBalance/getBalance.test.ts +1 -1
- package/src/web3Sdk/getBalance/getBalance.ts +2 -1
- package/src/web3Sdk/getTokenFeeConfig/getTokenFeeConfig.stories.tsx +8 -18
- package/src/web3Sdk/getTokenFeeConfig/getTokenFeeConfig.ts +2 -4
- package/src/web3Sdk/redeem/redeem.stories.tsx +17 -8
- package/src/web3Sdk/redeem/redeem.test.ts +45 -13
- package/src/web3Sdk/redeem/redeem.ts +46 -20
- package/src/web3Sdk/redeemToken/redeemBtcb.ts +28 -12
- package/src/web3Sdk/redeemToken/redeemForBtc.stories.tsx +6 -6
- package/src/web3Sdk/redeemToken/redeemForBtc.test.ts +43 -13
- package/src/web3Sdk/redeemToken/redeemForBtc.ts +27 -14
- package/src/web3Sdk/redeemToken/redeemLbtc.ts +28 -12
- package/src/web3Sdk/redeemToken/shared.test.ts +6 -2
- package/src/web3Sdk/redeemToken/shared.ts +1 -3
|
@@ -9,16 +9,7 @@
|
|
|
9
9
|
"instructions": [
|
|
10
10
|
{
|
|
11
11
|
"name": "accept_ownership",
|
|
12
|
-
"discriminator": [
|
|
13
|
-
172,
|
|
14
|
-
23,
|
|
15
|
-
43,
|
|
16
|
-
13,
|
|
17
|
-
238,
|
|
18
|
-
213,
|
|
19
|
-
85,
|
|
20
|
-
150
|
|
21
|
-
],
|
|
12
|
+
"discriminator": [172, 23, 43, 13, 238, 213, 85, 150],
|
|
22
13
|
"accounts": [
|
|
23
14
|
{
|
|
24
15
|
"name": "payer",
|
|
@@ -32,25 +23,8 @@
|
|
|
32
23
|
{
|
|
33
24
|
"kind": "const",
|
|
34
25
|
"value": [
|
|
35
|
-
114,
|
|
36
|
-
|
|
37
|
-
116,
|
|
38
|
-
105,
|
|
39
|
-
111,
|
|
40
|
-
95,
|
|
41
|
-
111,
|
|
42
|
-
114,
|
|
43
|
-
97,
|
|
44
|
-
99,
|
|
45
|
-
108,
|
|
46
|
-
101,
|
|
47
|
-
95,
|
|
48
|
-
99,
|
|
49
|
-
111,
|
|
50
|
-
110,
|
|
51
|
-
102,
|
|
52
|
-
105,
|
|
53
|
-
103
|
|
26
|
+
114, 97, 116, 105, 111, 95, 111, 114, 97, 99, 108, 101, 95,
|
|
27
|
+
99, 111, 110, 102, 105, 103
|
|
54
28
|
]
|
|
55
29
|
}
|
|
56
30
|
]
|
|
@@ -61,16 +35,7 @@
|
|
|
61
35
|
},
|
|
62
36
|
{
|
|
63
37
|
"name": "initialize",
|
|
64
|
-
"discriminator": [
|
|
65
|
-
175,
|
|
66
|
-
175,
|
|
67
|
-
109,
|
|
68
|
-
31,
|
|
69
|
-
13,
|
|
70
|
-
152,
|
|
71
|
-
155,
|
|
72
|
-
237
|
|
73
|
-
],
|
|
38
|
+
"discriminator": [175, 175, 109, 31, 13, 152, 155, 237],
|
|
74
39
|
"accounts": [
|
|
75
40
|
{
|
|
76
41
|
"name": "deployer",
|
|
@@ -84,76 +49,18 @@
|
|
|
84
49
|
{
|
|
85
50
|
"kind": "const",
|
|
86
51
|
"value": [
|
|
87
|
-
5,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
39,
|
|
91
|
-
163,
|
|
92
|
-
240,
|
|
93
|
-
179,
|
|
94
|
-
76,
|
|
95
|
-
204,
|
|
96
|
-
70,
|
|
97
|
-
201,
|
|
98
|
-
236,
|
|
99
|
-
130,
|
|
100
|
-
51,
|
|
101
|
-
157,
|
|
102
|
-
165,
|
|
103
|
-
94,
|
|
104
|
-
178,
|
|
105
|
-
83,
|
|
106
|
-
64,
|
|
107
|
-
148,
|
|
108
|
-
201,
|
|
109
|
-
219,
|
|
110
|
-
70,
|
|
111
|
-
26,
|
|
112
|
-
57,
|
|
113
|
-
13,
|
|
114
|
-
75,
|
|
115
|
-
178,
|
|
116
|
-
65,
|
|
117
|
-
89,
|
|
118
|
-
225
|
|
52
|
+
5, 18, 235, 39, 163, 240, 179, 76, 204, 70, 201, 236, 130, 51,
|
|
53
|
+
157, 165, 94, 178, 83, 64, 148, 201, 219, 70, 26, 57, 13, 75,
|
|
54
|
+
178, 65, 89, 225
|
|
119
55
|
]
|
|
120
56
|
}
|
|
121
57
|
],
|
|
122
58
|
"program": {
|
|
123
59
|
"kind": "const",
|
|
124
60
|
"value": [
|
|
125
|
-
2,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
145,
|
|
129
|
-
78,
|
|
130
|
-
136,
|
|
131
|
-
161,
|
|
132
|
-
176,
|
|
133
|
-
226,
|
|
134
|
-
16,
|
|
135
|
-
21,
|
|
136
|
-
62,
|
|
137
|
-
247,
|
|
138
|
-
99,
|
|
139
|
-
174,
|
|
140
|
-
43,
|
|
141
|
-
0,
|
|
142
|
-
194,
|
|
143
|
-
185,
|
|
144
|
-
61,
|
|
145
|
-
22,
|
|
146
|
-
193,
|
|
147
|
-
36,
|
|
148
|
-
210,
|
|
149
|
-
192,
|
|
150
|
-
83,
|
|
151
|
-
122,
|
|
152
|
-
16,
|
|
153
|
-
4,
|
|
154
|
-
128,
|
|
155
|
-
0,
|
|
156
|
-
0
|
|
61
|
+
2, 168, 246, 145, 78, 136, 161, 176, 226, 16, 21, 62, 247, 99,
|
|
62
|
+
174, 43, 0, 194, 185, 61, 22, 193, 36, 210, 192, 83, 122, 16, 4,
|
|
63
|
+
128, 0, 0
|
|
157
64
|
]
|
|
158
65
|
}
|
|
159
66
|
}
|
|
@@ -166,25 +73,8 @@
|
|
|
166
73
|
{
|
|
167
74
|
"kind": "const",
|
|
168
75
|
"value": [
|
|
169
|
-
114,
|
|
170
|
-
|
|
171
|
-
116,
|
|
172
|
-
105,
|
|
173
|
-
111,
|
|
174
|
-
95,
|
|
175
|
-
111,
|
|
176
|
-
114,
|
|
177
|
-
97,
|
|
178
|
-
99,
|
|
179
|
-
108,
|
|
180
|
-
101,
|
|
181
|
-
95,
|
|
182
|
-
99,
|
|
183
|
-
111,
|
|
184
|
-
110,
|
|
185
|
-
102,
|
|
186
|
-
105,
|
|
187
|
-
103
|
|
76
|
+
114, 97, 116, 105, 111, 95, 111, 114, 97, 99, 108, 101, 95,
|
|
77
|
+
99, 111, 110, 102, 105, 103
|
|
188
78
|
]
|
|
189
79
|
}
|
|
190
80
|
]
|
|
@@ -208,16 +98,7 @@
|
|
|
208
98
|
},
|
|
209
99
|
{
|
|
210
100
|
"name": "initialize_oracle",
|
|
211
|
-
"discriminator": [
|
|
212
|
-
144,
|
|
213
|
-
223,
|
|
214
|
-
131,
|
|
215
|
-
120,
|
|
216
|
-
196,
|
|
217
|
-
253,
|
|
218
|
-
181,
|
|
219
|
-
99
|
|
220
|
-
],
|
|
101
|
+
"discriminator": [144, 223, 131, 120, 196, 253, 181, 99],
|
|
221
102
|
"accounts": [
|
|
222
103
|
{
|
|
223
104
|
"name": "payer",
|
|
@@ -231,25 +112,8 @@
|
|
|
231
112
|
{
|
|
232
113
|
"kind": "const",
|
|
233
114
|
"value": [
|
|
234
|
-
114,
|
|
235
|
-
|
|
236
|
-
116,
|
|
237
|
-
105,
|
|
238
|
-
111,
|
|
239
|
-
95,
|
|
240
|
-
111,
|
|
241
|
-
114,
|
|
242
|
-
97,
|
|
243
|
-
99,
|
|
244
|
-
108,
|
|
245
|
-
101,
|
|
246
|
-
95,
|
|
247
|
-
99,
|
|
248
|
-
111,
|
|
249
|
-
110,
|
|
250
|
-
102,
|
|
251
|
-
105,
|
|
252
|
-
103
|
|
115
|
+
114, 97, 116, 105, 111, 95, 111, 114, 97, 99, 108, 101, 95,
|
|
116
|
+
99, 111, 110, 102, 105, 103
|
|
253
117
|
]
|
|
254
118
|
}
|
|
255
119
|
]
|
|
@@ -293,16 +157,7 @@
|
|
|
293
157
|
},
|
|
294
158
|
{
|
|
295
159
|
"name": "publish_ratio",
|
|
296
|
-
"discriminator": [
|
|
297
|
-
150,
|
|
298
|
-
12,
|
|
299
|
-
239,
|
|
300
|
-
94,
|
|
301
|
-
15,
|
|
302
|
-
9,
|
|
303
|
-
177,
|
|
304
|
-
122
|
|
305
|
-
],
|
|
160
|
+
"discriminator": [150, 12, 239, 94, 15, 9, 177, 122],
|
|
306
161
|
"accounts": [
|
|
307
162
|
{
|
|
308
163
|
"name": "payer",
|
|
@@ -316,25 +171,8 @@
|
|
|
316
171
|
{
|
|
317
172
|
"kind": "const",
|
|
318
173
|
"value": [
|
|
319
|
-
114,
|
|
320
|
-
|
|
321
|
-
116,
|
|
322
|
-
105,
|
|
323
|
-
111,
|
|
324
|
-
95,
|
|
325
|
-
111,
|
|
326
|
-
114,
|
|
327
|
-
97,
|
|
328
|
-
99,
|
|
329
|
-
108,
|
|
330
|
-
101,
|
|
331
|
-
95,
|
|
332
|
-
99,
|
|
333
|
-
111,
|
|
334
|
-
110,
|
|
335
|
-
102,
|
|
336
|
-
105,
|
|
337
|
-
103
|
|
174
|
+
114, 97, 116, 105, 111, 95, 111, 114, 97, 99, 108, 101, 95,
|
|
175
|
+
99, 111, 110, 102, 105, 103
|
|
338
176
|
]
|
|
339
177
|
}
|
|
340
178
|
]
|
|
@@ -355,26 +193,14 @@
|
|
|
355
193
|
{
|
|
356
194
|
"name": "payload",
|
|
357
195
|
"type": {
|
|
358
|
-
"array": [
|
|
359
|
-
"u8",
|
|
360
|
-
100
|
|
361
|
-
]
|
|
196
|
+
"array": ["u8", 100]
|
|
362
197
|
}
|
|
363
198
|
}
|
|
364
199
|
]
|
|
365
200
|
},
|
|
366
201
|
{
|
|
367
202
|
"name": "transfer_ownership",
|
|
368
|
-
"discriminator": [
|
|
369
|
-
65,
|
|
370
|
-
177,
|
|
371
|
-
215,
|
|
372
|
-
73,
|
|
373
|
-
53,
|
|
374
|
-
45,
|
|
375
|
-
99,
|
|
376
|
-
47
|
|
377
|
-
],
|
|
203
|
+
"discriminator": [65, 177, 215, 73, 53, 45, 99, 47],
|
|
378
204
|
"accounts": [
|
|
379
205
|
{
|
|
380
206
|
"name": "payer",
|
|
@@ -388,25 +214,8 @@
|
|
|
388
214
|
{
|
|
389
215
|
"kind": "const",
|
|
390
216
|
"value": [
|
|
391
|
-
114,
|
|
392
|
-
|
|
393
|
-
116,
|
|
394
|
-
105,
|
|
395
|
-
111,
|
|
396
|
-
95,
|
|
397
|
-
111,
|
|
398
|
-
114,
|
|
399
|
-
97,
|
|
400
|
-
99,
|
|
401
|
-
108,
|
|
402
|
-
101,
|
|
403
|
-
95,
|
|
404
|
-
99,
|
|
405
|
-
111,
|
|
406
|
-
110,
|
|
407
|
-
102,
|
|
408
|
-
105,
|
|
409
|
-
103
|
|
217
|
+
114, 97, 116, 105, 111, 95, 111, 114, 97, 99, 108, 101, 95,
|
|
218
|
+
99, 111, 110, 102, 105, 103
|
|
410
219
|
]
|
|
411
220
|
}
|
|
412
221
|
]
|
|
@@ -422,16 +231,7 @@
|
|
|
422
231
|
},
|
|
423
232
|
{
|
|
424
233
|
"name": "update_consortium",
|
|
425
|
-
"discriminator": [
|
|
426
|
-
66,
|
|
427
|
-
146,
|
|
428
|
-
98,
|
|
429
|
-
208,
|
|
430
|
-
251,
|
|
431
|
-
97,
|
|
432
|
-
90,
|
|
433
|
-
196
|
|
434
|
-
],
|
|
234
|
+
"discriminator": [66, 146, 98, 208, 251, 97, 90, 196],
|
|
435
235
|
"accounts": [
|
|
436
236
|
{
|
|
437
237
|
"name": "payer",
|
|
@@ -445,25 +245,8 @@
|
|
|
445
245
|
{
|
|
446
246
|
"kind": "const",
|
|
447
247
|
"value": [
|
|
448
|
-
114,
|
|
449
|
-
|
|
450
|
-
116,
|
|
451
|
-
105,
|
|
452
|
-
111,
|
|
453
|
-
95,
|
|
454
|
-
111,
|
|
455
|
-
114,
|
|
456
|
-
97,
|
|
457
|
-
99,
|
|
458
|
-
108,
|
|
459
|
-
101,
|
|
460
|
-
95,
|
|
461
|
-
99,
|
|
462
|
-
111,
|
|
463
|
-
110,
|
|
464
|
-
102,
|
|
465
|
-
105,
|
|
466
|
-
103
|
|
248
|
+
114, 97, 116, 105, 111, 95, 111, 114, 97, 99, 108, 101, 95,
|
|
249
|
+
99, 111, 110, 102, 105, 103
|
|
467
250
|
]
|
|
468
251
|
}
|
|
469
252
|
]
|
|
@@ -479,16 +262,7 @@
|
|
|
479
262
|
},
|
|
480
263
|
{
|
|
481
264
|
"name": "update_ratio_threshold",
|
|
482
|
-
"discriminator": [
|
|
483
|
-
183,
|
|
484
|
-
76,
|
|
485
|
-
186,
|
|
486
|
-
79,
|
|
487
|
-
135,
|
|
488
|
-
9,
|
|
489
|
-
149,
|
|
490
|
-
236
|
|
491
|
-
],
|
|
265
|
+
"discriminator": [183, 76, 186, 79, 135, 9, 149, 236],
|
|
492
266
|
"accounts": [
|
|
493
267
|
{
|
|
494
268
|
"name": "payer",
|
|
@@ -502,25 +276,8 @@
|
|
|
502
276
|
{
|
|
503
277
|
"kind": "const",
|
|
504
278
|
"value": [
|
|
505
|
-
114,
|
|
506
|
-
|
|
507
|
-
116,
|
|
508
|
-
105,
|
|
509
|
-
111,
|
|
510
|
-
95,
|
|
511
|
-
111,
|
|
512
|
-
114,
|
|
513
|
-
97,
|
|
514
|
-
99,
|
|
515
|
-
108,
|
|
516
|
-
101,
|
|
517
|
-
95,
|
|
518
|
-
99,
|
|
519
|
-
111,
|
|
520
|
-
110,
|
|
521
|
-
102,
|
|
522
|
-
105,
|
|
523
|
-
103
|
|
279
|
+
114, 97, 116, 105, 111, 95, 111, 114, 97, 99, 108, 101, 95,
|
|
280
|
+
99, 111, 110, 102, 105, 103
|
|
524
281
|
]
|
|
525
282
|
}
|
|
526
283
|
]
|
|
@@ -542,83 +299,29 @@
|
|
|
542
299
|
"accounts": [
|
|
543
300
|
{
|
|
544
301
|
"name": "Config",
|
|
545
|
-
"discriminator": [
|
|
546
|
-
155,
|
|
547
|
-
12,
|
|
548
|
-
170,
|
|
549
|
-
224,
|
|
550
|
-
30,
|
|
551
|
-
250,
|
|
552
|
-
204,
|
|
553
|
-
130
|
|
554
|
-
]
|
|
302
|
+
"discriminator": [155, 12, 170, 224, 30, 250, 204, 130]
|
|
555
303
|
},
|
|
556
304
|
{
|
|
557
305
|
"name": "Oracle",
|
|
558
|
-
"discriminator": [
|
|
559
|
-
139,
|
|
560
|
-
194,
|
|
561
|
-
131,
|
|
562
|
-
179,
|
|
563
|
-
140,
|
|
564
|
-
179,
|
|
565
|
-
229,
|
|
566
|
-
244
|
|
567
|
-
]
|
|
306
|
+
"discriminator": [139, 194, 131, 179, 140, 179, 229, 244]
|
|
568
307
|
},
|
|
569
308
|
{
|
|
570
309
|
"name": "ValidatedPayload",
|
|
571
|
-
"discriminator": [
|
|
572
|
-
129,
|
|
573
|
-
8,
|
|
574
|
-
149,
|
|
575
|
-
193,
|
|
576
|
-
22,
|
|
577
|
-
240,
|
|
578
|
-
127,
|
|
579
|
-
36
|
|
580
|
-
]
|
|
310
|
+
"discriminator": [129, 8, 149, 193, 22, 240, 127, 36]
|
|
581
311
|
}
|
|
582
312
|
],
|
|
583
313
|
"events": [
|
|
584
314
|
{
|
|
585
315
|
"name": "ConsortiumUpdated",
|
|
586
|
-
"discriminator": [
|
|
587
|
-
177,
|
|
588
|
-
238,
|
|
589
|
-
1,
|
|
590
|
-
232,
|
|
591
|
-
23,
|
|
592
|
-
33,
|
|
593
|
-
83,
|
|
594
|
-
62
|
|
595
|
-
]
|
|
316
|
+
"discriminator": [177, 238, 1, 232, 23, 33, 83, 62]
|
|
596
317
|
},
|
|
597
318
|
{
|
|
598
319
|
"name": "OwnershipTransferInitiated",
|
|
599
|
-
"discriminator": [
|
|
600
|
-
181,
|
|
601
|
-
32,
|
|
602
|
-
40,
|
|
603
|
-
60,
|
|
604
|
-
60,
|
|
605
|
-
64,
|
|
606
|
-
235,
|
|
607
|
-
29
|
|
608
|
-
]
|
|
320
|
+
"discriminator": [181, 32, 40, 60, 60, 64, 235, 29]
|
|
609
321
|
},
|
|
610
322
|
{
|
|
611
323
|
"name": "OwnershipTransferred",
|
|
612
|
-
"discriminator": [
|
|
613
|
-
172,
|
|
614
|
-
61,
|
|
615
|
-
205,
|
|
616
|
-
183,
|
|
617
|
-
250,
|
|
618
|
-
50,
|
|
619
|
-
38,
|
|
620
|
-
98
|
|
621
|
-
]
|
|
324
|
+
"discriminator": [172, 61, 205, 183, 250, 50, 38, 98]
|
|
622
325
|
}
|
|
623
326
|
],
|
|
624
327
|
"errors": [
|
|
@@ -781,4 +484,4 @@
|
|
|
781
484
|
}
|
|
782
485
|
}
|
|
783
486
|
]
|
|
784
|
-
}
|
|
487
|
+
}
|
|
@@ -3,7 +3,9 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
3
3
|
import { SolanaServiceImpl } from './SolanaServiceImpl';
|
|
4
4
|
|
|
5
5
|
vi.mock('../web3Sdk/signLbtcDestinationAddrSolana', () => ({
|
|
6
|
-
signLbtcDestinationAddrSolana: vi
|
|
6
|
+
signLbtcDestinationAddrSolana: vi
|
|
7
|
+
.fn()
|
|
8
|
+
.mockResolvedValue({ signature: 'mock-sig' }),
|
|
7
9
|
}));
|
|
8
10
|
|
|
9
11
|
vi.mock('../web3Sdk/redeemToken/redeemForBtc', () => ({
|
|
@@ -18,9 +20,8 @@ vi.mock('../web3Sdk/deposit/deposit', () => ({
|
|
|
18
20
|
deposit: vi.fn().mockResolvedValue('mock-deposit-tx'),
|
|
19
21
|
}));
|
|
20
22
|
|
|
21
|
-
const { signLbtcDestinationAddrSolana } =
|
|
22
|
-
'../web3Sdk/signLbtcDestinationAddrSolana'
|
|
23
|
-
);
|
|
23
|
+
const { signLbtcDestinationAddrSolana } =
|
|
24
|
+
await import('../web3Sdk/signLbtcDestinationAddrSolana');
|
|
24
25
|
const { redeemForBtc } = await import('../web3Sdk/redeemToken/redeemForBtc');
|
|
25
26
|
const { redeem } = await import('../web3Sdk/redeem/redeem');
|
|
26
27
|
const { deposit } = await import('../web3Sdk/deposit/deposit');
|
|
@@ -42,13 +42,13 @@ export const ConnectButton = ({
|
|
|
42
42
|
<select
|
|
43
43
|
title="Select Wallet"
|
|
44
44
|
className="form-select"
|
|
45
|
-
onChange={e =>
|
|
45
|
+
onChange={(e) =>
|
|
46
46
|
setSelectedWallet(e.target.value as InjectedWallet)
|
|
47
47
|
}
|
|
48
48
|
value={selectedWallet}
|
|
49
49
|
disabled={isLoading}
|
|
50
50
|
>
|
|
51
|
-
{Object.values(InjectedWallet).map(opt => (
|
|
51
|
+
{Object.values(InjectedWallet).map((opt) => (
|
|
52
52
|
<option key={opt} value={opt}>
|
|
53
53
|
{opt}
|
|
54
54
|
</option>
|
|
@@ -21,7 +21,7 @@ export const NetworkSelector: React.FC<NetworkSelectorProps> = ({
|
|
|
21
21
|
label = 'Network',
|
|
22
22
|
className,
|
|
23
23
|
}) => {
|
|
24
|
-
const networkOptions = Object.keys(RPC_URLS).map(net => ({
|
|
24
|
+
const networkOptions = Object.keys(RPC_URLS).map((net) => ({
|
|
25
25
|
value: net,
|
|
26
26
|
label: net, // Consider using fromCamelCase for better display if needed
|
|
27
27
|
}));
|
|
@@ -56,7 +56,7 @@ export const OutputSelector: React.FC<OutputSelectorProps> = ({
|
|
|
56
56
|
|
|
57
57
|
const outputOptions = [
|
|
58
58
|
{ value: '', label: '-- Select a Bitcoin transaction --' },
|
|
59
|
-
...outputs.map(output => ({
|
|
59
|
+
...outputs.map((output) => ({
|
|
60
60
|
value: output.txid,
|
|
61
61
|
label: `${output.txid.substring(0, 10)}... - ${
|
|
62
62
|
Number.parseFloat(output.value) / 10 ** 8
|
|
@@ -65,7 +65,7 @@ export const OutputSelector: React.FC<OutputSelectorProps> = ({
|
|
|
65
65
|
];
|
|
66
66
|
|
|
67
67
|
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
|
68
|
-
const selected = outputs.find(o => o.txid === e.target.value);
|
|
68
|
+
const selected = outputs.find((o) => o.txid === e.target.value);
|
|
69
69
|
onOutputSelect(selected || null);
|
|
70
70
|
};
|
|
71
71
|
|
|
@@ -81,8 +81,8 @@ export const OutputSelector: React.FC<OutputSelectorProps> = ({
|
|
|
81
81
|
) : outputs.length === 0 ? (
|
|
82
82
|
<div className="alert alert-info">
|
|
83
83
|
No pending Bitcoin outputs found for your address (
|
|
84
|
-
{address?.substring(0, 6)}...) on {environment}. You might need to
|
|
85
|
-
Bitcoin first or check the selected network.
|
|
84
|
+
{address?.substring(0, 6)}...) on {environment}. You might need to
|
|
85
|
+
stake Bitcoin first or check the selected network.
|
|
86
86
|
</div>
|
|
87
87
|
) : (
|
|
88
88
|
<>
|
|
@@ -5,8 +5,7 @@ interface Option {
|
|
|
5
5
|
label: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
interface SelectFieldProps
|
|
9
|
-
extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
8
|
+
interface SelectFieldProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
10
9
|
label: string;
|
|
11
10
|
id: string;
|
|
12
11
|
options: Option[];
|
|
@@ -32,7 +31,7 @@ export const SelectField: React.FC<SelectFieldProps> = ({
|
|
|
32
31
|
aria-describedby={infoText ? `${id}-help` : undefined}
|
|
33
32
|
{...props}
|
|
34
33
|
>
|
|
35
|
-
{options.map(option => (
|
|
34
|
+
{options.map((option) => (
|
|
36
35
|
<option key={option.value} value={option.value}>
|
|
37
36
|
{option.label}
|
|
38
37
|
</option>
|
package/src/types/sdkTypes.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Env } from '@lombard.finance/sdk-common';
|
|
1
2
|
import BigNumber from 'bignumber.js';
|
|
2
3
|
|
|
3
4
|
import { SolanaNetwork } from './network';
|
|
@@ -27,6 +28,12 @@ export interface GetBalanceParams {
|
|
|
27
28
|
* If provided, overrides the network parameter
|
|
28
29
|
*/
|
|
29
30
|
rpcUrl?: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Optional environment. Determines which BFF host (prod vs stage) the
|
|
34
|
+
* default RPC URL routes through when `rpcUrl` is not provided.
|
|
35
|
+
*/
|
|
36
|
+
env?: Env;
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
/**
|
|
@@ -26,7 +26,7 @@ export function createDebugLogger(options: CreateDebugLoggerOptions = {}) {
|
|
|
26
26
|
const logs: string[] = [];
|
|
27
27
|
|
|
28
28
|
const debugLog = (...args: unknown[]): void => {
|
|
29
|
-
const formattedArgs = args.map(arg =>
|
|
29
|
+
const formattedArgs = args.map((arg) =>
|
|
30
30
|
typeof arg === 'object' && arg !== null
|
|
31
31
|
? JSON.stringify(arg)
|
|
32
32
|
: String(arg),
|
|
@@ -19,10 +19,19 @@ import {
|
|
|
19
19
|
*/
|
|
20
20
|
export async function claimBtcbFromPayload(ctx: ClaimContext): Promise<string> {
|
|
21
21
|
const {
|
|
22
|
-
provider,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
provider,
|
|
23
|
+
connection,
|
|
24
|
+
params,
|
|
25
|
+
payloadBytes,
|
|
26
|
+
payloadHash,
|
|
27
|
+
payloadHashArray,
|
|
28
|
+
assetRouterProgram,
|
|
29
|
+
assetRouterProgramId,
|
|
30
|
+
assetRouterConfigPDA,
|
|
31
|
+
tokenAuthorityPDA,
|
|
32
|
+
validatedPayloadPDA,
|
|
33
|
+
arConfig,
|
|
34
|
+
debugLog,
|
|
26
35
|
} = ctx;
|
|
27
36
|
|
|
28
37
|
const [depositPayloadSpentPDA] = PublicKey.findProgramAddressSync(
|
|
@@ -60,7 +69,12 @@ export async function claimBtcbFromPayload(ctx: ClaimContext): Promise<string> {
|
|
|
60
69
|
const tokenProgramId = mintAccountInfo.owner;
|
|
61
70
|
debugLog('Token program:', tokenProgramId.toBase58());
|
|
62
71
|
|
|
63
|
-
const mintAccount = await getMint(
|
|
72
|
+
const mintAccount = await getMint(
|
|
73
|
+
connection,
|
|
74
|
+
mint,
|
|
75
|
+
undefined,
|
|
76
|
+
tokenProgramId,
|
|
77
|
+
);
|
|
64
78
|
if (!mintAccount.mintAuthority) {
|
|
65
79
|
throw new Error('Mint has no mint authority');
|
|
66
80
|
}
|