@lombard.finance/sdk-starknet 0.3.0-canary.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.
Files changed (58) hide show
  1. package/README.md +128 -0
  2. package/dist/index.cjs +2 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.js +20 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index2.cjs +229 -0
  7. package/dist/index2.cjs.map +1 -0
  8. package/dist/index2.js +30378 -0
  9. package/dist/index2.js.map +1 -0
  10. package/dist/index3.cjs +2 -0
  11. package/dist/index3.cjs.map +1 -0
  12. package/dist/index3.js +2316 -0
  13. package/dist/index3.js.map +1 -0
  14. package/package.json +66 -0
  15. package/src/contract-functions/approve.stories.tsx +74 -0
  16. package/src/contract-functions/approve.ts +56 -0
  17. package/src/contract-functions/balance-of.stories.tsx +54 -0
  18. package/src/contract-functions/balance-of.ts +41 -0
  19. package/src/contract-functions/mint.ts +109 -0
  20. package/src/contract-functions/redeem.ts +107 -0
  21. package/src/index.ts +25 -0
  22. package/src/module/createStarknetModule.ts +38 -0
  23. package/src/services/StarknetServiceImpl.ts +83 -0
  24. package/src/services/index.ts +7 -0
  25. package/src/stories/components/Button/Button.css +10 -0
  26. package/src/stories/components/Button/Button.tsx +52 -0
  27. package/src/stories/components/Button/index.ts +1 -0
  28. package/src/stories/components/CodeBlock/CodeBlock.tsx +38 -0
  29. package/src/stories/components/CodeBlock/CodeBlockStyles.css +3 -0
  30. package/src/stories/components/CodeBlock/index.ts +1 -0
  31. package/src/stories/components/ConnectButton/connect-button.tsx +112 -0
  32. package/src/stories/components/ConnectButton/index.ts +1 -0
  33. package/src/stories/components/Spinner/Spinner.tsx +24 -0
  34. package/src/stories/components/Spinner/index.ts +1 -0
  35. package/src/stories/components/decorators/function-type.tsx +66 -0
  36. package/src/stories/components/decorators/index.ts +1 -0
  37. package/src/stories/components/decorators/starknet-context.tsx +21 -0
  38. package/src/stories/components/error-block.tsx +21 -0
  39. package/src/stories/hooks/use-connection.ts +70 -0
  40. package/src/stories/hooks/use-query.ts +56 -0
  41. package/src/tokens/abi/ERC20_ABI.ts +1122 -0
  42. package/src/tokens/abi/LBTC_ABI.ts +1615 -0
  43. package/src/tokens/abi/LBTC_BASCULE_ABI.ts +709 -0
  44. package/src/tokens/abi/LBTC_BRIDGE_ABI.ts +1568 -0
  45. package/src/tokens/lib/tokens.ts +267 -0
  46. package/src/utils/account.ts +81 -0
  47. package/src/utils/chains.ts +33 -0
  48. package/src/utils/common.ts +11 -0
  49. package/src/utils/env.ts +6 -0
  50. package/src/utils/err.ts +121 -0
  51. package/src/utils/rpc-providers.ts +25 -0
  52. package/src/utils/signature.ts +60 -0
  53. package/src/utils/span.ts +56 -0
  54. package/src/utils/typed-data.ts +36 -0
  55. package/src/utils/wallet-account.ts +9 -0
  56. package/src/wallet-functions/sign-message.stories.tsx +72 -0
  57. package/src/wallet-functions/sign-message.ts +127 -0
  58. package/src/wallet-functions/sign-terms-of-service.ts +45 -0
