@reyaxyz/sdk 0.50.0 → 0.52.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.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/abis/CoreProxy.json +5600 -0
  3. package/dist/abis/Periphery.json +380 -92
  4. package/dist/abis/socket/VaultWithPayload.json +6 -1
  5. package/dist/services/encode.js +2 -2
  6. package/dist/services/encode.js.map +1 -1
  7. package/dist/services/lp/bridgeAndDepositPassivePool.js +2 -2
  8. package/dist/services/lp/bridgeAndDepositPassivePool.js.map +1 -1
  9. package/dist/services/lp/encode.js +10 -6
  10. package/dist/services/lp/encode.js.map +1 -1
  11. package/dist/services/lp/transferFromMAToPool.js +1 -1
  12. package/dist/services/lp/transferFromMAToPool.js.map +1 -1
  13. package/dist/services/lp/types.js.map +1 -1
  14. package/dist/services/lp/withdrawPassivePoolAndBridge.js +2 -2
  15. package/dist/services/lp/withdrawPassivePoolAndBridge.js.map +1 -1
  16. package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js +4 -9
  17. package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js.map +1 -1
  18. package/dist/services/margin-accounts/bridgeAndDepositNewMA.js +2 -2
  19. package/dist/services/margin-accounts/bridgeAndDepositNewMA.js.map +1 -1
  20. package/dist/services/margin-accounts/encode.js +17 -12
  21. package/dist/services/margin-accounts/encode.js.map +1 -1
  22. package/dist/services/margin-accounts/withdrawMAAndBridge.js +1 -1
  23. package/dist/services/margin-accounts/withdrawMAAndBridge.js.map +1 -1
  24. package/dist/services/orders/encode.js +2 -2
  25. package/dist/services/orders/encode.js.map +1 -1
  26. package/dist/types/services/lp/bridgeAndDepositPassivePool.d.ts.map +1 -1
  27. package/dist/types/services/lp/encode.d.ts +3 -3
  28. package/dist/types/services/lp/encode.d.ts.map +1 -1
  29. package/dist/types/services/lp/transferFromMAToPool.d.ts.map +1 -1
  30. package/dist/types/services/lp/types.d.ts +1 -1
  31. package/dist/types/services/lp/types.d.ts.map +1 -1
  32. package/dist/types/services/lp/withdrawPassivePoolAndBridge.d.ts.map +1 -1
  33. package/dist/types/services/margin-accounts/bridgeAndDepositExistingMA.d.ts.map +1 -1
  34. package/dist/types/services/margin-accounts/bridgeAndDepositNewMA.d.ts.map +1 -1
  35. package/dist/types/services/margin-accounts/encode.d.ts +3 -3
  36. package/dist/types/services/margin-accounts/encode.d.ts.map +1 -1
  37. package/dist/types/services/margin-accounts/withdrawMAAndBridge.d.ts.map +1 -1
  38. package/package.json +3 -3
  39. package/src/abis/CoreProxy.json +5394 -0
  40. package/src/abis/Periphery.json +380 -92
  41. package/src/abis/socket/VaultWithPayload.json +6 -1
  42. package/src/services/encode.ts +1 -1
  43. package/src/services/lp/bridgeAndDepositPassivePool.ts +2 -0
  44. package/src/services/lp/encode.ts +12 -3
  45. package/src/services/lp/transferFromMAToPool.ts +1 -0
  46. package/src/services/lp/types.ts +1 -1
  47. package/src/services/lp/withdrawPassivePoolAndBridge.ts +2 -0
  48. package/src/services/margin-accounts/bridgeAndDepositExistingMA.ts +2 -14
  49. package/src/services/margin-accounts/bridgeAndDepositNewMA.ts +2 -0
  50. package/src/services/margin-accounts/encode.ts +17 -9
  51. package/src/services/margin-accounts/withdrawMAAndBridge.ts +1 -0
  52. package/src/services/orders/encode.ts +1 -1
  53. package/dist/abis/AccountModule.json +0 -1079
  54. package/dist/abis/ExecutionModule.json +0 -758
  55. package/src/abis/AccountModule.json +0 -1079
  56. package/src/abis/ExecutionModule.json +0 -758
