@gmx-io/sdk 1.4.0 → 1.4.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 (157) hide show
  1. package/build/cjs/src/abis/GlvReader.js +940 -940
  2. package/build/cjs/src/abis/IStargate.js +603 -0
  3. package/build/cjs/src/abis/LayerZeroProvider.js +273 -46
  4. package/build/cjs/src/abis/index.js +2 -2
  5. package/build/cjs/src/configs/batch.js +29 -103
  6. package/build/cjs/src/configs/chainIds.js +2 -2
  7. package/build/cjs/src/configs/chains.js +230 -151
  8. package/build/cjs/src/configs/contracts.js +1 -5
  9. package/build/cjs/src/configs/dataStore.js +5 -4
  10. package/build/cjs/src/configs/express.js +1 -1
  11. package/build/cjs/src/configs/gasLimits.js +41 -0
  12. package/build/cjs/src/configs/markets.js +102 -1
  13. package/build/cjs/src/configs/multichain.js +1 -0
  14. package/build/cjs/src/configs/oracleKeeper.js +18 -20
  15. package/build/cjs/src/configs/tokens.js +98 -180
  16. package/build/cjs/src/modules/markets/index.js +6 -2
  17. package/build/cjs/src/modules/markets/markets.spec.js +5 -5
  18. package/build/cjs/src/modules/markets/query-builders.js +8 -0
  19. package/build/cjs/src/modules/orders/helpers.js +4 -2
  20. package/build/cjs/src/modules/orders/helpers.spec.js +1 -1
  21. package/build/cjs/src/modules/orders/orders.spec.js +1 -1
  22. package/build/cjs/src/modules/positions/positions.spec.js +2 -2
  23. package/build/cjs/src/modules/tokens/tokens.spec.js +2 -2
  24. package/build/cjs/src/modules/trades/trades.spec.js +1 -1
  25. package/build/cjs/src/modules/utils/utils.js +7 -6
  26. package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +64 -0
  27. package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +780 -0
  28. package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +120 -0
  29. package/build/cjs/src/test/mock.js +2 -0
  30. package/build/cjs/src/types/chains.js +2 -0
  31. package/build/cjs/src/types/orders.js +8 -2
  32. package/build/cjs/src/types/subsquid.js +241 -1
  33. package/build/cjs/src/types/tokens.js +7 -0
  34. package/build/cjs/src/utils/__tests__/abort.spec.js +122 -0
  35. package/build/cjs/src/utils/__tests__/numbers.spec.js +94 -14
  36. package/build/cjs/src/utils/abort.js +31 -0
  37. package/build/cjs/src/utils/callContract.js +4 -4
  38. package/build/cjs/src/utils/fees/executionFee.js +14 -11
  39. package/build/cjs/src/utils/fees/index.js +8 -2
  40. package/build/cjs/src/utils/marketKeysAndConfigs.js +8 -0
  41. package/build/cjs/src/utils/markets.js +7 -1
  42. package/build/cjs/src/utils/multicall.js +54 -17
  43. package/build/cjs/src/utils/numbers.js +25 -14
  44. package/build/cjs/src/utils/orders.js +2 -2
  45. package/build/cjs/src/utils/swap/__tests__/findSwapPathsBetweenTokens.spec.js +22 -0
  46. package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +264 -6
  47. package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +5 -4
  48. package/build/cjs/src/utils/swap/__tests__/swapStats.spec.js +10 -9
  49. package/build/cjs/src/utils/swap/buildSwapStrategy.js +20 -11
  50. package/build/cjs/src/utils/swap/findSwapPathsBetweenTokens.js +8 -4
  51. package/build/cjs/src/utils/swap/swapPath.js +6 -6
  52. package/build/cjs/src/utils/swap/swapRouting.js +8 -4
  53. package/build/cjs/src/utils/swap/swapStats.js +6 -6
  54. package/build/cjs/src/utils/swap/swapValues.js +17 -6
  55. package/build/cjs/src/utils/tokens.js +17 -1
  56. package/build/cjs/src/utils/trade/decrease.js +1 -1
  57. package/build/cjs/src/utils/trade/increase.js +3 -0
  58. package/build/esm/src/abis/GlvReader.js +940 -940
  59. package/build/esm/src/abis/IStargate.js +601 -0
  60. package/build/esm/src/abis/LayerZeroProvider.js +273 -46
  61. package/build/esm/src/abis/index.js +2 -2
  62. package/build/esm/src/configs/batch.js +30 -104
  63. package/build/esm/src/configs/chainIds.js +1 -1
  64. package/build/esm/src/configs/chains.js +212 -147
  65. package/build/esm/src/configs/contracts.js +1 -5
  66. package/build/esm/src/configs/dataStore.js +1 -0
  67. package/build/esm/src/configs/express.js +1 -1
  68. package/build/esm/src/configs/gasLimits.js +38 -0
  69. package/build/esm/src/configs/markets.js +95 -1
  70. package/build/esm/src/configs/multichain.js +2 -1
  71. package/build/esm/src/configs/oracleKeeper.js +17 -19
  72. package/build/esm/src/configs/tokens.js +97 -179
  73. package/build/esm/src/modules/markets/index.js +6 -2
  74. package/build/esm/src/modules/markets/markets.spec.js +5 -5
  75. package/build/esm/src/modules/markets/query-builders.js +8 -0
  76. package/build/esm/src/modules/orders/helpers.js +5 -3
  77. package/build/esm/src/modules/orders/helpers.spec.js +1 -1
  78. package/build/esm/src/modules/orders/orders.spec.js +1 -1
  79. package/build/esm/src/modules/positions/positions.spec.js +2 -2
  80. package/build/esm/src/modules/tokens/tokens.spec.js +2 -2
  81. package/build/esm/src/modules/trades/trades.spec.js +1 -1
  82. package/build/esm/src/modules/utils/utils.js +7 -6
  83. package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +64 -0
  84. package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +780 -0
  85. package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +120 -0
  86. package/build/esm/src/test/mock.js +2 -0
  87. package/build/esm/src/types/chains.js +1 -0
  88. package/build/esm/src/types/orders.js +8 -2
  89. package/build/esm/src/types/subsquid.js +240 -0
  90. package/build/esm/src/types/tokens.js +6 -1
  91. package/build/esm/src/utils/__tests__/abort.spec.js +120 -0
  92. package/build/esm/src/utils/__tests__/numbers.spec.js +95 -15
  93. package/build/esm/src/utils/abort.js +27 -0
  94. package/build/esm/src/utils/callContract.js +5 -5
  95. package/build/esm/src/utils/fees/executionFee.js +15 -12
  96. package/build/esm/src/utils/fees/index.js +8 -2
  97. package/build/esm/src/utils/marketKeysAndConfigs.js +9 -1
  98. package/build/esm/src/utils/markets.js +5 -0
  99. package/build/esm/src/utils/multicall.js +53 -16
  100. package/build/esm/src/utils/numbers.js +21 -12
  101. package/build/esm/src/utils/orders.js +3 -3
  102. package/build/esm/src/utils/swap/__tests__/findSwapPathsBetweenTokens.spec.js +22 -0
  103. package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +264 -6
  104. package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +5 -4
  105. package/build/esm/src/utils/swap/__tests__/swapStats.spec.js +10 -9
  106. package/build/esm/src/utils/swap/buildSwapStrategy.js +21 -12
  107. package/build/esm/src/utils/swap/findSwapPathsBetweenTokens.js +8 -4
  108. package/build/esm/src/utils/swap/swapPath.js +6 -6
  109. package/build/esm/src/utils/swap/swapRouting.js +8 -4
  110. package/build/esm/src/utils/swap/swapStats.js +6 -6
  111. package/build/esm/src/utils/swap/swapValues.js +18 -7
  112. package/build/esm/src/utils/tokens.js +15 -1
  113. package/build/esm/src/utils/trade/decrease.js +2 -2
  114. package/build/esm/src/utils/trade/increase.js +3 -0
  115. package/build/types/src/abis/IStargate.d.ts +464 -0
  116. package/build/types/src/abis/LayerZeroProvider.d.ts +12 -0
  117. package/build/types/src/abis/index.d.ts +475 -99
  118. package/build/types/src/configs/chainIds.d.ts +1 -1
  119. package/build/types/src/configs/chains.d.ts +170 -27
  120. package/build/types/src/configs/contracts.d.ts +0 -4
  121. package/build/types/src/configs/dataStore.d.ts +1 -0
  122. package/build/types/src/configs/express.d.ts +1 -1
  123. package/build/types/src/configs/gasLimits.d.ts +4 -0
  124. package/build/types/src/configs/markets.d.ts +10 -1
  125. package/build/types/src/configs/oracleKeeper.d.ts +13 -0
  126. package/build/types/src/configs/tokens.d.ts +3 -0
  127. package/build/types/src/index.d.ts +1 -1
  128. package/build/types/src/modules/base.d.ts +1 -1
  129. package/build/types/src/modules/markets/index.d.ts +2 -0
  130. package/build/types/src/modules/markets/query-builders.d.ts +1 -1
  131. package/build/types/src/modules/markets/types.d.ts +2 -2
  132. package/build/types/src/modules/utils/utils.d.ts +2 -3
  133. package/build/types/src/types/chains.d.ts +57 -0
  134. package/build/types/src/types/markets.d.ts +2 -0
  135. package/build/types/src/types/orders.d.ts +8 -2
  136. package/build/types/src/types/subsquid.d.ts +5987 -5172
  137. package/build/types/src/types/tokens.d.ts +11 -6
  138. package/build/types/src/types/trade.d.ts +5 -0
  139. package/build/types/src/utils/__tests__/abort.spec.d.ts +1 -0
  140. package/build/types/src/utils/abort.d.ts +1 -0
  141. package/build/types/src/utils/fees/estimateOraclePriceCount.d.ts +2 -2
  142. package/build/types/src/utils/fees/executionFee.d.ts +6 -6
  143. package/build/types/src/utils/fees/index.d.ts +2 -1
  144. package/build/types/src/utils/marketKeysAndConfigs.d.ts +2 -0
  145. package/build/types/src/utils/markets.d.ts +4 -2
  146. package/build/types/src/utils/multicall.d.ts +4 -2
  147. package/build/types/src/utils/numbers.d.ts +8 -1
  148. package/build/types/src/utils/swap/buildSwapStrategy.d.ts +8 -3
  149. package/build/types/src/utils/swap/swapPath.d.ts +2 -1
  150. package/build/types/src/utils/swap/swapRouting.d.ts +7 -2
  151. package/build/types/src/utils/swap/swapStats.d.ts +3 -2
  152. package/build/types/src/utils/swap/swapValues.d.ts +3 -1
  153. package/build/types/src/utils/tokens.d.ts +3 -0
  154. package/package.json +17 -5
  155. package/build/cjs/src/abis/MultichainUtils.js +0 -133
  156. package/build/esm/src/abis/MultichainUtils.js +0 -131
  157. package/build/types/src/abis/MultichainUtils.d.ts +0 -100
