@gmx-io/sdk 1.5.0-alpha-13 → 1.5.0-alpha-15
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/build/cjs/scripts/subsquid-codegen.js +1 -1
- package/build/cjs/src/clients/v1/modules/trades/trades.js +4 -0
- package/build/cjs/src/clients/v2/__tests__/decrease.spec.js +12 -12
- package/build/cjs/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +16 -0
- package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +122 -0
- package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +30 -0
- package/build/cjs/src/codegen/subsquid.js +30 -0
- package/build/cjs/src/configs/markets.js +14 -0
- package/build/cjs/src/configs/tokens.js +18 -0
- package/build/cjs/src/test/mock.js +1 -0
- package/build/cjs/src/utils/__tests__/markets.spec.js +88 -48
- package/build/cjs/src/utils/__tests__/positions.spec.js +93 -0
- package/build/cjs/src/utils/markets/utils.js +23 -14
- package/build/cjs/src/utils/orderTransactions/utils.js +2 -2
- package/build/cjs/src/utils/orderTransactions/validateTypedData.js +3 -3
- package/build/cjs/src/utils/positions/utils.js +34 -2
- package/build/cjs/src/utils/prices/utils.js +4 -4
- package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +1 -1
- package/build/cjs/src/utils/trade/decrease.js +1 -1
- package/build/cjs/src/utils/trade/increase.js +1 -1
- package/build/cjs/src/utils/trade/trade.js +0 -7
- package/build/cjs/src/utils/tradeHistory/utils.js +2 -0
- package/build/cjs/src/utils/twap/index.js +4 -10
- package/build/esm/scripts/subsquid-codegen.js +1 -1
- package/build/esm/src/clients/v1/modules/trades/trades.js +4 -0
- package/build/esm/src/clients/v2/__tests__/decrease.spec.js +12 -12
- package/build/esm/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +16 -0
- package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +122 -0
- package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +30 -0
- package/build/esm/src/codegen/subsquid.js +30 -0
- package/build/esm/src/configs/markets.js +14 -0
- package/build/esm/src/configs/tokens.js +18 -0
- package/build/esm/src/test/mock.js +1 -0
- package/build/esm/src/utils/__tests__/markets.spec.js +90 -50
- package/build/esm/src/utils/__tests__/positions.spec.js +94 -1
- package/build/esm/src/utils/markets/utils.js +21 -13
- package/build/esm/src/utils/orderTransactions/utils.js +2 -2
- package/build/esm/src/utils/orderTransactions/validateTypedData.js +3 -3
- package/build/esm/src/utils/positions/utils.js +32 -2
- package/build/esm/src/utils/prices/utils.js +4 -4
- package/build/esm/src/utils/subaccount/index.js +2 -2
- package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +1 -1
- package/build/esm/src/utils/trade/decrease.js +1 -1
- package/build/esm/src/utils/trade/increase.js +1 -1
- package/build/esm/src/utils/trade/trade.js +0 -7
- package/build/esm/src/utils/tradeHistory/utils.js +2 -0
- package/build/esm/src/utils/twap/index.js +4 -10
- package/build/types/src/codegen/prebuilt/index.d.ts +168 -0
- package/build/types/src/codegen/subsquid.d.ts +77 -0
- package/build/types/src/utils/markets/utils.d.ts +6 -1
- package/build/types/src/utils/positions/types.d.ts +3 -0
- package/build/types/src/utils/positions/utils.d.ts +15 -0
- package/build/types/src/utils/prices/utils.d.ts +1 -1
- package/build/types/src/utils/subaccount/index.d.ts +2 -2
- package/build/types/src/utils/swap/types.d.ts +1 -1
- package/build/types/src/utils/trade/types.d.ts +4 -1
- package/build/types/src/utils/tradeHistory/types.d.ts +2 -0
- package/package.json +1 -1
- package/build/cjs/src/configs/marketHours.js +0 -27
- package/build/esm/src/configs/marketHours.js +0 -24
- package/build/types/src/configs/marketHours.d.ts +0 -7
|
@@ -57,6 +57,8 @@ export interface AccountPnlHistoryPointObject {
|
|
|
57
57
|
/** Field for debug */
|
|
58
58
|
cumulativeRealizedPriceImpact: Scalars["BigInt"]["output"];
|
|
59
59
|
/** Field for debug */
|
|
60
|
+
cumulativeRealizedSwapFees: Scalars["BigInt"]["output"];
|
|
61
|
+
/** Field for debug */
|
|
60
62
|
cumulativeRealizedSwapImpact: Scalars["BigInt"]["output"];
|
|
61
63
|
pnl: Scalars["BigInt"]["output"];
|
|
62
64
|
/** Field for debug */
|
|
@@ -66,6 +68,8 @@ export interface AccountPnlHistoryPointObject {
|
|
|
66
68
|
/** Field for debug */
|
|
67
69
|
realizedPriceImpact: Scalars["BigInt"]["output"];
|
|
68
70
|
/** Field for debug */
|
|
71
|
+
realizedSwapFees: Scalars["BigInt"]["output"];
|
|
72
|
+
/** Field for debug */
|
|
69
73
|
realizedSwapImpact: Scalars["BigInt"]["output"];
|
|
70
74
|
/** Field for debug */
|
|
71
75
|
startUnrealizedFees: Scalars["BigInt"]["output"];
|
|
@@ -91,6 +95,8 @@ export interface AccountPnlSummaryBucketObject {
|
|
|
91
95
|
/** Field for debug */
|
|
92
96
|
realizedPriceImpactUsd: Scalars["BigInt"]["output"];
|
|
93
97
|
/** Field for debug */
|
|
98
|
+
realizedSwapFeesUsd: Scalars["BigInt"]["output"];
|
|
99
|
+
/** Field for debug */
|
|
94
100
|
realizedSwapImpactUsd: Scalars["BigInt"]["output"];
|
|
95
101
|
/** Field for debug */
|
|
96
102
|
startUnrealizedBasePnlUsd: Scalars["BigInt"]["output"];
|
|
@@ -127,6 +133,7 @@ export interface AccountStat {
|
|
|
127
133
|
realizedFees: Scalars["BigInt"]["output"];
|
|
128
134
|
realizedPnl: Scalars["BigInt"]["output"];
|
|
129
135
|
realizedPriceImpact: Scalars["BigInt"]["output"];
|
|
136
|
+
realizedSwapFees: Scalars["BigInt"]["output"];
|
|
130
137
|
realizedSwapImpact: Scalars["BigInt"]["output"];
|
|
131
138
|
sumMaxSize: Scalars["BigInt"]["output"];
|
|
132
139
|
volume: Scalars["BigInt"]["output"];
|
|
@@ -240,6 +247,12 @@ export declare enum AccountStatOrderByInput {
|
|
|
240
247
|
realizedPriceImpact_DESC = "realizedPriceImpact_DESC",
|
|
241
248
|
realizedPriceImpact_DESC_NULLS_FIRST = "realizedPriceImpact_DESC_NULLS_FIRST",
|
|
242
249
|
realizedPriceImpact_DESC_NULLS_LAST = "realizedPriceImpact_DESC_NULLS_LAST",
|
|
250
|
+
realizedSwapFees_ASC = "realizedSwapFees_ASC",
|
|
251
|
+
realizedSwapFees_ASC_NULLS_FIRST = "realizedSwapFees_ASC_NULLS_FIRST",
|
|
252
|
+
realizedSwapFees_ASC_NULLS_LAST = "realizedSwapFees_ASC_NULLS_LAST",
|
|
253
|
+
realizedSwapFees_DESC = "realizedSwapFees_DESC",
|
|
254
|
+
realizedSwapFees_DESC_NULLS_FIRST = "realizedSwapFees_DESC_NULLS_FIRST",
|
|
255
|
+
realizedSwapFees_DESC_NULLS_LAST = "realizedSwapFees_DESC_NULLS_LAST",
|
|
243
256
|
realizedSwapImpact_ASC = "realizedSwapImpact_ASC",
|
|
244
257
|
realizedSwapImpact_ASC_NULLS_FIRST = "realizedSwapImpact_ASC_NULLS_FIRST",
|
|
245
258
|
realizedSwapImpact_ASC_NULLS_LAST = "realizedSwapImpact_ASC_NULLS_LAST",
|
|
@@ -439,6 +452,15 @@ export interface AccountStatWhereInput {
|
|
|
439
452
|
realizedPriceImpact_lte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
440
453
|
realizedPriceImpact_not_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
441
454
|
realizedPriceImpact_not_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
455
|
+
realizedSwapFees_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
456
|
+
realizedSwapFees_gt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
457
|
+
realizedSwapFees_gte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
458
|
+
realizedSwapFees_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
459
|
+
realizedSwapFees_isNull?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
460
|
+
realizedSwapFees_lt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
461
|
+
realizedSwapFees_lte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
462
|
+
realizedSwapFees_not_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
463
|
+
realizedSwapFees_not_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
442
464
|
realizedSwapImpact_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
443
465
|
realizedSwapImpact_gt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
444
466
|
realizedSwapImpact_gte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
@@ -2965,6 +2987,7 @@ export interface MarketInfo {
|
|
|
2965
2987
|
maxShortPoolAmount: Scalars["BigInt"]["output"];
|
|
2966
2988
|
maxShortPoolUsdForDeposit: Scalars["BigInt"]["output"];
|
|
2967
2989
|
minCollateralFactor: Scalars["BigInt"]["output"];
|
|
2990
|
+
minCollateralFactorForLiquidation: Scalars["BigInt"]["output"];
|
|
2968
2991
|
minCollateralFactorForOpenInterestLong: Scalars["BigInt"]["output"];
|
|
2969
2992
|
minCollateralFactorForOpenInterestShort: Scalars["BigInt"]["output"];
|
|
2970
2993
|
minFundingFactorPerSecond: Scalars["BigInt"]["output"];
|
|
@@ -3295,6 +3318,12 @@ export declare enum MarketInfoOrderByInput {
|
|
|
3295
3318
|
maxShortPoolUsdForDeposit_DESC = "maxShortPoolUsdForDeposit_DESC",
|
|
3296
3319
|
maxShortPoolUsdForDeposit_DESC_NULLS_FIRST = "maxShortPoolUsdForDeposit_DESC_NULLS_FIRST",
|
|
3297
3320
|
maxShortPoolUsdForDeposit_DESC_NULLS_LAST = "maxShortPoolUsdForDeposit_DESC_NULLS_LAST",
|
|
3321
|
+
minCollateralFactorForLiquidation_ASC = "minCollateralFactorForLiquidation_ASC",
|
|
3322
|
+
minCollateralFactorForLiquidation_ASC_NULLS_FIRST = "minCollateralFactorForLiquidation_ASC_NULLS_FIRST",
|
|
3323
|
+
minCollateralFactorForLiquidation_ASC_NULLS_LAST = "minCollateralFactorForLiquidation_ASC_NULLS_LAST",
|
|
3324
|
+
minCollateralFactorForLiquidation_DESC = "minCollateralFactorForLiquidation_DESC",
|
|
3325
|
+
minCollateralFactorForLiquidation_DESC_NULLS_FIRST = "minCollateralFactorForLiquidation_DESC_NULLS_FIRST",
|
|
3326
|
+
minCollateralFactorForLiquidation_DESC_NULLS_LAST = "minCollateralFactorForLiquidation_DESC_NULLS_LAST",
|
|
3298
3327
|
minCollateralFactorForOpenInterestLong_ASC = "minCollateralFactorForOpenInterestLong_ASC",
|
|
3299
3328
|
minCollateralFactorForOpenInterestLong_ASC_NULLS_FIRST = "minCollateralFactorForOpenInterestLong_ASC_NULLS_FIRST",
|
|
3300
3329
|
minCollateralFactorForOpenInterestLong_ASC_NULLS_LAST = "minCollateralFactorForOpenInterestLong_ASC_NULLS_LAST",
|
|
@@ -4021,6 +4050,15 @@ export interface MarketInfoWhereInput {
|
|
|
4021
4050
|
maxShortPoolUsdForDeposit_lte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4022
4051
|
maxShortPoolUsdForDeposit_not_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4023
4052
|
maxShortPoolUsdForDeposit_not_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
4053
|
+
minCollateralFactorForLiquidation_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4054
|
+
minCollateralFactorForLiquidation_gt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4055
|
+
minCollateralFactorForLiquidation_gte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4056
|
+
minCollateralFactorForLiquidation_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
4057
|
+
minCollateralFactorForLiquidation_isNull?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
4058
|
+
minCollateralFactorForLiquidation_lt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4059
|
+
minCollateralFactorForLiquidation_lte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4060
|
+
minCollateralFactorForLiquidation_not_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4061
|
+
minCollateralFactorForLiquidation_not_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
4024
4062
|
minCollateralFactorForOpenInterestLong_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4025
4063
|
minCollateralFactorForOpenInterestLong_gt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
4026
4064
|
minCollateralFactorForOpenInterestLong_gte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
@@ -6070,6 +6108,7 @@ export interface PeriodAccountStatObject {
|
|
|
6070
6108
|
realizedFees: Scalars["BigInt"]["output"];
|
|
6071
6109
|
realizedPnl: Scalars["BigInt"]["output"];
|
|
6072
6110
|
realizedPriceImpact: Scalars["BigInt"]["output"];
|
|
6111
|
+
realizedSwapFees: Scalars["BigInt"]["output"];
|
|
6073
6112
|
realizedSwapImpact: Scalars["BigInt"]["output"];
|
|
6074
6113
|
startUnrealizedFees: Scalars["BigInt"]["output"];
|
|
6075
6114
|
startUnrealizedPnl: Scalars["BigInt"]["output"];
|
|
@@ -6335,6 +6374,7 @@ export interface PositionChange {
|
|
|
6335
6374
|
sizeDeltaUsd: Scalars["BigInt"]["output"];
|
|
6336
6375
|
sizeInTokens: Scalars["BigInt"]["output"];
|
|
6337
6376
|
sizeInUsd: Scalars["BigInt"]["output"];
|
|
6377
|
+
swapFeeUsd?: Maybe<Scalars["BigInt"]["output"]>;
|
|
6338
6378
|
swapImpactUsd?: Maybe<Scalars["BigInt"]["output"]>;
|
|
6339
6379
|
timestamp: Scalars["Int"]["output"];
|
|
6340
6380
|
totalImpactUsd?: Maybe<Scalars["BigInt"]["output"]>;
|
|
@@ -6490,6 +6530,12 @@ export declare enum PositionChangeOrderByInput {
|
|
|
6490
6530
|
sizeInUsd_DESC = "sizeInUsd_DESC",
|
|
6491
6531
|
sizeInUsd_DESC_NULLS_FIRST = "sizeInUsd_DESC_NULLS_FIRST",
|
|
6492
6532
|
sizeInUsd_DESC_NULLS_LAST = "sizeInUsd_DESC_NULLS_LAST",
|
|
6533
|
+
swapFeeUsd_ASC = "swapFeeUsd_ASC",
|
|
6534
|
+
swapFeeUsd_ASC_NULLS_FIRST = "swapFeeUsd_ASC_NULLS_FIRST",
|
|
6535
|
+
swapFeeUsd_ASC_NULLS_LAST = "swapFeeUsd_ASC_NULLS_LAST",
|
|
6536
|
+
swapFeeUsd_DESC = "swapFeeUsd_DESC",
|
|
6537
|
+
swapFeeUsd_DESC_NULLS_FIRST = "swapFeeUsd_DESC_NULLS_FIRST",
|
|
6538
|
+
swapFeeUsd_DESC_NULLS_LAST = "swapFeeUsd_DESC_NULLS_LAST",
|
|
6493
6539
|
swapImpactUsd_ASC = "swapImpactUsd_ASC",
|
|
6494
6540
|
swapImpactUsd_ASC_NULLS_FIRST = "swapImpactUsd_ASC_NULLS_FIRST",
|
|
6495
6541
|
swapImpactUsd_ASC_NULLS_LAST = "swapImpactUsd_ASC_NULLS_LAST",
|
|
@@ -6774,6 +6820,15 @@ export interface PositionChangeWhereInput {
|
|
|
6774
6820
|
sizeInUsd_lte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6775
6821
|
sizeInUsd_not_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6776
6822
|
sizeInUsd_not_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
6823
|
+
swapFeeUsd_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6824
|
+
swapFeeUsd_gt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6825
|
+
swapFeeUsd_gte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6826
|
+
swapFeeUsd_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
6827
|
+
swapFeeUsd_isNull?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
6828
|
+
swapFeeUsd_lt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6829
|
+
swapFeeUsd_lte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6830
|
+
swapFeeUsd_not_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6831
|
+
swapFeeUsd_not_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
6777
6832
|
swapImpactUsd_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6778
6833
|
swapImpactUsd_gt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
6779
6834
|
swapImpactUsd_gte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
@@ -7520,6 +7575,12 @@ export declare enum PositionOrderByInput {
|
|
|
7520
7575
|
accountStat_realizedPriceImpact_DESC = "accountStat_realizedPriceImpact_DESC",
|
|
7521
7576
|
accountStat_realizedPriceImpact_DESC_NULLS_FIRST = "accountStat_realizedPriceImpact_DESC_NULLS_FIRST",
|
|
7522
7577
|
accountStat_realizedPriceImpact_DESC_NULLS_LAST = "accountStat_realizedPriceImpact_DESC_NULLS_LAST",
|
|
7578
|
+
accountStat_realizedSwapFees_ASC = "accountStat_realizedSwapFees_ASC",
|
|
7579
|
+
accountStat_realizedSwapFees_ASC_NULLS_FIRST = "accountStat_realizedSwapFees_ASC_NULLS_FIRST",
|
|
7580
|
+
accountStat_realizedSwapFees_ASC_NULLS_LAST = "accountStat_realizedSwapFees_ASC_NULLS_LAST",
|
|
7581
|
+
accountStat_realizedSwapFees_DESC = "accountStat_realizedSwapFees_DESC",
|
|
7582
|
+
accountStat_realizedSwapFees_DESC_NULLS_FIRST = "accountStat_realizedSwapFees_DESC_NULLS_FIRST",
|
|
7583
|
+
accountStat_realizedSwapFees_DESC_NULLS_LAST = "accountStat_realizedSwapFees_DESC_NULLS_LAST",
|
|
7523
7584
|
accountStat_realizedSwapImpact_ASC = "accountStat_realizedSwapImpact_ASC",
|
|
7524
7585
|
accountStat_realizedSwapImpact_ASC_NULLS_FIRST = "accountStat_realizedSwapImpact_ASC_NULLS_FIRST",
|
|
7525
7586
|
accountStat_realizedSwapImpact_ASC_NULLS_LAST = "accountStat_realizedSwapImpact_ASC_NULLS_LAST",
|
|
@@ -10250,6 +10311,7 @@ export interface TradeAction {
|
|
|
10250
10311
|
sizeDeltaInTokens?: Maybe<Scalars["BigInt"]["output"]>;
|
|
10251
10312
|
sizeDeltaUsd?: Maybe<Scalars["BigInt"]["output"]>;
|
|
10252
10313
|
srcChainId?: Maybe<Scalars["BigInt"]["output"]>;
|
|
10314
|
+
swapFeeUsd?: Maybe<Scalars["BigInt"]["output"]>;
|
|
10253
10315
|
swapImpactUsd?: Maybe<Scalars["BigInt"]["output"]>;
|
|
10254
10316
|
swapPath: Array<Scalars["String"]["output"]>;
|
|
10255
10317
|
timestamp: Scalars["Int"]["output"];
|
|
@@ -10487,6 +10549,12 @@ export declare enum TradeActionOrderByInput {
|
|
|
10487
10549
|
srcChainId_DESC = "srcChainId_DESC",
|
|
10488
10550
|
srcChainId_DESC_NULLS_FIRST = "srcChainId_DESC_NULLS_FIRST",
|
|
10489
10551
|
srcChainId_DESC_NULLS_LAST = "srcChainId_DESC_NULLS_LAST",
|
|
10552
|
+
swapFeeUsd_ASC = "swapFeeUsd_ASC",
|
|
10553
|
+
swapFeeUsd_ASC_NULLS_FIRST = "swapFeeUsd_ASC_NULLS_FIRST",
|
|
10554
|
+
swapFeeUsd_ASC_NULLS_LAST = "swapFeeUsd_ASC_NULLS_LAST",
|
|
10555
|
+
swapFeeUsd_DESC = "swapFeeUsd_DESC",
|
|
10556
|
+
swapFeeUsd_DESC_NULLS_FIRST = "swapFeeUsd_DESC_NULLS_FIRST",
|
|
10557
|
+
swapFeeUsd_DESC_NULLS_LAST = "swapFeeUsd_DESC_NULLS_LAST",
|
|
10490
10558
|
swapImpactUsd_ASC = "swapImpactUsd_ASC",
|
|
10491
10559
|
swapImpactUsd_ASC_NULLS_FIRST = "swapImpactUsd_ASC_NULLS_FIRST",
|
|
10492
10560
|
swapImpactUsd_ASC_NULLS_LAST = "swapImpactUsd_ASC_NULLS_LAST",
|
|
@@ -10918,6 +10986,15 @@ export interface TradeActionWhereInput {
|
|
|
10918
10986
|
srcChainId_lte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10919
10987
|
srcChainId_not_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10920
10988
|
srcChainId_not_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
10989
|
+
swapFeeUsd_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10990
|
+
swapFeeUsd_gt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10991
|
+
swapFeeUsd_gte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10992
|
+
swapFeeUsd_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
10993
|
+
swapFeeUsd_isNull?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
10994
|
+
swapFeeUsd_lt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10995
|
+
swapFeeUsd_lte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10996
|
+
swapFeeUsd_not_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10997
|
+
swapFeeUsd_not_in?: InputMaybe<Array<Scalars["BigInt"]["input"]>>;
|
|
10921
10998
|
swapImpactUsd_eq?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10922
10999
|
swapImpactUsd_gt?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
10923
11000
|
swapImpactUsd_gte?: InputMaybe<Scalars["BigInt"]["input"]>;
|
|
@@ -43,7 +43,11 @@ export declare function getCappedPoolPnl(p: {
|
|
|
43
43
|
isLong: boolean;
|
|
44
44
|
}): bigint;
|
|
45
45
|
export declare function getMaxLeverageByMinCollateralFactor(minCollateralFactor: bigint | undefined): number;
|
|
46
|
-
export declare function
|
|
46
|
+
export declare function getMaxAllowedLeverage({ minCollateralFactor, minCollateralFactorForLiquidation, positionFeeFactorForBalanceWasNotImproved, }: {
|
|
47
|
+
minCollateralFactor: bigint | undefined;
|
|
48
|
+
minCollateralFactorForLiquidation: bigint | undefined;
|
|
49
|
+
positionFeeFactorForBalanceWasNotImproved: bigint | undefined;
|
|
50
|
+
}): number;
|
|
47
51
|
export declare function getOppositeCollateral(marketInfo: MarketInfo, tokenAddress: string): import("../tokens").TokenData | undefined;
|
|
48
52
|
export declare function getOppositeCollateralFromConfig(marketConfig: ConfigMarketConfig, tokenAddress: string): string;
|
|
49
53
|
export declare function getAvailableUsdLiquidityForCollateral(marketInfo: MarketInfo, isLong: boolean): bigint;
|
|
@@ -76,6 +80,7 @@ export declare function getOpenInterestInTokens(marketInfo: MarketInfo, isLong:
|
|
|
76
80
|
export declare function getOpenInterestForBalance(marketInfo: MarketInfo, isLong: boolean): bigint;
|
|
77
81
|
export declare function getPriceForPnl(prices: TokenPrices, isLong: boolean, maximize: boolean): bigint;
|
|
78
82
|
export declare function getIsMarketAvailableForExpressSwaps(marketInfo: MarketInfo): boolean;
|
|
83
|
+
export declare function getIsMarketDeprecated(marketInfo: MarketInfo): boolean;
|
|
79
84
|
export declare function getMarket24Stats(dayPriceCandle: DayPriceCandle): {
|
|
80
85
|
open24h: bigint;
|
|
81
86
|
high24h: bigint;
|
|
@@ -46,6 +46,9 @@ export type PositionInfo = Position & {
|
|
|
46
46
|
pnlPercentage: bigint;
|
|
47
47
|
pnlAfterFees: bigint;
|
|
48
48
|
pnlAfterFeesPercentage: bigint;
|
|
49
|
+
netValueAfterAllFees: bigint;
|
|
50
|
+
pnlAfterAllFees: bigint;
|
|
51
|
+
pnlAfterAllFeesPercentage: bigint;
|
|
49
52
|
netPriceImapctDeltaUsd: bigint;
|
|
50
53
|
priceImpactDiffUsd: bigint;
|
|
51
54
|
pendingImpactUsd: bigint;
|
|
@@ -36,11 +36,26 @@ export declare function getPositionNetValue(p: {
|
|
|
36
36
|
pendingBorrowingFeesUsd: bigint;
|
|
37
37
|
pnl: bigint;
|
|
38
38
|
}): bigint;
|
|
39
|
+
export declare function getPositionNetValueAfterAllFees(p: {
|
|
40
|
+
collateralUsd: bigint;
|
|
41
|
+
pnl: bigint;
|
|
42
|
+
pendingBorrowingFeesUsd: bigint;
|
|
43
|
+
pendingFundingFeesUsd: bigint;
|
|
44
|
+
netPriceImpactDeltaUsd: bigint;
|
|
45
|
+
closingFeeUsd: bigint;
|
|
46
|
+
}): bigint;
|
|
39
47
|
export declare function getPositionPnlAfterFees({ pnl, pendingBorrowingFeesUsd, pendingFundingFeesUsd, }: {
|
|
40
48
|
pnl: bigint;
|
|
41
49
|
pendingBorrowingFeesUsd: bigint;
|
|
42
50
|
pendingFundingFeesUsd: bigint;
|
|
43
51
|
}): bigint;
|
|
52
|
+
export declare function getPositionPnlAfterAllFees({ pnl, pendingBorrowingFeesUsd, pendingFundingFeesUsd, netPriceImpactDeltaUsd, closingFeeUsd, }: {
|
|
53
|
+
pnl: bigint;
|
|
54
|
+
pendingBorrowingFeesUsd: bigint;
|
|
55
|
+
pendingFundingFeesUsd: bigint;
|
|
56
|
+
netPriceImpactDeltaUsd: bigint;
|
|
57
|
+
closingFeeUsd: bigint;
|
|
58
|
+
}): bigint;
|
|
44
59
|
export declare function getLeverage(p: {
|
|
45
60
|
sizeInUsd: bigint;
|
|
46
61
|
collateralUsd: bigint;
|
|
@@ -2,6 +2,6 @@ export * from "./types";
|
|
|
2
2
|
export { generateSubaccount, decryptSubaccountPrivateKey, createSubaccountSignerFromConfig, type GeneratedSubaccount, } from "./generateSubaccount";
|
|
3
3
|
export { hashSubaccountApproval } from "./hashSubaccountApproval";
|
|
4
4
|
export { getEmptySubaccountApproval } from "./getEmptySubaccountApproval";
|
|
5
|
-
export { getSubaccountApprovalTypedData, type SubaccountApprovalTypedData
|
|
6
|
-
export { fetchSubaccountStatus, prepareSubaccountApproval, signSubaccountApproval
|
|
5
|
+
export { getSubaccountApprovalTypedData, type SubaccountApprovalTypedData } from "./getSubaccountApprovalTypedData";
|
|
6
|
+
export { fetchSubaccountStatus, prepareSubaccountApproval, signSubaccountApproval } from "./api";
|
|
7
7
|
export type { SubaccountStatusRequest, SubaccountStatusResponse, SubaccountApprovalPrepareRequest, SubaccountApprovalPrepareResponse, } from "./api";
|
|
@@ -29,5 +29,5 @@ export type CombinedSwapStrategy = BaseSwapStrategy & {
|
|
|
29
29
|
swapPathStats: SwapPathStats;
|
|
30
30
|
};
|
|
31
31
|
export type SwapStrategyForIncreaseOrders = NoSwapStrategy | ExternalSwapStrategy | InternalSwapStrategy | CombinedSwapStrategy;
|
|
32
|
-
export type SwapStrategyForSwapOrders = NoSwapStrategy | InternalSwapStrategy | CombinedSwapStrategy;
|
|
32
|
+
export type SwapStrategyForSwapOrders = NoSwapStrategy | ExternalSwapStrategy | InternalSwapStrategy | CombinedSwapStrategy;
|
|
33
33
|
export {};
|
|
@@ -248,7 +248,9 @@ export type ExternalSwapQuote = {
|
|
|
248
248
|
priceIn: bigint;
|
|
249
249
|
priceOut: bigint;
|
|
250
250
|
feesUsd: bigint;
|
|
251
|
+
slippage?: number;
|
|
251
252
|
needSpenderApproval?: boolean;
|
|
253
|
+
desiredAmountOut?: bigint;
|
|
252
254
|
txnData: {
|
|
253
255
|
to: string;
|
|
254
256
|
data: string;
|
|
@@ -269,7 +271,7 @@ export type ExternalSwapQuoteParams = {
|
|
|
269
271
|
tokensData: TokensData | undefined;
|
|
270
272
|
botanixStakingAssetsPerShare: bigint | undefined;
|
|
271
273
|
};
|
|
272
|
-
export type ExternalSwapCalculationStrategy = "byFromValue" | "leverageBySize";
|
|
274
|
+
export type ExternalSwapCalculationStrategy = "byFromValue" | "byToValue" | "leverageBySize";
|
|
273
275
|
export type ExternalSwapInputs = {
|
|
274
276
|
amountIn: bigint;
|
|
275
277
|
priceIn: bigint;
|
|
@@ -277,6 +279,7 @@ export type ExternalSwapInputs = {
|
|
|
277
279
|
usdIn: bigint;
|
|
278
280
|
usdOut: bigint;
|
|
279
281
|
strategy: ExternalSwapCalculationStrategy;
|
|
282
|
+
desiredAmountOut?: bigint;
|
|
280
283
|
internalSwapTotalFeesDeltaUsd?: bigint;
|
|
281
284
|
internalSwapTotalFeeItem?: FeeItem;
|
|
282
285
|
internalSwapAmounts: SwapAmounts;
|
|
@@ -34,6 +34,8 @@ export type PositionTradeAction = {
|
|
|
34
34
|
minOutputAmount: bigint;
|
|
35
35
|
priceImpactUsd?: bigint;
|
|
36
36
|
priceImpactDiffUsd?: bigint;
|
|
37
|
+
swapImpactUsd?: bigint;
|
|
38
|
+
swapFeeUsd?: bigint;
|
|
37
39
|
positionFeeAmount?: bigint;
|
|
38
40
|
borrowingFeeAmount?: bigint;
|
|
39
41
|
fundingFeeAmount?: bigint;
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Per-market UI leverage caps keyed off the contract's `minCollateralFactor`.
|
|
3
|
-
// The contracts team runs a cron (see Linear ENG-54) that toggles each market's
|
|
4
|
-
// MCF between its on-hours and off-hours value. Matching either sentinel here
|
|
5
|
-
// lets the UI apply the correct cap without knowing the session schedule.
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.MARKET_HOURS_MARKETS = void 0;
|
|
8
|
-
const GOLD_SILVER_CFG = {
|
|
9
|
-
onHoursMcf: 9n * 10n ** 27n,
|
|
10
|
-
onHoursMaxLeverage: 100,
|
|
11
|
-
offHoursMcf: 35n * 10n ** 27n,
|
|
12
|
-
offHoursMaxLeverage: 25,
|
|
13
|
-
};
|
|
14
|
-
exports.MARKET_HOURS_MARKETS = {
|
|
15
|
-
// Arbitrum
|
|
16
|
-
"0x0Df2BE76F517BCF0000AbfFcB6344B3b2aC4Cc4f": GOLD_SILVER_CFG, // GOLD/USD
|
|
17
|
-
"0x448Fa722717df299ee197E2F6d8EB7911EFF6cEc": GOLD_SILVER_CFG, // SILVER/USD
|
|
18
|
-
"0xda81cdd397210C08cFc567f93982E148A3aac8a6": GOLD_SILVER_CFG, // WTIOIL/USD
|
|
19
|
-
"0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74": GOLD_SILVER_CFG, // BRENTOIL/USD
|
|
20
|
-
"0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b": {
|
|
21
|
-
// NATGAS/USD
|
|
22
|
-
onHoursMcf: 22n * 10n ** 27n,
|
|
23
|
-
onHoursMaxLeverage: 40,
|
|
24
|
-
offHoursMcf: 40n * 10n ** 27n,
|
|
25
|
-
offHoursMaxLeverage: 20,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Per-market UI leverage caps keyed off the contract's `minCollateralFactor`.
|
|
2
|
-
// The contracts team runs a cron (see Linear ENG-54) that toggles each market's
|
|
3
|
-
// MCF between its on-hours and off-hours value. Matching either sentinel here
|
|
4
|
-
// lets the UI apply the correct cap without knowing the session schedule.
|
|
5
|
-
const GOLD_SILVER_CFG = {
|
|
6
|
-
onHoursMcf: 9n * 10n ** 27n,
|
|
7
|
-
onHoursMaxLeverage: 100,
|
|
8
|
-
offHoursMcf: 35n * 10n ** 27n,
|
|
9
|
-
offHoursMaxLeverage: 25,
|
|
10
|
-
};
|
|
11
|
-
export const MARKET_HOURS_MARKETS = {
|
|
12
|
-
// Arbitrum
|
|
13
|
-
"0x0Df2BE76F517BCF0000AbfFcB6344B3b2aC4Cc4f": GOLD_SILVER_CFG, // GOLD/USD
|
|
14
|
-
"0x448Fa722717df299ee197E2F6d8EB7911EFF6cEc": GOLD_SILVER_CFG, // SILVER/USD
|
|
15
|
-
"0xda81cdd397210C08cFc567f93982E148A3aac8a6": GOLD_SILVER_CFG, // WTIOIL/USD
|
|
16
|
-
"0x6F287D071800BfA847B4a7a7104BE33F87Ce9E74": GOLD_SILVER_CFG, // BRENTOIL/USD
|
|
17
|
-
"0x2Ce2bc8B0f9d000f359d756a5816C125474Bb39b": {
|
|
18
|
-
// NATGAS/USD
|
|
19
|
-
onHoursMcf: 22n * 10n ** 27n,
|
|
20
|
-
onHoursMaxLeverage: 40,
|
|
21
|
-
offHoursMcf: 40n * 10n ** 27n,
|
|
22
|
-
offHoursMaxLeverage: 20,
|
|
23
|
-
},
|
|
24
|
-
};
|