@@ -143,17 +143,6 @@
143
143
  ],
144
144
  "anonymous": false
145
145
  },
146
- {
147
- "type": "error",
148
- "name": "CheckZeroGasPrice",
149
- "inputs": [
150
- {
151
- "name": "txGasPrice",
152
- "type": "uint256",
153
- "internalType": "uint256"
154
- }
155
- ]
156
- },
157
146
  {
158
147
  "type": "error",
159
148
  "name": "ImplementationIsSterile",
@@ -262,6 +251,25 @@
262
251
  ],
263
252
  "stateMutability": "view"
264
253
  },
254
+ {
255
+ "type": "function",
256
+ "name": "getTokenExecutionHelper",
257
+ "inputs": [
258
+ {
259
+ "name": "token",
260
+ "type": "address",
261
+ "internalType": "address"
262
+ }
263
+ ],
264
+ "outputs": [
265
+ {
266
+ "name": "executionHelper",
267
+ "type": "address",
268
+ "internalType": "address"
269
+ }
270
+ ],
271
+ "stateMutability": "view"
272
+ },
265
273
  {
266
274
  "type": "function",
267
275
  "name": "getTokenStaticWithdrawFee",
@@ -288,12 +296,40 @@
288
296
  },
289
297
  {
290
298
  "type": "function",
291
- "name": "rescueFunds",
299
+ "name": "rescueErc20",
292
300
  "inputs": [
293
301
  {
294
302
  "name": "amount",
295
303
  "type": "uint256",
296
304
  "internalType": "uint256"
305
+ },
306
+ {
307
+ "name": "token",
308
+ "type": "address",
309
+ "internalType": "address"
310
+ },
311
+ {
312
+ "name": "receiver",
313
+ "type": "address",
314
+ "internalType": "address"
315
+ }
316
+ ],
317
+ "outputs": [],
318
+ "stateMutability": "nonpayable"
319
+ },
320
+ {
321
+ "type": "function",
322
+ "name": "rescueEth",
323
+ "inputs": [
324
+ {
325
+ "name": "amount",
326
+ "type": "uint256",
327
+ "internalType": "uint256"
328
+ },
329
+ {
330
+ "name": "receiver",
331
+ "type": "address",
332
+ "internalType": "address"
297
333
  }
298
334
  ],
299
335
  "outputs": [],
@@ -347,6 +383,24 @@
347
383
  "outputs": [],
348
384
  "stateMutability": "nonpayable"
349
385
  },
386
+ {
387
+ "type": "function",
388
+ "name": "setTokenExecutionHelper",
389
+ "inputs": [
390
+ {
391
+ "name": "token",
392
+ "type": "address",
393
+ "internalType": "address"
394
+ },
395
+ {
396
+ "name": "executionHelper",
397
+ "type": "address",
398
+ "internalType": "address"
399
+ }
400
+ ],
401
+ "outputs": [],
402
+ "stateMutability": "nonpayable"
403
+ },
350
404
  {
351
405
  "type": "function",
352
406
  "name": "setTokenStaticWithdrawFee",
@@ -370,6 +424,54 @@
370
424
  "outputs": [],
371
425
  "stateMutability": "nonpayable"
372
426
  },