@@ -0,0 +1,709 @@
1
+ export default [
2
+ {
3
+ name: 'BasculeImpl',
4
+ type: 'impl',
5
+ interface_name: 'lbtc_bascule::interface::IBascule',
6
+ },
7
+ {
8
+ name: 'core::integer::u256',
9
+ type: 'struct',
10
+ members: [
11
+ {
12
+ name: 'low',
13
+ type: 'core::integer::u128',
14
+ },
15
+ {
16
+ name: 'high',
17
+ type: 'core::integer::u128',
18
+ },
19
+ ],
20
+ },
21
+ {
22
+ name: 'core::array::Span::<core::integer::u256>',
23
+ type: 'struct',
24
+ members: [
25
+ {
26
+ name: 'snapshot',
27
+ type: '@core::array::Array::<core::integer::u256>',
28
+ },
29
+ ],
30
+ },
31
+ {
32
+ name: 'lbtc_bascule::interface::DepositState',
33
+ type: 'enum',
34
+ variants: [
35
+ {
36
+ name: 'Unreported',
37
+ type: '()',
38
+ },
39
+ {
40
+ name: 'Reported',
41
+ type: '()',
42
+ },
43
+ {
44
+ name: 'Withdrawn',
45
+ type: '()',
46
+ },
47
+ ],
48
+ },
49
+ {
50
+ name: 'core::bool',
51
+ type: 'enum',
52
+ variants: [
53
+ {
54
+ name: 'False',
55
+ type: '()',
56
+ },
57
+ {
58
+ name: 'True',
59
+ type: '()',
60
+ },
61
+ ],
62
+ },
63
+ {
64
+ name: 'lbtc_bascule::interface::IBascule',
65
+ type: 'interface',
66
+ items: [
67
+ {
68
+ name: 'validate_withdrawal',
69
+ type: 'function',
70
+ inputs: [
71
+ {
72
+ name: 'to_chain',
73
+ type: 'core::integer::u256',
74
+ },
75
+ {
76
+ name: 'recipient',
77
+ type: 'core::starknet::contract_address::ContractAddress',
78
+ },
79
+ {
80
+ name: 'withdrawal_amount',
81
+ type: 'core::integer::u256',
82
+ },
83
+ {
84
+ name: 'tx_id',
85
+ type: 'core::integer::u256',
86
+ },
87
+ {
88
+ name: 'vout',
89
+ type: 'core::integer::u32',
90
+ },
91
+ ],
92
+ outputs: [],
93
+ state_mutability: 'external',
94
+ },
95
+ {
96
+ name: 'update_validation_threshold',
97
+ type: 'function',
98
+ inputs: [
99
+ {
100
+ name: 'new_threshold',
101
+ type: 'core::integer::u256',
102
+ },
103
+ ],
104
+ outputs: [],
105
+ state_mutability: 'external',
106
+ },
107
+ {
108
+ name: 'set_max_deposits',
109
+ type: 'function',
110
+ inputs: [
111
+ {
112
+ name: 'max_deposits',
113
+ type: 'core::integer::u32',
114
+ },
115
+ ],
116
+ outputs: [],
117
+ state_mutability: 'external',
118
+ },
119
+ {
120
+ name: 'report_deposits',
121
+ type: 'function',
122
+ inputs: [
123
+ {
124
+ name: 'report_id',
125
+ type: 'core::integer::u256',
126
+ },
127
+ {
128
+ name: 'deposit_ids',
129
+ type: 'core::array::Span::<core::integer::u256>',
130
+ },
131
+ ],
132
+ outputs: [],
133
+ state_mutability: 'external',
134
+ },
135
+ {
136
+ name: 'get_validation_threshold',
137
+ type: 'function',
138
+ inputs: [],
139
+ outputs: [
140
+ {
141
+ type: 'core::integer::u256',
142
+ },
143
+ ],
144
+ state_mutability: 'view',
145
+ },
146
+ {
147
+ name: 'get_max_deposits',
148
+ type: 'function',
149
+ inputs: [],
150
+ outputs: [
151
+ {
152
+ type: 'core::integer::u32',
153
+ },
154
+ ],
155
+ state_mutability: 'view',
156
+ },
157
+ {
158
+ name: 'get_deposit_status',
159
+ type: 'function',
160
+ inputs: [
161
+ {
162
+ name: 'deposit_id',
163
+ type: 'core::integer::u256',
164
+ },
165
+ ],
166
+ outputs: [
167
+ {
168
+ type: 'lbtc_bascule::interface::DepositState',
169
+ },
170
+ ],
171
+ state_mutability: 'view',
172
+ },
173
+ {
174
+ name: 'is_deposit_reporter',
175
+ type: 'function',
176
+ inputs: [
177
+ {
178
+ name: 'account',
179
+ type: 'core::starknet::contract_address::ContractAddress',
180
+ },
181
+ ],
182
+ outputs: [
183
+ {
184
+ type: 'core::bool',
185
+ },
186
+ ],
187
+ state_mutability: 'view',
188
+ },
189
+ {
190
+ name: 'register_deposit_reporter',
191
+ type: 'function',
192
+ inputs: [
193
+ {
194
+ name: 'account',
195
+ type: 'core::starknet::contract_address::ContractAddress',
196
+ },
197
+ ],
198
+ outputs: [],
199
+ state_mutability: 'external',
200
+ },
201
+ {
202
+ name: 'remove_deposit_reporter',
203
+ type: 'function',
204
+ inputs: [
205
+ {
206
+ name: 'account',
207
+ type: 'core::starknet::contract_address::ContractAddress',
208
+ },
209
+ ],
210
+ outputs: [],
211
+ state_mutability: 'external',
212
+ },
213
+ {
214
+ name: 'is_withdrawal_validator',
215
+ type: 'function',
216
+ inputs: [
217
+ {
218
+ name: 'account',
219
+ type: 'core::starknet::contract_address::ContractAddress',
220
+ },
221
+ ],
222
+ outputs: [
223
+ {
224
+ type: 'core::bool',
225
+ },
226
+ ],
227
+ state_mutability: 'view',
228
+ },
229
+ {
230
+ name: 'register_withdrawal_validator',
231
+ type: 'function',
232
+ inputs: [
233
+ {
234
+ name: 'account',
235
+ type: 'core::starknet::contract_address::ContractAddress',
236
+ },
237
+ ],
238
+ outputs: [],
239
+ state_mutability: 'external',
240
+ },
241
+ {
242
+ name: 'remove_withdrawal_validator',
243
+ type: 'function',
244
+ inputs: [
245
+ {
246
+ name: 'account',
247
+ type: 'core::starknet::contract_address::ContractAddress',
248
+ },
249
+ ],
250
+ outputs: [],
251
+ state_mutability: 'external',
252
+ },
253
+ {
254
+ name: 'is_validation_guardian',
255
+ type: 'function',
256
+ inputs: [
257
+ {
258
+ name: 'account',
259
+ type: 'core::starknet::contract_address::ContractAddress',
260
+ },
261
+ ],
262
+ outputs: [
263
+ {
264
+ type: 'core::bool',
265
+ },
266
+ ],
267
+ state_mutability: 'view',
268
+ },
269
+ {
270
+ name: 'register_validation_guardian',
271
+ type: 'function',
272
+ inputs: [
273
+ {
274
+ name: 'account',
275
+ type: 'core::starknet::contract_address::ContractAddress',
276
+ },
277
+ ],
278
+ outputs: [],
279
+ state_mutability: 'external',
280
+ },
281
+ {
282
+ name: 'remove_validation_guardian',
283
+ type: 'function',
284
+ inputs: [
285
+ {
286
+ name: 'account',
287
+ type: 'core::starknet::contract_address::ContractAddress',
288
+ },
289
+ ],
290
+ outputs: [],
291
+ state_mutability: 'external',
292
+ },
293
+ {
294
+ name: 'is_pauser',
295
+ type: 'function',
296
+ inputs: [
297
+ {
298
+ name: 'account',
299
+ type: 'core::starknet::contract_address::ContractAddress',
300
+ },
301
+ ],
302
+ outputs: [
303
+ {
304
+ type: 'core::bool',
305
+ },
306
+ ],
307
+ state_mutability: 'view',
308
+ },
309
+ {
310
+ name: 'register_pauser',
311
+ type: 'function',
312
+ inputs: [
313
+ {
314
+ name: 'account',
315
+ type: 'core::starknet::contract_address::ContractAddress',
316
+ },
317
+ ],
318
+ outputs: [],
319
+ state_mutability: 'external',
320
+ },
321
+ {
322
+ name: 'remove_pauser',
323
+ type: 'function',
324
+ inputs: [
325
+ {
326
+ name: 'account',
327
+ type: 'core::starknet::contract_address::ContractAddress',
328
+ },
329
+ ],
330
+ outputs: [],
331
+ state_mutability: 'external',
332
+ },
333
+ ],
334
+ },
335
+ {
336
+ name: 'PausableImpl',
337
+ type: 'impl',
338
+ interface_name:
339
+ 'starkware_utils::components::pausable::interface::IPausable',
340
+ },
341
+ {
342
+ name: 'starkware_utils::components::pausable::interface::IPausable',
343
+ type: 'interface',
344
+ items: [
345
+ {
346
+ name: 'is_paused',
347
+ type: 'function',
348
+ inputs: [],
349
+ outputs: [
350
+ {
351
+ type: 'core::bool',
352
+ },
353
+ ],
354
+ state_mutability: 'view',
355
+ },
356
+ {
357
+ name: 'pause',
358
+ type: 'function',
359
+ inputs: [],
360
+ outputs: [],
361
+ state_mutability: 'external',
362
+ },
363
+ {
364
+ name: 'unpause',
365
+ type: 'function',
366
+ inputs: [],
367
+ outputs: [],
368
+ state_mutability: 'external',
369
+ },
370
+ ],
371
+ },
372
+ {
373
+ name: 'constructor',
374
+ type: 'constructor',
375
+ inputs: [
376
+ {
377
+ name: 'governance_admin',
378
+ type: 'core::starknet::contract_address::ContractAddress',
379
+ },
380
+ {
381
+ name: 'pauser',
382
+ type: 'core::starknet::contract_address::ContractAddress',
383
+ },
384
+ {
385
+ name: 'deposit_reporter',
386
+ type: 'core::starknet::contract_address::ContractAddress',
387
+ },
388
+ {
389
+ name: 'withdrawal_validator',
390
+ type: 'core::starknet::contract_address::ContractAddress',
391
+ },
392
+ {
393
+ name: 'max_deposits',
394
+ type: 'core::integer::u32',
395
+ },
396
+ ],
397
+ },
398
+ {
399
+ kind: 'struct',
400
+ name: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::RoleGranted',
401
+ type: 'event',
402
+ members: [
403
+ {
404
+ kind: 'data',
405
+ name: 'role',
406
+ type: 'core::felt252',
407
+ },
408
+ {
409
+ kind: 'data',
410
+ name: 'account',
411
+ type: 'core::starknet::contract_address::ContractAddress',
412
+ },
413
+ {
414
+ kind: 'data',
415
+ name: 'sender',
416
+ type: 'core::starknet::contract_address::ContractAddress',
417
+ },
418
+ ],
419
+ },
420
+ {
421
+ kind: 'struct',
422
+ name: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::RoleGrantedWithDelay',
423
+ type: 'event',
424
+ members: [
425
+ {
426
+ kind: 'data',
427
+ name: 'role',
428
+ type: 'core::felt252',
429
+ },
430
+ {
431
+ kind: 'data',
432
+ name: 'account',
433
+ type: 'core::starknet::contract_address::ContractAddress',
434
+ },
435
+ {
436
+ kind: 'data',
437
+ name: 'sender',
438
+ type: 'core::starknet::contract_address::ContractAddress',
439
+ },
440
+ {
441
+ kind: 'data',
442
+ name: 'delay',
443
+ type: 'core::integer::u64',
444
+ },
445
+ ],
446
+ },
447
+ {
448
+ kind: 'struct',
449
+ name: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::RoleRevoked',
450
+ type: 'event',
451
+ members: [
452
+ {
453
+ kind: 'data',
454
+ name: 'role',
455
+ type: 'core::felt252',
456
+ },
457
+ {
458
+ kind: 'data',
459
+ name: 'account',
460
+ type: 'core::starknet::contract_address::ContractAddress',
461
+ },
462
+ {
463
+ kind: 'data',
464
+ name: 'sender',
465
+ type: 'core::starknet::contract_address::ContractAddress',
466
+ },
467
+ ],
468
+ },
469
+ {
470
+ kind: 'struct',
471
+ name: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::RoleAdminChanged',
472
+ type: 'event',
473
+ members: [
474
+ {
475
+ kind: 'data',
476
+ name: 'role',
477
+ type: 'core::felt252',
478
+ },
479
+ {
480
+ kind: 'data',
481
+ name: 'previous_admin_role',
482
+ type: 'core::felt252',
483
+ },
484
+ {
485
+ kind: 'data',
486
+ name: 'new_admin_role',
487
+ type: 'core::felt252',
488
+ },
489
+ ],
490
+ },
491
+ {
492
+ kind: 'enum',
493
+ name: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::Event',
494
+ type: 'event',
495
+ variants: [
496
+ {
497
+ kind: 'nested',
498
+ name: 'RoleGranted',
499
+ type: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::RoleGranted',
500
+ },
501
+ {
502
+ kind: 'nested',
503
+ name: 'RoleGrantedWithDelay',
504
+ type: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::RoleGrantedWithDelay',
505
+ },
506
+ {
507
+ kind: 'nested',
508
+ name: 'RoleRevoked',
509
+ type: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::RoleRevoked',
510
+ },
511
+ {
512
+ kind: 'nested',
513
+ name: 'RoleAdminChanged',
514
+ type: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::RoleAdminChanged',
515
+ },
516
+ ],
517
+ },
518
+ {
519
+ kind: 'struct',
520
+ name: 'openzeppelin_security::pausable::PausableComponent::Paused',
521
+ type: 'event',
522
+ members: [
523
+ {
524
+ kind: 'data',
525
+ name: 'account',
526
+ type: 'core::starknet::contract_address::ContractAddress',
527
+ },
528
+ ],
529
+ },
530
+ {
531
+ kind: 'struct',
532
+ name: 'openzeppelin_security::pausable::PausableComponent::Unpaused',
533
+ type: 'event',
534
+ members: [
535
+ {
536
+ kind: 'data',
537
+ name: 'account',
538
+ type: 'core::starknet::contract_address::ContractAddress',
539
+ },
540
+ ],
541
+ },
542
+ {
543
+ kind: 'enum',
544
+ name: 'openzeppelin_security::pausable::PausableComponent::Event',
545
+ type: 'event',
546
+ variants: [
547
+ {
548
+ kind: 'nested',
549
+ name: 'Paused',
550
+ type: 'openzeppelin_security::pausable::PausableComponent::Paused',
551
+ },
552
+ {
553
+ kind: 'nested',
554
+ name: 'Unpaused',
555
+ type: 'openzeppelin_security::pausable::PausableComponent::Unpaused',
556
+ },
557
+ ],
558
+ },
559
+ {
560
+ kind: 'enum',
561
+ name: 'openzeppelin_introspection::src5::SRC5Component::Event',
562
+ type: 'event',
563
+ variants: [],
564
+ },
565
+ {
566
+ kind: 'struct',
567
+ name: 'lbtc_bascule::events::DepositAlreadyReported',
568
+ type: 'event',
569
+ members: [
570
+ {
571
+ kind: 'key',
572
+ name: 'deposit_id',
573
+ type: 'core::integer::u256',
574
+ },
575
+ ],
576
+ },
577
+ {
578
+ kind: 'struct',
579
+ name: 'lbtc_bascule::events::DepositsReported',
580
+ type: 'event',
581
+ members: [
582
+ {
583
+ kind: 'key',
584
+ name: 'report_id',
585
+ type: 'core::integer::u256',
586
+ },
587
+ {
588
+ kind: 'data',
589
+ name: 'num_deposits',
590
+ type: 'core::integer::u32',
591
+ },
592
+ ],
593
+ },
594
+ {
595
+ kind: 'struct',
596
+ name: 'lbtc_bascule::events::MaxDepositsUpdated',
597
+ type: 'event',
598
+ members: [
599
+ {
600
+ kind: 'data',
601
+ name: 'num_deposits',
602
+ type: 'core::integer::u32',
603
+ },
604
+ ],
605
+ },
606
+ {
607
+ kind: 'struct',
608
+ name: 'lbtc_bascule::events::UpdateValidateThreshold',
609
+ type: 'event',
610
+ members: [
611
+ {
612
+ kind: 'data',
613
+ name: 'old_threshold',
614
+ type: 'core::integer::u256',
615
+ },
616
+ {
617
+ kind: 'data',
618
+ name: 'new_threshold',
619
+ type: 'core::integer::u256',
620
+ },
621
+ ],
622
+ },
623
+ {
624
+ kind: 'struct',
625
+ name: 'lbtc_bascule::events::WithdrawalNotValidated',
626
+ type: 'event',
627
+ members: [
628
+ {
629
+ kind: 'key',
630
+ name: 'deposit_id',
631
+ type: 'core::integer::u256',
632
+ },
633
+ {
634
+ kind: 'data',
635
+ name: 'withdrawal_amount',
636
+ type: 'core::integer::u256',
637
+ },
638
+ ],
639
+ },
640
+ {
641
+ kind: 'struct',
642
+ name: 'lbtc_bascule::events::WithdrawalValidated',
643
+ type: 'event',
644
+ members: [
645
+ {
646
+ kind: 'key',
647
+ name: 'deposit_id',
648
+ type: 'core::integer::u256',
649
+ },
650
+ {
651
+ kind: 'data',
652
+ name: 'withdrawal_amount',
653
+ type: 'core::integer::u256',
654
+ },
655
+ ],
656
+ },
657
+ {
658
+ kind: 'enum',
659
+ name: 'lbtc_bascule::bascule::bascule::Event',
660
+ type: 'event',
661
+ variants: [
662
+ {
663
+ kind: 'flat',
664
+ name: 'AccessControlEvent',
665
+ type: 'openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::Event',
666
+ },
667
+ {
668
+ kind: 'flat',
669
+ name: 'PausableEvent',
670
+ type: 'openzeppelin_security::pausable::PausableComponent::Event',
671
+ },
672
+ {
673
+ kind: 'flat',
674
+ name: 'SRC5Event',
675
+ type: 'openzeppelin_introspection::src5::SRC5Component::Event',
676
+ },
677
+ {
678
+ kind: 'nested',
679
+ name: 'DepositAlreadyReported',
680
+ type: 'lbtc_bascule::events::DepositAlreadyReported',
681
+ },
682
+ {
683
+ kind: 'nested',
684
+ name: 'DepositsReported',
685
+ type: 'lbtc_bascule::events::DepositsReported',
686
+ },
687
+ {
688
+ kind: 'nested',
689
+ name: 'MaxDepositsUpdated',
690
+ type: 'lbtc_bascule::events::MaxDepositsUpdated',
691
+ },
692
+ {
693
+ kind: 'nested',
694
+ name: 'UpdateValidateThreshold',
695
+ type: 'lbtc_bascule::events::UpdateValidateThreshold',
696
+ },
697
+ {
698
+ kind: 'nested',
699
+ name: 'WithdrawalNotValidated',
700
+ type: 'lbtc_bascule::events::WithdrawalNotValidated',
701
+ },
702
+ {
703
+ kind: 'nested',
704
+ name: 'WithdrawalValidated',
705
+ type: 'lbtc_bascule::events::WithdrawalValidated',
706
+ },
707
+ ],
708
+ },
709
+ ] as const;