@@ -1756,6 +1756,126 @@
1756
1756
  "longInterestInTokensUsingShortToken": "0x6734f6e1ed79dbc103747ae3793283a241f5781bdedcee7ecc33e856c5dedb83",
1757
1757
  "shortInterestInTokensUsingLongToken": "0x3290d5bb740ead6457be88ecd3dc9fe14cabb45ae3b6f79c1348639e03fa16c6",
1758
1758
  "shortInterestInTokensUsingShortToken": "0xc6a4753ad0bccf47988451d2174e0bc5dbd2eb198aeb6e17426d3b8ce0e4b028"
1759
+ },
1760
+ "0x66AB9D61A0124b61C8892A4ac687Ac48DbA8ff2c": {
1761
+ "longPoolAmount": "0x5661e078962dbc784b7a17cecca12cfbd5600a21fa3297dc638cc6f1d1046493",
1762
+ "shortPoolAmount": "0xf9f13803349449db626ac6f6313e40aee5e825974ea5343fc20705f5717a4a63",
1763
+ "positionImpactPoolAmount": "0x85eb4f5f6c82d284dd0125e049e4d3d9644348f409db85d507b0976cf3f56e0b",
1764
+ "swapImpactPoolAmountLong": "0x1d359a85d48c70f0ee3cb93653f66445f8176f7ea40b8225543f55678a4cf16f",
1765
+ "swapImpactPoolAmountShort": "0x5bf55afb1627b36620f80515384ef3512044d0cb15bad2834257210b9fb831ad",
1766
+ "longInterestUsingLongToken": "0x5c9b7a26db46be6be52ff43c23ba724f7a611f1b1d6ea79bf0c31dafece2dd73",
1767
+ "longInterestUsingShortToken": "0xef06200611d7c2e17001b8eb0bef6c59e5fbb510807deda09442776b06172d8f",
1768
+ "shortInterestUsingLongToken": "0x0030ba0747b42bb6c7fc78299c003bf446a7b74928de19e27982c75470273bfb",
1769
+ "shortInterestUsingShortToken": "0x2fccdb93b869579e0ab3ba456b425ed1fe0ed3ec3d37e0fb02d1009c928683ef",
1770
+ "longInterestInTokensUsingLongToken": "0x4d0636fc30ec5d0946166825d3529ab8abec7a67dbf2f61d510d1c6a9b69db33",
1771
+ "longInterestInTokensUsingShortToken": "0xf754a35647b4bb1d0994dd139506d074624929e8603afc3d7a036f5c1ec29f4b",
1772
+ "shortInterestInTokensUsingLongToken": "0x2061e3bce5bec7ca22d0e6471341e4426e7e79ab3e1a5ef6b81d97e9acb0a47f",
1773
+ "shortInterestInTokensUsingShortToken": "0x524eee5972856af1944aa29eb2def1352092388483c22dee1afed3a2a622a7f8"
1774
+ },
1775
+ "0x587759c237acCa739bCE3911647BacF56C876E60": {
1776
+ "longPoolAmount": "0x405f450c6837127eea52cb7a5adf5174d032d48569888685d1f3fbbe73aaf4cf",
1777
+ "shortPoolAmount": "0x40b5e0dd2730bf75bccb83c22ef3b10a16caff60c68c82d14d09af6817b49c07",
1778
+ "positionImpactPoolAmount": "0xaa5713894d8e1a2dedc2b80a7e6e0aca11ffeb4516debea1209b8c91f5446b2c",
1779
+ "swapImpactPoolAmountLong": "0x60bc7e3f55cf4de3909d5c2f17bf420bfa968a579d346131a54ebe899b3b70a9",
1780
+ "swapImpactPoolAmountShort": "0x6002e6d197af4ba5bff4a852320894a939f8a7471d466825943d644e15c645bf",
1781
+ "longInterestUsingLongToken": "0xfaada052609aa4aeaee352d2c3653ded1546972dac675a5b0ef493b4b048ecd3",
1782
+ "longInterestUsingShortToken": "0x7828a689f759931f07d41023220ea95f211d8c78ae8ff51170bb662c2f69db3c",
1783
+ "shortInterestUsingLongToken": "0xf19626d23c99a52faf31420ff2d78490fb1d6796c521183cbee86f88f197ff62",
1784
+ "shortInterestUsingShortToken": "0x462ccab88cf00a39ec99b665f5cbddb507d04e1f9f299229418effcada93846f",
1785
+ "longInterestInTokensUsingLongToken": "0x8800845b00a19f74f245101c9c5300b63b580d3c0bedfa753a5c0dadd7a3c685",
1786
+ "longInterestInTokensUsingShortToken": "0x16737a49e9c8e4e4d3d9578a2cffc9d82ecd02cbdb3d1433f7733a5d348d97a4",
1787
+ "shortInterestInTokensUsingLongToken": "0x04b993baa9ecd37570c605022f54e2d6cae7eda955be07f5171e55755cbeb12c",
1788
+ "shortInterestInTokensUsingShortToken": "0xde53ce1b9f4ed36a3385cd7e862002c3a62c865d7e3981f8aa413b293097f5a0"
1789
+ },
1790
+ "0x00310c6d8A9F821e3FE991f4835f2cA4d87034Cf": {
1791
+ "longPoolAmount": "0x2a2e4cd11620eab1b42ba531fed7a20e24945042e4bbedf461731d9664b3f546",
1792
+ "shortPoolAmount": "0x9c04ed781c483037dc9bc153601d926fee1ddb383c1a678ced44310174ba5695",
1793
+ "positionImpactPoolAmount": "0xe02b77f5768c2ff82ccd91f56ec89b8f1b57735919ba6d889b8fa94b0ee0ad44",
1794
+ "swapImpactPoolAmountLong": "0xf4690c0911cd29cb5278909d852155e649f2a0863a9ea9c2e07d7fbf51b00a8e",
1795
+ "swapImpactPoolAmountShort": "0xbd3268b907d7351d5c7288aec636644f2088db232e8c97543c81e280fe8306a9",
1796
+ "longInterestUsingLongToken": "0x7bd795fa61c935e554e40934975be4042b9d8c0896aadf6e527c5ca7fc6db085",
1797
+ "longInterestUsingShortToken": "0x52fd08299b1456da39fa37efb8aa61a82e1ece3194820b1bab016badece6808a",
1798
+ "shortInterestUsingLongToken": "0xbb680a83b92776a2afc7ec3f3678f51636bcf6875fc08a5b900d2b9a5946bd00",
1799
+ "shortInterestUsingShortToken": "0x9a44bf9a70f91c4f9baeb32922722169dea930ddac234a59c9f9479bca9e17de",
1800
+ "longInterestInTokensUsingLongToken": "0x6a99806df5b157c5f981d3024d1642ee5a8a17713ef7d80b4958432553c3a2fa",
1801
+ "longInterestInTokensUsingShortToken": "0x10be684d3b02317e078f4c9f561ad313cbdf6701163346bb271543b58a6cfcc7",
1802
+ "shortInterestInTokensUsingLongToken": "0x74b8efa44465155c5fc9951e7518290fba4cbed2741539562502e86745b04058",
1803
+ "shortInterestInTokensUsingShortToken": "0x344592d78feae63ecf187af3a66c1e0d1b24afc5abdd978cf47dc7fca9928e97"
1804
+ },
1805
+ "0xfa19f7d23a475575BD0270AE7de4FC6852442945": {
1806
+ "longPoolAmount": "0x769b2651dfd9ff67fd2e120c87e1652e4863ad9d1ea31a933380ba783dba54a5",
1807
+ "shortPoolAmount": "0xbed82a81070b1ab45a407cef21f962f701deb420921c73a5069b28256a2b5225",
1808
+ "positionImpactPoolAmount": "0xac5163fefc03ca42b5823258cb610e0ae35abb3eea3b6fb62c17cf423c63d0fa",
1809
+ "swapImpactPoolAmountLong": "0x9571bde89a2343aec021e1a8a511542e608fa1d0a39b8c5188d4820620e57632",
1810
+ "swapImpactPoolAmountShort": "0x2be194b6240863c6bddfd264f3e6f754a454b3ac6b76c52193e82cb54fded9ed",
1811
+ "longInterestUsingLongToken": "0x7a535299a4d0299c912f9e346db03a833b0db7d3deccae48e9bc7a905d21b59b",
1812
+ "longInterestUsingShortToken": "0x3499a85f002f9f15f4a7e2de7fecfebe9956bb7d11895642996f25364cfbadb5",
1813
+ "shortInterestUsingLongToken": "0x541b372595b60ed62c865ec7372d6ae9d2ae79dbf068f3bfc877e3d794a2564e",
1814
+ "shortInterestUsingShortToken": "0xeef7fcbeed3bbefa8f4c5cfafc45fb839a8b6a9022b91bd53d484f7946e9bc1f",
1815
+ "longInterestInTokensUsingLongToken": "0x8a70cf1f1fcd6f797dbc54614a64f3ebc3943e1ee03a59d879aff5db4f06d23f",
1816
+ "longInterestInTokensUsingShortToken": "0x45009651c58ab1a8b57e58cdbacb1582880b02b1fb611b02ec70cd2c80e2b9a1",
1817
+ "shortInterestInTokensUsingLongToken": "0x6fb34e78ef0a17cb11997a13703c97b31a5a7caf40ca5fce0489a0c45ef20f83",
1818
+ "shortInterestInTokensUsingShortToken": "0xf3c401cbeaa5338350dc9a9b7d5c7d86b7c818712598ff1ae8d2e0ed9e87ab78"
1819
+ },
1820
+ "0x728Ff0679c89267434D6EF1824c8C8eED4aC3DBC": {
1821
+ "longPoolAmount": "0x8979b875f2cd668c03a6eeb4c7cb1c85e5bd7ef67bc71b187e4db592b2b4abeb",
1822
+ "shortPoolAmount": "0x010804628d49699c77e2af9acc6a74af43c2e0a35ee9a6f89a4f54c6fdc0d353",
1823
+ "positionImpactPoolAmount": "0xdb1fa0ad6859b4db39a7bed43e8c8bb60affc0fc13ae93384d735999d72a3e54",
1824
+ "swapImpactPoolAmountLong": "0xaf99ec074c87574b6f977edfad3626dd4e7c73933a564b7c552fbef7cd86482a",
1825
+ "swapImpactPoolAmountShort": "0xd3ec47bbf27d70ccd98a4a150fcde17ada195f4e216a8fd1785029f262ab3fa3",
1826
+ "longInterestUsingLongToken": "0xfb3098cd3f646a599404948ec43125a5a6006d5d608b90ad120c55dd7346b318",
1827
+ "longInterestUsingShortToken": "0x1bf2ea7f64430bf9d2acdbaf17071819a4ea4ab8bc8fdc03dabb36d48806511e",
1828
+ "shortInterestUsingLongToken": "0x5ec33cf714ea01ce18a026b33cecc5c8850e4a84069905614bcb322fe8b5608c",
1829
+ "shortInterestUsingShortToken": "0x8d67de51d82871c9465d5258916733392f1ace6f953f6d700f2bda8de06638fe",
1830
+ "longInterestInTokensUsingLongToken": "0x22701602701a07a786dad6f414d252f0bd9954f6e0253d35de3136b4762f5fda",
1831
+ "longInterestInTokensUsingShortToken": "0x258b4030ed7c58b4a6e3bbd6ebd647bb00b8f8095ca68b498542f45cc16f092b",
1832
+ "shortInterestInTokensUsingLongToken": "0xcfea4b65f382ac5c5f6f664bbe35c58e2980f0c3b8c690fc637323b0e5d6417e",
1833
+ "shortInterestInTokensUsingShortToken": "0xb2db20fe0f91b03004bcfc9495c138715913e79f6b5b044862fcdde38a7cf58c"
1834
+ },
1835
+ "0x3B4689d69516b9D4b1aaf7545c6fC4d3ED70b70b": {
1836
+ "longPoolAmount": "0x859662ec513e44158ee0ccf5a94d120305a12348a9dbddd5ccd206b177cdf4eb",
1837
+ "shortPoolAmount": "0xb46fc4659eb29cdb837e8fcc935210c77e42fcb8a583179df17ae04debf80d89",
1838
+ "positionImpactPoolAmount": "0xb228ecb1939e901d51f21798d9d6b8557ae6f235a0975715a3991e06700c85d7",
1839
+ "swapImpactPoolAmountLong": "0x7ef60434ad174496a492e5b9ace2ae6ee22b017a336e75d334c1d8c9e7814016",
1840
+ "swapImpactPoolAmountShort": "0x6c3dafe20f5e8c7a321b0e0e8fa6a988e6a5a4aadf5c61f2205093b0e0b31d82",
1841
+ "longInterestUsingLongToken": "0xe8f4b28bc33ceb87f02d0e177873b9091fcf87e46716312348d152b1d8a9b4b5",
1842
+ "longInterestUsingShortToken": "0x4b8631f0ea309d974664c44b27fb09cbe96b76778b3ddcdaf7525676b5541ff5",
1843
+ "shortInterestUsingLongToken": "0xe4c5de8cf12381a14d65c5365a68e6633716bd2dd4405e02af710d2d30a787f4",
1844
+ "shortInterestUsingShortToken": "0x34224448ae12e28a09f00339d1b5f64ca76b00fbf3c474ccd9e172ef3e9cd4fc",
1845
+ "longInterestInTokensUsingLongToken": "0x09ff271595434f54483367c25e9d1207348ceb4b63585c39ec4ee0a3c22d4a4f",
1846
+ "longInterestInTokensUsingShortToken": "0xbc29e7c6ca04597e9d15181e93cdaa6ba363a958d55f0e62f7fe5ef507d2c94c",
1847
+ "shortInterestInTokensUsingLongToken": "0x594e7e708b5fa4f6f4c87ee055dc894ddfec6017e2f52c885278a8f2ec1ac8b7",
1848
+ "shortInterestInTokensUsingShortToken": "0x960c34b07813fb70855820dfb601ee4b76897109d5c3a2dd1d30fae8712555a0"
1849
+ },
1850
+ "0x8965e821c7C8c09c6eB3Cb9cCf7Eb6f386441EA2": {
1851
+ "longPoolAmount": "0xb6d889395a9d64218892ea61d11c7174637e0f94a99ca67da71109d1bcc7bcf3",
1852
+ "shortPoolAmount": "0x440e08650f5ec7138b1d2776eab730f2ca4975f6f41eddbda38d85aa526bc7d5",
1853
+ "positionImpactPoolAmount": "0xab8a4c4147176530c89b9a3f39c33a9a4fa5afc44c0e5a9050bbdf0089d52c61",
1854
+ "swapImpactPoolAmountLong": "0xa9259e1d5ae5a703af9afc82f0d3f410696af0089d7070b4f9ca8ad6206dcb3d",
1855
+ "swapImpactPoolAmountShort": "0x8e601e1818c6698cc9671b03e9d9a902ea712d307c7ec6eba62118f12395ed83",
1856
+ "longInterestUsingLongToken": "0xb59330e96e848a4d8e8569d021e6632dc1c315331b8ba7ff7ae8a6945d73a222",
1857
+ "longInterestUsingShortToken": "0x3fdfae07e54ab044da2db02e0de0160ed9671226991be877fe833d82a1d9a872",
1858
+ "shortInterestUsingLongToken": "0x196229caa3dfdf1e7adb24d742b422b6f1b072a38a9f07938e899f2a24fbd6bd",
1859
+ "shortInterestUsingShortToken": "0x7c4cc952a9892b3fa804923021517f88ceac512d1fa430efd5f8dfbb5017ee49",
1860
+ "longInterestInTokensUsingLongToken": "0xfeb9915fc6eab71e687974ff896833fd8133748bf3c8858847c1f5547c623db4",
1861
+ "longInterestInTokensUsingShortToken": "0xb7216cb22e3d88515c66240afbe7270af82c56662fbe02175cdb8a4c536bb653",
1862
+ "shortInterestInTokensUsingLongToken": "0xb1f03517e53f64ea61c2c020ea83b65d1f285917d6f740ce7bb7904e8e783c20",
1863
+ "shortInterestInTokensUsingShortToken": "0x711ef4606c1e48b3454a208e31088d694917c745893c54ee39f0a011ba2410bf"
1864
+ },
1865
+ "0x3600592DdEd7e6E0B05029DfB637fFc5A85D6f6B": {
1866
+ "longPoolAmount": "0x668ee8f6776025dbda07f90d5b7477e0535d09f923c862e11119c2190b4cea3b",
1867
+ "shortPoolAmount": "0xb666179d743eb811335cd7b70c756eac867214b684c4ca27757c7a0552ff7365",
1868
+ "positionImpactPoolAmount": "0x41c353f4e81e3fd7f01e1b1f01778bfe13fd5f94ed982f49862fec78af45dfb8",
1869
+ "swapImpactPoolAmountLong": "0x231927a1820c359ec257c6e3fc4e3b6659f562417b37465802fe60c99174f2cf",
1870
+ "swapImpactPoolAmountShort": "0x41f8fde1d6545da3fa3be39508b35e31ecc9f8e03f8775d85384af53fdf508ba",
1871
+ "longInterestUsingLongToken": "0x59f608056e5b384ceebe52810464d60ad32fc408b7d694509b6f3e55c2b4b8ba",
1872
+ "longInterestUsingShortToken": "0x0e99a19843cfde40ef0736f377392cf7ea7893b4a6a93be7abd142cb14e07fc7",
1873
+ "shortInterestUsingLongToken": "0x2497df001e1741822c0d4f646596f0d1ed9e70f5dbd90ff4236a06a09132d50b",
1874
+ "shortInterestUsingShortToken": "0x4e5400c0395037b7c640c88360bda543229ee50d0e33883ef2aae2ae96ceb7d0",
1875
+ "longInterestInTokensUsingLongToken": "0x9649688da2dd7172e852d091969f6ed87dcda9fb2c6537d6ae35f665ef1868aa",
1876
+ "longInterestInTokensUsingShortToken": "0x2dc01b3b85d756baf87d00c973daa5407d890d823b6d0c3e3319969af87c09a7",
1877
+ "shortInterestInTokensUsingLongToken": "0xbdc14076a36f44c7f3a721b002fbe90479cef53c30049cf42365a196f962978d",
1878
+ "shortInterestInTokensUsingShortToken": "0x4807b52cfdf6c2cebdc1e028aa6e5ea81dc95ff2d40ac3888f859c3973fdfe1b"
1759
1879
  }