427
+ {
428
+ "type": "error",
429
+ "name": "ControllerNotRegistered",
430
+ "inputs": [
431
+ {
432
+ "name": "token",
433
+ "type": "address",
434
+ "internalType": "address"
435
+ }
436
+ ]
437
+ },
438
+ {
439
+ "type": "error",
440
+ "name": "ExecutionHelperNotRegistered",
441
+ "inputs": [
442
+ {
443
+ "name": "token",
444
+ "type": "address",
445
+ "internalType": "address"
446
+ }
447
+ ]
448
+ },
449
+ {
450
+ "type": "error",
451
+ "name": "FailedToRescueFunds",
452
+ "inputs": []
453
+ },
454
+ {
455
+ "type": "error",
456
+ "name": "FailedTransfer",
457
+ "inputs": [
458
+ {
459
+ "name": "from",
460
+ "type": "address",
461
+ "internalType": "address"
462
+ },
463
+ {
464
+ "name": "to",
465
+ "type": "address",
466
+ "internalType": "address"
467
+ },
468
+ {
469
+ "name": "value",
470
+ "type": "uint256",
471
+ "internalType": "uint256"
472
+ }
473
+ ]
474
+ },
373
475
  {
374
476
  "type": "function",
375
477
  "name": "depositExistingMA",
@@ -393,33 +495,6 @@
393
495
  "name": "tokenAmount",
394
496
  "type": "uint256",
395
497
  "internalType": "uint256"
396
- },
397
- {
398
- "name": "sig",
399
- "type": "tuple",
400
- "internalType": "struct EIP712Signature",
401
- "components": [
402
- {
403
- "name": "v",
404
- "type": "uint8",
405
- "internalType": "uint8"
406
- },
407
- {
408
- "name": "r",
409
- "type": "bytes32",
410
- "internalType": "bytes32"
411
- },
412
- {
413
- "name": "s",
414
- "type": "bytes32",
415
- "internalType": "bytes32"
416
- },
417
- {
418
- "name": "deadline",
419
- "type": "uint256",
420
- "internalType": "uint256"
421
- }
422
- ]
423
498
  }
424
499
  ]
425
500
  }
@@ -498,6 +573,22 @@
498
573
  "outputs": [],
499
574
  "stateMutability": "nonpayable"
500
575
  },
576
+ {
577
+ "type": "error",
578
+ "name": "BridgedAmountDoesNotMatch",
579
+ "inputs": [
580
+ {
581
+ "name": "bridgeAmount",
582
+ "type": "uint256",
583
+ "internalType": "uint256"
584
+ },
585
+ {
586
+ "name": "givenAmount",
587
+ "type": "uint256",
588
+ "internalType": "uint256"
589
+ }
590
+ ]
591
+ },
501
592
  {
502
593
  "type": "error",
503
594
  "name": "CheckSelfCall",
@@ -575,33 +666,6 @@
575
666
  "name": "tokenAmount",
576
667
  "type": "uint256",
577
668
  "internalType": "uint256"
578
- },
579
- {
580
- "name": "sig",
581
- "type": "tuple",
582
- "internalType": "struct EIP712Signature",
583
- "components": [
584
- {
585
- "name": "v",
586
- "type": "uint8",
587
- "internalType": "uint8"
588
- },
589
- {
590
- "name": "r",
591
- "type": "bytes32",
592
- "internalType": "bytes32"
593
- },
594
- {
595
- "name": "s",
596
- "type": "bytes32",
597
- "internalType": "bytes32"
598
- },
599
- {
600
- "name": "deadline",
601
- "type": "uint256",
602
- "internalType": "uint256"
603
- }
604
- ]
605
669
  }
606
670
  ]
607
671
  },
@@ -615,6 +679,11 @@
615
679
  "type": "uint256",
616
680
  "internalType": "uint256"
617
681
  },
682
+ {
683
+ "name": "socketPayloadSize",
684
+ "type": "uint256",
685
+ "internalType": "uint256"
686
+ },
618
687
  {
619
688
  "name": "socketConnector",
620
689
  "type": "address",
@@ -662,6 +731,11 @@
662
731
  "type": "uint256",
663
732
  "internalType": "uint256"
664
733
  },
734
+ {
735
+ "name": "socketPayloadSize",
736
+ "type": "uint256",
737
+ "internalType": "uint256"
738
+ },
665
739
  {
666
740
  "name": "socketConnector",
667
741
  "type": "address",
@@ -714,6 +788,11 @@
714
788
  "type": "uint256",
715
789
  "internalType": "uint256"
716
790
  },
