@gmx-io/sdk 1.2.0 → 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.
Files changed (227) hide show
  1. package/build/cjs/src/abis/ClaimHandler.json +424 -0
  2. package/build/cjs/src/abis/CustomErrors.json +642 -61
  3. package/build/cjs/src/abis/DataStore.json +25 -6
  4. package/build/cjs/src/abis/EventEmitter.json +1 -6
  5. package/build/cjs/src/abis/ExchangeRouter.json +195 -290
  6. package/build/cjs/src/abis/GelatoRelayRouter.json +251 -98
  7. package/build/cjs/src/abis/GlvReader.json +60 -3
  8. package/build/cjs/src/abis/GlvRouter.json +144 -86
  9. package/build/cjs/src/abis/GovToken.json +1 -354
  10. package/build/cjs/src/abis/LayerZeroProvider.json +372 -0
  11. package/build/cjs/src/abis/Multicall.json +134 -38
  12. package/build/cjs/src/abis/MultichainClaimsRouter.json +1266 -0
  13. package/build/cjs/src/abis/MultichainGlvRouter.json +1150 -0
  14. package/build/cjs/src/abis/MultichainGmRouter.json +1449 -0
  15. package/build/cjs/src/abis/MultichainOrderRouter.json +1820 -0
  16. package/build/cjs/src/abis/MultichainSubaccountRouter.json +2069 -0
  17. package/build/cjs/src/abis/MultichainTransferRouter.json +915 -0
  18. package/build/cjs/src/abis/MultichainUtils.json +133 -0
  19. package/build/cjs/src/abis/MultichainVault.json +275 -0
  20. package/build/cjs/src/abis/ReferralStorage.json +69 -19
  21. package/build/cjs/src/abis/RelayParams.json +85 -48
  22. package/build/cjs/src/abis/SmartAccount.json +28 -0
  23. package/build/cjs/src/abis/SubaccountGelatoRelayRouter.json +282 -148
  24. package/build/cjs/src/abis/SubaccountRouter.json +62 -118
  25. package/build/cjs/src/abis/SyntheticsReader.json +342 -474
  26. package/build/cjs/src/abis/SyntheticsRouter.json +1 -6
  27. package/build/cjs/src/abis/index.js +53 -5
  28. package/build/cjs/src/configs/__tests__/markets.spec.js +2 -2
  29. package/build/cjs/src/configs/__tests__/permits.spec.js +1 -1
  30. package/build/cjs/src/configs/__tests__/tokens.spec.js +2 -2
  31. package/build/cjs/src/configs/batch.js +60 -0
  32. package/build/cjs/src/configs/chains.js +41 -8
  33. package/build/cjs/src/configs/contracts.js +151 -39
  34. package/build/cjs/src/configs/dataStore.js +49 -5
  35. package/build/cjs/src/configs/express.js +6 -1
  36. package/build/cjs/src/configs/factors.js +1 -1
  37. package/build/cjs/src/configs/markets.js +163 -0
  38. package/build/cjs/src/configs/oracleKeeper.js +21 -35
  39. package/build/cjs/src/configs/tokens.js +272 -2
  40. package/build/cjs/src/index.js +3 -3
  41. package/build/cjs/src/modules/markets/index.js +9 -4
  42. package/build/cjs/src/modules/markets/query-builders.js +28 -8
  43. package/build/cjs/src/modules/orders/helpers.js +11 -2
  44. package/build/cjs/src/modules/orders/helpers.spec.js +2 -2
  45. package/build/cjs/src/modules/orders/orders.js +3 -3
  46. package/build/cjs/src/modules/orders/utils.js +4 -5
  47. package/build/cjs/src/modules/positions/positions.js +38 -5
  48. package/build/cjs/src/modules/utils/utils.js +4 -3
  49. package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +186 -0
  50. package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +2442 -512
  51. package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +347 -0
  52. package/build/cjs/src/test/mock.js +9 -4
  53. package/build/cjs/src/types/subsquid.js +597 -1
  54. package/build/cjs/src/types/swapStrategy.js +2 -0
  55. package/build/cjs/src/types/trade.js +1 -0
  56. package/build/cjs/src/utils/LruCache.js +4 -0
  57. package/build/cjs/src/utils/__tests__/LruCache.spec.js +18 -0
  58. package/build/cjs/src/utils/__tests__/numbers.spec.js +18 -16
  59. package/build/cjs/src/utils/__tests__/orderTransactions/batchUtils.spec.js +0 -1
  60. package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +8 -0
  61. package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +40 -30
  62. package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +12 -0
  63. package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +6 -0
  64. package/build/cjs/src/utils/__tests__/positions.spec.js +23 -6
  65. package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +10 -0
  66. package/build/cjs/src/utils/bigmath.js +9 -2
  67. package/build/cjs/src/utils/errors/parseError.js +35 -1
  68. package/build/cjs/src/utils/errors/transactionsErrors.js +7 -1
  69. package/build/cjs/src/utils/fees/executionFee.js +5 -3
  70. package/build/cjs/src/utils/fees/index.js +8 -6
  71. package/build/cjs/src/utils/fees/priceImpact.js +94 -32
  72. package/build/cjs/src/utils/gelatoRelay.js +5 -0
  73. package/build/cjs/src/utils/marketKeysAndConfigs.js +24 -4
  74. package/build/cjs/src/utils/markets.js +10 -3
  75. package/build/cjs/src/utils/numbers.js +18 -17
  76. package/build/cjs/src/utils/orderTransactions.js +5 -2
  77. package/build/cjs/src/utils/positions.js +77 -9
  78. package/build/cjs/src/utils/prices.js +19 -13
  79. package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +1 -0
  80. package/build/cjs/src/utils/swap/botanixStaking.js +90 -0
  81. package/build/cjs/src/utils/swap/buildSwapStrategy.js +224 -0
  82. package/build/cjs/src/utils/swap/externalSwapPath.js +41 -0
  83. package/build/cjs/src/utils/swap/externalSwapQuoteByPath.js +27 -0
  84. package/build/cjs/src/utils/swap/swapStats.js +6 -3
  85. package/build/cjs/src/utils/swap/swapValues.js +250 -11
  86. package/build/cjs/src/utils/trade/decrease.js +470 -0
  87. package/build/cjs/src/utils/trade/{amounts.js → increase.js} +175 -72
  88. package/build/cjs/src/utils/trade/trade.js +2 -2
  89. package/build/cjs/src/utils/tradeHistory.js +3 -0
  90. package/build/cjs/src/utils/twap/uiFeeReceiver.js +9 -9
  91. package/build/esm/src/abis/ClaimHandler.json +424 -0
  92. package/build/esm/src/abis/CustomErrors.json +642 -61
  93. package/build/esm/src/abis/DataStore.json +25 -6
  94. package/build/esm/src/abis/EventEmitter.json +1 -6
  95. package/build/esm/src/abis/ExchangeRouter.json +195 -290
  96. package/build/esm/src/abis/GelatoRelayRouter.json +251 -98
  97. package/build/esm/src/abis/GlvReader.json +60 -3
  98. package/build/esm/src/abis/GlvRouter.json +144 -86
  99. package/build/esm/src/abis/GovToken.json +1 -354
  100. package/build/esm/src/abis/LayerZeroProvider.json +372 -0
  101. package/build/esm/src/abis/Multicall.json +134 -38
  102. package/build/esm/src/abis/MultichainClaimsRouter.json +1266 -0
  103. package/build/esm/src/abis/MultichainGlvRouter.json +1150 -0
  104. package/build/esm/src/abis/MultichainGmRouter.json +1449 -0
  105. package/build/esm/src/abis/MultichainOrderRouter.json +1820 -0
  106. package/build/esm/src/abis/MultichainSubaccountRouter.json +2069 -0
  107. package/build/esm/src/abis/MultichainTransferRouter.json +915 -0
  108. package/build/esm/src/abis/MultichainUtils.json +133 -0
  109. package/build/esm/src/abis/MultichainVault.json +275 -0
  110. package/build/esm/src/abis/ReferralStorage.json +69 -19
  111. package/build/esm/src/abis/RelayParams.json +85 -48
  112. package/build/esm/src/abis/SmartAccount.json +28 -0
  113. package/build/esm/src/abis/SubaccountGelatoRelayRouter.json +282 -148
  114. package/build/esm/src/abis/SubaccountRouter.json +62 -118
  115. package/build/esm/src/abis/SyntheticsReader.json +342 -474
  116. package/build/esm/src/abis/SyntheticsRouter.json +1 -6
  117. package/build/esm/src/abis/index.js +53 -5
  118. package/build/esm/src/configs/__tests__/markets.spec.js +4 -4
  119. package/build/esm/src/configs/__tests__/permits.spec.js +2 -2
  120. package/build/esm/src/configs/__tests__/tokens.spec.js +3 -3
  121. package/build/esm/src/configs/batch.js +61 -1
  122. package/build/esm/src/configs/chains.js +40 -7
  123. package/build/esm/src/configs/contracts.js +152 -40
  124. package/build/esm/src/configs/dataStore.js +37 -1
  125. package/build/esm/src/configs/express.js +6 -1
  126. package/build/esm/src/configs/factors.js +1 -1
  127. package/build/esm/src/configs/markets.js +164 -1
  128. package/build/esm/src/configs/oracleKeeper.js +20 -30
  129. package/build/esm/src/configs/tokens.js +271 -2
  130. package/build/esm/src/index.js +3 -3
  131. package/build/esm/src/modules/markets/index.js +9 -4
  132. package/build/esm/src/modules/markets/query-builders.js +28 -8
  133. package/build/esm/src/modules/orders/helpers.js +10 -1
  134. package/build/esm/src/modules/orders/helpers.spec.js +2 -2
  135. package/build/esm/src/modules/orders/orders.js +3 -3
  136. package/build/esm/src/modules/orders/utils.js +4 -5
  137. package/build/esm/src/modules/positions/positions.js +40 -7
  138. package/build/esm/src/modules/utils/utils.js +4 -3
  139. package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +186 -0
  140. package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +2442 -512
  141. package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +347 -0
  142. package/build/esm/src/test/mock.js +9 -4
  143. package/build/esm/src/types/subsquid.js +596 -0
  144. package/build/esm/src/types/swapStrategy.js +1 -0
  145. package/build/esm/src/types/trade.js +1 -0
  146. package/build/esm/src/utils/LruCache.js +4 -0
  147. package/build/esm/src/utils/__tests__/LruCache.spec.js +18 -0
  148. package/build/esm/src/utils/__tests__/numbers.spec.js +18 -16
  149. package/build/esm/src/utils/__tests__/orderTransactions/batchUtils.spec.js +0 -1
  150. package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +8 -0
  151. package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +40 -30
  152. package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +12 -0
  153. package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +7 -1
  154. package/build/esm/src/utils/__tests__/positions.spec.js +23 -6
  155. package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +11 -1
  156. package/build/esm/src/utils/bigmath.js +9 -2
  157. package/build/esm/src/utils/errors/parseError.js +31 -0
  158. package/build/esm/src/utils/errors/transactionsErrors.js +7 -1
  159. package/build/esm/src/utils/fees/executionFee.js +5 -3
  160. package/build/esm/src/utils/fees/index.js +8 -6
  161. package/build/esm/src/utils/fees/priceImpact.js +88 -30
  162. package/build/esm/src/utils/gelatoRelay.js +2 -0
  163. package/build/esm/src/utils/marketKeysAndConfigs.js +25 -5
  164. package/build/esm/src/utils/markets.js +7 -1
  165. package/build/esm/src/utils/numbers.js +18 -17
  166. package/build/esm/src/utils/orderTransactions.js +5 -2
  167. package/build/esm/src/utils/positions.js +75 -11
  168. package/build/esm/src/utils/prices.js +20 -14
  169. package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +1 -0
  170. package/build/esm/src/utils/swap/botanixStaking.js +83 -0
  171. package/build/esm/src/utils/swap/buildSwapStrategy.js +219 -0
  172. package/build/esm/src/utils/swap/externalSwapPath.js +37 -0
  173. package/build/esm/src/utils/swap/externalSwapQuoteByPath.js +23 -0
  174. package/build/esm/src/utils/swap/swapStats.js +6 -3
  175. package/build/esm/src/utils/swap/swapValues.js +248 -9
  176. package/build/esm/src/utils/trade/decrease.js +460 -0
  177. package/build/esm/src/utils/trade/{amounts.js → increase.js} +176 -74
  178. package/build/esm/src/utils/trade/trade.js +2 -2
  179. package/build/esm/src/utils/tradeHistory.js +3 -0
  180. package/build/esm/src/utils/twap/uiFeeReceiver.js +9 -9
  181. package/build/types/src/abis/index.d.ts +1 -1
  182. package/build/types/src/configs/batch.d.ts +2 -1
  183. package/build/types/src/configs/chains.d.ts +25 -20
  184. package/build/types/src/configs/contracts.d.ts +118 -8
  185. package/build/types/src/configs/dataStore.d.ts +20 -0
  186. package/build/types/src/configs/express.d.ts +1 -0
  187. package/build/types/src/configs/factors.d.ts +1 -1
  188. package/build/types/src/configs/markets.d.ts +2 -2
  189. package/build/types/src/configs/oracleKeeper.d.ts +2 -3
  190. package/build/types/src/configs/tokens.d.ts +1 -0
  191. package/build/types/src/index.d.ts +1 -1
  192. package/build/types/src/modules/base.d.ts +1 -1
  193. package/build/types/src/modules/markets/query-builders.d.ts +3 -2
  194. package/build/types/src/modules/markets/types.d.ts +2 -2
  195. package/build/types/src/modules/orders/utils.d.ts +6 -5
  196. package/build/types/src/types/fees.d.ts +1 -0
  197. package/build/types/src/types/markets.d.ts +10 -5
  198. package/build/types/src/types/orders.d.ts +1 -1
  199. package/build/types/src/types/positions.d.ts +26 -2
  200. package/build/types/src/types/sdk.d.ts +2 -2
  201. package/build/types/src/types/subsquid.d.ts +1562 -9
  202. package/build/types/src/types/swapStrategy.d.ts +33 -0
  203. package/build/types/src/types/tokens.d.ts +12 -0
  204. package/build/types/src/types/trade.d.ts +32 -7
  205. package/build/types/src/types/tradeHistory.d.ts +3 -0
  206. package/build/types/src/utils/LruCache.d.ts +1 -0
  207. package/build/types/src/utils/bigmath.d.ts +2 -1
  208. package/build/types/src/utils/errors/parseError.d.ts +11 -0
  209. package/build/types/src/utils/fees/executionFee.d.ts +6 -3
  210. package/build/types/src/utils/fees/index.d.ts +2 -2
  211. package/build/types/src/utils/fees/priceImpact.d.ts +33 -5
  212. package/build/types/src/utils/marketKeysAndConfigs.d.ts +9 -4
  213. package/build/types/src/utils/markets.d.ts +7 -0
  214. package/build/types/src/utils/multicall.d.ts +1 -1
  215. package/build/types/src/utils/numbers.d.ts +6 -3
  216. package/build/types/src/utils/orderTransactions.d.ts +6 -4
  217. package/build/types/src/utils/positions.d.ts +30 -0
  218. package/build/types/src/utils/prices.d.ts +4 -0
  219. package/build/types/src/utils/swap/botanixStaking.d.ts +11 -0
  220. package/build/types/src/utils/swap/buildSwapStrategy.d.ts +22 -0
  221. package/build/types/src/utils/swap/externalSwapPath.d.ts +13 -0
  222. package/build/types/src/utils/swap/externalSwapQuoteByPath.d.ts +6 -0
  223. package/build/types/src/utils/swap/swapValues.d.ts +11 -4
  224. package/build/types/src/utils/trade/decrease.d.ts +77 -0
  225. package/build/types/src/utils/trade/{amounts.d.ts → increase.d.ts} +20 -2
  226. package/build/types/src/utils/twap/uiFeeReceiver.d.ts +7 -7
  227. package/package.json +2 -2