1760
1880
  },
1761
1881
  "43113": {
@@ -204,6 +204,8 @@ export function mockMarketsInfoData(tokensData, marketKeys, overrides = {}) {
204
204
  swapImpactFactorPositive: expandDecimals(2, 23),
205
205
  swapImpactFactorNegative: expandDecimals(1, 23),
206
206
  swapImpactExponentFactor: expandDecimals(2, 30),
207
+ withdrawalFeeFactorBalanceWasImproved: expandDecimals(2, 27),
208
+ withdrawalFeeFactorBalanceWasNotImproved: expandDecimals(2, 27),
207
209
  // MarketInfo
208
210
  borrowingFactorPerSecondForLongs: 0n,
209
211
  borrowingFactorPerSecondForShorts: 0n,
@@ -0,0 +1 @@
1
+ export {};
@@ -21,11 +21,17 @@ export var OrderType;
21
21
  // @dev StopIncrease: increase position if the triggerPrice is reached and the acceptablePrice can be fulfilled
22
22
  OrderType[OrderType["StopIncrease"] = 8] = "StopIncrease";
23
23
  })(OrderType || (OrderType = {}));
24
+ /**
25
+ * @see https://github.com/gmx-io/gmx-synthetics/blob/a54f774198d79954d66d694af1be479bb6da61f1/contracts/pricing/ISwapPricingUtils.sol#L5
26
+ */
24
27
  export var SwapPricingType;
