@gmx-io/sdk 1.5.0-alpha-7 → 1.5.0-alpha-8

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 (52) hide show
  1. package/build/cjs/src/clients/v2/index.js +38 -9
  2. package/build/cjs/src/configs/express.js +1 -6
  3. package/build/cjs/src/configs/fees.js +9 -0
  4. package/build/cjs/src/utils/apy/api.js +11 -0
  5. package/build/cjs/src/utils/apy/types.js +2 -0
  6. package/build/cjs/src/utils/fees/executionFee.js +11 -3
  7. package/build/cjs/src/utils/markets/api.js +16 -1
  8. package/build/cjs/src/utils/numbers/utils.js +4 -0
  9. package/build/cjs/src/utils/orderTransactions/utils.js +2 -2
  10. package/build/cjs/src/utils/pairs/api.js +7 -0
  11. package/build/cjs/src/utils/pairs/types.js +2 -0
  12. package/build/cjs/src/utils/performance/api.js +21 -0
  13. package/build/cjs/src/utils/performance/types.js +2 -0
  14. package/build/cjs/src/utils/rates/api.js +13 -0
  15. package/build/cjs/src/utils/rates/types.js +2 -0
  16. package/build/cjs/src/utils/swap/swapValues.js +3 -3
  17. package/build/cjs/src/utils/tokens/api.js +7 -0
  18. package/build/esm/src/clients/v2/index.js +30 -1
  19. package/build/esm/src/configs/express.js +1 -6
  20. package/build/esm/src/configs/fees.js +6 -0
  21. package/build/esm/src/utils/apy/api.js +7 -0
  22. package/build/esm/src/utils/apy/types.js +1 -0
  23. package/build/esm/src/utils/fees/executionFee.js +8 -2
  24. package/build/esm/src/utils/markets/api.js +13 -0
  25. package/build/esm/src/utils/numbers/utils.js +4 -0
  26. package/build/esm/src/utils/orderTransactions/utils.js +2 -2
  27. package/build/esm/src/utils/pairs/api.js +3 -0
  28. package/build/esm/src/utils/pairs/types.js +1 -0
  29. package/build/esm/src/utils/performance/api.js +16 -0
  30. package/build/esm/src/utils/performance/types.js +1 -0
  31. package/build/esm/src/utils/rates/api.js +9 -0
  32. package/build/esm/src/utils/rates/types.js +1 -0
  33. package/build/esm/src/utils/swap/swapValues.js +3 -3
  34. package/build/esm/src/utils/tokens/api.js +3 -0
  35. package/build/types/src/clients/v2/index.d.ts +21 -1
  36. package/build/types/src/configs/express.d.ts +0 -4
  37. package/build/types/src/configs/fees.d.ts +4 -0
  38. package/build/types/src/utils/apy/api.d.ts +5 -0
  39. package/build/types/src/utils/apy/types.d.ts +13 -0
  40. package/build/types/src/utils/fees/executionFee.d.ts +2 -0
  41. package/build/types/src/utils/markets/api.d.ts +10 -1
  42. package/build/types/src/utils/numbers/utils.d.ts +1 -0
  43. package/build/types/src/utils/orderTransactions/utils.d.ts +2 -1
  44. package/build/types/src/utils/pairs/api.d.ts +5 -0
  45. package/build/types/src/utils/pairs/types.d.ts +20 -0
  46. package/build/types/src/utils/performance/api.d.ts +8 -0
  47. package/build/types/src/utils/performance/types.d.ts +19 -0
  48. package/build/types/src/utils/rates/api.d.ts +5 -0
  49. package/build/types/src/utils/rates/types.d.ts +19 -0
  50. package/build/types/src/utils/swap/swapValues.d.ts +2 -0
  51. package/build/types/src/utils/tokens/api.d.ts +5 -0
  52. package/package.json +1 -1
@@ -2,11 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GmxApiSdk = void 0;
4
4
  const api_1 = require("../../configs/api");
5
+ const api_2 = require("../../utils/apy/api");
5
6
  const http_1 = require("../../utils/http/http");
6
- const api_2 = require("../../utils/markets/api");
7
- const api_3 = require("../../utils/orders/api");
8
- const api_4 = require("../../utils/positions/api");
9
- const api_5 = require("../../utils/prices/api");
7
+ const api_3 = require("../../utils/markets/api");
8
+ const api_4 = require("../../utils/orders/api");
9
+ const api_5 = require("../../utils/pairs/api");
10
+ const api_6 = require("../../utils/performance/api");
11
+ const api_7 = require("../../utils/positions/api");
12
+ const api_8 = require("../../utils/prices/api");
13
+ const api_9 = require("../../utils/rates/api");
14
+ const api_10 = require("../../utils/tokens/api");
10
15
  class GmxApiSdk {
11
16
  constructor({ chainId }) {
12
17
  const apiUrl = (0, api_1.getApiUrl)(chainId);
@@ -19,19 +24,43 @@ class GmxApiSdk {
19
24
  };
20
25
  }
21
26
  fetchMarketsInfo() {
22
- return (0, api_2.fetchApiMarketsInfo)(this.ctx);
27
+ return (0, api_3.fetchApiMarketsInfo)(this.ctx);
28
+ }
29
+ fetchMarkets() {
30
+ return (0, api_3.fetchApiMarkets)(this.ctx);
31
+ }
32
+ fetchMarketsTickers(params) {
33
+ return (0, api_3.fetchApiMarketsTickers)(this.ctx, params);
23
34
  }
24
35
  fetchTokensData() {
25
- return (0, api_2.fetchApiTokensData)(this.ctx);
36
+ return (0, api_3.fetchApiTokensData)(this.ctx);
37
+ }
38
+ fetchTokens() {
39
+ return (0, api_10.fetchApiTokens)(this.ctx);
26
40
  }
27
41
  fetchPositionsInfo(params) {
28
- return (0, api_4.fetchApiPositionsInfo)(this.ctx, params);
42
+ return (0, api_7.fetchApiPositionsInfo)(this.ctx, params);
29
43
  }
30
44
  fetchOrders(params) {
31
- return (0, api_3.fetchApiOrders)(this.ctx, params);
45
+ return (0, api_4.fetchApiOrders)(this.ctx, params);
32
46
  }
33
47
  fetchOhlcv(params) {
34
- return (0, api_5.fetchApiOhlcv)(this.ctx, params);
48
+ return (0, api_8.fetchApiOhlcv)(this.ctx, params);
49
+ }
50
+ fetchPairs() {
51
+ return (0, api_5.fetchApiPairs)(this.ctx);
52
+ }
53
+ fetchRates(params) {
54
+ return (0, api_9.fetchApiRates)(this.ctx, params);
55
+ }
56
+ fetchApy(params) {
57
+ return (0, api_2.fetchApiApy)(this.ctx, params);
58
+ }
59
+ fetchPerformanceAnnualized(params) {
60
+ return (0, api_6.fetchApiPerformanceAnnualized)(this.ctx, params);
61
+ }
62
+ fetchPerformanceSnapshots(params) {
63
+ return (0, api_6.fetchApiPerformanceSnapshots)(this.ctx, params);
35
64
  }
36
65
  }