@@ -0,0 +1,33 @@
1
+ import { ExternalSwapQuote, SwapPathStats } from "./trade";
2
+ type BaseSwapStrategy = {
3
+ amountIn: bigint;
4
+ amountOut: bigint;
5
+ usdIn: bigint;
6
+ usdOut: bigint;
7
+ priceIn: bigint;
8
+ priceOut: bigint;
9
+ feesUsd: bigint;
10
+ };
11
+ export type NoSwapStrategy = BaseSwapStrategy & {
12
+ type: "noSwap";
13
+ externalSwapQuote: undefined;
14
+ swapPathStats: undefined;
15
+ };
16
+ export type ExternalSwapStrategy = BaseSwapStrategy & {
17
+ type: "externalSwap";
18
+ externalSwapQuote: ExternalSwapQuote;
19
+ swapPathStats: undefined;
20
+ };
21
+ export type InternalSwapStrategy = BaseSwapStrategy & {
22
+ type: "internalSwap";
23
+ swapPathStats: SwapPathStats;
24
+ externalSwapQuote: undefined;
25
+ };
26
+ export type CombinedSwapStrategy = BaseSwapStrategy & {
27
+ type: "combinedSwap";
28
+ externalSwapQuote: ExternalSwapQuote;
29
+ swapPathStats: SwapPathStats;
30
+ };
31
+ export type SwapStrategyForIncreaseOrders = NoSwapStrategy | ExternalSwapStrategy | InternalSwapStrategy | CombinedSwapStrategy;
32
+ export type SwapStrategyForSwapOrders = NoSwapStrategy | InternalSwapStrategy | CombinedSwapStrategy;
33
+ export {};
@@ -89,6 +89,11 @@ export type SignedTokenPermit = {
89
89
  r: string;
90
90
  s: string;
91
91
  token: string;
92
+ onchainParams: {
93
+ name: string;
94
+ version: string;
95
+ nonce: bigint;
96
+ };
92
97
  };
