@gmx-io/sdk 1.4.2 → 1.5.0-alpha-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 (442) hide show
  1. package/build/cjs/scripts/generate-platform-tokens.js +200 -0
  2. package/build/cjs/scripts/prebuild/index.js +6 -1
  3. package/build/cjs/scripts/prebuild/prebuildKinkModelMarketRatesKeys.js +2 -28
  4. package/build/cjs/scripts/prebuild/prebuildMarketConfigKeys.js +2 -2
  5. package/build/cjs/scripts/prebuild/prebuildMarketValuesKeys.js +2 -2
  6. package/build/cjs/scripts/subsquid-codegen.js +26 -0
  7. package/build/cjs/src/{utils → clients/v1}/callContract.js +4 -6
  8. package/build/cjs/src/{index.js → clients/v1/index.js} +4 -4
  9. package/build/cjs/src/{modules → clients/v1/modules}/accounts/accounts.js +1 -1
  10. package/build/cjs/src/{modules → clients/v1/modules}/accounts/accounts.spec.js +1 -1
  11. package/build/cjs/src/clients/v1/modules/markets/index.js +227 -0
  12. package/build/cjs/src/{modules → clients/v1/modules}/markets/markets.spec.js +3 -3
  13. package/build/cjs/src/{modules → clients/v1/modules}/oracle.js +1 -1
  14. package/build/cjs/src/{modules → clients/v1/modules}/orders/helpers.js +9 -9
  15. package/build/cjs/src/{modules → clients/v1/modules}/orders/helpers.spec.js +5 -5
  16. package/build/cjs/src/{modules → clients/v1/modules}/orders/orders.js +14 -14
  17. package/build/cjs/src/{modules → clients/v1/modules}/orders/orders.spec.js +1 -1
  18. package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/cancelOrdersTxn.js +2 -2
  19. package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/createDecreaseOrderTxn.js +7 -7
  20. package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/createIncreaseOrderTxn.js +11 -11
  21. package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/createSwapOrderTxn.js +10 -10
  22. package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/createWrapOrUnwrapTxn.js +2 -2
  23. package/build/cjs/src/{modules → clients/v1/modules}/orders/transactions/updateOrderTxn.js +3 -3
  24. package/build/cjs/src/{modules → clients/v1/modules}/orders/utils.js +7 -7
  25. package/build/cjs/src/{modules → clients/v1/modules}/positions/positions.js +16 -158
  26. package/build/cjs/src/{modules → clients/v1/modules}/positions/positions.spec.js +1 -1
  27. package/build/cjs/src/{modules → clients/v1/modules}/tokens/tokens.js +3 -3
  28. package/build/cjs/src/{modules → clients/v1/modules}/tokens/tokens.spec.js +3 -3
  29. package/build/cjs/src/{modules → clients/v1/modules}/trades/trades.js +19 -19
  30. package/build/cjs/src/{modules → clients/v1/modules}/trades/trades.spec.js +1 -1
  31. package/build/cjs/src/{modules → clients/v1/modules}/utils/utils.js +8 -8
  32. package/build/cjs/src/{utils → clients/v1}/multicall.js +2 -2
  33. package/build/cjs/src/{utils → clients/v1}/simulateExecuteOrder.js +5 -5
  34. package/build/cjs/src/{utils → clients/v1}/testUtil.js +2 -2
  35. package/build/cjs/src/clients/v2/index.js +29 -0
  36. package/build/cjs/src/codegen/platformTokens.json +134 -0
  37. package/build/cjs/src/{prebuilt → codegen/prebuilt}/hashedKinkModelMarketRatesKeys.json +24 -0
  38. package/build/cjs/src/{prebuilt → codegen/prebuilt}/hashedMarketConfigKeys.json +171 -0
  39. package/build/cjs/src/{prebuilt → codegen/prebuilt}/hashedMarketValuesKeys.json +45 -0
  40. package/build/cjs/src/codegen/prebuilt/index.js +16 -0
  41. package/build/cjs/src/{types → codegen}/subsquid.js +142 -22
  42. package/build/cjs/src/configs/api.js +15 -0
  43. package/build/cjs/src/configs/chains.js +29 -1
  44. package/build/cjs/src/configs/dataStore.js +6 -2
  45. package/build/cjs/src/configs/markets.js +21 -0
  46. package/build/cjs/src/configs/multichain.js +29 -19
  47. package/build/cjs/src/configs/tokens.js +36 -0
  48. package/build/cjs/src/test/mock.js +5 -122
  49. package/build/cjs/src/utils/24h/index.js +17 -0
  50. package/build/cjs/src/utils/LruCache/index.js +17 -0
  51. package/build/cjs/src/utils/__tests__/fees.spec.js +2 -2
  52. package/build/cjs/src/utils/__tests__/numbers.spec.js +1 -1
  53. package/build/cjs/src/utils/__tests__/orderTransactions/batchUtils.spec.js +3 -3
  54. package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +34 -34
  55. package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +5 -5
  56. package/build/cjs/src/utils/__tests__/orderTransactions/externalCalls.spec.js +1 -1
  57. package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +29 -29
  58. package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +21 -21
  59. package/build/cjs/src/utils/__tests__/orderTransactions/updateOrder.spec.js +4 -4
  60. package/build/cjs/src/utils/__tests__/parseError.spec.js +40 -0
  61. package/build/cjs/src/utils/__tests__/positions.spec.js +1 -1
  62. package/build/cjs/src/utils/__tests__/prices.spec.js +18 -18
  63. package/build/cjs/src/utils/__tests__/tokens.spec.js +191 -4
  64. package/build/cjs/src/utils/abort/index.js +17 -0
  65. package/build/cjs/src/utils/bigmath/index.js +17 -0
  66. package/build/cjs/src/utils/buildUrl/index.js +17 -0
  67. package/build/cjs/src/utils/chains/index.js +17 -0
  68. package/build/cjs/src/utils/common/index.js +17 -0
  69. package/build/cjs/src/utils/{common.js → common/utils.js} +1 -2
  70. package/build/cjs/src/utils/errors/parseError.js +67 -25
  71. package/build/cjs/src/utils/fees/executionFee.js +2 -2
  72. package/build/cjs/src/utils/fees/index.js +9 -9
  73. package/build/cjs/src/utils/fees/priceImpact.js +6 -1
  74. package/build/cjs/src/utils/gelatoRelay/index.js +17 -0
  75. package/build/cjs/src/utils/graphqlFetcher/index.js +8 -0
  76. package/build/cjs/src/utils/hash/index.js +17 -0
  77. package/build/cjs/src/utils/{hash.js → hash/utils.js} +1 -1
  78. package/build/cjs/src/utils/http/http.js +33 -0
  79. package/build/cjs/src/utils/indexers/index.js +17 -0
  80. package/build/cjs/src/utils/{indexers.js → indexers/utils.js} +1 -1
  81. package/build/cjs/src/utils/markets/__tests__/mockMarkets.js +129 -0
  82. package/build/cjs/src/utils/markets/api.js +14 -0
  83. package/build/cjs/src/utils/{marketKeysAndConfigs.js → markets/hashKeys.js} +32 -3
  84. package/build/cjs/src/utils/markets/index.js +21 -0
  85. package/build/cjs/src/{modules/markets/query-builders.js → utils/markets/multicall.js} +149 -42
  86. package/build/cjs/src/utils/markets/utils.js +398 -0
  87. package/build/cjs/src/utils/numbers/index.js +17 -0
  88. package/build/cjs/src/utils/{numbers.js → numbers/utils.js} +12 -5
  89. package/build/cjs/src/utils/objects/index.js +17 -0
  90. package/build/cjs/src/utils/{objects.js → objects/utils.js} +9 -1
  91. package/build/cjs/src/utils/orderTransactions/index.js +17 -0
  92. package/build/cjs/src/utils/{orderTransactions.js → orderTransactions/utils.js} +22 -22
  93. package/build/cjs/src/utils/orders/api.js +13 -0
  94. package/build/cjs/src/utils/orders/index.js +19 -0
  95. package/build/cjs/src/utils/{orders.js → orders/utils.js} +22 -22
  96. package/build/cjs/src/utils/positions/api.js +14 -0
  97. package/build/cjs/src/utils/positions/index.js +19 -0
  98. package/build/cjs/src/utils/positions/utils.js +425 -0
  99. package/build/cjs/src/utils/prices/index.js +17 -0
  100. package/build/cjs/src/utils/{prices.js → prices/utils.js} +15 -15
  101. package/build/cjs/src/utils/referrals/index.js +18 -0
  102. package/build/cjs/src/utils/sidecarOrders/index.js +17 -0
  103. package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +15 -15
  104. package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +6 -6
  105. package/build/cjs/src/utils/swap/__tests__/swapStats.spec.js +10 -10
  106. package/build/cjs/src/utils/swap/botanixStaking.js +3 -3
  107. package/build/cjs/src/utils/swap/buildSwapStrategy.js +2 -2
  108. package/build/cjs/src/utils/swap/externalSwapPath.js +2 -2
  109. package/build/cjs/src/utils/swap/externalSwapQuoteByPath.js +2 -2
  110. package/build/cjs/src/utils/swap/index.js +12 -0
  111. package/build/cjs/src/utils/swap/swapPath.js +3 -3
  112. package/build/cjs/src/utils/swap/swapValues.js +4 -4
  113. package/build/cjs/src/utils/time/index.js +17 -0
  114. package/build/cjs/src/utils/tokens/index.js +18 -0
  115. package/build/cjs/src/utils/{tokens.js → tokens/utils.js} +27 -7
  116. package/build/cjs/src/utils/trade/decrease.js +8 -8
  117. package/build/cjs/src/utils/trade/increase.js +2 -2
  118. package/build/cjs/src/utils/trade/index.js +3 -0
  119. package/build/cjs/src/utils/trade/trade.js +10 -10
  120. package/build/cjs/src/utils/tradeHistory/index.js +18 -0
  121. package/build/cjs/src/utils/{tradeHistory.js → tradeHistory/utils.js} +4 -4
  122. package/build/cjs/src/utils/twap/index.js +15 -0
  123. package/build/cjs/src/utils/types/index.js +7 -0
  124. package/build/esm/scripts/generate-platform-tokens.js +195 -0
  125. package/build/esm/scripts/prebuild/index.js +3 -1
  126. package/build/esm/scripts/prebuild/prebuildKinkModelMarketRatesKeys.js +2 -28
  127. package/build/esm/scripts/prebuild/prebuildMarketConfigKeys.js +1 -1
  128. package/build/esm/scripts/prebuild/prebuildMarketValuesKeys.js +1 -1
  129. package/build/esm/scripts/subsquid-codegen.js +24 -0
  130. package/build/esm/src/{utils → clients/v1}/callContract.js +5 -5
  131. package/build/esm/src/{index.js → clients/v1/index.js} +4 -4
  132. package/build/esm/src/{modules → clients/v1/modules}/accounts/accounts.js +1 -1
  133. package/build/esm/src/{modules → clients/v1/modules}/accounts/accounts.spec.js +1 -1
  134. package/build/esm/src/clients/v1/modules/markets/index.js +220 -0
  135. package/build/esm/src/{modules → clients/v1/modules}/markets/markets.spec.js +2 -2
  136. package/build/esm/src/{modules → clients/v1/modules}/oracle.js +1 -1
  137. package/build/esm/src/{modules → clients/v1/modules}/orders/helpers.js +6 -6
  138. package/build/esm/src/{modules → clients/v1/modules}/orders/helpers.spec.js +5 -5
  139. package/build/esm/src/{modules → clients/v1/modules}/orders/orders.js +7 -7
  140. package/build/esm/src/{modules → clients/v1/modules}/orders/orders.spec.js +1 -1
  141. package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/cancelOrdersTxn.js +2 -2
  142. package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/createDecreaseOrderTxn.js +7 -7
  143. package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/createIncreaseOrderTxn.js +8 -8
  144. package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/createSwapOrderTxn.js +7 -7
  145. package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/createWrapOrUnwrapTxn.js +2 -2
  146. package/build/esm/src/{modules → clients/v1/modules}/orders/transactions/updateOrderTxn.js +3 -3
  147. package/build/esm/src/{modules → clients/v1/modules}/orders/utils.js +7 -7
  148. package/build/esm/src/{modules → clients/v1/modules}/positions/positions.js +16 -158
  149. package/build/esm/src/{modules → clients/v1/modules}/positions/positions.spec.js +1 -1
  150. package/build/esm/src/{modules → clients/v1/modules}/tokens/tokens.js +3 -3
  151. package/build/esm/src/{modules → clients/v1/modules}/tokens/tokens.spec.js +1 -1
  152. package/build/esm/src/{modules → clients/v1/modules}/trades/trades.js +8 -8
  153. package/build/esm/src/{modules → clients/v1/modules}/trades/trades.spec.js +1 -1
  154. package/build/esm/src/{modules → clients/v1/modules}/utils/utils.js +8 -8
  155. package/build/esm/src/{utils → clients/v1}/multicall.js +2 -2
  156. package/build/esm/src/{utils → clients/v1}/simulateExecuteOrder.js +5 -5
  157. package/build/esm/src/{utils → clients/v1}/testUtil.js +2 -2
  158. package/build/esm/src/clients/v2/index.js +25 -0
  159. package/build/esm/src/codegen/platformTokens.json +134 -0
  160. package/build/esm/src/{prebuilt → codegen/prebuilt}/hashedKinkModelMarketRatesKeys.json +24 -0
  161. package/build/esm/src/{prebuilt → codegen/prebuilt}/hashedMarketConfigKeys.json +171 -0
  162. package/build/esm/src/{prebuilt → codegen/prebuilt}/hashedMarketValuesKeys.json +45 -0
  163. package/build/esm/src/codegen/prebuilt/index.js +10 -0
  164. package/build/esm/src/{types → codegen}/subsquid.js +141 -21
  165. package/build/esm/src/configs/api.js +11 -0
  166. package/build/esm/src/configs/chains.js +29 -1
  167. package/build/esm/src/configs/dataStore.js +3 -0
  168. package/build/esm/src/configs/markets.js +21 -0
  169. package/build/esm/src/configs/multichain.js +28 -19
  170. package/build/esm/src/configs/tokens.js +36 -0
  171. package/build/esm/src/test/mock.js +3 -120
  172. package/build/esm/src/utils/24h/index.js +1 -0
  173. package/build/esm/src/utils/LruCache/index.js +1 -0
  174. package/build/esm/src/utils/__tests__/fees.spec.js +2 -2
  175. package/build/esm/src/utils/__tests__/numbers.spec.js +1 -1
  176. package/build/esm/src/utils/__tests__/orderTransactions/batchUtils.spec.js +2 -2
  177. package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +2 -2
  178. package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +2 -2
  179. package/build/esm/src/utils/__tests__/orderTransactions/externalCalls.spec.js +1 -1
  180. package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -2
  181. package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +2 -2
  182. package/build/esm/src/utils/__tests__/orderTransactions/updateOrder.spec.js +2 -2
  183. package/build/esm/src/utils/__tests__/parseError.spec.js +40 -0
  184. package/build/esm/src/utils/__tests__/positions.spec.js +1 -1
  185. package/build/esm/src/utils/__tests__/prices.spec.js +2 -2
  186. package/build/esm/src/utils/__tests__/tokens.spec.js +192 -5
  187. package/build/esm/src/utils/abort/index.js +1 -0
  188. package/build/esm/src/utils/bigmath/index.js +1 -0
  189. package/build/esm/src/utils/buildUrl/index.js +1 -0
  190. package/build/esm/src/utils/chains/index.js +1 -0
  191. package/build/esm/src/utils/common/index.js +1 -0
  192. package/build/esm/src/utils/{common.js → common/utils.js} +0 -1
  193. package/build/esm/src/utils/errors/parseError.js +64 -24
  194. package/build/esm/src/utils/fees/executionFee.js +1 -1
  195. package/build/esm/src/utils/fees/index.js +7 -7
  196. package/build/esm/src/utils/fees/priceImpact.js +5 -1
  197. package/build/esm/src/utils/gelatoRelay/index.js +1 -0
  198. package/build/esm/src/utils/graphqlFetcher/index.js +1 -0
  199. package/build/esm/src/utils/hash/index.js +1 -0
  200. package/build/esm/src/utils/{hash.js → hash/utils.js} +1 -1
  201. package/build/esm/src/utils/http/http.js +26 -0
  202. package/build/esm/src/utils/indexers/index.js +1 -0
  203. package/build/esm/src/utils/{indexers.js → indexers/utils.js} +1 -1
  204. package/build/esm/src/utils/markets/__tests__/mockMarkets.js +124 -0
  205. package/build/esm/src/utils/markets/api.js +9 -0
  206. package/build/esm/src/utils/{marketKeysAndConfigs.js → markets/hashKeys.js} +30 -2
  207. package/build/esm/src/utils/markets/index.js +5 -0
  208. package/build/esm/src/{modules/markets/query-builders.js → utils/markets/multicall.js} +146 -41
  209. package/build/esm/src/utils/markets/utils.js +364 -0
  210. package/build/esm/src/utils/numbers/index.js +1 -0
  211. package/build/esm/src/utils/{numbers.js → numbers/utils.js} +10 -3
  212. package/build/esm/src/utils/objects/index.js +1 -0
  213. package/build/esm/src/utils/{objects.js → objects/utils.js} +7 -0
  214. package/build/esm/src/utils/orderTransactions/index.js +1 -0
  215. package/build/esm/src/utils/{orderTransactions.js → orderTransactions/utils.js} +14 -14
  216. package/build/esm/src/utils/orders/api.js +9 -0
  217. package/build/esm/src/utils/orders/index.js +3 -0
  218. package/build/esm/src/utils/{orders.js → orders/utils.js} +8 -8
  219. package/build/esm/src/utils/positions/api.js +10 -0
  220. package/build/esm/src/utils/positions/index.js +3 -0
  221. package/build/esm/src/utils/positions/utils.js +407 -0
  222. package/build/esm/src/utils/prices/index.js +1 -0
  223. package/build/esm/src/utils/{prices.js → prices/utils.js} +7 -7
  224. package/build/esm/src/utils/referrals/index.js +2 -0
  225. package/build/esm/src/utils/sidecarOrders/index.js +1 -0
  226. package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +2 -2
  227. package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +2 -2
  228. package/build/esm/src/utils/swap/__tests__/swapStats.spec.js +1 -1
  229. package/build/esm/src/utils/swap/botanixStaking.js +1 -1
  230. package/build/esm/src/utils/swap/buildSwapStrategy.js +1 -1
  231. package/build/esm/src/utils/swap/externalSwapPath.js +1 -1
  232. package/build/esm/src/utils/swap/externalSwapQuoteByPath.js +1 -1
  233. package/build/esm/src/utils/swap/index.js +12 -0
  234. package/build/esm/src/utils/swap/swapPath.js +1 -1
  235. package/build/esm/src/utils/swap/swapValues.js +1 -1
  236. package/build/esm/src/utils/time/index.js +1 -0
  237. package/build/esm/src/utils/tokens/index.js +2 -0
  238. package/build/esm/src/utils/{tokens.js → tokens/utils.js} +27 -7
  239. package/build/esm/src/utils/trade/decrease.js +1 -1
  240. package/build/esm/src/utils/trade/increase.js +1 -1
  241. package/build/esm/src/utils/trade/index.js +3 -0
  242. package/build/esm/src/utils/trade/trade.js +2 -2
  243. package/build/esm/src/utils/tradeHistory/index.js +2 -0
  244. package/build/esm/src/utils/{tradeHistory.js → tradeHistory/utils.js} +4 -4
  245. package/build/esm/src/utils/twap/index.js +1 -0
  246. package/build/esm/src/utils/types/index.js +3 -0
  247. package/build/types/scripts/generate-platform-tokens.d.ts +27 -0
  248. package/build/types/scripts/subsquid-codegen.d.ts +3 -0
  249. package/build/types/src/clients/v1/callContract.d.ts +7 -0
  250. package/build/types/src/{index.d.ts → clients/v1/index.d.ts} +3 -3
  251. package/build/types/src/{modules → clients/v1/modules}/markets/index.d.ts +12 -1
  252. package/build/types/src/{modules → clients/v1/modules}/oracle.d.ts +2 -2
  253. package/build/types/src/{modules → clients/v1/modules}/orders/helpers.d.ts +3 -3
  254. package/build/types/src/{modules → clients/v1/modules}/orders/orders.d.ts +6 -6
  255. package/build/types/src/{modules → clients/v1/modules}/orders/transactions/cancelOrdersTxn.d.ts +1 -1
  256. package/build/types/src/{modules → clients/v1/modules}/orders/transactions/createDecreaseOrderTxn.d.ts +3 -3
  257. package/build/types/src/{modules → clients/v1/modules}/orders/transactions/createIncreaseOrderTxn.d.ts +4 -4
  258. package/build/types/src/{modules → clients/v1/modules}/orders/transactions/createSwapOrderTxn.d.ts +2 -2
  259. package/build/types/src/{modules → clients/v1/modules}/orders/transactions/createWrapOrUnwrapTxn.d.ts +1 -1
  260. package/build/types/src/{modules → clients/v1/modules}/orders/transactions/updateOrderTxn.d.ts +2 -2
  261. package/build/types/src/{modules → clients/v1/modules}/orders/utils.d.ts +9 -9
  262. package/build/types/src/{modules → clients/v1/modules}/positions/positions.d.ts +4 -4
  263. package/build/types/src/{modules → clients/v1/modules}/tokens/tokens.d.ts +1 -1
  264. package/build/types/src/{modules → clients/v1/modules}/trades/trades.d.ts +4 -4
  265. package/build/types/src/{modules → clients/v1/modules}/utils/utils.d.ts +4 -4
  266. package/build/types/src/{utils → clients/v1}/multicall.d.ts +2 -2
  267. package/build/types/src/{utils → clients/v1}/simulateExecuteOrder.d.ts +3 -3
  268. package/build/types/src/{utils → clients/v1}/testUtil.d.ts +2 -2
  269. package/build/types/src/{types/sdk.d.ts → clients/v1/types.d.ts} +3 -3
  270. package/build/types/src/clients/v2/index.d.ts +20 -0
  271. package/build/types/src/codegen/prebuilt/index.d.ts +13876 -0
  272. package/build/types/src/{types → codegen}/subsquid.d.ts +505 -60
  273. package/build/types/src/configs/api.d.ts +1 -0
  274. package/build/types/src/configs/chains.d.ts +26 -2
  275. package/build/types/src/configs/dataStore.d.ts +1 -0
  276. package/build/types/src/configs/express.d.ts +1 -1
  277. package/build/types/src/configs/gasLimits.d.ts +1 -1
  278. package/build/types/src/configs/markets.d.ts +1 -1
  279. package/build/types/src/configs/multichain.d.ts +6 -3
  280. package/build/types/src/configs/tokens.d.ts +1 -1
  281. package/build/types/src/test/mock.d.ts +3 -7
  282. package/build/types/src/utils/24h/index.d.ts +1 -0
  283. package/build/types/src/utils/24h/types.d.ts +7 -0
  284. package/build/types/src/utils/LruCache/index.d.ts +1 -0
  285. package/build/types/src/utils/abort/index.d.ts +1 -0
  286. package/build/types/src/utils/bigmath/index.d.ts +1 -0
  287. package/build/types/src/utils/buildUrl/index.d.ts +1 -0
  288. package/build/types/src/utils/chains/index.d.ts +1 -0
  289. package/build/types/src/utils/common/index.d.ts +1 -0
  290. package/build/types/src/utils/{common.d.ts → common/utils.d.ts} +0 -1
  291. package/build/types/src/utils/errors/parseError.d.ts +13 -1
  292. package/build/types/src/utils/fees/executionFee.d.ts +3 -3
  293. package/build/types/src/utils/fees/getNaiveEstimatedGasBySwapCount.d.ts +1 -1
  294. package/build/types/src/utils/fees/index.d.ts +10 -13
  295. package/build/types/src/utils/fees/priceImpact.d.ts +4 -3
  296. package/build/types/src/{types/fees.d.ts → utils/fees/types.d.ts} +2 -2
  297. package/build/types/src/utils/gelatoRelay/index.d.ts +1 -0
  298. package/build/types/src/utils/graphqlFetcher/index.d.ts +1 -0
  299. package/build/types/src/utils/hash/index.d.ts +1 -0
  300. package/build/types/src/utils/http/http.d.ts +9 -0
  301. package/build/types/src/utils/http/types.d.ts +7 -0
  302. package/build/types/src/utils/indexers/index.d.ts +1 -0
  303. package/build/types/src/utils/markets/__tests__/mockMarkets.d.ts +9 -0
  304. package/build/types/src/utils/markets/api.d.ts +9 -0
  305. package/build/types/src/utils/markets/hashKeys.d.ts +23 -0
  306. package/build/types/src/utils/markets/index.d.ts +5 -0
  307. package/build/types/src/utils/markets/multicall.d.ts +25 -0
  308. package/build/types/src/{types/markets.d.ts → utils/markets/types.d.ts} +64 -1
  309. package/build/types/src/utils/markets/utils.d.ts +122 -0
  310. package/build/types/src/utils/numbers/index.d.ts +1 -0
  311. package/build/types/src/utils/{numbers.d.ts → numbers/utils.d.ts} +5 -1
  312. package/build/types/src/utils/objects/index.d.ts +1 -0
  313. package/build/types/src/utils/{objects.d.ts → objects/utils.d.ts} +1 -0
  314. package/build/types/src/utils/orderTransactions/index.d.ts +1 -0
  315. package/build/types/src/utils/{orderTransactions.d.ts → orderTransactions/utils.d.ts} +6 -6
  316. package/build/types/src/utils/orders/api.d.ts +7 -0
  317. package/build/types/src/utils/orders/index.d.ts +3 -0
  318. package/build/types/src/{types/orders.d.ts → utils/orders/types.d.ts} +30 -3
  319. package/build/types/src/utils/{orders.d.ts → orders/utils.d.ts} +3 -3
  320. package/build/types/src/utils/positions/api.d.ts +8 -0
  321. package/build/types/src/utils/positions/index.d.ts +3 -0
  322. package/build/types/src/{types/positions.d.ts → utils/positions/types.d.ts} +7 -18
  323. package/build/types/src/utils/{positions.d.ts → positions/utils.d.ts} +45 -4
  324. package/build/types/src/utils/prices/index.d.ts +1 -0
  325. package/build/types/src/utils/{prices.d.ts → prices/utils.d.ts} +4 -4
  326. package/build/types/src/utils/referrals/index.d.ts +2 -0
  327. package/build/types/src/utils/sidecarOrders/index.d.ts +1 -0
  328. package/build/types/src/{types/sidecarOrders.d.ts → utils/sidecarOrders/types.d.ts} +2 -2
  329. package/build/types/src/utils/swap/botanixStaking.d.ts +2 -2
  330. package/build/types/src/utils/swap/buildSwapStrategy.d.ts +5 -5
  331. package/build/types/src/utils/swap/externalSwapPath.d.ts +1 -1
  332. package/build/types/src/utils/swap/externalSwapQuoteByPath.d.ts +1 -1
  333. package/build/types/src/utils/swap/findSwapPathsBetweenTokens.d.ts +1 -1
  334. package/build/types/src/utils/swap/index.d.ts +12 -0
  335. package/build/types/src/utils/swap/preparedSwapData.d.ts +1 -1
  336. package/build/types/src/utils/swap/swapPath.d.ts +6 -6
  337. package/build/types/src/utils/swap/swapRouting.d.ts +5 -5
  338. package/build/types/src/utils/swap/swapStats.d.ts +3 -3
  339. package/build/types/src/utils/swap/swapValues.d.ts +4 -4
  340. package/build/types/src/{types/swapStrategy.d.ts → utils/swap/types.d.ts} +1 -1
  341. package/build/types/src/utils/time/index.d.ts +1 -0
  342. package/build/types/src/utils/tokens/index.d.ts +2 -0
  343. package/build/types/src/{types/tokens.d.ts → utils/tokens/types.d.ts} +1 -1
  344. package/build/types/src/utils/{tokens.d.ts → tokens/utils.d.ts} +2 -2
  345. package/build/types/src/utils/trade/decrease.d.ts +5 -5
  346. package/build/types/src/utils/trade/increase.d.ts +5 -5
  347. package/build/types/src/utils/trade/index.d.ts +3 -0
  348. package/build/types/src/utils/trade/trade.d.ts +1 -1
  349. package/build/types/src/{types/trade.d.ts → utils/trade/types.d.ts} +4 -4
  350. package/build/types/src/utils/tradeHistory/index.d.ts +2 -0
  351. package/build/types/src/{types/tradeHistory.d.ts → utils/tradeHistory/types.d.ts} +5 -5
  352. package/build/types/src/utils/{tradeHistory.d.ts → tradeHistory/utils.d.ts} +4 -4
  353. package/build/types/src/utils/twap/index.d.ts +3 -2
  354. package/build/types/src/utils/{types.d.ts → types/index.d.ts} +0 -1
  355. package/package.json +280 -31
  356. package/build/cjs/src/modules/markets/index.js +0 -366
  357. package/build/cjs/src/prebuilt/index.js +0 -15
  358. package/build/cjs/src/utils/markets.js +0 -195
  359. package/build/cjs/src/utils/positions.js +0 -213
  360. package/build/cjs/src/utils/types.js +0 -13
  361. package/build/esm/src/modules/markets/index.js +0 -359
  362. package/build/esm/src/prebuilt/index.js +0 -7
  363. package/build/esm/src/utils/markets.js +0 -171
  364. package/build/esm/src/utils/positions.js +0 -197
  365. package/build/esm/src/utils/types.js +0 -8
  366. package/build/types/src/modules/markets/query-builders.d.ts +0 -42
  367. package/build/types/src/modules/markets/types.d.ts +0 -51
  368. package/build/types/src/prebuilt/index.d.ts +0 -24
  369. package/build/types/src/types/common.d.ts +0 -1
  370. package/build/types/src/utils/callContract.d.ts +0 -17
  371. package/build/types/src/utils/marketKeysAndConfigs.d.ts +0 -73
  372. package/build/types/src/utils/markets.d.ts +0 -58
  373. /package/build/cjs/src/{modules → clients/v1/modules}/base.js +0 -0
  374. /package/build/cjs/src/{modules/markets → clients/v1}/types.js +0 -0
  375. /package/build/cjs/src/{types/chains.js → utils/24h/types.js} +0 -0
  376. /package/build/cjs/src/utils/{LruCache.js → LruCache/utils.js} +0 -0
  377. /package/build/cjs/src/utils/{abort.js → abort/utils.js} +0 -0
  378. /package/build/cjs/src/utils/{bigmath.js → bigmath/utils.js} +0 -0
  379. /package/build/cjs/src/utils/{buildUrl.js → buildUrl/utils.js} +0 -0
  380. /package/build/cjs/src/{types/common.js → utils/chains/types.js} +0 -0
  381. /package/build/cjs/src/{types/fees.js → utils/fees/types.js} +0 -0
  382. /package/build/cjs/src/utils/{gelatoRelay.js → gelatoRelay/utils.js} +0 -0
  383. /package/build/cjs/src/utils/{graphqlFetcher.js → graphqlFetcher/utils.js} +0 -0
  384. /package/build/cjs/src/{types/markets.js → utils/http/types.js} +0 -0
  385. /package/build/cjs/src/{types/positions.js → utils/markets/types.js} +0 -0
  386. /package/build/cjs/src/{types/orders.js → utils/orders/types.js} +0 -0
  387. /package/build/cjs/src/{types/sdk.js → utils/positions/types.js} +0 -0
  388. /package/build/cjs/src/{types/referrals.js → utils/referrals/types.js} +0 -0
  389. /package/build/cjs/src/utils/{referrals.js → referrals/utils.js} +0 -0
  390. /package/build/cjs/src/{types/sidecarOrders.js → utils/sidecarOrders/types.js} +0 -0
  391. /package/build/cjs/src/{types/swapStrategy.js → utils/swap/types.js} +0 -0
  392. /package/build/cjs/src/utils/{time.js → time/utils.js} +0 -0
  393. /package/build/cjs/src/{types/tokens.js → utils/tokens/types.js} +0 -0
  394. /package/build/cjs/src/{types/trade.js → utils/trade/types.js} +0 -0
  395. /package/build/cjs/src/{types/tradeHistory.js → utils/tradeHistory/types.js} +0 -0
  396. /package/build/cjs/src/{types/twap.js → utils/twap/types.js} +0 -0
  397. /package/build/esm/src/{modules → clients/v1/modules}/base.js +0 -0
  398. /package/build/esm/src/{modules/markets → clients/v1}/types.js +0 -0
  399. /package/build/esm/src/{types/chains.js → utils/24h/types.js} +0 -0
  400. /package/build/esm/src/utils/{LruCache.js → LruCache/utils.js} +0 -0
  401. /package/build/esm/src/utils/{abort.js → abort/utils.js} +0 -0
  402. /package/build/esm/src/utils/{bigmath.js → bigmath/utils.js} +0 -0
  403. /package/build/esm/src/utils/{buildUrl.js → buildUrl/utils.js} +0 -0
  404. /package/build/esm/src/{types/common.js → utils/chains/types.js} +0 -0
  405. /package/build/esm/src/{types/fees.js → utils/fees/types.js} +0 -0
  406. /package/build/esm/src/utils/{gelatoRelay.js → gelatoRelay/utils.js} +0 -0
  407. /package/build/esm/src/utils/{graphqlFetcher.js → graphqlFetcher/utils.js} +0 -0
  408. /package/build/esm/src/{types/markets.js → utils/http/types.js} +0 -0
  409. /package/build/esm/src/{types/positions.js → utils/markets/types.js} +0 -0
  410. /package/build/esm/src/{types/orders.js → utils/orders/types.js} +0 -0
  411. /package/build/esm/src/{types/sdk.js → utils/positions/types.js} +0 -0
  412. /package/build/esm/src/{types/referrals.js → utils/referrals/types.js} +0 -0
  413. /package/build/esm/src/utils/{referrals.js → referrals/utils.js} +0 -0
  414. /package/build/esm/src/{types/sidecarOrders.js → utils/sidecarOrders/types.js} +0 -0
  415. /package/build/esm/src/{types/swapStrategy.js → utils/swap/types.js} +0 -0
  416. /package/build/esm/src/utils/{time.js → time/utils.js} +0 -0
  417. /package/build/esm/src/{types/tokens.js → utils/tokens/types.js} +0 -0
  418. /package/build/esm/src/{types/trade.js → utils/trade/types.js} +0 -0
  419. /package/build/esm/src/{types/tradeHistory.js → utils/tradeHistory/types.js} +0 -0
  420. /package/build/esm/src/{types/twap.js → utils/twap/types.js} +0 -0
  421. /package/build/types/src/{modules → clients/v1/modules}/accounts/accounts.d.ts +0 -0
  422. /package/build/types/src/{modules → clients/v1/modules}/accounts/accounts.spec.d.ts +0 -0
  423. /package/build/types/src/{modules → clients/v1/modules}/base.d.ts +0 -0
  424. /package/build/types/src/{modules → clients/v1/modules}/markets/markets.spec.d.ts +0 -0
  425. /package/build/types/src/{modules → clients/v1/modules}/orders/helpers.spec.d.ts +0 -0
  426. /package/build/types/src/{modules → clients/v1/modules}/orders/orders.spec.d.ts +0 -0
  427. /package/build/types/src/{modules → clients/v1/modules}/positions/positions.spec.d.ts +0 -0
  428. /package/build/types/src/{modules → clients/v1/modules}/tokens/tokens.spec.d.ts +0 -0
  429. /package/build/types/src/{modules → clients/v1/modules}/trades/trades.spec.d.ts +0 -0
  430. /package/build/types/src/utils/{LruCache.d.ts → LruCache/utils.d.ts} +0 -0
  431. /package/build/types/src/utils/{abort.d.ts → abort/utils.d.ts} +0 -0
  432. /package/build/types/src/utils/{bigmath.d.ts → bigmath/utils.d.ts} +0 -0
  433. /package/build/types/src/utils/{buildUrl.d.ts → buildUrl/utils.d.ts} +0 -0
  434. /package/build/types/src/{types/chains.d.ts → utils/chains/types.d.ts} +0 -0
  435. /package/build/types/src/utils/{gelatoRelay.d.ts → gelatoRelay/utils.d.ts} +0 -0
  436. /package/build/types/src/utils/{graphqlFetcher.d.ts → graphqlFetcher/utils.d.ts} +0 -0
  437. /package/build/types/src/utils/{hash.d.ts → hash/utils.d.ts} +0 -0
  438. /package/build/types/src/utils/{indexers.d.ts → indexers/utils.d.ts} +0 -0
  439. /package/build/types/src/{types/referrals.d.ts → utils/referrals/types.d.ts} +0 -0
  440. /package/build/types/src/utils/{referrals.d.ts → referrals/utils.d.ts} +0 -0
  441. /package/build/types/src/utils/{time.d.ts → time/utils.d.ts} +0 -0
  442. /package/build/types/src/{types/twap.d.ts → utils/twap/types.d.ts} +0 -0
