@gmx-io/sdk 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/src/abis/ArbitrumNodeInterface.json +105 -0
- package/build/cjs/src/abis/CustomErrors.json +613 -16
- package/build/cjs/src/abis/ERC20PermitInterface.json +118 -0
- package/build/cjs/src/abis/GelatoRelayRouter.json +1426 -0
- package/build/cjs/src/abis/RelayParams.json +110 -0
- package/build/cjs/src/abis/SubaccountApproval.json +17 -0
- package/build/cjs/src/abis/SubaccountGelatoRelayRouter.json +1885 -0
- package/build/cjs/src/abis/SyntheticsReader.json +1 -131
- package/build/cjs/src/abis/__tests__/abis.spec.js +40 -0
- package/build/cjs/src/abis/index.js +8 -0
- package/build/cjs/src/configs/__tests__/permits.spec.js +109 -0
- package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -1
- package/build/cjs/src/configs/chains.js +36 -5
- package/build/cjs/src/configs/contracts.js +15 -3
- package/build/cjs/src/configs/dataStore.js +26 -4
- package/build/cjs/src/configs/express.js +35 -0
- package/build/cjs/src/configs/factors.js +4 -3
- package/build/cjs/src/configs/markets.js +28 -0
- package/build/cjs/src/configs/tokens.js +90 -0
- package/build/cjs/src/configs/twap.js +10 -0
- package/build/cjs/src/index.js +3 -3
- package/build/cjs/src/modules/markets/index.js +1 -0
- package/build/cjs/src/modules/markets/query-builders.js +4 -0
- package/build/cjs/src/modules/orders/helpers.js +2 -0
- package/build/cjs/src/modules/utils/utils.js +11 -1
- package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +32 -0
- package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +323 -0
- package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +60 -0
- package/build/cjs/src/test/mock.js +30 -1
- package/build/cjs/src/types/twap.js +2 -0
- package/build/cjs/src/utils/__tests__/numbers.spec.js +217 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/batchUtils.spec.js +241 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +595 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +296 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/externalCalls.spec.js +118 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +762 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +469 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/updateOrder.spec.js +80 -0
- package/build/cjs/src/utils/__tests__/parseError.spec.js +263 -0
- package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +45 -0
- package/build/cjs/src/utils/bigmath.js +3 -0
- package/build/cjs/src/utils/callContract.js +2 -2
- package/build/cjs/src/utils/errors/index.js +18 -0
- package/build/cjs/src/utils/errors/parseError.js +150 -0
- package/build/cjs/src/utils/{contracts.js → errors/transactionsErrors.js} +35 -3
- package/build/cjs/src/utils/fees/executionFee.js +52 -1
- package/build/cjs/src/utils/fees/index.js +8 -4
- package/build/cjs/src/utils/gelatoRelay.js +5 -0
- package/build/cjs/src/utils/hash.js +6 -1
- package/build/cjs/src/utils/marketKeysAndConfigs.js +4 -0
- package/build/cjs/src/utils/markets.js +5 -1
- package/build/cjs/src/utils/numbers.js +559 -5
- package/build/cjs/src/utils/orderTransactions.js +638 -0
- package/build/cjs/src/utils/orders.js +7 -1
- package/build/cjs/src/utils/simulateExecuteOrder.js +6 -2
- package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +11 -6
- package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +4 -4
- package/build/cjs/src/utils/swap/__tests__/swapStats.spec.js +9 -0
- package/build/cjs/src/utils/swap/swapPath.js +30 -13
- package/build/cjs/src/utils/swap/swapRouting.js +4 -2
- package/build/cjs/src/utils/swap/swapStats.js +6 -5
- package/build/cjs/src/utils/testUtil.js +1 -1
- package/build/cjs/src/utils/time.js +30 -0
- package/build/cjs/src/utils/tokens.js +16 -2
- package/build/cjs/src/utils/twap/index.js +53 -0
- package/build/cjs/src/utils/twap/uiFeeReceiver.js +31 -0
- package/build/cjs/src/utils/types.js +13 -0
- package/build/esm/src/abis/ArbitrumNodeInterface.json +105 -0
- package/build/esm/src/abis/CustomErrors.json +613 -16
- package/build/esm/src/abis/ERC20PermitInterface.json +118 -0
- package/build/esm/src/abis/GelatoRelayRouter.json +1426 -0
- package/build/esm/src/abis/RelayParams.json +110 -0
- package/build/esm/src/abis/SubaccountApproval.json +17 -0
- package/build/esm/src/abis/SubaccountGelatoRelayRouter.json +1885 -0
- package/build/esm/src/abis/SyntheticsReader.json +1 -131
- package/build/esm/src/abis/__tests__/abis.spec.js +35 -0
- package/build/esm/src/abis/index.js +8 -0
- package/build/esm/src/configs/__tests__/permits.spec.js +107 -0
- package/build/esm/src/configs/__tests__/tokens.spec.js +3 -3
- package/build/esm/src/configs/chains.js +33 -3
- package/build/esm/src/configs/contracts.js +15 -3
- package/build/esm/src/configs/dataStore.js +19 -1
- package/build/esm/src/configs/express.js +29 -0
- package/build/esm/src/configs/factors.js +1 -3
- package/build/esm/src/configs/markets.js +28 -0
- package/build/esm/src/configs/tokens.js +90 -0
- package/build/esm/src/configs/twap.js +7 -0
- package/build/esm/src/index.js +4 -4
- package/build/esm/src/modules/markets/index.js +1 -0
- package/build/esm/src/modules/markets/query-builders.js +4 -0
- package/build/esm/src/modules/orders/helpers.js +2 -0
- package/build/esm/src/modules/utils/utils.js +13 -3
- package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +32 -0
- package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +323 -0
- package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +60 -0
- package/build/esm/src/test/mock.js +28 -0
- package/build/esm/src/types/twap.js +1 -0
- package/build/esm/src/utils/__tests__/numbers.spec.js +219 -2
- package/build/esm/src/utils/__tests__/orderTransactions/batchUtils.spec.js +239 -0
- package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +593 -0
- package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +294 -0
- package/build/esm/src/utils/__tests__/orderTransactions/externalCalls.spec.js +116 -0
- package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +760 -0
- package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +467 -0
- package/build/esm/src/utils/__tests__/orderTransactions/updateOrder.spec.js +78 -0
- package/build/esm/src/utils/__tests__/parseError.spec.js +261 -0
- package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +43 -0
- package/build/esm/src/utils/bigmath.js +3 -0
- package/build/esm/src/utils/callContract.js +3 -3
- package/build/esm/src/utils/errors/index.js +2 -0
- package/build/esm/src/utils/errors/parseError.js +141 -0
- package/build/esm/src/utils/{contracts.js → errors/transactionsErrors.js} +30 -1
- package/build/esm/src/utils/fees/executionFee.js +48 -1
- package/build/esm/src/utils/fees/index.js +8 -4
- package/build/esm/src/utils/gelatoRelay.js +2 -0
- package/build/esm/src/utils/hash.js +5 -1
- package/build/esm/src/utils/marketKeysAndConfigs.js +5 -1
- package/build/esm/src/utils/markets.js +3 -0
- package/build/esm/src/utils/numbers.js +516 -1
- package/build/esm/src/utils/orderTransactions.js +607 -0
- package/build/esm/src/utils/orders.js +5 -0
- package/build/esm/src/utils/simulateExecuteOrder.js +6 -2
- package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +11 -6
- package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +4 -4
- package/build/esm/src/utils/swap/__tests__/swapStats.spec.js +9 -0
- package/build/esm/src/utils/swap/swapPath.js +30 -13
- package/build/esm/src/utils/swap/swapRouting.js +4 -2
- package/build/esm/src/utils/swap/swapStats.js +6 -5
- package/build/esm/src/utils/testUtil.js +2 -2
- package/build/esm/src/utils/time.js +23 -0
- package/build/esm/src/utils/tokens.js +14 -1
- package/build/esm/src/utils/twap/index.js +44 -0
- package/build/esm/src/utils/twap/uiFeeReceiver.js +24 -0
- package/build/esm/src/utils/types.js +8 -0
- package/build/types/src/abis/__tests__/abis.spec.d.ts +1 -0
- package/build/types/src/abis/index.d.ts +1 -1
- package/build/types/src/configs/__tests__/permits.spec.d.ts +1 -0
- package/build/types/src/configs/chains.d.ts +29 -1
- package/build/types/src/configs/contracts.d.ts +238 -1
- package/build/types/src/configs/dataStore.d.ts +10 -0
- package/build/types/src/configs/express.d.ts +12 -0
- package/build/types/src/configs/factors.d.ts +1 -3
- package/build/types/src/configs/tokens.d.ts +2 -2
- package/build/types/src/configs/twap.d.ts +7 -0
- package/build/types/src/modules/markets/query-builders.d.ts +1 -1
- package/build/types/src/modules/markets/types.d.ts +2 -2
- package/build/types/src/modules/orders/transactions/createIncreaseOrderTxn.d.ts +1 -1
- package/build/types/src/test/mock.d.ts +16 -1
- package/build/types/src/types/fees.d.ts +9 -0
- package/build/types/src/types/markets.d.ts +1 -0
- package/build/types/src/types/orders.d.ts +3 -0
- package/build/types/src/types/tokens.d.ts +27 -0
- package/build/types/src/types/trade.d.ts +2 -19
- package/build/types/src/types/twap.d.ts +11 -0
- package/build/types/src/utils/__tests__/orderTransactions/batchUtils.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/decreaseOrders.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/externalCalls.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/increaseOrders.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/swapOrders.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/orderTransactions/updateOrder.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/parseError.spec.d.ts +1 -0
- package/build/types/src/utils/__tests__/uiFeeReceiver.spec.d.ts +1 -0
- package/build/types/src/utils/bigmath.d.ts +1 -0
- package/build/types/src/utils/errors/index.d.ts +2 -0
- package/build/types/src/utils/errors/parseError.d.ts +50 -0
- package/build/types/src/utils/errors/transactionsErrors.d.ts +34 -0
- package/build/types/src/utils/fees/executionFee.d.ts +35 -2
- package/build/types/src/utils/fees/index.d.ts +1 -1
- package/build/types/src/utils/gelatoRelay.d.ts +2 -0
- package/build/types/src/utils/hash.d.ts +2 -0
- package/build/types/src/utils/marketKeysAndConfigs.d.ts +1 -0
- package/build/types/src/utils/markets.d.ts +1 -0
- package/build/types/src/utils/numbers.d.ts +110 -1
- package/build/types/src/utils/orderTransactions.d.ts +231 -0
- package/build/types/src/utils/orders.d.ts +2 -1
- package/build/types/src/utils/simulateExecuteOrder.d.ts +4 -0
- package/build/types/src/utils/swap/swapPath.d.ts +5 -5
- package/build/types/src/utils/swap/swapRouting.d.ts +2 -2
- package/build/types/src/utils/swap/swapStats.d.ts +2 -0
- package/build/types/src/utils/time.d.ts +14 -0
- package/build/types/src/utils/tokens.d.ts +6 -5
- package/build/types/src/utils/twap/index.d.ts +17 -0
- package/build/types/src/utils/twap/uiFeeReceiver.d.ts +9 -0
- package/build/types/src/utils/types.d.ts +5 -0
- package/package.json +3 -1
- package/build/types/src/utils/contracts.d.ts +0 -19
|
@@ -29,6 +29,8 @@ exports.TOKENS = {
|
|
|
29
29
|
imageUrl: "https://assets.coingecko.com/coins/images/2518/thumb/weth.png?1628852295",
|
|
30
30
|
coingeckoUrl: "https://www.coingecko.com/en/coins/ethereum",
|
|
31
31
|
isV1Available: true,
|
|
32
|
+
isPermitSupported: true,
|
|
33
|
+
contractVersion: "1",
|
|
32
34
|
},
|
|
33
35
|
{
|
|
34
36
|
name: "Wrapped Bitcoin",
|
|
@@ -43,6 +45,8 @@ exports.TOKENS = {
|
|
|
43
45
|
coingeckoUrl: "https://www.coingecko.com/en/coins/wrapped-bitcoin",
|
|
44
46
|
explorerUrl: "https://arbiscan.io/address/0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
|
|
45
47
|
isV1Available: true,
|
|
48
|
+
isPermitSupported: true,
|
|
49
|
+
contractVersion: "1",
|
|
46
50
|
},
|
|
47
51
|
{
|
|
48
52
|
name: "Arbitrum",
|
|
@@ -54,6 +58,8 @@ exports.TOKENS = {
|
|
|
54
58
|
imageUrl: "https://assets.coingecko.com/coins/images/16547/small/photo_2023-03-29_21.47.00.jpeg?1680097630",
|
|
55
59
|
coingeckoUrl: "https://www.coingecko.com/en/coins/arbitrum",
|
|
56
60
|
explorerUrl: "https://arbiscan.io/token/0x912ce59144191c1204e64559fe8253a0e49e6548",
|
|
61
|
+
isPermitSupported: true,
|
|
62
|
+
contractVersion: "1",
|
|
57
63
|
},
|
|
58
64
|
{
|
|
59
65
|
name: "Wrapped SOL (Wormhole)",
|
|
@@ -68,6 +74,9 @@ exports.TOKENS = {
|
|
|
68
74
|
coingeckoSymbol: "SOL",
|
|
69
75
|
explorerUrl: "https://arbiscan.io/token/0x2bCc6D6CdBbDC0a4071e48bb3B969b06B3330c07",
|
|
70
76
|
explorerSymbol: "SOL",
|
|
77
|
+
isPermitSupported: true,
|
|
78
|
+
isPermitDisabled: true,
|
|
79
|
+
contractVersion: "1",
|
|
71
80
|
},
|
|
72
81
|
{
|
|
73
82
|
name: "Chainlink",
|
|
@@ -82,6 +91,8 @@ exports.TOKENS = {
|
|
|
82
91
|
coingeckoUrl: "https://www.coingecko.com/en/coins/chainlink",
|
|
83
92
|
explorerUrl: "https://arbiscan.io/token/0xf97f4df75117a78c1a5a0dbb814af92458539fb4",
|
|
84
93
|
isV1Available: true,
|
|
94
|
+
isPermitSupported: true,
|
|
95
|
+
contractVersion: "1",
|
|
85
96
|
},
|
|
86
97
|
{
|
|
87
98
|
name: "Uniswap",
|
|
@@ -96,6 +107,8 @@ exports.TOKENS = {
|
|
|
96
107
|
coingeckoUrl: "https://www.coingecko.com/en/coins/uniswap",
|
|
97
108
|
explorerUrl: "https://arbiscan.io/token/0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0",
|
|
98
109
|
isV1Available: true,
|
|
110
|
+
isPermitSupported: true,
|
|
111
|
+
contractVersion: "1",
|
|
99
112
|
},
|
|
100
113
|
{
|
|
101
114
|
name: "Bridged USDC (USDC.e)",
|
|
@@ -107,6 +120,8 @@ exports.TOKENS = {
|
|
|
107
120
|
coingeckoUrl: "https://www.coingecko.com/en/coins/bridged-usdc-arbitrum",
|
|
108
121
|
explorerUrl: "https://arbiscan.io/token/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
|
|
109
122
|
isV1Available: true,
|
|
123
|
+
isPermitSupported: true,
|
|
124
|
+
contractVersion: "1",
|
|
110
125
|
},
|
|
111
126
|
{
|
|
112
127
|
name: "USD Coin",
|
|
@@ -118,6 +133,7 @@ exports.TOKENS = {
|
|
|
118
133
|
imageUrl: "https://assets.coingecko.com/coins/images/6319/thumb/USD_Coin_icon.png?1547042389",
|
|
119
134
|
coingeckoUrl: "https://www.coingecko.com/en/coins/usd-coin",
|
|
120
135
|
explorerUrl: "https://arbiscan.io/address/0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
136
|
+
isPermitSupported: true,
|
|
121
137
|
},
|
|
122
138
|
{
|
|
123
139
|
name: "Tether",
|
|
@@ -129,6 +145,8 @@ exports.TOKENS = {
|
|
|
129
145
|
explorerUrl: "https://arbiscan.io/address/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
|
|
130
146
|
coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
|
|
131
147
|
isV1Available: true,
|
|
148
|
+
isPermitSupported: true,
|
|
149
|
+
contractVersion: "1",
|
|
132
150
|
},
|
|
133
151
|
{
|
|
134
152
|
name: "Dai",
|
|
@@ -140,6 +158,7 @@ exports.TOKENS = {
|
|
|
140
158
|
coingeckoUrl: "https://www.coingecko.com/en/coins/dai",
|
|
141
159
|
explorerUrl: "https://arbiscan.io/token/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
|
|
142
160
|
isV1Available: true,
|
|
161
|
+
isPermitSupported: true,
|
|
143
162
|
},
|
|
144
163
|
{
|
|
145
164
|
name: "Frax",
|
|
@@ -151,6 +170,8 @@ exports.TOKENS = {
|
|
|
151
170
|
coingeckoUrl: "https://www.coingecko.com/en/coins/frax",
|
|
152
171
|
explorerUrl: "https://arbiscan.io/token/0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F",
|
|
153
172
|
isV1Available: true,
|
|
173
|
+
isPermitSupported: true,
|
|
174
|
+
contractVersion: "1",
|
|
154
175
|
},
|
|
155
176
|
{
|
|
156
177
|
name: "Magic Internet Money",
|
|
@@ -161,6 +182,7 @@ exports.TOKENS = {
|
|
|
161
182
|
isTempHidden: true,
|
|
162
183
|
imageUrl: "https://assets.coingecko.com/coins/images/16786/small/mimlogopng.png",
|
|
163
184
|
isV1Available: true,
|
|
185
|
+
isPermitSupported: true,
|
|
164
186
|
},
|
|
165
187
|
{
|
|
166
188
|
name: "Bitcoin",
|
|
@@ -171,6 +193,7 @@ exports.TOKENS = {
|
|
|
171
193
|
categories: ["layer1"],
|
|
172
194
|
imageUrl: "https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579",
|
|
173
195
|
coingeckoUrl: "https://www.coingecko.com/en/coins/bitcoin",
|
|
196
|
+
isPermitSupported: true,
|
|
174
197
|
},
|
|
175
198
|
{
|
|
176
199
|
name: "Dogecoin",
|
|
@@ -275,6 +298,8 @@ exports.TOKENS = {
|
|
|
275
298
|
imageUrl: "https://assets.coingecko.com/coins/images/12645/standard/AAVE.png?1696512452",
|
|
276
299
|
coingeckoUrl: "https://www.coingecko.com/en/coins/aave",
|
|
277
300
|
coingeckoSymbol: "AAVE",
|
|
301
|
+
isPermitSupported: true,
|
|
302
|
+
contractVersion: "1",
|
|
278
303
|
},
|
|
279
304
|
{
|
|
280
305
|
name: "Wrapped AVAX (Wormhole)",
|
|
@@ -288,6 +313,9 @@ exports.TOKENS = {
|
|
|
288
313
|
coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
|
|
289
314
|
coingeckoSymbol: "AVAX",
|
|
290
315
|
explorerSymbol: "WAVAX",
|
|
316
|
+
isPermitSupported: true,
|
|
317
|
+
isPermitDisabled: true,
|
|
318
|
+
contractVersion: "1",
|
|
291
319
|
},
|
|
292
320
|
{
|
|
293
321
|
name: "Optimism",
|
|
@@ -319,6 +347,9 @@ exports.TOKENS = {
|
|
|
319
347
|
categories: ["meme"],
|
|
320
348
|
imageUrl: "https://assets.coingecko.com/coins/images/33566/standard/dogwifhat.jpg?1702499428",
|
|
321
349
|
coingeckoUrl: "https://www.coingecko.com/en/coins/dogwifhat",
|
|
350
|
+
isPermitSupported: true,
|
|
351
|
+
isPermitDisabled: true,
|
|
352
|
+
contractVersion: "1",
|
|
322
353
|
},
|
|
323
354
|
{
|
|
324
355
|
name: "ORDI",
|
|
@@ -378,6 +409,8 @@ exports.TOKENS = {
|
|
|
378
409
|
decimals: 18,
|
|
379
410
|
imageUrl: "https://assets.coingecko.com/coins/images/11224/standard/0x18084fba666a33d37592fa2633fd49a74dd93a88.png?1696511155",
|
|
380
411
|
coingeckoUrl: "https://www.coingecko.com/en/coins/tbtc",
|
|
412
|
+
isPermitSupported: true,
|
|
413
|
+
contractVersion: "1",
|
|
381
414
|
},
|
|
382
415
|
{
|
|
383
416
|
name: "Eigen",
|
|
@@ -387,6 +420,8 @@ exports.TOKENS = {
|
|
|
387
420
|
categories: ["layer2"],
|
|
388
421
|
imageUrl: "https://assets.coingecko.com/coins/images/37441/standard/eigen.jpg?1728023974",
|
|
389
422
|
coingeckoUrl: "https://www.coingecko.com/en/coins/eigenlayer",
|
|
423
|
+
isPermitSupported: true,
|
|
424
|
+
contractVersion: "1",
|
|
390
425
|
},
|
|
391
426
|
{
|
|
392
427
|
name: "Sats",
|
|
@@ -574,6 +609,9 @@ exports.TOKENS = {
|
|
|
574
609
|
categories: ["defi"],
|
|
575
610
|
imageUrl: "https://assets.coingecko.com/coins/images/15069/standard/Pendle_Logo_Normal-03.png?1696514728",
|
|
576
611
|
coingeckoUrl: "https://www.coingecko.com/en/coins/pendle",
|
|
612
|
+
isPermitSupported: true,
|
|
613
|
+
isPermitDisabled: true,
|
|
614
|
+
contractVersion: "1",
|
|
577
615
|
},
|
|
578
616
|
{
|
|
579
617
|
name: "ADA",
|
|
@@ -901,6 +939,46 @@ exports.TOKENS = {
|
|
|
901
939
|
coingeckoUrl: "https://www.coingecko.com/en/coins/layerzero",
|
|
902
940
|
isSynthetic: true,
|
|
903
941
|
},
|
|
942
|
+
{
|
|
943
|
+
name: "Moodeng",
|
|
944
|
+
symbol: "MOODENG",
|
|
945
|
+
address: "0xd3898c6570974AEca38a8ACf22fd60739e528A99",
|
|
946
|
+
decimals: 6,
|
|
947
|
+
isSynthetic: true,
|
|
948
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/moo-deng",
|
|
949
|
+
imageUrl: "https://assets.coingecko.com/coins/images/50264/standard/MOODENG.jpg?1726726975",
|
|
950
|
+
categories: ["meme"],
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
name: "Monero",
|
|
954
|
+
symbol: "XMR",
|
|
955
|
+
address: "0x13674172E6E44D31d4bE489d5184f3457c40153A",
|
|
956
|
+
decimals: 12,
|
|
957
|
+
isSynthetic: true,
|
|
958
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/monero",
|
|
959
|
+
imageUrl: "https://assets.coingecko.com/coins/images/69/standard/monero_logo.png?1696501460",
|
|
960
|
+
categories: ["layer1", "defi"],
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
name: "Pi Network",
|
|
964
|
+
symbol: "PI",
|
|
965
|
+
address: "0xd1738d37401a0A71f7E382d2cFeCD3ab69687017",
|
|
966
|
+
decimals: 18,
|
|
967
|
+
isSynthetic: true,
|
|
968
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/pi-network",
|
|
969
|
+
imageUrl: "https://assets.coingecko.com/coins/images/54342/standard/pi_network.jpg?1739347576",
|
|
970
|
+
categories: ["layer1"],
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
name: "Curve DAO Token",
|
|
974
|
+
symbol: "CRV",
|
|
975
|
+
address: "0xe5f01aeAcc8288E9838A60016AB00d7b6675900b",
|
|
976
|
+
decimals: 18,
|
|
977
|
+
isSynthetic: true,
|
|
978
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/curve-dao-token",
|
|
979
|
+
imageUrl: "https://assets.coingecko.com/coins/images/12124/standard/Curve.png?1696511967",
|
|
980
|
+
categories: ["defi"],
|
|
981
|
+
},
|
|
904
982
|
{
|
|
905
983
|
name: "GMX LP",
|
|
906
984
|
symbol: "GLP",
|
|
@@ -1005,6 +1083,7 @@ exports.TOKENS = {
|
|
|
1005
1083
|
coingeckoUrl: "https://www.coingecko.com/en/coins/usd-coin",
|
|
1006
1084
|
explorerUrl: "https://snowtrace.io/address/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
1007
1085
|
isV1Available: true,
|
|
1086
|
+
isPermitSupported: true,
|
|
1008
1087
|
},
|
|
1009
1088
|
{
|
|
1010
1089
|
name: "Bridged USDC (USDC.e)",
|
|
@@ -1026,6 +1105,8 @@ exports.TOKENS = {
|
|
|
1026
1105
|
imageUrl: "https://assets.coingecko.com/coins/images/325/small/Tether-logo.png",
|
|
1027
1106
|
coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
|
|
1028
1107
|
explorerUrl: "https://snowtrace.io/address/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
|
|
1108
|
+
isPermitSupported: true,
|
|
1109
|
+
contractVersion: "1",
|
|
1029
1110
|
},
|
|
1030
1111
|
{
|
|
1031
1112
|
name: "Tether",
|
|
@@ -1058,6 +1139,7 @@ exports.TOKENS = {
|
|
|
1058
1139
|
coingeckoUrl: "https://www.coingecko.com/en/coins/magic-internet-money",
|
|
1059
1140
|
explorerUrl: "https://snowtrace.io/address/0x130966628846BFd36ff31a822705796e8cb8C18D",
|
|
1060
1141
|
isV1Available: true,
|
|
1142
|
+
isPermitSupported: true,
|
|
1061
1143
|
},
|
|
1062
1144
|
{
|
|
1063
1145
|
name: "Chainlink",
|
|
@@ -1106,6 +1188,9 @@ exports.TOKENS = {
|
|
|
1106
1188
|
coingeckoUrl: "https://www.coingecko.com/en/coins/solana",
|
|
1107
1189
|
coingeckoSymbol: "SOL",
|
|
1108
1190
|
explorerUrl: "https://snowtrace.io/address/0xFE6B19286885a4F7F55AdAD09C3Cd1f906D2478F",
|
|
1191
|
+
isPermitSupported: true,
|
|
1192
|
+
isPermitDisabled: true,
|
|
1193
|
+
contractVersion: "1",
|
|
1109
1194
|
},
|
|
1110
1195
|
{
|
|
1111
1196
|
name: "XRP",
|
|
@@ -1210,6 +1295,7 @@ exports.TOKENS = {
|
|
|
1210
1295
|
imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
|
|
1211
1296
|
coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
|
|
1212
1297
|
explorerUrl: "https://testnet.snowtrace.io/address/0x1D308089a2D1Ced3f1Ce36B1FcaF815b07217be3",
|
|
1298
|
+
isPermitSupported: true,
|
|
1213
1299
|
},
|
|
1214
1300
|
{
|
|
1215
1301
|
name: "Ethereum (WETH.e)",
|
|
@@ -1533,6 +1619,10 @@ function isValidToken(chainId, address) {
|
|
|
1533
1619
|
}
|
|
1534
1620
|
exports.isValidToken = isValidToken;
|
|
1535
1621
|
function getToken(chainId, address) {
|
|
1622
|
+
// FIXME APE_deprecated token which is not in use but can be displayed
|
|
1623
|
+
if (chainId === chains_1.ARBITRUM && address === "0x74885b4D524d497261259B38900f54e6dbAd2210") {
|
|
1624
|
+
return getTokenBySymbol(chainId, "APE");
|
|
1625
|
+
}
|
|
1536
1626
|
if (!exports.TOKENS_MAP[chainId]) {
|
|
1537
1627
|
throw new Error(`Incorrect chainId ${chainId}`);
|
|
1538
1628
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_TWAP_DURATION = exports.MAX_TWAP_NUMBER_OF_PARTS = exports.MIN_TWAP_NUMBER_OF_PARTS = exports.DEFAULT_TWAP_NUMBER_OF_PARTS = void 0;
|
|
4
|
+
exports.DEFAULT_TWAP_NUMBER_OF_PARTS = 5;
|
|
5
|
+
exports.MIN_TWAP_NUMBER_OF_PARTS = 2;
|
|
6
|
+
exports.MAX_TWAP_NUMBER_OF_PARTS = 30;
|
|
7
|
+
exports.DEFAULT_TWAP_DURATION = {
|
|
8
|
+
minutes: 0,
|
|
9
|
+
hours: 10,
|
|
10
|
+
};
|
package/build/cjs/src/index.js
CHANGED
|
@@ -37,13 +37,13 @@ class GmxSdk {
|
|
|
37
37
|
}),
|
|
38
38
|
pollingInterval: undefined,
|
|
39
39
|
batch: batch_1.BATCH_CONFIGS[this.config.chainId].client,
|
|
40
|
-
chain: (0, chains_1.
|
|
40
|
+
chain: (0, chains_1.getViemChain)(this.config.chainId),
|
|
41
41
|
});
|
|
42
42
|
this.walletClient =
|
|
43
43
|
config.walletClient ??
|
|
44
44
|
(0, viem_1.createWalletClient)({
|
|
45
45
|
account: config.account,
|
|
46
|
-
chain: (0, chains_1.
|
|
46
|
+
chain: (0, chains_1.getViemChain)(config.chainId),
|
|
47
47
|
transport: (0, viem_1.http)(config.rpcUrl, {
|
|
48
48
|
retryCount: 0,
|
|
49
49
|
retryDelay: 10000000,
|
|
@@ -66,7 +66,7 @@ class GmxSdk {
|
|
|
66
66
|
return this.config.chainId;
|
|
67
67
|
}
|
|
68
68
|
get chain() {
|
|
69
|
-
return (0, chains_1.
|
|
69
|
+
return (0, chains_1.getViemChain)(this.chainId);
|
|
70
70
|
}
|
|
71
71
|
get account() {
|
|
72
72
|
return this.config.account;
|
|
@@ -169,6 +169,7 @@ class Markets extends base_1.Module {
|
|
|
169
169
|
swapFeeFactorForPositiveImpact: dataStoreValues.swapFeeFactorForPositiveImpact.returnValues[0],
|
|
170
170
|
swapFeeFactorForNegativeImpact: dataStoreValues.swapFeeFactorForNegativeImpact.returnValues[0],
|
|
171
171
|
swapImpactFactorPositive: dataStoreValues.swapImpactFactorPositive.returnValues[0],
|
|
172
|
+
atomicSwapFeeFactor: dataStoreValues.atomicSwapFeeFactor.returnValues[0],
|
|
172
173
|
swapImpactFactorNegative: dataStoreValues.swapImpactFactorNegative.returnValues[0],
|
|
173
174
|
swapImpactExponentFactor: dataStoreValues.swapImpactExponentFactor.returnValues[0],
|
|
174
175
|
virtualMarketId: dataStoreValues.virtualMarketId.returnValues[0],
|
|
@@ -358,6 +358,10 @@ async function buildMarketsConfigsRequest(chainId, { marketsData, marketsAddress
|
|
|
358
358
|
methodName: "getUint",
|
|
359
359
|
params: [prebuiltHashedKeys.swapFeeFactorForNegativeImpact],
|
|
360
360
|
},
|
|
361
|
+
atomicSwapFeeFactor: {
|
|
362
|
+
methodName: "getUint",
|
|
363
|
+
params: [prebuiltHashedKeys.atomicSwapFeeFactor],
|
|
364
|
+
},
|
|
361
365
|
swapImpactFactorPositive: {
|
|
362
366
|
methodName: "getUint",
|
|
363
367
|
params: [prebuiltHashedKeys.swapImpactFactorPositive],
|
|
@@ -79,6 +79,7 @@ async function increaseOrderHelper(sdk, params) {
|
|
|
79
79
|
gasPrice,
|
|
80
80
|
tokensData,
|
|
81
81
|
},
|
|
82
|
+
isExpressFeeSwap: false,
|
|
82
83
|
});
|
|
83
84
|
const payOrSizeAmount = "payAmount" in params ? params.payAmount : params.sizeAmount;
|
|
84
85
|
const increaseAmounts = (0, amounts_1.getIncreasePositionAmounts)({
|
|
@@ -165,6 +166,7 @@ async function swap(sdk, params) {
|
|
|
165
166
|
gasPrice,
|
|
166
167
|
tokensData,
|
|
167
168
|
},
|
|
169
|
+
isExpressFeeSwap: false,
|
|
168
170
|
});
|
|
169
171
|
const isWrapOrUnwrap = Boolean(fromToken && toToken && ((0, tokens_1.getIsWrap)(fromToken, toToken) || (0, tokens_1.getIsUnwrap)(fromToken, toToken)));
|
|
170
172
|
const swapOptimizationOrder = isLimit ? ["length", "liquidity"] : undefined;
|
|
@@ -79,6 +79,10 @@ class Utils extends base_1.Module {
|
|
|
79
79
|
methodName: "getUint",
|
|
80
80
|
params: [dataStore_1.GLV_PER_MARKET_GAS_LIMIT],
|
|
81
81
|
},
|
|
82
|
+
gelatoRelayFeeMultiplierFactor: {
|
|
83
|
+
methodName: "getUint",
|
|
84
|
+
params: [dataStore_1.GELATO_RELAY_FEE_MULTIPLIER_FACTOR_KEY],
|
|
85
|
+
},
|
|
82
86
|
},
|
|
83
87
|
},
|
|
84
88
|
})
|
|
@@ -87,6 +91,7 @@ class Utils extends base_1.Module {
|
|
|
87
91
|
function getBigInt(key) {
|
|
88
92
|
return BigInt(results[key].returnValues[0]);
|
|
89
93
|
}
|
|
94
|
+
const staticGasLimits = chains_1.GAS_LIMITS_STATIC_CONFIG[this.chainId];
|
|
90
95
|
return {
|
|
91
96
|
depositToken: getBigInt("depositToken"),
|
|
92
97
|
withdrawalMultiToken: getBigInt("withdrawalMultiToken"),
|
|
@@ -101,6 +106,11 @@ class Utils extends base_1.Module {
|
|
|
101
106
|
glvDepositGasLimit: getBigInt("glvDepositGasLimit"),
|
|
102
107
|
glvWithdrawalGasLimit: getBigInt("glvWithdrawalGasLimit"),
|
|
103
108
|
glvPerMarketGasLimit: getBigInt("glvPerMarketGasLimit"),
|
|
109
|
+
createOrderGasLimit: staticGasLimits.createOrderGasLimit,
|
|
110
|
+
updateOrderGasLimit: staticGasLimits.updateOrderGasLimit,
|
|
111
|
+
cancelOrderGasLimit: staticGasLimits.cancelOrderGasLimit,
|
|
112
|
+
tokenPermitGasLimit: staticGasLimits.tokenPermitGasLimit,
|
|
113
|
+
gelatoRelayFeeMultiplierFactor: getBigInt("gelatoRelayFeeMultiplierFactor"),
|
|
104
114
|
};
|
|
105
115
|
});
|
|
106
116
|
this._gasLimits = gasLimits;
|
|
@@ -166,7 +176,7 @@ class Utils extends base_1.Module {
|
|
|
166
176
|
async getGasPrice() {
|
|
167
177
|
const executionFeeConfig = chains_1.EXECUTION_FEE_CONFIG_V2[this.chainId];
|
|
168
178
|
const feeData = await (0, viem_1.withRetry)(() => this.sdk.publicClient.estimateFeesPerGas({
|
|
169
|
-
chain: (0, chains_1.
|
|
179
|
+
chain: (0, chains_1.getViemChain)(this.chainId),
|
|
170
180
|
type: "legacy",
|
|
171
181
|
}), {
|
|
172
182
|
retryCount: 2,
|
|
@@ -663,6 +663,38 @@
|
|
|
663
663
|
"baseBorrowingFactorShort": "0x208583f32d8a947ce802ada215547db39c83f47b79694bab2a8553af1b011676",
|
|
664
664
|
"aboveOptimalUsageBorrowingFactorLong": "0x0dd5d847eb76fc4986137f91d409d500b8e9a3e05d0b721e902ed4fe6a42f0d4",
|
|
665
665
|
"aboveOptimalUsageBorrowingFactorShort": "0xa77bd37d33247f0d86c482b48208711317ee68817a21fc2976bb3e54f2265579"
|
|
666
|
+
},
|
|
667
|
+
"0x0e46941F9bfF8d0784BFfa3d0D7883CDb82D7aE7": {
|
|
668
|
+
"optimalUsageFactorLong": "0x4c401d404a1c1269fb6aa7928ceb1935a9a6f4de7c7e64f214b8a266a662ce30",
|
|
669
|
+
"optimalUsageFactorShort": "0xa230801e8b702d8b0e96c43f1f55a8b59290c4f8c279f1b7857dd05c580ce343",
|
|
670
|
+
"baseBorrowingFactorLong": "0x5e5b2f3c0a995b771355f55d7717305c072e7e9590dfbd3974c16abfb106f264",
|
|
671
|
+
"baseBorrowingFactorShort": "0x4e83186068e01b7963bf06a1db46129a3fc52c0aa2a6cede0f4f7e1cea418635",
|
|
672
|
+
"aboveOptimalUsageBorrowingFactorLong": "0x20a3640f97b96b9c0822d0dc61ee226a8334e7a5b24626b9a7502097af05a326",
|
|
673
|
+
"aboveOptimalUsageBorrowingFactorShort": "0x85ef58093c6eaed2811bc1bea92f4a159585f0b24ac6c4346d7d2df8022367b7"
|
|
674
|
+
},
|
|
675
|
+
"0x2523B89298908FEf4c5e5bd6F55F20926e22058f": {
|
|
676
|
+
"optimalUsageFactorLong": "0xa2f32b1482558e0e227f8710d0d95e3109d262f1c202c36290eb7f237196378d",
|
|
677
|
+
"optimalUsageFactorShort": "0x0bbb61bb560c7a37fa166a538e3bd121d97340e6c337b7b63305e6c970fe003e",
|
|
678
|
+
"baseBorrowingFactorLong": "0x36448e380d2f15c1f9ebb52be2edf1465cd3bc094f51e820c4edb9739911bdfc",
|
|
679
|
+
"baseBorrowingFactorShort": "0x3d10551cad9dcb1162fffb36dddb7a9bf732309b035c390903cb6691c5ed2c41",
|
|
680
|
+
"aboveOptimalUsageBorrowingFactorLong": "0x96c6512b5cf544d92602a6f131b09ce017fa399e19cb1077b5e401ccb288a81d",
|
|
681
|
+
"aboveOptimalUsageBorrowingFactorShort": "0x89006ab4ceebc6145f5520cd195fd1edc44b69eb84a3b6bc106a423954e3adfd"
|
|
682
|
+
},
|
|
683
|
+
"0x7c54D547FAD72f8AFbf6E5b04403A0168b654C6f": {
|
|
684
|
+
"optimalUsageFactorLong": "0xff18362de8f0fda2252bc409478257cebdfa5ec4b871406f7a505da2c7fe1ab8",
|
|
685
|
+
"optimalUsageFactorShort": "0x230f71281e768eebd4331bd719291624e543196517749b8d00dba269ce6be195",
|
|
686
|
+
"baseBorrowingFactorLong": "0xaeef4efa75991b37580a3d0a298c6544ee23646fc1ad2d8c1f1cb423caeaa409",
|
|
687
|
+
"baseBorrowingFactorShort": "0xe286e4d69b63827eefc1434086a543c85f9531c278e55f0603cf9b54e2c19637",
|
|
688
|
+
"aboveOptimalUsageBorrowingFactorLong": "0xb656f322337ee629cf453b0fa72ca684db89f8bdcfff5e333842f6e66f5ebbd8",
|
|
689
|
+
"aboveOptimalUsageBorrowingFactorShort": "0x853644d97900c5164a82701fde817c51a57d31dc222e136c1e2c7d5a948b11fd"
|
|
690
|
+
},
|
|
691
|
+
"0x39AC3C494950A4363D739201BA5A0861265C9ae5": {
|
|
692
|
+
"optimalUsageFactorLong": "0x5be9aa175e2ec6bf9d9508099dc2452f179ea3c74374aaf69b245fadd1fee369",
|
|
693
|
+
"optimalUsageFactorShort": "0xd2708f5731caffd02de0e20b01a2e089c23ae856702baa71dbc8183da6ebfb76",
|
|
694
|
+
"baseBorrowingFactorLong": "0x0a4665f7256edc8fbc4dcb890994df31eeacc8d252f39a90f7f85842eeb81ca2",
|
|
695
|
+
"baseBorrowingFactorShort": "0x9906550d5dc055a64080e0a74a6910eee2bf9e507bf50f7636ae653bc037ba4f",
|
|
696
|
+
"aboveOptimalUsageBorrowingFactorLong": "0x0eaf5f1d2e29a62d716f417ca4c84c379336f25ed6b72efef91b1192674b1cb4",
|
|
697
|
+
"aboveOptimalUsageBorrowingFactorShort": "0x90b85d18260e09eff7f3d7f4a3e907cbf476ff493d792f3f33f5926a68cfe584"
|
|
666
698
|
}
|
|
667
699
|
},
|
|
668
700
|
"43113": {
|