25
28
  (function (SwapPricingType) {
26
- SwapPricingType[SwapPricingType["TwoStep"] = 0] = "TwoStep";
29
+ SwapPricingType[SwapPricingType["Swap"] = 0] = "Swap";
27
30
  SwapPricingType[SwapPricingType["Shift"] = 1] = "Shift";
28
- SwapPricingType[SwapPricingType["Atomic"] = 2] = "Atomic";
31
+ SwapPricingType[SwapPricingType["AtomicWithdrawal"] = 2] = "AtomicWithdrawal";
32
+ SwapPricingType[SwapPricingType["Deposit"] = 3] = "Deposit";
33
+ SwapPricingType[SwapPricingType["Withdrawal"] = 4] = "Withdrawal";
34
+ SwapPricingType[SwapPricingType["AtomicSwap"] = 5] = "AtomicSwap";
29
35
  })(SwapPricingType || (SwapPricingType = {}));
30
36
  export var DecreasePositionSwapType;
31
37
  (function (DecreasePositionSwapType) {
@@ -1261,6 +1261,12 @@ export var MarketInfoOrderByInput;
1261
1261
  MarketInfoOrderByInput["totalBorrowingFees_DESC"] = "totalBorrowingFees_DESC";
1262
1262
  MarketInfoOrderByInput["totalBorrowingFees_DESC_NULLS_FIRST"] = "totalBorrowingFees_DESC_NULLS_FIRST";
1263
1263
  MarketInfoOrderByInput["totalBorrowingFees_DESC_NULLS_LAST"] = "totalBorrowingFees_DESC_NULLS_LAST";
1264
+ MarketInfoOrderByInput["useOpenInterestInTokensForBalance_ASC"] = "useOpenInterestInTokensForBalance_ASC";
1265
+ MarketInfoOrderByInput["useOpenInterestInTokensForBalance_ASC_NULLS_FIRST"] = "useOpenInterestInTokensForBalance_ASC_NULLS_FIRST";
1266
+ MarketInfoOrderByInput["useOpenInterestInTokensForBalance_ASC_NULLS_LAST"] = "useOpenInterestInTokensForBalance_ASC_NULLS_LAST";
1267
+ MarketInfoOrderByInput["useOpenInterestInTokensForBalance_DESC"] = "useOpenInterestInTokensForBalance_DESC";
1268
+ MarketInfoOrderByInput["useOpenInterestInTokensForBalance_DESC_NULLS_FIRST"] = "useOpenInterestInTokensForBalance_DESC_NULLS_FIRST";
1269
+ MarketInfoOrderByInput["useOpenInterestInTokensForBalance_DESC_NULLS_LAST"] = "useOpenInterestInTokensForBalance_DESC_NULLS_LAST";
1264
1270
  MarketInfoOrderByInput["virtualIndexTokenId_ASC"] = "virtualIndexTokenId_ASC";
1265
1271
  MarketInfoOrderByInput["virtualIndexTokenId_ASC_NULLS_FIRST"] = "virtualIndexTokenId_ASC_NULLS_FIRST";
1266
1272
  MarketInfoOrderByInput["virtualIndexTokenId_ASC_NULLS_LAST"] = "virtualIndexTokenId_ASC_NULLS_LAST";
@@ -1961,6 +1967,18 @@ export var PositionChangeOrderByInput;
1961
1967
  PositionChangeOrderByInput["maxSize_DESC"] = "maxSize_DESC";
1962
1968
  PositionChangeOrderByInput["maxSize_DESC_NULLS_FIRST"] = "maxSize_DESC_NULLS_FIRST";
1963
1969
  PositionChangeOrderByInput["maxSize_DESC_NULLS_LAST"] = "maxSize_DESC_NULLS_LAST";
1970
+ PositionChangeOrderByInput["orderKey_ASC"] = "orderKey_ASC";
1971
+ PositionChangeOrderByInput["orderKey_ASC_NULLS_FIRST"] = "orderKey_ASC_NULLS_FIRST";
1972
+ PositionChangeOrderByInput["orderKey_ASC_NULLS_LAST"] = "orderKey_ASC_NULLS_LAST";
1973
+ PositionChangeOrderByInput["orderKey_DESC"] = "orderKey_DESC";
1974
+ PositionChangeOrderByInput["orderKey_DESC_NULLS_FIRST"] = "orderKey_DESC_NULLS_FIRST";
1975
+ PositionChangeOrderByInput["orderKey_DESC_NULLS_LAST"] = "orderKey_DESC_NULLS_LAST";
1976
+ PositionChangeOrderByInput["positionKey_ASC"] = "positionKey_ASC";
1977
+ PositionChangeOrderByInput["positionKey_ASC_NULLS_FIRST"] = "positionKey_ASC_NULLS_FIRST";
1978
+ PositionChangeOrderByInput["positionKey_ASC_NULLS_LAST"] = "positionKey_ASC_NULLS_LAST";
1979
+ PositionChangeOrderByInput["positionKey_DESC"] = "positionKey_DESC";
1980
+ PositionChangeOrderByInput["positionKey_DESC_NULLS_FIRST"] = "positionKey_DESC_NULLS_FIRST";
1981
+ PositionChangeOrderByInput["positionKey_DESC_NULLS_LAST"] = "positionKey_DESC_NULLS_LAST";
1964
1982
  PositionChangeOrderByInput["priceImpactAmount_ASC"] = "priceImpactAmount_ASC";
1965
1983
  PositionChangeOrderByInput["priceImpactAmount_ASC_NULLS_FIRST"] = "priceImpactAmount_ASC_NULLS_FIRST";
1966
1984
  PositionChangeOrderByInput["priceImpactAmount_ASC_NULLS_LAST"] = "priceImpactAmount_ASC_NULLS_LAST";
@@ -1997,6 +2015,12 @@ export var PositionChangeOrderByInput;
1997
2015
  PositionChangeOrderByInput["sizeDeltaUsd_DESC"] = "sizeDeltaUsd_DESC";
1998
2016
  PositionChangeOrderByInput["sizeDeltaUsd_DESC_NULLS_FIRST"] = "sizeDeltaUsd_DESC_NULLS_FIRST";
1999
2017
  PositionChangeOrderByInput["sizeDeltaUsd_DESC_NULLS_LAST"] = "sizeDeltaUsd_DESC_NULLS_LAST";
2018
+ PositionChangeOrderByInput["sizeInTokens_ASC"] = "sizeInTokens_ASC";
2019
+ PositionChangeOrderByInput["sizeInTokens_ASC_NULLS_FIRST"] = "sizeInTokens_ASC_NULLS_FIRST";
2020
+ PositionChangeOrderByInput["sizeInTokens_ASC_NULLS_LAST"] = "sizeInTokens_ASC_NULLS_LAST";
2021
+ PositionChangeOrderByInput["sizeInTokens_DESC"] = "sizeInTokens_DESC";
2022
+ PositionChangeOrderByInput["sizeInTokens_DESC_NULLS_FIRST"] = "sizeInTokens_DESC_NULLS_FIRST";
2023
+ PositionChangeOrderByInput["sizeInTokens_DESC_NULLS_LAST"] = "sizeInTokens_DESC_NULLS_LAST";
2000
2024
  PositionChangeOrderByInput["sizeInUsd_ASC"] = "sizeInUsd_ASC";
2001
2025
  PositionChangeOrderByInput["sizeInUsd_ASC_NULLS_FIRST"] = "sizeInUsd_ASC_NULLS_FIRST";
2002
2026
  PositionChangeOrderByInput["sizeInUsd_ASC_NULLS_LAST"] = "sizeInUsd_ASC_NULLS_LAST";
@@ -2422,6 +2446,45 @@ export var PositionOrderByInput;
2422
2446
  PositionOrderByInput["unrealizedPriceImpact_DESC_NULLS_FIRST"] = "unrealizedPriceImpact_DESC_NULLS_FIRST";
2423
2447
  PositionOrderByInput["unrealizedPriceImpact_DESC_NULLS_LAST"] = "unrealizedPriceImpact_DESC_NULLS_LAST";
2424
2448
  })(PositionOrderByInput || (PositionOrderByInput = {}));