@@ -1468,27 +1468,51 @@ export var MultichainFundingSendEventOrderByInput;
1468
1468
  MultichainFundingSendEventOrderByInput["txn_DESC_NULLS_FIRST"] = "txn_DESC_NULLS_FIRST";
1469
1469
  MultichainFundingSendEventOrderByInput["txn_DESC_NULLS_LAST"] = "txn_DESC_NULLS_LAST";
1470
1470
  })(MultichainFundingSendEventOrderByInput || (MultichainFundingSendEventOrderByInput = {}));
1471
- export var MultichainMetadataOrderByInput;
1472
- (function (MultichainMetadataOrderByInput) {
1473
- MultichainMetadataOrderByInput["id_ASC"] = "id_ASC";
1474
- MultichainMetadataOrderByInput["id_ASC_NULLS_FIRST"] = "id_ASC_NULLS_FIRST";
1475
- MultichainMetadataOrderByInput["id_ASC_NULLS_LAST"] = "id_ASC_NULLS_LAST";
1476
- MultichainMetadataOrderByInput["id_DESC"] = "id_DESC";
1477
- MultichainMetadataOrderByInput["id_DESC_NULLS_FIRST"] = "id_DESC_NULLS_FIRST";
1478
- MultichainMetadataOrderByInput["id_DESC_NULLS_LAST"] = "id_DESC_NULLS_LAST";
1479
- MultichainMetadataOrderByInput["lastBlockNumber_ASC"] = "lastBlockNumber_ASC";
1480
- MultichainMetadataOrderByInput["lastBlockNumber_ASC_NULLS_FIRST"] = "lastBlockNumber_ASC_NULLS_FIRST";
1481
- MultichainMetadataOrderByInput["lastBlockNumber_ASC_NULLS_LAST"] = "lastBlockNumber_ASC_NULLS_LAST";
1482
- MultichainMetadataOrderByInput["lastBlockNumber_DESC"] = "lastBlockNumber_DESC";
1483
- MultichainMetadataOrderByInput["lastBlockNumber_DESC_NULLS_FIRST"] = "lastBlockNumber_DESC_NULLS_FIRST";
1484
- MultichainMetadataOrderByInput["lastBlockNumber_DESC_NULLS_LAST"] = "lastBlockNumber_DESC_NULLS_LAST";
1485
- MultichainMetadataOrderByInput["lastBlockTimestamp_ASC"] = "lastBlockTimestamp_ASC";
1486
- MultichainMetadataOrderByInput["lastBlockTimestamp_ASC_NULLS_FIRST"] = "lastBlockTimestamp_ASC_NULLS_FIRST";
1487
- MultichainMetadataOrderByInput["lastBlockTimestamp_ASC_NULLS_LAST"] = "lastBlockTimestamp_ASC_NULLS_LAST";
1488
- MultichainMetadataOrderByInput["lastBlockTimestamp_DESC"] = "lastBlockTimestamp_DESC";
1489
- MultichainMetadataOrderByInput["lastBlockTimestamp_DESC_NULLS_FIRST"] = "lastBlockTimestamp_DESC_NULLS_FIRST";
1490
- MultichainMetadataOrderByInput["lastBlockTimestamp_DESC_NULLS_LAST"] = "lastBlockTimestamp_DESC_NULLS_LAST";
1491
- })(MultichainMetadataOrderByInput || (MultichainMetadataOrderByInput = {}));
1471
+ export var MultichainSamechainFundingEventOrderByInput;
1472
+ (function (MultichainSamechainFundingEventOrderByInput) {
1473
+ MultichainSamechainFundingEventOrderByInput["account_ASC"] = "account_ASC";
1474
+ MultichainSamechainFundingEventOrderByInput["account_ASC_NULLS_FIRST"] = "account_ASC_NULLS_FIRST";
1475
+ MultichainSamechainFundingEventOrderByInput["account_ASC_NULLS_LAST"] = "account_ASC_NULLS_LAST";
1476
+ MultichainSamechainFundingEventOrderByInput["account_DESC"] = "account_DESC";
1477
+ MultichainSamechainFundingEventOrderByInput["account_DESC_NULLS_FIRST"] = "account_DESC_NULLS_FIRST";
1478
+ MultichainSamechainFundingEventOrderByInput["account_DESC_NULLS_LAST"] = "account_DESC_NULLS_LAST";
1479
+ MultichainSamechainFundingEventOrderByInput["amount_ASC"] = "amount_ASC";
1480
+ MultichainSamechainFundingEventOrderByInput["amount_ASC_NULLS_FIRST"] = "amount_ASC_NULLS_FIRST";
1481
+ MultichainSamechainFundingEventOrderByInput["amount_ASC_NULLS_LAST"] = "amount_ASC_NULLS_LAST";
1482
+ MultichainSamechainFundingEventOrderByInput["amount_DESC"] = "amount_DESC";
1483
+ MultichainSamechainFundingEventOrderByInput["amount_DESC_NULLS_FIRST"] = "amount_DESC_NULLS_FIRST";
1484
+ MultichainSamechainFundingEventOrderByInput["amount_DESC_NULLS_LAST"] = "amount_DESC_NULLS_LAST";
1485
+ MultichainSamechainFundingEventOrderByInput["id_ASC"] = "id_ASC";
1486
+ MultichainSamechainFundingEventOrderByInput["id_ASC_NULLS_FIRST"] = "id_ASC_NULLS_FIRST";
1487
+ MultichainSamechainFundingEventOrderByInput["id_ASC_NULLS_LAST"] = "id_ASC_NULLS_LAST";
1488
+ MultichainSamechainFundingEventOrderByInput["id_DESC"] = "id_DESC";
1489
+ MultichainSamechainFundingEventOrderByInput["id_DESC_NULLS_FIRST"] = "id_DESC_NULLS_FIRST";
1490
+ MultichainSamechainFundingEventOrderByInput["id_DESC_NULLS_LAST"] = "id_DESC_NULLS_LAST";
1491
+ MultichainSamechainFundingEventOrderByInput["operation_ASC"] = "operation_ASC";
1492
+ MultichainSamechainFundingEventOrderByInput["operation_ASC_NULLS_FIRST"] = "operation_ASC_NULLS_FIRST";
1493
+ MultichainSamechainFundingEventOrderByInput["operation_ASC_NULLS_LAST"] = "operation_ASC_NULLS_LAST";
1494
+ MultichainSamechainFundingEventOrderByInput["operation_DESC"] = "operation_DESC";
1495
+ MultichainSamechainFundingEventOrderByInput["operation_DESC_NULLS_FIRST"] = "operation_DESC_NULLS_FIRST";
1496
+ MultichainSamechainFundingEventOrderByInput["operation_DESC_NULLS_LAST"] = "operation_DESC_NULLS_LAST";
1497
+ MultichainSamechainFundingEventOrderByInput["timestamp_ASC"] = "timestamp_ASC";
1498
+ MultichainSamechainFundingEventOrderByInput["timestamp_ASC_NULLS_FIRST"] = "timestamp_ASC_NULLS_FIRST";
1499
+ MultichainSamechainFundingEventOrderByInput["timestamp_ASC_NULLS_LAST"] = "timestamp_ASC_NULLS_LAST";
1500
+ MultichainSamechainFundingEventOrderByInput["timestamp_DESC"] = "timestamp_DESC";
1501
+ MultichainSamechainFundingEventOrderByInput["timestamp_DESC_NULLS_FIRST"] = "timestamp_DESC_NULLS_FIRST";
1502
+ MultichainSamechainFundingEventOrderByInput["timestamp_DESC_NULLS_LAST"] = "timestamp_DESC_NULLS_LAST";
1503
+ MultichainSamechainFundingEventOrderByInput["token_ASC"] = "token_ASC";
1504
+ MultichainSamechainFundingEventOrderByInput["token_ASC_NULLS_FIRST"] = "token_ASC_NULLS_FIRST";
1505
+ MultichainSamechainFundingEventOrderByInput["token_ASC_NULLS_LAST"] = "token_ASC_NULLS_LAST";
1506
+ MultichainSamechainFundingEventOrderByInput["token_DESC"] = "token_DESC";
1507
+ MultichainSamechainFundingEventOrderByInput["token_DESC_NULLS_FIRST"] = "token_DESC_NULLS_FIRST";
1508
+ MultichainSamechainFundingEventOrderByInput["token_DESC_NULLS_LAST"] = "token_DESC_NULLS_LAST";
1509
+ MultichainSamechainFundingEventOrderByInput["txHash_ASC"] = "txHash_ASC";
1510
+ MultichainSamechainFundingEventOrderByInput["txHash_ASC_NULLS_FIRST"] = "txHash_ASC_NULLS_FIRST";
1511
+ MultichainSamechainFundingEventOrderByInput["txHash_ASC_NULLS_LAST"] = "txHash_ASC_NULLS_LAST";
1512
+ MultichainSamechainFundingEventOrderByInput["txHash_DESC"] = "txHash_DESC";
1513
+ MultichainSamechainFundingEventOrderByInput["txHash_DESC_NULLS_FIRST"] = "txHash_DESC_NULLS_FIRST";
1514
+ MultichainSamechainFundingEventOrderByInput["txHash_DESC_NULLS_LAST"] = "txHash_DESC_NULLS_LAST";
1515
+ })(MultichainSamechainFundingEventOrderByInput || (MultichainSamechainFundingEventOrderByInput = {}));
1492
1516
  export var OnChainSettingOrderByInput;
