@defisaver/sdk 1.3.28 → 1.3.30
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/esm/src/Action.js +23 -5
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/actions/midnight/MidnightBorrowFromOrdersAction.d.ts +18 -0
- package/esm/src/actions/midnight/MidnightBorrowFromOrdersAction.js +28 -0
- package/esm/src/actions/midnight/MidnightPaybackDirectAction.d.ts +16 -0
- package/esm/src/actions/midnight/MidnightPaybackDirectAction.js +24 -0
- package/esm/src/actions/midnight/MidnightPaybackFromOrdersAction.d.ts +18 -0
- package/esm/src/actions/midnight/MidnightPaybackFromOrdersAction.js +28 -0
- package/esm/src/actions/midnight/MidnightSupplyCollateralAction.d.ts +17 -0
- package/esm/src/actions/midnight/MidnightSupplyCollateralAction.js +26 -0
- package/esm/src/actions/midnight/MidnightWithdrawCollateralAction.d.ts +17 -0
- package/esm/src/actions/midnight/MidnightWithdrawCollateralAction.js +26 -0
- package/esm/src/actions/midnight/index.d.ts +5 -0
- package/esm/src/actions/midnight/index.js +5 -0
- package/esm/src/addresses.d.ts +36 -0
- package/esm/src/addresses.js +8 -2
- package/esm/src/index.d.ts +144 -0
- package/package.json +1 -1
- package/src/Action.ts +21 -5
- package/src/actions/index.ts +2 -0
- package/src/actions/midnight/MidnightBorrowFromOrdersAction.ts +44 -0
- package/src/actions/midnight/MidnightPaybackDirectAction.ts +36 -0
- package/src/actions/midnight/MidnightPaybackFromOrdersAction.ts +44 -0
- package/src/actions/midnight/MidnightSupplyCollateralAction.ts +39 -0
- package/src/actions/midnight/MidnightWithdrawCollateralAction.ts +39 -0
- package/src/actions/midnight/index.ts +5 -0
- package/src/addresses.ts +9 -2
- package/umd/index.js +300 -93
package/esm/src/index.d.ts
CHANGED
|
@@ -305,6 +305,12 @@ declare const actionAddressesAllChains: {
|
|
|
305
305
|
GasFeeTakerL2?: undefined;
|
|
306
306
|
AaveV3RatioCheck?: undefined;
|
|
307
307
|
MorphoBlueView?: undefined;
|
|
308
|
+
MidnightPaybackDirect?: undefined;
|
|
309
|
+
MidnightBorrowFromOrders?: undefined;
|
|
310
|
+
MidnightPaybackFromOrders?: undefined;
|
|
311
|
+
MidnightSupplyCollateral?: undefined;
|
|
312
|
+
MidnightWithdrawCollateral?: undefined;
|
|
313
|
+
MidnightView?: undefined;
|
|
308
314
|
} | {
|
|
309
315
|
DFSSell: string;
|
|
310
316
|
DFSSellNoFee: string;
|
|
@@ -599,6 +605,12 @@ declare const actionAddressesAllChains: {
|
|
|
599
605
|
AaveV4DelegateBorrowWithSig?: undefined;
|
|
600
606
|
AaveV4DelegateSetUsingAsCollateralWithSig?: undefined;
|
|
601
607
|
MorphoBlueView?: undefined;
|
|
608
|
+
MidnightPaybackDirect?: undefined;
|
|
609
|
+
MidnightBorrowFromOrders?: undefined;
|
|
610
|
+
MidnightPaybackFromOrders?: undefined;
|
|
611
|
+
MidnightSupplyCollateral?: undefined;
|
|
612
|
+
MidnightWithdrawCollateral?: undefined;
|
|
613
|
+
MidnightView?: undefined;
|
|
602
614
|
} | {
|
|
603
615
|
DFSSell: string;
|
|
604
616
|
DFSSellNoFee: string;
|
|
@@ -893,6 +905,12 @@ declare const actionAddressesAllChains: {
|
|
|
893
905
|
AaveV4DelegateBorrowWithSig?: undefined;
|
|
894
906
|
AaveV4DelegateSetUsingAsCollateralWithSig?: undefined;
|
|
895
907
|
AaveV3RatioTrigger?: undefined;
|
|
908
|
+
MidnightPaybackDirect?: undefined;
|
|
909
|
+
MidnightBorrowFromOrders?: undefined;
|
|
910
|
+
MidnightPaybackFromOrders?: undefined;
|
|
911
|
+
MidnightSupplyCollateral?: undefined;
|
|
912
|
+
MidnightWithdrawCollateral?: undefined;
|
|
913
|
+
MidnightView?: undefined;
|
|
896
914
|
} | {
|
|
897
915
|
DFSSell: string;
|
|
898
916
|
DFSSellNoFee: string;
|
|
@@ -966,6 +984,12 @@ declare const actionAddressesAllChains: {
|
|
|
966
984
|
SFApproveTokens: string;
|
|
967
985
|
SummerfiUnsub: string;
|
|
968
986
|
SummerfiUnsubV2: string;
|
|
987
|
+
MidnightPaybackDirect: string;
|
|
988
|
+
MidnightBorrowFromOrders: string;
|
|
989
|
+
MidnightPaybackFromOrders: string;
|
|
990
|
+
MidnightSupplyCollateral: string;
|
|
991
|
+
MidnightWithdrawCollateral: string;
|
|
992
|
+
MidnightView: string;
|
|
969
993
|
AutomationV2Unsub?: undefined;
|
|
970
994
|
SendTokenAndUnwrap?: undefined;
|
|
971
995
|
SDaiWrap?: undefined;
|
|
@@ -1481,6 +1505,12 @@ declare const actionAddressesAllChains: {
|
|
|
1481
1505
|
GasFeeTakerL2?: undefined;
|
|
1482
1506
|
AaveV3RatioCheck?: undefined;
|
|
1483
1507
|
MorphoBlueView?: undefined;
|
|
1508
|
+
MidnightPaybackDirect?: undefined;
|
|
1509
|
+
MidnightBorrowFromOrders?: undefined;
|
|
1510
|
+
MidnightPaybackFromOrders?: undefined;
|
|
1511
|
+
MidnightSupplyCollateral?: undefined;
|
|
1512
|
+
MidnightWithdrawCollateral?: undefined;
|
|
1513
|
+
MidnightView?: undefined;
|
|
1484
1514
|
} | {
|
|
1485
1515
|
DFSSell: string;
|
|
1486
1516
|
DFSSellNoFee: string;
|
|
@@ -1775,6 +1805,12 @@ declare const actionAddressesAllChains: {
|
|
|
1775
1805
|
GasFeeTakerL2?: undefined;
|
|
1776
1806
|
AaveV3RatioCheck?: undefined;
|
|
1777
1807
|
MorphoBlueView?: undefined;
|
|
1808
|
+
MidnightPaybackDirect?: undefined;
|
|
1809
|
+
MidnightBorrowFromOrders?: undefined;
|
|
1810
|
+
MidnightPaybackFromOrders?: undefined;
|
|
1811
|
+
MidnightSupplyCollateral?: undefined;
|
|
1812
|
+
MidnightWithdrawCollateral?: undefined;
|
|
1813
|
+
MidnightView?: undefined;
|
|
1778
1814
|
};
|
|
1779
1815
|
};
|
|
1780
1816
|
declare const actionAddresses: (chainId?: null) => {
|
|
@@ -2071,6 +2107,12 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
2071
2107
|
GasFeeTakerL2?: undefined;
|
|
2072
2108
|
AaveV3RatioCheck?: undefined;
|
|
2073
2109
|
MorphoBlueView?: undefined;
|
|
2110
|
+
MidnightPaybackDirect?: undefined;
|
|
2111
|
+
MidnightBorrowFromOrders?: undefined;
|
|
2112
|
+
MidnightPaybackFromOrders?: undefined;
|
|
2113
|
+
MidnightSupplyCollateral?: undefined;
|
|
2114
|
+
MidnightWithdrawCollateral?: undefined;
|
|
2115
|
+
MidnightView?: undefined;
|
|
2074
2116
|
} | {
|
|
2075
2117
|
DFSSell: string;
|
|
2076
2118
|
DFSSellNoFee: string;
|
|
@@ -2365,6 +2407,12 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
2365
2407
|
AaveV4DelegateBorrowWithSig?: undefined;
|
|
2366
2408
|
AaveV4DelegateSetUsingAsCollateralWithSig?: undefined;
|
|
2367
2409
|
MorphoBlueView?: undefined;
|
|
2410
|
+
MidnightPaybackDirect?: undefined;
|
|
2411
|
+
MidnightBorrowFromOrders?: undefined;
|
|
2412
|
+
MidnightPaybackFromOrders?: undefined;
|
|
2413
|
+
MidnightSupplyCollateral?: undefined;
|
|
2414
|
+
MidnightWithdrawCollateral?: undefined;
|
|
2415
|
+
MidnightView?: undefined;
|
|
2368
2416
|
} | {
|
|
2369
2417
|
DFSSell: string;
|
|
2370
2418
|
DFSSellNoFee: string;
|
|
@@ -2659,6 +2707,12 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
2659
2707
|
AaveV4DelegateBorrowWithSig?: undefined;
|
|
2660
2708
|
AaveV4DelegateSetUsingAsCollateralWithSig?: undefined;
|
|
2661
2709
|
AaveV3RatioTrigger?: undefined;
|
|
2710
|
+
MidnightPaybackDirect?: undefined;
|
|
2711
|
+
MidnightBorrowFromOrders?: undefined;
|
|
2712
|
+
MidnightPaybackFromOrders?: undefined;
|
|
2713
|
+
MidnightSupplyCollateral?: undefined;
|
|
2714
|
+
MidnightWithdrawCollateral?: undefined;
|
|
2715
|
+
MidnightView?: undefined;
|
|
2662
2716
|
} | {
|
|
2663
2717
|
DFSSell: string;
|
|
2664
2718
|
DFSSellNoFee: string;
|
|
@@ -2732,6 +2786,12 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
2732
2786
|
SFApproveTokens: string;
|
|
2733
2787
|
SummerfiUnsub: string;
|
|
2734
2788
|
SummerfiUnsubV2: string;
|
|
2789
|
+
MidnightPaybackDirect: string;
|
|
2790
|
+
MidnightBorrowFromOrders: string;
|
|
2791
|
+
MidnightPaybackFromOrders: string;
|
|
2792
|
+
MidnightSupplyCollateral: string;
|
|
2793
|
+
MidnightWithdrawCollateral: string;
|
|
2794
|
+
MidnightView: string;
|
|
2735
2795
|
AutomationV2Unsub?: undefined;
|
|
2736
2796
|
SendTokenAndUnwrap?: undefined;
|
|
2737
2797
|
SDaiWrap?: undefined;
|
|
@@ -3247,6 +3307,12 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
3247
3307
|
GasFeeTakerL2?: undefined;
|
|
3248
3308
|
AaveV3RatioCheck?: undefined;
|
|
3249
3309
|
MorphoBlueView?: undefined;
|
|
3310
|
+
MidnightPaybackDirect?: undefined;
|
|
3311
|
+
MidnightBorrowFromOrders?: undefined;
|
|
3312
|
+
MidnightPaybackFromOrders?: undefined;
|
|
3313
|
+
MidnightSupplyCollateral?: undefined;
|
|
3314
|
+
MidnightWithdrawCollateral?: undefined;
|
|
3315
|
+
MidnightView?: undefined;
|
|
3250
3316
|
} | {
|
|
3251
3317
|
DFSSell: string;
|
|
3252
3318
|
DFSSellNoFee: string;
|
|
@@ -3541,6 +3607,12 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
3541
3607
|
GasFeeTakerL2?: undefined;
|
|
3542
3608
|
AaveV3RatioCheck?: undefined;
|
|
3543
3609
|
MorphoBlueView?: undefined;
|
|
3610
|
+
MidnightPaybackDirect?: undefined;
|
|
3611
|
+
MidnightBorrowFromOrders?: undefined;
|
|
3612
|
+
MidnightPaybackFromOrders?: undefined;
|
|
3613
|
+
MidnightSupplyCollateral?: undefined;
|
|
3614
|
+
MidnightWithdrawCollateral?: undefined;
|
|
3615
|
+
MidnightView?: undefined;
|
|
3544
3616
|
};
|
|
3545
3617
|
declare const otherAddressesAllChains: {
|
|
3546
3618
|
[x: number]: {
|
|
@@ -4074,6 +4146,12 @@ declare const _default: {
|
|
|
4074
4146
|
GasFeeTakerL2?: undefined;
|
|
4075
4147
|
AaveV3RatioCheck?: undefined;
|
|
4076
4148
|
MorphoBlueView?: undefined;
|
|
4149
|
+
MidnightPaybackDirect?: undefined;
|
|
4150
|
+
MidnightBorrowFromOrders?: undefined;
|
|
4151
|
+
MidnightPaybackFromOrders?: undefined;
|
|
4152
|
+
MidnightSupplyCollateral?: undefined;
|
|
4153
|
+
MidnightWithdrawCollateral?: undefined;
|
|
4154
|
+
MidnightView?: undefined;
|
|
4077
4155
|
} | {
|
|
4078
4156
|
DFSSell: string;
|
|
4079
4157
|
DFSSellNoFee: string;
|
|
@@ -4368,6 +4446,12 @@ declare const _default: {
|
|
|
4368
4446
|
AaveV4DelegateBorrowWithSig?: undefined;
|
|
4369
4447
|
AaveV4DelegateSetUsingAsCollateralWithSig?: undefined;
|
|
4370
4448
|
MorphoBlueView?: undefined;
|
|
4449
|
+
MidnightPaybackDirect?: undefined;
|
|
4450
|
+
MidnightBorrowFromOrders?: undefined;
|
|
4451
|
+
MidnightPaybackFromOrders?: undefined;
|
|
4452
|
+
MidnightSupplyCollateral?: undefined;
|
|
4453
|
+
MidnightWithdrawCollateral?: undefined;
|
|
4454
|
+
MidnightView?: undefined;
|
|
4371
4455
|
} | {
|
|
4372
4456
|
DFSSell: string;
|
|
4373
4457
|
DFSSellNoFee: string;
|
|
@@ -4662,6 +4746,12 @@ declare const _default: {
|
|
|
4662
4746
|
AaveV4DelegateBorrowWithSig?: undefined;
|
|
4663
4747
|
AaveV4DelegateSetUsingAsCollateralWithSig?: undefined;
|
|
4664
4748
|
AaveV3RatioTrigger?: undefined;
|
|
4749
|
+
MidnightPaybackDirect?: undefined;
|
|
4750
|
+
MidnightBorrowFromOrders?: undefined;
|
|
4751
|
+
MidnightPaybackFromOrders?: undefined;
|
|
4752
|
+
MidnightSupplyCollateral?: undefined;
|
|
4753
|
+
MidnightWithdrawCollateral?: undefined;
|
|
4754
|
+
MidnightView?: undefined;
|
|
4665
4755
|
} | {
|
|
4666
4756
|
DFSSell: string;
|
|
4667
4757
|
DFSSellNoFee: string;
|
|
@@ -4735,6 +4825,12 @@ declare const _default: {
|
|
|
4735
4825
|
SFApproveTokens: string;
|
|
4736
4826
|
SummerfiUnsub: string;
|
|
4737
4827
|
SummerfiUnsubV2: string;
|
|
4828
|
+
MidnightPaybackDirect: string;
|
|
4829
|
+
MidnightBorrowFromOrders: string;
|
|
4830
|
+
MidnightPaybackFromOrders: string;
|
|
4831
|
+
MidnightSupplyCollateral: string;
|
|
4832
|
+
MidnightWithdrawCollateral: string;
|
|
4833
|
+
MidnightView: string;
|
|
4738
4834
|
AutomationV2Unsub?: undefined;
|
|
4739
4835
|
SendTokenAndUnwrap?: undefined;
|
|
4740
4836
|
SDaiWrap?: undefined;
|
|
@@ -5250,6 +5346,12 @@ declare const _default: {
|
|
|
5250
5346
|
GasFeeTakerL2?: undefined;
|
|
5251
5347
|
AaveV3RatioCheck?: undefined;
|
|
5252
5348
|
MorphoBlueView?: undefined;
|
|
5349
|
+
MidnightPaybackDirect?: undefined;
|
|
5350
|
+
MidnightBorrowFromOrders?: undefined;
|
|
5351
|
+
MidnightPaybackFromOrders?: undefined;
|
|
5352
|
+
MidnightSupplyCollateral?: undefined;
|
|
5353
|
+
MidnightWithdrawCollateral?: undefined;
|
|
5354
|
+
MidnightView?: undefined;
|
|
5253
5355
|
} | {
|
|
5254
5356
|
DFSSell: string;
|
|
5255
5357
|
DFSSellNoFee: string;
|
|
@@ -5544,6 +5646,12 @@ declare const _default: {
|
|
|
5544
5646
|
GasFeeTakerL2?: undefined;
|
|
5545
5647
|
AaveV3RatioCheck?: undefined;
|
|
5546
5648
|
MorphoBlueView?: undefined;
|
|
5649
|
+
MidnightPaybackDirect?: undefined;
|
|
5650
|
+
MidnightBorrowFromOrders?: undefined;
|
|
5651
|
+
MidnightPaybackFromOrders?: undefined;
|
|
5652
|
+
MidnightSupplyCollateral?: undefined;
|
|
5653
|
+
MidnightWithdrawCollateral?: undefined;
|
|
5654
|
+
MidnightView?: undefined;
|
|
5547
5655
|
};
|
|
5548
5656
|
actionAddressesAllChains: {
|
|
5549
5657
|
[x: number]: {
|
|
@@ -5840,6 +5948,12 @@ declare const _default: {
|
|
|
5840
5948
|
GasFeeTakerL2?: undefined;
|
|
5841
5949
|
AaveV3RatioCheck?: undefined;
|
|
5842
5950
|
MorphoBlueView?: undefined;
|
|
5951
|
+
MidnightPaybackDirect?: undefined;
|
|
5952
|
+
MidnightBorrowFromOrders?: undefined;
|
|
5953
|
+
MidnightPaybackFromOrders?: undefined;
|
|
5954
|
+
MidnightSupplyCollateral?: undefined;
|
|
5955
|
+
MidnightWithdrawCollateral?: undefined;
|
|
5956
|
+
MidnightView?: undefined;
|
|
5843
5957
|
} | {
|
|
5844
5958
|
DFSSell: string;
|
|
5845
5959
|
DFSSellNoFee: string;
|
|
@@ -6134,6 +6248,12 @@ declare const _default: {
|
|
|
6134
6248
|
AaveV4DelegateBorrowWithSig?: undefined;
|
|
6135
6249
|
AaveV4DelegateSetUsingAsCollateralWithSig?: undefined;
|
|
6136
6250
|
MorphoBlueView?: undefined;
|
|
6251
|
+
MidnightPaybackDirect?: undefined;
|
|
6252
|
+
MidnightBorrowFromOrders?: undefined;
|
|
6253
|
+
MidnightPaybackFromOrders?: undefined;
|
|
6254
|
+
MidnightSupplyCollateral?: undefined;
|
|
6255
|
+
MidnightWithdrawCollateral?: undefined;
|
|
6256
|
+
MidnightView?: undefined;
|
|
6137
6257
|
} | {
|
|
6138
6258
|
DFSSell: string;
|
|
6139
6259
|
DFSSellNoFee: string;
|
|
@@ -6428,6 +6548,12 @@ declare const _default: {
|
|
|
6428
6548
|
AaveV4DelegateBorrowWithSig?: undefined;
|
|
6429
6549
|
AaveV4DelegateSetUsingAsCollateralWithSig?: undefined;
|
|
6430
6550
|
AaveV3RatioTrigger?: undefined;
|
|
6551
|
+
MidnightPaybackDirect?: undefined;
|
|
6552
|
+
MidnightBorrowFromOrders?: undefined;
|
|
6553
|
+
MidnightPaybackFromOrders?: undefined;
|
|
6554
|
+
MidnightSupplyCollateral?: undefined;
|
|
6555
|
+
MidnightWithdrawCollateral?: undefined;
|
|
6556
|
+
MidnightView?: undefined;
|
|
6431
6557
|
} | {
|
|
6432
6558
|
DFSSell: string;
|
|
6433
6559
|
DFSSellNoFee: string;
|
|
@@ -6501,6 +6627,12 @@ declare const _default: {
|
|
|
6501
6627
|
SFApproveTokens: string;
|
|
6502
6628
|
SummerfiUnsub: string;
|
|
6503
6629
|
SummerfiUnsubV2: string;
|
|
6630
|
+
MidnightPaybackDirect: string;
|
|
6631
|
+
MidnightBorrowFromOrders: string;
|
|
6632
|
+
MidnightPaybackFromOrders: string;
|
|
6633
|
+
MidnightSupplyCollateral: string;
|
|
6634
|
+
MidnightWithdrawCollateral: string;
|
|
6635
|
+
MidnightView: string;
|
|
6504
6636
|
AutomationV2Unsub?: undefined;
|
|
6505
6637
|
SendTokenAndUnwrap?: undefined;
|
|
6506
6638
|
SDaiWrap?: undefined;
|
|
@@ -7016,6 +7148,12 @@ declare const _default: {
|
|
|
7016
7148
|
GasFeeTakerL2?: undefined;
|
|
7017
7149
|
AaveV3RatioCheck?: undefined;
|
|
7018
7150
|
MorphoBlueView?: undefined;
|
|
7151
|
+
MidnightPaybackDirect?: undefined;
|
|
7152
|
+
MidnightBorrowFromOrders?: undefined;
|
|
7153
|
+
MidnightPaybackFromOrders?: undefined;
|
|
7154
|
+
MidnightSupplyCollateral?: undefined;
|
|
7155
|
+
MidnightWithdrawCollateral?: undefined;
|
|
7156
|
+
MidnightView?: undefined;
|
|
7019
7157
|
} | {
|
|
7020
7158
|
DFSSell: string;
|
|
7021
7159
|
DFSSellNoFee: string;
|
|
@@ -7310,6 +7448,12 @@ declare const _default: {
|
|
|
7310
7448
|
GasFeeTakerL2?: undefined;
|
|
7311
7449
|
AaveV3RatioCheck?: undefined;
|
|
7312
7450
|
MorphoBlueView?: undefined;
|
|
7451
|
+
MidnightPaybackDirect?: undefined;
|
|
7452
|
+
MidnightBorrowFromOrders?: undefined;
|
|
7453
|
+
MidnightPaybackFromOrders?: undefined;
|
|
7454
|
+
MidnightSupplyCollateral?: undefined;
|
|
7455
|
+
MidnightWithdrawCollateral?: undefined;
|
|
7456
|
+
MidnightView?: undefined;
|
|
7313
7457
|
};
|
|
7314
7458
|
};
|
|
7315
7459
|
otherAddresses: (chainId?: null) => {
|
package/package.json
CHANGED
package/src/Action.ts
CHANGED
|
@@ -101,14 +101,30 @@ export class Action {
|
|
|
101
101
|
|
|
102
102
|
_parseParamType(paramType:string | ParamTypes, arg:Args) {
|
|
103
103
|
if (typeof (paramType) === 'string') {
|
|
104
|
-
if (paramType.startsWith('(')) {
|
|
105
|
-
let _paramType = paramType.replace('(', '');
|
|
106
|
-
_paramType = _paramType.replace(')', '');
|
|
107
|
-
return _paramType.split(',');
|
|
108
|
-
}
|
|
109
104
|
if (paramType.endsWith('[]')) {
|
|
110
105
|
return Array.from(Array(arg.length).fill(paramType.replace('[]', '')));
|
|
111
106
|
}
|
|
107
|
+
if (paramType.startsWith('(') || paramType.startsWith('tuple(')) {
|
|
108
|
+
const tupleStart = paramType.indexOf('(');
|
|
109
|
+
const tupleEnd = paramType.lastIndexOf(')');
|
|
110
|
+
const tupleContents = paramType.slice(tupleStart + 1, tupleEnd);
|
|
111
|
+
const tupleTypes = [];
|
|
112
|
+
let currentType = '';
|
|
113
|
+
let nestingDepth = 0;
|
|
114
|
+
|
|
115
|
+
for (const character of tupleContents) {
|
|
116
|
+
if (character === ',' && nestingDepth === 0) {
|
|
117
|
+
tupleTypes.push(currentType);
|
|
118
|
+
currentType = '';
|
|
119
|
+
} else {
|
|
120
|
+
currentType += character;
|
|
121
|
+
if (character === '(') nestingDepth += 1;
|
|
122
|
+
if (character === ')') nestingDepth -= 1;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
tupleTypes.push(currentType);
|
|
126
|
+
return tupleTypes;
|
|
127
|
+
}
|
|
112
128
|
}
|
|
113
129
|
return paramType;
|
|
114
130
|
}
|
package/src/actions/index.ts
CHANGED
|
@@ -40,6 +40,7 @@ import * as fluid from './fluid';
|
|
|
40
40
|
import * as pendle from './pendle';
|
|
41
41
|
import * as umbrella from './umbrella';
|
|
42
42
|
import * as aaveV4 from './aavev4';
|
|
43
|
+
import * as midnight from './midnight';
|
|
43
44
|
|
|
44
45
|
export {
|
|
45
46
|
aave,
|
|
@@ -84,4 +85,5 @@ export {
|
|
|
84
85
|
pendle,
|
|
85
86
|
umbrella,
|
|
86
87
|
aaveV4,
|
|
88
|
+
midnight,
|
|
87
89
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
const offerFillsParamType = 'tuple(tuple(tuple(uint256,address,address,tuple(address,uint256,uint256,address)[],uint256,uint256,address,address),bool,address,uint256,uint256,uint256,bytes32,address,bytes,address,address,bool,uint128,uint128,uint256),bytes,uint256)[]';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* MidnightBorrowFromOrdersAction - Borrow from one or more Midnight offers.
|
|
9
|
+
*
|
|
10
|
+
* @category MidnightBorrowFromOrders
|
|
11
|
+
*/
|
|
12
|
+
export class MidnightBorrowFromOrdersAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param marketId Market id.
|
|
15
|
+
* @param onBehalf Address to borrow tokens on behalf of. Defaults to the user's wallet if not provided.
|
|
16
|
+
* @param to Address to send the borrowed tokens to.
|
|
17
|
+
* @param amount Amount of tokens to borrow.
|
|
18
|
+
* @param maxUnits Maximum number of units to take from the orders (slippage protection).
|
|
19
|
+
* @param offerFills Array of offer fills to borrow from.
|
|
20
|
+
*/
|
|
21
|
+
constructor(
|
|
22
|
+
marketId: bytes32,
|
|
23
|
+
onBehalf: EthAddress,
|
|
24
|
+
to: EthAddress,
|
|
25
|
+
amount: uint256,
|
|
26
|
+
maxUnits: uint256,
|
|
27
|
+
offerFills: Array<any>,
|
|
28
|
+
) {
|
|
29
|
+
super(
|
|
30
|
+
'MidnightBorrowFromOrders',
|
|
31
|
+
getAddr('MidnightBorrowFromOrders'),
|
|
32
|
+
['bytes32', 'address', 'address', 'uint256', 'uint256', offerFillsParamType],
|
|
33
|
+
[marketId, onBehalf, to, amount, maxUnits, offerFills],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
this.mappableArgs = [
|
|
37
|
+
this.args[0],
|
|
38
|
+
this.args[1],
|
|
39
|
+
this.args[2],
|
|
40
|
+
this.args[3],
|
|
41
|
+
this.args[4],
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MidnightPaybackDirectAction - Payback a debt directly to the Midnight protocol.
|
|
7
|
+
*
|
|
8
|
+
* @category MidnightPaybackDirect
|
|
9
|
+
*/
|
|
10
|
+
export class MidnightPaybackDirectAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param marketId Market id.
|
|
13
|
+
* @param onBehalf Address to payback tokens on behalf of.
|
|
14
|
+
* @param from Address from which to pull the payback tokens.
|
|
15
|
+
* @param amount Amount of tokens to payback. Send type(uint).max to payback whole amount.
|
|
16
|
+
*/
|
|
17
|
+
constructor(
|
|
18
|
+
marketId: bytes32,
|
|
19
|
+
onBehalf: EthAddress,
|
|
20
|
+
from: EthAddress,
|
|
21
|
+
amount: uint256,
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
'MidnightPaybackDirect',
|
|
25
|
+
getAddr('MidnightPaybackDirect'),
|
|
26
|
+
['bytes32', 'address', 'address', 'uint256'],
|
|
27
|
+
[marketId, onBehalf, from, amount],
|
|
28
|
+
);
|
|
29
|
+
this.mappableArgs = [
|
|
30
|
+
this.args[0],
|
|
31
|
+
this.args[1],
|
|
32
|
+
this.args[2],
|
|
33
|
+
this.args[3],
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
const offerFillsParamType = 'tuple(tuple(tuple(uint256,address,address,tuple(address,uint256,uint256,address)[],uint256,uint256,address,address),bool,address,uint256,uint256,uint256,bytes32,address,bytes,address,address,bool,uint128,uint128,uint256),bytes,uint256)[]';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* MidnightPaybackFromOrdersAction - Pay back debt through one or more Midnight offers.
|
|
9
|
+
*
|
|
10
|
+
* @category MidnightPaybackFromOrders
|
|
11
|
+
*/
|
|
12
|
+
export class MidnightPaybackFromOrdersAction extends Action {
|
|
13
|
+
/**
|
|
14
|
+
* @param marketId Market id.
|
|
15
|
+
* @param onBehalf Address whose debt is repaid. Defaults to the user's wallet if not provided.
|
|
16
|
+
* @param from Address from which to pull the payback tokens.
|
|
17
|
+
* @param amount Amount of tokens to spend. Send type(uint).max to pay back the whole debt.
|
|
18
|
+
* @param minUnits Minimum number of debt units to repay (slippage protection).
|
|
19
|
+
* @param offerFills Array of offer fills to pay back from.
|
|
20
|
+
*/
|
|
21
|
+
constructor(
|
|
22
|
+
marketId: bytes32,
|
|
23
|
+
onBehalf: EthAddress,
|
|
24
|
+
from: EthAddress,
|
|
25
|
+
amount: uint256,
|
|
26
|
+
minUnits: uint256,
|
|
27
|
+
offerFills: Array<any>,
|
|
28
|
+
) {
|
|
29
|
+
super(
|
|
30
|
+
'MidnightPaybackFromOrders',
|
|
31
|
+
getAddr('MidnightPaybackFromOrders'),
|
|
32
|
+
['bytes32', 'address', 'address', 'uint256', 'uint256', offerFillsParamType],
|
|
33
|
+
[marketId, onBehalf, from, amount, minUnits, offerFills],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
this.mappableArgs = [
|
|
37
|
+
this.args[0],
|
|
38
|
+
this.args[1],
|
|
39
|
+
this.args[2],
|
|
40
|
+
this.args[3],
|
|
41
|
+
this.args[4],
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MidnightSupplyCollateralAction
|
|
7
|
+
*
|
|
8
|
+
* @category MidnightSupplyCollateral
|
|
9
|
+
*/
|
|
10
|
+
export class MidnightSupplyCollateralAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param marketId Market id.
|
|
13
|
+
* @param onBehalf Address to supply tokens on behalf of.
|
|
14
|
+
* @param from Address from which to pull collateral asset.
|
|
15
|
+
* @param amount Amount of tokens to supply.
|
|
16
|
+
* @param collateralIndex Collateral index (0-based).
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
marketId: bytes32,
|
|
20
|
+
onBehalf: EthAddress,
|
|
21
|
+
from: EthAddress,
|
|
22
|
+
amount: uint256,
|
|
23
|
+
collateralIndex: uint256,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'MidnightSupplyCollateral',
|
|
27
|
+
getAddr('MidnightSupplyCollateral'),
|
|
28
|
+
['bytes32', 'address', 'address', 'uint256', 'uint256'],
|
|
29
|
+
[marketId, onBehalf, from, amount, collateralIndex],
|
|
30
|
+
);
|
|
31
|
+
this.mappableArgs = [
|
|
32
|
+
this.args[0],
|
|
33
|
+
this.args[1],
|
|
34
|
+
this.args[2],
|
|
35
|
+
this.args[3],
|
|
36
|
+
this.args[4],
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MidnightWithdrawCollateralAction
|
|
7
|
+
*
|
|
8
|
+
* @category MidnightWithdrawCollateral
|
|
9
|
+
*/
|
|
10
|
+
export class MidnightWithdrawCollateralAction extends Action {
|
|
11
|
+
/**
|
|
12
|
+
* @param marketId Market id.
|
|
13
|
+
* @param onBehalf Address to withdraw tokens on behalf of.
|
|
14
|
+
* @param to Address that will receive the withdrawn tokens.
|
|
15
|
+
* @param amount Amount of tokens to withdraw. Send type(uint).max to withdraw whole amount.
|
|
16
|
+
* @param collateralIndex Collateral index (0-based).
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
marketId: bytes32,
|
|
20
|
+
onBehalf: EthAddress,
|
|
21
|
+
to: EthAddress,
|
|
22
|
+
amount: uint256,
|
|
23
|
+
collateralIndex: uint256,
|
|
24
|
+
) {
|
|
25
|
+
super(
|
|
26
|
+
'MidnightWithdrawCollateral',
|
|
27
|
+
getAddr('MidnightWithdrawCollateral'),
|
|
28
|
+
['bytes32', 'address', 'address', 'uint256', 'uint256'],
|
|
29
|
+
[marketId, onBehalf, to, amount, collateralIndex],
|
|
30
|
+
);
|
|
31
|
+
this.mappableArgs = [
|
|
32
|
+
this.args[0],
|
|
33
|
+
this.args[1],
|
|
34
|
+
this.args[2],
|
|
35
|
+
this.args[3],
|
|
36
|
+
this.args[4],
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/addresses.ts
CHANGED
|
@@ -208,8 +208,8 @@ export const actionAddresses = {
|
|
|
208
208
|
LiquityV2Adjust: '0x3BbC88f3b75cB898395C9b5AE8D9c2a26744993b',
|
|
209
209
|
LiquityV2AdjustInterestRate:
|
|
210
210
|
'0x685f0237D8b85B2018278E975a481b0650dE0b54',
|
|
211
|
-
LiquityV2SPDeposit: '
|
|
212
|
-
LiquityV2SPWithdraw: '
|
|
211
|
+
LiquityV2SPDeposit: '0x256e97E7f7B42Cf7De5258C59A2935AdEdDdfC63',
|
|
212
|
+
LiquityV2SPWithdraw: '0x7ab4A43DE2628EA53c88E27755325d090f28D9c9',
|
|
213
213
|
LiquityV2SPClaimColl: '0x3f783de20C3095bcB999AEA999aF4DF184b6630f',
|
|
214
214
|
LiquityV2AdjustZombieTrove:
|
|
215
215
|
'0x45F5CEe8f89AdBCe4f5B20f38a49402b152ba99e',
|
|
@@ -685,6 +685,13 @@ export const actionAddresses = {
|
|
|
685
685
|
SFApproveTokens: '0x03EDC9A683f37BFB7516FF234223fFb6E38D5eb9',
|
|
686
686
|
SummerfiUnsub: '0x0000000000000000000000000000000000000000', // Only exists for Maker on Mainnet
|
|
687
687
|
SummerfiUnsubV2: '0x60587B8Fe62Fc149d285a611822263206b4138da',
|
|
688
|
+
|
|
689
|
+
MidnightPaybackDirect: '0xC1B049A038f9E9811dc1Ad1D335369844d4268D9',
|
|
690
|
+
MidnightBorrowFromOrders: '0x82F9dd7eA821463178A2c7bC4047057Bd338E5e5',
|
|
691
|
+
MidnightPaybackFromOrders: '0x4B0c242195B1C941A2e7a871Bfa242c40dbf032F',
|
|
692
|
+
MidnightSupplyCollateral: '0xC83C7Ca37203FC30636EDcd3Ef127194542504c5',
|
|
693
|
+
MidnightWithdrawCollateral: '0x4fA4DA5fDD813279409B4Bf0Bde5Fe9ca8006A9C',
|
|
694
|
+
MidnightView: '0x3aa272f329E8B562A3bA56Bb6979a44D23A28839',
|
|
688
695
|
},
|
|
689
696
|
[NETWORKS.linea.chainId]: {
|
|
690
697
|
// Basic
|