2449
+ export var PositionVolumeInfoOrderByInput;
2450
+ (function (PositionVolumeInfoOrderByInput) {
2451
+ PositionVolumeInfoOrderByInput["collateralToken_ASC"] = "collateralToken_ASC";
2452
+ PositionVolumeInfoOrderByInput["collateralToken_ASC_NULLS_FIRST"] = "collateralToken_ASC_NULLS_FIRST";
2453
+ PositionVolumeInfoOrderByInput["collateralToken_ASC_NULLS_LAST"] = "collateralToken_ASC_NULLS_LAST";
2454
+ PositionVolumeInfoOrderByInput["collateralToken_DESC"] = "collateralToken_DESC";
2455
+ PositionVolumeInfoOrderByInput["collateralToken_DESC_NULLS_FIRST"] = "collateralToken_DESC_NULLS_FIRST";
2456
+ PositionVolumeInfoOrderByInput["collateralToken_DESC_NULLS_LAST"] = "collateralToken_DESC_NULLS_LAST";
2457
+ PositionVolumeInfoOrderByInput["id_ASC"] = "id_ASC";
2458
+ PositionVolumeInfoOrderByInput["id_ASC_NULLS_FIRST"] = "id_ASC_NULLS_FIRST";
2459
+ PositionVolumeInfoOrderByInput["id_ASC_NULLS_LAST"] = "id_ASC_NULLS_LAST";
2460
+ PositionVolumeInfoOrderByInput["id_DESC"] = "id_DESC";
2461
+ PositionVolumeInfoOrderByInput["id_DESC_NULLS_FIRST"] = "id_DESC_NULLS_FIRST";
2462
+ PositionVolumeInfoOrderByInput["id_DESC_NULLS_LAST"] = "id_DESC_NULLS_LAST";
2463
+ PositionVolumeInfoOrderByInput["indexToken_ASC"] = "indexToken_ASC";
2464
+ PositionVolumeInfoOrderByInput["indexToken_ASC_NULLS_FIRST"] = "indexToken_ASC_NULLS_FIRST";
2465
+ PositionVolumeInfoOrderByInput["indexToken_ASC_NULLS_LAST"] = "indexToken_ASC_NULLS_LAST";
2466
+ PositionVolumeInfoOrderByInput["indexToken_DESC"] = "indexToken_DESC";
2467
+ PositionVolumeInfoOrderByInput["indexToken_DESC_NULLS_FIRST"] = "indexToken_DESC_NULLS_FIRST";
2468
+ PositionVolumeInfoOrderByInput["indexToken_DESC_NULLS_LAST"] = "indexToken_DESC_NULLS_LAST";
2469
+ PositionVolumeInfoOrderByInput["period_ASC"] = "period_ASC";
2470
+ PositionVolumeInfoOrderByInput["period_ASC_NULLS_FIRST"] = "period_ASC_NULLS_FIRST";
2471
+ PositionVolumeInfoOrderByInput["period_ASC_NULLS_LAST"] = "period_ASC_NULLS_LAST";
2472
+ PositionVolumeInfoOrderByInput["period_DESC"] = "period_DESC";
2473
+ PositionVolumeInfoOrderByInput["period_DESC_NULLS_FIRST"] = "period_DESC_NULLS_FIRST";
2474
+ PositionVolumeInfoOrderByInput["period_DESC_NULLS_LAST"] = "period_DESC_NULLS_LAST";
2475
+ PositionVolumeInfoOrderByInput["timestamp_ASC"] = "timestamp_ASC";
2476
+ PositionVolumeInfoOrderByInput["timestamp_ASC_NULLS_FIRST"] = "timestamp_ASC_NULLS_FIRST";
2477
+ PositionVolumeInfoOrderByInput["timestamp_ASC_NULLS_LAST"] = "timestamp_ASC_NULLS_LAST";
2478
+ PositionVolumeInfoOrderByInput["timestamp_DESC"] = "timestamp_DESC";
2479
+ PositionVolumeInfoOrderByInput["timestamp_DESC_NULLS_FIRST"] = "timestamp_DESC_NULLS_FIRST";
2480
+ PositionVolumeInfoOrderByInput["timestamp_DESC_NULLS_LAST"] = "timestamp_DESC_NULLS_LAST";
2481
+ PositionVolumeInfoOrderByInput["volumeUsd_ASC"] = "volumeUsd_ASC";
2482
+ PositionVolumeInfoOrderByInput["volumeUsd_ASC_NULLS_FIRST"] = "volumeUsd_ASC_NULLS_FIRST";
2483
+ PositionVolumeInfoOrderByInput["volumeUsd_ASC_NULLS_LAST"] = "volumeUsd_ASC_NULLS_LAST";
2484
+ PositionVolumeInfoOrderByInput["volumeUsd_DESC"] = "volumeUsd_DESC";
2485
+ PositionVolumeInfoOrderByInput["volumeUsd_DESC_NULLS_FIRST"] = "volumeUsd_DESC_NULLS_FIRST";
2486
+ PositionVolumeInfoOrderByInput["volumeUsd_DESC_NULLS_LAST"] = "volumeUsd_DESC_NULLS_LAST";
2487
+ })(PositionVolumeInfoOrderByInput || (PositionVolumeInfoOrderByInput = {}));
2425
2488
  export var PriceOrderByInput;
2426
2489
  (function (PriceOrderByInput) {
2427
2490
  PriceOrderByInput["id_ASC"] = "id_ASC";
@@ -2507,6 +2570,93 @@ export var ProcessorStatusOrderByInput;
2507
2570
  ProcessorStatusOrderByInput["lastProcessorCallTimestamp_DESC_NULLS_FIRST"] = "lastProcessorCallTimestamp_DESC_NULLS_FIRST";
2508
2571
  ProcessorStatusOrderByInput["lastProcessorCallTimestamp_DESC_NULLS_LAST"] = "lastProcessorCallTimestamp_DESC_NULLS_LAST";
2509
2572
  })(ProcessorStatusOrderByInput || (ProcessorStatusOrderByInput = {}));