1493
1517
  (function (OnChainSettingOrderByInput) {
1494
1518
  OnChainSettingOrderByInput["id_ASC"] = "id_ASC";
@@ -2221,6 +2245,69 @@ export var PositionFeesEntityType;
2221
2245
  PositionFeesEntityType["PositionFeesCollected"] = "PositionFeesCollected";
2222
2246
  PositionFeesEntityType["PositionFeesInfo"] = "PositionFeesInfo";
2223
2247
  })(PositionFeesEntityType || (PositionFeesEntityType = {}));
2248
+ export var PositionFeesInfoWithPeriodOrderByInput;
2249
+ (function (PositionFeesInfoWithPeriodOrderByInput) {
2250
+ PositionFeesInfoWithPeriodOrderByInput["id_ASC"] = "id_ASC";
2251
+ PositionFeesInfoWithPeriodOrderByInput["id_ASC_NULLS_FIRST"] = "id_ASC_NULLS_FIRST";
2252
+ PositionFeesInfoWithPeriodOrderByInput["id_ASC_NULLS_LAST"] = "id_ASC_NULLS_LAST";
2253
+ PositionFeesInfoWithPeriodOrderByInput["id_DESC"] = "id_DESC";
2254
+ PositionFeesInfoWithPeriodOrderByInput["id_DESC_NULLS_FIRST"] = "id_DESC_NULLS_FIRST";
2255
+ PositionFeesInfoWithPeriodOrderByInput["id_DESC_NULLS_LAST"] = "id_DESC_NULLS_LAST";
2256
+ PositionFeesInfoWithPeriodOrderByInput["period_ASC"] = "period_ASC";
2257
+ PositionFeesInfoWithPeriodOrderByInput["period_ASC_NULLS_FIRST"] = "period_ASC_NULLS_FIRST";
2258
+ PositionFeesInfoWithPeriodOrderByInput["period_ASC_NULLS_LAST"] = "period_ASC_NULLS_LAST";
2259
+ PositionFeesInfoWithPeriodOrderByInput["period_DESC"] = "period_DESC";
2260
+ PositionFeesInfoWithPeriodOrderByInput["period_DESC_NULLS_FIRST"] = "period_DESC_NULLS_FIRST";
2261
+ PositionFeesInfoWithPeriodOrderByInput["period_DESC_NULLS_LAST"] = "period_DESC_NULLS_LAST";
2262
+ PositionFeesInfoWithPeriodOrderByInput["timestamp_ASC"] = "timestamp_ASC";
2263
+ PositionFeesInfoWithPeriodOrderByInput["timestamp_ASC_NULLS_FIRST"] = "timestamp_ASC_NULLS_FIRST";
2264
+ PositionFeesInfoWithPeriodOrderByInput["timestamp_ASC_NULLS_LAST"] = "timestamp_ASC_NULLS_LAST";
2265
+ PositionFeesInfoWithPeriodOrderByInput["timestamp_DESC"] = "timestamp_DESC";
2266
+ PositionFeesInfoWithPeriodOrderByInput["timestamp_DESC_NULLS_FIRST"] = "timestamp_DESC_NULLS_FIRST";
2267
+ PositionFeesInfoWithPeriodOrderByInput["timestamp_DESC_NULLS_LAST"] = "timestamp_DESC_NULLS_LAST";
2268
+ PositionFeesInfoWithPeriodOrderByInput["totalBorrowingFeeUsd_ASC"] = "totalBorrowingFeeUsd_ASC";
2269
+ PositionFeesInfoWithPeriodOrderByInput["totalBorrowingFeeUsd_ASC_NULLS_FIRST"] = "totalBorrowingFeeUsd_ASC_NULLS_FIRST";
2270
+ PositionFeesInfoWithPeriodOrderByInput["totalBorrowingFeeUsd_ASC_NULLS_LAST"] = "totalBorrowingFeeUsd_ASC_NULLS_LAST";
2271
+ PositionFeesInfoWithPeriodOrderByInput["totalBorrowingFeeUsd_DESC"] = "totalBorrowingFeeUsd_DESC";
2272
+ PositionFeesInfoWithPeriodOrderByInput["totalBorrowingFeeUsd_DESC_NULLS_FIRST"] = "totalBorrowingFeeUsd_DESC_NULLS_FIRST";
2273
+ PositionFeesInfoWithPeriodOrderByInput["totalBorrowingFeeUsd_DESC_NULLS_LAST"] = "totalBorrowingFeeUsd_DESC_NULLS_LAST";
2274
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeAmount_ASC"] = "totalLiquidationFeeAmount_ASC";
2275
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeAmount_ASC_NULLS_FIRST"] = "totalLiquidationFeeAmount_ASC_NULLS_FIRST";
2276
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeAmount_ASC_NULLS_LAST"] = "totalLiquidationFeeAmount_ASC_NULLS_LAST";
2277
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeAmount_DESC"] = "totalLiquidationFeeAmount_DESC";
2278
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeAmount_DESC_NULLS_FIRST"] = "totalLiquidationFeeAmount_DESC_NULLS_FIRST";
2279
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeAmount_DESC_NULLS_LAST"] = "totalLiquidationFeeAmount_DESC_NULLS_LAST";
2280
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeUsd_ASC"] = "totalLiquidationFeeUsd_ASC";
2281
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeUsd_ASC_NULLS_FIRST"] = "totalLiquidationFeeUsd_ASC_NULLS_FIRST";
2282
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeUsd_ASC_NULLS_LAST"] = "totalLiquidationFeeUsd_ASC_NULLS_LAST";
2283
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeUsd_DESC"] = "totalLiquidationFeeUsd_DESC";
2284
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeUsd_DESC_NULLS_FIRST"] = "totalLiquidationFeeUsd_DESC_NULLS_FIRST";
2285
+ PositionFeesInfoWithPeriodOrderByInput["totalLiquidationFeeUsd_DESC_NULLS_LAST"] = "totalLiquidationFeeUsd_DESC_NULLS_LAST";
2286
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmountForPool_ASC"] = "totalPositionFeeAmountForPool_ASC";
2287
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmountForPool_ASC_NULLS_FIRST"] = "totalPositionFeeAmountForPool_ASC_NULLS_FIRST";
2288
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmountForPool_ASC_NULLS_LAST"] = "totalPositionFeeAmountForPool_ASC_NULLS_LAST";
2289
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmountForPool_DESC"] = "totalPositionFeeAmountForPool_DESC";
2290
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmountForPool_DESC_NULLS_FIRST"] = "totalPositionFeeAmountForPool_DESC_NULLS_FIRST";
2291
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmountForPool_DESC_NULLS_LAST"] = "totalPositionFeeAmountForPool_DESC_NULLS_LAST";
2292
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmount_ASC"] = "totalPositionFeeAmount_ASC";
2293
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmount_ASC_NULLS_FIRST"] = "totalPositionFeeAmount_ASC_NULLS_FIRST";
2294
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmount_ASC_NULLS_LAST"] = "totalPositionFeeAmount_ASC_NULLS_LAST";
2295
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmount_DESC"] = "totalPositionFeeAmount_DESC";
2296
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmount_DESC_NULLS_FIRST"] = "totalPositionFeeAmount_DESC_NULLS_FIRST";
2297
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeAmount_DESC_NULLS_LAST"] = "totalPositionFeeAmount_DESC_NULLS_LAST";
2298
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsdForPool_ASC"] = "totalPositionFeeUsdForPool_ASC";
2299
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsdForPool_ASC_NULLS_FIRST"] = "totalPositionFeeUsdForPool_ASC_NULLS_FIRST";
2300
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsdForPool_ASC_NULLS_LAST"] = "totalPositionFeeUsdForPool_ASC_NULLS_LAST";
2301
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsdForPool_DESC"] = "totalPositionFeeUsdForPool_DESC";
2302
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsdForPool_DESC_NULLS_FIRST"] = "totalPositionFeeUsdForPool_DESC_NULLS_FIRST";
2303
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsdForPool_DESC_NULLS_LAST"] = "totalPositionFeeUsdForPool_DESC_NULLS_LAST";
2304
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsd_ASC"] = "totalPositionFeeUsd_ASC";
2305
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsd_ASC_NULLS_FIRST"] = "totalPositionFeeUsd_ASC_NULLS_FIRST";
2306
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsd_ASC_NULLS_LAST"] = "totalPositionFeeUsd_ASC_NULLS_LAST";
2307
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsd_DESC"] = "totalPositionFeeUsd_DESC";
2308
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsd_DESC_NULLS_FIRST"] = "totalPositionFeeUsd_DESC_NULLS_FIRST";
2309
+ PositionFeesInfoWithPeriodOrderByInput["totalPositionFeeUsd_DESC_NULLS_LAST"] = "totalPositionFeeUsd_DESC_NULLS_LAST";
2310
+ })(PositionFeesInfoWithPeriodOrderByInput || (PositionFeesInfoWithPeriodOrderByInput = {}));
2224
2311
  export var PositionOrderByInput;
