@gmx-io/sdk 1.0.5 → 1.0.7
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 +6 -4
- package/build/cjs/src/configs/tokens.js +50 -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 +3 -1
- package/build/cjs/src/modules/orders/transactions/createDecreaseOrderTxn.js +1 -1
- package/build/cjs/src/modules/orders/transactions/createIncreaseOrderTxn.js +6 -3
- package/build/cjs/src/modules/orders/transactions/createSwapOrderTxn.js +1 -1
- package/build/cjs/src/modules/utils/utils.js +11 -1
- package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +119 -0
- package/build/cjs/src/test/mock.js +30 -1
- package/build/cjs/src/types/subsquid.js +2303 -0
- 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 +7 -3
- package/build/cjs/src/utils/numbers.js +560 -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/tradeHistory.js +4 -4
- 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/tokens.js +50 -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 +3 -1
- package/build/esm/src/modules/orders/transactions/createDecreaseOrderTxn.js +1 -1
- package/build/esm/src/modules/orders/transactions/createIncreaseOrderTxn.js +6 -3
- package/build/esm/src/modules/orders/transactions/createSwapOrderTxn.js +1 -1
- package/build/esm/src/modules/utils/utils.js +13 -3
- package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +119 -0
- package/build/esm/src/test/mock.js +28 -0
- package/build/esm/src/types/subsquid.js +2300 -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 +5 -2
- package/build/esm/src/utils/numbers.js +517 -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/tradeHistory.js +4 -4
- 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/subsquid.d.ts +6916 -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/tradeHistory.d.ts +0 -40
- 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 +2 -1
- package/build/types/src/utils/numbers.d.ts +111 -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/tradeHistory.d.ts +2 -2
- 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 +9 -2
- 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",
|
|
@@ -1002,6 +1040,7 @@ export const TOKENS = {
|
|
|
1002
1040
|
coingeckoUrl: "https://www.coingecko.com/en/coins/usd-coin",
|
|
1003
1041
|
explorerUrl: "https://snowtrace.io/address/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
1004
1042
|
isV1Available: true,
|
|
1043
|
+
isPermitSupported: true,
|
|
1005
1044
|
},
|
|
1006
1045
|
{
|
|
1007
1046
|
name: "Bridged USDC (USDC.e)",
|
|
@@ -1023,6 +1062,8 @@ export const TOKENS = {
|
|
|
1023
1062
|
imageUrl: "https://assets.coingecko.com/coins/images/325/small/Tether-logo.png",
|
|
1024
1063
|
coingeckoUrl: "https://www.coingecko.com/en/coins/tether",
|
|
1025
1064
|
explorerUrl: "https://snowtrace.io/address/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
|
|
1065
|
+
isPermitSupported: true,
|
|
1066
|
+
contractVersion: "1",
|
|
1026
1067
|
},
|
|
1027
1068
|
{
|
|
1028
1069
|
name: "Tether",
|
|
@@ -1055,6 +1096,7 @@ export const TOKENS = {
|
|
|
1055
1096
|
coingeckoUrl: "https://www.coingecko.com/en/coins/magic-internet-money",
|
|
1056
1097
|
explorerUrl: "https://snowtrace.io/address/0x130966628846BFd36ff31a822705796e8cb8C18D",
|
|
1057
1098
|
isV1Available: true,
|
|
1099
|
+
isPermitSupported: true,
|
|
1058
1100
|
},
|
|
1059
1101
|
{
|
|
1060
1102
|
name: "Chainlink",
|
|
@@ -1103,6 +1145,9 @@ export const TOKENS = {
|
|
|
1103
1145
|
coingeckoUrl: "https://www.coingecko.com/en/coins/solana",
|
|
1104
1146
|
coingeckoSymbol: "SOL",
|
|
1105
1147
|
explorerUrl: "https://snowtrace.io/address/0xFE6B19286885a4F7F55AdAD09C3Cd1f906D2478F",
|
|
1148
|
+
isPermitSupported: true,
|
|
1149
|
+
isPermitDisabled: true,
|
|
1150
|
+
contractVersion: "1",
|
|
1106
1151
|
},
|
|
1107
1152
|
{
|
|
1108
1153
|
name: "XRP",
|
|
@@ -1207,6 +1252,7 @@ export const TOKENS = {
|
|
|
1207
1252
|
imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
|
|
1208
1253
|
coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
|
|
1209
1254
|
explorerUrl: "https://testnet.snowtrace.io/address/0x1D308089a2D1Ced3f1Ce36B1FcaF815b07217be3",
|
|
1255
|
+
isPermitSupported: true,
|
|
1210
1256
|
},
|
|
1211
1257
|
{
|
|
1212
1258
|
name: "Ethereum (WETH.e)",
|
|
@@ -1520,6 +1566,10 @@ export function isValidToken(chainId, address) {
|
|
|
1520
1566
|
return address in TOKENS_MAP[chainId];
|
|
1521
1567
|
}
|
|
1522
1568
|
export function getToken(chainId, address) {
|
|
1569
|
+
// FIXME APE_deprecated token which is not in use but can be displayed
|
|
1570
|
+
if (chainId === ARBITRUM && address === "0x74885b4D524d497261259B38900f54e6dbAd2210") {
|
|
1571
|
+
return getTokenBySymbol(chainId, "APE");
|
|
1572
|
+
}
|
|
1523
1573
|
if (!TOKENS_MAP[chainId]) {
|
|
1524
1574
|
throw new Error(`Incorrect chainId ${chainId}`);
|
|
1525
1575
|
}
|
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({
|
|
@@ -109,7 +110,7 @@ export async function increaseOrderHelper(sdk, params) {
|
|
|
109
110
|
referralCodeForTxn: params.referralCodeForTxn,
|
|
110
111
|
triggerPrice: params.limitPrice,
|
|
111
112
|
collateralTokenAddress: collateralToken.address,
|
|
112
|
-
isLong:
|
|
113
|
+
isLong: params.isLong,
|
|
113
114
|
receiveTokenAddress: collateralTokenAddress,
|
|
114
115
|
indexToken: marketInfo.indexToken,
|
|
115
116
|
marketInfo,
|
|
@@ -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;
|
|
@@ -63,7 +63,7 @@ export function createDecreaseEncodedPayload({ sdk, orderVaultAddress, ps, }) {
|
|
|
63
63
|
callbackContract: zeroAddress,
|
|
64
64
|
market: p.marketAddress,
|
|
65
65
|
swapPath: p.swapPath,
|
|
66
|
-
uiFeeReceiver: zeroAddress,
|
|
66
|
+
uiFeeReceiver: sdk.config.settings?.uiFeeReceiverAccount || zeroAddress,
|
|
67
67
|
},
|
|
68
68
|
numbers: {
|
|
69
69
|
sizeDeltaUsd: p.sizeDeltaUsd,
|
|
@@ -32,6 +32,7 @@ export async function createIncreaseOrderTxn({ sdk, createIncreaseOrderParams: p
|
|
|
32
32
|
acceptablePrice,
|
|
33
33
|
isNativePayment,
|
|
34
34
|
initialCollateralTokenAddress,
|
|
35
|
+
uiFeeReceiver: sdk.config.settings?.uiFeeReceiverAccount,
|
|
35
36
|
});
|
|
36
37
|
const simulationEncodedPayload = await createEncodedPayload({
|
|
37
38
|
routerAbi: abis.ExchangeRouter,
|
|
@@ -41,6 +42,7 @@ export async function createIncreaseOrderTxn({ sdk, createIncreaseOrderParams: p
|
|
|
41
42
|
acceptablePrice,
|
|
42
43
|
isNativePayment,
|
|
43
44
|
initialCollateralTokenAddress,
|
|
45
|
+
uiFeeReceiver: sdk.config.settings?.uiFeeReceiverAccount,
|
|
44
46
|
});
|
|
45
47
|
const decreaseEncodedPayload = createDecreaseEncodedPayload({
|
|
46
48
|
sdk,
|
|
@@ -84,12 +86,13 @@ export async function createIncreaseOrderTxn({ sdk, createIncreaseOrderParams: p
|
|
|
84
86
|
value: totalWntAmount,
|
|
85
87
|
});
|
|
86
88
|
}
|
|
87
|
-
async function createEncodedPayload({ routerAbi, orderVaultAddress, totalWntAmount, p, acceptablePrice, isNativePayment, initialCollateralTokenAddress, }) {
|
|
89
|
+
async function createEncodedPayload({ routerAbi, orderVaultAddress, totalWntAmount, p, acceptablePrice, isNativePayment, initialCollateralTokenAddress, uiFeeReceiver, }) {
|
|
88
90
|
const orderParams = createOrderParams({
|
|
89
91
|
p,
|
|
90
92
|
acceptablePrice,
|
|
91
93
|
initialCollateralTokenAddress,
|
|
92
94
|
isNativePayment,
|
|
95
|
+
uiFeeReceiver,
|
|
93
96
|
});
|
|
94
97
|
const multicall = [
|
|
95
98
|
{ method: "sendWnt", params: [orderVaultAddress, totalWntAmount] },
|
|
@@ -107,7 +110,7 @@ async function createEncodedPayload({ routerAbi, orderVaultAddress, totalWntAmou
|
|
|
107
110
|
args: call.params,
|
|
108
111
|
}));
|
|
109
112
|
}
|
|
110
|
-
function createOrderParams({ p, acceptablePrice, initialCollateralTokenAddress, isNativePayment, }) {
|
|
113
|
+
function createOrderParams({ p, acceptablePrice, initialCollateralTokenAddress, isNativePayment, uiFeeReceiver, }) {
|
|
111
114
|
return {
|
|
112
115
|
addresses: {
|
|
113
116
|
cancellationReceiver: zeroAddress,
|
|
@@ -116,7 +119,7 @@ function createOrderParams({ p, acceptablePrice, initialCollateralTokenAddress,
|
|
|
116
119
|
callbackContract: zeroAddress,
|
|
117
120
|
market: p.marketAddress,
|
|
118
121
|
swapPath: p.swapPath,
|
|
119
|
-
uiFeeReceiver: zeroAddress,
|
|
122
|
+
uiFeeReceiver: uiFeeReceiver || zeroAddress,
|
|
120
123
|
},
|
|
121
124
|
numbers: {
|
|
122
125
|
sizeDeltaUsd: p.sizeDeltaUsd,
|
|
@@ -41,7 +41,7 @@ async function getParams(sdk, p) {
|
|
|
41
41
|
callbackContract: zeroAddress,
|
|
42
42
|
market: zeroAddress,
|
|
43
43
|
swapPath: p.swapPath,
|
|
44
|
-
uiFeeReceiver: zeroAddress,
|
|
44
|
+
uiFeeReceiver: sdk.config.settings?.uiFeeReceiverAccount || zeroAddress,
|
|
45
45
|
},
|
|
46
46
|
numbers: {
|
|
47
47
|
sizeDeltaUsd: 0n,
|
|
@@ -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,
|