2573
+ export var SwapFeesInfoOrderByInput;
2574
+ (function (SwapFeesInfoOrderByInput) {
2575
+ SwapFeesInfoOrderByInput["feeReceiverAmount_ASC"] = "feeReceiverAmount_ASC";
2576
+ SwapFeesInfoOrderByInput["feeReceiverAmount_ASC_NULLS_FIRST"] = "feeReceiverAmount_ASC_NULLS_FIRST";
2577
+ SwapFeesInfoOrderByInput["feeReceiverAmount_ASC_NULLS_LAST"] = "feeReceiverAmount_ASC_NULLS_LAST";
2578
+ SwapFeesInfoOrderByInput["feeReceiverAmount_DESC"] = "feeReceiverAmount_DESC";
2579
+ SwapFeesInfoOrderByInput["feeReceiverAmount_DESC_NULLS_FIRST"] = "feeReceiverAmount_DESC_NULLS_FIRST";
2580
+ SwapFeesInfoOrderByInput["feeReceiverAmount_DESC_NULLS_LAST"] = "feeReceiverAmount_DESC_NULLS_LAST";
2581
+ SwapFeesInfoOrderByInput["feeUsdForPool_ASC"] = "feeUsdForPool_ASC";
2582
+ SwapFeesInfoOrderByInput["feeUsdForPool_ASC_NULLS_FIRST"] = "feeUsdForPool_ASC_NULLS_FIRST";
2583
+ SwapFeesInfoOrderByInput["feeUsdForPool_ASC_NULLS_LAST"] = "feeUsdForPool_ASC_NULLS_LAST";
2584
+ SwapFeesInfoOrderByInput["feeUsdForPool_DESC"] = "feeUsdForPool_DESC";
2585
+ SwapFeesInfoOrderByInput["feeUsdForPool_DESC_NULLS_FIRST"] = "feeUsdForPool_DESC_NULLS_FIRST";
2586
+ SwapFeesInfoOrderByInput["feeUsdForPool_DESC_NULLS_LAST"] = "feeUsdForPool_DESC_NULLS_LAST";
2587
+ SwapFeesInfoOrderByInput["id_ASC"] = "id_ASC";
2588
+ SwapFeesInfoOrderByInput["id_ASC_NULLS_FIRST"] = "id_ASC_NULLS_FIRST";
2589
+ SwapFeesInfoOrderByInput["id_ASC_NULLS_LAST"] = "id_ASC_NULLS_LAST";
2590
+ SwapFeesInfoOrderByInput["id_DESC"] = "id_DESC";
2591
+ SwapFeesInfoOrderByInput["id_DESC_NULLS_FIRST"] = "id_DESC_NULLS_FIRST";
2592
+ SwapFeesInfoOrderByInput["id_DESC_NULLS_LAST"] = "id_DESC_NULLS_LAST";
2593
+ SwapFeesInfoOrderByInput["marketAddress_ASC"] = "marketAddress_ASC";
2594
+ SwapFeesInfoOrderByInput["marketAddress_ASC_NULLS_FIRST"] = "marketAddress_ASC_NULLS_FIRST";
2595
+ SwapFeesInfoOrderByInput["marketAddress_ASC_NULLS_LAST"] = "marketAddress_ASC_NULLS_LAST";
2596
+ SwapFeesInfoOrderByInput["marketAddress_DESC"] = "marketAddress_DESC";
2597
+ SwapFeesInfoOrderByInput["marketAddress_DESC_NULLS_FIRST"] = "marketAddress_DESC_NULLS_FIRST";
2598
+ SwapFeesInfoOrderByInput["marketAddress_DESC_NULLS_LAST"] = "marketAddress_DESC_NULLS_LAST";
2599
+ SwapFeesInfoOrderByInput["swapFeeType_ASC"] = "swapFeeType_ASC";
2600
+ SwapFeesInfoOrderByInput["swapFeeType_ASC_NULLS_FIRST"] = "swapFeeType_ASC_NULLS_FIRST";
2601
+ SwapFeesInfoOrderByInput["swapFeeType_ASC_NULLS_LAST"] = "swapFeeType_ASC_NULLS_LAST";
2602
+ SwapFeesInfoOrderByInput["swapFeeType_DESC"] = "swapFeeType_DESC";
2603
+ SwapFeesInfoOrderByInput["swapFeeType_DESC_NULLS_FIRST"] = "swapFeeType_DESC_NULLS_FIRST";
2604
+ SwapFeesInfoOrderByInput["swapFeeType_DESC_NULLS_LAST"] = "swapFeeType_DESC_NULLS_LAST";
2605
+ SwapFeesInfoOrderByInput["tokenAddress_ASC"] = "tokenAddress_ASC";
2606
+ SwapFeesInfoOrderByInput["tokenAddress_ASC_NULLS_FIRST"] = "tokenAddress_ASC_NULLS_FIRST";
2607
+ SwapFeesInfoOrderByInput["tokenAddress_ASC_NULLS_LAST"] = "tokenAddress_ASC_NULLS_LAST";
2608
+ SwapFeesInfoOrderByInput["tokenAddress_DESC"] = "tokenAddress_DESC";
2609
+ SwapFeesInfoOrderByInput["tokenAddress_DESC_NULLS_FIRST"] = "tokenAddress_DESC_NULLS_FIRST";
2610
+ SwapFeesInfoOrderByInput["tokenAddress_DESC_NULLS_LAST"] = "tokenAddress_DESC_NULLS_LAST";
2611
+ SwapFeesInfoOrderByInput["tokenPrice_ASC"] = "tokenPrice_ASC";
2612
+ SwapFeesInfoOrderByInput["tokenPrice_ASC_NULLS_FIRST"] = "tokenPrice_ASC_NULLS_FIRST";
2613
+ SwapFeesInfoOrderByInput["tokenPrice_ASC_NULLS_LAST"] = "tokenPrice_ASC_NULLS_LAST";
2614
+ SwapFeesInfoOrderByInput["tokenPrice_DESC"] = "tokenPrice_DESC";
2615
+ SwapFeesInfoOrderByInput["tokenPrice_DESC_NULLS_FIRST"] = "tokenPrice_DESC_NULLS_FIRST";
2616
+ SwapFeesInfoOrderByInput["tokenPrice_DESC_NULLS_LAST"] = "tokenPrice_DESC_NULLS_LAST";
2617
+ SwapFeesInfoOrderByInput["transaction_blockNumber_ASC"] = "transaction_blockNumber_ASC";
2618
+ SwapFeesInfoOrderByInput["transaction_blockNumber_ASC_NULLS_FIRST"] = "transaction_blockNumber_ASC_NULLS_FIRST";
2619
+ SwapFeesInfoOrderByInput["transaction_blockNumber_ASC_NULLS_LAST"] = "transaction_blockNumber_ASC_NULLS_LAST";
2620
+ SwapFeesInfoOrderByInput["transaction_blockNumber_DESC"] = "transaction_blockNumber_DESC";
2621
+ SwapFeesInfoOrderByInput["transaction_blockNumber_DESC_NULLS_FIRST"] = "transaction_blockNumber_DESC_NULLS_FIRST";
2622
+ SwapFeesInfoOrderByInput["transaction_blockNumber_DESC_NULLS_LAST"] = "transaction_blockNumber_DESC_NULLS_LAST";
2623
+ SwapFeesInfoOrderByInput["transaction_from_ASC"] = "transaction_from_ASC";
2624
+ SwapFeesInfoOrderByInput["transaction_from_ASC_NULLS_FIRST"] = "transaction_from_ASC_NULLS_FIRST";
2625
+ SwapFeesInfoOrderByInput["transaction_from_ASC_NULLS_LAST"] = "transaction_from_ASC_NULLS_LAST";
2626
+ SwapFeesInfoOrderByInput["transaction_from_DESC"] = "transaction_from_DESC";
2627
+ SwapFeesInfoOrderByInput["transaction_from_DESC_NULLS_FIRST"] = "transaction_from_DESC_NULLS_FIRST";
2628
+ SwapFeesInfoOrderByInput["transaction_from_DESC_NULLS_LAST"] = "transaction_from_DESC_NULLS_LAST";
2629
+ SwapFeesInfoOrderByInput["transaction_hash_ASC"] = "transaction_hash_ASC";
2630
+ SwapFeesInfoOrderByInput["transaction_hash_ASC_NULLS_FIRST"] = "transaction_hash_ASC_NULLS_FIRST";
2631
+ SwapFeesInfoOrderByInput["transaction_hash_ASC_NULLS_LAST"] = "transaction_hash_ASC_NULLS_LAST";
2632
+ SwapFeesInfoOrderByInput["transaction_hash_DESC"] = "transaction_hash_DESC";
2633
+ SwapFeesInfoOrderByInput["transaction_hash_DESC_NULLS_FIRST"] = "transaction_hash_DESC_NULLS_FIRST";
2634
+ SwapFeesInfoOrderByInput["transaction_hash_DESC_NULLS_LAST"] = "transaction_hash_DESC_NULLS_LAST";
2635
+ SwapFeesInfoOrderByInput["transaction_id_ASC"] = "transaction_id_ASC";
2636
+ SwapFeesInfoOrderByInput["transaction_id_ASC_NULLS_FIRST"] = "transaction_id_ASC_NULLS_FIRST";
2637
+ SwapFeesInfoOrderByInput["transaction_id_ASC_NULLS_LAST"] = "transaction_id_ASC_NULLS_LAST";
2638
+ SwapFeesInfoOrderByInput["transaction_id_DESC"] = "transaction_id_DESC";
2639
+ SwapFeesInfoOrderByInput["transaction_id_DESC_NULLS_FIRST"] = "transaction_id_DESC_NULLS_FIRST";
2640
+ SwapFeesInfoOrderByInput["transaction_id_DESC_NULLS_LAST"] = "transaction_id_DESC_NULLS_LAST";
2641
+ SwapFeesInfoOrderByInput["transaction_timestamp_ASC"] = "transaction_timestamp_ASC";
2642
+ SwapFeesInfoOrderByInput["transaction_timestamp_ASC_NULLS_FIRST"] = "transaction_timestamp_ASC_NULLS_FIRST";
2643
+ SwapFeesInfoOrderByInput["transaction_timestamp_ASC_NULLS_LAST"] = "transaction_timestamp_ASC_NULLS_LAST";
2644
+ SwapFeesInfoOrderByInput["transaction_timestamp_DESC"] = "transaction_timestamp_DESC";
2645
+ SwapFeesInfoOrderByInput["transaction_timestamp_DESC_NULLS_FIRST"] = "transaction_timestamp_DESC_NULLS_FIRST";
2646
+ SwapFeesInfoOrderByInput["transaction_timestamp_DESC_NULLS_LAST"] = "transaction_timestamp_DESC_NULLS_LAST";
2647
+ SwapFeesInfoOrderByInput["transaction_to_ASC"] = "transaction_to_ASC";
2648
+ SwapFeesInfoOrderByInput["transaction_to_ASC_NULLS_FIRST"] = "transaction_to_ASC_NULLS_FIRST";
2649
+ SwapFeesInfoOrderByInput["transaction_to_ASC_NULLS_LAST"] = "transaction_to_ASC_NULLS_LAST";
2650
+ SwapFeesInfoOrderByInput["transaction_to_DESC"] = "transaction_to_DESC";
2651
+ SwapFeesInfoOrderByInput["transaction_to_DESC_NULLS_FIRST"] = "transaction_to_DESC_NULLS_FIRST";
2652
+ SwapFeesInfoOrderByInput["transaction_to_DESC_NULLS_LAST"] = "transaction_to_DESC_NULLS_LAST";
2653
+ SwapFeesInfoOrderByInput["transaction_transactionIndex_ASC"] = "transaction_transactionIndex_ASC";
2654
+ SwapFeesInfoOrderByInput["transaction_transactionIndex_ASC_NULLS_FIRST"] = "transaction_transactionIndex_ASC_NULLS_FIRST";
2655
+ SwapFeesInfoOrderByInput["transaction_transactionIndex_ASC_NULLS_LAST"] = "transaction_transactionIndex_ASC_NULLS_LAST";
2656
+ SwapFeesInfoOrderByInput["transaction_transactionIndex_DESC"] = "transaction_transactionIndex_DESC";
2657
+ SwapFeesInfoOrderByInput["transaction_transactionIndex_DESC_NULLS_FIRST"] = "transaction_transactionIndex_DESC_NULLS_FIRST";
2658
+ SwapFeesInfoOrderByInput["transaction_transactionIndex_DESC_NULLS_LAST"] = "transaction_transactionIndex_DESC_NULLS_LAST";
2659
+ })(SwapFeesInfoOrderByInput || (SwapFeesInfoOrderByInput = {}));
2510
2660
  export var SwapInfoOrderByInput;
2511
2661
  (function (SwapInfoOrderByInput) {
2512
2662
  SwapInfoOrderByInput["amountInAfterFees_ASC"] = "amountInAfterFees_ASC";
@@ -2624,6 +2774,45 @@ export var SwapInfoOrderByInput;
2624
2774
  SwapInfoOrderByInput["transaction_transactionIndex_DESC_NULLS_FIRST"] = "transaction_transactionIndex_DESC_NULLS_FIRST";
2625
2775
  SwapInfoOrderByInput["transaction_transactionIndex_DESC_NULLS_LAST"] = "transaction_transactionIndex_DESC_NULLS_LAST";
2626
2776
  })(SwapInfoOrderByInput || (SwapInfoOrderByInput = {}));