791
+ {
792
+ "name": "socketPayloadSize",
793
+ "type": "uint256",
794
+ "internalType": "uint256"
795
+ },
717
796
  {
718
797
  "name": "socketConnector",
719
798
  "type": "address",
@@ -727,15 +806,15 @@
727
806
  },
728
807
  {
729
808
  "type": "error",
730
- "name": "ControllerNotRegistered",
809
+ "name": "CallerIsNotExecutionHelper",
731
810
  "inputs": [
732
811
  {
733
- "name": "token",
812
+ "name": "caller",
734
813
  "type": "address",
735
814
  "internalType": "address"
736
815
  },
737
816
  {
738
- "name": "controler",
817
+ "name": "token",
739
818
  "type": "address",
740
819
  "internalType": "address"
741
820
  }
@@ -743,40 +822,167 @@
743
822
  },
744
823
  {
745
824
  "type": "error",
746
- "name": "FailedTransfer",
825
+ "name": "NotEnoughFees",
747
826
  "inputs": [
748
827
  {
749
- "name": "from",
750
- "type": "address",
751
- "internalType": "address"
752
- },
753
- {
754
- "name": "to",
755
- "type": "address",
756
- "internalType": "address"
828
+ "name": "tokenAmount",
829
+ "type": "uint256",
830
+ "internalType": "uint256"
757
831
  },
758
832
  {
759
- "name": "value",
833
+ "name": "tokenFees",
760
834
  "type": "uint256",
761
835
  "internalType": "uint256"
762
836
  }
763
837
  ]
764
838
  },
765
839
  {
766
- "type": "error",
767
- "name": "NotEnoughFees",
840
+ "type": "function",
841
+ "name": "executeMatchOrders",
768
842
  "inputs": [
769
843
  {
770
- "name": "tokenAmount",
771
- "type": "uint256",
772
- "internalType": "uint256"
773
- },
844
+ "name": "inputs",
845
+ "type": "tuple",
846
+ "internalType": "struct PeripheryMatchOrderInputs",
847
+ "components": [
848
+ {
849
+ "name": "accountId",
850
+ "type": "uint128",
851
+ "internalType": "uint128"
852
+ },
853
+ {
854
+ "name": "commands",
855
+ "type": "tuple[]",
856
+ "internalType": "struct Command[]",
857
+ "components": [
858
+ {
859
+ "name": "commandType",
860
+ "type": "uint8",
861
+ "internalType": "enum CommandType"
862
+ },
863
+ {
864
+ "name": "inputs",
865
+ "type": "bytes",
866
+ "internalType": "bytes"
867
+ },
868
+ {
869
+ "name": "marketId",
870
+ "type": "uint128",
871
+ "internalType": "uint128"
872
+ },
873
+ {
874
+ "name": "exchangeId",
875
+ "type": "uint128",
876
+ "internalType": "uint128"
877
+ }
878
+ ]
879
+ },
880
+ {
881
+ "name": "sig",
882
+ "type": "tuple",
883
+ "internalType": "struct EIP712Signature",
884
+ "components": [
885
+ {
886
+ "name": "v",
887
+ "type": "uint8",
888
+ "internalType": "uint8"
889
+ },
890
+ {
891
+ "name": "r",
892
+ "type": "bytes32",
893
+ "internalType": "bytes32"
894
+ },
895
+ {
896
+ "name": "s",
897
+ "type": "bytes32",
898
+ "internalType": "bytes32"
899
+ },
900
+ {
901
+ "name": "deadline",
902
+ "type": "uint256",
903
+ "internalType": "uint256"
904
+ }
905
+ ]
906
+ }
907
+ ]
908
+ }
909
+ ],
910
+ "outputs": [],
911
+ "stateMutability": "nonpayable"
912
+ },
913
+ {
914
+ "type": "error",
915
+ "name": "InvalidMatchOrders",
916
+ "inputs": []
917
+ },
918
+ {
919
+ "type": "function",
920
+ "name": "transferFromMAToMA",
921
+ "inputs": [
774
922
  {
775
- "name": "tokenFees",
776
- "type": "uint256",
777
- "internalType": "uint256"
923
+ "name": "inputs",
924
+ "type": "tuple",
925
+ "internalType": "struct TransferFromMAToMAInputs",
926
+ "components": [
927
+ {
928
+ "name": "accountId",
929
+ "type": "uint128",
930
+ "internalType": "uint128"
931
+ },
932
+ {
933
+ "name": "transfer",
934
+ "type": "tuple",
935
+ "internalType": "struct TransferInput",
936
+ "components": [
937
+ {
938
+ "name": "destAccountId",
939
+ "type": "uint128",
940
+ "internalType": "uint128"
941
+ },
942
+ {
943
+ "name": "collateral",
944
+ "type": "address",
945
+ "internalType": "address"
946
+ },
947
+ {
948
+ "name": "collateralAmount",
949
+ "type": "uint256",
950
+ "internalType": "uint256"
951
+ }
952
+ ]
953
+ },
954
+ {
955
+ "name": "sig",
956
+ "type": "tuple",
957
+ "internalType": "struct EIP712Signature",
958
+ "components": [
959
+ {
960
+ "name": "v",
961
+ "type": "uint8",
962
+ "internalType": "uint8"
963
+ },
964
+ {
965
+ "name": "r",
966
+ "type": "bytes32",
967
+ "internalType": "bytes32"
968
+ },
969
+ {
970
+ "name": "s",
971
+ "type": "bytes32",
972
+ "internalType": "bytes32"
973
+ },
974
+ {
975
+ "name": "deadline",
976
+ "type": "uint256",
977
+ "internalType": "uint256"
978
+ }
979
+ ]
980
+ }
981
+ ]
778
982
  }
779
- ]
983
+ ],
984
+ "outputs": [],
985
+ "stateMutability": "nonpayable"
780
986
  },