2225
2312
  (function (PositionOrderByInput) {
2226
2313
  PositionOrderByInput["accountStat_closedCount_ASC"] = "accountStat_closedCount_ASC";
@@ -2657,6 +2744,39 @@ export var SwapFeesInfoOrderByInput;
2657
2744
  SwapFeesInfoOrderByInput["transaction_transactionIndex_DESC_NULLS_FIRST"] = "transaction_transactionIndex_DESC_NULLS_FIRST";
2658
2745
  SwapFeesInfoOrderByInput["transaction_transactionIndex_DESC_NULLS_LAST"] = "transaction_transactionIndex_DESC_NULLS_LAST";
2659
2746
  })(SwapFeesInfoOrderByInput || (SwapFeesInfoOrderByInput = {}));
2747
+ export var SwapFeesInfoWithPeriodOrderByInput;
2748
+ (function (SwapFeesInfoWithPeriodOrderByInput) {
2749
+ SwapFeesInfoWithPeriodOrderByInput["id_ASC"] = "id_ASC";
2750
+ SwapFeesInfoWithPeriodOrderByInput["id_ASC_NULLS_FIRST"] = "id_ASC_NULLS_FIRST";
2751
+ SwapFeesInfoWithPeriodOrderByInput["id_ASC_NULLS_LAST"] = "id_ASC_NULLS_LAST";
2752
+ SwapFeesInfoWithPeriodOrderByInput["id_DESC"] = "id_DESC";
2753
+ SwapFeesInfoWithPeriodOrderByInput["id_DESC_NULLS_FIRST"] = "id_DESC_NULLS_FIRST";
2754
+ SwapFeesInfoWithPeriodOrderByInput["id_DESC_NULLS_LAST"] = "id_DESC_NULLS_LAST";
2755
+ SwapFeesInfoWithPeriodOrderByInput["period_ASC"] = "period_ASC";
2756
+ SwapFeesInfoWithPeriodOrderByInput["period_ASC_NULLS_FIRST"] = "period_ASC_NULLS_FIRST";
2757
+ SwapFeesInfoWithPeriodOrderByInput["period_ASC_NULLS_LAST"] = "period_ASC_NULLS_LAST";
2758
+ SwapFeesInfoWithPeriodOrderByInput["period_DESC"] = "period_DESC";
2759
+ SwapFeesInfoWithPeriodOrderByInput["period_DESC_NULLS_FIRST"] = "period_DESC_NULLS_FIRST";
2760
+ SwapFeesInfoWithPeriodOrderByInput["period_DESC_NULLS_LAST"] = "period_DESC_NULLS_LAST";
2761
+ SwapFeesInfoWithPeriodOrderByInput["timestamp_ASC"] = "timestamp_ASC";
2762
+ SwapFeesInfoWithPeriodOrderByInput["timestamp_ASC_NULLS_FIRST"] = "timestamp_ASC_NULLS_FIRST";
2763
+ SwapFeesInfoWithPeriodOrderByInput["timestamp_ASC_NULLS_LAST"] = "timestamp_ASC_NULLS_LAST";
2764
+ SwapFeesInfoWithPeriodOrderByInput["timestamp_DESC"] = "timestamp_DESC";
2765
+ SwapFeesInfoWithPeriodOrderByInput["timestamp_DESC_NULLS_FIRST"] = "timestamp_DESC_NULLS_FIRST";
2766
+ SwapFeesInfoWithPeriodOrderByInput["timestamp_DESC_NULLS_LAST"] = "timestamp_DESC_NULLS_LAST";
2767
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeReceiverUsd_ASC"] = "totalFeeReceiverUsd_ASC";
2768
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeReceiverUsd_ASC_NULLS_FIRST"] = "totalFeeReceiverUsd_ASC_NULLS_FIRST";
2769
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeReceiverUsd_ASC_NULLS_LAST"] = "totalFeeReceiverUsd_ASC_NULLS_LAST";
2770
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeReceiverUsd_DESC"] = "totalFeeReceiverUsd_DESC";
2771
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeReceiverUsd_DESC_NULLS_FIRST"] = "totalFeeReceiverUsd_DESC_NULLS_FIRST";
2772
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeReceiverUsd_DESC_NULLS_LAST"] = "totalFeeReceiverUsd_DESC_NULLS_LAST";
2773
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeUsdForPool_ASC"] = "totalFeeUsdForPool_ASC";
2774
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeUsdForPool_ASC_NULLS_FIRST"] = "totalFeeUsdForPool_ASC_NULLS_FIRST";
2775
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeUsdForPool_ASC_NULLS_LAST"] = "totalFeeUsdForPool_ASC_NULLS_LAST";
2776
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeUsdForPool_DESC"] = "totalFeeUsdForPool_DESC";
2777
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeUsdForPool_DESC_NULLS_FIRST"] = "totalFeeUsdForPool_DESC_NULLS_FIRST";
2778
+ SwapFeesInfoWithPeriodOrderByInput["totalFeeUsdForPool_DESC_NULLS_LAST"] = "totalFeeUsdForPool_DESC_NULLS_LAST";
2779
+ })(SwapFeesInfoWithPeriodOrderByInput || (SwapFeesInfoWithPeriodOrderByInput = {}));
2660
2780
  export var SwapInfoOrderByInput;