2777
+ export var SwapVolumeInfoOrderByInput;
2778
+ (function (SwapVolumeInfoOrderByInput) {
2779
+ SwapVolumeInfoOrderByInput["id_ASC"] = "id_ASC";
2780
+ SwapVolumeInfoOrderByInput["id_ASC_NULLS_FIRST"] = "id_ASC_NULLS_FIRST";
2781
+ SwapVolumeInfoOrderByInput["id_ASC_NULLS_LAST"] = "id_ASC_NULLS_LAST";
2782
+ SwapVolumeInfoOrderByInput["id_DESC"] = "id_DESC";
2783
+ SwapVolumeInfoOrderByInput["id_DESC_NULLS_FIRST"] = "id_DESC_NULLS_FIRST";
2784
+ SwapVolumeInfoOrderByInput["id_DESC_NULLS_LAST"] = "id_DESC_NULLS_LAST";
2785
+ SwapVolumeInfoOrderByInput["period_ASC"] = "period_ASC";
2786
+ SwapVolumeInfoOrderByInput["period_ASC_NULLS_FIRST"] = "period_ASC_NULLS_FIRST";
2787
+ SwapVolumeInfoOrderByInput["period_ASC_NULLS_LAST"] = "period_ASC_NULLS_LAST";
2788
+ SwapVolumeInfoOrderByInput["period_DESC"] = "period_DESC";
2789
+ SwapVolumeInfoOrderByInput["period_DESC_NULLS_FIRST"] = "period_DESC_NULLS_FIRST";
2790
+ SwapVolumeInfoOrderByInput["period_DESC_NULLS_LAST"] = "period_DESC_NULLS_LAST";
2791
+ SwapVolumeInfoOrderByInput["timestamp_ASC"] = "timestamp_ASC";
2792
+ SwapVolumeInfoOrderByInput["timestamp_ASC_NULLS_FIRST"] = "timestamp_ASC_NULLS_FIRST";
2793
+ SwapVolumeInfoOrderByInput["timestamp_ASC_NULLS_LAST"] = "timestamp_ASC_NULLS_LAST";
2794
+ SwapVolumeInfoOrderByInput["timestamp_DESC"] = "timestamp_DESC";
2795
+ SwapVolumeInfoOrderByInput["timestamp_DESC_NULLS_FIRST"] = "timestamp_DESC_NULLS_FIRST";
2796
+ SwapVolumeInfoOrderByInput["timestamp_DESC_NULLS_LAST"] = "timestamp_DESC_NULLS_LAST";
2797
+ SwapVolumeInfoOrderByInput["tokenIn_ASC"] = "tokenIn_ASC";
2798
+ SwapVolumeInfoOrderByInput["tokenIn_ASC_NULLS_FIRST"] = "tokenIn_ASC_NULLS_FIRST";
2799
+ SwapVolumeInfoOrderByInput["tokenIn_ASC_NULLS_LAST"] = "tokenIn_ASC_NULLS_LAST";
2800
+ SwapVolumeInfoOrderByInput["tokenIn_DESC"] = "tokenIn_DESC";
2801
+ SwapVolumeInfoOrderByInput["tokenIn_DESC_NULLS_FIRST"] = "tokenIn_DESC_NULLS_FIRST";
2802
+ SwapVolumeInfoOrderByInput["tokenIn_DESC_NULLS_LAST"] = "tokenIn_DESC_NULLS_LAST";
2803
+ SwapVolumeInfoOrderByInput["tokenOut_ASC"] = "tokenOut_ASC";
2804
+ SwapVolumeInfoOrderByInput["tokenOut_ASC_NULLS_FIRST"] = "tokenOut_ASC_NULLS_FIRST";
2805
+ SwapVolumeInfoOrderByInput["tokenOut_ASC_NULLS_LAST"] = "tokenOut_ASC_NULLS_LAST";
2806
+ SwapVolumeInfoOrderByInput["tokenOut_DESC"] = "tokenOut_DESC";
2807
+ SwapVolumeInfoOrderByInput["tokenOut_DESC_NULLS_FIRST"] = "tokenOut_DESC_NULLS_FIRST";
2808
+ SwapVolumeInfoOrderByInput["tokenOut_DESC_NULLS_LAST"] = "tokenOut_DESC_NULLS_LAST";
2809
+ SwapVolumeInfoOrderByInput["volumeUsd_ASC"] = "volumeUsd_ASC";
2810
+ SwapVolumeInfoOrderByInput["volumeUsd_ASC_NULLS_FIRST"] = "volumeUsd_ASC_NULLS_FIRST";
2811
+ SwapVolumeInfoOrderByInput["volumeUsd_ASC_NULLS_LAST"] = "volumeUsd_ASC_NULLS_LAST";
2812
+ SwapVolumeInfoOrderByInput["volumeUsd_DESC"] = "volumeUsd_DESC";
2813
+ SwapVolumeInfoOrderByInput["volumeUsd_DESC_NULLS_FIRST"] = "volumeUsd_DESC_NULLS_FIRST";
2814
+ SwapVolumeInfoOrderByInput["volumeUsd_DESC_NULLS_LAST"] = "volumeUsd_DESC_NULLS_LAST";
2815
+ })(SwapVolumeInfoOrderByInput || (SwapVolumeInfoOrderByInput = {}));
2627
2816
  export var TradeActionOrderByInput;
2628
2817
  (function (TradeActionOrderByInput) {
2629
2818
  TradeActionOrderByInput["acceptablePrice_ASC"] = "acceptablePrice_ASC";
@@ -2972,3 +3161,54 @@ export var TransactionOrderByInput;
2972
3161
  TransactionOrderByInput["transactionIndex_DESC_NULLS_FIRST"] = "transactionIndex_DESC_NULLS_FIRST";
2973
3162
  TransactionOrderByInput["transactionIndex_DESC_NULLS_LAST"] = "transactionIndex_DESC_NULLS_LAST";
2974
3163
  })(TransactionOrderByInput || (TransactionOrderByInput = {}));
