@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
|
@@ -18,7 +18,7 @@ export type MarketValues = Pick<MarketInfo, "longInterestUsd" | "shortInterestUs
|
|
|
18
18
|
/**
|
|
19
19
|
* Updates seldom
|
|
20
20
|
*/
|
|
21
|
-
export type MarketConfig = Pick<MarketInfo, "isDisabled" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "maxLongPoolAmount" | "maxShortPoolAmount" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForDecreaseFunding" | "thresholdForStableFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "
|
|
21
|
+
export type MarketConfig = Pick<MarketInfo, "isDisabled" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "maxLongPoolAmount" | "maxShortPoolAmount" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForDecreaseFunding" | "thresholdForStableFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "minCollateralFactor" | "minCollateralFactorForLiquidation" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionFeeFactorForBalanceWasImproved" | "positionFeeFactorForBalanceWasNotImproved" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "maxLendableImpactFactor" | "maxLendableImpactFactorForWithdrawals" | "maxLendableImpactUsd" | "lentPositionImpactPoolAmount" | "positionImpactExponentFactor" | "swapFeeFactorForBalanceWasImproved" | "swapFeeFactorForBalanceWasNotImproved" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "atomicSwapFeeFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId">;
|
|
22
22
|
export type MarketValuesMulticallRequestConfig = MulticallRequestConfig<{
|
|
23
23
|
[key: `${string}-reader`]: {
|
|
24
24
|
calls: Record<"marketInfo" | "marketTokenPriceMax" | "marketTokenPriceMin", {
|
|
@@ -35,7 +35,7 @@ export type MarketValuesMulticallRequestConfig = MulticallRequestConfig<{
|
|
|
35
35
|
}>;
|
|
36
36
|
export type MarketConfigMulticallRequestConfig = MulticallRequestConfig<{
|
|
37
37
|
[key: `${string}-dataStore`]: {
|
|
38
|
-
calls: Record<"isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "
|
|
38
|
+
calls: Record<"isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "maxFundingFactorPerSecond" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForBalanceWasImproved" | "positionFeeFactorForBalanceWasNotImproved" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "maxLendableImpactFactor" | "maxLendableImpactFactorForWithdrawals" | "maxLendableImpactUsd" | "lentPositionImpactPoolAmount" | "minCollateralFactor" | "minCollateralFactorForLiquidation" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "positionImpactExponentFactor" | "swapFeeFactorForBalanceWasImproved" | "swapFeeFactorForBalanceWasNotImproved" | "atomicSwapFeeFactor" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
39
39
|
methodName: string;
|
|
40
40
|
params: any[];
|
|
41
41
|
}>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Address } from "viem";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import type { ContractsChainId } from "../../configs/chains";
|
|
3
|
+
import type { MarketFilterLongShortDirection, MarketFilterLongShortItemData } from "../trades/trades";
|
|
4
|
+
import type { GasLimitsConfig } from "../../types/fees";
|
|
5
|
+
import type { MarketsInfoData } from "../../types/markets";
|
|
5
6
|
import { DecreasePositionSwapType, Order } from "../../types/orders";
|
|
6
7
|
import { SidecarLimitOrderEntry, SidecarSlTpOrderEntry } from "../../types/sidecarOrders";
|
|
7
|
-
import { TokensData } from "../../types/tokens";
|
|
8
|
+
import type { TokensData } from "../../types/tokens";
|
|
8
9
|
import type { MulticallResult } from "../../utils/multicall";
|
|
9
10
|
import type { GmxSdk } from "../../index";
|
|
10
11
|
export declare const getOrderExecutionFee: (sdk: GmxSdk, swapsCount: number, decreasePositionSwapType: DecreasePositionSwapType | undefined, gasLimits: GasLimitsConfig | undefined, tokensData: TokensData | undefined, gasPrice: bigint | undefined) => import("../../types/fees").ExecutionFee | undefined;
|
|
@@ -21,7 +22,7 @@ export declare function matchByMarket({ order, nonSwapRelevantDefinedFiltersLowe
|
|
|
21
22
|
chainId: number;
|
|
22
23
|
}): boolean;
|
|
23
24
|
export declare const DEFAULT_COUNT = 1000;
|
|
24
|
-
export declare function buildGetOrdersMulticall(chainId:
|
|
25
|
+
export declare function buildGetOrdersMulticall(chainId: ContractsChainId, account: string): {
|
|
25
26
|
dataStore: {
|
|
26
27
|
contractAddress: `0x${string}`;
|
|
27
28
|
abiId: "DataStore";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TokenData } from "./tokens";
|
|
1
|
+
import type { TokenData } from "./tokens";
|
|
2
2
|
export type PnlFactorType = "FOR_DEPOSITS" | "FOR_WITHDRAWALS" | "FOR_TRADERS";
|
|
3
3
|
export type MarketSdkConfig = {
|
|
4
4
|
marketToken: string;
|
|
@@ -57,6 +57,7 @@ export type MarketInfo = Market & MarketPoolTokens & {
|
|
|
57
57
|
minPositionImpactPoolAmount: bigint;
|
|
58
58
|
positionImpactPoolDistributionRate: bigint;
|
|
59
59
|
minCollateralFactor: bigint;
|
|
60
|
+
minCollateralFactorForLiquidation: bigint;
|
|
60
61
|
minCollateralFactorForOpenInterestLong: bigint;
|
|
61
62
|
minCollateralFactorForOpenInterestShort: bigint;
|
|
62
63
|
swapImpactPoolAmountLong: bigint;
|
|
@@ -69,16 +70,20 @@ export type MarketInfo = Market & MarketPoolTokens & {
|
|
|
69
70
|
shortInterestUsd: bigint;
|
|
70
71
|
longInterestInTokens: bigint;
|
|
71
72
|
shortInterestInTokens: bigint;
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
positionFeeFactorForBalanceWasImproved: bigint;
|
|
74
|
+
positionFeeFactorForBalanceWasNotImproved: bigint;
|
|
74
75
|
positionImpactFactorPositive: bigint;
|
|
75
76
|
positionImpactFactorNegative: bigint;
|
|
76
77
|
maxPositionImpactFactorPositive: bigint;
|
|
77
78
|
maxPositionImpactFactorNegative: bigint;
|
|
78
79
|
maxPositionImpactFactorForLiquidations: bigint;
|
|
80
|
+
maxLendableImpactFactor: bigint;
|
|
81
|
+
maxLendableImpactFactorForWithdrawals: bigint;
|
|
82
|
+
maxLendableImpactUsd: bigint;
|
|
83
|
+
lentPositionImpactPoolAmount: bigint;
|
|
79
84
|
positionImpactExponentFactor: bigint;
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
swapFeeFactorForBalanceWasImproved: bigint;
|
|
86
|
+
swapFeeFactorForBalanceWasNotImproved: bigint;
|
|
82
87
|
atomicSwapFeeFactor: bigint;
|
|
83
88
|
swapImpactFactorPositive: bigint;
|
|
84
89
|
swapImpactFactorNegative: bigint;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Market, MarketInfo } from "./markets";
|
|
2
|
-
import { TokenData } from "./tokens";
|
|
1
|
+
import type { Market, MarketInfo } from "./markets";
|
|
2
|
+
import type { TokenData } from "./tokens";
|
|
3
3
|
export type Position = {
|
|
4
4
|
key: string;
|
|
5
5
|
contractKey: string;
|
|
@@ -21,6 +21,23 @@ export type Position = {
|
|
|
21
21
|
positionFeeAmount: bigint;
|
|
22
22
|
traderDiscountAmount: bigint;
|
|
23
23
|
uiFeeAmount: bigint;
|
|
24
|
+
pendingImpactAmount: bigint;
|
|
25
|
+
/**
|
|
26
|
+
* Not implemented in parsing
|
|
27
|
+
*/
|
|
28
|
+
borrowingFactor?: bigint;
|
|
29
|
+
/**
|
|
30
|
+
* Not implemented in parsing
|
|
31
|
+
*/
|
|
32
|
+
fundingFeeAmountPerSize?: bigint;
|
|
33
|
+
/**
|
|
34
|
+
* Not implemented in parsing
|
|
35
|
+
*/
|
|
36
|
+
longTokenClaimableFundingAmountPerSize?: bigint;
|
|
37
|
+
/**
|
|
38
|
+
* Not implemented in parsing
|
|
39
|
+
*/
|
|
40
|
+
shortTokenClaimableFundingAmountPerSize?: bigint;
|
|
24
41
|
data: string;
|
|
25
42
|
};
|
|
26
43
|
export type PositionInfo = Position & {
|
|
@@ -44,6 +61,10 @@ export type PositionInfo = Position & {
|
|
|
44
61
|
pnlPercentage: bigint;
|
|
45
62
|
pnlAfterFees: bigint;
|
|
46
63
|
pnlAfterFeesPercentage: bigint;
|
|
64
|
+
netPriceImapctDeltaUsd: bigint;
|
|
65
|
+
priceImpactDiffUsd: bigint;
|
|
66
|
+
pendingImpactUsd: bigint;
|
|
67
|
+
closePriceImpactDeltaUsd: bigint;
|
|
47
68
|
leverage: bigint | undefined;
|
|
48
69
|
leverageWithPnl: bigint | undefined;
|
|
49
70
|
netValue: bigint;
|
|
@@ -52,6 +73,9 @@ export type PositionInfo = Position & {
|
|
|
52
73
|
pendingFundingFeesUsd: bigint;
|
|
53
74
|
pendingClaimableFundingFeesUsd: bigint;
|
|
54
75
|
};
|
|
76
|
+
export type PositionInfoLoaded = PositionInfo & {
|
|
77
|
+
marketInfo: MarketInfo;
|
|
78
|
+
};
|
|
55
79
|
export type PositionsData = {
|
|
56
80
|
[positionKey: string]: Position;
|
|
57
81
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { PublicClient, WalletClient } from "viem";
|
|
2
|
-
import {
|
|
2
|
+
import type { ContractsChainId } from "../configs/chains";
|
|
3
3
|
import type { MarketSdkConfig } from "./markets";
|
|
4
4
|
import type { Token } from "./tokens";
|
|
5
5
|
export interface GmxSdkConfig {
|
|
6
6
|
/** Chain ID */
|
|
7
|
-
chainId:
|
|
7
|
+
chainId: ContractsChainId;
|
|
8
8
|
/** Account's address */
|
|
9
9
|
account?: string;
|
|
10
10
|
/** GMX Oracle URL */
|