@gmx-io/sdk 0.0.1-alpha-1

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 (237) hide show
  1. package/LICENSE +40 -0
  2. package/README.md +79 -0
  3. package/build/abis/CustomErrors.json +3254 -0
  4. package/build/abis/DataStore.json +1440 -0
  5. package/build/abis/ERC721.json +442 -0
  6. package/build/abis/EventEmitter.json +2065 -0
  7. package/build/abis/ExchangeRouter.json +1598 -0
  8. package/build/abis/GMT.json +522 -0
  9. package/build/abis/GlpManager.json +592 -0
  10. package/build/abis/GlvReader.json +1425 -0
  11. package/build/abis/GlvRouter.json +613 -0
  12. package/build/abis/GmxMigrator.json +657 -0
  13. package/build/abis/GovToken.json +1121 -0
  14. package/build/abis/MintableBaseToken.json +696 -0
  15. package/build/abis/Multicall.json +333 -0
  16. package/build/abis/OrderBook.json +1997 -0
  17. package/build/abis/OrderBookReader.json +111 -0
  18. package/build/abis/OrderExecutor.json +122 -0
  19. package/build/abis/PositionManager.json +1165 -0
  20. package/build/abis/PositionRouter.json +2030 -0
  21. package/build/abis/Reader.json +355 -0
  22. package/build/abis/ReaderV2.json +630 -0
  23. package/build/abis/ReferralStorage.json +507 -0
  24. package/build/abis/RewardReader.json +86 -0
  25. package/build/abis/RewardRouter.json +769 -0
  26. package/build/abis/RewardTracker.json +918 -0
  27. package/build/abis/Router-v2.json +605 -0
  28. package/build/abis/Router.json +605 -0
  29. package/build/abis/SubaccountRouter.json +648 -0
  30. package/build/abis/SyntheticsReader.json +4577 -0
  31. package/build/abis/SyntheticsRouter.json +77 -0
  32. package/build/abis/Timelock.json +1737 -0
  33. package/build/abis/Token.json +345 -0
  34. package/build/abis/Treasury.json +411 -0
  35. package/build/abis/UniPool.json +89 -0
  36. package/build/abis/UniswapV2.json +1 -0
  37. package/build/abis/Vault.json +3220 -0
  38. package/build/abis/VaultReader.json +87 -0
  39. package/build/abis/VaultV2.json +3019 -0
  40. package/build/abis/VaultV2b.json +3220 -0
  41. package/build/abis/Vester.json +1031 -0
  42. package/build/abis/WETH.json +320 -0
  43. package/build/abis/YieldFarm.json +599 -0
  44. package/build/abis/YieldToken.json +560 -0
  45. package/build/prebuilt/hashedMarketConfigKeys.json +3658 -0
  46. package/build/prebuilt/hashedMarketValuesKeys.json +1103 -0
  47. package/build/prebuilt/index.ts +28 -0
  48. package/build/src/abis/CustomErrors.json +3254 -0
  49. package/build/src/abis/DataStore.json +1440 -0
  50. package/build/src/abis/ERC721.json +442 -0
  51. package/build/src/abis/EventEmitter.json +2065 -0
  52. package/build/src/abis/ExchangeRouter.json +1598 -0
  53. package/build/src/abis/GMT.json +522 -0
  54. package/build/src/abis/GlpManager.json +591 -0
  55. package/build/src/abis/GlvReader.json +1424 -0
  56. package/build/src/abis/GlvRouter.json +612 -0
  57. package/build/src/abis/GmxMigrator.json +657 -0
  58. package/build/src/abis/GovToken.json +1121 -0
  59. package/build/src/abis/MintableBaseToken.json +696 -0
  60. package/build/src/abis/Multicall.json +333 -0
  61. package/build/src/abis/OrderBook.json +1997 -0
  62. package/build/src/abis/OrderBookReader.json +111 -0
  63. package/build/src/abis/OrderExecutor.json +122 -0
  64. package/build/src/abis/PositionManager.json +1165 -0
  65. package/build/src/abis/PositionRouter.json +2030 -0
  66. package/build/src/abis/Reader.json +355 -0
  67. package/build/src/abis/ReaderV2.json +630 -0
  68. package/build/src/abis/ReferralStorage.json +507 -0
  69. package/build/src/abis/RewardReader.json +86 -0
  70. package/build/src/abis/RewardRouter.json +769 -0
  71. package/build/src/abis/RewardTracker.json +918 -0
  72. package/build/src/abis/Router-v2.json +605 -0
  73. package/build/src/abis/Router.json +605 -0
  74. package/build/src/abis/SubaccountRouter.json +648 -0
  75. package/build/src/abis/SyntheticsReader.json +4577 -0
  76. package/build/src/abis/SyntheticsRouter.json +77 -0
  77. package/build/src/abis/Timelock.json +1737 -0
  78. package/build/src/abis/Token.json +345 -0
  79. package/build/src/abis/Treasury.json +411 -0
  80. package/build/src/abis/UniPool.json +89 -0
  81. package/build/src/abis/UniswapV2.json +1 -0
  82. package/build/src/abis/Vault.json +3220 -0
  83. package/build/src/abis/VaultReader.json +87 -0
  84. package/build/src/abis/VaultV2.json +3019 -0
  85. package/build/src/abis/VaultV2b.json +3220 -0
  86. package/build/src/abis/Vester.json +1031 -0
  87. package/build/src/abis/WETH.json +320 -0
  88. package/build/src/abis/YieldFarm.json +599 -0
  89. package/build/src/abis/YieldToken.json +560 -0
  90. package/build/src/configs/batch.d.ts +6 -0
  91. package/build/src/configs/batch.js +51 -0
  92. package/build/src/configs/chains.d.ts +37 -0
  93. package/build/src/configs/chains.js +90 -0
  94. package/build/src/configs/contracts.d.ts +2 -0
  95. package/build/src/configs/contracts.js +218 -0
  96. package/build/src/configs/dataStore.d.ts +149 -0
  97. package/build/src/configs/dataStore.js +276 -0
  98. package/build/src/configs/factors.d.ts +20 -0
  99. package/build/src/configs/factors.js +21 -0
  100. package/build/src/configs/markets.d.ts +8 -0
  101. package/build/src/configs/markets.js +528 -0
  102. package/build/src/configs/subgraph.d.ts +3 -0
  103. package/build/src/configs/subgraph.js +3 -0
  104. package/build/src/configs/tokens.d.ts +89 -0
  105. package/build/src/configs/tokens.js +1269 -0
  106. package/build/src/index.d.ts +44 -0
  107. package/build/src/index.js +245 -0
  108. package/build/src/modules/accounts/accounts.d.ts +5 -0
  109. package/build/src/modules/accounts/accounts.js +36 -0
  110. package/build/src/modules/accounts/accounts.spec.d.ts +1 -0
  111. package/build/src/modules/accounts/accounts.spec.js +7 -0
  112. package/build/src/modules/base.d.ts +9 -0
  113. package/build/src/modules/base.js +15 -0
  114. package/build/src/modules/markets/index.d.ts +26 -0
  115. package/build/src/modules/markets/index.js +339 -0
  116. package/build/src/modules/markets/markets.spec.d.ts +1 -0
  117. package/build/src/modules/markets/markets.spec.js +38 -0
  118. package/build/src/modules/markets/query-builders.d.ts +40 -0
  119. package/build/src/modules/markets/query-builders.js +379 -0
  120. package/build/src/modules/markets/types.d.ts +42 -0
  121. package/build/src/modules/markets/types.js +1 -0
  122. package/build/src/modules/oracle.d.ts +31 -0
  123. package/build/src/modules/oracle.js +53 -0
  124. package/build/src/modules/orders/orders.d.ts +60 -0
  125. package/build/src/modules/orders/orders.js +270 -0
  126. package/build/src/modules/orders/orders.spec.d.ts +1 -0
  127. package/build/src/modules/orders/orders.spec.js +16 -0
  128. package/build/src/modules/orders/transactions/cancelOrdersTxn.d.ts +6 -0
  129. package/build/src/modules/orders/transactions/cancelOrdersTxn.js +15 -0
  130. package/build/src/modules/orders/transactions/createDecreaseOrderTxn.d.ts +32 -0
  131. package/build/src/modules/orders/transactions/createDecreaseOrderTxn.js +98 -0
  132. package/build/src/modules/orders/transactions/createIncreaseOrderTxn.d.ts +77 -0
  133. package/build/src/modules/orders/transactions/createIncreaseOrderTxn.js +164 -0
  134. package/build/src/modules/orders/transactions/createSwapOrderTxn.d.ts +16 -0
  135. package/build/src/modules/orders/transactions/createSwapOrderTxn.js +97 -0
  136. package/build/src/modules/orders/transactions/createWrapOrUnwrapTxn.d.ts +6 -0
  137. package/build/src/modules/orders/transactions/createWrapOrUnwrapTxn.js +13 -0
  138. package/build/src/modules/orders/transactions/updateOrderTxn.d.ts +23 -0
  139. package/build/src/modules/orders/transactions/updateOrderTxn.js +44 -0
  140. package/build/src/modules/orders/utils.d.ts +248 -0
  141. package/build/src/modules/orders/utils.js +151 -0
  142. package/build/src/modules/positions/positions.d.ts +48 -0
  143. package/build/src/modules/positions/positions.js +563 -0
  144. package/build/src/modules/positions/positions.spec.d.ts +1 -0
  145. package/build/src/modules/positions/positions.spec.js +25 -0
  146. package/build/src/modules/tokens/tokens.d.ts +26 -0
  147. package/build/src/modules/tokens/tokens.js +132 -0
  148. package/build/src/modules/tokens/tokens.spec.d.ts +1 -0
  149. package/build/src/modules/tokens/tokens.spec.js +19 -0
  150. package/build/src/modules/trades/trades.d.ts +48 -0
  151. package/build/src/modules/trades/trades.js +390 -0
  152. package/build/src/modules/trades/trades.spec.d.ts +1 -0
  153. package/build/src/modules/trades/trades.spec.js +14 -0
  154. package/build/src/prebuilt/hashedMarketConfigKeys.json +3658 -0
  155. package/build/src/prebuilt/hashedMarketValuesKeys.json +1103 -0
  156. package/build/src/prebuilt/index.d.ts +14 -0
  157. package/build/src/prebuilt/index.js +9 -0
  158. package/build/src/types/amounts.d.ts +223 -0
  159. package/build/src/types/amounts.js +17 -0
  160. package/build/src/types/fees.d.ts +34 -0
  161. package/build/src/types/fees.js +1 -0
  162. package/build/src/types/markets.d.ts +143 -0
  163. package/build/src/types/markets.js +1 -0
  164. package/build/src/types/orders.d.ts +74 -0
  165. package/build/src/types/orders.js +33 -0
  166. package/build/src/types/positions.d.ts +53 -0
  167. package/build/src/types/positions.js +1 -0
  168. package/build/src/types/referrals.d.ts +124 -0
  169. package/build/src/types/referrals.js +9 -0
  170. package/build/src/types/sdk.d.ts +32 -0
  171. package/build/src/types/sdk.js +1 -0
  172. package/build/src/types/sidecarOrders.d.ts +54 -0
  173. package/build/src/types/sidecarOrders.js +1 -0
  174. package/build/src/types/syntheticsEvents.d.ts +88 -0
  175. package/build/src/types/syntheticsEvents.js +1 -0
  176. package/build/src/types/tokens.d.ts +89 -0
  177. package/build/src/types/tokens.js +1 -0
  178. package/build/src/types/trade.d.ts +223 -0
  179. package/build/src/types/trade.js +17 -0
  180. package/build/src/types/tradeHistory.d.ts +107 -0
  181. package/build/src/types/tradeHistory.js +8 -0
  182. package/build/src/utils/LruCache.d.ts +10 -0
  183. package/build/src/utils/LruCache.js +45 -0
  184. package/build/src/utils/bigmath.d.ts +7 -0
  185. package/build/src/utils/bigmath.js +23 -0
  186. package/build/src/utils/buildUrl.d.ts +1 -0
  187. package/build/src/utils/buildUrl.js +5 -0
  188. package/build/src/utils/callContract.d.ts +17 -0
  189. package/build/src/utils/callContract.js +133 -0
  190. package/build/src/utils/common.d.ts +2 -0
  191. package/build/src/utils/common.js +2 -0
  192. package/build/src/utils/fees/estimateOraclePriceCount.d.ts +6 -0
  193. package/build/src/utils/fees/estimateOraclePriceCount.js +19 -0
  194. package/build/src/utils/fees/executionFee.d.ts +59 -0
  195. package/build/src/utils/fees/executionFee.js +108 -0
  196. package/build/src/utils/fees/index.d.ts +29 -0
  197. package/build/src/utils/fees/index.js +89 -0
  198. package/build/src/utils/fees/priceImpact.d.ts +75 -0
  199. package/build/src/utils/fees/priceImpact.js +287 -0
  200. package/build/src/utils/graphqlFetcher.d.ts +1 -0
  201. package/build/src/utils/graphqlFetcher.js +18 -0
  202. package/build/src/utils/hash.d.ts +5 -0
  203. package/build/src/utils/hash.js +35 -0
  204. package/build/src/utils/marketKeysAndConfigs.d.ts +66 -0
  205. package/build/src/utils/marketKeysAndConfigs.js +257 -0
  206. package/build/src/utils/markets.d.ts +40 -0
  207. package/build/src/utils/markets.js +129 -0
  208. package/build/src/utils/multicall.d.ts +64 -0
  209. package/build/src/utils/multicall.js +116 -0
  210. package/build/src/utils/numbers.d.ts +9 -0
  211. package/build/src/utils/numbers.js +30 -0
  212. package/build/src/utils/objects.d.ts +18 -0
  213. package/build/src/utils/objects.js +30 -0
  214. package/build/src/utils/orders.d.ts +28 -0
  215. package/build/src/utils/orders.js +178 -0
  216. package/build/src/utils/positions.d.ts +60 -0
  217. package/build/src/utils/positions.js +133 -0
  218. package/build/src/utils/prices.d.ts +15 -0
  219. package/build/src/utils/prices.js +34 -0
  220. package/build/src/utils/referrals.d.ts +2 -0
  221. package/build/src/utils/referrals.js +27 -0
  222. package/build/src/utils/simulateExecuteOrder.d.ts +16 -0
  223. package/build/src/utils/simulateExecuteOrder.js +143 -0
  224. package/build/src/utils/slidingWindowFallbackSwitcher.d.ts +24 -0
  225. package/build/src/utils/slidingWindowFallbackSwitcher.js +40 -0
  226. package/build/src/utils/subgraph.d.ts +21 -0
  227. package/build/src/utils/subgraph.js +72 -0
  228. package/build/src/utils/swapStats.d.ts +35 -0
  229. package/build/src/utils/swapStats.js +197 -0
  230. package/build/src/utils/test.d.ts +2 -0
  231. package/build/src/utils/test.js +24 -0
  232. package/build/src/utils/tokens.d.ts +18 -0
  233. package/build/src/utils/tokens.js +64 -0
  234. package/build/src/utils/trade.d.ts +10 -0
  235. package/build/src/utils/trade.js +32 -0
  236. package/build/tsconfig.tsbuildinfo +1 -0
  237. package/package.json +96 -0