781
987
  {
782
988
  "type": "function",
@@ -833,6 +1039,11 @@
833
1039
  "name": "minShares",
834
1040
  "type": "uint256",
835
1041
  "internalType": "uint256"
1042
+ },
1043
+ {
1044
+ "name": "receiver",
1045
+ "type": "address",
1046
+ "internalType": "address"
836
1047
  }
837
1048
  ]
838
1049
  }
@@ -841,9 +1052,71 @@
841
1052
  "stateMutability": "nonpayable"
842
1053
  },
843
1054
  {
844
- "type": "error",
845
- "name": "UnauthorizedCaller",
846
- "inputs": []
1055
+ "type": "function",
1056
+ "name": "transferFromPoolToMA",
1057
+ "inputs": [
1058
+ {
1059
+ "name": "inputs",
1060
+ "type": "tuple",
1061
+ "internalType": "struct TransferFromPoolToMAInputs",
1062
+ "components": [
1063
+ {
1064
+ "name": "owner",
1065
+ "type": "address",
1066
+ "internalType": "address"
1067
+ },
1068
+ {
1069
+ "name": "sig",
1070
+ "type": "tuple",
1071
+ "internalType": "struct EIP712Signature",
1072
+ "components": [
1073
+ {
1074
+ "name": "v",
1075
+ "type": "uint8",
1076
+ "internalType": "uint8"
1077
+ },
1078
+ {
1079
+ "name": "r",
1080
+ "type": "bytes32",
1081
+ "internalType": "bytes32"
1082
+ },
1083
+ {
1084
+ "name": "s",
1085
+ "type": "bytes32",
1086
+ "internalType": "bytes32"
1087
+ },
1088
+ {
1089
+ "name": "deadline",
1090
+ "type": "uint256",
1091
+ "internalType": "uint256"
1092
+ }
1093
+ ]
1094
+ },
1095
+ {
1096
+ "name": "sharesAmount",
1097
+ "type": "uint256",
1098
+ "internalType": "uint256"
1099
+ },
1100
+ {
1101
+ "name": "poolId",
1102
+ "type": "uint128",
1103
+ "internalType": "uint128"
1104
+ },
1105
+ {
1106
+ "name": "minOut",
1107
+ "type": "uint256",
1108
+ "internalType": "uint256"
1109
+ },
1110
+ {
1111
+ "name": "accountId",
1112
+ "type": "uint128",
1113
+ "internalType": "uint128"
1114
+ }
1115
+ ]
1116
+ }
1117
+ ],
1118
+ "outputs": [],
1119
+ "stateMutability": "nonpayable"
847
1120
  },