93
98
  export type InfoTokens = {
94
99
  [key: string]: TokenInfo;
@@ -99,6 +104,13 @@ export type TokenPrices = {
99
104
  };
100
105
  export type TokenData = Token & {
101
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
+ */
102
114
  balance?: bigint;
103
115
  totalSupply?: bigint;
104
116
  hasPriceFeedProvider?: boolean;
@@ -1,5 +1,7 @@
1
1
  import { ExternalSwapFeeItem, FeeItem, SwapFeeItem } from "./fees";
2
2
  import { DecreasePositionSwapType, OrderType } from "./orders";
3
+ import { SwapStrategyForIncreaseOrders } from "./swapStrategy";
4
+ import { TokensData } from "./tokens";
3
5
  export declare enum TradeType {
4
6
  Long = "Long",
5
7
  Short = "Short",
@@ -39,7 +41,7 @@ export type SwapAmounts = {
39
41
  usdOut: bigint;
40
42
  priceIn: bigint;
41
43
  priceOut: bigint;
42
- swapPathStats: SwapPathStats | undefined;
44
+ swapStrategy: SwapStrategyForIncreaseOrders;
43
45
  minOutputAmount: bigint;
44
46
  uiFeeUsd?: bigint;
45
47
  };
@@ -48,8 +50,7 @@ export type IncreasePositionAmounts = {
48
50
  initialCollateralUsd: bigint;
49
51
  collateralDeltaAmount: bigint;
50
52
  collateralDeltaUsd: bigint;
51
- swapPathStats: SwapPathStats | undefined;
52
- externalSwapQuote: ExternalSwapQuote | undefined;
53
+ swapStrategy: SwapStrategyForIncreaseOrders;
53
54
  indexTokenAmount: bigint;
54
55
  sizeDeltaUsd: bigint;
55
56
  sizeDeltaInTokens: bigint;
@@ -62,6 +63,7 @@ export type IncreasePositionAmounts = {
62
63
  triggerThresholdType?: TriggerThresholdType;
63
64
  acceptablePrice: bigint;
64
65
  acceptablePriceDeltaBps: bigint;
66
+ recommendedAcceptablePriceDeltaBps: bigint;
65
67
  positionFeeUsd: bigint;
66
68
  uiFeeUsd: bigint;
67
69
  swapUiFeeUsd: bigint;
@@ -93,8 +95,11 @@ export type DecreasePositionAmounts = {
93
95
  borrowingFeeUsd: bigint;
94
96
  fundingFeeUsd: bigint;
95
97
  swapProfitFeeUsd: bigint;
96
- positionPriceImpactDeltaUsd: bigint;
98
+ proportionalPendingImpactDeltaUsd: bigint;
99
+ closePriceImpactDeltaUsd: bigint;
100
+ totalPendingImpactDeltaUsd: bigint;
97
101
  priceImpactDiffUsd: bigint;
102
+ balanceWasImproved: boolean;
98
103
  payedRemainingCollateralAmount: bigint;
99
104
  payedOutputUsd: bigint;
100
105
  payedRemainingCollateralUsd: bigint;
@@ -139,6 +144,8 @@ export type NextPositionValues = {
139
144
  nextPnlPercentage?: bigint;
140
145
  nextEntryPrice?: bigint;
141
146
  remainingCollateralFeesUsd?: bigint;
147
+ nextPendingImpactDeltaUsd?: bigint;
148
+ potentialPriceImpactDiffUsd?: bigint;
142
149
  };
143
150
  export type SwapStats = {
144
151
  marketAddress: string;
@@ -212,7 +219,8 @@ export type FindSwapPath = (usdIn: bigint, opts?: {
212
219
  }) => SwapPathStats | undefined;
213
220
  export type TradeFeesType = "swap" | "increase" | "decrease" | "edit";
214
221
  export declare enum ExternalSwapAggregator {
215
- OpenOcean = "openOcean"
222
+ OpenOcean = "openOcean",
223
+ BotanixStaking = "botanixStaking"
216
224
  }
217
225
  export type ExternalSwapQuote = {
218
226
  aggregator: ExternalSwapAggregator;
@@ -235,6 +243,18 @@ export type ExternalSwapQuote = {
235
243
  estimatedExecutionFee: bigint;
236
244
  };
237
245
  };
246
+ export type ExternalSwapPath = {
247
+ aggregator: ExternalSwapAggregator;
248
+ inTokenAddress: string;
249
+ outTokenAddress: string;
250
+ };
251
+ export type ExternalSwapQuoteParams = {
252
+ chainId: number;
253
+ receiverAddress: string;
254
+ gasPrice: bigint | undefined;
255
+ tokensData: TokensData | undefined;
256
+ botanixStakingAssetsPerShare: bigint | undefined;
257
+ };
238
258
  export type ExternalSwapCalculationStrategy = "byFromValue" | "leverageBySize";
239
259
  export type ExternalSwapInputs = {
240
260
  amountIn: bigint;
@@ -253,9 +273,14 @@ export type TradeFees = {
253
273
  swapFees?: SwapFeeItem[];
254
274
  positionFee?: FeeItem;
255
275
  swapPriceImpact?: FeeItem;
256
- positionPriceImpact?: FeeItem;
257
- priceImpactDiff?: FeeItem;
258
276
  positionCollateralPriceImpact?: FeeItem;
277
+ proportionalPendingImpact?: FeeItem;
278
+ increasePositionPriceImpact?: FeeItem;
279
+ decreasePositionPriceImpact?: FeeItem;
280
+ totalPendingImpact?: FeeItem;
281
+ priceImpactDiff?: FeeItem;
282
+ positionNetPriceImpact?: FeeItem;
283
+ collateralNetPriceImpact?: FeeItem;
259
284
  collateralPriceImpactDiff?: FeeItem;
260
285
  positionFeeFactor?: bigint;
261
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;
@@ -6,5 +6,6 @@ export declare class LRUCache<T> {
6
6
  has(key: string): boolean;
7
7
  get(key: string): T | undefined;
8
8
  set(key: string, value: T): void;
9
+ delete(key: string): void;
9
10
  private updateRecentKeys;
10
11
  }
@@ -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: number;
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, forPositiveImpact: boolean, isAtomicSwap: boolean): bigint;
8
- export declare function getPositionFee(marketInfo: MarketInfo, sizeDeltaUsd: bigint, forPositiveImpact: boolean, referralInfo: {
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
- }): bigint;
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
- }): bigint;
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
- }): bigint;
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
- }): bigint;
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
- positionFeeFactorForPositiveImpact: string;
33
- positionFeeFactorForNegativeImpact: string;
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
- swapFeeFactorForPositiveImpact: string;
44
- swapFeeFactorForNegativeImpact: string;
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").UiContractsChain;
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): string;
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): 5 | 2 | 3 | 4 | 6 | 7 | 8 | 9;
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: number;
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: number;
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: number;
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: number;
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;
@@ -0,0 +1,11 @@
1
+ import { TokensData } from "../../types/tokens";
2
+ import { ExternalSwapQuote } from "../../types/trade";
3
+ export declare const getBotanixStakingExternalSwapQuote: ({ tokenInAddress, tokenOutAddress, amountIn, gasPrice, receiverAddress, tokensData, assetsPerShare, }: {
4
+ tokenInAddress: string;
5
+ tokenOutAddress: string;
6
+ amountIn: bigint;
7
+ gasPrice: bigint;
8
+ receiverAddress: string;
9
+ tokensData: TokensData;
10
+ assetsPerShare: bigint;
11
+ }) => ExternalSwapQuote | undefined;
@@ -0,0 +1,22 @@
1
+ import { MarketsInfoData } from "../../types/markets";
2
+ import { SwapStrategyForSwapOrders } from "../../types/swapStrategy";
3
+ import { TokenData } from "../../types/tokens";
4
+ import { ExternalSwapQuoteParams, SwapOptimizationOrderArray } from "../../types/trade";
5
+ export declare function buildSwapStrategy({ amountIn, tokenIn, tokenOut, marketsInfoData, chainId, swapOptimizationOrder, externalSwapQuoteParams, }: {
6
+ chainId: number;
7
+ amountIn: bigint;
8
+ tokenIn: TokenData;
9
+ tokenOut: TokenData;
10
+ marketsInfoData: MarketsInfoData | undefined;
11
+ swapOptimizationOrder: SwapOptimizationOrderArray | undefined;
12
+ externalSwapQuoteParams: ExternalSwapQuoteParams;
13
+ }): SwapStrategyForSwapOrders;
14
+ export declare function buildReverseSwapStrategy({ amountOut, tokenIn, tokenOut, marketsInfoData, chainId, externalSwapQuoteParams, swapOptimizationOrder, }: {
15
+ chainId: number;
16
+ amountOut: bigint;
17
+ tokenIn: TokenData;
18
+ tokenOut: TokenData;
19
+ marketsInfoData: MarketsInfoData | undefined;
20
+ externalSwapQuoteParams: ExternalSwapQuoteParams;
21
+ swapOptimizationOrder: SwapOptimizationOrderArray | undefined;
22
+ }): SwapStrategyForSwapOrders;
@@ -0,0 +1,13 @@
1
+ import { ExternalSwapPath } from "../../types/trade";
2
+ export declare const AVAILABLE_BOTANIX_DEPOSIT_PAIRS: {
3
+ from: string;
4
+ to: string;
5
+ }[];
6
+ export declare const AVAILABLE_BOTANIX_WITHDRAW_PAIRS: {
7
+ from: string;
8
+ to: string;
9
+ }[];
10
+ export declare const getAvailableExternalSwapPaths: ({ chainId, fromTokenAddress, }: {
11
+ chainId: number;
12
+ fromTokenAddress: string;
13
+ }) => ExternalSwapPath[];
@@ -0,0 +1,6 @@
1
+ import { ExternalSwapPath, ExternalSwapQuote, ExternalSwapQuoteParams } from "../../types/trade";
2
+ export declare const getExternalSwapQuoteByPath: ({ amountIn, externalSwapPath, externalSwapQuoteParams, }: {
3
+ amountIn: bigint;
4
+ externalSwapPath: ExternalSwapPath;
5
+ externalSwapQuoteParams: ExternalSwapQuoteParams;
6
+ }) => ExternalSwapQuote | undefined;
@@ -1,6 +1,7 @@
1
+ import { MarketsInfoData } from "../../types/markets";
1
2
  import type { TokenData, TokensRatio } from "../../types/tokens";
