@silentswap/sdk 0.0.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.
@@ -0,0 +1,766 @@
1
+ // Gateway ABI
2
+ export const GATEWAY_ABI = [
3
+ {
4
+ inputs: [
5
+ {
6
+ internalType: 'contract IERC20',
7
+ name: '_usdc',
8
+ type: 'address',
9
+ },
10
+ {
11
+ components: [
12
+ {
13
+ internalType: 'uint256',
14
+ name: 'minDuration',
15
+ type: 'uint256',
16
+ },
17
+ {
18
+ internalType: 'uint256',
19
+ name: 'maxDuration',
20
+ type: 'uint256',
21
+ },
22
+ {
23
+ internalType: 'uint256',
24
+ name: 'minDepositAmount',
25
+ type: 'uint256',
26
+ },
27
+ ],
28
+ internalType: 'struct SilentSwapV2Gateway.Config',
29
+ name: '_config',
30
+ type: 'tuple',
31
+ },
32
+ ],
33
+ stateMutability: 'nonpayable',
34
+ type: 'constructor',
35
+ },
36
+ {
37
+ inputs: [],
38
+ name: 'ApprovalExpired',
39
+ type: 'error',
40
+ },
41
+ {
42
+ inputs: [],
43
+ name: 'ApproverNotAuthorized',
44
+ type: 'error',
45
+ },
46
+ {
47
+ inputs: [
48
+ {
49
+ internalType: 'uint256',
50
+ name: 'index',
51
+ type: 'uint256',
52
+ },
53
+ {
54
+ internalType: 'enum SilentSwapV2Gateway.OrderStatus',
55
+ name: 'status',
56
+ type: 'uint8',
57
+ },
58
+ ],
59
+ name: 'ClaimRejectedOrderNotOpen',
60
+ type: 'error',
61
+ },
62
+ {
63
+ inputs: [],
64
+ name: 'ECDSAInvalidSignature',
65
+ type: 'error',
66
+ },
67
+ {
68
+ inputs: [
69
+ {
70
+ internalType: 'uint256',
71
+ name: 'length',
72
+ type: 'uint256',
73
+ },
74
+ ],
75
+ name: 'ECDSAInvalidSignatureLength',
76
+ type: 'error',
77
+ },
78
+ {
79
+ inputs: [
80
+ {
81
+ internalType: 'bytes32',
82
+ name: 's',
83
+ type: 'bytes32',
84
+ },
85
+ ],
86
+ name: 'ECDSAInvalidSignatureS',
87
+ type: 'error',
88
+ },
89
+ {
90
+ inputs: [
91
+ {
92
+ internalType: 'uint256',
93
+ name: 'minDuration',
94
+ type: 'uint256',
95
+ },
96
+ {
97
+ internalType: 'uint256',
98
+ name: 'maxDuration',
99
+ type: 'uint256',
100
+ },
101
+ ],
102
+ name: 'InvalidDuration',
103
+ type: 'error',
104
+ },
105
+ {
106
+ inputs: [],
107
+ name: 'InvalidOrderApprovalSignature',
108
+ type: 'error',
109
+ },
110
+ {
111
+ inputs: [],
112
+ name: 'InvalidTypedDataSignature',
113
+ type: 'error',
114
+ },
115
+ {
116
+ inputs: [],
117
+ name: 'OrderAlreadyExists',
118
+ type: 'error',
119
+ },
120
+ {
121
+ inputs: [
122
+ {
123
+ internalType: 'address',
124
+ name: 'owner',
125
+ type: 'address',
126
+ },
127
+ ],
128
+ name: 'OwnableInvalidOwner',
129
+ type: 'error',
130
+ },
131
+ {
132
+ inputs: [
133
+ {
134
+ internalType: 'address',
135
+ name: 'account',
136
+ type: 'address',
137
+ },
138
+ ],
139
+ name: 'OwnableUnauthorizedAccount',
140
+ type: 'error',
141
+ },
142
+ {
143
+ inputs: [],
144
+ name: 'PayloadAlreadyUsed',
145
+ type: 'error',
146
+ },
147
+ {
148
+ inputs: [
149
+ {
150
+ internalType: 'uint256',
151
+ name: 'minAmount',
152
+ type: 'uint256',
153
+ },
154
+ ],
155
+ name: 'ReceiveAuthorizationAmountTooLow',
156
+ type: 'error',
157
+ },
158
+ {
159
+ inputs: [],
160
+ name: 'ReceiveAuthorizationFailed',
161
+ type: 'error',
162
+ },
163
+ {
164
+ inputs: [],
165
+ name: 'ReceiveAuthorizationNotFromSigner',
166
+ type: 'error',
167
+ },
168
+ {
169
+ inputs: [],
170
+ name: 'ReceiveAuthorizationNotToContract',
171
+ type: 'error',
172
+ },
173
+ {
174
+ anonymous: false,
175
+ inputs: [
176
+ {
177
+ indexed: true,
178
+ internalType: 'address',
179
+ name: 'approver',
180
+ type: 'address',
181
+ },
182
+ ],
183
+ name: 'ApproverAdded',
184
+ type: 'event',
185
+ },
186
+ {
187
+ anonymous: false,
188
+ inputs: [
189
+ {
190
+ indexed: true,
191
+ internalType: 'address',
192
+ name: 'approver',
193
+ type: 'address',
194
+ },
195
+ ],
196
+ name: 'ApproverRemoved',
197
+ type: 'event',
198
+ },
199
+ {
200
+ anonymous: false,
201
+ inputs: [
202
+ {
203
+ indexed: true,
204
+ internalType: 'bytes32',
205
+ name: 'orderId',
206
+ type: 'bytes32',
207
+ },
208
+ {
209
+ indexed: true,
210
+ internalType: 'address',
211
+ name: 'recipient',
212
+ type: 'address',
213
+ },
214
+ {
215
+ indexed: false,
216
+ internalType: 'uint256',
217
+ name: 'amount',
218
+ type: 'uint256',
219
+ },
220
+ ],
221
+ name: 'Claim',
222
+ type: 'event',
223
+ },
224
+ {
225
+ anonymous: false,
226
+ inputs: [
227
+ {
228
+ indexed: false,
229
+ internalType: 'uint256',
230
+ name: 'minDuration',
231
+ type: 'uint256',
232
+ },
233
+ {
234
+ indexed: false,
235
+ internalType: 'uint256',
236
+ name: 'maxDuration',
237
+ type: 'uint256',
238
+ },
239
+ {
240
+ indexed: false,
241
+ internalType: 'uint256',
242
+ name: 'minDepositAmount',
243
+ type: 'uint256',
244
+ },
245
+ ],
246
+ name: 'ConfigUpdated',
247
+ type: 'event',
248
+ },
249
+ {
250
+ anonymous: false,
251
+ inputs: [
252
+ {
253
+ indexed: true,
254
+ internalType: 'address',
255
+ name: 'signer',
256
+ type: 'address',
257
+ },
258
+ {
259
+ indexed: true,
260
+ internalType: 'bytes32',
261
+ name: 'orderId',
262
+ type: 'bytes32',
263
+ },
264
+ {
265
+ indexed: false,
266
+ internalType: 'uint256',
267
+ name: 'amount',
268
+ type: 'uint256',
269
+ },
270
+ {
271
+ indexed: false,
272
+ internalType: 'uint256',
273
+ name: 'duration',
274
+ type: 'uint256',
275
+ },
276
+ ],
277
+ name: 'Deposit',
278
+ type: 'event',
279
+ },
280
+ {
281
+ anonymous: false,
282
+ inputs: [
283
+ {
284
+ indexed: true,
285
+ internalType: 'address',
286
+ name: 'previousOwner',
287
+ type: 'address',
288
+ },
289
+ {
290
+ indexed: true,
291
+ internalType: 'address',
292
+ name: 'newOwner',
293
+ type: 'address',
294
+ },
295
+ ],
296
+ name: 'OwnershipTransferred',
297
+ type: 'event',
298
+ },
299
+ {
300
+ anonymous: false,
301
+ inputs: [
302
+ {
303
+ indexed: true,
304
+ internalType: 'bytes32',
305
+ name: 'orderId',
306
+ type: 'bytes32',
307
+ },
308
+ {
309
+ indexed: true,
310
+ internalType: 'address',
311
+ name: 'refundee',
312
+ type: 'address',
313
+ },
314
+ {
315
+ indexed: false,
316
+ internalType: 'uint256',
317
+ name: 'amount',
318
+ type: 'uint256',
319
+ },
320
+ ],
321
+ name: 'Refund',
322
+ type: 'event',
323
+ },
324
+ {
325
+ inputs: [
326
+ {
327
+ internalType: 'address',
328
+ name: 'approver',
329
+ type: 'address',
330
+ },
331
+ ],
332
+ name: 'addApprover',
333
+ outputs: [],
334
+ stateMutability: 'nonpayable',
335
+ type: 'function',
336
+ },
337
+ {
338
+ inputs: [
339
+ {
340
+ internalType: 'address',
341
+ name: '',
342
+ type: 'address',
343
+ },
344
+ ],
345
+ name: 'authorizedApprovers',
346
+ outputs: [
347
+ {
348
+ internalType: 'bool',
349
+ name: '',
350
+ type: 'bool',
351
+ },
352
+ ],
353
+ stateMutability: 'view',
354
+ type: 'function',
355
+ },
356
+ {
357
+ inputs: [
358
+ {
359
+ components: [
360
+ {
361
+ components: [
362
+ {
363
+ internalType: 'bytes32',
364
+ name: 'orderId',
365
+ type: 'bytes32',
366
+ },
367
+ {
368
+ internalType: 'bytes',
369
+ name: 'signature',
370
+ type: 'bytes',
371
+ },
372
+ ],
373
+ internalType: 'struct SilentSwapV2Gateway.ClaimSpec[]',
374
+ name: 'claims',
375
+ type: 'tuple[]',
376
+ },
377
+ {
378
+ internalType: 'address',
379
+ name: 'recipient',
380
+ type: 'address',
381
+ },
382
+ ],
383
+ internalType: 'struct SilentSwapV2Gateway.BulkClaimParams',
384
+ name: 'params',
385
+ type: 'tuple',
386
+ },
387
+ ],
388
+ name: 'claim',
389
+ outputs: [
390
+ {
391
+ internalType: 'uint256',
392
+ name: '',
393
+ type: 'uint256',
394
+ },
395
+ ],
396
+ stateMutability: 'nonpayable',
397
+ type: 'function',
398
+ },
399
+ {
400
+ inputs: [],
401
+ name: 'config',
402
+ outputs: [
403
+ {
404
+ internalType: 'uint256',
405
+ name: 'minDuration',
406
+ type: 'uint256',
407
+ },
408
+ {
409
+ internalType: 'uint256',
410
+ name: 'maxDuration',
411
+ type: 'uint256',
412
+ },
413
+ {
414
+ internalType: 'uint256',
415
+ name: 'minDepositAmount',
416
+ type: 'uint256',
417
+ },
418
+ ],
419
+ stateMutability: 'view',
420
+ type: 'function',
421
+ },
422
+ {
423
+ inputs: [
424
+ {
425
+ components: [
426
+ {
427
+ internalType: 'address',
428
+ name: 'signer',
429
+ type: 'address',
430
+ },
431
+ {
432
+ internalType: 'bytes32',
433
+ name: 'orderId',
434
+ type: 'bytes32',
435
+ },
436
+ {
437
+ internalType: 'address',
438
+ name: 'notary',
439
+ type: 'address',
440
+ },
441
+ {
442
+ internalType: 'address',
443
+ name: 'approver',
444
+ type: 'address',
445
+ },
446
+ {
447
+ internalType: 'bytes',
448
+ name: 'orderApproval',
449
+ type: 'bytes',
450
+ },
451
+ {
452
+ internalType: 'uint256',
453
+ name: 'approvalExpiration',
454
+ type: 'uint256',
455
+ },
456
+ {
457
+ internalType: 'uint256',
458
+ name: 'duration',
459
+ type: 'uint256',
460
+ },
461
+ {
462
+ internalType: 'bytes32',
463
+ name: 'domainSepHash',
464
+ type: 'bytes32',
465
+ },
466
+ {
467
+ internalType: 'bytes32',
468
+ name: 'payloadHash',
469
+ type: 'bytes32',
470
+ },
471
+ {
472
+ internalType: 'bytes',
473
+ name: 'typedDataSignature',
474
+ type: 'bytes',
475
+ },
476
+ {
477
+ internalType: 'bytes',
478
+ name: 'receiveAuthorization',
479
+ type: 'bytes',
480
+ },
481
+ ],
482
+ internalType: 'struct SilentSwapV2Gateway.DepositParams',
483
+ name: 'params',
484
+ type: 'tuple',
485
+ },
486
+ ],
487
+ name: 'deposit',
488
+ outputs: [],
489
+ stateMutability: 'nonpayable',
490
+ type: 'function',
491
+ },
492
+ {
493
+ inputs: [],
494
+ name: 'getConfig',
495
+ outputs: [
496
+ {
497
+ components: [
498
+ {
499
+ internalType: 'uint256',
500
+ name: 'minDuration',
501
+ type: 'uint256',
502
+ },
503
+ {
504
+ internalType: 'uint256',
505
+ name: 'maxDuration',
506
+ type: 'uint256',
507
+ },
508
+ {
509
+ internalType: 'uint256',
510
+ name: 'minDepositAmount',
511
+ type: 'uint256',
512
+ },
513
+ ],
514
+ internalType: 'struct SilentSwapV2Gateway.Config',
515
+ name: '',
516
+ type: 'tuple',
517
+ },
518
+ ],
519
+ stateMutability: 'view',
520
+ type: 'function',
521
+ },
522
+ {
523
+ inputs: [
524
+ {
525
+ internalType: 'address',
526
+ name: 'approver',
527
+ type: 'address',
528
+ },
529
+ ],
530
+ name: 'isAuthorizedApprover',
531
+ outputs: [
532
+ {
533
+ internalType: 'bool',
534
+ name: 'isAuthorized',
535
+ type: 'bool',
536
+ },
537
+ ],
538
+ stateMutability: 'view',
539
+ type: 'function',
540
+ },
541
+ {
542
+ inputs: [
543
+ {
544
+ internalType: 'bytes32',
545
+ name: '',
546
+ type: 'bytes32',
547
+ },
548
+ ],
549
+ name: 'orders',
550
+ outputs: [
551
+ {
552
+ internalType: 'enum SilentSwapV2Gateway.OrderStatus',
553
+ name: 'status',
554
+ type: 'uint8',
555
+ },
556
+ {
557
+ internalType: 'uint256',
558
+ name: 'expiration',
559
+ type: 'uint256',
560
+ },
561
+ {
562
+ internalType: 'address',
563
+ name: 'notary',
564
+ type: 'address',
565
+ },
566
+ {
567
+ internalType: 'address',
568
+ name: 'refundee',
569
+ type: 'address',
570
+ },
571
+ {
572
+ internalType: 'uint256',
573
+ name: 'amount',
574
+ type: 'uint256',
575
+ },
576
+ ],
577
+ stateMutability: 'view',
578
+ type: 'function',
579
+ },
580
+ {
581
+ inputs: [],
582
+ name: 'owner',
583
+ outputs: [
584
+ {
585
+ internalType: 'address',
586
+ name: '',
587
+ type: 'address',
588
+ },
589
+ ],
590
+ stateMutability: 'view',
591
+ type: 'function',
592
+ },
593
+ {
594
+ inputs: [
595
+ {
596
+ internalType: 'bytes32',
597
+ name: '',
598
+ type: 'bytes32',
599
+ },
600
+ ],
601
+ name: 'payloads',
602
+ outputs: [
603
+ {
604
+ internalType: 'bytes32',
605
+ name: '',
606
+ type: 'bytes32',
607
+ },
608
+ ],
609
+ stateMutability: 'view',
610
+ type: 'function',
611
+ },
612
+ {
613
+ inputs: [
614
+ {
615
+ internalType: 'bytes32',
616
+ name: 'orderId',
617
+ type: 'bytes32',
618
+ },
619
+ ],
620
+ name: 'queryOrderStatus',
621
+ outputs: [
622
+ {
623
+ internalType: 'enum SilentSwapV2Gateway.OrderStatus',
624
+ name: '',
625
+ type: 'uint8',
626
+ },
627
+ ],
628
+ stateMutability: 'view',
629
+ type: 'function',
630
+ },
631
+ {
632
+ inputs: [
633
+ {
634
+ internalType: 'bytes32',
635
+ name: 'orderId',
636
+ type: 'bytes32',
637
+ },
638
+ ],
639
+ name: 'refund',
640
+ outputs: [],
641
+ stateMutability: 'nonpayable',
642
+ type: 'function',
643
+ },
644
+ {
645
+ inputs: [
646
+ {
647
+ internalType: 'address',
648
+ name: 'approver',
649
+ type: 'address',
650
+ },
651
+ ],
652
+ name: 'removeApprover',
653
+ outputs: [],
654
+ stateMutability: 'nonpayable',
655
+ type: 'function',
656
+ },
657
+ {
658
+ inputs: [],
659
+ name: 'renounceOwnership',
660
+ outputs: [],
661
+ stateMutability: 'nonpayable',
662
+ type: 'function',
663
+ },
664
+ {
665
+ inputs: [
666
+ {
667
+ internalType: 'uint256',
668
+ name: 'minimumDuration',
669
+ type: 'uint256',
670
+ },
671
+ {
672
+ internalType: 'uint256',
673
+ name: 'maximumDuration',
674
+ type: 'uint256',
675
+ },
676
+ {
677
+ internalType: 'uint256',
678
+ name: 'minimumDepositAmount',
679
+ type: 'uint256',
680
+ },
681
+ ],
682
+ name: 'setConfig',
683
+ outputs: [],
684
+ stateMutability: 'nonpayable',
685
+ type: 'function',
686
+ },
687
+ {
688
+ inputs: [
689
+ {
690
+ internalType: 'address',
691
+ name: 'signer',
692
+ type: 'address',
693
+ },
694
+ ],
695
+ name: 'signerCounts',
696
+ outputs: [
697
+ {
698
+ internalType: 'uint256',
699
+ name: 'count',
700
+ type: 'uint256',
701
+ },
702
+ ],
703
+ stateMutability: 'view',
704
+ type: 'function',
705
+ },
706
+ {
707
+ inputs: [
708
+ {
709
+ internalType: 'address',
710
+ name: 'newOwner',
711
+ type: 'address',
712
+ },
713
+ ],
714
+ name: 'transferOwnership',
715
+ outputs: [],
716
+ stateMutability: 'nonpayable',
717
+ type: 'function',
718
+ },
719
+ {
720
+ inputs: [],
721
+ name: 'usdc',
722
+ outputs: [
723
+ {
724
+ internalType: 'contract IERC20',
725
+ name: '',
726
+ type: 'address',
727
+ },
728
+ ],
729
+ stateMutability: 'view',
730
+ type: 'function',
731
+ },
732
+ {
733
+ inputs: [
734
+ {
735
+ internalType: 'bytes32',
736
+ name: 'domainSepHash',
737
+ type: 'bytes32',
738
+ },
739
+ {
740
+ internalType: 'bytes32',
741
+ name: 'payloadHash',
742
+ type: 'bytes32',
743
+ },
744
+ {
745
+ internalType: 'bytes',
746
+ name: 'typedDataSignature',
747
+ type: 'bytes',
748
+ },
749
+ {
750
+ internalType: 'address',
751
+ name: 'signer',
752
+ type: 'address',
753
+ },
754
+ ],
755
+ name: 'verifyTypedDataSignature',
756
+ outputs: [
757
+ {
758
+ internalType: 'bool',
759
+ name: 'isValid',
760
+ type: 'bool',
761
+ },
762
+ ],
763
+ stateMutability: 'pure',
764
+ type: 'function',
765
+ },
766
+ ];