@gmx-io/sdk 1.8.0 → 1.8.2

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.
Files changed (31) hide show
  1. package/build/cjs/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +16 -0
  2. package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +136 -0
  3. package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +30 -0
  4. package/build/cjs/src/configs/express.js +1 -0
  5. package/build/cjs/src/configs/markets.js +14 -0
  6. package/build/cjs/src/configs/tokens.js +22 -0
  7. package/build/cjs/src/utils/express/utils/gelatoRelayUtils.js +2 -0
  8. package/build/cjs/src/utils/express/utils/gmxRelayUtils.js +145 -0
  9. package/build/cjs/src/utils/express/utils/gmxRelayUtils.spec.js +163 -0
  10. package/build/cjs/src/utils/express/utils/index.js +1 -0
  11. package/build/cjs/src/utils/tradeHistory/utils.js +3 -0
  12. package/build/esm/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +16 -0
  13. package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +136 -0
  14. package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +30 -0
  15. package/build/esm/src/configs/express.js +1 -0
  16. package/build/esm/src/configs/markets.js +14 -0
  17. package/build/esm/src/configs/tokens.js +22 -0
  18. package/build/esm/src/utils/express/utils/gelatoRelayUtils.js +2 -0
  19. package/build/esm/src/utils/express/utils/gmxRelayUtils.js +137 -0
  20. package/build/esm/src/utils/express/utils/gmxRelayUtils.spec.js +161 -0
  21. package/build/esm/src/utils/express/utils/index.js +1 -0
  22. package/build/esm/src/utils/tradeHistory/utils.js +3 -0
  23. package/build/tsconfig.tsbuildinfo +1 -1
  24. package/build/types/src/codegen/prebuilt/index.d.ts +182 -0
  25. package/build/types/src/configs/express.d.ts +1 -0
  26. package/build/types/src/utils/express/utils/gelatoRelayUtils.d.ts +2 -0
  27. package/build/types/src/utils/express/utils/gmxRelayUtils.d.ts +61 -0
  28. package/build/types/src/utils/express/utils/gmxRelayUtils.spec.d.ts +1 -0
  29. package/build/types/src/utils/express/utils/index.d.ts +1 -0
  30. package/build/types/src/utils/tradeHistory/types.d.ts +2 -1
  31. package/package.json +1 -1
@@ -2072,6 +2072,36 @@ export declare const HASHED_MARKET_VALUES_KEYS: {
2072
2072
  shortInterestInTokensUsingLongToken: string;
2073
2073
  shortInterestInTokensUsingShortToken: string;
2074
2074
  };