2
- import { SwapRoute } from "../../types/trade";
3
3
  import type { FindSwapPath, SwapAmounts, SwapOptimizationOrderArray } from "../../types/trade";
4
+ import { ExternalSwapQuoteParams, SwapRoute } from "../../types/trade";
4
5
  export declare function getSwapAmountsByFromValue(p: {
5
6
  tokenIn: TokenData;
6
7
  tokenOut: TokenData;
@@ -9,8 +10,11 @@ export declare function getSwapAmountsByFromValue(p: {
9
10
  isLimit: boolean;
10
11
  swapOptimizationOrder?: SwapOptimizationOrderArray;
11
12
  allowedSwapSlippageBps?: bigint;
12
- findSwapPath: FindSwapPath;
13
13
  uiFeeFactor: bigint;
14
+ marketsInfoData: MarketsInfoData | undefined;
15
+ chainId: number;
16
+ externalSwapQuoteParams: ExternalSwapQuoteParams | undefined;
17
+ findSwapPath: FindSwapPath;
14
18
  }): SwapAmounts;
15
19
  export declare function getSwapAmountsByToValue(p: {
16
20
  tokenIn: TokenData;
@@ -18,9 +22,12 @@ export declare function getSwapAmountsByToValue(p: {
18
22
  amountOut: bigint;
19
23
  triggerRatio?: TokensRatio;
20
24
  isLimit: boolean;
21
- findSwapPath: FindSwapPath;
22
25
  swapOptimizationOrder?: SwapOptimizationOrderArray;
23
26
  allowedSwapSlippageBps?: bigint;
24
27
  uiFeeFactor: bigint;
28
+ marketsInfoData: MarketsInfoData | undefined;
29
+ chainId: number;
30
+ externalSwapQuoteParams: ExternalSwapQuoteParams | undefined;
31
+ findSwapPath: FindSwapPath;
25
32
  }): SwapAmounts;
26
- export declare function getSwapPathComparator(order?: SwapOptimizationOrderArray | undefined): (a: SwapRoute, b: SwapRoute) => 1 | 0 | -1;
33
+ export declare function getSwapPathComparator(order?: SwapOptimizationOrderArray | undefined): (a: SwapRoute, b: SwapRoute) => 0 | 1 | -1;