2661
2781
  (function (SwapInfoOrderByInput) {
2662
2782
  SwapInfoOrderByInput["amountInAfterFees_ASC"] = "amountInAfterFees_ASC";
@@ -0,0 +1,11 @@
1
+ import { ARBITRUM, ARBITRUM_SEPOLIA, AVALANCHE, AVALANCHE_FUJI, BOTANIX } from "./chains";
2
+ const API_URLS = {
3
+ [ARBITRUM]: "https://gmx-api-arbitrum-dev-ikpem.ondigitalocean.app/api/v1",
4
+ [AVALANCHE]: "",
5
+ [AVALANCHE_FUJI]: "",
6
+ [BOTANIX]: "",
7
+ [ARBITRUM_SEPOLIA]: "",
8
+ };
9
+ export function getApiUrl(chainId) {
10
+ return API_URLS[chainId];
11
+ }
@@ -5,13 +5,17 @@ export { ARBITRUM, AVALANCHE, AVALANCHE_FUJI, BOTANIX, ARBITRUM_SEPOLIA, SOURCE_
5
5
  export const CONTRACTS_CHAIN_IDS = [ARBITRUM, AVALANCHE, BOTANIX];
6
6
  export const CONTRACTS_CHAIN_IDS_DEV = [...CONTRACTS_CHAIN_IDS, AVALANCHE_FUJI, ARBITRUM_SEPOLIA];
7
7
  export const SETTLEMENT_CHAIN_IDS = [ARBITRUM, AVALANCHE];
8
- export const SETTLEMENT_CHAIN_IDS_DEV = [...SETTLEMENT_CHAIN_IDS, ARBITRUM_SEPOLIA];
8
+ export const SETTLEMENT_CHAIN_IDS_DEV = [...SETTLEMENT_CHAIN_IDS, ARBITRUM_SEPOLIA, AVALANCHE_FUJI];
9
9
  export const SOURCE_CHAIN_IDS = [
10
10
  SOURCE_OPTIMISM_SEPOLIA,
11
11
  SOURCE_SEPOLIA,
12
12
  SOURCE_BASE_MAINNET,
13
13
  SOURCE_BSC_MAINNET,
14
14
  SOURCE_ETHEREUM_MAINNET,
15
+ ARBITRUM_SEPOLIA,
16
+ ARBITRUM,
17
+ AVALANCHE,
18
+ AVALANCHE_FUJI,
15
19
  ];
16
20
  export const GMX_ACCOUNT_PSEUDO_CHAIN_ID = 0;
17
21
  const CONTRACTS_CHAIN_CONFIGS = {
@@ -147,6 +151,30 @@ const SOURCE_CHAIN_CONFIGS = {
147
151
  slug: "ethereum-mainnet",
148
152
  explorerUrl: "https://etherscan.io/",
149
153
  },
154
+ [ARBITRUM]: {
155
+ chainId: ARBITRUM,
156
+ name: "Arbitrum",
157
+ slug: "arbitrum",
158
+ explorerUrl: "https://arbiscan.io/",
159
+ },
160
+ [AVALANCHE]: {
161
+ chainId: AVALANCHE,
162
+ name: "Avalanche",
163
+ slug: "avalanche",
164
+ explorerUrl: "https://snowtrace.io/",
165
+ },
166
+ [ARBITRUM_SEPOLIA]: {
167
+ chainId: ARBITRUM_SEPOLIA,
168
+ name: "Arbitrum Sepolia",
169
+ slug: "arbitrum-sepolia",
170
+ explorerUrl: "https://sepolia.arbiscan.io/",
171
+ },
172
+ [AVALANCHE_FUJI]: {
173
+ chainId: AVALANCHE_FUJI,
174
+ name: "Avalanche Fuji",
175
+ slug: "avalanche-fuji",
176
+ explorerUrl: "https://testnet.snowtrace.io/",
177
+ },
150
178
  // Use this notation to correctly infer chain names, etc. from config
151
179
  };
152
180
  const ALL_CHAIN_CONFIGS = {
@@ -150,6 +150,9 @@ export function swapFeeFactorKey(market, forPositiveImpact) {
150
150
  export function atomicSwapFeeFactorKey(market) {
151
151
  return hashData(["bytes32", "address"], [ATOMIC_SWAP_FEE_FACTOR_KEY, market]);
152
152
  }
153
+ export function withdrawalFeeFactorKey(market, forBalanceWasImproved) {
154
+ return hashData(["bytes32", "address", "bool"], [WITHDRAWAL_FEE_FACTOR_KEY, market, forBalanceWasImproved]);
155
+ }
153
156
  export function openInterestKey(market, collateralToken, isLong) {
154
157
  return hashData(["bytes32", "address", "address", "bool"], [OPEN_INTEREST_KEY, market, collateralToken, isLong]);
155
158
  }
@@ -866,6 +866,27 @@ export const MARKETS = {
866
866
  longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
867
867
  shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
868
868
  },
869
+ // XAUT/USD [WBTC-USDC]
870
+ "0xeb28aD1a2e497F4Acc5D9b87e7B496623C93061E": {
871
+ marketTokenAddress: "0xeb28aD1a2e497F4Acc5D9b87e7B496623C93061E",
872
+ indexTokenAddress: "0x7624cccCc59361D583F28BEC40D37e7771d2ef5D",
873
+ longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
874
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
875
+ },
876
+ // LIT/USD [WETH-USDC]
877
+ "0x044dFE01863CE85f9ECd5639eE5485c90AC320FC": {
878
+ marketTokenAddress: "0x044dFE01863CE85f9ECd5639eE5485c90AC320FC",
879
+ indexTokenAddress: "0xE6172EecBB07F197F52bb73d74daa0e19C31c4Db",
880
+ longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
881
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
882
+ },
883
+ // IP/USD [WBTC-USDC]
884
+ "0x5ff52BE1968107D7886a8E9A64874A45c8F5D96a": {
885
+ marketTokenAddress: "0x5ff52BE1968107D7886a8E9A64874A45c8F5D96a",
886
+ indexTokenAddress: "0xe7304E9F4ca383BD6312a5179cdC7B40B96A6F5a",
887
+ longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
888
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
889
+ },
869
890
  },
870
891
  [AVALANCHE]: {
871
892
  // BTC/USD [BTC-USDC]
@@ -1,22 +1,31 @@
1
- import { ARBITRUM_SEPOLIA, ARBITRUM, AVALANCHE, SOURCE_OPTIMISM_SEPOLIA, SOURCE_SEPOLIA, SOURCE_BASE_MAINNET, SOURCE_BSC_MAINNET, SOURCE_ETHEREUM_MAINNET, } from "./chainIds";
2
- function ensureExhaustive(value) {
3
- return Object.keys(value).map(Number);
4
- }
5
- export const SETTLEMENT_CHAINS = ensureExhaustive({
6
- [ARBITRUM_SEPOLIA]: true,
7
- [ARBITRUM]: true,
8
- [AVALANCHE]: true,
9
- });
10
- export const SOURCE_CHAINS = ensureExhaustive({
11
- [SOURCE_OPTIMISM_SEPOLIA]: true,
12
- [SOURCE_SEPOLIA]: true,
13
- [SOURCE_BASE_MAINNET]: true,
14
- [SOURCE_BSC_MAINNET]: true,
15
- [SOURCE_ETHEREUM_MAINNET]: true,
16
- });
1
+ import { ARBITRUM, AVALANCHE, AVALANCHE_FUJI, ARBITRUM_SEPOLIA, SOURCE_BASE_MAINNET, SOURCE_ETHEREUM_MAINNET, SOURCE_BSC_MAINNET, SOURCE_SEPOLIA, SOURCE_OPTIMISM_SEPOLIA, } from "./chainIds";
2
+ import { SETTLEMENT_CHAIN_IDS, SETTLEMENT_CHAIN_IDS_DEV, SOURCE_CHAIN_IDS, } from "./chains";
17
3
  export function isSettlementChain(chainId) {
18
- return SETTLEMENT_CHAINS.includes(chainId);
4
+ return SETTLEMENT_CHAIN_IDS.includes(chainId) || SETTLEMENT_CHAIN_IDS_DEV.includes(chainId);
5
+ }
6
+ const SOURCE_CHAIN_IDS_MAP = {
7
+ [ARBITRUM]: [SOURCE_BASE_MAINNET, SOURCE_ETHEREUM_MAINNET, SOURCE_BSC_MAINNET],
8
+ [AVALANCHE]: [SOURCE_BASE_MAINNET, SOURCE_BSC_MAINNET],
9
+ [AVALANCHE_FUJI]: [ARBITRUM_SEPOLIA],
10
+ [ARBITRUM_SEPOLIA]: [SOURCE_SEPOLIA, SOURCE_OPTIMISM_SEPOLIA],
11
+ };
12
+ export function isSourceChain(chainId, forSettlementChain) {
13
+ if (!chainId || !forSettlementChain) {
14
+ return false;
15
+ }
16
+ const sourceChainIds = SOURCE_CHAIN_IDS_MAP[forSettlementChain];
17
+ if (!sourceChainIds) {
18
+ return false;
19
+ }
20
+ return sourceChainIds.includes(chainId);
19
21
  }
20
- export function isSourceChain(chainId) {
21
- return SOURCE_CHAINS.includes(chainId);
22
+ /**
23
+ * Check if a chain is a source chain for any settlement chain
24
+ * Useful when settlement chain context is not available
25
+ */
26
+ export function isSourceChainForAnySettlementChain(chainId) {
27
+ if (!chainId) {
28
+ return false;
29
+ }
30
+ return SOURCE_CHAIN_IDS.includes(chainId);
22
31
  }
@@ -317,6 +317,7 @@ export const TOKENS = {
317
317
  symbol: "WIF",
318
318
  address: "0xA1b91fe9FD52141Ff8cac388Ce3F10BFDc1dE79d",
319
319
  decimals: 6,
320
+ priceDecimals: 5,
320
321
  categories: ["meme"],
321
322
  imageUrl: "https://assets.coingecko.com/coins/images/33566/standard/dogwifhat.jpg?1702499428",
322
323
  isPermitSupported: true,
@@ -1217,6 +1218,38 @@ export const TOKENS = {
1217
1218
  categories: ["layer1"],
1218
1219
  imageUrl: "https://assets.coingecko.com/coins/images/8834/standard/CHZ_Token_updated.png?1696508986",
1219
1220
  },
1221
+ {
1222
+ name: "Tether Gold",
1223
+ symbol: "XAUT",
1224
+ assetSymbol: "XAUT",
1225
+ baseSymbol: "XAUT",
1226
+ address: "0x7624cccCc59361D583F28BEC40D37e7771d2ef5D",
1227
+ isSynthetic: true,
1228
+ decimals: 18,
1229
+ priceDecimals: 2,
1230
+ categories: ["rwa"],
1231
+ imageUrl: "https://assets.coingecko.com/coins/images/10481/standard/Tether_Gold.png?1696510471",
1232
+ },
1233
+ {
1234
+ name: "Lighter",
1235
+ symbol: "LIT",
1236
+ address: "0xE6172EecBB07F197F52bb73d74daa0e19C31c4Db",
1237
+ isSynthetic: true,
1238
+ decimals: 18,
1239
+ priceDecimals: 4,
1240
+ categories: ["defi"],
1241
+ imageUrl: "https://assets.coingecko.com/coins/images/71121/standard/lighter.png?1765888098",
1242
+ },
1243
+ {
1244
+ name: "Story",
1245
+ symbol: "IP",
1246
+ address: "0xe7304E9F4ca383BD6312a5179cdC7B40B96A6F5a",
1247
+ isSynthetic: true,
1248
+ decimals: 18,
1249
+ priceDecimals: 4,
1250
+ categories: ["layer1"],
1251
+ imageUrl: "https://assets.coingecko.com/coins/images/54035/standard/Transparent_bg.png?1738075331",
1252
+ },
1220
1253
  ],
1221
1254
  [AVALANCHE]: [
1222
1255
  {
@@ -2072,6 +2105,9 @@ export function getNormalizedTokenSymbol(tokenSymbol) {
2072
2105
  else if (["PBTC", "STBTC"].includes(tokenSymbol)) {
2073
2106
  return "BTC";
2074
2107
  }
2108
+ else if (tokenSymbol === "XAUT") {
2109
+ return "XAUT.v2";
2110
+ }
2075
2111
  else if (tokenSymbol.includes(".")) {
2076
2112
  return tokenSymbol.split(".")[0];
2077
2113
  }
@@ -1,9 +1,7 @@
1
- import { zeroAddress } from "viem";
2
1
  import { USD_DECIMALS } from "../configs/factors";
3
- import { ExternalSwapAggregator } from "../types/trade";
4
- import { getMarketFullName } from "../utils/markets";
5
2
  import { expandDecimals } from "../utils/numbers";
6
- import { convertToTokenAmount, getTokenData } from "../utils/tokens";
3
+ import { convertToTokenAmount } from "../utils/tokens";
4
+ import { ExternalSwapAggregator } from "../utils/trade/types";
7
5
  export function usdToToken(usd, token) {
8
6
  return convertToTokenAmount(expandDecimals(usd, USD_DECIMALS), token.decimals, token.prices?.minPrice);
9
7
  }
@@ -130,122 +128,7 @@ export function mockTokensData(overrides = {}) {
130
128
  /**
131
129
  * @param marketKeys - array of market keys in the following format: indexToken-longToken-shortToken
132
130
  */
133
- export function mockMarketsData(marketKeys) {
134
- return marketKeys.reduce((acc, key) => {
135
- const [indexTokenAddress, longTokenAddress, shortTokenAddress] = key.split("-");
136
- acc[key] = {
137
- marketTokenAddress: key,
138
- indexTokenAddress,
139
- longTokenAddress,
140
- shortTokenAddress,
141
- isSameCollaterals: longTokenAddress === shortTokenAddress,
142
- isSpotOnly: indexTokenAddress === "SPOT",
143
- data: "",
144
- name: "Test Market",
145
- };
146
- return acc;
147
- }, {});
148
- }
149
- export function mockMarketsInfoData(tokensData, marketKeys, overrides = {}) {
150
- return marketKeys.reduce((acc, key) => {
151
- const [indexTokenAddress, longTokenAddress, shortTokenAddress] = key.split("-");
152
- const indexToken = getTokenData(tokensData, indexTokenAddress);
153
- const longToken = getTokenData(tokensData, longTokenAddress);
154
- const shortToken = getTokenData(tokensData, shortTokenAddress);
155
- const isSpotOnly = indexTokenAddress === "SPOT";
156
- acc[key] = {
157
- isDisabled: false,
158
- marketTokenAddress: key,
159
- indexTokenAddress,
160
- longTokenAddress,
161
- shortTokenAddress,
162
- isSameCollaterals: longTokenAddress === shortTokenAddress,
163
- isSpotOnly,
164
- name: getMarketFullName({ longToken, shortToken, indexToken, isSpotOnly }),
165
- longToken,
166
- shortToken,
167
- indexToken,
168
- longPoolAmount: usdToToken(1000, longToken),
169
- shortPoolAmount: usdToToken(1000, shortToken),
170
- maxLongPoolAmount: usdToToken(10000, longToken),
171
- maxShortPoolAmount: usdToToken(10000, shortToken),
172
- maxLongPoolUsdForDeposit: usdToToken(10000, longToken),
173
- maxShortPoolUsdForDeposit: usdToToken(10000, shortToken),
174
- poolValueMax: expandDecimals(2000, USD_DECIMALS),
175
- poolValueMin: expandDecimals(2000, USD_DECIMALS),
176
- reserveFactorLong: expandDecimals(5, 29),
177
- reserveFactorShort: expandDecimals(5, 29),
178
- openInterestReserveFactorLong: expandDecimals(5, 29),
179
- openInterestReserveFactorShort: expandDecimals(5, 29),
180
- maxOpenInterestLong: expandDecimals(5, 29),
181
- maxOpenInterestShort: expandDecimals(5, 29),
182
- positionImpactPoolAmount: usdToToken(1000, indexToken),
183
- positionImpactPoolDistributionRate: 0n,
184
- minPositionImpactPoolAmount: 0n,
185
- swapImpactPoolAmountLong: usdToToken(1000, longToken),
186
- swapImpactPoolAmountShort: usdToToken(1000, shortToken),
187
- positionFeeFactorForBalanceWasImproved: expandDecimals(5, 26),
188
- positionFeeFactorForBalanceWasNotImproved: expandDecimals(5, 26),
189
- positionImpactFactorPositive: expandDecimals(2, 23),
190
- positionImpactFactorNegative: expandDecimals(1, 23),
191
- maxPositionImpactFactorPositive: expandDecimals(2, 23),
192
- maxPositionImpactFactorNegative: expandDecimals(1, 23),
193
- maxPositionImpactFactorForLiquidations: expandDecimals(1, 23),
194
- maxLendableImpactFactor: expandDecimals(1, 23),
195
- maxLendableImpactFactorForWithdrawals: expandDecimals(1, 23),
196
- maxLendableImpactUsd: expandDecimals(1, 23),
197
- lentPositionImpactPoolAmount: expandDecimals(1, 23),
198
- positionImpactExponentFactorPositive: expandDecimals(2, 30),
199
- positionImpactExponentFactorNegative: expandDecimals(2, 30),
200
- useOpenInterestInTokensForBalance: true,
201
- swapFeeFactorForBalanceWasImproved: expandDecimals(2, 27),
202
- swapFeeFactorForBalanceWasNotImproved: expandDecimals(2, 27),
203
- atomicSwapFeeFactor: expandDecimals(2, 27),
204
- swapImpactFactorPositive: expandDecimals(2, 23),
205
- swapImpactFactorNegative: expandDecimals(1, 23),
206
- swapImpactExponentFactor: expandDecimals(2, 30),
207
- withdrawalFeeFactorBalanceWasImproved: expandDecimals(2, 27),
208
- withdrawalFeeFactorBalanceWasNotImproved: expandDecimals(2, 27),
209
- // MarketInfo
210
- borrowingFactorPerSecondForLongs: 0n,
211
- borrowingFactorPerSecondForShorts: 0n,
212
- borrowingExponentFactorLong: 0n,
213
- borrowingExponentFactorShort: 0n,
214
- fundingFactor: 0n,
215
- fundingExponentFactor: 0n,
216
- fundingIncreaseFactorPerSecond: 0n,
217
- fundingDecreaseFactorPerSecond: 0n,
218
- maxFundingFactorPerSecond: 0n,
219
- minFundingFactorPerSecond: 0n,
220
- thresholdForDecreaseFunding: 0n,
221
- thresholdForStableFunding: 0n,
222
- totalBorrowingFees: 0n,
223
- minCollateralFactor: 0n,
224
- minCollateralFactorForLiquidation: 0n,
225
- minCollateralFactorForOpenInterestLong: 0n,
226
- minCollateralFactorForOpenInterestShort: 0n,
227
- borrowingFactorLong: 0n,
228
- borrowingFactorShort: 0n,
229
- fundingFactorPerSecond: 0n,
230
- longsPayShorts: false,
231
- longInterestUsd: expandDecimals(500, USD_DECIMALS),
232
- shortInterestUsd: expandDecimals(500, USD_DECIMALS),
233
- longInterestInTokens: usdToToken(500, indexToken),
234
- shortInterestInTokens: usdToToken(500, indexToken),
235
- maxPnlFactorForTradersLong: expandDecimals(1, 30),
236
- maxPnlFactorForTradersShort: expandDecimals(1, 30),
237
- data: "",
238
- virtualPoolAmountForLongToken: 0n,
239
- virtualPoolAmountForShortToken: 0n,
240
- virtualInventoryForPositions: 0n,
241
- virtualMarketId: zeroAddress,
242
- virtualLongTokenId: zeroAddress,
243
- virtualShortTokenId: zeroAddress,
244
- ...(overrides[key] || {}),
245
- };
246
- return acc;
247
- }, {});
248
- }
131
+ export { mockMarketsData, mockMarketsInfoData } from "../utils/markets/__tests__/mockMarkets";
249
132
  export function mockExternalSwap({ inToken, outToken, amountIn, amountOut, priceIn, priceOut, feesUsd = expandDecimals(5, USD_DECIMALS), // $5 default fee
250
133
  data = "0x1", to = "0x6352a56caadC4F1E25CD6c75970Fa768A3304e64", receiver = "0x1234567890123456789012345678901234567890", }) {
251
134
  const usdIn = (amountIn * priceIn) / expandDecimals(1, inToken.decimals);
@@ -0,0 +1 @@
1
+ export * from "./types";
@@ -0,0 +1 @@
1
+ export * from "./utils";
@@ -1,7 +1,7 @@
1
1
  import { describe, it, expect } from "vitest";
2
2
  import { USD_DECIMALS } from "../../configs/factors";
3
- import { numberToBigint } from "../numbers";
4
3
  import { getFundingFactorPerPeriod } from "../fees";
4
+ import { numberToBigint } from "../numbers";
5
5
  const dollar = 10n ** BigInt(USD_DECIMALS);
6
6
  const eightMillion = 8000000n;
7
7
  const tenMillion = 10000000n;
@@ -9,7 +9,7 @@ function toFactor(percent) {
9
9
  const value = parseFloat(percent.replace("%", ""));
10
10
  return numberToBigint(value, 30 - 2);
11
11
  }
12
- const second = 1;
12
+ const second = 1n;
13
13
  describe("getFundingFactorPerPeriod", () => {
14
14
  it("works when short pay, shorts OI bigger", () => {
15
15
  const marketInfo = {
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
  import { BASIS_POINTS_DIVISOR_BIGINT, USD_DECIMALS } from "../../configs/factors";
3
- const ONE_USD = 1000000000000000000000000000000n;
4
3
  import { applyFactor, basisPointsToFloat, bigintToNumber, BN_NEGATIVE_ONE, BN_ONE, BN_ZERO, expandDecimals, formatAmount, formatAmountHuman, formatBalanceAmount, formatFactor, formatPercentage, formatTokenAmount, formatUsdPrice, getBasisPoints, numberToBigint, PERCENT_PRECISION_DECIMALS, PRECISION, PRECISION_DECIMALS, roundWithDecimals, roundUpMagnitudeDivision, toBigNumberWithDecimals, } from "../numbers";
4
+ const ONE_USD = 1000000000000000000000000000000n;
5
5
  describe("numbers utils", () => {
6
6
  it("constants", () => {
7
7
  // Just to confirm they exist and have no unexpected changes
@@ -2,10 +2,10 @@ import { zeroAddress, zeroHash } from "viem";
2
2
  import { describe, expect, it } from "vitest";
3
3
  import { ARBITRUM } from "../../../configs/chains";
4
4
  import { getTokenBySymbol, getWrappedToken, NATIVE_TOKEN_ADDRESS } from "../../../configs/tokens";
5
- import { OrderType } from "../../../types/orders";
5
+ import { mockExternalSwap } from "../../../test/mock";
6
6
  import { expandDecimals, parseValue, USD_DECIMALS } from "../../numbers";
7
+ import { OrderType } from "../../orders/types";
7
8
  import { buildIncreaseOrderPayload, getBatchExternalCalls, getBatchExternalSwapGasLimit, getBatchIsNativePayment, getBatchTotalExecutionFee, getBatchTotalPayCollateralAmount, getIsEmptyBatch, getIsInvalidBatchReceiver, } from "../../orderTransactions";
8
- import { mockExternalSwap } from "../../../test/mock";
9
9
  // Common tokens and addresses
10
10
  const CHAIN_ID = ARBITRUM;
11
11
  const ACCOUNT = "0x1234567890123456789012345678901234567890";
@@ -4,11 +4,11 @@ import { ARBITRUM } from "../../../configs/chains";
4
4
  import { getContract } from "../../../configs/contracts";
5
5
  import { MARKETS } from "../../../configs/markets";
6
6
  import { getTokenBySymbol, getWrappedToken, NATIVE_TOKEN_ADDRESS } from "../../../configs/tokens";
7
- import { DecreasePositionSwapType, OrderType } from "../../../types/orders";
7
+ import { MOCK_GAS_PRICE } from "../../../test/mock";
8
8
  import { MaxUint256, parseValue, USD_DECIMALS } from "../../numbers";
9
+ import { DecreasePositionSwapType, OrderType } from "../../orders/types";
9
10
  import { buildDecreaseOrderPayload, buildTwapOrdersPayloads, getIsTwapOrderPayload, } from "../../orderTransactions";
10
11
  import { decodeTwapUiFeeReceiver } from "../../twap/uiFeeReceiver";
11
- import { MOCK_GAS_PRICE } from "../../../test/mock";
12
12
  beforeAll(() => {
13
13
  vi.spyOn(Math, "random").mockReturnValue(0.5);
14
14
  });
@@ -3,10 +3,10 @@ import { ARBITRUM } from "../../../configs/chains";
3
3
  import { getContract } from "../../../configs/contracts";
4
4
  import { MARKETS } from "../../../configs/markets";
5
5
  import { getTokenBySymbol, getWrappedToken, NATIVE_TOKEN_ADDRESS } from "../../../configs/tokens";
6
- import { OrderType } from "../../../types/orders";
6
+ import { MOCK_GAS_PRICE, mockExternalSwap } from "../../../test/mock";
7
7
  import { parseValue, USD_DECIMALS } from "../../numbers";
8
+ import { OrderType } from "../../orders/types";
8
9
  import { buildIncreaseOrderPayload, buildUpdateOrderPayload, getBatchOrderMulticallPayload, } from "../../orderTransactions";
9
- import { MOCK_GAS_PRICE, mockExternalSwap } from "../../../test/mock";
10
10
  beforeAll(() => {
11
11
  vi.spyOn(Math, "random").mockReturnValue(0.5);
12
12
  });
@@ -2,9 +2,9 @@ import { encodeFunctionData, erc20Abi } from "viem";
2
2
  import { describe, expect, it } from "vitest";
3
3
  import { ARBITRUM } from "../../../configs/chains";
4
4
  import { getTokenBySymbol, getWrappedToken } from "../../../configs/tokens";
5
+ import { mockExternalSwap } from "../../../test/mock";
5
6
  import { expandDecimals, MaxUint256, parseValue, USD_DECIMALS } from "../../numbers";
6
7
  import { combineExternalCalls, getExternalCallsPayload } from "../../orderTransactions";
7
- import { mockExternalSwap } from "../../../test/mock";
8
8
  describe("External Calls", () => {
9
9
  const CHAIN_ID = ARBITRUM;
10
10
  const ACCOUNT = "0x1234567890123456789012345678901234567890";