flash-sdk 1.0.80 → 1.0.81
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/CustodyAccount.js +1 -1
- package/dist/OraclePrice.d.ts +5 -1
- package/dist/OraclePrice.js +14 -1
- package/dist/PerpetualsClient.d.ts +56 -224
- package/dist/PerpetualsClient.js +96 -9
- package/dist/PoolAccount.js +4 -2
- package/dist/PoolConfig.json +100 -0
- package/dist/idl/perpetuals.d.ts +2 -18
- package/dist/idl/perpetuals.js +2 -18
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +61 -191
- package/dist/types/index.js +30 -20
- package/package.json +1 -1
package/dist/CustodyAccount.js
CHANGED
@@ -67,7 +67,7 @@ var CustodyAccount = (function () {
|
|
67
67
|
}
|
68
68
|
;
|
69
69
|
if (stats.openPositions.gt(constants_1.BN_ZERO)) {
|
70
|
-
var obj = __assign({ side: side, price: stats.
|
70
|
+
var obj = __assign({ side: side, price: stats.averagePrice.div(stats.totalQuantity), sizeUsd: stats.sizeUsd, collateralUsd: stats.collateralUsd, unrealizedLossUsd: stats.cumulativeInterestUsd, cumulativeInterestSnapshot: stats.cumulativeInterestSnapshot, lockedAmount: stats.lockedAmount }, types_1.DEFAULT_POSITION);
|
71
71
|
return new PositionAccount_1.PositionAccount(web3_js_1.PublicKey.default, obj);
|
72
72
|
}
|
73
73
|
else {
|
package/dist/OraclePrice.d.ts
CHANGED
@@ -4,17 +4,21 @@ export declare class OraclePrice {
|
|
4
4
|
price: BN;
|
5
5
|
exponent: BN;
|
6
6
|
confidence: BN;
|
7
|
+
timestamp: BN;
|
7
8
|
constructor(parseData: {
|
8
9
|
price: BN;
|
9
10
|
exponent: BN;
|
10
|
-
confidence
|
11
|
+
confidence: BN;
|
12
|
+
timestamp?: BN;
|
11
13
|
});
|
12
14
|
static from(parseData: {
|
13
15
|
price: BN;
|
14
16
|
exponent: BN;
|
15
17
|
confidence: BN;
|
18
|
+
timestamp: BN;
|
16
19
|
}): OraclePrice;
|
17
20
|
cmp(other: OraclePrice): -1 | 0 | 1;
|
21
|
+
getDeviationFactor(other: OraclePrice): BN;
|
18
22
|
scale_to_exponent(target_exponent: BN): OraclePrice;
|
19
23
|
getTokenAmount(asset_amount_usd: BN, token_decimals: number): BN;
|
20
24
|
getAssetAmountUsd(token_amount: BN, token_decimals: number): BN;
|
package/dist/OraclePrice.js
CHANGED
@@ -30,6 +30,17 @@ var OraclePrice = (function () {
|
|
30
30
|
;
|
31
31
|
return lhs.cmp(rhs);
|
32
32
|
};
|
33
|
+
OraclePrice.prototype.getDeviationFactor = function (other) {
|
34
|
+
if (!this.exponent.eq(other.exponent)) {
|
35
|
+
throw "Exponents mistmatch";
|
36
|
+
}
|
37
|
+
if (this.price.cmp(other.price) == 1) {
|
38
|
+
return ((this.price.sub(other.price)).muln(constants_1.BPS_POWER).div(this.price));
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
return ((other.price.sub(this.price)).muln(constants_1.BPS_POWER).div(this.price));
|
42
|
+
}
|
43
|
+
};
|
33
44
|
OraclePrice.prototype.scale_to_exponent = function (target_exponent) {
|
34
45
|
if (!target_exponent.isNeg()) {
|
35
46
|
throw new Error("Target exponent must be negative");
|
@@ -41,12 +52,14 @@ var OraclePrice = (function () {
|
|
41
52
|
if (delta.gt(constants_1.BN_ZERO)) {
|
42
53
|
return new OraclePrice({
|
43
54
|
price: this.price.div(new anchor_1.BN(10).pow(delta)),
|
55
|
+
confidence: this.confidence.div(new anchor_1.BN(10).pow(delta)),
|
44
56
|
exponent: target_exponent
|
45
57
|
});
|
46
58
|
}
|
47
59
|
else {
|
48
60
|
return new OraclePrice({
|
49
|
-
price: this.price.mul(new anchor_1.BN(10).pow(delta.
|
61
|
+
price: this.price.mul(new anchor_1.BN(10).pow(delta.neg())),
|
62
|
+
confidence: this.confidence.mul(new anchor_1.BN(10).pow(delta.neg())),
|
50
63
|
exponent: target_exponent
|
51
64
|
});
|
52
65
|
}
|
@@ -4,7 +4,7 @@ import { Program, AnchorProvider, BN } from "@coral-xyz/anchor";
|
|
4
4
|
import { PublicKey, TransactionInstruction, Commitment, Signer, AddressLookupTableAccount } from "@solana/web3.js";
|
5
5
|
import { PoolAccount } from "./PoolAccount";
|
6
6
|
import { PositionAccount } from "./PositionAccount";
|
7
|
-
import { AddLiquidityAmountAndFee, AumCalcMode, BorrowRateParams, EntryPriceAndFee, ExitPriceAndFee, Fees, OracleParams, Permissions, PositionSide, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, SwapAmountAndFees, TokenRatios } from "./types";
|
7
|
+
import { AddLiquidityAmountAndFee, AumCalcMode, BorrowRateParams, EntryPriceAndFee, ExitPriceAndFee, Fees, OracleParams, Permissions, PositionSide, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, SwapAmountAndFees, TokenRatios, MinAndMaxPrice } from "./types";
|
8
8
|
import { OraclePrice } from "./OraclePrice";
|
9
9
|
import { CustodyAccount } from "./CustodyAccount";
|
10
10
|
import { Perpetuals } from "./idl/perpetuals";
|
@@ -48,7 +48,11 @@ export declare class PerpetualsClient {
|
|
48
48
|
publicKey: PublicKey;
|
49
49
|
bump: number;
|
50
50
|
};
|
51
|
-
adjustTokenRatios: (ratios: TokenRatios[]) =>
|
51
|
+
adjustTokenRatios: (ratios: TokenRatios[]) => {
|
52
|
+
target: BN;
|
53
|
+
min: BN;
|
54
|
+
max: BN;
|
55
|
+
}[];
|
52
56
|
getPerpetuals: () => Promise<{
|
53
57
|
pool: PublicKey;
|
54
58
|
mint: PublicKey;
|
@@ -103,39 +107,23 @@ export declare class PerpetualsClient {
|
|
103
107
|
ratioMult: BN;
|
104
108
|
utilizationMult: BN;
|
105
109
|
swapIn: {
|
106
|
-
baseRate: BN;
|
107
|
-
slope1: BN;
|
108
|
-
constant1: BN;
|
109
|
-
slope2: BN;
|
110
|
-
constant2: BN;
|
111
110
|
minFee: BN;
|
111
|
+
targetFee: BN;
|
112
112
|
maxFee: BN;
|
113
113
|
};
|
114
114
|
swapOut: {
|
115
|
-
baseRate: BN;
|
116
|
-
slope1: BN;
|
117
|
-
constant1: BN;
|
118
|
-
slope2: BN;
|
119
|
-
constant2: BN;
|
120
115
|
minFee: BN;
|
116
|
+
targetFee: BN;
|
121
117
|
maxFee: BN;
|
122
118
|
};
|
123
119
|
addLiquidity: {
|
124
|
-
baseRate: BN;
|
125
|
-
slope1: BN;
|
126
|
-
constant1: BN;
|
127
|
-
slope2: BN;
|
128
|
-
constant2: BN;
|
129
120
|
minFee: BN;
|
121
|
+
targetFee: BN;
|
130
122
|
maxFee: BN;
|
131
123
|
};
|
132
124
|
removeLiquidity: {
|
133
|
-
baseRate: BN;
|
134
|
-
slope1: BN;
|
135
|
-
constant1: BN;
|
136
|
-
slope2: BN;
|
137
|
-
constant2: BN;
|
138
125
|
minFee: BN;
|
126
|
+
targetFee: BN;
|
139
127
|
maxFee: BN;
|
140
128
|
};
|
141
129
|
openPosition: BN;
|
@@ -311,39 +299,23 @@ export declare class PerpetualsClient {
|
|
311
299
|
ratioMult: BN;
|
312
300
|
utilizationMult: BN;
|
313
301
|
swapIn: {
|
314
|
-
baseRate: BN;
|
315
|
-
slope1: BN;
|
316
|
-
constant1: BN;
|
317
|
-
slope2: BN;
|
318
|
-
constant2: BN;
|
319
302
|
minFee: BN;
|
303
|
+
targetFee: BN;
|
320
304
|
maxFee: BN;
|
321
305
|
};
|
322
306
|
swapOut: {
|
323
|
-
baseRate: BN;
|
324
|
-
slope1: BN;
|
325
|
-
constant1: BN;
|
326
|
-
slope2: BN;
|
327
|
-
constant2: BN;
|
328
307
|
minFee: BN;
|
308
|
+
targetFee: BN;
|
329
309
|
maxFee: BN;
|
330
310
|
};
|
331
311
|
addLiquidity: {
|
332
|
-
baseRate: BN;
|
333
|
-
slope1: BN;
|
334
|
-
constant1: BN;
|
335
|
-
slope2: BN;
|
336
|
-
constant2: BN;
|
337
312
|
minFee: BN;
|
313
|
+
targetFee: BN;
|
338
314
|
maxFee: BN;
|
339
315
|
};
|
340
316
|
removeLiquidity: {
|
341
|
-
baseRate: BN;
|
342
|
-
slope1: BN;
|
343
|
-
constant1: BN;
|
344
|
-
slope2: BN;
|
345
|
-
constant2: BN;
|
346
317
|
minFee: BN;
|
318
|
+
targetFee: BN;
|
347
319
|
maxFee: BN;
|
348
320
|
};
|
349
321
|
openPosition: BN;
|
@@ -518,39 +490,23 @@ export declare class PerpetualsClient {
|
|
518
490
|
ratioMult: BN;
|
519
491
|
utilizationMult: BN;
|
520
492
|
swapIn: {
|
521
|
-
baseRate: BN;
|
522
|
-
slope1: BN;
|
523
|
-
constant1: BN;
|
524
|
-
slope2: BN;
|
525
|
-
constant2: BN;
|
526
493
|
minFee: BN;
|
494
|
+
targetFee: BN;
|
527
495
|
maxFee: BN;
|
528
496
|
};
|
529
497
|
swapOut: {
|
530
|
-
baseRate: BN;
|
531
|
-
slope1: BN;
|
532
|
-
constant1: BN;
|
533
|
-
slope2: BN;
|
534
|
-
constant2: BN;
|
535
498
|
minFee: BN;
|
499
|
+
targetFee: BN;
|
536
500
|
maxFee: BN;
|
537
501
|
};
|
538
502
|
addLiquidity: {
|
539
|
-
baseRate: BN;
|
540
|
-
slope1: BN;
|
541
|
-
constant1: BN;
|
542
|
-
slope2: BN;
|
543
|
-
constant2: BN;
|
544
503
|
minFee: BN;
|
504
|
+
targetFee: BN;
|
545
505
|
maxFee: BN;
|
546
506
|
};
|
547
507
|
removeLiquidity: {
|
548
|
-
baseRate: BN;
|
549
|
-
slope1: BN;
|
550
|
-
constant1: BN;
|
551
|
-
slope2: BN;
|
552
|
-
constant2: BN;
|
553
508
|
minFee: BN;
|
509
|
+
targetFee: BN;
|
554
510
|
maxFee: BN;
|
555
511
|
};
|
556
512
|
openPosition: BN;
|
@@ -730,39 +686,23 @@ export declare class PerpetualsClient {
|
|
730
686
|
ratioMult: BN;
|
731
687
|
utilizationMult: BN;
|
732
688
|
swapIn: {
|
733
|
-
baseRate: BN;
|
734
|
-
slope1: BN;
|
735
|
-
constant1: BN;
|
736
|
-
slope2: BN;
|
737
|
-
constant2: BN;
|
738
689
|
minFee: BN;
|
690
|
+
targetFee: BN;
|
739
691
|
maxFee: BN;
|
740
692
|
};
|
741
693
|
swapOut: {
|
742
|
-
baseRate: BN;
|
743
|
-
slope1: BN;
|
744
|
-
constant1: BN;
|
745
|
-
slope2: BN;
|
746
|
-
constant2: BN;
|
747
694
|
minFee: BN;
|
695
|
+
targetFee: BN;
|
748
696
|
maxFee: BN;
|
749
697
|
};
|
750
698
|
addLiquidity: {
|
751
|
-
baseRate: BN;
|
752
|
-
slope1: BN;
|
753
|
-
constant1: BN;
|
754
|
-
slope2: BN;
|
755
|
-
constant2: BN;
|
756
699
|
minFee: BN;
|
700
|
+
targetFee: BN;
|
757
701
|
maxFee: BN;
|
758
702
|
};
|
759
703
|
removeLiquidity: {
|
760
|
-
baseRate: BN;
|
761
|
-
slope1: BN;
|
762
|
-
constant1: BN;
|
763
|
-
slope2: BN;
|
764
|
-
constant2: BN;
|
765
704
|
minFee: BN;
|
705
|
+
targetFee: BN;
|
766
706
|
maxFee: BN;
|
767
707
|
};
|
768
708
|
openPosition: BN;
|
@@ -937,39 +877,23 @@ export declare class PerpetualsClient {
|
|
937
877
|
ratioMult: BN;
|
938
878
|
utilizationMult: BN;
|
939
879
|
swapIn: {
|
940
|
-
baseRate: BN;
|
941
|
-
slope1: BN;
|
942
|
-
constant1: BN;
|
943
|
-
slope2: BN;
|
944
|
-
constant2: BN;
|
945
880
|
minFee: BN;
|
881
|
+
targetFee: BN;
|
946
882
|
maxFee: BN;
|
947
883
|
};
|
948
884
|
swapOut: {
|
949
|
-
baseRate: BN;
|
950
|
-
slope1: BN;
|
951
|
-
constant1: BN;
|
952
|
-
slope2: BN;
|
953
|
-
constant2: BN;
|
954
885
|
minFee: BN;
|
886
|
+
targetFee: BN;
|
955
887
|
maxFee: BN;
|
956
888
|
};
|
957
889
|
addLiquidity: {
|
958
|
-
baseRate: BN;
|
959
|
-
slope1: BN;
|
960
|
-
constant1: BN;
|
961
|
-
slope2: BN;
|
962
|
-
constant2: BN;
|
963
890
|
minFee: BN;
|
891
|
+
targetFee: BN;
|
964
892
|
maxFee: BN;
|
965
893
|
};
|
966
894
|
removeLiquidity: {
|
967
|
-
baseRate: BN;
|
968
|
-
slope1: BN;
|
969
|
-
constant1: BN;
|
970
|
-
slope2: BN;
|
971
|
-
constant2: BN;
|
972
895
|
minFee: BN;
|
896
|
+
targetFee: BN;
|
973
897
|
maxFee: BN;
|
974
898
|
};
|
975
899
|
openPosition: BN;
|
@@ -1145,39 +1069,23 @@ export declare class PerpetualsClient {
|
|
1145
1069
|
ratioMult: BN;
|
1146
1070
|
utilizationMult: BN;
|
1147
1071
|
swapIn: {
|
1148
|
-
baseRate: BN;
|
1149
|
-
slope1: BN;
|
1150
|
-
constant1: BN;
|
1151
|
-
slope2: BN;
|
1152
|
-
constant2: BN;
|
1153
1072
|
minFee: BN;
|
1073
|
+
targetFee: BN;
|
1154
1074
|
maxFee: BN;
|
1155
1075
|
};
|
1156
1076
|
swapOut: {
|
1157
|
-
baseRate: BN;
|
1158
|
-
slope1: BN;
|
1159
|
-
constant1: BN;
|
1160
|
-
slope2: BN;
|
1161
|
-
constant2: BN;
|
1162
1077
|
minFee: BN;
|
1078
|
+
targetFee: BN;
|
1163
1079
|
maxFee: BN;
|
1164
1080
|
};
|
1165
1081
|
addLiquidity: {
|
1166
|
-
baseRate: BN;
|
1167
|
-
slope1: BN;
|
1168
|
-
constant1: BN;
|
1169
|
-
slope2: BN;
|
1170
|
-
constant2: BN;
|
1171
1082
|
minFee: BN;
|
1083
|
+
targetFee: BN;
|
1172
1084
|
maxFee: BN;
|
1173
1085
|
};
|
1174
1086
|
removeLiquidity: {
|
1175
|
-
baseRate: BN;
|
1176
|
-
slope1: BN;
|
1177
|
-
constant1: BN;
|
1178
|
-
slope2: BN;
|
1179
|
-
constant2: BN;
|
1180
1087
|
minFee: BN;
|
1088
|
+
targetFee: BN;
|
1181
1089
|
maxFee: BN;
|
1182
1090
|
};
|
1183
1091
|
openPosition: BN;
|
@@ -1353,39 +1261,23 @@ export declare class PerpetualsClient {
|
|
1353
1261
|
ratioMult: BN;
|
1354
1262
|
utilizationMult: BN;
|
1355
1263
|
swapIn: {
|
1356
|
-
baseRate: BN;
|
1357
|
-
slope1: BN;
|
1358
|
-
constant1: BN;
|
1359
|
-
slope2: BN;
|
1360
|
-
constant2: BN;
|
1361
1264
|
minFee: BN;
|
1265
|
+
targetFee: BN;
|
1362
1266
|
maxFee: BN;
|
1363
1267
|
};
|
1364
1268
|
swapOut: {
|
1365
|
-
baseRate: BN;
|
1366
|
-
slope1: BN;
|
1367
|
-
constant1: BN;
|
1368
|
-
slope2: BN;
|
1369
|
-
constant2: BN;
|
1370
1269
|
minFee: BN;
|
1270
|
+
targetFee: BN;
|
1371
1271
|
maxFee: BN;
|
1372
1272
|
};
|
1373
1273
|
addLiquidity: {
|
1374
|
-
baseRate: BN;
|
1375
|
-
slope1: BN;
|
1376
|
-
constant1: BN;
|
1377
|
-
slope2: BN;
|
1378
|
-
constant2: BN;
|
1379
1274
|
minFee: BN;
|
1275
|
+
targetFee: BN;
|
1380
1276
|
maxFee: BN;
|
1381
1277
|
};
|
1382
1278
|
removeLiquidity: {
|
1383
|
-
baseRate: BN;
|
1384
|
-
slope1: BN;
|
1385
|
-
constant1: BN;
|
1386
|
-
slope2: BN;
|
1387
|
-
constant2: BN;
|
1388
1279
|
minFee: BN;
|
1280
|
+
targetFee: BN;
|
1389
1281
|
maxFee: BN;
|
1390
1282
|
};
|
1391
1283
|
openPosition: BN;
|
@@ -1560,39 +1452,23 @@ export declare class PerpetualsClient {
|
|
1560
1452
|
ratioMult: BN;
|
1561
1453
|
utilizationMult: BN;
|
1562
1454
|
swapIn: {
|
1563
|
-
baseRate: BN;
|
1564
|
-
slope1: BN;
|
1565
|
-
constant1: BN;
|
1566
|
-
slope2: BN;
|
1567
|
-
constant2: BN;
|
1568
1455
|
minFee: BN;
|
1456
|
+
targetFee: BN;
|
1569
1457
|
maxFee: BN;
|
1570
1458
|
};
|
1571
1459
|
swapOut: {
|
1572
|
-
baseRate: BN;
|
1573
|
-
slope1: BN;
|
1574
|
-
constant1: BN;
|
1575
|
-
slope2: BN;
|
1576
|
-
constant2: BN;
|
1577
1460
|
minFee: BN;
|
1461
|
+
targetFee: BN;
|
1578
1462
|
maxFee: BN;
|
1579
1463
|
};
|
1580
1464
|
addLiquidity: {
|
1581
|
-
baseRate: BN;
|
1582
|
-
slope1: BN;
|
1583
|
-
constant1: BN;
|
1584
|
-
slope2: BN;
|
1585
|
-
constant2: BN;
|
1586
1465
|
minFee: BN;
|
1466
|
+
targetFee: BN;
|
1587
1467
|
maxFee: BN;
|
1588
1468
|
};
|
1589
1469
|
removeLiquidity: {
|
1590
|
-
baseRate: BN;
|
1591
|
-
slope1: BN;
|
1592
|
-
constant1: BN;
|
1593
|
-
slope2: BN;
|
1594
|
-
constant2: BN;
|
1595
1470
|
minFee: BN;
|
1471
|
+
targetFee: BN;
|
1596
1472
|
maxFee: BN;
|
1597
1473
|
};
|
1598
1474
|
openPosition: BN;
|
@@ -1767,39 +1643,23 @@ export declare class PerpetualsClient {
|
|
1767
1643
|
ratioMult: BN;
|
1768
1644
|
utilizationMult: BN;
|
1769
1645
|
swapIn: {
|
1770
|
-
baseRate: BN;
|
1771
|
-
slope1: BN;
|
1772
|
-
constant1: BN;
|
1773
|
-
slope2: BN;
|
1774
|
-
constant2: BN;
|
1775
1646
|
minFee: BN;
|
1647
|
+
targetFee: BN;
|
1776
1648
|
maxFee: BN;
|
1777
1649
|
};
|
1778
1650
|
swapOut: {
|
1779
|
-
baseRate: BN;
|
1780
|
-
slope1: BN;
|
1781
|
-
constant1: BN;
|
1782
|
-
slope2: BN;
|
1783
|
-
constant2: BN;
|
1784
1651
|
minFee: BN;
|
1652
|
+
targetFee: BN;
|
1785
1653
|
maxFee: BN;
|
1786
1654
|
};
|
1787
1655
|
addLiquidity: {
|
1788
|
-
baseRate: BN;
|
1789
|
-
slope1: BN;
|
1790
|
-
constant1: BN;
|
1791
|
-
slope2: BN;
|
1792
|
-
constant2: BN;
|
1793
1656
|
minFee: BN;
|
1657
|
+
targetFee: BN;
|
1794
1658
|
maxFee: BN;
|
1795
1659
|
};
|
1796
1660
|
removeLiquidity: {
|
1797
|
-
baseRate: BN;
|
1798
|
-
slope1: BN;
|
1799
|
-
constant1: BN;
|
1800
|
-
slope2: BN;
|
1801
|
-
constant2: BN;
|
1802
1661
|
minFee: BN;
|
1662
|
+
targetFee: BN;
|
1803
1663
|
maxFee: BN;
|
1804
1664
|
};
|
1805
1665
|
openPosition: BN;
|
@@ -1975,39 +1835,23 @@ export declare class PerpetualsClient {
|
|
1975
1835
|
ratioMult: BN;
|
1976
1836
|
utilizationMult: BN;
|
1977
1837
|
swapIn: {
|
1978
|
-
baseRate: BN;
|
1979
|
-
slope1: BN;
|
1980
|
-
constant1: BN;
|
1981
|
-
slope2: BN;
|
1982
|
-
constant2: BN;
|
1983
1838
|
minFee: BN;
|
1839
|
+
targetFee: BN;
|
1984
1840
|
maxFee: BN;
|
1985
1841
|
};
|
1986
1842
|
swapOut: {
|
1987
|
-
baseRate: BN;
|
1988
|
-
slope1: BN;
|
1989
|
-
constant1: BN;
|
1990
|
-
slope2: BN;
|
1991
|
-
constant2: BN;
|
1992
1843
|
minFee: BN;
|
1844
|
+
targetFee: BN;
|
1993
1845
|
maxFee: BN;
|
1994
1846
|
};
|
1995
1847
|
addLiquidity: {
|
1996
|
-
baseRate: BN;
|
1997
|
-
slope1: BN;
|
1998
|
-
constant1: BN;
|
1999
|
-
slope2: BN;
|
2000
|
-
constant2: BN;
|
2001
1848
|
minFee: BN;
|
1849
|
+
targetFee: BN;
|
2002
1850
|
maxFee: BN;
|
2003
1851
|
};
|
2004
1852
|
removeLiquidity: {
|
2005
|
-
baseRate: BN;
|
2006
|
-
slope1: BN;
|
2007
|
-
constant1: BN;
|
2008
|
-
slope2: BN;
|
2009
|
-
constant2: BN;
|
2010
1853
|
minFee: BN;
|
1854
|
+
targetFee: BN;
|
2011
1855
|
maxFee: BN;
|
2012
1856
|
};
|
2013
1857
|
openPosition: BN;
|
@@ -2182,39 +2026,23 @@ export declare class PerpetualsClient {
|
|
2182
2026
|
ratioMult: BN;
|
2183
2027
|
utilizationMult: BN;
|
2184
2028
|
swapIn: {
|
2185
|
-
baseRate: BN;
|
2186
|
-
slope1: BN;
|
2187
|
-
constant1: BN;
|
2188
|
-
slope2: BN;
|
2189
|
-
constant2: BN;
|
2190
2029
|
minFee: BN;
|
2030
|
+
targetFee: BN;
|
2191
2031
|
maxFee: BN;
|
2192
2032
|
};
|
2193
2033
|
swapOut: {
|
2194
|
-
baseRate: BN;
|
2195
|
-
slope1: BN;
|
2196
|
-
constant1: BN;
|
2197
|
-
slope2: BN;
|
2198
|
-
constant2: BN;
|
2199
2034
|
minFee: BN;
|
2035
|
+
targetFee: BN;
|
2200
2036
|
maxFee: BN;
|
2201
2037
|
};
|
2202
2038
|
addLiquidity: {
|
2203
|
-
baseRate: BN;
|
2204
|
-
slope1: BN;
|
2205
|
-
constant1: BN;
|
2206
|
-
slope2: BN;
|
2207
|
-
constant2: BN;
|
2208
2039
|
minFee: BN;
|
2040
|
+
targetFee: BN;
|
2209
2041
|
maxFee: BN;
|
2210
2042
|
};
|
2211
2043
|
removeLiquidity: {
|
2212
|
-
baseRate: BN;
|
2213
|
-
slope1: BN;
|
2214
|
-
constant1: BN;
|
2215
|
-
slope2: BN;
|
2216
|
-
constant2: BN;
|
2217
2044
|
minFee: BN;
|
2045
|
+
targetFee: BN;
|
2218
2046
|
maxFee: BN;
|
2219
2047
|
};
|
2220
2048
|
openPosition: BN;
|
@@ -2368,14 +2196,18 @@ export declare class PerpetualsClient {
|
|
2368
2196
|
sizeDeltaAmount: BN;
|
2369
2197
|
} | null, side: Side, marketPrice: OraclePrice, marketEmaPrice: OraclePrice, marketCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount) => EntryPriceAndFee;
|
2370
2198
|
getEntryPriceSync: (side: Side, marketPrice: OraclePrice, marketEmaPrice: OraclePrice, marketCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount) => BN;
|
2371
|
-
|
2372
|
-
|
2199
|
+
getMinAndMaxPriceSync: (price: OraclePrice, emaPrice: OraclePrice, custodyAccount: CustodyAccount) => MinAndMaxPrice;
|
2200
|
+
checkIfPriceStale: (price: OraclePrice, emaPrice: OraclePrice, custodyAccount: CustodyAccount) => boolean;
|
2201
|
+
getSizeAmountFromLeverageAndCollateral: (collateralAmtWithFee: BN, leverage: string, marketToken: Token, collateralToken: Token, side: Side, marketPrice: OraclePrice, marketEmaPrice: OraclePrice, marketCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount) => BN;
|
2202
|
+
getCollateralAmountWithFeeFromLeverageAndSize: (sizeAmount: BN, leverage: string, marketToken: Token, collateralToken: Token, side: Side, marketPrice: OraclePrice, marketEmaPrice: OraclePrice, marketCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount) => BN;
|
2373
2203
|
getExitPriceAndFeeSync: (positionAccount: PositionAccount | null, delta: {
|
2374
2204
|
collateralDeltaAmount: BN;
|
2375
2205
|
sizeDeltaAmount: BN;
|
2376
2206
|
} | null, side: Side, marketPrice: OraclePrice, marketEmaPrice: OraclePrice, marketCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount) => ExitPriceAndFee;
|
2377
2207
|
getExitPriceSync: (side: Side, marketPrice: OraclePrice, marketEmaPrice: OraclePrice, marketCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount) => BN;
|
2378
2208
|
getDecreaseSizeCollateralAndFeeSync: (positionAccount: PositionAccount, sizeDeltaAmount: BN, keepLevSame: boolean, side: Side, marketPrice: OraclePrice, marketEmaPrice: OraclePrice, marketCustodyAccount: CustodyAccount, collateralPrice: OraclePrice, collateralEmaPrice: OraclePrice, collateralCustodyAccount: CustodyAccount) => RemoveCollateralData;
|
2209
|
+
getCumulativeInterestSync: (custodyAccount: CustodyAccount) => BN;
|
2210
|
+
getInterestAmountUsdForPosition: (position: PositionAccount, custodyAccount: CustodyAccount) => BN;
|
2379
2211
|
getLiquidationPriceSync: (positionAccount: PositionAccount | null, delta: {
|
2380
2212
|
collateralDeltaAmount: BN;
|
2381
2213
|
sizeDeltaAmount: BN;
|