37
66
  exports.GmxApiSdk = GmxApiSdk;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRelayerFeeToken = exports.getDefaultGasPaymentToken = exports.getGasPaymentTokens = exports.EXPRESS_RESIDUAL_AMOUNT_MULTIPLIER = exports.EXPRESS_DEFAULT_MAX_RESIDUAL_USD = exports.EXPRESS_DEFAULT_MIN_RESIDUAL_USD = exports.EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER = exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = exports.GELATO_API_KEYS = exports.MIN_RELAYER_FEE_USD = exports.DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = exports.DEFAULT_PERMIT_DEADLINE_DURATION = exports.DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = exports.DEFAULT_SUBACCOUNT_EXPIRY_DURATION = exports.SUBACCOUNT_DOCS_URL = exports.SUBACCOUNT_MESSAGE = void 0;
3
+ exports.getRelayerFeeToken = exports.getDefaultGasPaymentToken = exports.getGasPaymentTokens = exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = exports.GELATO_API_KEYS = exports.MIN_RELAYER_FEE_USD = exports.DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = exports.DEFAULT_PERMIT_DEADLINE_DURATION = exports.DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = exports.DEFAULT_SUBACCOUNT_EXPIRY_DURATION = exports.SUBACCOUNT_DOCS_URL = exports.SUBACCOUNT_MESSAGE = void 0;
4
4
  const numbers_1 = require("../utils/numbers");
5
5
  const time_1 = require("../utils/time");
6
6
  const chains_1 = require("./chains");
@@ -19,11 +19,6 @@ exports.GELATO_API_KEYS = {
19
19
  [chains_1.ARBITRUM_SEPOLIA]: "nx5nyAg4h2kI_64YtOuPt7LSPDEXo4u8eJY_idF9xDw_",
20
20
  };
21
21
  exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