3164
+ export var VolumeInfoOrderByInput;
3165
+ (function (VolumeInfoOrderByInput) {
3166
+ VolumeInfoOrderByInput["depositVolumeUsd_ASC"] = "depositVolumeUsd_ASC";
3167
+ VolumeInfoOrderByInput["depositVolumeUsd_ASC_NULLS_FIRST"] = "depositVolumeUsd_ASC_NULLS_FIRST";
3168
+ VolumeInfoOrderByInput["depositVolumeUsd_ASC_NULLS_LAST"] = "depositVolumeUsd_ASC_NULLS_LAST";
3169
+ VolumeInfoOrderByInput["depositVolumeUsd_DESC"] = "depositVolumeUsd_DESC";
3170
+ VolumeInfoOrderByInput["depositVolumeUsd_DESC_NULLS_FIRST"] = "depositVolumeUsd_DESC_NULLS_FIRST";
3171
+ VolumeInfoOrderByInput["depositVolumeUsd_DESC_NULLS_LAST"] = "depositVolumeUsd_DESC_NULLS_LAST";
3172
+ VolumeInfoOrderByInput["id_ASC"] = "id_ASC";
3173
+ VolumeInfoOrderByInput["id_ASC_NULLS_FIRST"] = "id_ASC_NULLS_FIRST";
3174
+ VolumeInfoOrderByInput["id_ASC_NULLS_LAST"] = "id_ASC_NULLS_LAST";
3175
+ VolumeInfoOrderByInput["id_DESC"] = "id_DESC";
3176
+ VolumeInfoOrderByInput["id_DESC_NULLS_FIRST"] = "id_DESC_NULLS_FIRST";
3177
+ VolumeInfoOrderByInput["id_DESC_NULLS_LAST"] = "id_DESC_NULLS_LAST";
3178
+ VolumeInfoOrderByInput["marginVolumeUsd_ASC"] = "marginVolumeUsd_ASC";
3179
+ VolumeInfoOrderByInput["marginVolumeUsd_ASC_NULLS_FIRST"] = "marginVolumeUsd_ASC_NULLS_FIRST";
3180
+ VolumeInfoOrderByInput["marginVolumeUsd_ASC_NULLS_LAST"] = "marginVolumeUsd_ASC_NULLS_LAST";
3181
+ VolumeInfoOrderByInput["marginVolumeUsd_DESC"] = "marginVolumeUsd_DESC";
3182
+ VolumeInfoOrderByInput["marginVolumeUsd_DESC_NULLS_FIRST"] = "marginVolumeUsd_DESC_NULLS_FIRST";
3183
+ VolumeInfoOrderByInput["marginVolumeUsd_DESC_NULLS_LAST"] = "marginVolumeUsd_DESC_NULLS_LAST";
3184
+ VolumeInfoOrderByInput["period_ASC"] = "period_ASC";
3185
+ VolumeInfoOrderByInput["period_ASC_NULLS_FIRST"] = "period_ASC_NULLS_FIRST";
3186
+ VolumeInfoOrderByInput["period_ASC_NULLS_LAST"] = "period_ASC_NULLS_LAST";
3187
+ VolumeInfoOrderByInput["period_DESC"] = "period_DESC";
3188
+ VolumeInfoOrderByInput["period_DESC_NULLS_FIRST"] = "period_DESC_NULLS_FIRST";
3189
+ VolumeInfoOrderByInput["period_DESC_NULLS_LAST"] = "period_DESC_NULLS_LAST";
3190
+ VolumeInfoOrderByInput["swapVolumeUsd_ASC"] = "swapVolumeUsd_ASC";
3191
+ VolumeInfoOrderByInput["swapVolumeUsd_ASC_NULLS_FIRST"] = "swapVolumeUsd_ASC_NULLS_FIRST";
3192
+ VolumeInfoOrderByInput["swapVolumeUsd_ASC_NULLS_LAST"] = "swapVolumeUsd_ASC_NULLS_LAST";
3193
+ VolumeInfoOrderByInput["swapVolumeUsd_DESC"] = "swapVolumeUsd_DESC";
3194
+ VolumeInfoOrderByInput["swapVolumeUsd_DESC_NULLS_FIRST"] = "swapVolumeUsd_DESC_NULLS_FIRST";
3195
+ VolumeInfoOrderByInput["swapVolumeUsd_DESC_NULLS_LAST"] = "swapVolumeUsd_DESC_NULLS_LAST";
3196
+ VolumeInfoOrderByInput["timestamp_ASC"] = "timestamp_ASC";
3197
+ VolumeInfoOrderByInput["timestamp_ASC_NULLS_FIRST"] = "timestamp_ASC_NULLS_FIRST";
3198
+ VolumeInfoOrderByInput["timestamp_ASC_NULLS_LAST"] = "timestamp_ASC_NULLS_LAST";
3199
+ VolumeInfoOrderByInput["timestamp_DESC"] = "timestamp_DESC";
3200
+ VolumeInfoOrderByInput["timestamp_DESC_NULLS_FIRST"] = "timestamp_DESC_NULLS_FIRST";
3201
+ VolumeInfoOrderByInput["timestamp_DESC_NULLS_LAST"] = "timestamp_DESC_NULLS_LAST";
3202
+ VolumeInfoOrderByInput["volumeUsd_ASC"] = "volumeUsd_ASC";
3203
+ VolumeInfoOrderByInput["volumeUsd_ASC_NULLS_FIRST"] = "volumeUsd_ASC_NULLS_FIRST";
3204
+ VolumeInfoOrderByInput["volumeUsd_ASC_NULLS_LAST"] = "volumeUsd_ASC_NULLS_LAST";
3205
+ VolumeInfoOrderByInput["volumeUsd_DESC"] = "volumeUsd_DESC";
3206
+ VolumeInfoOrderByInput["volumeUsd_DESC_NULLS_FIRST"] = "volumeUsd_DESC_NULLS_FIRST";
3207
+ VolumeInfoOrderByInput["volumeUsd_DESC_NULLS_LAST"] = "volumeUsd_DESC_NULLS_LAST";
3208
+ VolumeInfoOrderByInput["withdrawalVolumeUsd_ASC"] = "withdrawalVolumeUsd_ASC";
3209
+ VolumeInfoOrderByInput["withdrawalVolumeUsd_ASC_NULLS_FIRST"] = "withdrawalVolumeUsd_ASC_NULLS_FIRST";
3210
+ VolumeInfoOrderByInput["withdrawalVolumeUsd_ASC_NULLS_LAST"] = "withdrawalVolumeUsd_ASC_NULLS_LAST";
3211
+ VolumeInfoOrderByInput["withdrawalVolumeUsd_DESC"] = "withdrawalVolumeUsd_DESC";
3212
+ VolumeInfoOrderByInput["withdrawalVolumeUsd_DESC_NULLS_FIRST"] = "withdrawalVolumeUsd_DESC_NULLS_FIRST";
3213
+ VolumeInfoOrderByInput["withdrawalVolumeUsd_DESC_NULLS_LAST"] = "withdrawalVolumeUsd_DESC_NULLS_LAST";
3214
+ })(VolumeInfoOrderByInput || (VolumeInfoOrderByInput = {}));
@@ -1 +1,6 @@
1
- export {};
1
+ export var TokenBalanceType;
2
+ (function (TokenBalanceType) {
3
+ TokenBalanceType[TokenBalanceType["Wallet"] = 0] = "Wallet";
4
+ TokenBalanceType[TokenBalanceType["GmxAccount"] = 1] = "GmxAccount";
5
+ TokenBalanceType[TokenBalanceType["SourceChain"] = 2] = "SourceChain";
6
+ })(TokenBalanceType || (TokenBalanceType = {}));
@@ -0,0 +1,120 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { combineAbortSignals } from "../abort";
3
+ describe("combineAbortSignals", () => {
4
+ it("should return an AbortController", () => {
5
+ const controller1 = new AbortController();
6
+ const controller2 = new AbortController();
7
+ const combined = combineAbortSignals(controller1.signal, controller2.signal);
8
+ expect(combined).toBeInstanceOf(AbortController);
9
+ expect(combined.signal.aborted).toBe(false);
10
+ });
11
+ it("should abort combined controller when first signal is aborted", () => {
12
+ const controller1 = new AbortController();
13
+ const controller2 = new AbortController();
14
+ controller1.abort();
15
+ const combined = combineAbortSignals(controller1.signal, controller2.signal);
16
+ expect(combined.signal.aborted).toBe(true);
17
+ });
18
+ it("should abort combined controller when second signal is aborted", () => {
19
+ const controller1 = new AbortController();
20
+ const controller2 = new AbortController();
21
+ controller2.abort();
22
+ const combined = combineAbortSignals(controller1.signal, controller2.signal);
23
+ expect(combined.signal.aborted).toBe(true);
24
+ });
25
+ it("should abort combined controller when any signal is aborted after creation", () => {
26
+ const controller1 = new AbortController();
27
+ const controller2 = new AbortController();
28
+ const combined = combineAbortSignals(controller1.signal, controller2.signal);
29
+ expect(combined.signal.aborted).toBe(false);
30
+ controller1.abort();
31
+ expect(combined.signal.aborted).toBe(true);
32
+ });
33
+ it("should abort combined controller when multiple signals are aborted", () => {
34
+ const controller1 = new AbortController();
35
+ const controller2 = new AbortController();
36
+ const controller3 = new AbortController();
37
+ const combined = combineAbortSignals(controller1.signal, controller2.signal, controller3.signal);
38
+ expect(combined.signal.aborted).toBe(false);
39
+ controller2.abort();
40
+ expect(combined.signal.aborted).toBe(true);
41
+ });
42
+ it("should clean up event listeners when combined controller is aborted", () => {
43
+ const controller1 = new AbortController();
44
+ const controller2 = new AbortController();
45
+ const removeEventListener1 = vi.spyOn(controller1.signal, "removeEventListener");
46
+ const removeEventListener2 = vi.spyOn(controller2.signal, "removeEventListener");
47
+ const combined = combineAbortSignals(controller1.signal, controller2.signal);
48
+ combined.abort();
49
+ expect(removeEventListener1).toHaveBeenCalled();
50
+ expect(removeEventListener2).toHaveBeenCalled();
51
+ });
52
+ it("should clean up event listeners when source signal is aborted", () => {
53
+ const controller1 = new AbortController();
54
+ const controller2 = new AbortController();
55
+ const removeEventListener1 = vi.spyOn(controller1.signal, "removeEventListener");
56
+ const removeEventListener2 = vi.spyOn(controller2.signal, "removeEventListener");
57
+ const combined = combineAbortSignals(controller1.signal, controller2.signal);
58
+ controller1.abort();
59
+ expect(combined.signal.aborted).toBe(true);
60
+ expect(removeEventListener1).toHaveBeenCalled();
61
+ expect(removeEventListener2).toHaveBeenCalled();
62
+ });
63
+ it("should work with single signal", () => {
64
+ const controller = new AbortController();
65
+ const combined = combineAbortSignals(controller.signal);
66
+ expect(combined.signal.aborted).toBe(false);
67
+ controller.abort();
68
+ expect(combined.signal.aborted).toBe(true);
69
+ });
70
+ it("should work with empty array", () => {
71
+ const combined = combineAbortSignals();
72
+ expect(combined).toBeInstanceOf(AbortController);
73
+ expect(combined.signal.aborted).toBe(false);
74
+ });
75
+ it("should handle multiple aborts gracefully", () => {
76
+ const controller1 = new AbortController();
77
+ const controller2 = new AbortController();
78
+ const combined = combineAbortSignals(controller1.signal, controller2.signal);
79
+ controller1.abort();
80
+ controller2.abort();
81
+ expect(combined.signal.aborted).toBe(true);
82
+ });
83
+ it("should not leak memory when signals are aborted multiple times", () => {
84
+ const controller1 = new AbortController();
85
+ const controller2 = new AbortController();
86
+ const removeEventListener1 = vi.spyOn(controller1.signal, "removeEventListener");
87
+ const removeEventListener2 = vi.spyOn(controller2.signal, "removeEventListener");
88
+ const combined = combineAbortSignals(controller1.signal, controller2.signal);
89
+ controller1.abort();
90
+ controller2.abort();
91
+ combined.abort();
92
+ const callCount1 = removeEventListener1.mock.calls.length;
93
+ const callCount2 = removeEventListener2.mock.calls.length;
94
+ expect(callCount1).toBeGreaterThan(0);
95
+ expect(callCount2).toBeGreaterThan(0);
96
+ });
97
+ it("should clean up listeners when later signal is already aborted", () => {
98
+ const controller1 = new AbortController();
99
+ const controller2 = new AbortController();
100
+ controller2.abort();
101
+ const removeEventListener1 = vi.spyOn(controller1.signal, "removeEventListener");
102
+ const addEventListener1 = vi.spyOn(controller1.signal, "addEventListener");
103
+ const combined = combineAbortSignals(controller1.signal, controller2.signal);
104
+ expect(combined.signal.aborted).toBe(true);
105
+ expect(addEventListener1).toHaveBeenCalled();
106
+ expect(removeEventListener1).toHaveBeenCalled();
107
+ });
108
+ it("should clean up listeners when middle signal is already aborted", () => {
109
+ const controller1 = new AbortController();
110
+ const controller2 = new AbortController();
111
+ const controller3 = new AbortController();
112
+ controller2.abort();
113
+ const removeEventListener1 = vi.spyOn(controller1.signal, "removeEventListener");
114
+ const addEventListener1 = vi.spyOn(controller1.signal, "addEventListener");
115
+ const combined = combineAbortSignals(controller1.signal, controller2.signal, controller3.signal);
116
+ expect(combined.signal.aborted).toBe(true);
117
+ expect(addEventListener1).toHaveBeenCalled();
118
+ expect(removeEventListener1).toHaveBeenCalled();
119
+ });
120
+ });