@@ -0,0 +1,1269 @@
1
+ import { ARBITRUM, ARBITRUM_GOERLI, AVALANCHE, AVALANCHE_FUJI } from "./chains";
2
+ import { getContract } from "./contracts";
3
+ import { zeroAddress } from "viem";
4
+ export const NATIVE_TOKEN_ADDRESS = zeroAddress;
5
+ export const TOKENS = {
6
+ [ARBITRUM]: [
7
+ {
8
+ name: "Ethereum",
9
+ symbol: "ETH",
10
+ decimals: 18,
11
+ address: zeroAddress,
12
+ isNative: true,
13
+ isShortable: true,
14
+ imageUrl: "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
15
+ coingeckoUrl: "https://www.coingecko.com/en/coins/ethereum",
16
+ isV1Available: true,
17
+ },
18
+ {
19
+ name: "Wrapped Ethereum",
20
+ symbol: "WETH",
21
+ decimals: 18,
22
+ address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
23
+ isWrapped: true,
24
+ baseSymbol: "ETH",
25
+ imageUrl: "https://assets.coingecko.com/coins/images/2518/thumb/weth.png?1628852295",
26
+ coingeckoUrl: "https://www.coingecko.com/en/coins/ethereum",
27
+ isV1Available: true,
28
+ },
29
+ {
30
+ name: "Bitcoin (WBTC)",
31
+ symbol: "BTC",
32
+ assetSymbol: "WBTC",
33
+ baseSymbol: "BTC",
34
+ decimals: 8,
35
+ address: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
36
+ isShortable: true,
37
+ imageUrl: "https://assets.coingecko.com/coins/images/26115/thumb/btcb.png?1655921693",
38
+ coingeckoUrl: "https://www.coingecko.com/en/coins/wrapped-bitcoin",
39
+ explorerUrl: "https://arbiscan.io/address/0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
40
+ isV1Available: true,
41
+ },
42
+ {
43
+ name: "Arbitrum",
44
+ symbol: "ARB",
45
+ decimals: 18,
46
+ priceDecimals: 4,
47
+ address: "0x912CE59144191C1204E64559FE8253a0e49E6548",
48
+ imageUrl: "https://assets.coingecko.com/coins/images/16547/small/photo_2023-03-29_21.47.00.jpeg?1680097630",
49
+ coingeckoUrl: "https://www.coingecko.com/en/coins/arbitrum",
50
+ explorerUrl: "https://arbiscan.io/token/0x912ce59144191c1204e64559fe8253a0e49e6548",
51
+ },
52
+ {
53
+ name: "Wrapped SOL (Wormhole)",
54
+ symbol: "SOL",
55
+ assetSymbol: "WSOL (Wormhole)",
56
+ priceDecimals: 3,
57
+ decimals: 9,
58
+ address: "0x2bcC6D6CdBbDC0a4071e48bb3B969b06B3330c07",
59
+ imageUrl: "https://assets.coingecko.com/coins/images/4128/small/solana.png?1640133422",
60
+ coingeckoUrl: "https://www.coingecko.com/en/coins/solana",
61
+ coingeckoSymbol: "SOL",
62
+ explorerUrl: "https://arbiscan.io/token/0x2bCc6D6CdBbDC0a4071e48bb3B969b06B3330c07",
63
+ explorerSymbol: "SOL",
64
+ },
65
+ {
66
+ name: "Chainlink",
67
+ symbol: "LINK",
68
+ decimals: 18,
69
+ priceDecimals: 4,
70
+ address: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4",
71
+ isStable: false,
72
+ isShortable: true,
73
+ imageUrl: "https://assets.coingecko.com/coins/images/877/thumb/chainlink-new-logo.png?1547034700",
74
+ coingeckoUrl: "https://www.coingecko.com/en/coins/chainlink",
75
+ explorerUrl: "https://arbiscan.io/token/0xf97f4df75117a78c1a5a0dbb814af92458539fb4",
76
+ isV1Available: true,
77
+ },
78
+ {
79
+ name: "Uniswap",
80
+ symbol: "UNI",
81
+ decimals: 18,
82
+ priceDecimals: 4,
83
+ address: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0",
84
+ isStable: false,
85
+ isShortable: true,
86
+ imageUrl: "https://assets.coingecko.com/coins/images/12504/thumb/uniswap-uni.png?1600306604",
87
+ coingeckoUrl: "https://www.coingecko.com/en/coins/uniswap",
88
+ explorerUrl: "https://arbiscan.io/token/0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0",
89
+ isV1Available: true,
90
+ },
91
+ {
92
+ name: "Bridged USDC (USDC.e)",
93
+ symbol: "USDC.e",
94
+ decimals: 6,
95
+ address: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
96
+ isStable: true,
97
+ imageUrl: "https://assets.coingecko.com/coins/images/6319/thumb/USD_Coin_icon.png?1547042389",
98
+ coingeckoUrl: "https://www.coingecko.com/en/coins/bridged-usdc-arbitrum",
99
+ explorerUrl: "https://arbiscan.io/token/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
100
+ isV1Available: true,
101
+ },
102
+ {
103
+ name: "USD Coin",
104
+ symbol: "USDC",
105
+ decimals: 6,
106
+ address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
107
+ isStable: true,
108
+ isV1Available: true,
109
+ imageUrl: "https://assets.coingecko.com/coins/images/6319/thumb/USD_Coin_icon.png?1547042389",
110
+ coingeckoUrl: "https://www.coingecko.com/en/coins/usd-coin",
111
+ explorerUrl: "https://arbiscan.io/address/0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
112
+ },
113
+ {
114
+ name: "Tether",
115
+ symbol: "USDT",
116
+ decimals: 6,
117
+ address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
118
+ isStable: true,
119
+ imageUrl: "https://assets.coingecko.com/coins/images/325/thumb/Tether-logo.png?1598003707",
120
+ explorerUrl: "https://arbiscan.io/address/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
121
+ coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
122
+ isV1Available: true,
123
+ },
124
+ {
125
+ name: "Dai",
126
+ symbol: "DAI",
127
+ decimals: 18,
128
+ address: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
129
+ isStable: true,
130
+ imageUrl: "https://assets.coingecko.com/coins/images/9956/thumb/4943.png?1636636734",
131
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dai",
132
+ explorerUrl: "https://arbiscan.io/token/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
133
+ isV1Available: true,
134
+ },
135
+ {
136
+ name: "Frax",
137
+ symbol: "FRAX",
138
+ decimals: 18,
139
+ address: "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F",
140
+ isStable: true,
141
+ imageUrl: "https://assets.coingecko.com/coins/images/13422/small/frax_logo.png?1608476506",
142
+ coingeckoUrl: "https://www.coingecko.com/en/coins/frax",
143
+ explorerUrl: "https://arbiscan.io/token/0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F",
144
+ isV1Available: true,
145
+ },
146
+ {
147
+ name: "Magic Internet Money",
148
+ symbol: "MIM",
149
+ decimals: 18,
150
+ address: "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A",
151
+ isStable: true,
152
+ isTempHidden: true,
153
+ imageUrl: "https://assets.coingecko.com/coins/images/16786/small/mimlogopng.png",
154
+ isV1Available: true,
155
+ },
156
+ {
157
+ name: "Bitcoin",
158
+ symbol: "BTC",
159
+ address: "0x47904963fc8b2340414262125aF798B9655E58Cd",
160
+ isSynthetic: true,
161
+ decimals: 8,
162
+ imageUrl: "https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579",
163
+ coingeckoUrl: "https://www.coingecko.com/en/coins/bitcoin",
164
+ },
165
+ {
166
+ name: "Dogecoin",
167
+ symbol: "DOGE",
168
+ decimals: 8,
169
+ priceDecimals: 5,
170
+ address: "0xC4da4c24fd591125c3F47b340b6f4f76111883d8",
171
+ isSynthetic: true,
172
+ imageUrl: "https://assets.coingecko.com/coins/images/5/small/dogecoin.png?1547792256",
173
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dogecoin",
174
+ },
175
+ {
176
+ name: "Litecoin",
177
+ symbol: "LTC",
178
+ decimals: 8,
179
+ priceDecimals: 3,
180
+ address: "0xB46A094Bc4B0adBD801E14b9DB95e05E28962764",
181
+ isSynthetic: true,
182
+ imageUrl: "https://assets.coingecko.com/coins/images/2/small/litecoin.png?1547033580",
183
+ coingeckoUrl: "https://www.coingecko.com/en/coins/litecoin",
184
+ },
185
+ {
186
+ name: "XRP",
187
+ symbol: "XRP",
188
+ decimals: 6,
189
+ priceDecimals: 4,
190
+ address: "0xc14e065b0067dE91534e032868f5Ac6ecf2c6868",
191
+ imageUrl: "https://assets.coingecko.com/coins/images/44/small/xrp-symbol-white-128.png?1605778731",
192
+ coingeckoUrl: "https://www.coingecko.com/en/coins/xrp",
193
+ isSynthetic: true,
194
+ },
195
+ {
196
+ name: "GMX",
197
+ symbol: "GMX",
198
+ address: getContract(ARBITRUM, "GMX"),
199
+ decimals: 18,
200
+ isPlatformToken: true,
201
+ isPlatformTradingToken: true,
202
+ imageUrl: "https://assets.coingecko.com/coins/images/18323/small/arbit.png?1631532468",
203
+ coingeckoUrl: "https://www.coingecko.com/en/coins/gmx",
204
+ explorerUrl: "https://arbiscan.io/address/0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a",
205
+ },
206
+ {
207
+ name: "Escrowed GMX",
208
+ symbol: "esGMX",
209
+ address: getContract(ARBITRUM, "ES_GMX"),
210
+ decimals: 18,
211
+ isPlatformToken: true,
212
+ },
213
+ {
214
+ name: "Wrapped BNB (LayerZero)",
215
+ symbol: "BNB",
216
+ assetSymbol: "WBNB (LayerZero)",
217
+ address: "0xa9004A5421372E1D83fB1f85b0fc986c912f91f3",
218
+ decimals: 18,
219
+ imageUrl: "https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970",
220
+ coingeckoUrl: "https://www.coingecko.com/en/coins/bnb",
221
+ coingeckoSymbol: "BNB",
222
+ metamaskSymbol: "WBNB",
223
+ explorerUrl: "https://arbiscan.io/token/0xa9004A5421372E1D83fB1f85b0fc986c912f91f3",
224
+ explorerSymbol: "WBNB",
225
+ },
226
+ {
227
+ name: "Cosmos",
228
+ symbol: "ATOM",
229
+ assetSymbol: "ATOM",
230
+ priceDecimals: 4,
231
+ address: "0x7D7F1765aCbaF847b9A1f7137FE8Ed4931FbfEbA",
232
+ decimals: 6,
233
+ imageUrl: "https://assets.coingecko.com/coins/images/1481/standard/cosmos_hub.png?1696502525",
234
+ coingeckoUrl: "https://www.coingecko.com/en/coins/cosmos-hub",
235
+ coingeckoSymbol: "ATOM",
236
+ isSynthetic: true,
237
+ },
238
+ {
239
+ name: "Near",
240
+ symbol: "NEAR",
241
+ assetSymbol: "NEAR",
242
+ priceDecimals: 4,
243
+ address: "0x1FF7F3EFBb9481Cbd7db4F932cBCD4467144237C",
244
+ decimals: 24,
245
+ imageUrl: "https://assets.coingecko.com/coins/images/10365/standard/near.jpg?1696510367",
246
+ coingeckoUrl: "https://www.coingecko.com/en/coins/near",
247
+ coingeckoSymbol: "NEAR",
248
+ isSynthetic: true,
249
+ },
250
+ {
251
+ name: "Aave",
252
+ symbol: "AAVE",
253
+ assetSymbol: "AAVE",
254
+ priceDecimals: 3,
255
+ address: "0xba5DdD1f9d7F570dc94a51479a000E3BCE967196",
256
+ decimals: 18,
257
+ imageUrl: "https://assets.coingecko.com/coins/images/12645/standard/AAVE.png?1696512452",
258
+ coingeckoUrl: "https://www.coingecko.com/en/coins/aave",
259
+ coingeckoSymbol: "AAVE",
260
+ },
261
+ {
262
+ name: "Wrapped AVAX (Wormhole)",
263
+ symbol: "AVAX",
264
+ assetSymbol: "WAVAX (Wormhole)",
265
+ priceDecimals: 3,
266
+ address: "0x565609fAF65B92F7be02468acF86f8979423e514",
267
+ decimals: 18,
268
+ imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
269
+ coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
270
+ coingeckoSymbol: "AVAX",
271
+ explorerSymbol: "WAVAX",
272
+ },
273
+ {
274
+ name: "Optimism",
275
+ symbol: "OP",
276
+ priceDecimals: 4,
277
+ address: "0xaC800FD6159c2a2CB8fC31EF74621eB430287a5A",
278
+ decimals: 18,
279
+ imageUrl: "https://assets.coingecko.com/coins/images/25244/standard/Optimism.png?1696524385",
280
+ coingeckoUrl: "https://www.coingecko.com/en/coins/optimism",
281
+ },
282
+ {
283
+ name: "Pepe",
284
+ symbol: "PEPE",
285
+ address: "0x25d887Ce7a35172C62FeBFD67a1856F20FaEbB00",
286
+ decimals: 18,
287
+ priceDecimals: 8,
288
+ imageUrl: "https://assets.coingecko.com/coins/images/29850/standard/pepe-token.jpeg?1696528776",
289
+ coingeckoUrl: "https://www.coingecko.com/en/coins/pepe",
290
+ },
291
+ {
292
+ name: "dogwifhat",
293
+ symbol: "WIF",
294
+ address: "0xA1b91fe9FD52141Ff8cac388Ce3F10BFDc1dE79d",
295
+ decimals: 6,
296
+ imageUrl: "https://assets.coingecko.com/coins/images/33566/standard/dogwifhat.jpg?1702499428",
297
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dogwifhat",
298
+ },
299
+ {
300
+ name: "ORDI",
301
+ symbol: "ORDI",
302
+ address: "0x1E15d08f3CA46853B692EE28AE9C7a0b88a9c994",
303
+ decimals: 18,
304
+ imageUrl: "https://assets.coingecko.com/coins/images/30162/standard/ordi.png?1696529082",
305
+ coingeckoUrl: "https://www.coingecko.com/en/coins/ordi",
306
+ isSynthetic: true,
307
+ },
308
+ {
309
+ name: "Stacks",
310
+ symbol: "STX",
311
+ address: "0xBaf07cF91D413C0aCB2b7444B9Bf13b4e03c9D71",
312
+ decimals: 6,
313
+ imageUrl: "https://assets.coingecko.com/coins/images/2069/standard/Stacks_Logo_png.png?1709979332",
314
+ coingeckoUrl: "https://www.coingecko.com/en/coins/stacks",
315
+ isSynthetic: true,
316
+ },
317
+ {
318
+ name: "Ethena USDe",
319
+ symbol: "USDe",
320
+ address: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34",
321
+ decimals: 18,
322
+ imageUrl: "https://assets.coingecko.com/coins/images/33613/standard/USDE.png?1716355685",
323
+ coingeckoUrl: "https://www.coingecko.com/en/coins/ethena-usde",
324
+ isStable: true,
325
+ },
326
+ {
327
+ name: "Wrapped stETH",
328
+ symbol: "wstETH",
329
+ address: "0x5979D7b546E38E414F7E9822514be443A4800529",
330
+ decimals: 18,
331
+ imageUrl: "https://assets.coingecko.com/coins/images/18834/standard/wstETH.png?1696518295",
332
+ coingeckoUrl: "https://www.coingecko.com/en/coins/wrapped-steth",
333
+ },
334
+ {
335
+ name: "Shiba Inu",
336
+ symbol: "SHIB",
337
+ assetSymbol: "SHIB",
338
+ address: "0x3E57D02f9d196873e55727382974b02EdebE6bfd",
339
+ decimals: 18,
340
+ priceDecimals: 8,
341
+ imageUrl: "https://assets.coingecko.com/coins/images/11939/standard/shiba.png?1696511800",
342
+ coingeckoUrl: "https://www.coingecko.com/en/coins/shiba-inu",
343
+ isSynthetic: true,
344
+ },
345
+ {
346
+ name: "tBTC",
347
+ symbol: "tBTC",
348
+ address: "0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40",
349
+ decimals: 18,
350
+ imageUrl: "https://assets.coingecko.com/coins/images/11224/standard/0x18084fba666a33d37592fa2633fd49a74dd93a88.png?1696511155",
351
+ coingeckoUrl: "https://www.coingecko.com/en/coins/tbtc",
352
+ },
353
+ {
354
+ name: "Eigen",
355
+ symbol: "EIGEN",
356
+ address: "0x606C3e5075e5555e79Aa15F1E9FACB776F96C248",
357
+ decimals: 18,
358
+ imageUrl: "https://assets.coingecko.com/coins/images/37441/standard/eigen.jpg?1728023974",
359
+ coingeckoUrl: "https://www.coingecko.com/en/coins/eigenlayer",
360
+ },
361
+ {
362
+ name: "Sats",
363
+ symbol: "SATS",
364
+ address: "0x2cD2eB61D17b78239Fcd19aafF72981B5D5eF319",
365
+ decimals: 6,
366
+ priceDecimals: 9,
367
+ imageUrl: "https://assets.coingecko.com/coins/images/30666/standard/_dD8qr3M_400x400.png?1702913020",
368
+ coingeckoUrl: "https://www.coingecko.com/en/coins/sats-ordinals",
369
+ isSynthetic: true,
370
+ },
371
+ {
372
+ name: "Polygon",
373
+ symbol: "POL",
374
+ decimals: 18,
375
+ priceDecimals: 4,
376
+ address: "0x9c74772b713a1B032aEB173E28683D937E51921c",
377
+ imageUrl: "https://assets.coingecko.com/coins/images/32440/standard/polygon.png?1698233684",
378
+ coingeckoUrl: "https://www.coingecko.com/en/coins/polygon",
379
+ isSynthetic: true,
380
+ },
381
+ // TODO: Enable
382
+ // {
383
+ // name: "APE",
384
+ // symbol: "APE",
385
+ // address: "0x74885b4D524d497261259B38900f54e6dbAd2210",
386
+ // decimals: 18,
387
+ // imageUrl: "https://assets.coingecko.com/coins/images/24383/standard/apecoin.jpg?1696523566",
388
+ // coingeckoUrl: "https://www.coingecko.com/en/coins/apecoin",
389
+ // },
390
+ {
391
+ name: "GMX LP",
392
+ symbol: "GLP",
393
+ address: getContract(ARBITRUM, "GLP"),
394
+ decimals: 18,
395
+ imageUrl: "https://github.com/gmx-io/gmx-assets/blob/main/GMX-Assets/PNG/GLP_LOGO%20ONLY.png?raw=true",
396
+ reservesUrl: "https://portfolio.nansen.ai/dashboard/gmx?chain=ARBITRUM",
397
+ isPlatformToken: true,
398
+ },
399
+ /** Placeholder tokens */
400
+ {
401
+ name: "GMX Market tokens",
402
+ symbol: "GM",
403
+ address: "<market-token-address>",
404
+ decimals: 18,
405
+ imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
406
+ isPlatformToken: true,
407
+ },
408
+ {
409
+ name: "GLV Market tokens",
410
+ symbol: "GLV",
411
+ address: "<market-token-address>",
412
+ decimals: 18,
413
+ imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
414
+ isPlatformToken: true,
415
+ },
416
+ ],
417
+ [AVALANCHE]: [
418
+ {
419
+ name: "Avalanche",
420
+ symbol: "AVAX",
421
+ decimals: 18,
422
+ address: zeroAddress,
423
+ isNative: true,
424
+ isShortable: true,
425
+ imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
426
+ coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
427
+ isV1Available: true,
428
+ },
429
+ {
430
+ name: "Wrapped AVAX",
431
+ symbol: "WAVAX",
432
+ decimals: 18,
433
+ address: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
434
+ isWrapped: true,
435
+ baseSymbol: "AVAX",
436
+ imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
437
+ coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
438
+ explorerUrl: "https://snowtrace.io/address/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
439
+ isV1Available: true,
440
+ },
441
+ {
442
+ name: "Ethereum (WETH.e)",
443
+ symbol: "ETH",
444
+ assetSymbol: "WETH.e",
445
+ address: "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
446
+ decimals: 18,
447
+ isShortable: true,
448
+ imageUrl: "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
449
+ coingeckoUrl: "https://www.coingecko.com/en/coins/weth",
450
+ coingeckoSymbol: "WETH",
451
+ explorerUrl: "https://snowtrace.io/address/0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
452
+ isV1Available: true,
453
+ },
454
+ {
455
+ name: "Bitcoin (BTC.b)",
456
+ symbol: "BTC",
457
+ assetSymbol: "BTC.b",
458
+ address: "0x152b9d0FdC40C096757F570A51E494bd4b943E50",
459
+ decimals: 8,
460
+ isShortable: true,
461
+ imageUrl: "https://assets.coingecko.com/coins/images/26115/thumb/btcb.png?1655921693",
462
+ coingeckoUrl: "https://www.coingecko.com/en/coins/bitcoin-avalanche-bridged-btc-b",
463
+ explorerUrl: "https://snowtrace.io/address/0x152b9d0FdC40C096757F570A51E494bd4b943E50",
464
+ isV1Available: true,
465
+ },
466
+ {
467
+ name: "Bitcoin (WBTC.e)",
468
+ symbol: "WBTC",
469
+ assetSymbol: "WBTC.e",
470
+ address: "0x50b7545627a5162F82A992c33b87aDc75187B218",
471
+ decimals: 8,
472
+ isShortable: true,
473
+ imageUrl: "https://assets.coingecko.com/coins/images/7598/thumb/wrapped_bitcoin_wbtc.png?1548822744",
474
+ coingeckoUrl: "https://www.coingecko.com/en/coins/wrapped-bitcoin",
475
+ coingeckoSymbol: "WBTC",
476
+ explorerUrl: "https://snowtrace.io/address/0x50b7545627a5162F82A992c33b87aDc75187B218",
477
+ isV1Available: true,
478
+ },
479
+ {
480
+ name: "USD Coin",
481
+ symbol: "USDC",
482
+ address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
483
+ decimals: 6,
484
+ isStable: true,
485
+ imageUrl: "https://assets.coingecko.com/coins/images/6319/thumb/USD_Coin_icon.png?1547042389",
486
+ coingeckoUrl: "https://www.coingecko.com/en/coins/usd-coin",
487
+ explorerUrl: "https://snowtrace.io/address/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
488
+ isV1Available: true,
489
+ },
490
+ {
491
+ name: "Bridged USDC (USDC.e)",
492
+ symbol: "USDC.e",
493
+ address: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664",
494
+ decimals: 6,
495
+ isStable: true,
496
+ imageUrl: "https://assets.coingecko.com/coins/images/6319/thumb/USD_Coin_icon.png?1547042389",
497
+ coingeckoUrl: "https://www.coingecko.com/en/coins/bridged-usdc-avalanche-bridge",
498
+ explorerUrl: "https://snowtrace.io/address/0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664",
499
+ isV1Available: true,
500
+ },
501
+ {
502
+ name: "Tether",
503
+ symbol: "USDT",
504
+ decimals: 6,
505
+ address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
506
+ isStable: true,
507
+ imageUrl: "https://assets.coingecko.com/coins/images/325/small/Tether-logo.png",
508
+ coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
509
+ explorerUrl: "https://snowtrace.io/address/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
510
+ },
511
+ {
512
+ name: "Tether",
513
+ symbol: "USDT.e",
514
+ decimals: 6,
515
+ address: "0xc7198437980c041c805A1EDcbA50c1Ce5db95118",
516
+ isStable: true,
517
+ imageUrl: "https://assets.coingecko.com/coins/images/325/small/Tether-logo.png",
518
+ coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
519
+ explorerUrl: "https://snowtrace.io/address/0xc7198437980c041c805A1EDcbA50c1Ce5db95118",
520
+ },
521
+ {
522
+ name: "Dai",
523
+ symbol: "DAI.e",
524
+ address: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",
525
+ decimals: 18,
526
+ isStable: true,
527
+ imageUrl: "https://assets.coingecko.com/coins/images/9956/thumb/4943.png?1636636734",
528
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dai",
529
+ explorerUrl: "https://snowtrace.io/address/0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",
530
+ },
531
+ {
532
+ name: "Magic Internet Money",
533
+ symbol: "MIM",
534
+ address: "0x130966628846BFd36ff31a822705796e8cb8C18D",
535
+ decimals: 18,
536
+ isStable: true,
537
+ isTempHidden: true,
538
+ imageUrl: "https://assets.coingecko.com/coins/images/16786/small/mimlogopng.png",
539
+ coingeckoUrl: "https://www.coingecko.com/en/coins/magic-internet-money",
540
+ explorerUrl: "https://snowtrace.io/address/0x130966628846BFd36ff31a822705796e8cb8C18D",
541
+ isV1Available: true,
542
+ },
543
+ {
544
+ name: "Chainlink",
545
+ symbol: "LINK",
546
+ decimals: 18,
547
+ priceDecimals: 4,
548
+ address: "0x5947BB275c521040051D82396192181b413227A3",
549
+ isStable: false,
550
+ isShortable: true,
551
+ imageUrl: "https://assets.coingecko.com/coins/images/877/thumb/chainlink-new-logo.png?1547034700",
552
+ coingeckoUrl: "https://www.coingecko.com/en/coins/chainlink",
553
+ explorerUrl: "https://snowtrace.io/address/0x5947BB275c521040051D82396192181b413227A3",
554
+ },
555
+ {
556
+ name: "Dogecoin",
557
+ symbol: "DOGE",
558
+ decimals: 8,
559
+ priceDecimals: 5,
560
+ address: "0xC301E6fe31062C557aEE806cc6A841aE989A3ac6",
561
+ isSynthetic: true,
562
+ imageUrl: "https://assets.coingecko.com/coins/images/5/small/dogecoin.png?1547792256",
563
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dogecoin",
564
+ },
565
+ {
566
+ name: "Litecoin",
567
+ symbol: "LTC",
568
+ decimals: 8,
569
+ priceDecimals: 3,
570
+ address: "0x8E9C35235C38C44b5a53B56A41eaf6dB9a430cD6",
571
+ isSynthetic: true,
572
+ imageUrl: "https://assets.coingecko.com/coins/images/2/small/litecoin.png?1547033580",
573
+ coingeckoUrl: "https://www.coingecko.com/en/coins/litecoin",
574
+ },
575
+ {
576
+ name: "Wrapped SOL (Wormhole)",
577
+ symbol: "SOL",
578
+ assetSymbol: "WSOL (Wormhole)",
579
+ priceDecimals: 3,
580
+ decimals: 9,
581
+ address: "0xFE6B19286885a4F7F55AdAD09C3Cd1f906D2478F",
582
+ imageUrl: "https://assets.coingecko.com/coins/images/4128/small/solana.png?1640133422",
583
+ coingeckoUrl: "https://www.coingecko.com/en/coins/solana",
584
+ coingeckoSymbol: "SOL",
585
+ explorerUrl: "https://snowtrace.io/address/0xFE6B19286885a4F7F55AdAD09C3Cd1f906D2478F",
586
+ },
587
+ {
588
+ name: "XRP",
589
+ symbol: "XRP",
590
+ decimals: 6,
591
+ priceDecimals: 5,
592
+ address: "0x34B2885D617cE2ddeD4F60cCB49809fc17bb58Af",
593
+ imageUrl: "https://assets.coingecko.com/coins/images/44/small/xrp-symbol-white-128.png?1605778731",
594
+ coingeckoUrl: "https://www.coingecko.com/en/coins/xrp",
595
+ isSynthetic: true,
596
+ },
597
+ {
598
+ name: "GMX",
599
+ symbol: "GMX",
600
+ address: getContract(AVALANCHE, "GMX"),
601
+ decimals: 18,
602
+ imageUrl: "https://assets.coingecko.com/coins/images/18323/small/arbit.png?1631532468",
603
+ isPlatformToken: true,
604
+ coingeckoUrl: "https://www.coingecko.com/en/coins/gmx",
605
+ explorerUrl: "https://snowtrace.io/address/0x62edc0692bd897d2295872a9ffcac5425011c661",
606
+ },
607
+ {
608
+ name: "Escrowed GMX",
609
+ symbol: "esGMX",
610
+ address: getContract(AVALANCHE, "ES_GMX"),
611
+ decimals: 18,
612
+ isPlatformToken: true,
613
+ },
614
+ {
615
+ name: "GMX LP",
616
+ symbol: "GLP",
617
+ address: getContract(AVALANCHE, "GLP"),
618
+ decimals: 18,
619
+ isPlatformToken: true,
620
+ imageUrl: "https://github.com/gmx-io/gmx-assets/blob/main/GMX-Assets/PNG/GLP_LOGO%20ONLY.png?raw=true",
621
+ explorerUrl: "https://snowtrace.io/address/0x9e295B5B976a184B14aD8cd72413aD846C299660",
622
+ reservesUrl: "https://portfolio.nansen.ai/dashboard/gmx?chain=AVAX",
623
+ },
624
+ /** Placeholder tokens */
625
+ {
626
+ name: "GMX Market tokens",
627
+ symbol: "GM",
628
+ address: "<market-token-address>",
629
+ decimals: 18,
630
+ imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
631
+ isPlatformToken: true,
632
+ },
633
+ {
634
+ name: "GLV Market tokens",
635
+ symbol: "GLV",
636
+ address: "<market-token-address>",
637
+ decimals: 18,
638
+ imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
639
+ isPlatformToken: true,
640
+ },
641
+ ],
642
+ [ARBITRUM_GOERLI]: [
643
+ {
644
+ name: "Ethereum",
645
+ symbol: "ETH",
646
+ decimals: 18,
647
+ address: zeroAddress,
648
+ isNative: true,
649
+ isShortable: true,
650
+ imageUrl: "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
651
+ },
652
+ {
653
+ name: "Wrapped Ethereum",
654
+ symbol: "WETH",
655
+ decimals: 18,
656
+ address: "0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3",
657
+ isWrapped: true,
658
+ baseSymbol: "ETH",
659
+ imageUrl: "https://assets.coingecko.com/coins/images/2518/thumb/weth.png?1628852295",
660
+ coingeckoUrl: "https://www.coingecko.com/en/coins/ethereum",
661
+ explorerUrl: "https://goerli.arbiscan.io/address/0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3",
662
+ },
663
+ {
664
+ name: "Bitcoin",
665
+ symbol: "BTC",
666
+ decimals: 8,
667
+ address: "0xCcF73F4Dcbbb573296BFA656b754Fe94BB957d62",
668
+ isShortable: true,
669
+ imageUrl: "https://assets.coingecko.com/coins/images/7598/thumb/wrapped_bitcoin_wbtc.png?1548822744",
670
+ coingeckoUrl: "https://www.coingecko.com/en/coins/bitcoin",
671
+ explorerUrl: "https://goerli.arbiscan.io/address/0xCcF73F4Dcbbb573296BFA656b754Fe94BB957d62",
672
+ },
673
+ {
674
+ name: "USD Coin",
675
+ symbol: "USDC",
676
+ decimals: 6,
677
+ address: "0x04FC936a15352a1b15b3B9c56EA002051e3DB3e5",
678
+ isStable: true,
679
+ imageUrl: "https://assets.coingecko.com/coins/images/6319/thumb/USD_Coin_icon.png?1547042389",
680
+ coingeckoUrl: "https://www.coingecko.com/en/coins/usd-coin",
681
+ explorerUrl: "https://goerli.arbiscan.io/address/0x04FC936a15352a1b15b3B9c56EA002051e3DB3e5",
682
+ },
683
+ {
684
+ name: "Tether",
685
+ symbol: "USDT",
686
+ decimals: 6,
687
+ address: "0xBFcBcdCbcc1b765843dCe4DF044B92FE68182a62",
688
+ isStable: true,
689
+ imageUrl: "https://assets.coingecko.com/coins/images/325/small/Tether-logo.png",
690
+ coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
691
+ explorerUrl: "https://goerli.arbiscan.io/address/0xBFcBcdCbcc1b765843dCe4DF044B92FE68182a62",
692
+ },
693
+ {
694
+ name: "Dai",
695
+ symbol: "DAI",
696
+ address: "0x7b7c6c49fA99b37270077FBFA398748c27046984",
697
+ decimals: 18,
698
+ isStable: true,
699
+ imageUrl: "https://assets.coingecko.com/coins/images/9956/thumb/4943.png?1636636734",
700
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dai",
701
+ explorerUrl: "https://goerli.arbiscan.io/address/0x7b7c6c49fA99b37270077FBFA398748c27046984",
702
+ },
703
+ {
704
+ name: "Solana",
705
+ symbol: "SOL",
706
+ decimals: 18,
707
+ priceDecimals: 3,
708
+ address: "0x9A98a11279FaeB0fF695dFEC3C4B8a29138d0a2f",
709
+ isSynthetic: true,
710
+ imageUrl: "https://assets.coingecko.com/coins/images/4128/small/solana.png?1640133422",
711
+ coingeckoUrl: "https://www.coingecko.com/en/coins/solana",
712
+ },
713
+ {
714
+ name: "Test token",
715
+ symbol: "TEST",
716
+ decimals: 18,
717
+ address: "0x13C52ccB49fE3228356D0C355641961646A0D9B2",
718
+ isSynthetic: true,
719
+ coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
720
+ },
721
+ {
722
+ name: "BNB",
723
+ symbol: "BNB",
724
+ isSynthetic: true,
725
+ priceDecimals: 3,
726
+ decimals: 18,
727
+ address: "0xa076E6db62f61bd1A4fC283F84739D2b0c80e2a3",
728
+ coingeckoUrl: "https://www.coingecko.com/en/coins/binancecoin",
729
+ },
730
+ {
731
+ name: "Cardano",
732
+ symbol: "ADA",
733
+ decimals: 18,
734
+ priceDecimals: 5,
735
+ address: "0x5F8a8f06da2848f846A2b5e3e42A4A2eEC5f337B",
736
+ isSynthetic: true,
737
+ coingeckoUrl: "https://www.coingecko.com/en/coins/cardano",
738
+ },
739
+ {
740
+ name: "TRON",
741
+ symbol: "TRX",
742
+ decimals: 18,
743
+ priceDecimals: 5,
744
+ address: "0x7a9Ba06548D0499f6Debf97809CC351c1e85795D",
745
+ isSynthetic: true,
746
+ coingeckoUrl: "https://www.coingecko.com/en/coins/tron",
747
+ },
748
+ {
749
+ name: "Polygon",
750
+ symbol: "MATIC",
751
+ decimals: 18,
752
+ priceDecimals: 4,
753
+ address: "0xd98D28787F5598749331052f952196428F61e3aD",
754
+ isSynthetic: true,
755
+ coingeckoUrl: "https://www.coingecko.com/en/coins/polygon",
756
+ },
757
+ {
758
+ name: "Polkadot",
759
+ symbol: "DOT",
760
+ decimals: 18,
761
+ priceDecimals: 4,
762
+ address: "0x7361D58cBc6495B6419397dFd5ebE2e2017F23E9",
763
+ isSynthetic: true,
764
+ coingeckoUrl: "https://www.coingecko.com/en/coins/polkadot",
765
+ },
766
+ {
767
+ name: "Uniswap",
768
+ symbol: "UNI",
769
+ decimals: 18,
770
+ priceDecimals: 4,
771
+ address: "0x6DEbb9cC48819941F797a2F0c63f9168C19fD057",
772
+ isSynthetic: true,
773
+ coingeckoUrl: "https://www.coingecko.com/en/coins/uniswap",
774
+ },
775
+ {
776
+ name: "Dogecoin",
777
+ symbol: "DOGE",
778
+ isSynthetic: true,
779
+ isShortable: true,
780
+ decimals: 8,
781
+ priceDecimals: 5,
782
+ address: "0x3e2fA75b78edF836299127FBAA776304B4712972",
783
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dogecoin",
784
+ },
785
+ {
786
+ name: "Chainlink",
787
+ symbol: "LINK",
788
+ decimals: 18,
789
+ priceDecimals: 4,
790
+ address: "0x55602A94239a7926D92da5C53Fb96E80372382aa",
791
+ isSynthetic: true,
792
+ coingeckoUrl: "https://www.coingecko.com/en/coins/chainlink",
793
+ },
794
+ {
795
+ name: "XRP",
796
+ symbol: "XRP",
797
+ decimals: 6,
798
+ priceDecimals: 5,
799
+ address: "0xF1C2093383453831e8c90ecf809691123116dAaC",
800
+ isSynthetic: true,
801
+ imageUrl: "https://assets.coingecko.com/coins/images/44/small/xrp-symbol-white-128.png?1605778731",
802
+ coingeckoUrl: "https://www.coingecko.com/en/coins/xrp",
803
+ },
804
+ {
805
+ name: "GMX",
806
+ symbol: "GMX",
807
+ address: "",
808
+ decimals: 18,
809
+ imageUrl: "https://assets.coingecko.com/coins/images/18323/small/arbit.png?1631532468",
810
+ isPlatformToken: true,
811
+ },
812
+ {
813
+ name: "Escrowed GMX",
814
+ symbol: "esGMX",
815
+ address: "",
816
+ decimals: 18,
817
+ isPlatformToken: true,
818
+ },
819
+ {
820
+ name: "GMX LP",
821
+ symbol: "GLP",
822
+ address: "",
823
+ decimals: 18,
824
+ imageUrl: "https://github.com/gmx-io/gmx-assets/blob/main/GMX-Assets/PNG/GLP_LOGO%20ONLY.png?raw=true",
825
+ isPlatformToken: true,
826
+ },
827
+ /** Placeholder tokens */
828
+ {
829
+ name: "GMX Market tokens",
830
+ symbol: "GM",
831
+ address: "<market-token-address>",
832
+ decimals: 18,
833
+ imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
834
+ isPlatformToken: true,
835
+ },
836
+ {
837
+ name: "GLV Market tokens",
838
+ symbol: "GLV",
839
+ address: "<market-token-address>",
840
+ decimals: 18,
841
+ imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
842
+ isPlatformToken: true,
843
+ },
844
+ ],
845
+ [AVALANCHE_FUJI]: [
846
+ {
847
+ name: "Avalanche",
848
+ symbol: "AVAX",
849
+ priceDecimals: 3,
850
+ decimals: 18,
851
+ address: zeroAddress,
852
+ isNative: true,
853
+ isShortable: true,
854
+ imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
855
+ },
856
+ {
857
+ name: "Wrapped AVAX",
858
+ symbol: "WAVAX",
859
+ priceDecimals: 3,
860
+ decimals: 18,
861
+ address: "0x1D308089a2D1Ced3f1Ce36B1FcaF815b07217be3",
862
+ isWrapped: true,
863
+ baseSymbol: "AVAX",
864
+ imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
865
+ coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
866
+ explorerUrl: "https://testnet.snowtrace.io/address/0x1D308089a2D1Ced3f1Ce36B1FcaF815b07217be3",
867
+ },
868
+ {
869
+ name: "Ethereum (WETH.e)",
870
+ symbol: "ETH",
871
+ assetSymbol: "WETH.e",
872
+ address: "0x82F0b3695Ed2324e55bbD9A9554cB4192EC3a514",
873
+ decimals: 18,
874
+ isShortable: true,
875
+ imageUrl: "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
876
+ coingeckoUrl: "https://www.coingecko.com/en/coins/weth",
877
+ coingeckoSymbol: "WETH",
878
+ explorerUrl: "https://testnet.snowtrace.io/address/0x82F0b3695Ed2324e55bbD9A9554cB4192EC3a514",
879
+ },
880
+ {
881
+ name: "USD Coin",
882
+ symbol: "USDC",
883
+ address: "0x3eBDeaA0DB3FfDe96E7a0DBBAFEC961FC50F725F",
884
+ decimals: 6,
885
+ isStable: true,
886
+ imageUrl: "https://assets.coingecko.com/coins/images/6319/thumb/USD_Coin_icon.png?1547042389",
887
+ coingeckoUrl: "https://www.coingecko.com/en/coins/usd-coin",
888
+ explorerUrl: "https://testnet.snowtrace.io/address/0x3eBDeaA0DB3FfDe96E7a0DBBAFEC961FC50F725F",
889
+ },
890
+ {
891
+ name: "Tether",
892
+ symbol: "USDT",
893
+ decimals: 6,
894
+ address: "0x50df4892Bd13f01E4e1Cd077ff394A8fa1A3fD7c",
895
+ isStable: true,
896
+ imageUrl: "https://assets.coingecko.com/coins/images/325/small/Tether-logo.png",
897
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dai",
898
+ explorerUrl: "https://testnet.snowtrace.io/address/0x50df4892Bd13f01E4e1Cd077ff394A8fa1A3fD7c",
899
+ },
900
+ {
901
+ name: "Dai",
902
+ symbol: "DAI",
903
+ address: "0x51290cb93bE5062A6497f16D9cd3376Adf54F920",
904
+ decimals: 6,
905
+ isStable: true,
906
+ imageUrl: "https://assets.coingecko.com/coins/images/9956/thumb/4943.png?1636636734",
907
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dai",
908
+ explorerUrl: "https://testnet.snowtrace.io/address/0x51290cb93bE5062A6497f16D9cd3376Adf54F920",
909
+ },
910
+ {
911
+ name: "Bitcoin (WBTC)",
912
+ symbol: "WBTC",
913
+ decimals: 8,
914
+ address: "0x3Bd8e00c25B12E6E60fc8B6f1E1E2236102073Ca",
915
+ imageUrl: "https://assets.coingecko.com/coins/images/7598/thumb/wrapped_bitcoin_wbtc.png?1548822744",
916
+ coingeckoUrl: "https://www.coingecko.com/en/coins/wrapped-bitcoin",
917
+ explorerUrl: "https://testnet.snowtrace.io/address/0x3Bd8e00c25B12E6E60fc8B6f1E1E2236102073Ca",
918
+ },
919
+ {
920
+ name: "Solana",
921
+ symbol: "SOL",
922
+ decimals: 18,
923
+ priceDecimals: 3,
924
+ address: "0x137f4a7336df4f3f11894718528516edaaD0B082",
925
+ isSynthetic: true,
926
+ imageUrl: "https://assets.coingecko.com/coins/images/4128/small/solana.png?1640133422",
927
+ coingeckoUrl: "https://www.coingecko.com/en/coins/solana",
928
+ },
929
+ {
930
+ name: "Test token",
931
+ symbol: "TEST",
932
+ decimals: 18,
933
+ address: "0x42DD131E1086FFCc59bAE9498D71E20E0C889B14",
934
+ isSynthetic: true,
935
+ coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
936
+ },
937
+ {
938
+ name: "BNB",
939
+ symbol: "BNB",
940
+ decimals: 18,
941
+ priceDecimals: 3,
942
+ address: "0x110892Dd5fa73bE430c0ade694febD9a4CAc68Be",
943
+ isSynthetic: true,
944
+ coingeckoUrl: "https://www.coingecko.com/en/coins/binancecoin",
945
+ },
946
+ {
947
+ name: "Cardano",
948
+ symbol: "ADA",
949
+ decimals: 18,
950
+ priceDecimals: 5,
951
+ address: "0xE64dfFF37Fa6Fe969b792B4146cEe2774Ef6e1a1",
952
+ isSynthetic: true,
953
+ coingeckoUrl: "https://www.coingecko.com/en/coins/cardano",
954
+ },
955
+ {
956
+ name: "TRON",
957
+ symbol: "TRX",
958
+ decimals: 18,
959
+ priceDecimals: 5,
960
+ address: "0x0D1495527C255068F2f6feE31C85d326D0A76FE8",
961
+ isSynthetic: true,
962
+ coingeckoUrl: "https://www.coingecko.com/en/coins/tron",
963
+ },
964
+ {
965
+ name: "Polygon",
966
+ symbol: "MATIC",
967
+ decimals: 18,
968
+ priceDecimals: 4,
969
+ address: "0xadc4698B257F78187Fd675FBf591a09f4c975240",
970
+ isSynthetic: true,
971
+ coingeckoUrl: "https://www.coingecko.com/en/coins/polygon",
972
+ },
973
+ {
974
+ name: "Polkadot",
975
+ symbol: "DOT",
976
+ address: "0x65FFb5664a7B3377A5a27D9e59C72Fb1A5E94962",
977
+ decimals: 18,
978
+ priceDecimals: 4,
979
+ isSynthetic: true,
980
+ coingeckoUrl: "https://www.coingecko.com/en/coins/polkadot",
981
+ },
982
+ {
983
+ name: "Uniswap",
984
+ symbol: "UNI",
985
+ decimals: 18,
986
+ priceDecimals: 4,
987
+ address: "0xF62dC1d2452d0893735D22945Af53C290b158eAF",
988
+ isSynthetic: true,
989
+ coingeckoUrl: "https://www.coingecko.com/en/coins/uniswap",
990
+ },
991
+ {
992
+ name: "Dogecoin",
993
+ symbol: "DOGE",
994
+ decimals: 8,
995
+ priceDecimals: 5,
996
+ address: "0x2265F317eA5f47A684E5B26c50948617c945d986",
997
+ isSynthetic: true,
998
+ isShortable: true,
999
+ coingeckoUrl: "https://www.coingecko.com/en/coins/dogecoin",
1000
+ },
1001
+ {
1002
+ name: "Chainlink",
1003
+ symbol: "LINK",
1004
+ decimals: 18,
1005
+ priceDecimals: 3,
1006
+ address: "0x6BD09E8D65AD5cc761DF62454452d4EC1545e647",
1007
+ isSynthetic: true,
1008
+ isShortable: true,
1009
+ coingeckoUrl: "https://www.coingecko.com/en/coins/chainlink",
1010
+ },
1011
+ {
1012
+ name: "XRP",
1013
+ symbol: "XRP",
1014
+ decimals: 6,
1015
+ priceDecimals: 4,
1016
+ address: "0xF1C2093383453831e8c90ecf809691123116dAaC",
1017
+ isSynthetic: true,
1018
+ imageUrl: "https://assets.coingecko.com/coins/images/44/small/xrp-symbol-white-128.png?1605778731",
1019
+ coingeckoUrl: "https://www.coingecko.com/en/coins/xrp",
1020
+ },
1021
+ {
1022
+ name: "GMX",
1023
+ symbol: "GMX",
1024
+ address: "",
1025
+ decimals: 18,
1026
+ imageUrl: "https://assets.coingecko.com/coins/images/18323/small/arbit.png?1631532468",
1027
+ isPlatformToken: true,
1028
+ },
1029
+ {
1030
+ name: "Escrowed GMX",
1031
+ symbol: "esGMX",
1032
+ address: "",
1033
+ decimals: 18,
1034
+ isPlatformToken: true,
1035
+ },
1036
+ {
1037
+ name: "GMX LP",
1038
+ symbol: "GLP",
1039
+ address: "",
1040
+ decimals: 18,
1041
+ imageUrl: "https://github.com/gmx-io/gmx-assets/blob/main/GMX-Assets/PNG/GLP_LOGO%20ONLY.png?raw=true",
1042
+ isPlatformToken: true,
1043
+ },
1044
+ /** Placeholder tokens */
1045
+ {
1046
+ name: "GMX Market tokens",
1047
+ symbol: "GM",
1048
+ address: "<market-token-address>",
1049
+ decimals: 18,
1050
+ imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
1051
+ isPlatformToken: true,
1052
+ },
1053
+ {
1054
+ name: "GLV Market tokens",
1055
+ symbol: "GLV",
1056
+ address: "<market-token-address>",
1057
+ decimals: 18,
1058
+ imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
1059
+ isPlatformToken: true,
1060
+ },
1061
+ ],
1062
+ };
1063
+ export const TOKEN_COLOR_MAP = {
1064
+ ETH: "#6062a6",
1065
+ BTC: "#F7931A",
1066
+ WBTC: "#F7931A",
1067
+ USDC: "#2775CA",
1068
+ "USDC.e": "#2A5ADA",
1069
+ USDT: "#67B18A",
1070
+ MIM: "#9695F8",
1071
+ FRAX: "#000",
1072
+ DAI: "#FAC044",
1073
+ UNI: "#E9167C",
1074
+ AVAX: "#E84142",
1075
+ LINK: "#3256D6",
1076
+ DOGE: "#BA9F2F",
1077
+ SOL: "#38cbc1",
1078
+ ARB: "#162c4f",
1079
+ NEAR: "#07eb98",
1080
+ BNB: "#efb90b",
1081
+ ATOM: "#6f7390",
1082
+ XRP: "#23292f",
1083
+ LTC: "#16182e",
1084
+ OP: "#ff0421",
1085
+ DOT: "#e6007a",
1086
+ tBTC: "#000000",
1087
+ TEST: "#2d3ed7",
1088
+ SHIB: "#f00601",
1089
+ STX: "#eb6230",
1090
+ ORDI: "#000000",
1091
+ MATIC: "#6f41d8",
1092
+ EIGEN: "#1A0C6D",
1093
+ SATS: "#F7931A",
1094
+ default: "#6062a6",
1095
+ };
1096
+ export const TOKENS_MAP = {};
1097
+ export const V1_TOKENS = {};
1098
+ export const V2_TOKENS = {};
1099
+ export const SYNTHETIC_TOKENS = {};
1100
+ export const TOKENS_BY_SYMBOL_MAP = {};
1101
+ export const WRAPPED_TOKENS_MAP = {};
1102
+ export const NATIVE_TOKENS_MAP = {};
1103
+ const CHAIN_IDS = [ARBITRUM, ARBITRUM_GOERLI, AVALANCHE, AVALANCHE_FUJI];
1104
+ for (let j = 0; j < CHAIN_IDS.length; j++) {
1105
+ const chainId = CHAIN_IDS[j];
1106
+ TOKENS_MAP[chainId] = {};
1107
+ TOKENS_BY_SYMBOL_MAP[chainId] = {};
1108
+ SYNTHETIC_TOKENS[chainId] = [];
1109
+ V1_TOKENS[chainId] = [];
1110
+ V2_TOKENS[chainId] = [];
1111
+ let tokens = TOKENS[chainId];
1112
+ let wrappedTokenAddress;
1113
+ for (let i = 0; i < tokens.length; i++) {
1114
+ const token = tokens[i];
1115
+ TOKENS_MAP[chainId][token.address] = token;
1116
+ TOKENS_BY_SYMBOL_MAP[chainId][token.symbol] = token;
1117
+ if (token.isWrapped) {
1118
+ WRAPPED_TOKENS_MAP[chainId] = token;
1119
+ wrappedTokenAddress = token.address;
1120
+ }
1121
+ if (token.isNative) {
1122
+ NATIVE_TOKENS_MAP[chainId] = token;
1123
+ }
1124
+ if (token.isV1Available && !token.isTempHidden) {
1125
+ V1_TOKENS[chainId].push(token);
1126
+ }
1127
+ if ((!token.isPlatformToken || (token.isPlatformToken && token.isPlatformTradingToken)) && !token.isTempHidden) {
1128
+ V2_TOKENS[chainId].push(token);
1129
+ }
1130
+ if (token.isSynthetic) {
1131
+ SYNTHETIC_TOKENS[chainId].push(token);
1132
+ }
1133
+ }
1134
+ NATIVE_TOKENS_MAP[chainId].wrappedAddress = wrappedTokenAddress;
1135
+ }
1136
+ export function getSyntheticTokens(chainId) {
1137
+ return SYNTHETIC_TOKENS[chainId];
1138
+ }
1139
+ export function getWrappedToken(chainId) {
1140
+ return WRAPPED_TOKENS_MAP[chainId];
1141
+ }
1142
+ export function getNativeToken(chainId) {
1143
+ return NATIVE_TOKENS_MAP[chainId];
1144
+ }
1145
+ export function getTokens(chainId) {
1146
+ return TOKENS[chainId];
1147
+ }
1148
+ export function getV1Tokens(chainId) {
1149
+ return V1_TOKENS[chainId];
1150
+ }
1151
+ export function getV2Tokens(chainId) {
1152
+ return V2_TOKENS[chainId];
1153
+ }
1154
+ export function getTokensMap(chainId) {
1155
+ return TOKENS_MAP[chainId];
1156
+ }
1157
+ export function getWhitelistedV1Tokens(chainId) {
1158
+ return getV1Tokens(chainId);
1159
+ }
1160
+ export function getVisibleV1Tokens(chainId) {
1161
+ return getV1Tokens(chainId).filter((token) => !token.isWrapped);
1162
+ }
1163
+ export function isValidToken(chainId, address) {
1164
+ if (!TOKENS_MAP[chainId]) {
1165
+ throw new Error(`Incorrect chainId ${chainId}`);
1166
+ }
1167
+ return address in TOKENS_MAP[chainId];
1168
+ }
1169
+ export function getToken(chainId, address) {
1170
+ if (!TOKENS_MAP[chainId]) {
1171
+ throw new Error(`Incorrect chainId ${chainId}`);
1172
+ }
1173
+ if (!TOKENS_MAP[chainId][address]) {
1174
+ throw new Error(`Incorrect address "${address}" for chainId ${chainId}`);
1175
+ }
1176
+ return TOKENS_MAP[chainId][address];
1177
+ }
1178
+ export function getTokenBySymbol(chainId, symbol, { isSynthetic, version, symbolType = "symbol", } = {}) {
1179
+ let tokens = Object.values(TOKENS_MAP[chainId]);
1180
+ if (version) {
1181
+ tokens = version === "v1" ? getV1Tokens(chainId) : getV2Tokens(chainId);
1182
+ }
1183
+ let token;
1184
+ if (isSynthetic !== undefined) {
1185
+ token = tokens.find((token) => {
1186
+ return token[symbolType]?.toLowerCase() === symbol.toLowerCase() && Boolean(token.isSynthetic) === isSynthetic;
1187
+ });
1188
+ }
1189
+ else {
1190
+ if (symbolType === "symbol" && TOKENS_BY_SYMBOL_MAP[chainId][symbol]) {
1191
+ token = TOKENS_BY_SYMBOL_MAP[chainId][symbol];
1192
+ }
1193
+ else {
1194
+ token = tokens.find((token) => token[symbolType]?.toLowerCase() === symbol.toLowerCase());
1195
+ }
1196
+ }
1197
+ if (!token) {
1198
+ throw new Error(`Incorrect symbol "${symbol}" for chainId ${chainId}`);
1199
+ }
1200
+ return token;
1201
+ }
1202
+ export function convertTokenAddress(chainId, address, convertTo) {
1203
+ const wrappedToken = getWrappedToken(chainId);
1204
+ if (convertTo === "wrapped" && address === NATIVE_TOKEN_ADDRESS) {
1205
+ return wrappedToken.address;
1206
+ }
1207
+ if (convertTo === "native" && address === wrappedToken.address) {
1208
+ return NATIVE_TOKEN_ADDRESS;
1209
+ }
1210
+ return address;
1211
+ }
1212
+ export function getNormalizedTokenSymbol(tokenSymbol) {
1213
+ if (["WBTC", "WETH", "WAVAX"].includes(tokenSymbol)) {
1214
+ return tokenSymbol.substr(1);
1215
+ }
1216
+ else if (tokenSymbol.includes(".")) {
1217
+ return tokenSymbol.split(".")[0];
1218
+ }
1219
+ return tokenSymbol;
1220
+ }
1221
+ export function isChartAvailabeForToken(chainId, tokenSymbol) {
1222
+ let token;
1223
+ try {
1224
+ token = getTokenBySymbol(chainId, tokenSymbol);
1225
+ }
1226
+ catch (e) {
1227
+ return false;
1228
+ }
1229
+ if (token.isChartDisabled || (token.isPlatformToken && !token.isPlatformTradingToken))
1230
+ return false;
1231
+ return true;
1232
+ }
1233
+ export function getPriceDecimals(chainId, tokenSymbol) {
1234
+ if (!tokenSymbol)
1235
+ return 2;
1236
+ try {
1237
+ const token = getTokenBySymbol(chainId, tokenSymbol);
1238
+ return token.priceDecimals ?? 2;
1239
+ }
1240
+ catch (e) {
1241
+ return 2;
1242
+ }
1243
+ }
1244
+ export function getTokenBySymbolSafe(chainId, symbol, params = {}) {
1245
+ try {
1246
+ return getTokenBySymbol(chainId, symbol, params);
1247
+ }
1248
+ catch (e) {
1249
+ return;
1250
+ }
1251
+ }
1252
+ export function isTokenInList(token, tokenList) {
1253
+ return tokenList.some((t) => t.address === token.address);
1254
+ }
1255
+ export function isSimilarToken(tokenA, tokenB) {
1256
+ if (tokenA.address === tokenB.address) {
1257
+ return true;
1258
+ }
1259
+ if (tokenA.symbol === tokenB.symbol || tokenA.baseSymbol === tokenB.symbol || tokenA.symbol === tokenB.baseSymbol) {
1260
+ return true;
1261
+ }
1262
+ return false;
1263
+ }
1264
+ export const createTokensMap = (tokens) => {
1265
+ return tokens.reduce((acc, token) => {
1266
+ acc[token.address] = token;
1267
+ return acc;
1268
+ }, {});
1269
+ };