22
- exports.EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER = 20;
23
- exports.EXPRESS_DEFAULT_MIN_RESIDUAL_USD = (0, numbers_1.expandDecimals)(exports.EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER, numbers_1.USD_DECIMALS);
24
- const EXPRESS_DEFAULT_MAX_RESIDUAL_USD_NUMBER = 40;
25
- exports.EXPRESS_DEFAULT_MAX_RESIDUAL_USD = (0, numbers_1.expandDecimals)(EXPRESS_DEFAULT_MAX_RESIDUAL_USD_NUMBER, numbers_1.USD_DECIMALS);
26
- exports.EXPRESS_RESIDUAL_AMOUNT_MULTIPLIER = 20n;
27
22
  const GAS_PAYMENT_TOKENS = {
28
23
  [chains_1.ARBITRUM]: [
29
24
  (0, tokens_1.getTokenBySymbol)(chains_1.ARBITRUM, "USDC").address,
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESIDUAL_GAS_AMOUNT_MULTIPLIER = exports.DEFAULT_MAX_RESIDUAL_GAS_USD = exports.DEFAULT_MIN_RESIDUAL_GAS_USD = exports.DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER = void 0;
4
+ const numbers_1 = require("../utils/numbers");
5
+ exports.DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER = 20;
6
+ exports.DEFAULT_MIN_RESIDUAL_GAS_USD = (0, numbers_1.expandDecimals)(exports.DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER, numbers_1.USD_DECIMALS);
7
+ const DEFAULT_MAX_RESIDUAL_GAS_USD_NUMBER = 40;
8
+ exports.DEFAULT_MAX_RESIDUAL_GAS_USD = (0, numbers_1.expandDecimals)(DEFAULT_MAX_RESIDUAL_GAS_USD_NUMBER, numbers_1.USD_DECIMALS);
9
+ exports.RESIDUAL_GAS_AMOUNT_MULTIPLIER = 20n;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchApiApy = void 0;
4
+ async function fetchApiApy(ctx, params) {
5
+ return ctx.api.fetchJson("/apy", {
6
+ query: {
7
+ period: params?.period,
8
+ },
9
+ });
10
+ }
11
+ exports.fetchApiApy = fetchApiApy;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.estimateExecuteShiftGasLimit = exports.estimateExecuteWithdrawalGasLimit = exports.estimateExecuteGlvWithdrawalGasLimit = exports.estimateExecuteGlvDepositGasLimit = exports.estimateExecuteDepositGasLimit = exports.estimateExecuteSwapOrderGasLimit = exports.estimateExecuteDecreaseOrderGasLimit = exports.estimateExecuteIncreaseOrderGasLimit = exports.estimateBatchMinGasPaymentTokenAmount = exports.estimateBatchGasLimit = exports.approximateL1GasBuffer = exports.estimateRelayerGasLimit = exports.getExecutionFee = void 0;
3
+ exports.estimateExecuteShiftGasLimit = exports.estimateExecuteWithdrawalGasLimit = exports.estimateExecuteGlvWithdrawalGasLimit = exports.estimateExecuteGlvDepositGasLimit = exports.estimateExecuteDepositGasLimit = exports.estimateExecuteSwapOrderGasLimit = exports.estimateExecuteDecreaseOrderGasLimit = exports.estimateExecuteIncreaseOrderGasLimit = exports.estimateBatchMinGasPaymentTokenAmount = exports.estimateBatchGasLimit = exports.approximateL1GasBuffer = exports.estimateRelayerGasLimit = exports.getExecutionFee = exports.getIsExecutionFeeVeryHigh = exports.getIsExecutionFeeHigh = void 0;
4
4
  const chains_1 = require("../../configs/chains");
5
5
  const factors_1 = require("../../configs/factors");
6
6
  const tokens_1 = require("../../configs/tokens");
@@ -8,6 +8,14 @@ const bigmath_1 = require("../bigmath");
8
8
  const numbers_1 = require("../numbers");
9
9
  const types_1 = require("../orders/types");
10
10
  const tokens_2 = require("../tokens");
11
+ function getIsExecutionFeeHigh(chainId, feeUsd) {
12
+ return feeUsd > (0, numbers_1.expandDecimals)((0, chains_1.getHighExecutionFee)(chainId), factors_1.USD_DECIMALS);
13
+ }
14
+ exports.getIsExecutionFeeHigh = getIsExecutionFeeHigh;
15
+ function getIsExecutionFeeVeryHigh(chainId, feeUsd) {
16
+ return feeUsd > (0, numbers_1.expandDecimals)((0, chains_1.getExcessiveExecutionFee)(chainId), factors_1.USD_DECIMALS);
17
+ }
18
+ exports.getIsExecutionFeeVeryHigh = getIsExecutionFeeVeryHigh;
11
19
  function getExecutionFee(chainId, gasLimits,
12
20
  // TODO optimize we only need the native token data
13
21
  tokensData, estimatedGasLimit, gasPrice, oraclePriceCount, numberOfParts) {
@@ -29,8 +37,8 @@ tokensData, estimatedGasLimit, gasPrice, oraclePriceCount, numberOfParts) {
29
37
  }
30
38
  const feeTokenAmount = feeTokenAmountPerExecution * BigInt(numberOfParts ?? 1);
31
39
  const feeUsd = (0, tokens_2.convertToUsd)(feeTokenAmount, nativeToken.decimals, nativeToken.prices.minPrice);
32
- const isFeeHigh = feeUsd > (0, numbers_1.expandDecimals)((0, chains_1.getHighExecutionFee)(chainId), factors_1.USD_DECIMALS);
33
- const isFeeVeryHigh = feeUsd > (0, numbers_1.expandDecimals)((0, chains_1.getExcessiveExecutionFee)(chainId), factors_1.USD_DECIMALS);
40
+ const isFeeHigh = getIsExecutionFeeHigh(chainId, feeUsd);
41
+ const isFeeVeryHigh = getIsExecutionFeeVeryHigh(chainId, feeUsd);
34
42
  return {
35
43
  feeUsd,
36
44
  feeTokenAmount,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchApiTokensData = exports.fetchApiMarketsInfo = void 0;
3
+ exports.fetchApiMarketsTickers = exports.fetchApiMarkets = exports.fetchApiTokensData = exports.fetchApiMarketsInfo = void 0;
4
4
  const numbers_1 = require("../numbers");
5
5
  async function fetchApiMarketsInfo(ctx) {
6
6
  const mInfos = await ctx.api.fetchJson("/markets/info");
@@ -12,3 +12,18 @@ async function fetchApiTokensData(ctx) {
12
12
  return tInfos.map((tInfo) => (0, numbers_1.deserializeBigIntsInObject)(tInfo, { handleInts: true }));
13
13
  }
14
14
  exports.fetchApiTokensData = fetchApiTokensData;
15
+ async function fetchApiMarkets(ctx) {
16
+ const markets = await ctx.api.fetchJson("/markets");
17
+ return markets.map((m) => (0, numbers_1.deserializeBigIntsInObject)(m, { handleInts: true }));
18
+ }
19
+ exports.fetchApiMarkets = fetchApiMarkets;
20
+ async function fetchApiMarketsTickers(ctx, params) {
21
+ const tickers = await ctx.api.fetchJson("/markets/tickers", {
22
+ query: {
23
+ addresses: params?.addresses,
24
+ symbols: params?.symbols,
25
+ },
26
+ });
27
+ return tickers.map((t) => (0, numbers_1.deserializeBigIntsInObject)(t, { handleInts: true }));
28
+ }
29
+ exports.fetchApiMarketsTickers = fetchApiMarketsTickers;
@@ -137,6 +137,10 @@ function formatUsd(usd, opts = {}) {
137
137
  if (opts.visualMultiplier) {
138
138
  usd *= BigInt(opts.visualMultiplier);
139
139
  }
140
+ if (opts.roundMode === "floor" && displayDecimals < exports.USD_DECIMALS) {
141
+ const factor = expandDecimals(1, exports.USD_DECIMALS - displayDecimals);
142
+ usd = usd >= 0n ? (usd / factor) * factor : ((usd - factor + 1n) / factor) * factor;
143
+ }
140
144
  const defaultMinThreshold = displayDecimals > 1 ? "0." + "0".repeat(displayDecimals - 1) + "1" : undefined;
141
145
  const exceedingInfo = getLimitedDisplay(usd, exports.USD_DECIMALS, {
142
146
  maxThreshold: opts.maxThreshold,
@@ -283,8 +283,8 @@ function buildUpdateOrderPayload(p) {
283
283
  };
284
284
  }
285
285
  exports.buildUpdateOrderPayload = buildUpdateOrderPayload;
286
- function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, }) {
287
- if (getIsEmptyBatch(batchParams)) {
286
+ function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, allowEmptyBatch = false, }) {
287
+ if (getIsEmptyBatch(batchParams) && !allowEmptyBatch) {
288
288
  return undefined;
289
289
  }
290
290
  let feeTokenAmount = 0n;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchApiPairs = void 0;
4
+ async function fetchApiPairs(ctx) {
5
+ return ctx.api.fetchJson("/pairs");
6
+ }
7
+ exports.fetchApiPairs = fetchApiPairs;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchApiPerformanceSnapshots = exports.fetchApiPerformanceAnnualized = void 0;
4
+ async function fetchApiPerformanceAnnualized(ctx, params) {
5
+ return ctx.api.fetchJson("/performance/annualized", {
6
+ query: {
7
+ period: params?.period,
8
+ address: params?.address,
9
+ },
10
+ });
11
+ }
12
+ exports.fetchApiPerformanceAnnualized = fetchApiPerformanceAnnualized;
13
+ async function fetchApiPerformanceSnapshots(ctx, params) {
14
+ return ctx.api.fetchJson("/performance/snapshots", {
15
+ query: {
16
+ period: params?.period,
17
+ address: params?.address,
18
+ },
19
+ });
20
+ }
21
+ exports.fetchApiPerformanceSnapshots = fetchApiPerformanceSnapshots;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchApiRates = void 0;
4
+ async function fetchApiRates(ctx, params) {
5
+ return ctx.api.fetchJson("/rates", {
6
+ query: {
7
+ period: params?.period,
8
+ averageBy: params?.averageBy,
9
+ address: params?.address,
10
+ },
11
+ });
12
+ }
13
+ exports.fetchApiRates = fetchApiRates;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -80,7 +80,7 @@ function getSwapAmountsByFromValue(p) {
80
80
  }
81
81
  exports.getSwapAmountsByFromValue = getSwapAmountsByFromValue;
82
82
  function getSwapAmountsByToValue(p) {
83
- const { tokenIn, tokenOut, amountOut, triggerRatio, isLimit, uiFeeFactor, swapOptimizationOrder, allowedSwapSlippageBps, marketsInfoData, chainId, externalSwapQuoteParams, allowSameTokenSwap, } = p;
83
+ const { tokenIn, tokenOut, amountOut, triggerRatio, isLimit, uiFeeFactor, swapOptimizationOrder, allowedSwapSlippageBps, marketsInfoData, chainId, externalSwapQuoteParams, allowSameTokenSwap, swapPricingType = types_1.SwapPricingType.Swap, } = p;
84
84
  if (!externalSwapQuoteParams) {
85
85
  return getSwapAmountsByToValueDefault(p);
86
86
  }
@@ -92,7 +92,7 @@ function getSwapAmountsByToValue(p) {
92
92
  chainId,
93
93
  externalSwapQuoteParams,
94
94
  swapOptimizationOrder,
95
- swapPricingType: types_1.SwapPricingType.Swap,
95
+ swapPricingType,
96
96
  allowSameTokenSwap,
97
97
  });
98
98
  const swapStrategy = (0, buildSwapStrategy_1.buildSwapStrategy)({
@@ -103,7 +103,7 @@ function getSwapAmountsByToValue(p) {
103
103
  chainId,
104
104
  swapOptimizationOrder,
105
105
  externalSwapQuoteParams,
106
- swapPricingType: types_1.SwapPricingType.Swap,
106
+ swapPricingType,
107
107
  allowSameTokenSwap,
108
108
  });
109
109
  const uiFeeUsd = (0, numbers_1.applyFactor)(swapStrategy.usdIn, uiFeeFactor);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchApiTokens = void 0;
4
+ async function fetchApiTokens(ctx) {
5
+ return ctx.api.fetchJson("/tokens");
6
+ }
7
+ exports.fetchApiTokens = fetchApiTokens;
@@ -1,9 +1,14 @@
1
1
  import { getApiUrl } from "../../configs/api";
2
+ import { fetchApiApy } from "../../utils/apy/api";
2
3
  import { HttpClient } from "../../utils/http/http";
3
- import { fetchApiMarketsInfo, fetchApiTokensData } from "../../utils/markets/api";
4
+ import { fetchApiMarkets, fetchApiMarketsInfo, fetchApiMarketsTickers, fetchApiTokensData } from "../../utils/markets/api";
4
5
  import { fetchApiOrders } from "../../utils/orders/api";
6
+ import { fetchApiPairs } from "../../utils/pairs/api";
7
+ import { fetchApiPerformanceAnnualized, fetchApiPerformanceSnapshots } from "../../utils/performance/api";
5
8
  import { fetchApiPositionsInfo } from "../../utils/positions/api";
6
9
  import { fetchApiOhlcv } from "../../utils/prices/api";
10
+ import { fetchApiRates } from "../../utils/rates/api";
11
+ import { fetchApiTokens } from "../../utils/tokens/api";
7
12
  export class GmxApiSdk {
8
13
  constructor({ chainId }) {
9
14
  const apiUrl = getApiUrl(chainId);
@@ -18,9 +23,18 @@ export class GmxApiSdk {
18
23
  fetchMarketsInfo() {
19
24
  return fetchApiMarketsInfo(this.ctx);
20
25
  }
26
+ fetchMarkets() {
27
+ return fetchApiMarkets(this.ctx);
28
+ }
29
+ fetchMarketsTickers(params) {
30
+ return fetchApiMarketsTickers(this.ctx, params);
31
+ }
21
32
  fetchTokensData() {
22
33
  return fetchApiTokensData(this.ctx);
23
34
  }
35
+ fetchTokens() {
36
+ return fetchApiTokens(this.ctx);
37
+ }
24
38
  fetchPositionsInfo(params) {
25
39
  return fetchApiPositionsInfo(this.ctx, params);
26
40
  }
@@ -30,4 +44,19 @@ export class GmxApiSdk {
30
44
  fetchOhlcv(params) {
31
45
  return fetchApiOhlcv(this.ctx, params);
32
46
  }
47
+ fetchPairs() {
48
+ return fetchApiPairs(this.ctx);
49
+ }
50
+ fetchRates(params) {
51
+ return fetchApiRates(this.ctx, params);
52
+ }
53
+ fetchApy(params) {
54
+ return fetchApiApy(this.ctx, params);
55
+ }
56
+ fetchPerformanceAnnualized(params) {
57
+ return fetchApiPerformanceAnnualized(this.ctx, params);
58
+ }
59
+ fetchPerformanceSnapshots(params) {
60
+ return fetchApiPerformanceSnapshots(this.ctx, params);
61
+ }
33
62
  }
@@ -1,4 +1,4 @@
1
- import { expandDecimals, USD_DECIMALS } from "../utils/numbers";
1
+ import { USD_DECIMALS } from "../utils/numbers";
2
2
  import { periodToSeconds } from "../utils/time";
3
3
  import { ARBITRUM, ARBITRUM_SEPOLIA, AVALANCHE, AVALANCHE_FUJI, BOTANIX } from "./chains";
4
4
  import { getTokenBySymbol, getWrappedToken } from "./tokens";
@@ -16,11 +16,6 @@ export const GELATO_API_KEYS = {
16
16
  [ARBITRUM_SEPOLIA]: "nx5nyAg4h2kI_64YtOuPt7LSPDEXo4u8eJY_idF9xDw_",
17
17
  };
18
18
  export const EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
19
- export const EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER = 20;
20
- export const EXPRESS_DEFAULT_MIN_RESIDUAL_USD = expandDecimals(EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER, USD_DECIMALS);
21
- const EXPRESS_DEFAULT_MAX_RESIDUAL_USD_NUMBER = 40;
22
- export const EXPRESS_DEFAULT_MAX_RESIDUAL_USD = expandDecimals(EXPRESS_DEFAULT_MAX_RESIDUAL_USD_NUMBER, USD_DECIMALS);
23
- export const EXPRESS_RESIDUAL_AMOUNT_MULTIPLIER = 20n;
24
19
  const GAS_PAYMENT_TOKENS = {
25
20
  [ARBITRUM]: [
26
21
  getTokenBySymbol(ARBITRUM, "USDC").address,
@@ -0,0 +1,6 @@
1
+ import { expandDecimals, USD_DECIMALS } from "../utils/numbers";
2
+ export const DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER = 20;
3
+ export const DEFAULT_MIN_RESIDUAL_GAS_USD = expandDecimals(DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER, USD_DECIMALS);
4
+ const DEFAULT_MAX_RESIDUAL_GAS_USD_NUMBER = 40;
5
+ export const DEFAULT_MAX_RESIDUAL_GAS_USD = expandDecimals(DEFAULT_MAX_RESIDUAL_GAS_USD_NUMBER, USD_DECIMALS);
6
+ export const RESIDUAL_GAS_AMOUNT_MULTIPLIER = 20n;
@@ -0,0 +1,7 @@
1
+ export async function fetchApiApy(ctx, params) {
2
+ return ctx.api.fetchJson("/apy", {
3
+ query: {
4
+ period: params?.period,
5
+ },
6
+ });
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -5,6 +5,12 @@ import { bigMath } from "../bigmath";
5
5
  import { applyFactor, expandDecimals } from "../numbers";
6
6
  import { DecreasePositionSwapType } from "../orders/types";
7
7
  import { convertBetweenTokens, convertToTokenAmount, convertToUsd, getTokenData } from "../tokens";
8
+ export function getIsExecutionFeeHigh(chainId, feeUsd) {
9
+ return feeUsd > expandDecimals(getHighExecutionFee(chainId), USD_DECIMALS);
10
+ }
11
+ export function getIsExecutionFeeVeryHigh(chainId, feeUsd) {
12
+ return feeUsd > expandDecimals(getExcessiveExecutionFee(chainId), USD_DECIMALS);
13
+ }
8
14
  export function getExecutionFee(chainId, gasLimits,
9
15
  // TODO optimize we only need the native token data
10
16
  tokensData, estimatedGasLimit, gasPrice, oraclePriceCount, numberOfParts) {
@@ -26,8 +32,8 @@ tokensData, estimatedGasLimit, gasPrice, oraclePriceCount, numberOfParts) {
26
32
  }
27
33
  const feeTokenAmount = feeTokenAmountPerExecution * BigInt(numberOfParts ?? 1);
28
34
  const feeUsd = convertToUsd(feeTokenAmount, nativeToken.decimals, nativeToken.prices.minPrice);
29
- const isFeeHigh = feeUsd > expandDecimals(getHighExecutionFee(chainId), USD_DECIMALS);
30
- const isFeeVeryHigh = feeUsd > expandDecimals(getExcessiveExecutionFee(chainId), USD_DECIMALS);
35
+ const isFeeHigh = getIsExecutionFeeHigh(chainId, feeUsd);
36
+ const isFeeVeryHigh = getIsExecutionFeeVeryHigh(chainId, feeUsd);
31
37
  return {
32
38
  feeUsd,
33
39
  feeTokenAmount,
@@ -7,3 +7,16 @@ export async function fetchApiTokensData(ctx) {
7
7
  const tInfos = await ctx.api.fetchJson("/tokens/info");
8
8
  return tInfos.map((tInfo) => deserializeBigIntsInObject(tInfo, { handleInts: true }));
9
9
  }
10
+ export async function fetchApiMarkets(ctx) {
11
+ const markets = await ctx.api.fetchJson("/markets");
12
+ return markets.map((m) => deserializeBigIntsInObject(m, { handleInts: true }));
13
+ }
14
+ export async function fetchApiMarketsTickers(ctx, params) {
15
+ const tickers = await ctx.api.fetchJson("/markets/tickers", {
16
+ query: {
17
+ addresses: params?.addresses,
18
+ symbols: params?.symbols,
19
+ },
20
+ });
21
+ return tickers.map((t) => deserializeBigIntsInObject(t, { handleInts: true }));
22
+ }
@@ -122,6 +122,10 @@ export function formatUsd(usd, opts = {}) {
122
122
  if (opts.visualMultiplier) {
123
123
  usd *= BigInt(opts.visualMultiplier);
124
124
  }
125
+ if (opts.roundMode === "floor" && displayDecimals < USD_DECIMALS) {
126
+ const factor = expandDecimals(1, USD_DECIMALS - displayDecimals);
127
+ usd = usd >= 0n ? (usd / factor) * factor : ((usd - factor + 1n) / factor) * factor;
128
+ }
125
129
  const defaultMinThreshold = displayDecimals > 1 ? "0." + "0".repeat(displayDecimals - 1) + "1" : undefined;
126
130
  const exceedingInfo = getLimitedDisplay(usd, USD_DECIMALS, {
127
131
  maxThreshold: opts.maxThreshold,
@@ -271,8 +271,8 @@ export function buildUpdateOrderPayload(p) {
271
271
  },
272
272
  };
273
273
  }
274
- export function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, }) {
275
- if (getIsEmptyBatch(batchParams)) {
274
+ export function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, allowEmptyBatch = false, }) {
275
+ if (getIsEmptyBatch(batchParams) && !allowEmptyBatch) {
276
276
  return undefined;
277
277
  }
278
278
  let feeTokenAmount = 0n;
@@ -0,0 +1,3 @@
1
+ export async function fetchApiPairs(ctx) {
2
+ return ctx.api.fetchJson("/pairs");
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ export async function fetchApiPerformanceAnnualized(ctx, params) {
2
+ return ctx.api.fetchJson("/performance/annualized", {
3
+ query: {
4
+ period: params?.period,
5
+ address: params?.address,
6
+ },
7
+ });
8
+ }
9
+ export async function fetchApiPerformanceSnapshots(ctx, params) {
10
+ return ctx.api.fetchJson("/performance/snapshots", {
11
+ query: {
12
+ period: params?.period,
13
+ address: params?.address,
14
+ },
15
+ });
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export async function fetchApiRates(ctx, params) {
2
+ return ctx.api.fetchJson("/rates", {
3
+ query: {
4
+ period: params?.period,
5
+ averageBy: params?.averageBy,
6
+ address: params?.address,
7
+ },
8
+ });
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -76,7 +76,7 @@ export function getSwapAmountsByFromValue(p) {
76
76
  };
77
77
  }
78
78
  export function getSwapAmountsByToValue(p) {
79
- const { tokenIn, tokenOut, amountOut, triggerRatio, isLimit, uiFeeFactor, swapOptimizationOrder, allowedSwapSlippageBps, marketsInfoData, chainId, externalSwapQuoteParams, allowSameTokenSwap, } = p;
79
+ const { tokenIn, tokenOut, amountOut, triggerRatio, isLimit, uiFeeFactor, swapOptimizationOrder, allowedSwapSlippageBps, marketsInfoData, chainId, externalSwapQuoteParams, allowSameTokenSwap, swapPricingType = SwapPricingType.Swap, } = p;
80
80
  if (!externalSwapQuoteParams) {
81
81
  return getSwapAmountsByToValueDefault(p);
82
82
  }
@@ -88,7 +88,7 @@ export function getSwapAmountsByToValue(p) {
88
88
  chainId,
89
89
  externalSwapQuoteParams,
90
90
  swapOptimizationOrder,
91
- swapPricingType: SwapPricingType.Swap,
91
+ swapPricingType,
92
92
  allowSameTokenSwap,
93
93
  });
94
94
  const swapStrategy = buildSwapStrategy({
@@ -99,7 +99,7 @@ export function getSwapAmountsByToValue(p) {
99
99
  chainId,
100
100
  swapOptimizationOrder,
101
101
  externalSwapQuoteParams,
102
- swapPricingType: SwapPricingType.Swap,
102
+ swapPricingType,
103
103
  allowSameTokenSwap,
104
104
  });
105
105
  const uiFeeUsd = applyFactor(swapStrategy.usdIn, uiFeeFactor);
@@ -0,0 +1,3 @@
1
+ export async function fetchApiTokens(ctx) {
2
+ return ctx.api.fetchJson("/tokens");
3
+ }
@@ -1,7 +1,16 @@
1
1
  import { ContractsChainId } from "../../configs/chains";
2
+ import { ApyParams, ApyResponse } from "../../utils/apy/types";
2
3
  import { IHttp } from "../../utils/http/types";
4
+ import { MarketTicker, MarketWithTiers } from "../../utils/markets/types";
5
+ import { PerformanceAnnualized, PerformanceParams, PerformanceSnapshots } from "../../utils/performance/types";
3
6
  import type { OhlcvParams } from "../../utils/prices/types";
7
+ import { MarketRates, RatesParams } from "../../utils/rates/types";
8
+ export type { ApyEntry, ApyParams, ApyResponse } from "../../utils/apy/types";
9
+ export type { MarketTicker, MarketWithTiers } from "../../utils/markets/types";
10
+ export type { Pair } from "../../utils/pairs/types";
11
+ export type { PerformanceAnnualized, PerformanceParams, PerformanceSnapshot, PerformanceSnapshots, } from "../../utils/performance/types";
4
12
  export type { OhlcvCandle, OhlcvParams } from "../../utils/prices/types";
13
+ export type { ApiParameterPeriod, MarketRates, RatesParams, RatesSnapshot } from "../../utils/rates/types";
5
14
  export declare class GmxApiSdk {
6
15
  ctx: {
7
16
  chainId: ContractsChainId;
@@ -10,8 +19,14 @@ export declare class GmxApiSdk {
10
19
  constructor({ chainId }: {
11
20
  chainId: ContractsChainId;
12
21
  });
13
- fetchMarketsInfo(): Promise<import("../../utils/markets").RawMarketInfo[]>;
22
+ fetchMarketsInfo(): Promise<import("../../utils/markets/types").RawMarketInfo[]>;
23
+ fetchMarkets(): Promise<MarketWithTiers[]>;
24
+ fetchMarketsTickers(params?: {
25
+ addresses?: string[];
26
+ symbols?: string[];
27
+ }): Promise<MarketTicker[]>;
14
28
  fetchTokensData(): Promise<import("../../utils/tokens").TokenData[]>;
29
+ fetchTokens(): Promise<import("../../utils/tokens").Token[]>;
15
30
  fetchPositionsInfo(params: {
16
31
  address: string;
17
32
  includeRelatedOrders?: boolean;
@@ -20,4 +35,9 @@ export declare class GmxApiSdk {
20
35
  address: string;
21
36
  }): Promise<import("../../utils/orders").ApiOrderInfo[]>;
22
37
  fetchOhlcv(params: OhlcvParams): Promise<import("../../utils/prices/types").OhlcvCandle[]>;
38
+ fetchPairs(): Promise<import("../../utils/pairs/types").Pair[]>;
39
+ fetchRates(params?: RatesParams): Promise<MarketRates[]>;
40
+ fetchApy(params?: ApyParams): Promise<ApyResponse>;
41
+ fetchPerformanceAnnualized(params?: PerformanceParams): Promise<PerformanceAnnualized[]>;
42
+ fetchPerformanceSnapshots(params?: PerformanceParams): Promise<PerformanceSnapshots[]>;
23
43
  }
@@ -9,10 +9,6 @@ export declare const DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION: number;
9
9
  export declare const MIN_RELAYER_FEE_USD: bigint;
10
10
  export declare const GELATO_API_KEYS: Partial<Record<ContractsChainId, string>>;
11
11
  export declare const EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
12
- export declare const EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER = 20;
13
- export declare const EXPRESS_DEFAULT_MIN_RESIDUAL_USD: bigint;
14
- export declare const EXPRESS_DEFAULT_MAX_RESIDUAL_USD: bigint;
15
- export declare const EXPRESS_RESIDUAL_AMOUNT_MULTIPLIER = 20n;
16
12
  export declare function getGasPaymentTokens(chainId: number): string[];
17
13
  export declare function getDefaultGasPaymentToken(chainId: number): string;
18
14
  export declare function getRelayerFeeToken(chainId: number): Token;
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER = 20;
2
+ export declare const DEFAULT_MIN_RESIDUAL_GAS_USD: bigint;
3
+ export declare const DEFAULT_MAX_RESIDUAL_GAS_USD: bigint;
4
+ export declare const RESIDUAL_GAS_AMOUNT_MULTIPLIER = 20n;
@@ -0,0 +1,5 @@
1
+ import { IHttp } from "../http/types";
2
+ import { ApyParams, ApyResponse } from "./types";
3
+ export declare function fetchApiApy(ctx: {
4
+ api: IHttp;
5
+ }, params?: ApyParams): Promise<ApyResponse>;
@@ -0,0 +1,13 @@
1
+ import type { ApiParameterPeriod } from "../rates/types";
2
+ export type ApyEntry = {
3
+ apy: number;
4
+ baseApy: number;
5
+ bonusApr: number;
6
+ };
7
+ export type ApyResponse = {
8
+ markets: Record<string, ApyEntry>;
9
+ glvs: Record<string, ApyEntry>;
10
+ };
11
+ export type ApyParams = {
12
+ period?: ApiParameterPeriod;
13
+ };
@@ -2,6 +2,8 @@ import { ContractsChainId } from "../../configs/chains";
2
2
  import { ExecutionFee, GasLimitsConfig, L1ExpressOrderGasReference } from "./types";
3
3
  import { DecreasePositionSwapType } from "../orders/types";
4
4
  import { TokenData, TokensData } from "../tokens/types";
5
+ export declare function getIsExecutionFeeHigh(chainId: number, feeUsd: bigint): boolean;
6
+ export declare function getIsExecutionFeeVeryHigh(chainId: number, feeUsd: bigint): boolean;
5
7
  export declare function getExecutionFee(chainId: number, gasLimits: GasLimitsConfig, tokensData: TokensData, estimatedGasLimit: bigint, gasPrice: bigint, oraclePriceCount: bigint, numberOfParts?: number): ExecutionFee | undefined;
6
8
  export declare function estimateRelayerGasLimit({ gasLimits, tokenPermitsCount, feeSwapsCount, feeExternalCallsGasLimit, oraclePriceCount, transactionPayloadGasLimit, l1GasLimit, }: {
7
9
  gasLimits: GasLimitsConfig;
@@ -1,9 +1,18 @@
1
1
  import { IHttp } from "../http/types";
2
2
  import { TokenData } from "../tokens/types";
3
- import { RawMarketInfo } from "./types";
3
+ import { MarketTicker, MarketWithTiers, RawMarketInfo } from "./types";
4
4
  export declare function fetchApiMarketsInfo(ctx: {
5
5
  api: IHttp;
6
6
  }): Promise<RawMarketInfo[]>;
7
7
  export declare function fetchApiTokensData(ctx: {
8
8
  api: IHttp;
9
9
  }): Promise<TokenData[]>;
10
+ export declare function fetchApiMarkets(ctx: {
11
+ api: IHttp;
12
+ }): Promise<MarketWithTiers[]>;
13
+ export declare function fetchApiMarketsTickers(ctx: {
14
+ api: IHttp;
15
+ }, params?: {
16
+ addresses?: string[];
17
+ symbols?: string[];
18
+ }): Promise<MarketTicker[]>;
@@ -38,6 +38,7 @@ export declare function formatUsd(usd?: bigint, opts?: {
38
38
  minThreshold?: string;
39
39
  displayPlus?: boolean;
40
40
  visualMultiplier?: number;
41
+ roundMode?: "round" | "floor";
41
42
  }): string | undefined;
42
43
  export declare function formatBigUsd(amount: bigint, opts?: {
43
44
  displayDecimals?: number;
@@ -162,10 +162,11 @@ export declare function buildDecreaseOrderPayload(p: DecreasePositionOrderParams
162
162
  export declare function buildTwapOrdersPayloads<T extends SwapOrderParams | IncreasePositionOrderParams | DecreasePositionOrderParams>(p: T, twapParams: TwapOrderParams): CreateOrderTxnParams<T>[];
163
163
  export declare function getIsTwapOrderPayload(p: CreateOrderPayload): boolean;
164
164
  export declare function buildUpdateOrderPayload(p: UpdateOrderParams): UpdateOrderTxnParams;
165
- export declare function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, }: {
165
+ export declare function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, allowEmptyBatch, }: {
166
166
  batchParams: BatchOrderTxnParams;
167
167
  tokensData: TokensData;
168
168
  chainId: number;
169
+ allowEmptyBatch?: boolean;
169
170
  }): ExecutionFee | undefined;
170
171
  export declare function getBatchTotalPayCollateralAmount(batchParams: BatchOrderTxnParams): {
171
172
  [tokenAddress: string]: bigint;
@@ -0,0 +1,5 @@
1
+ import { IHttp } from "../http/types";
2
+ import { Pair } from "./types";
3
+ export declare function fetchApiPairs(ctx: {
4
+ api: IHttp;
5
+ }): Promise<Pair[]>;
@@ -0,0 +1,20 @@
1
+ export type Pair = {
2
+ ticker_id: string;
3
+ base_currency: string;
4
+ target_currency: string;
5
+ base_volume: number;
6
+ target_volume: number;
7
+ product_type: string;
8
+ last_price: number;
9
+ high?: number;
10
+ low?: number;
11
+ open_interest?: number;
12
+ long_open_interest?: number;
13
+ short_open_interest?: number;
14
+ funding_rate?: number;
15
+ next_funding_rate?: number;
16
+ next_funding_rate_timestamp?: number;
17
+ volume_usd?: number;
18
+ pool_id: string;
19
+ liquidity_in_usd?: number;
20
+ };
@@ -0,0 +1,8 @@
1
+ import { IHttp } from "../http/types";
2
+ import { PerformanceAnnualized, PerformanceParams, PerformanceSnapshots } from "./types";
3
+ export declare function fetchApiPerformanceAnnualized(ctx: {
4
+ api: IHttp;
5
+ }, params?: PerformanceParams): Promise<PerformanceAnnualized[]>;
6
+ export declare function fetchApiPerformanceSnapshots(ctx: {
7
+ api: IHttp;
8
+ }, params?: PerformanceParams): Promise<PerformanceSnapshots[]>;
@@ -0,0 +1,19 @@
1
+ import type { ApiParameterPeriod } from "../rates/types";
2
+ export type PerformanceAnnualized = {
3
+ address: string;
4
+ performance?: string;
5
+ entity: string;
6
+ };
7
+ export type PerformanceSnapshot = {
8
+ snapshotTimestamp: number;
9
+ performance?: string;
10
+ };
11
+ export type PerformanceSnapshots = {
12
+ address: string;
13
+ entity: string;
14
+ snapshots: PerformanceSnapshot[];
15
+ };
16
+ export type PerformanceParams = {
17
+ period?: ApiParameterPeriod;
18
+ address?: string;
19
+ };
@@ -0,0 +1,5 @@
1
+ import { IHttp } from "../http/types";
2
+ import { MarketRates, RatesParams } from "./types";
3
+ export declare function fetchApiRates(ctx: {
4
+ api: IHttp;
5
+ }, params?: RatesParams): Promise<MarketRates[]>;
@@ -0,0 +1,19 @@
1
+ export type ApiParameterPeriod = "1d" | "7d" | "30d" | "90d" | "180d" | "1y" | "total";
2
+ export type RatesSnapshot = {
3
+ netRateLong: string;
4
+ netRateShort: string;
5
+ fundingRateLong: string;
6
+ fundingRateShort: string;
7
+ borrowingRateLong: string;
8
+ borrowingRateShort: string;
9
+ timestamp: number;
10
+ };
11
+ export type MarketRates = {
12
+ marketAddress: string;
13
+ ratesSnapshots: RatesSnapshot[];
14
+ };
15
+ export type RatesParams = {
16
+ period?: ApiParameterPeriod;
17
+ averageBy?: "1d" | "7d" | "30d";
18
+ address?: string;
19
+ };
@@ -1,4 +1,5 @@
1
1
  import { MarketsInfoData } from "../markets/types";
2
+ import { SwapPricingType } from "../orders/types";
2
3
  import type { TokenData, TokensRatio } from "../tokens/types";
3
4
  import type { FindSwapPath, SwapAmounts, SwapOptimizationOrderArray } from "../trade/types";
4
5
  import { ExternalSwapQuoteParams, SwapRoute } from "../trade/types";
@@ -31,5 +32,6 @@ export declare function getSwapAmountsByToValue(p: {
31
32
  externalSwapQuoteParams: ExternalSwapQuoteParams | undefined;
32
33
  findSwapPath: FindSwapPath;
33
34
  allowSameTokenSwap: boolean;
35
+ swapPricingType?: SwapPricingType;
34
36
  }): SwapAmounts;
35
37
  export declare function getSwapPathComparator(order?: SwapOptimizationOrderArray | undefined): (a: SwapRoute, b: SwapRoute) => 1 | 0 | -1;
@@ -0,0 +1,5 @@
1
+ import { IHttp } from "../http/types";
2
+ import { Token } from "./types";
3
+ export declare function fetchApiTokens(ctx: {
4
+ api: IHttp;
5
+ }): Promise<Token[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmx-io/sdk",
3
- "version": "1.5.0-alpha-7",
3
+ "version": "1.5.0-alpha-8",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",