848
1121
  {
849
1122
  "type": "function",
@@ -901,6 +1174,11 @@
901
1174
  "type": "uint256",
902
1175
  "internalType": "uint256"
903
1176
  },
1177
+ {
1178
+ "name": "socketPayloadSize",
1179
+ "type": "uint256",
1180
+ "internalType": "uint256"
1181
+ },
904
1182
  {
905
1183
  "name": "socketConnector",
906
1184
  "type": "address",
@@ -926,6 +1204,11 @@
926
1204
  "type": "tuple",
927
1205
  "internalType": "struct WithdrawPassivePoolInputs",
928
1206
  "components": [
1207
+ {
1208
+ "name": "owner",
1209
+ "type": "address",
1210
+ "internalType": "address"
1211
+ },
929
1212
  {
930
1213
  "name": "poolId",
931
1214
  "type": "uint128",
@@ -973,6 +1256,11 @@
973
1256
  "type": "uint256",
974
1257
  "internalType": "uint256"
975
1258
  },
1259
+ {
1260
+ "name": "socketPayloadSize",
1261
+ "type": "uint256",
1262
+ "internalType": "uint256"
1263
+ },
976
1264
  {
977
1265
  "name": "socketConnector",
978
1266
  "type": "address",
@@ -2,7 +2,7 @@
2
2
  "abi": [
3
3
  {
4
4
  "type": "function",
5
- "name": "depositToAppChain",
5
+ "name": "bridge",
6
6
  "inputs": [
7
7
  {
8
8
  "name": "receiver_",
@@ -28,6 +28,11 @@
28
28
  "name": "execPayload_",
29
29
  "type": "bytes",
30
30
  "internalType": "bytes"
31
+ },
32
+ {
33
+ "name": "options_",
34
+ "type": "bytes",
35
+ "internalType": "bytes"
31
36
  }
32
37
  ]
33
38
  }
@@ -3,7 +3,7 @@
3
3
  import { MethodParameters, MultiAction } from '../utils/action';
4
4
  import { CommandType, getCommand } from '../utils/routerCommands';
5
5
  import { AbiCoder, Interface } from 'ethers';
6
- import { abi } from '../abis/ExecutionModule.json';
6
+ import { abi } from '../abis/CoreProxy.json';
7
7
  // const abi = [
8
8
  // 'function coreExecute(uint128 poolId, uint128 accountId, Command[] commands, EIP712Signature sig)',
9
9
  // ];
@@ -42,6 +42,7 @@ export const bridgeAndDepositPassivePool = async (
42
42
  peripheryAddress,
43
43
  BigInt('10000000'),
44
44
  socketConnectors.deposit,
45
+ '0x',
45
46
  getSocketDepositFeesAsBigInt({
46
47
  moneyInOutChainId: moneyInOutChainId,
47
48
  }),
@@ -51,6 +52,7 @@ export const bridgeAndDepositPassivePool = async (
51
52
  BigInt(0),
52
53
  BigInt('10000000'),
53
54
  socketConnectors.withdraw,
55
+ BigInt(0),
54
56
  );
55
57
 
56
58
  const result = await executeTransaction(