2075
+ "0x1C132E43029efCd57435eE79ceA98006C6227A6f": {
2076
+ longPoolAmount: string;
2077
+ shortPoolAmount: string;
2078
+ positionImpactPoolAmount: string;
2079
+ swapImpactPoolAmountLong: string;
2080
+ swapImpactPoolAmountShort: string;
2081
+ longInterestUsingLongToken: string;
2082
+ longInterestUsingShortToken: string;
2083
+ shortInterestUsingLongToken: string;
2084
+ shortInterestUsingShortToken: string;
2085
+ longInterestInTokensUsingLongToken: string;
2086
+ longInterestInTokensUsingShortToken: string;
2087
+ shortInterestInTokensUsingLongToken: string;
2088
+ shortInterestInTokensUsingShortToken: string;
2089
+ };
2090
+ "0xcBd4c1b0c89D50793c5A3e8d96d98FcB4f1B1c47": {
2091
+ longPoolAmount: string;
2092
+ shortPoolAmount: string;
2093
+ positionImpactPoolAmount: string;
2094
+ swapImpactPoolAmountLong: string;
2095
+ swapImpactPoolAmountShort: string;
2096
+ longInterestUsingLongToken: string;
2097
+ longInterestUsingShortToken: string;
2098
+ shortInterestUsingLongToken: string;
2099
+ shortInterestUsingShortToken: string;
2100
+ longInterestInTokensUsingLongToken: string;
2101
+ longInterestInTokensUsingShortToken: string;
2102
+ shortInterestInTokensUsingLongToken: string;
2103
+ shortInterestInTokensUsingShortToken: string;
2104
+ };
2075
2105
  "0xE26E7b91143f367445f1c0a5dCf4f4aC8EaDcDb1": {
2076
2106
  longPoolAmount: string;
2077
2107
  shortPoolAmount: string;
@@ -12218,6 +12248,142 @@ export declare const HASHED_MARKET_CONFIG_KEYS: {
12218
12248
  virtualLongTokenId: string;
12219
12249
  virtualShortTokenId: string;
12220
12250
  };
12251
+ "0x1C132E43029efCd57435eE79ceA98006C6227A6f": {
12252
+ isDisabled: string;
12253
+ maxLongPoolAmount: string;
12254
+ maxShortPoolAmount: string;
12255
+ maxLongPoolUsdForDeposit: string;
12256
+ maxShortPoolUsdForDeposit: string;
12257
+ reserveFactorLong: string;
12258
+ reserveFactorShort: string;
12259
+ openInterestReserveFactorLong: string;
12260
+ openInterestReserveFactorShort: string;
12261
+ maxOpenInterestLong: string;
12262
+ maxOpenInterestShort: string;
12263
+ maxCollateralSumLongTokenLong: string;
12264
+ maxCollateralSumLongTokenShort: string;
12265
+ maxCollateralSumShortTokenLong: string;
12266
+ maxCollateralSumShortTokenShort: string;
12267
+ minPositionImpactPoolAmount: string;
12268
+ positionImpactPoolDistributionRate: string;
12269
+ borrowingFactorLong: string;
12270
+ borrowingFactorShort: string;
12271
+ borrowingExponentFactorLong: string;
12272
+ borrowingExponentFactorShort: string;
12273
+ fundingFactor: string;
12274
+ fundingExponentFactor: string;
12275
+ fundingIncreaseFactorPerSecond: string;
12276
+ minFundingIncreaseRatePerSecond: string;
12277
+ fundingDecreaseFactorPerSecond: string;
12278
+ thresholdForStableFunding: string;
12279
+ thresholdForDecreaseFunding: string;
12280
+ minFundingFactorPerSecondLong: string;
12281
+ minFundingFactorPerSecondShort: string;
12282
+ maxFundingFactorPerSecondLong: string;
12283
+ maxFundingFactorPerSecondShort: string;
12284
+ maxPnlFactorForTradersLong: string;
12285
+ maxPnlFactorForTradersShort: string;
12286
+ maxPnlFactorForDepositsLong: string;
12287
+ maxPnlFactorForDepositsShort: string;
12288
+ maxPnlFactorForWithdrawalsLong: string;
12289
+ maxPnlFactorForWithdrawalsShort: string;
12290
+ positionFeeFactorForBalanceWasImproved: string;
12291
+ positionFeeFactorForBalanceWasNotImproved: string;
12292
+ positionImpactFactorPositive: string;
12293
+ positionImpactFactorNegative: string;
12294
+ maxPositionImpactFactorPositive: string;
12295
+ maxPositionImpactFactorNegative: string;
12296
+ maxPositionImpactFactorForLiquidations: string;
12297
+ maxLendableImpactFactor: string;
12298
+ maxLendableImpactFactorForWithdrawals: string;
12299
+ maxLendableImpactUsd: string;
12300
+ lentPositionImpactPoolAmount: string;
12301
+ minCollateralFactor: string;
12302
+ minCollateralFactorForLiquidation: string;
12303
+ minCollateralFactorForOpenInterestLong: string;
12304
+ minCollateralFactorForOpenInterestShort: string;
12305
+ positionImpactExponentFactorPositive: string;
12306
+ positionImpactExponentFactorNegative: string;
12307
+ swapFeeFactorForBalanceWasImproved: string;
12308
+ swapFeeFactorForBalanceWasNotImproved: string;
12309
+ atomicSwapFeeFactor: string;
12310
+ swapImpactFactorPositive: string;
12311
+ swapImpactFactorNegative: string;
12312
+ swapImpactExponentFactor: string;
12313
+ withdrawalFeeFactorBalanceWasImproved: string;
12314
+ withdrawalFeeFactorBalanceWasNotImproved: string;
12315
+ virtualMarketId: string;
12316
+ virtualLongTokenId: string;
12317
+ virtualShortTokenId: string;
12318
+ };
12319
+ "0xcBd4c1b0c89D50793c5A3e8d96d98FcB4f1B1c47": {
12320
+ isDisabled: string;
12321
+ maxLongPoolAmount: string;
12322
+ maxShortPoolAmount: string;
12323
+ maxLongPoolUsdForDeposit: string;
12324
+ maxShortPoolUsdForDeposit: string;
12325
+ reserveFactorLong: string;
12326
+ reserveFactorShort: string;
12327
+ openInterestReserveFactorLong: string;
12328
+ openInterestReserveFactorShort: string;
12329
+ maxOpenInterestLong: string;
12330
+ maxOpenInterestShort: string;
12331
+ maxCollateralSumLongTokenLong: string;
12332
+ maxCollateralSumLongTokenShort: string;
12333
+ maxCollateralSumShortTokenLong: string;
12334
+ maxCollateralSumShortTokenShort: string;
12335
+ minPositionImpactPoolAmount: string;
12336
+ positionImpactPoolDistributionRate: string;
12337
+ borrowingFactorLong: string;
12338
+ borrowingFactorShort: string;
12339
+ borrowingExponentFactorLong: string;
12340
+ borrowingExponentFactorShort: string;
12341
+ fundingFactor: string;
12342
+ fundingExponentFactor: string;
12343
+ fundingIncreaseFactorPerSecond: string;
12344
+ minFundingIncreaseRatePerSecond: string;
12345
+ fundingDecreaseFactorPerSecond: string;
12346
+ thresholdForStableFunding: string;
12347
+ thresholdForDecreaseFunding: string;
12348
+ minFundingFactorPerSecondLong: string;
12349
+ minFundingFactorPerSecondShort: string;
12350
+ maxFundingFactorPerSecondLong: string;
12351
+ maxFundingFactorPerSecondShort: string;
12352
+ maxPnlFactorForTradersLong: string;
12353
+ maxPnlFactorForTradersShort: string;
12354
+ maxPnlFactorForDepositsLong: string;
12355
+ maxPnlFactorForDepositsShort: string;
12356
+ maxPnlFactorForWithdrawalsLong: string;
12357
+ maxPnlFactorForWithdrawalsShort: string;
12358
+ positionFeeFactorForBalanceWasImproved: string;
12359
+ positionFeeFactorForBalanceWasNotImproved: string;
12360
+ positionImpactFactorPositive: string;
12361
+ positionImpactFactorNegative: string;
12362
+ maxPositionImpactFactorPositive: string;
12363
+ maxPositionImpactFactorNegative: string;
12364
+ maxPositionImpactFactorForLiquidations: string;
12365
+ maxLendableImpactFactor: string;
12366
+ maxLendableImpactFactorForWithdrawals: string;
12367
+ maxLendableImpactUsd: string;
12368
+ lentPositionImpactPoolAmount: string;
12369
+ minCollateralFactor: string;
12370
+ minCollateralFactorForLiquidation: string;
12371
+ minCollateralFactorForOpenInterestLong: string;
12372
+ minCollateralFactorForOpenInterestShort: string;
12373
+ positionImpactExponentFactorPositive: string;
12374
+ positionImpactExponentFactorNegative: string;
12375
+ swapFeeFactorForBalanceWasImproved: string;
12376
+ swapFeeFactorForBalanceWasNotImproved: string;
12377
+ atomicSwapFeeFactor: string;
12378
+ swapImpactFactorPositive: string;
12379
+ swapImpactFactorNegative: string;
12380
+ swapImpactExponentFactor: string;
12381
+ withdrawalFeeFactorBalanceWasImproved: string;
12382
+ withdrawalFeeFactorBalanceWasNotImproved: string;
12383
+ virtualMarketId: string;
12384
+ virtualLongTokenId: string;
12385
+ virtualShortTokenId: string;
12386
+ };
12221
12387
  "0xE26E7b91143f367445f1c0a5dCf4f4aC8EaDcDb1": {
12222
12388
  isDisabled: string;
12223
12389
  maxLongPoolAmount: string;
@@ -16734,6 +16900,22 @@ export declare const HASHED_KINK_MODEL_MARKET_RATES_KEYS: {
16734
16900
  aboveOptimalUsageBorrowingFactorLong: string;
16735
16901
  aboveOptimalUsageBorrowingFactorShort: string;
16736
16902
  };
16903
+ "0x1C132E43029efCd57435eE79ceA98006C6227A6f": {
16904
+ optimalUsageFactorLong: string;
16905
+ optimalUsageFactorShort: string;
16906
+ baseBorrowingFactorLong: string;
16907
+ baseBorrowingFactorShort: string;
16908
+ aboveOptimalUsageBorrowingFactorLong: string;
16909
+ aboveOptimalUsageBorrowingFactorShort: string;
16910
+ };
16911
+ "0xcBd4c1b0c89D50793c5A3e8d96d98FcB4f1B1c47": {
16912
+ optimalUsageFactorLong: string;
16913
+ optimalUsageFactorShort: string;
16914
+ baseBorrowingFactorLong: string;
16915
+ baseBorrowingFactorShort: string;
16916
+ aboveOptimalUsageBorrowingFactorLong: string;
16917
+ aboveOptimalUsageBorrowingFactorShort: string;
16918
+ };
16737
16919
  "0xE26E7b91143f367445f1c0a5dCf4f4aC8EaDcDb1": {
16738
16920
  optimalUsageFactorLong: string;
16739
16921
  optimalUsageFactorShort: string;
@@ -7,6 +7,7 @@ export declare const DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = 90;
7
7
  export declare const DEFAULT_PERMIT_DEADLINE_DURATION: number;
8
8
  export declare const DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION: number;
9
9
  export declare const MIN_RELAYER_FEE_USD: bigint;
10
+ /** @deprecated Gelato shuts its relay services down on 2026-09-01; use GMX Relay (`sendToGmxRelay`). */
10
11
  export declare const GELATO_API_KEYS: Partial<Record<ContractsChainId, string>>;
11
12
  export declare const EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
12
13
  export declare function getGasPaymentTokens(chainId: number): string[];
@@ -9,10 +9,12 @@ export type GelatoRelayResult = {
9
9
  taskId: string;
10
10
  relayerClient: GelatoEvmRelayerClient;
11
11
  };
12
+ /** @deprecated Gelato shuts its relay services down on 2026-09-01; use `sendToGmxRelay`. */
12
13
  export declare function sendToGelatoRelay({ chainId, txnData, }: {
13
14
  chainId: ContractsChainId;
14
15
  txnData: ExpressTxnData;
15
16
  }): Promise<GelatoRelayResult>;
17
+ /** @deprecated Gelato shuts its relay services down on 2026-09-01; use `waitForGmxRelayTask`. */
16
18
  export declare function waitForGelatoTask(relayerClient: GelatoEvmRelayerClient, taskId: string, options?: {
17
19
  timeout?: number;
18
20
  pollingInterval?: number;
@@ -0,0 +1,61 @@
1
+ import type { ContractsChainId } from "../../../configs/chains";
2
+ import { HttpError } from "../../http/http";
3
+ import type { ExpressTxnData } from "../types";
4
+ export type GmxRelayStatus = "pending" | "executed" | "reverted" | "failed" | "unknown";
5
+ export type GmxRelayResult = {
6
+ taskId: string;
7
+ status: GmxRelayStatus;
8
+ };
9
+ export type GmxRelayDebugView = {
10
+ chainId?: number;
11
+ from?: string | null;
12
+ to?: string;
13
+ operationType?: string;
14
+ account?: string;
15
+ blockNumber?: number | null;
16
+ errorCode?: string | null;
17
+ errorData?: string | null;
18
+ calldata?: string;
19
+ tenderlyUrl?: string;
20
+ };
21
+ export type GmxRelayStatusView = {
22
+ taskId: string;
23
+ status: GmxRelayStatus;
24
+ txHash?: string;
25
+ reason?: string;
26
+ revertData?: string;
27
+ debug?: GmxRelayDebugView | null;
28
+ };
29
+ export type GmxRelayTaskResult = {
30
+ transactionHash?: string;
31
+ status: "success" | "failed" | "pending";
32
+ relayStatus: GmxRelayStatus;
33
+ message?: string;
34
+ revertData?: string;
35
+ };
36
+ export declare class GmxRelayError extends HttpError {
37
+ readonly cause?: unknown;
38
+ data?: {
39
+ traceId: string;
40
+ };
41
+ constructor(message: string, httpStatus?: number, cause?: unknown);
42
+ get isPermanent(): boolean;
43
+ }
44
+ export declare function isPermanentRelayError(error: unknown): boolean;
45
+ export declare function sendToGmxRelay({ chainId, txnData, apiUrl, }: {
46
+ chainId: ContractsChainId;
47
+ txnData: ExpressTxnData;
48
+ apiUrl?: string;
49
+ }): Promise<GmxRelayResult>;
50
+ export declare function getGmxRelayTaskStatus({ chainId, taskId, apiUrl, }: {
51
+ chainId: ContractsChainId;
52
+ taskId: string;
53
+ apiUrl?: string;
54
+ }): Promise<GmxRelayStatusView>;
55
+ export declare function waitForGmxRelayTask({ chainId, taskId, apiUrl, timeout, pollingInterval, }: {
56
+ chainId: ContractsChainId;
57
+ taskId: string;
58
+ apiUrl?: string;
59
+ timeout?: number;
60
+ pollingInterval?: number;
61
+ }): Promise<GmxRelayTaskResult>;
@@ -3,6 +3,7 @@ export * from "./oracleParamsUtils";
3
3
  export * from "./relayParamsUtils";
4
4
  export * from "./batchOrderUtils";
5
5
  export * from "./gelatoRelayUtils";
6
+ export * from "./gmxRelayUtils";
6
7
  export * from "./globalExpressParams";
7
8
  export * from "./expressParamsUtils";
8
9
  export * from "./estimateExpressParams";
@@ -1,5 +1,5 @@
1
1
  import { MarketInfo } from "../markets/types";
2
- import { OrderType } from "../orders/types";
2
+ import { DecreasePositionSwapType, OrderType } from "../orders/types";
3
3
  import { TokenData } from "../tokens/types";
4
4
  export declare enum TradeActionType {
5
5
  OrderCreated = "OrderCreated",
@@ -49,6 +49,7 @@ export type PositionTradeAction = {
49
49
  pnlUsd?: bigint;
50
50
  basePnlUsd?: bigint;
51
51
  orderType: OrderType;
52
+ decreasePositionSwapType?: DecreasePositionSwapType;
52
53
  orderKey: string;
53
54
  isLong: boolean;
54
55
  reason?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmx-io/sdk",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",