@gmx-io/sdk 1.2.1 → 1.3.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.
- package/build/cjs/src/abis/ClaimHandler.json +1 -16
- package/build/cjs/src/abis/CustomErrors.json +642 -61
- package/build/cjs/src/abis/DataStore.json +25 -6
- package/build/cjs/src/abis/EventEmitter.json +1 -6
- package/build/cjs/src/abis/ExchangeRouter.json +195 -290
- package/build/cjs/src/abis/GelatoRelayRouter.json +251 -98
- package/build/cjs/src/abis/GlvReader.json +60 -3
- package/build/cjs/src/abis/GlvRouter.json +144 -86
- package/build/cjs/src/abis/GovToken.json +1 -354
- package/build/cjs/src/abis/LayerZeroProvider.json +372 -0
- package/build/cjs/src/abis/Multicall.json +134 -38
- package/build/cjs/src/abis/MultichainClaimsRouter.json +1266 -0
- package/build/cjs/src/abis/MultichainGlvRouter.json +1150 -0
- package/build/cjs/src/abis/MultichainGmRouter.json +1449 -0
- package/build/cjs/src/abis/MultichainOrderRouter.json +1820 -0
- package/build/cjs/src/abis/MultichainSubaccountRouter.json +2069 -0
- package/build/cjs/src/abis/MultichainTransferRouter.json +915 -0
- package/build/cjs/src/abis/MultichainUtils.json +133 -0
- package/build/cjs/src/abis/MultichainVault.json +275 -0
- package/build/cjs/src/abis/ReferralStorage.json +69 -19
- package/build/cjs/src/abis/RelayParams.json +85 -48
- package/build/cjs/src/abis/SmartAccount.json +28 -0
- package/build/cjs/src/abis/SubaccountGelatoRelayRouter.json +282 -148
- package/build/cjs/src/abis/SubaccountRouter.json +62 -118
- package/build/cjs/src/abis/SyntheticsReader.json +342 -474
- package/build/cjs/src/abis/SyntheticsRouter.json +1 -6
- package/build/cjs/src/abis/index.js +51 -7
- package/build/cjs/src/configs/__tests__/markets.spec.js +1 -1
- package/build/cjs/src/configs/__tests__/permits.spec.js +1 -1
- package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -1
- package/build/cjs/src/configs/batch.js +48 -0
- package/build/cjs/src/configs/chains.js +41 -8
- package/build/cjs/src/configs/contracts.js +151 -41
- package/build/cjs/src/configs/dataStore.js +39 -5
- package/build/cjs/src/configs/express.js +4 -0
- package/build/cjs/src/configs/factors.js +1 -1
- package/build/cjs/src/configs/markets.js +128 -0
- package/build/cjs/src/configs/oracleKeeper.js +2 -0
- package/build/cjs/src/configs/tokens.js +217 -2
- package/build/cjs/src/modules/markets/index.js +9 -4
- package/build/cjs/src/modules/markets/query-builders.js +28 -8
- package/build/cjs/src/modules/orders/helpers.js +2 -2
- package/build/cjs/src/modules/orders/helpers.spec.js +1 -1
- package/build/cjs/src/modules/orders/utils.js +4 -5
- package/build/cjs/src/modules/positions/positions.js +38 -5
- package/build/cjs/src/modules/utils/utils.js +1 -0
- package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +146 -0
- package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +2207 -532
- package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +272 -0
- package/build/cjs/src/test/mock.js +9 -4
- package/build/cjs/src/types/subsquid.js +507 -1
- package/build/cjs/src/utils/LruCache.js +4 -0
- package/build/cjs/src/utils/__tests__/LruCache.spec.js +18 -0
- package/build/cjs/src/utils/__tests__/numbers.spec.js +18 -16
- package/build/cjs/src/utils/__tests__/orderTransactions/batchUtils.spec.js +0 -1
- package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +8 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +38 -30
- package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +10 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +6 -0
- package/build/cjs/src/utils/__tests__/positions.spec.js +23 -6
- package/build/cjs/src/utils/bigmath.js +9 -2
- package/build/cjs/src/utils/errors/parseError.js +35 -1
- package/build/cjs/src/utils/fees/executionFee.js +5 -3
- package/build/cjs/src/utils/fees/index.js +8 -6
- package/build/cjs/src/utils/fees/priceImpact.js +94 -32
- package/build/cjs/src/utils/gelatoRelay.js +5 -0
- package/build/cjs/src/utils/marketKeysAndConfigs.js +24 -4
- package/build/cjs/src/utils/markets.js +10 -3
- package/build/cjs/src/utils/numbers.js +18 -17
- package/build/cjs/src/utils/orderTransactions.js +5 -1
- package/build/cjs/src/utils/positions.js +77 -9
- package/build/cjs/src/utils/prices.js +19 -13
- package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +1 -0
- package/build/cjs/src/utils/swap/swapStats.js +6 -3
- package/build/cjs/src/utils/trade/decrease.js +470 -0
- package/build/cjs/src/utils/trade/{amounts.js → increase.js} +86 -31
- package/build/cjs/src/utils/tradeHistory.js +3 -0
- package/build/esm/src/abis/ClaimHandler.json +1 -16
- package/build/esm/src/abis/CustomErrors.json +642 -61
- package/build/esm/src/abis/DataStore.json +25 -6
- package/build/esm/src/abis/EventEmitter.json +1 -6
- package/build/esm/src/abis/ExchangeRouter.json +195 -290
- package/build/esm/src/abis/GelatoRelayRouter.json +251 -98
- package/build/esm/src/abis/GlvReader.json +60 -3
- package/build/esm/src/abis/GlvRouter.json +144 -86
- package/build/esm/src/abis/GovToken.json +1 -354
- package/build/esm/src/abis/LayerZeroProvider.json +372 -0
- package/build/esm/src/abis/Multicall.json +134 -38
- package/build/esm/src/abis/MultichainClaimsRouter.json +1266 -0
- package/build/esm/src/abis/MultichainGlvRouter.json +1150 -0
- package/build/esm/src/abis/MultichainGmRouter.json +1449 -0
- package/build/esm/src/abis/MultichainOrderRouter.json +1820 -0
- package/build/esm/src/abis/MultichainSubaccountRouter.json +2069 -0
- package/build/esm/src/abis/MultichainTransferRouter.json +915 -0
- package/build/esm/src/abis/MultichainUtils.json +133 -0
- package/build/esm/src/abis/MultichainVault.json +275 -0
- package/build/esm/src/abis/ReferralStorage.json +69 -19
- package/build/esm/src/abis/RelayParams.json +85 -48
- package/build/esm/src/abis/SmartAccount.json +28 -0
- package/build/esm/src/abis/SubaccountGelatoRelayRouter.json +282 -148
- package/build/esm/src/abis/SubaccountRouter.json +62 -118
- package/build/esm/src/abis/SyntheticsReader.json +342 -474
- package/build/esm/src/abis/SyntheticsRouter.json +1 -6
- package/build/esm/src/abis/index.js +51 -7
- package/build/esm/src/configs/__tests__/markets.spec.js +3 -3
- package/build/esm/src/configs/__tests__/permits.spec.js +2 -2
- package/build/esm/src/configs/__tests__/tokens.spec.js +2 -2
- package/build/esm/src/configs/batch.js +49 -1
- package/build/esm/src/configs/chains.js +40 -7
- package/build/esm/src/configs/contracts.js +152 -42
- package/build/esm/src/configs/dataStore.js +29 -1
- package/build/esm/src/configs/express.js +5 -1
- package/build/esm/src/configs/factors.js +1 -1
- package/build/esm/src/configs/markets.js +129 -1
- package/build/esm/src/configs/oracleKeeper.js +3 -1
- package/build/esm/src/configs/tokens.js +216 -2
- package/build/esm/src/modules/markets/index.js +9 -4
- package/build/esm/src/modules/markets/query-builders.js +28 -8
- package/build/esm/src/modules/orders/helpers.js +1 -1
- package/build/esm/src/modules/orders/helpers.spec.js +1 -1
- package/build/esm/src/modules/orders/utils.js +4 -5
- package/build/esm/src/modules/positions/positions.js +40 -7
- package/build/esm/src/modules/utils/utils.js +1 -0
- package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +146 -0
- package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +2207 -532
- package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +272 -0
- package/build/esm/src/test/mock.js +9 -4
- package/build/esm/src/types/subsquid.js +506 -0
- package/build/esm/src/utils/LruCache.js +4 -0
- package/build/esm/src/utils/__tests__/LruCache.spec.js +18 -0
- package/build/esm/src/utils/__tests__/numbers.spec.js +18 -16
- package/build/esm/src/utils/__tests__/orderTransactions/batchUtils.spec.js +0 -1
- package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +8 -0
- package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +38 -30
- package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +10 -0
- package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +7 -1
- package/build/esm/src/utils/__tests__/positions.spec.js +23 -6
- package/build/esm/src/utils/bigmath.js +9 -2
- package/build/esm/src/utils/errors/parseError.js +31 -0
- package/build/esm/src/utils/fees/executionFee.js +5 -3
- package/build/esm/src/utils/fees/index.js +8 -6
- package/build/esm/src/utils/fees/priceImpact.js +88 -30
- package/build/esm/src/utils/gelatoRelay.js +2 -0
- package/build/esm/src/utils/marketKeysAndConfigs.js +25 -5
- package/build/esm/src/utils/markets.js +7 -1
- package/build/esm/src/utils/numbers.js +18 -17
- package/build/esm/src/utils/orderTransactions.js +5 -1
- package/build/esm/src/utils/positions.js +75 -11
- package/build/esm/src/utils/prices.js +20 -14
- package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +1 -0
- package/build/esm/src/utils/swap/swapStats.js +6 -3
- package/build/esm/src/utils/trade/decrease.js +460 -0
- package/build/esm/src/utils/trade/{amounts.js → increase.js} +87 -33
- package/build/esm/src/utils/tradeHistory.js +3 -0
- package/build/types/src/abis/index.d.ts +1 -1
- package/build/types/src/configs/batch.d.ts +2 -2
- package/build/types/src/configs/chains.d.ts +25 -20
- package/build/types/src/configs/contracts.d.ts +118 -10
- package/build/types/src/configs/dataStore.d.ts +16 -0
- package/build/types/src/configs/factors.d.ts +1 -1
- package/build/types/src/configs/markets.d.ts +2 -2
- package/build/types/src/configs/tokens.d.ts +1 -0
- package/build/types/src/index.d.ts +1 -1
- package/build/types/src/modules/base.d.ts +1 -1
- package/build/types/src/modules/markets/query-builders.d.ts +3 -2
- package/build/types/src/modules/markets/types.d.ts +2 -2
- package/build/types/src/modules/orders/utils.d.ts +6 -5
- package/build/types/src/types/fees.d.ts +1 -0
- package/build/types/src/types/markets.d.ts +10 -5
- package/build/types/src/types/orders.d.ts +1 -1
- package/build/types/src/types/positions.d.ts +26 -2
- package/build/types/src/types/sdk.d.ts +2 -2
- package/build/types/src/types/subsquid.d.ts +1259 -9
- package/build/types/src/types/tokens.d.ts +7 -0
- package/build/types/src/types/trade.d.ts +14 -3
- package/build/types/src/types/tradeHistory.d.ts +3 -0
- package/build/types/src/utils/LruCache.d.ts +1 -0
- package/build/types/src/utils/bigmath.d.ts +2 -1
- package/build/types/src/utils/errors/parseError.d.ts +11 -0
- package/build/types/src/utils/fees/executionFee.d.ts +6 -3
- package/build/types/src/utils/fees/index.d.ts +2 -2
- package/build/types/src/utils/fees/priceImpact.d.ts +33 -5
- package/build/types/src/utils/marketKeysAndConfigs.d.ts +9 -4
- package/build/types/src/utils/markets.d.ts +7 -0
- package/build/types/src/utils/multicall.d.ts +1 -1
- package/build/types/src/utils/numbers.d.ts +6 -3
- package/build/types/src/utils/orderTransactions.d.ts +6 -4
- package/build/types/src/utils/positions.d.ts +30 -0
- package/build/types/src/utils/prices.d.ts +4 -0
- package/build/types/src/utils/swap/swapValues.d.ts +1 -1
- package/build/types/src/utils/trade/decrease.d.ts +77 -0
- package/build/types/src/utils/trade/{amounts.d.ts → increase.d.ts} +16 -1
- package/package.json +2 -2
|
@@ -104,6 +104,13 @@ export type TokenPrices = {
|
|
|
104
104
|
};
|
|
105
105
|
export type TokenData = Token & {
|
|
106
106
|
prices: TokenPrices;
|
|
107
|
+
isGmxAccount?: boolean;
|
|
108
|
+
walletBalance?: bigint;
|
|
109
|
+
gmxAccountBalance?: bigint;
|
|
110
|
+
/**
|
|
111
|
+
* If isGmxAccount is true, then this is the gmx account balance
|
|
112
|
+
* If isGmxAccount is false, then this is the wallet balance
|
|
113
|
+
*/
|
|
107
114
|
balance?: bigint;
|
|
108
115
|
totalSupply?: bigint;
|
|
109
116
|
hasPriceFeedProvider?: boolean;
|
|
@@ -63,6 +63,7 @@ export type IncreasePositionAmounts = {
|
|
|
63
63
|
triggerThresholdType?: TriggerThresholdType;
|
|
64
64
|
acceptablePrice: bigint;
|
|
65
65
|
acceptablePriceDeltaBps: bigint;
|
|
66
|
+
recommendedAcceptablePriceDeltaBps: bigint;
|
|
66
67
|
positionFeeUsd: bigint;
|
|
67
68
|
uiFeeUsd: bigint;
|
|
68
69
|
swapUiFeeUsd: bigint;
|
|
@@ -94,8 +95,11 @@ export type DecreasePositionAmounts = {
|
|
|
94
95
|
borrowingFeeUsd: bigint;
|
|
95
96
|
fundingFeeUsd: bigint;
|
|
96
97
|
swapProfitFeeUsd: bigint;
|
|
97
|
-
|
|
98
|
+
proportionalPendingImpactDeltaUsd: bigint;
|
|
99
|
+
closePriceImpactDeltaUsd: bigint;
|
|
100
|
+
totalPendingImpactDeltaUsd: bigint;
|
|
98
101
|
priceImpactDiffUsd: bigint;
|
|
102
|
+
balanceWasImproved: boolean;
|
|
99
103
|
payedRemainingCollateralAmount: bigint;
|
|
100
104
|
payedOutputUsd: bigint;
|
|
101
105
|
payedRemainingCollateralUsd: bigint;
|
|
@@ -140,6 +144,8 @@ export type NextPositionValues = {
|
|
|
140
144
|
nextPnlPercentage?: bigint;
|
|
141
145
|
nextEntryPrice?: bigint;
|
|
142
146
|
remainingCollateralFeesUsd?: bigint;
|
|
147
|
+
nextPendingImpactDeltaUsd?: bigint;
|
|
148
|
+
potentialPriceImpactDiffUsd?: bigint;
|
|
143
149
|
};
|
|
144
150
|
export type SwapStats = {
|
|
145
151
|
marketAddress: string;
|
|
@@ -267,9 +273,14 @@ export type TradeFees = {
|
|
|
267
273
|
swapFees?: SwapFeeItem[];
|
|
268
274
|
positionFee?: FeeItem;
|
|
269
275
|
swapPriceImpact?: FeeItem;
|
|
270
|
-
positionPriceImpact?: FeeItem;
|
|
271
|
-
priceImpactDiff?: FeeItem;
|
|
272
276
|
positionCollateralPriceImpact?: FeeItem;
|
|
277
|
+
proportionalPendingImpact?: FeeItem;
|
|
278
|
+
increasePositionPriceImpact?: FeeItem;
|
|
279
|
+
decreasePositionPriceImpact?: FeeItem;
|
|
280
|
+
totalPendingImpact?: FeeItem;
|
|
281
|
+
priceImpactDiff?: FeeItem;
|
|
282
|
+
positionNetPriceImpact?: FeeItem;
|
|
283
|
+
collateralNetPriceImpact?: FeeItem;
|
|
273
284
|
collateralPriceImpactDiff?: FeeItem;
|
|
274
285
|
positionFeeFactor?: bigint;
|
|
275
286
|
borrowFee?: FeeItem;
|
|
@@ -10,6 +10,7 @@ export declare enum TradeActionType {
|
|
|
10
10
|
}
|
|
11
11
|
export type PositionTradeAction = {
|
|
12
12
|
id: string;
|
|
13
|
+
srcChainId?: number;
|
|
13
14
|
eventName: TradeActionType;
|
|
14
15
|
marketInfo: MarketInfo;
|
|
15
16
|
marketAddress: string;
|
|
@@ -42,6 +43,7 @@ export type PositionTradeAction = {
|
|
|
42
43
|
reason?: string;
|
|
43
44
|
reasonBytes?: string | Uint8Array;
|
|
44
45
|
shouldUnwrapNativeToken: boolean;
|
|
46
|
+
totalImpactUsd?: bigint;
|
|
45
47
|
liquidationFeeAmount?: bigint;
|
|
46
48
|
twapParams: {
|
|
47
49
|
twapGroupId: string;
|
|
@@ -54,6 +56,7 @@ export type PositionTradeAction = {
|
|
|
54
56
|
};
|
|
55
57
|
export type SwapTradeAction = {
|
|
56
58
|
id: string;
|
|
59
|
+
srcChainId?: number;
|
|
57
60
|
account: string;
|
|
58
61
|
eventName: TradeActionType;
|
|
59
62
|
initialCollateralTokenAddress: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export declare const bigMath: {
|
|
2
2
|
abs(x: bigint): bigint;
|
|
3
|
-
mulDiv(x: bigint, y: bigint, z: bigint): bigint;
|
|
3
|
+
mulDiv(x: bigint, y: bigint, z: bigint, roundUpMagnitude?: boolean): bigint;
|
|
4
4
|
max(max: bigint, ...rest: bigint[]): bigint;
|
|
5
5
|
min(min: bigint, ...rest: bigint[]): bigint;
|
|
6
6
|
avg(...values: (bigint | undefined)[]): bigint | undefined;
|
|
7
7
|
divRound(x: bigint, y: bigint): bigint;
|
|
8
8
|
divRoundUp(x: bigint, y: bigint): bigint;
|
|
9
|
+
mulmod(x: bigint, y: bigint, m: bigint): bigint;
|
|
9
10
|
};
|
|
@@ -48,3 +48,14 @@ export declare function extendError(error: ErrorLike, params: {
|
|
|
48
48
|
}): ErrorLike;
|
|
49
49
|
export declare function parseError(error: ErrorLike | string | undefined, errorDepth?: number): ErrorData | undefined;
|
|
50
50
|
export declare function isContractError(error: ErrorData, errorType: CustomErrorName): boolean;
|
|
51
|
+
export declare class CustomError extends Error {
|
|
52
|
+
isGmxCustomError: boolean;
|
|
53
|
+
args: any;
|
|
54
|
+
constructor({ name, message, args }: {
|
|
55
|
+
name: string;
|
|
56
|
+
message: string;
|
|
57
|
+
args: any;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export declare function isCustomError(error: Error | undefined): error is CustomError;
|
|
61
|
+
export declare function getCustomError(error: Error): CustomError | Error;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ContractsChainId } from "../../configs/chains";
|
|
1
2
|
import { ExecutionFee, GasLimitsConfig, L1ExpressOrderGasReference } from "../../types/fees";
|
|
2
3
|
import { DecreasePositionSwapType } from "../../types/orders";
|
|
3
4
|
import { TokenData, TokensData } from "../../types/tokens";
|
|
@@ -15,15 +16,17 @@ export declare function approximateL1GasBuffer({ l1Reference, sizeOfData, }: {
|
|
|
15
16
|
l1Reference: L1ExpressOrderGasReference;
|
|
16
17
|
sizeOfData: bigint;
|
|
17
18
|
}): bigint;
|
|
18
|
-
export declare function estimateBatchGasLimit({ gasLimits, createOrdersCount, updateOrdersCount, cancelOrdersCount, externalCallsGasLimit, }: {
|
|
19
|
+
export declare function estimateBatchGasLimit({ gasLimits, createOrdersCount, updateOrdersCount, cancelOrdersCount, externalCallsGasLimit, isGmxAccount, }: {
|
|
19
20
|
gasLimits: GasLimitsConfig;
|
|
20
21
|
createOrdersCount: number;
|
|
21
22
|
updateOrdersCount: number;
|
|
22
23
|
cancelOrdersCount: number;
|
|
23
24
|
externalCallsGasLimit: bigint;
|
|
25
|
+
isGmxAccount: boolean;
|
|
24
26
|
}): bigint;
|
|
25
|
-
export declare function estimateBatchMinGasPaymentTokenAmount({ chainId, gasPaymentToken, relayFeeToken, gasPrice, gasLimits, l1Reference, tokensData, createOrdersCount, updateOrdersCount, cancelOrdersCount, executionFeeAmount, }: {
|
|
26
|
-
chainId:
|
|
27
|
+
export declare function estimateBatchMinGasPaymentTokenAmount({ chainId, gasPaymentToken, isGmxAccount, relayFeeToken, gasPrice, gasLimits, l1Reference, tokensData, createOrdersCount, updateOrdersCount, cancelOrdersCount, executionFeeAmount, }: {
|
|
28
|
+
chainId: ContractsChainId;
|
|
29
|
+
isGmxAccount: boolean;
|
|
27
30
|
gasLimits: GasLimitsConfig;
|
|
28
31
|
gasPaymentToken: TokenData;
|
|
29
32
|
relayFeeToken: TokenData;
|
|
@@ -4,8 +4,8 @@ import { SwapStats } from "../../types/trade";
|
|
|
4
4
|
export * from "./estimateOraclePriceCount";
|
|
5
5
|
export * from "./executionFee";
|
|
6
6
|
export * from "./priceImpact";
|
|
7
|
-
export declare function getSwapFee(marketInfo: MarketInfo, swapAmount: bigint,
|
|
8
|
-
export declare function getPositionFee(marketInfo: MarketInfo, sizeDeltaUsd: bigint,
|
|
7
|
+
export declare function getSwapFee(marketInfo: MarketInfo, swapAmount: bigint, balanceWasImproved: boolean, isAtomicSwap: boolean): bigint;
|
|
8
|
+
export declare function getPositionFee(marketInfo: MarketInfo, sizeDeltaUsd: bigint, balanceWasImproved: boolean, referralInfo: {
|
|
9
9
|
totalRebateFactor: bigint;
|
|
10
10
|
discountFactor: bigint;
|
|
11
11
|
} | undefined, uiFeeFactor?: bigint): {
|
|
@@ -16,15 +16,40 @@ export declare function applySwapImpactWithCap(marketInfo: MarketInfo, token: To
|
|
|
16
16
|
impactDeltaAmount: bigint;
|
|
17
17
|
cappedDiffUsd: bigint;
|
|
18
18
|
};
|
|
19
|
-
export declare function getCappedPositionImpactUsd(marketInfo: MarketInfo, sizeDeltaUsd: bigint, isLong: boolean, opts?: {
|
|
19
|
+
export declare function getCappedPositionImpactUsd(marketInfo: MarketInfo, sizeDeltaUsd: bigint, isLong: boolean, isIncrease: boolean, opts?: {
|
|
20
20
|
fallbackToZero?: boolean;
|
|
21
|
-
|
|
21
|
+
shouldCapNegativeImpact?: boolean;
|
|
22
|
+
}): {
|
|
23
|
+
priceImpactDeltaUsd: bigint;
|
|
24
|
+
balanceWasImproved: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare function capPositionImpactUsdByMaxImpactPool(marketInfo: MarketInfo, positionImpactDeltaUsd: bigint): bigint;
|
|
27
|
+
export declare function capPositionImpactUsdByMaxPriceImpactFactor(marketInfo: MarketInfo, sizeDeltaUsd: bigint, positionImpactDeltaUsd: bigint): bigint;
|
|
28
|
+
export declare function getMaxPositionImpactFactors(marketInfo: MarketInfo): {
|
|
29
|
+
maxPositiveImpactFactor: bigint;
|
|
30
|
+
maxNegativeImpactFactor: bigint;
|
|
31
|
+
};
|
|
22
32
|
export declare function getPriceImpactForPosition(marketInfo: MarketInfo, sizeDeltaUsd: bigint, isLong: boolean, opts?: {
|
|
23
33
|
fallbackToZero?: boolean;
|
|
24
|
-
}):
|
|
34
|
+
}): {
|
|
35
|
+
priceImpactDeltaUsd: bigint;
|
|
36
|
+
balanceWasImproved: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare function getProportionalPendingImpactValues({ sizeInUsd, pendingImpactAmount, sizeDeltaUsd, indexToken, }: {
|
|
39
|
+
sizeInUsd: bigint;
|
|
40
|
+
pendingImpactAmount: bigint;
|
|
41
|
+
sizeDeltaUsd: bigint;
|
|
42
|
+
indexToken: TokenData;
|
|
43
|
+
}): {
|
|
44
|
+
proportionalPendingImpactDeltaAmount: bigint;
|
|
45
|
+
proportionalPendingImpactDeltaUsd: bigint;
|
|
46
|
+
};
|
|
25
47
|
export declare function getPriceImpactForSwap(marketInfo: MarketInfo, tokenA: TokenData, tokenB: TokenData, usdDeltaTokenA: bigint, usdDeltaTokenB: bigint, opts?: {
|
|
26
48
|
fallbackToZero?: boolean;
|
|
27
|
-
}):
|
|
49
|
+
}): {
|
|
50
|
+
priceImpactDeltaUsd: bigint;
|
|
51
|
+
balanceWasImproved: boolean;
|
|
52
|
+
};
|
|
28
53
|
export declare function getNextPoolAmountsParams(p: {
|
|
29
54
|
marketInfo: MarketInfo;
|
|
30
55
|
longToken: TokenData;
|
|
@@ -51,7 +76,10 @@ export declare function getPriceImpactUsd(p: {
|
|
|
51
76
|
factorNegative: bigint;
|
|
52
77
|
exponentFactor: bigint;
|
|
53
78
|
fallbackToZero?: boolean;
|
|
54
|
-
}):
|
|
79
|
+
}): {
|
|
80
|
+
priceImpactDeltaUsd: bigint;
|
|
81
|
+
balanceWasImproved: boolean;
|
|
82
|
+
};
|
|
55
83
|
/**
|
|
56
84
|
* @see https://github.com/gmx-io/gmx-synthetics/blob/5fd9991ff2c37ae5f24f03bc9c132730b012ebf2/contracts/pricing/PricingUtils.sol
|
|
57
85
|
*/
|
|
@@ -29,19 +29,24 @@ export declare function hashMarketConfigKeys(market: MarketConfig): {
|
|
|
29
29
|
maxFundingFactorPerSecond: string;
|
|
30
30
|
maxPnlFactorForTradersLong: string;
|
|
31
31
|
maxPnlFactorForTradersShort: string;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
positionFeeFactorForBalanceWasImproved: string;
|
|
33
|
+
positionFeeFactorForBalanceWasNotImproved: string;
|
|
34
34
|
positionImpactFactorPositive: string;
|
|
35
35
|
positionImpactFactorNegative: string;
|
|
36
36
|
maxPositionImpactFactorPositive: string;
|
|
37
37
|
maxPositionImpactFactorNegative: string;
|
|
38
38
|
maxPositionImpactFactorForLiquidations: string;
|
|
39
|
+
maxLendableImpactFactor: string;
|
|
40
|
+
maxLendableImpactFactorForWithdrawals: string;
|
|
41
|
+
maxLendableImpactUsd: string;
|
|
42
|
+
lentPositionImpactPoolAmount: string;
|
|
39
43
|
minCollateralFactor: string;
|
|
44
|
+
minCollateralFactorForLiquidation: string;
|
|
40
45
|
minCollateralFactorForOpenInterestLong: string;
|
|
41
46
|
minCollateralFactorForOpenInterestShort: string;
|
|
42
47
|
positionImpactExponentFactor: string;
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
swapFeeFactorForBalanceWasImproved: string;
|
|
49
|
+
swapFeeFactorForBalanceWasNotImproved: string;
|
|
45
50
|
atomicSwapFeeFactor: string;
|
|
46
51
|
swapImpactFactorPositive: string;
|
|
47
52
|
swapImpactFactorNegative: string;
|
|
@@ -13,6 +13,13 @@ export declare function getMarketIndexName(p: ({
|
|
|
13
13
|
}) & {
|
|
14
14
|
isSpotOnly: boolean;
|
|
15
15
|
}): string;
|
|
16
|
+
export declare function getMarketBaseName(p: ({
|
|
17
|
+
indexToken: Token;
|
|
18
|
+
} | {
|
|
19
|
+
glvToken: Token;
|
|
20
|
+
}) & {
|
|
21
|
+
isSpotOnly: boolean;
|
|
22
|
+
}): string;
|
|
16
23
|
export declare function getMarketPoolName(p: {
|
|
17
24
|
longToken: Token;
|
|
18
25
|
shortToken: Token;
|
|
@@ -12,7 +12,7 @@ export declare class Multicall {
|
|
|
12
12
|
};
|
|
13
13
|
static getInstance(sdk: GmxSdk): Promise<Multicall>;
|
|
14
14
|
constructor(sdk: GmxSdk);
|
|
15
|
-
get chainId(): import("../configs/chains").
|
|
15
|
+
get chainId(): import("../configs/chains").ContractsChainId;
|
|
16
16
|
call(request: MulticallRequestConfig<any>, maxTimeout: number): Promise<MulticallResult<any>>;
|
|
17
17
|
}
|
|
18
18
|
export type SkipKey = null | undefined | false;
|
|
@@ -67,13 +67,16 @@ export declare function formatRatePercentage(rate?: bigint, opts?: {
|
|
|
67
67
|
export declare function formatUsdPrice(price?: bigint, opts?: Parameters<typeof formatUsd>[1]): string | undefined;
|
|
68
68
|
export declare function formatPercentageDisplay(percentage: number, hideThreshold?: number): string;
|
|
69
69
|
export declare function formatAmountHuman(amount: BigNumberish | undefined, tokenDecimals: number, showDollar?: boolean, displayDecimals?: number): string;
|
|
70
|
-
export declare function formatBalanceAmount(amount: bigint, tokenDecimals: number, tokenSymbol?: string, { showZero, toExponential, isStable, }?: {
|
|
70
|
+
export declare function formatBalanceAmount(amount: bigint, tokenDecimals: number, tokenSymbol?: string, { showZero, toExponential, isStable, signed, }?: {
|
|
71
71
|
showZero?: boolean;
|
|
72
72
|
toExponential?: boolean;
|
|
73
73
|
isStable?: boolean;
|
|
74
|
+
signed?: boolean;
|
|
74
75
|
}): string;
|
|
75
76
|
export declare function formatFactor(factor: bigint): string;
|
|
76
|
-
export declare function numberWithCommas(x: BigNumberish
|
|
77
|
+
export declare function numberWithCommas(x: BigNumberish, { showDollar }?: {
|
|
78
|
+
showDollar?: boolean;
|
|
79
|
+
}): string;
|
|
77
80
|
export declare const formatAmount: (amount: BigNumberish | undefined, tokenDecimals: number, displayDecimals?: number, useCommas?: boolean, defaultValue?: string, visualMultiplier?: number) => string;
|
|
78
81
|
export declare const formatKeyAmount: <T extends {}>(map: T | undefined, key: keyof T, tokenDecimals: number, displayDecimals: number, useCommas?: boolean) => string;
|
|
79
82
|
export declare const formatArrayAmount: (arr: any[], index: number, tokenDecimals: number, displayDecimals?: number, useCommas?: boolean) => string;
|
|
@@ -122,7 +125,7 @@ type DeserializeBigIntInObject<T> = {
|
|
|
122
125
|
};
|
|
123
126
|
export declare function serializeBigIntsInObject<T extends object>(obj: T): SerializedBigIntsInObject<T>;
|
|
124
127
|
export declare function deserializeBigIntsInObject<T extends object>(obj: T): DeserializeBigIntInObject<T>;
|
|
125
|
-
export declare function calculateDisplayDecimals(price?: bigint, decimals?: number, visualMultiplier?: number, isStable?: boolean):
|
|
128
|
+
export declare function calculateDisplayDecimals(price?: bigint, decimals?: number, visualMultiplier?: number, isStable?: boolean): 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
126
129
|
export declare function clamp(value: number, min: number, max: number): number;
|
|
127
130
|
export declare function absDiffBps(value: bigint, base: bigint): bigint;
|
|
128
131
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ContractsChainId } from "../configs/chains";
|
|
1
2
|
import { ExecutionFee } from "../types/fees";
|
|
2
3
|
import { DecreasePositionSwapType, OrderType } from "../types/orders";
|
|
3
4
|
import { ContractPrice, ERC20Address, TokensData } from "../types/tokens";
|
|
@@ -54,9 +55,10 @@ export type CreateOrderPayload = {
|
|
|
54
55
|
shouldUnwrapNativeToken: boolean;
|
|
55
56
|
autoCancel: boolean;
|
|
56
57
|
referralCode: string;
|
|
58
|
+
dataList: string[];
|
|
57
59
|
};
|
|
58
60
|
export type UpdateOrderParams = {
|
|
59
|
-
chainId:
|
|
61
|
+
chainId: ContractsChainId;
|
|
60
62
|
indexTokenAddress: string;
|
|
61
63
|
orderKey: string;
|
|
62
64
|
orderType: OrderType;
|
|
@@ -105,7 +107,7 @@ export type ExternalCallsPayload = {
|
|
|
105
107
|
refundReceivers: string[];
|
|
106
108
|
};
|
|
107
109
|
export type CommonOrderParams = {
|
|
108
|
-
chainId:
|
|
110
|
+
chainId: ContractsChainId;
|
|
109
111
|
receiver: string;
|
|
110
112
|
executionFeeAmount: bigint;
|
|
111
113
|
executionGasLimit: bigint;
|
|
@@ -170,7 +172,7 @@ export declare function getBatchTotalPayCollateralAmount(batchParams: BatchOrder
|
|
|
170
172
|
};
|
|
171
173
|
export declare function getBatchExternalSwapGasLimit(batchParams: BatchOrderTxnParams): bigint;
|
|
172
174
|
export declare function buildTokenTransfersParamsForDecrease({ chainId, executionFeeAmount, collateralTokenAddress, collateralDeltaAmount, swapPath, minOutputUsd, receiveTokenAddress, }: {
|
|
173
|
-
chainId:
|
|
175
|
+
chainId: ContractsChainId;
|
|
174
176
|
executionFeeAmount: bigint;
|
|
175
177
|
collateralTokenAddress: string;
|
|
176
178
|
collateralDeltaAmount: bigint;
|
|
@@ -179,7 +181,7 @@ export declare function buildTokenTransfersParamsForDecrease({ chainId, executio
|
|
|
179
181
|
minOutputUsd: bigint;
|
|
180
182
|
}): TokenTransfersParams;
|
|
181
183
|
export declare function buildTokenTransfersParamsForIncreaseOrSwap({ chainId, receiver, payTokenAddress, payTokenAmount, receiveTokenAddress, executionFeeAmount, externalSwapQuote, minOutputAmount, swapPath, }: {
|
|
182
|
-
chainId:
|
|
184
|
+
chainId: ContractsChainId;
|
|
183
185
|
receiver: string;
|
|
184
186
|
payTokenAddress: string;
|
|
185
187
|
payTokenAmount: bigint;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MarketInfo } from "../types/markets";
|
|
2
|
+
import { PositionInfoLoaded } from "../types/positions";
|
|
2
3
|
import { UserReferralInfo } from "../types/referrals";
|
|
3
4
|
import { Token, TokenData } from "../types/tokens";
|
|
4
5
|
export declare function getPositionKey(account: string, marketAddress: string, collateralAddress: string, isLong: boolean): string;
|
|
@@ -30,6 +31,8 @@ export declare function getPositionPendingFeesUsd(p: {
|
|
|
30
31
|
pendingBorrowingFeesUsd: bigint;
|
|
31
32
|
}): bigint;
|
|
32
33
|
export declare function getPositionNetValue(p: {
|
|
34
|
+
totalPendingImpactDeltaUsd: bigint;
|
|
35
|
+
priceImpactDiffUsd: bigint;
|
|
33
36
|
collateralUsd: bigint;
|
|
34
37
|
pendingFundingFeesUsd: bigint;
|
|
35
38
|
pendingBorrowingFeesUsd: bigint;
|
|
@@ -37,6 +40,15 @@ export declare function getPositionNetValue(p: {
|
|
|
37
40
|
closingFeeUsd: bigint;
|
|
38
41
|
uiFeeUsd: bigint;
|
|
39
42
|
}): bigint;
|
|
43
|
+
export declare function getPositionPnlAfterFees({ pnl, pendingBorrowingFeesUsd, pendingFundingFeesUsd, closingFeeUsd, uiFeeUsd, totalPendingImpactDeltaUsd, priceImpactDiffUsd, }: {
|
|
44
|
+
pnl: bigint;
|
|
45
|
+
pendingBorrowingFeesUsd: bigint;
|
|
46
|
+
pendingFundingFeesUsd: bigint;
|
|
47
|
+
closingFeeUsd: bigint;
|
|
48
|
+
uiFeeUsd: bigint;
|
|
49
|
+
totalPendingImpactDeltaUsd: bigint;
|
|
50
|
+
priceImpactDiffUsd: bigint;
|
|
51
|
+
}): bigint;
|
|
40
52
|
export declare function getLeverage(p: {
|
|
41
53
|
sizeInUsd: bigint;
|
|
42
54
|
collateralUsd: bigint;
|
|
@@ -53,8 +65,26 @@ export declare function getLiquidationPrice(p: {
|
|
|
53
65
|
marketInfo: MarketInfo;
|
|
54
66
|
pendingFundingFeesUsd: bigint;
|
|
55
67
|
pendingBorrowingFeesUsd: bigint;
|
|
68
|
+
pendingImpactAmount: bigint;
|
|
56
69
|
minCollateralUsd: bigint;
|
|
57
70
|
isLong: boolean;
|
|
58
71
|
useMaxPriceImpact?: boolean;
|
|
59
72
|
userReferralInfo: UserReferralInfo | undefined;
|
|
60
73
|
}): bigint | undefined;
|
|
74
|
+
export declare function getNetPriceImpactDeltaUsdForDecrease({ marketInfo, sizeInUsd, pendingImpactAmount, priceImpactDeltaUsd, sizeDeltaUsd, }: {
|
|
75
|
+
marketInfo: MarketInfo;
|
|
76
|
+
sizeInUsd: bigint;
|
|
77
|
+
pendingImpactAmount: bigint;
|
|
78
|
+
sizeDeltaUsd: bigint;
|
|
79
|
+
priceImpactDeltaUsd: bigint;
|
|
80
|
+
}): {
|
|
81
|
+
totalImpactDeltaUsd: bigint;
|
|
82
|
+
proportionalPendingImpactDeltaUsd: bigint;
|
|
83
|
+
priceImpactDiffUsd: bigint;
|
|
84
|
+
};
|
|
85
|
+
export declare function getPriceImpactDiffUsd({ totalImpactDeltaUsd, marketInfo, sizeDeltaUsd, }: {
|
|
86
|
+
totalImpactDeltaUsd: bigint;
|
|
87
|
+
marketInfo: MarketInfo;
|
|
88
|
+
sizeDeltaUsd: bigint;
|
|
89
|
+
}): bigint;
|
|
90
|
+
export declare function getMinCollateralFactorForPosition(position: PositionInfoLoaded, openInterestDelta: bigint): bigint;
|
|
@@ -12,6 +12,7 @@ export declare function getOrderThresholdType(orderType: OrderType, isLong: bool
|
|
|
12
12
|
export declare function getAcceptablePriceInfo(p: {
|
|
13
13
|
marketInfo: MarketInfo;
|
|
14
14
|
isIncrease: boolean;
|
|
15
|
+
isLimit: boolean;
|
|
15
16
|
isLong: boolean;
|
|
16
17
|
indexPrice: bigint;
|
|
17
18
|
sizeDeltaUsd: bigint;
|
|
@@ -19,9 +20,12 @@ export declare function getAcceptablePriceInfo(p: {
|
|
|
19
20
|
}): {
|
|
20
21
|
acceptablePrice: bigint;
|
|
21
22
|
acceptablePriceDeltaBps: bigint;
|
|
23
|
+
cappedPriceImpactDeltaUsd: bigint;
|
|
24
|
+
cappedPriceImpactDeltaAmount: bigint;
|
|
22
25
|
priceImpactDeltaAmount: bigint;
|
|
23
26
|
priceImpactDeltaUsd: bigint;
|
|
24
27
|
priceImpactDiffUsd: bigint;
|
|
28
|
+
balanceWasImproved: boolean;
|
|
25
29
|
};
|
|
26
30
|
export declare function getAcceptablePriceByPriceImpact(p: {
|
|
27
31
|
isIncrease: boolean;
|
|
@@ -30,4 +30,4 @@ export declare function getSwapAmountsByToValue(p: {
|
|
|
30
30
|
externalSwapQuoteParams: ExternalSwapQuoteParams | undefined;
|
|
31
31
|
findSwapPath: FindSwapPath;
|
|
32
32
|
}): SwapAmounts;
|
|
33
|
-
export declare function getSwapPathComparator(order?: SwapOptimizationOrderArray | undefined): (a: SwapRoute, b: SwapRoute) =>
|
|
33
|
+
export declare function getSwapPathComparator(order?: SwapOptimizationOrderArray | undefined): (a: SwapRoute, b: SwapRoute) => 0 | 1 | -1;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { MarketInfo } from "../../types/markets";
|
|
2
|
+
import { PositionInfo, PositionInfoLoaded } from "../../types/positions";
|
|
3
|
+
import { UserReferralInfo } from "../../types/referrals";
|
|
4
|
+
import { TokenData } from "../../types/tokens";
|
|
5
|
+
import { DecreasePositionAmounts, NextPositionValues } from "../../types/trade";
|
|
6
|
+
export declare function getDecreasePositionAmounts(p: {
|
|
7
|
+
marketInfo: MarketInfo;
|
|
8
|
+
collateralToken: TokenData;
|
|
9
|
+
isLong: boolean;
|
|
10
|
+
position: PositionInfoLoaded | undefined;
|
|
11
|
+
closeSizeUsd: bigint;
|
|
12
|
+
keepLeverage: boolean;
|
|
13
|
+
triggerPrice?: bigint;
|
|
14
|
+
fixedAcceptablePriceImpactBps?: bigint;
|
|
15
|
+
acceptablePriceImpactBuffer?: number;
|
|
16
|
+
userReferralInfo: UserReferralInfo | undefined;
|
|
17
|
+
minCollateralUsd: bigint;
|
|
18
|
+
minPositionSizeUsd: bigint;
|
|
19
|
+
uiFeeFactor: bigint;
|
|
20
|
+
isLimit?: boolean;
|
|
21
|
+
limitPrice?: bigint;
|
|
22
|
+
triggerOrderType?: DecreasePositionAmounts["triggerOrderType"];
|
|
23
|
+
receiveToken?: TokenData;
|
|
24
|
+
}): DecreasePositionAmounts;
|
|
25
|
+
export declare function getIsFullClose(p: {
|
|
26
|
+
position: PositionInfoLoaded;
|
|
27
|
+
sizeDeltaUsd: bigint;
|
|
28
|
+
indexPrice: bigint;
|
|
29
|
+
remainingCollateralUsd: bigint;
|
|
30
|
+
minCollateralUsd: bigint;
|
|
31
|
+
minPositionSizeUsd: bigint;
|
|
32
|
+
}): boolean;
|
|
33
|
+
export declare function getMinCollateralUsdForLeverage(position: PositionInfoLoaded, openInterestDelta: bigint): bigint;
|
|
34
|
+
export declare function payForCollateralCost(p: {
|
|
35
|
+
initialCostUsd: bigint;
|
|
36
|
+
collateralToken: TokenData;
|
|
37
|
+
collateralPrice: bigint;
|
|
38
|
+
outputAmount: bigint;
|
|
39
|
+
remainingCollateralAmount: bigint;
|
|
40
|
+
}): {
|
|
41
|
+
outputAmount: bigint;
|
|
42
|
+
remainingCollateralAmount: bigint;
|
|
43
|
+
paidOutputAmount: bigint;
|
|
44
|
+
paidRemainingCollateralAmount: bigint;
|
|
45
|
+
};
|
|
46
|
+
export declare function estimateCollateralCost(baseUsd: bigint, collateralToken: TokenData, collateralPrice: bigint): {
|
|
47
|
+
amount: bigint;
|
|
48
|
+
usd: bigint;
|
|
49
|
+
};
|
|
50
|
+
export declare function getTotalFeesUsdForDecrease({ positionFeeUsd, borrowingFeeUsd, fundingFeeUsd, swapProfitFeeUsd, swapUiFeeUsd, uiFeeUsd, pnlUsd, totalPendingImpactDeltaUsd, }: {
|
|
51
|
+
positionFeeUsd: bigint;
|
|
52
|
+
borrowingFeeUsd: bigint;
|
|
53
|
+
fundingFeeUsd: bigint;
|
|
54
|
+
swapProfitFeeUsd: bigint;
|
|
55
|
+
swapUiFeeUsd: bigint;
|
|
56
|
+
uiFeeUsd: bigint;
|
|
57
|
+
pnlUsd: bigint;
|
|
58
|
+
totalPendingImpactDeltaUsd: bigint;
|
|
59
|
+
}): bigint;
|
|
60
|
+
export declare function getNextPositionValuesForDecreaseTrade(p: {
|
|
61
|
+
existingPosition?: PositionInfo;
|
|
62
|
+
marketInfo: MarketInfo;
|
|
63
|
+
collateralToken: TokenData;
|
|
64
|
+
sizeDeltaUsd: bigint;
|
|
65
|
+
sizeDeltaInTokens: bigint;
|
|
66
|
+
realizedPnl: bigint;
|
|
67
|
+
estimatedPnl: bigint;
|
|
68
|
+
collateralDeltaUsd: bigint;
|
|
69
|
+
collateralDeltaAmount: bigint;
|
|
70
|
+
payedRemainingCollateralUsd: bigint;
|
|
71
|
+
payedRemainingCollateralAmount: bigint;
|
|
72
|
+
proportionalPendingImpactDeltaUsd: bigint;
|
|
73
|
+
showPnlInLeverage: boolean;
|
|
74
|
+
isLong: boolean;
|
|
75
|
+
minCollateralUsd: bigint;
|
|
76
|
+
userReferralInfo: UserReferralInfo | undefined;
|
|
77
|
+
}): NextPositionValues;
|
|
@@ -2,7 +2,7 @@ import { MarketInfo, MarketsInfoData } from "../../types/markets";
|
|
|
2
2
|
import { PositionInfo } from "../../types/positions";
|
|
3
3
|
import { UserReferralInfo } from "../../types/referrals";
|
|
4
4
|
import { TokenData, TokensRatio } from "../../types/tokens";
|
|
5
|
-
import { ExternalSwapQuote, ExternalSwapQuoteParams, FindSwapPath, IncreasePositionAmounts, TriggerThresholdType } from "../../types/trade";
|
|
5
|
+
import { ExternalSwapQuote, ExternalSwapQuoteParams, FindSwapPath, IncreasePositionAmounts, NextPositionValues, TriggerThresholdType } from "../../types/trade";
|
|
6
6
|
type IncreasePositionParams = {
|
|
7
7
|
marketInfo: MarketInfo;
|
|
8
8
|
indexToken: TokenData;
|
|
@@ -70,4 +70,19 @@ export declare function getIncreasePositionPrices({ triggerPrice, indexToken, in
|
|
|
70
70
|
triggerThresholdType: TriggerThresholdType | undefined;
|
|
71
71
|
triggerPrice: bigint | undefined;
|
|
72
72
|
};
|
|
73
|
+
export declare function getNextPositionValuesForIncreaseTrade(p: {
|
|
74
|
+
existingPosition?: PositionInfo;
|
|
75
|
+
marketInfo: MarketInfo;
|
|
76
|
+
collateralToken: TokenData;
|
|
77
|
+
positionPriceImpactDeltaUsd: bigint;
|
|
78
|
+
sizeDeltaUsd: bigint;
|
|
79
|
+
sizeDeltaInTokens: bigint;
|
|
80
|
+
collateralDeltaUsd: bigint;
|
|
81
|
+
collateralDeltaAmount: bigint;
|
|
82
|
+
indexPrice: bigint;
|
|
83
|
+
isLong: boolean;
|
|
84
|
+
showPnlInLeverage: boolean;
|
|
85
|
+
minCollateralUsd: bigint;
|
|
86
|
+
userReferralInfo: UserReferralInfo | undefined;
|
|
87
|
+
}): NextPositionValues;
|
|
73
88
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gmx-io/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./build/cjs/src/index.js",
|
|
6
6
|
"module": "./build/esm/src/index.js",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"query-string": "7.1.1",
|
|
73
73
|
"typescript": "5.4.2",
|
|
74
74
|
"universal-perf-hooks": "1.0.1",
|
|
75
|
-
"viem": "^2.
|
|
75
|
+
"viem": "^2.37.1"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
|