@gmx-io/sdk 1.0.4 → 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/orders/orders.js +4 -3
- 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/orders/orders.js +4 -3
- 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/orders.d.ts +2 -1
- 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
|
@@ -26,6 +26,8 @@ export const TOKENS = {
|
|
|
26
26
|
imageUrl: "https://assets.coingecko.com/coins/images/2518/thumb/weth.png?1628852295",
|
|
27
27
|
coingeckoUrl: "https://www.coingecko.com/en/coins/ethereum",
|
|
28
28
|
isV1Available: true,
|
|
29
|
+
isPermitSupported: true,
|
|
30
|
+
contractVersion: "1",
|
|
29
31
|
},
|
|
30
32
|
{
|
|
31
33
|
name: "Wrapped Bitcoin",
|
|
@@ -40,6 +42,8 @@ export const TOKENS = {
|
|
|
40
42
|
coingeckoUrl: "https://www.coingecko.com/en/coins/wrapped-bitcoin",
|
|
41
43
|
explorerUrl: "https://arbiscan.io/address/0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f",
|
|
42
44
|
isV1Available: true,
|
|
45
|
+
isPermitSupported: true,
|
|
46
|
+
contractVersion: "1",
|
|
43
47
|
},
|
|
44
48
|
{
|
|
45
49
|
name: "Arbitrum",
|
|
@@ -51,6 +55,8 @@ export const TOKENS = {
|
|
|
51
55
|
imageUrl: "https://assets.coingecko.com/coins/images/16547/small/photo_2023-03-29_21.47.00.jpeg?1680097630",
|
|
52
56
|
coingeckoUrl: "https://www.coingecko.com/en/coins/arbitrum",
|
|
53
57
|
explorerUrl: "https://arbiscan.io/token/0x912ce59144191c1204e64559fe8253a0e49e6548",
|
|
58
|
+
isPermitSupported: true,
|
|
59
|
+
contractVersion: "1",
|
|
54
60
|
},
|
|
55
61
|
{
|
|
56
62
|
name: "Wrapped SOL (Wormhole)",
|
|
@@ -65,6 +71,9 @@ export const TOKENS = {
|
|
|
65
71
|
coingeckoSymbol: "SOL",
|
|
66
72
|
explorerUrl: "https://arbiscan.io/token/0x2bCc6D6CdBbDC0a4071e48bb3B969b06B3330c07",
|
|
67
73
|
explorerSymbol: "SOL",
|
|
74
|
+
isPermitSupported: true,
|
|
75
|
+
isPermitDisabled: true,
|
|
76
|
+
contractVersion: "1",
|
|
68
77
|
},
|
|
69
78
|
{
|
|
70
79
|
name: "Chainlink",
|
|
@@ -79,6 +88,8 @@ export const TOKENS = {
|
|
|
79
88
|
coingeckoUrl: "https://www.coingecko.com/en/coins/chainlink",
|
|
80
89
|
explorerUrl: "https://arbiscan.io/token/0xf97f4df75117a78c1a5a0dbb814af92458539fb4",
|
|
81
90
|
isV1Available: true,
|
|
91
|
+
isPermitSupported: true,
|
|
92
|
+
contractVersion: "1",
|
|
82
93
|
},
|
|
83
94
|
{
|
|
84
95
|
name: "Uniswap",
|
|
@@ -93,6 +104,8 @@ export const TOKENS = {
|
|
|
93
104
|
coingeckoUrl: "https://www.coingecko.com/en/coins/uniswap",
|
|
94
105
|
explorerUrl: "https://arbiscan.io/token/0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0",
|
|
95
106
|
isV1Available: true,
|
|
107
|
+
isPermitSupported: true,
|
|
108
|
+
contractVersion: "1",
|
|
96
109
|
},
|
|
97
110
|
{
|
|
98
111
|
name: "Bridged USDC (USDC.e)",
|
|
@@ -104,6 +117,8 @@ export const TOKENS = {
|
|
|
104
117
|
coingeckoUrl: "https://www.coingecko.com/en/coins/bridged-usdc-arbitrum",
|
|
105
118
|
explorerUrl: "https://arbiscan.io/token/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
|
|
106
119
|
isV1Available: true,
|
|
120
|
+
isPermitSupported: true,
|
|
121
|
+
contractVersion: "1",
|
|
107
122
|
},
|
|
108
123
|
{
|
|
109
124
|
name: "USD Coin",
|
|
@@ -115,6 +130,7 @@ export const TOKENS = {
|
|
|
115
130
|
imageUrl: "https://assets.coingecko.com/coins/images/6319/thumb/USD_Coin_icon.png?1547042389",
|
|
116
131
|
coingeckoUrl: "https://www.coingecko.com/en/coins/usd-coin",
|
|
117
132
|
explorerUrl: "https://arbiscan.io/address/0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
133
|
+
isPermitSupported: true,
|
|
118
134
|
},
|
|
119
135
|
{
|
|
120
136
|
name: "Tether",
|
|
@@ -126,6 +142,8 @@ export const TOKENS = {
|
|
|
126
142
|
explorerUrl: "https://arbiscan.io/address/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
|
|
127
143
|
coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
|
|
128
144
|
isV1Available: true,
|
|
145
|
+
isPermitSupported: true,
|
|
146
|
+
contractVersion: "1",
|
|
129
147
|
},
|
|
130
148
|
{
|
|
131
149
|
name: "Dai",
|
|
@@ -137,6 +155,7 @@ export const TOKENS = {
|
|
|
137
155
|
coingeckoUrl: "https://www.coingecko.com/en/coins/dai",
|
|
138
156
|
explorerUrl: "https://arbiscan.io/token/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
|
|
139
157
|
isV1Available: true,
|
|
158
|
+
isPermitSupported: true,
|
|
140
159
|
},
|
|
141
160
|
{
|
|
142
161
|
name: "Frax",
|
|
@@ -148,6 +167,8 @@ export const TOKENS = {
|
|
|
148
167
|
coingeckoUrl: "https://www.coingecko.com/en/coins/frax",
|
|
149
168
|
explorerUrl: "https://arbiscan.io/token/0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F",
|
|
150
169
|
isV1Available: true,
|
|
170
|
+
isPermitSupported: true,
|
|
171
|
+
contractVersion: "1",
|
|
151
172
|
},
|
|
152
173
|
{
|
|
153
174
|
name: "Magic Internet Money",
|
|
@@ -158,6 +179,7 @@ export const TOKENS = {
|
|
|
158
179
|
isTempHidden: true,
|
|
159
180
|
imageUrl: "https://assets.coingecko.com/coins/images/16786/small/mimlogopng.png",
|
|
160
181
|
isV1Available: true,
|
|
182
|
+
isPermitSupported: true,
|
|
161
183
|
},
|
|
162
184
|
{
|
|
163
185
|
name: "Bitcoin",
|
|
@@ -168,6 +190,7 @@ export const TOKENS = {
|
|
|
168
190
|
categories: ["layer1"],
|
|
169
191
|
imageUrl: "https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579",
|
|
170
192
|
coingeckoUrl: "https://www.coingecko.com/en/coins/bitcoin",
|
|
193
|
+
isPermitSupported: true,
|
|
171
194
|
},
|
|
172
195
|
{
|
|
173
196
|
name: "Dogecoin",
|
|
@@ -272,6 +295,8 @@ export const TOKENS = {
|
|
|
272
295
|
imageUrl: "https://assets.coingecko.com/coins/images/12645/standard/AAVE.png?1696512452",
|
|
273
296
|
coingeckoUrl: "https://www.coingecko.com/en/coins/aave",
|
|
274
297
|
coingeckoSymbol: "AAVE",
|
|
298
|
+
isPermitSupported: true,
|
|
299
|
+
contractVersion: "1",
|
|
275
300
|
},
|
|
276
301
|
{
|
|
277
302
|
name: "Wrapped AVAX (Wormhole)",
|
|
@@ -285,6 +310,9 @@ export const TOKENS = {
|
|
|
285
310
|
coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
|
|
286
311
|
coingeckoSymbol: "AVAX",
|
|
287
312
|
explorerSymbol: "WAVAX",
|
|
313
|
+
isPermitSupported: true,
|
|
314
|
+
isPermitDisabled: true,
|
|
315
|
+
contractVersion: "1",
|
|
288
316
|
},
|
|
289
317
|
{
|
|
290
318
|
name: "Optimism",
|
|
@@ -316,6 +344,9 @@ export const TOKENS = {
|
|
|
316
344
|
categories: ["meme"],
|
|
317
345
|
imageUrl: "https://assets.coingecko.com/coins/images/33566/standard/dogwifhat.jpg?1702499428",
|
|
318
346
|
coingeckoUrl: "https://www.coingecko.com/en/coins/dogwifhat",
|
|
347
|
+
isPermitSupported: true,
|
|
348
|
+
isPermitDisabled: true,
|
|
349
|
+
contractVersion: "1",
|
|
319
350
|
},
|
|
320
351
|
{
|
|
321
352
|
name: "ORDI",
|
|
@@ -375,6 +406,8 @@ export const TOKENS = {
|
|
|
375
406
|
decimals: 18,
|
|
376
407
|
imageUrl: "https://assets.coingecko.com/coins/images/11224/standard/0x18084fba666a33d37592fa2633fd49a74dd93a88.png?1696511155",
|
|
377
408
|
coingeckoUrl: "https://www.coingecko.com/en/coins/tbtc",
|
|
409
|
+
isPermitSupported: true,
|
|
410
|
+
contractVersion: "1",
|
|
378
411
|
},
|
|
379
412
|
{
|
|
380
413
|
name: "Eigen",
|
|
@@ -384,6 +417,8 @@ export const TOKENS = {
|
|
|
384
417
|
categories: ["layer2"],
|
|
385
418
|
imageUrl: "https://assets.coingecko.com/coins/images/37441/standard/eigen.jpg?1728023974",
|
|
386
419
|
coingeckoUrl: "https://www.coingecko.com/en/coins/eigenlayer",
|
|
420
|
+
isPermitSupported: true,
|
|
421
|
+
contractVersion: "1",
|
|
387
422
|
},
|
|
388
423
|
{
|
|
389
424
|
name: "Sats",
|
|
@@ -571,6 +606,9 @@ export const TOKENS = {
|
|
|
571
606
|
categories: ["defi"],
|
|
572
607
|
imageUrl: "https://assets.coingecko.com/coins/images/15069/standard/Pendle_Logo_Normal-03.png?1696514728",
|
|
573
608
|
coingeckoUrl: "https://www.coingecko.com/en/coins/pendle",
|
|
609
|
+
isPermitSupported: true,
|
|
610
|
+
isPermitDisabled: true,
|
|
611
|
+
contractVersion: "1",
|
|
574
612
|
},
|
|
575
613
|
{
|
|
576
614
|
name: "ADA",
|
|
@@ -898,6 +936,46 @@ export const TOKENS = {
|
|
|
898
936
|
coingeckoUrl: "https://www.coingecko.com/en/coins/layerzero",
|
|
899
937
|
isSynthetic: true,
|
|
900
938
|
},
|
|
939
|
+
{
|
|
940
|
+
name: "Moodeng",
|
|
941
|
+
symbol: "MOODENG",
|
|
942
|
+
address: "0xd3898c6570974AEca38a8ACf22fd60739e528A99",
|
|
943
|
+
decimals: 6,
|
|
944
|
+
isSynthetic: true,
|
|
945
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/moo-deng",
|
|
946
|
+
imageUrl: "https://assets.coingecko.com/coins/images/50264/standard/MOODENG.jpg?1726726975",
|
|
947
|
+
categories: ["meme"],
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
name: "Monero",
|
|
951
|
+
symbol: "XMR",
|
|
952
|
+
address: "0x13674172E6E44D31d4bE489d5184f3457c40153A",
|
|
953
|
+
decimals: 12,
|
|
954
|
+
isSynthetic: true,
|
|
955
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/monero",
|
|
956
|
+
imageUrl: "https://assets.coingecko.com/coins/images/69/standard/monero_logo.png?1696501460",
|
|
957
|
+
categories: ["layer1", "defi"],
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
name: "Pi Network",
|
|
961
|
+
symbol: "PI",
|
|
962
|
+
address: "0xd1738d37401a0A71f7E382d2cFeCD3ab69687017",
|
|
963
|
+
decimals: 18,
|
|
964
|
+
isSynthetic: true,
|
|
965
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/pi-network",
|
|
966
|
+
imageUrl: "https://assets.coingecko.com/coins/images/54342/standard/pi_network.jpg?1739347576",
|
|
967
|
+
categories: ["layer1"],
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
name: "Curve DAO Token",
|
|
971
|
+
symbol: "CRV",
|
|
972
|
+
address: "0xe5f01aeAcc8288E9838A60016AB00d7b6675900b",
|
|
973
|
+
decimals: 18,
|
|
974
|
+
isSynthetic: true,
|
|
975
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/curve-dao-token",
|
|
976
|
+
imageUrl: "https://assets.coingecko.com/coins/images/12124/standard/Curve.png?1696511967",
|
|
977
|
+
categories: ["defi"],
|
|
978
|
+
},
|
|
901
979
|
{
|
|
902
980
|
name: "GMX LP",
|
|
903
981
|
symbol: "GLP",
|
|
@@ -1002,6 +1080,7 @@ export const TOKENS = {
|
|
|
1002
1080
|
coingeckoUrl: "https://www.coingecko.com/en/coins/usd-coin",
|
|
1003
1081
|
explorerUrl: "https://snowtrace.io/address/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
1004
1082
|
isV1Available: true,
|
|
1083
|
+
isPermitSupported: true,
|
|
1005
1084
|
},
|
|
1006
1085
|
{
|
|
1007
1086
|
name: "Bridged USDC (USDC.e)",
|
|
@@ -1023,6 +1102,8 @@ export const TOKENS = {
|
|
|
1023
1102
|
imageUrl: "https://assets.coingecko.com/coins/images/325/small/Tether-logo.png",
|
|
1024
1103
|
coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
|
|
1025
1104
|
explorerUrl: "https://snowtrace.io/address/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
|
|
1105
|
+
isPermitSupported: true,
|
|
1106
|
+
contractVersion: "1",
|
|
1026
1107
|
},
|
|
1027
1108
|
{
|
|
1028
1109
|
name: "Tether",
|
|
@@ -1055,6 +1136,7 @@ export const TOKENS = {
|
|
|
1055
1136
|
coingeckoUrl: "https://www.coingecko.com/en/coins/magic-internet-money",
|
|
1056
1137
|
explorerUrl: "https://snowtrace.io/address/0x130966628846BFd36ff31a822705796e8cb8C18D",
|
|
1057
1138
|
isV1Available: true,
|
|
1139
|
+
isPermitSupported: true,
|
|
1058
1140
|
},
|
|
1059
1141
|
{
|
|
1060
1142
|
name: "Chainlink",
|
|
@@ -1103,6 +1185,9 @@ export const TOKENS = {
|
|
|
1103
1185
|
coingeckoUrl: "https://www.coingecko.com/en/coins/solana",
|
|
1104
1186
|
coingeckoSymbol: "SOL",
|
|
1105
1187
|
explorerUrl: "https://snowtrace.io/address/0xFE6B19286885a4F7F55AdAD09C3Cd1f906D2478F",
|
|
1188
|
+
isPermitSupported: true,
|
|
1189
|
+
isPermitDisabled: true,
|
|
1190
|
+
contractVersion: "1",
|
|
1106
1191
|
},
|
|
1107
1192
|
{
|
|
1108
1193
|
name: "XRP",
|
|
@@ -1207,6 +1292,7 @@ export const TOKENS = {
|
|
|
1207
1292
|
imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
|
|
1208
1293
|
coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
|
|
1209
1294
|
explorerUrl: "https://testnet.snowtrace.io/address/0x1D308089a2D1Ced3f1Ce36B1FcaF815b07217be3",
|
|
1295
|
+
isPermitSupported: true,
|
|
1210
1296
|
},
|
|
1211
1297
|
{
|
|
1212
1298
|
name: "Ethereum (WETH.e)",
|
|
@@ -1520,6 +1606,10 @@ export function isValidToken(chainId, address) {
|
|
|
1520
1606
|
return address in TOKENS_MAP[chainId];
|
|
1521
1607
|
}
|
|
1522
1608
|
export function getToken(chainId, address) {
|
|
1609
|
+
// FIXME APE_deprecated token which is not in use but can be displayed
|
|
1610
|
+
if (chainId === ARBITRUM && address === "0x74885b4D524d497261259B38900f54e6dbAd2210") {
|
|
1611
|
+
return getTokenBySymbol(chainId, "APE");
|
|
1612
|
+
}
|
|
1523
1613
|
if (!TOKENS_MAP[chainId]) {
|
|
1524
1614
|
throw new Error(`Incorrect chainId ${chainId}`);
|
|
1525
1615
|
}
|
package/build/esm/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createPublicClient, createWalletClient, http } from "viem";
|
|
2
2
|
import { BATCH_CONFIGS } from "./configs/batch";
|
|
3
|
-
import {
|
|
3
|
+
import { getViemChain } from "./configs/chains";
|
|
4
4
|
import { Accounts } from "./modules/accounts/accounts";
|
|
5
5
|
import { Markets } from "./modules/markets";
|
|
6
6
|
import { Oracle } from "./modules/oracle";
|
|
@@ -34,13 +34,13 @@ export class GmxSdk {
|
|
|
34
34
|
}),
|
|
35
35
|
pollingInterval: undefined,
|
|
36
36
|
batch: BATCH_CONFIGS[this.config.chainId].client,
|
|
37
|
-
chain:
|
|
37
|
+
chain: getViemChain(this.config.chainId),
|
|
38
38
|
});
|
|
39
39
|
this.walletClient =
|
|
40
40
|
config.walletClient ??
|
|
41
41
|
createWalletClient({
|
|
42
42
|
account: config.account,
|
|
43
|
-
chain:
|
|
43
|
+
chain: getViemChain(config.chainId),
|
|
44
44
|
transport: http(config.rpcUrl, {
|
|
45
45
|
retryCount: 0,
|
|
46
46
|
retryDelay: 10000000,
|
|
@@ -63,7 +63,7 @@ export class GmxSdk {
|
|
|
63
63
|
return this.config.chainId;
|
|
64
64
|
}
|
|
65
65
|
get chain() {
|
|
66
|
-
return
|
|
66
|
+
return getViemChain(this.chainId);
|
|
67
67
|
}
|
|
68
68
|
get account() {
|
|
69
69
|
return this.config.account;
|
|
@@ -163,6 +163,7 @@ export class Markets extends Module {
|
|
|
163
163
|
swapFeeFactorForPositiveImpact: dataStoreValues.swapFeeFactorForPositiveImpact.returnValues[0],
|
|
164
164
|
swapFeeFactorForNegativeImpact: dataStoreValues.swapFeeFactorForNegativeImpact.returnValues[0],
|
|
165
165
|
swapImpactFactorPositive: dataStoreValues.swapImpactFactorPositive.returnValues[0],
|
|
166
|
+
atomicSwapFeeFactor: dataStoreValues.atomicSwapFeeFactor.returnValues[0],
|
|
166
167
|
swapImpactFactorNegative: dataStoreValues.swapImpactFactorNegative.returnValues[0],
|
|
167
168
|
swapImpactExponentFactor: dataStoreValues.swapImpactExponentFactor.returnValues[0],
|
|
168
169
|
virtualMarketId: dataStoreValues.virtualMarketId.returnValues[0],
|
|
@@ -353,6 +353,10 @@ export async function buildMarketsConfigsRequest(chainId, { marketsData, markets
|
|
|
353
353
|
methodName: "getUint",
|
|
354
354
|
params: [prebuiltHashedKeys.swapFeeFactorForNegativeImpact],
|
|
355
355
|
},
|
|
356
|
+
atomicSwapFeeFactor: {
|
|
357
|
+
methodName: "getUint",
|
|
358
|
+
params: [prebuiltHashedKeys.atomicSwapFeeFactor],
|
|
359
|
+
},
|
|
356
360
|
swapImpactFactorPositive: {
|
|
357
361
|
methodName: "getUint",
|
|
358
362
|
params: [prebuiltHashedKeys.swapImpactFactorPositive],
|
|
@@ -76,6 +76,7 @@ export async function increaseOrderHelper(sdk, params) {
|
|
|
76
76
|
gasPrice,
|
|
77
77
|
tokensData,
|
|
78
78
|
},
|
|
79
|
+
isExpressFeeSwap: false,
|
|
79
80
|
});
|
|
80
81
|
const payOrSizeAmount = "payAmount" in params ? params.payAmount : params.sizeAmount;
|
|
81
82
|
const increaseAmounts = getIncreasePositionAmounts({
|
|
@@ -161,6 +162,7 @@ export async function swap(sdk, params) {
|
|
|
161
162
|
gasPrice,
|
|
162
163
|
tokensData,
|
|
163
164
|
},
|
|
165
|
+
isExpressFeeSwap: false,
|
|
164
166
|
});
|
|
165
167
|
const isWrapOrUnwrap = Boolean(fromToken && toToken && (getIsWrap(fromToken, toToken) || getIsUnwrap(fromToken, toToken)));
|
|
166
168
|
const swapOptimizationOrder = isLimit ? ["length", "liquidity"] : undefined;
|
|
@@ -195,7 +195,7 @@ export class Orders extends Module {
|
|
|
195
195
|
})),
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
async createDecreaseOrder({ marketsInfoData, tokensData, marketInfo, decreaseAmounts, collateralToken, allowedSlippage, isLong, referralCode, }) {
|
|
198
|
+
async createDecreaseOrder({ marketsInfoData, tokensData, marketInfo, decreaseAmounts, collateralToken, allowedSlippage, isLong, referralCode, isTrigger, }) {
|
|
199
199
|
const account = this.account;
|
|
200
200
|
if (!account) {
|
|
201
201
|
throw new Error("Account is not defined");
|
|
@@ -206,7 +206,8 @@ export class Orders extends Module {
|
|
|
206
206
|
if (!executionFee) {
|
|
207
207
|
throw new Error("Execution fee is not available");
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
const orderType = isTrigger ? decreaseAmounts?.triggerOrderType : OrderType.MarketDecrease;
|
|
210
|
+
if (orderType === undefined) {
|
|
210
211
|
throw new Error("Trigger order type is not defined");
|
|
211
212
|
}
|
|
212
213
|
const { ordersInfoData } = await this.sdk.orders.getOrders({
|
|
@@ -237,7 +238,7 @@ export class Orders extends Module {
|
|
|
237
238
|
minOutputUsd: BigInt(0),
|
|
238
239
|
isLong,
|
|
239
240
|
decreasePositionSwapType: decreaseAmounts.decreaseSwapType,
|
|
240
|
-
orderType:
|
|
241
|
+
orderType: orderType,
|
|
241
242
|
executionFee: executionFee.feeTokenAmount,
|
|
242
243
|
allowedSlippage,
|
|
243
244
|
referralCode,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { withRetry } from "viem";
|
|
2
|
-
import { EXECUTION_FEE_CONFIG_V2, GAS_PRICE_PREMIUM_MAP,
|
|
2
|
+
import { EXECUTION_FEE_CONFIG_V2, GAS_LIMITS_STATIC_CONFIG, GAS_PRICE_PREMIUM_MAP, getViemChain, MAX_PRIORITY_FEE_PER_GAS_MAP, } from "../../configs/chains";
|
|
3
3
|
import { getContract } from "../../configs/contracts";
|
|
4
|
-
import { decreaseOrderGasLimitKey, depositGasLimitKey, ESTIMATED_GAS_FEE_BASE_AMOUNT_V2_1, ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR, ESTIMATED_GAS_FEE_PER_ORACLE_PRICE, GLV_DEPOSIT_GAS_LIMIT, GLV_PER_MARKET_GAS_LIMIT, GLV_WITHDRAWAL_GAS_LIMIT, increaseOrderGasLimitKey, shiftGasLimitKey, singleSwapGasLimitKey, swapOrderGasLimitKey, uiFeeFactorKey, withdrawalGasLimitKey, } from "../../configs/dataStore";
|
|
4
|
+
import { decreaseOrderGasLimitKey, depositGasLimitKey, ESTIMATED_GAS_FEE_BASE_AMOUNT_V2_1, ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR, ESTIMATED_GAS_FEE_PER_ORACLE_PRICE, GELATO_RELAY_FEE_MULTIPLIER_FACTOR_KEY, GLV_DEPOSIT_GAS_LIMIT, GLV_PER_MARKET_GAS_LIMIT, GLV_WITHDRAWAL_GAS_LIMIT, increaseOrderGasLimitKey, shiftGasLimitKey, singleSwapGasLimitKey, swapOrderGasLimitKey, uiFeeFactorKey, withdrawalGasLimitKey, } from "../../configs/dataStore";
|
|
5
5
|
import { bigMath } from "../../utils/bigmath";
|
|
6
6
|
import { estimateOrderOraclePriceCount } from "../../utils/fees/estimateOraclePriceCount";
|
|
7
7
|
import { estimateExecuteDecreaseOrderGasLimit, estimateExecuteIncreaseOrderGasLimit, estimateExecuteSwapOrderGasLimit, getExecutionFee, } from "../../utils/fees/executionFee";
|
|
@@ -76,6 +76,10 @@ export class Utils extends Module {
|
|
|
76
76
|
methodName: "getUint",
|
|
77
77
|
params: [GLV_PER_MARKET_GAS_LIMIT],
|
|
78
78
|
},
|
|
79
|
+
gelatoRelayFeeMultiplierFactor: {
|
|
80
|
+
methodName: "getUint",
|
|
81
|
+
params: [GELATO_RELAY_FEE_MULTIPLIER_FACTOR_KEY],
|
|
82
|
+
},
|
|
79
83
|
},
|
|
80
84
|
},
|
|
81
85
|
})
|
|
@@ -84,6 +88,7 @@ export class Utils extends Module {
|
|
|
84
88
|
function getBigInt(key) {
|
|
85
89
|
return BigInt(results[key].returnValues[0]);
|
|
86
90
|
}
|
|
91
|
+
const staticGasLimits = GAS_LIMITS_STATIC_CONFIG[this.chainId];
|
|
87
92
|
return {
|
|
88
93
|
depositToken: getBigInt("depositToken"),
|
|
89
94
|
withdrawalMultiToken: getBigInt("withdrawalMultiToken"),
|
|
@@ -98,6 +103,11 @@ export class Utils extends Module {
|
|
|
98
103
|
glvDepositGasLimit: getBigInt("glvDepositGasLimit"),
|
|
99
104
|
glvWithdrawalGasLimit: getBigInt("glvWithdrawalGasLimit"),
|
|
100
105
|
glvPerMarketGasLimit: getBigInt("glvPerMarketGasLimit"),
|
|
106
|
+
createOrderGasLimit: staticGasLimits.createOrderGasLimit,
|
|
107
|
+
updateOrderGasLimit: staticGasLimits.updateOrderGasLimit,
|
|
108
|
+
cancelOrderGasLimit: staticGasLimits.cancelOrderGasLimit,
|
|
109
|
+
tokenPermitGasLimit: staticGasLimits.tokenPermitGasLimit,
|
|
110
|
+
gelatoRelayFeeMultiplierFactor: getBigInt("gelatoRelayFeeMultiplierFactor"),
|
|
101
111
|
};
|
|
102
112
|
});
|
|
103
113
|
this._gasLimits = gasLimits;
|
|
@@ -163,7 +173,7 @@ export class Utils extends Module {
|
|
|
163
173
|
async getGasPrice() {
|
|
164
174
|
const executionFeeConfig = EXECUTION_FEE_CONFIG_V2[this.chainId];
|
|
165
175
|
const feeData = await withRetry(() => this.sdk.publicClient.estimateFeesPerGas({
|
|
166
|
-
chain:
|
|
176
|
+
chain: getViemChain(this.chainId),
|
|
167
177
|
type: "legacy",
|
|
168
178
|
}), {
|
|
169
179
|
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": {
|