@gmx-io/sdk 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/src/abis/GlvReader.js +940 -940
- package/build/cjs/src/abis/IStargate.js +603 -0
- package/build/cjs/src/abis/LayerZeroProvider.js +273 -46
- package/build/cjs/src/abis/index.js +2 -2
- package/build/cjs/src/configs/batch.js +29 -103
- package/build/cjs/src/configs/chainIds.js +2 -2
- package/build/cjs/src/configs/chains.js +230 -151
- package/build/cjs/src/configs/contracts.js +1 -5
- package/build/cjs/src/configs/dataStore.js +5 -4
- package/build/cjs/src/configs/express.js +1 -1
- package/build/cjs/src/configs/gasLimits.js +41 -0
- package/build/cjs/src/configs/markets.js +67 -1
- package/build/cjs/src/configs/multichain.js +1 -0
- package/build/cjs/src/configs/oracleKeeper.js +18 -20
- package/build/cjs/src/configs/tokens.js +53 -14
- package/build/cjs/src/modules/markets/index.js +6 -2
- package/build/cjs/src/modules/markets/markets.spec.js +5 -5
- package/build/cjs/src/modules/markets/query-builders.js +8 -0
- package/build/cjs/src/modules/orders/helpers.js +2 -2
- package/build/cjs/src/modules/orders/helpers.spec.js +1 -1
- package/build/cjs/src/modules/orders/orders.spec.js +1 -1
- package/build/cjs/src/modules/positions/positions.spec.js +2 -2
- package/build/cjs/src/modules/tokens/tokens.spec.js +2 -2
- package/build/cjs/src/modules/trades/trades.spec.js +1 -1
- package/build/cjs/src/modules/utils/utils.js +7 -6
- package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +24 -0
- package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +495 -0
- package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +45 -0
- package/build/cjs/src/test/mock.js +2 -0
- package/build/cjs/src/types/chains.js +2 -0
- package/build/cjs/src/types/orders.js +8 -2
- package/build/cjs/src/types/subsquid.js +241 -1
- package/build/cjs/src/types/tokens.js +7 -0
- package/build/cjs/src/utils/__tests__/abort.spec.js +122 -0
- package/build/cjs/src/utils/__tests__/numbers.spec.js +94 -14
- package/build/cjs/src/utils/abort.js +31 -0
- package/build/cjs/src/utils/callContract.js +4 -4
- package/build/cjs/src/utils/fees/executionFee.js +14 -11
- package/build/cjs/src/utils/fees/index.js +8 -2
- package/build/cjs/src/utils/marketKeysAndConfigs.js +8 -0
- package/build/cjs/src/utils/markets.js +7 -1
- package/build/cjs/src/utils/multicall.js +54 -17
- package/build/cjs/src/utils/numbers.js +25 -14
- package/build/cjs/src/utils/orders.js +2 -2
- package/build/cjs/src/utils/swap/__tests__/mockRouting.spec.js +7 -6
- package/build/cjs/src/utils/swap/__tests__/swapRouting.spec.js +5 -4
- package/build/cjs/src/utils/swap/__tests__/swapStats.spec.js +10 -9
- package/build/cjs/src/utils/swap/buildSwapStrategy.js +10 -9
- package/build/cjs/src/utils/swap/swapPath.js +6 -6
- package/build/cjs/src/utils/swap/swapRouting.js +8 -4
- package/build/cjs/src/utils/swap/swapStats.js +6 -6
- package/build/cjs/src/utils/swap/swapValues.js +4 -0
- package/build/cjs/src/utils/tokens.js +17 -1
- package/build/cjs/src/utils/trade/decrease.js +1 -1
- package/build/esm/src/abis/GlvReader.js +940 -940
- package/build/esm/src/abis/IStargate.js +601 -0
- package/build/esm/src/abis/LayerZeroProvider.js +273 -46
- package/build/esm/src/abis/index.js +2 -2
- package/build/esm/src/configs/batch.js +30 -104
- package/build/esm/src/configs/chainIds.js +1 -1
- package/build/esm/src/configs/chains.js +212 -147
- package/build/esm/src/configs/contracts.js +1 -5
- package/build/esm/src/configs/dataStore.js +1 -0
- package/build/esm/src/configs/express.js +1 -1
- package/build/esm/src/configs/gasLimits.js +38 -0
- package/build/esm/src/configs/markets.js +60 -1
- package/build/esm/src/configs/multichain.js +2 -1
- package/build/esm/src/configs/oracleKeeper.js +17 -19
- package/build/esm/src/configs/tokens.js +52 -13
- package/build/esm/src/modules/markets/index.js +6 -2
- package/build/esm/src/modules/markets/markets.spec.js +5 -5
- package/build/esm/src/modules/markets/query-builders.js +8 -0
- package/build/esm/src/modules/orders/helpers.js +3 -3
- package/build/esm/src/modules/orders/helpers.spec.js +1 -1
- package/build/esm/src/modules/orders/orders.spec.js +1 -1
- package/build/esm/src/modules/positions/positions.spec.js +2 -2
- package/build/esm/src/modules/tokens/tokens.spec.js +2 -2
- package/build/esm/src/modules/trades/trades.spec.js +1 -1
- package/build/esm/src/modules/utils/utils.js +7 -6
- package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +24 -0
- package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +495 -0
- package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +45 -0
- package/build/esm/src/test/mock.js +2 -0
- package/build/esm/src/types/chains.js +1 -0
- package/build/esm/src/types/orders.js +8 -2
- package/build/esm/src/types/subsquid.js +240 -0
- package/build/esm/src/types/tokens.js +6 -1
- package/build/esm/src/utils/__tests__/abort.spec.js +120 -0
- package/build/esm/src/utils/__tests__/numbers.spec.js +95 -15
- package/build/esm/src/utils/abort.js +27 -0
- package/build/esm/src/utils/callContract.js +5 -5
- package/build/esm/src/utils/fees/executionFee.js +15 -12
- package/build/esm/src/utils/fees/index.js +8 -2
- package/build/esm/src/utils/marketKeysAndConfigs.js +9 -1
- package/build/esm/src/utils/markets.js +5 -0
- package/build/esm/src/utils/multicall.js +53 -16
- package/build/esm/src/utils/numbers.js +21 -12
- package/build/esm/src/utils/orders.js +3 -3
- package/build/esm/src/utils/swap/__tests__/mockRouting.spec.js +7 -6
- package/build/esm/src/utils/swap/__tests__/swapRouting.spec.js +5 -4
- package/build/esm/src/utils/swap/__tests__/swapStats.spec.js +10 -9
- package/build/esm/src/utils/swap/buildSwapStrategy.js +10 -9
- package/build/esm/src/utils/swap/swapPath.js +6 -6
- package/build/esm/src/utils/swap/swapRouting.js +8 -4
- package/build/esm/src/utils/swap/swapStats.js +6 -6
- package/build/esm/src/utils/swap/swapValues.js +4 -0
- package/build/esm/src/utils/tokens.js +15 -1
- package/build/esm/src/utils/trade/decrease.js +2 -2
- package/build/types/src/abis/IStargate.d.ts +464 -0
- package/build/types/src/abis/LayerZeroProvider.d.ts +12 -0
- package/build/types/src/abis/index.d.ts +475 -99
- package/build/types/src/configs/chainIds.d.ts +1 -1
- package/build/types/src/configs/chains.d.ts +170 -27
- package/build/types/src/configs/contracts.d.ts +0 -4
- package/build/types/src/configs/dataStore.d.ts +1 -0
- package/build/types/src/configs/express.d.ts +1 -1
- package/build/types/src/configs/gasLimits.d.ts +4 -0
- package/build/types/src/configs/markets.d.ts +10 -1
- package/build/types/src/configs/oracleKeeper.d.ts +13 -0
- package/build/types/src/configs/tokens.d.ts +3 -0
- package/build/types/src/index.d.ts +1 -1
- package/build/types/src/modules/base.d.ts +1 -1
- package/build/types/src/modules/markets/index.d.ts +2 -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/utils/utils.d.ts +2 -3
- package/build/types/src/types/chains.d.ts +57 -0
- package/build/types/src/types/markets.d.ts +2 -0
- package/build/types/src/types/orders.d.ts +8 -2
- package/build/types/src/types/subsquid.d.ts +5987 -5172
- package/build/types/src/types/tokens.d.ts +11 -3
- package/build/types/src/types/trade.d.ts +5 -0
- package/build/types/src/utils/__tests__/abort.spec.d.ts +1 -0
- package/build/types/src/utils/abort.d.ts +1 -0
- package/build/types/src/utils/fees/estimateOraclePriceCount.d.ts +2 -2
- package/build/types/src/utils/fees/executionFee.d.ts +6 -6
- package/build/types/src/utils/fees/index.d.ts +2 -1
- package/build/types/src/utils/marketKeysAndConfigs.d.ts +2 -0
- package/build/types/src/utils/markets.d.ts +4 -2
- package/build/types/src/utils/multicall.d.ts +4 -2
- package/build/types/src/utils/numbers.d.ts +8 -1
- package/build/types/src/utils/swap/buildSwapStrategy.d.ts +6 -3
- package/build/types/src/utils/swap/swapPath.d.ts +2 -1
- package/build/types/src/utils/swap/swapRouting.d.ts +7 -2
- package/build/types/src/utils/swap/swapStats.d.ts +3 -2
- package/build/types/src/utils/swap/swapValues.d.ts +1 -1
- package/build/types/src/utils/tokens.d.ts +3 -0
- package/package.json +8 -2
- package/build/cjs/src/abis/MultichainUtils.js +0 -133
- package/build/esm/src/abis/MultichainUtils.js +0 -131
- package/build/types/src/abis/MultichainUtils.d.ts +0 -100
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fixTokenSymbolFromMarketLabel = exports.getMarketByLabel = exports.MARKETS = exports.SWAP_GRAPH_MAX_MARKETS_PER_TOKEN = void 0;
|
|
3
|
+
exports.getMarketIsSameCollaterals = exports.getIsSpotOnlyMarket = exports.getTokenSymbolByMarket = exports.getMarketIndexToken = exports.getTokenAddressByMarket = exports.isMarketTokenAddress = exports.fixTokenSymbolFromMarketLabel = exports.getMarketByLabel = exports.getMarketsByChainId = exports.MARKETS = exports.SWAP_GRAPH_MAX_MARKETS_PER_TOKEN = void 0;
|
|
4
4
|
/*
|
|
5
5
|
This files is used to pre-build data during the build process.
|
|
6
6
|
Avoid adding client-side code here, as it can break the build process.
|
|
7
7
|
*/
|
|
8
|
+
const viem_1 = require("viem");
|
|
8
9
|
const chains_1 = require("./chains");
|
|
9
10
|
const tokens_1 = require("./tokens");
|
|
10
11
|
exports.SWAP_GRAPH_MAX_MARKETS_PER_TOKEN = 5;
|
|
@@ -812,6 +813,27 @@ exports.MARKETS = {
|
|
|
812
813
|
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
813
814
|
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
814
815
|
},
|
|
816
|
+
// MON/USD [WETH-USDC]
|
|
817
|
+
"0x66AB9D61A0124b61C8892A4ac687Ac48DbA8ff2c": {
|
|
818
|
+
marketTokenAddress: "0x66AB9D61A0124b61C8892A4ac687Ac48DbA8ff2c",
|
|
819
|
+
indexTokenAddress: "0xB96e60CA3a7677b29f1e10dd109E952B275038Be",
|
|
820
|
+
longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
821
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
822
|
+
},
|
|
823
|
+
// ZEC/USD [WBTC.e-USDC]
|
|
824
|
+
"0x587759c237acCa739bCE3911647BacF56C876E60": {
|
|
825
|
+
marketTokenAddress: "0x587759c237acCa739bCE3911647BacF56C876E60",
|
|
826
|
+
indexTokenAddress: "0x6eAbbaA3278556Dc5b19c034dc26c0eaB60d65B5",
|
|
827
|
+
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
828
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
829
|
+
},
|
|
830
|
+
// SKY/USD [WETH-USDC]
|
|
831
|
+
"0x00310c6d8A9F821e3FE991f4835f2cA4d87034Cf": {
|
|
832
|
+
marketTokenAddress: "0x00310c6d8A9F821e3FE991f4835f2cA4d87034Cf",
|
|
833
|
+
indexTokenAddress: "0xeeA41ceA2204D1156De1BDF2CF4ab6184d17f90B",
|
|
834
|
+
longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
835
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
836
|
+
},
|
|
815
837
|
},
|
|
816
838
|
[chains_1.AVALANCHE]: {
|
|
817
839
|
// BTC/USD [BTC-USDC]
|
|
@@ -1158,6 +1180,13 @@ exports.MARKETS = {
|
|
|
1158
1180
|
},
|
|
1159
1181
|
},
|
|
1160
1182
|
};
|
|
1183
|
+
function getMarketsByChainId(chainId) {
|
|
1184
|
+
if (!exports.MARKETS[chainId]) {
|
|
1185
|
+
throw new Error(`Markets not found for chainId ${chainId}`);
|
|
1186
|
+
}
|
|
1187
|
+
return exports.MARKETS[chainId];
|
|
1188
|
+
}
|
|
1189
|
+
exports.getMarketsByChainId = getMarketsByChainId;
|
|
1161
1190
|
function getMarketByLabel(chainId, label) {
|
|
1162
1191
|
const marketsByAddress = exports.MARKETS[chainId];
|
|
1163
1192
|
if (!marketsByAddress) {
|
|
@@ -1206,3 +1235,40 @@ const fixTokenSymbolFromMarketLabel = (chainId, symbol) => {
|
|
|
1206
1235
|
return symbol;
|
|
1207
1236
|
};
|
|
1208
1237
|
exports.fixTokenSymbolFromMarketLabel = fixTokenSymbolFromMarketLabel;
|
|
1238
|
+
function isMarketTokenAddress(chainId, marketTokenAddress) {
|
|
1239
|
+
return Boolean(exports.MARKETS[chainId]?.[marketTokenAddress]);
|
|
1240
|
+
}
|
|
1241
|
+
exports.isMarketTokenAddress = isMarketTokenAddress;
|
|
1242
|
+
function getTokenAddressByMarket(chainId, marketTokenAddress, tokenType) {
|
|
1243
|
+
const market = exports.MARKETS[chainId][marketTokenAddress];
|
|
1244
|
+
if (tokenType === "index") {
|
|
1245
|
+
return (0, tokens_1.convertTokenAddress)(chainId, market.indexTokenAddress, "native");
|
|
1246
|
+
}
|
|
1247
|
+
if (tokenType === "long") {
|
|
1248
|
+
return market.longTokenAddress;
|
|
1249
|
+
}
|
|
1250
|
+
return market.shortTokenAddress;
|
|
1251
|
+
}
|
|
1252
|
+
exports.getTokenAddressByMarket = getTokenAddressByMarket;
|
|
1253
|
+
function getMarketIndexToken(chainId, marketTokenAddress) {
|
|
1254
|
+
const indexTokenAddress = getTokenAddressByMarket(chainId, marketTokenAddress, "index");
|
|
1255
|
+
return (0, tokens_1.getToken)(chainId, indexTokenAddress);
|
|
1256
|
+
}
|
|
1257
|
+
exports.getMarketIndexToken = getMarketIndexToken;
|
|
1258
|
+
function getTokenSymbolByMarket(chainId, marketTokenAddress, tokenType) {
|
|
1259
|
+
const tokenAddress = getTokenAddressByMarket(chainId, marketTokenAddress, tokenType);
|
|
1260
|
+
return (0, tokens_1.getToken)(chainId, tokenAddress).symbol;
|
|
1261
|
+
}
|
|
1262
|
+
exports.getTokenSymbolByMarket = getTokenSymbolByMarket;
|
|
1263
|
+
function getIsSpotOnlyMarket(chainId, marketTokenAddress) {
|
|
1264
|
+
return exports.MARKETS[chainId][marketTokenAddress].indexTokenAddress === viem_1.zeroAddress;
|
|
1265
|
+
}
|
|
1266
|
+
exports.getIsSpotOnlyMarket = getIsSpotOnlyMarket;
|
|
1267
|
+
function getMarketIsSameCollaterals(chainId, marketTokenAddress) {
|
|
1268
|
+
const market = exports.MARKETS[chainId][marketTokenAddress];
|
|
1269
|
+
if (!market) {
|
|
1270
|
+
return false;
|
|
1271
|
+
}
|
|
1272
|
+
return market.longTokenAddress === market.shortTokenAddress;
|
|
1273
|
+
}
|
|
1274
|
+
exports.getMarketIsSameCollaterals = getMarketIsSameCollaterals;
|
|
@@ -15,6 +15,7 @@ exports.SOURCE_CHAINS = ensureExhaustive({
|
|
|
15
15
|
[chainIds_1.SOURCE_SEPOLIA]: true,
|
|
16
16
|
[chainIds_1.SOURCE_BASE_MAINNET]: true,
|
|
17
17
|
[chainIds_1.SOURCE_BSC_MAINNET]: true,
|
|
18
|
+
[chainIds_1.SOURCE_ETHEREUM_MAINNET]: true,
|
|
18
19
|
});
|
|
19
20
|
function isSettlementChain(chainId) {
|
|
20
21
|
return exports.SETTLEMENT_CHAINS.includes(chainId);
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOracleKeeperFallbackUrls = exports.getOracleKeeperUrl = void 0;
|
|
3
|
+
exports.getOracleKeeperFallbackUrls = exports.getOracleKeeperUrl = exports.ORACLE_FALLBACK_TRACKER_CONFIG = void 0;
|
|
4
4
|
const chains_1 = require("./chains");
|
|
5
|
+
exports.ORACLE_FALLBACK_TRACKER_CONFIG = {
|
|
6
|
+
trackInterval: 10 * 1000, // 10 secs
|
|
7
|
+
checkTimeout: 10 * 1000, // 10 secs
|
|
8
|
+
cacheTimeout: 5 * 60 * 1000, // 5 mins
|
|
9
|
+
disableUnusedTrackingTimeout: 1 * 60 * 1000, // 1 mim
|
|
10
|
+
failuresBeforeBan: {
|
|
11
|
+
count: 3,
|
|
12
|
+
window: 60 * 1000, // 1 min
|
|
13
|
+
throttle: 2 * 1000, // 2 secs
|
|
14
|
+
},
|
|
15
|
+
setEndpointsThrottle: 5 * 1000, // 5 secs
|
|
16
|
+
delay: 5000, // 5 secs
|
|
17
|
+
};
|
|
5
18
|
const ORACLE_KEEPER_URLS = {
|
|
6
19
|
[chains_1.ARBITRUM]: "https://arbitrum-api.gmxinfra.io",
|
|
7
20
|
[chains_1.AVALANCHE]: "https://avalanche-api.gmxinfra.io",
|
|
@@ -10,25 +23,10 @@ const ORACLE_KEEPER_URLS = {
|
|
|
10
23
|
[chains_1.ARBITRUM_SEPOLIA]: "https://dolphin-app-a2dup.ondigitalocean.app",
|
|
11
24
|
};
|
|
12
25
|
const ORACLE_KEEPER_FALLBACK_URLS = {
|
|
13
|
-
[chains_1.ARBITRUM]: [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
],
|
|
18
|
-
[chains_1.AVALANCHE]: [
|
|
19
|
-
"https://avalanche-api-fallback.gmxinfra.io",
|
|
20
|
-
"https://avalanche-api-fallback.gmxinfra2.io",
|
|
21
|
-
"https://avalanche-api.gmxinfra.io",
|
|
22
|
-
],
|
|
23
|
-
[chains_1.AVALANCHE_FUJI]: [
|
|
24
|
-
"https://synthetics-api-avax-fuji-upovm.ondigitalocean.app",
|
|
25
|
-
"https://synthetics-api-avax-fuji.gmxinfra.io",
|
|
26
|
-
],
|
|
27
|
-
[chains_1.BOTANIX]: [
|
|
28
|
-
"https://botanix-api-fallback.gmxinfra.io",
|
|
29
|
-
"https://botanix-api-fallback.gmxinfra2.io",
|
|
30
|
-
"https://botanix-api.gmxinfra.io",
|
|
31
|
-
],
|
|
26
|
+
[chains_1.ARBITRUM]: ["https://arbitrum-api-fallback.gmxinfra.io", "https://arbitrum-api-fallback.gmxinfra2.io"],
|
|
27
|
+
[chains_1.AVALANCHE]: ["https://avalanche-api-fallback.gmxinfra.io", "https://avalanche-api-fallback.gmxinfra2.io"],
|
|
28
|
+
[chains_1.AVALANCHE_FUJI]: ["https://synthetics-api-avax-fuji.gmxinfra.io"],
|
|
29
|
+
[chains_1.BOTANIX]: ["https://botanix-api-fallback.gmxinfra.io", "https://botanix-api-fallback.gmxinfra2.io"],
|
|
32
30
|
[chains_1.ARBITRUM_SEPOLIA]: ["https://dolphin-app-a2dup.ondigitalocean.app"],
|
|
33
31
|
};
|
|
34
32
|
function getOracleKeeperUrl(chainId) {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUsdBasedStableToken = exports.createTokensMap = exports.getCategoryTokenAddresses = exports.getStableTokens = exports.getTokenVisualMultiplier = exports.isSimilarToken = exports.isTokenInList = exports.getTokenBySymbolSafe = exports.getPriceDecimals = exports.isChartAvailableForToken = exports.getNormalizedTokenSymbol = exports.convertTokenAddress = exports.getTokenBySymbol = exports.getToken = exports.isValidTokenSafe = exports.isValidToken = exports.getVisibleV1Tokens = exports.getWhitelistedV1Tokens = exports.getTokensMap = exports.getV2Tokens = exports.getV1Tokens = exports.getTokens = exports.getNativeToken = exports.getWrappedToken = exports.getSyntheticTokens = exports.NATIVE_TOKENS_MAP = exports.WRAPPED_TOKENS_MAP = exports.TOKENS_BY_SYMBOL_MAP = exports.SYNTHETIC_TOKENS = exports.V2_TOKENS = exports.V1_TOKENS = exports.TOKENS_MAP = exports.TOKEN_COLOR_MAP = exports.TOKENS = exports.NATIVE_TOKEN_ADDRESS = void 0;
|
|
3
|
+
exports.isUsdBasedStableToken = exports.createTokensMap = exports.getCategoryTokenAddresses = exports.getStableTokens = exports.getTokenVisualMultiplier = exports.isSimilarToken = exports.isTokenInList = exports.getTokenBySymbolSafe = exports.getPriceDecimals = exports.isChartAvailableForToken = exports.getNormalizedTokenSymbol = exports.convertTokenAddress = exports.getTokenBySymbol = exports.getToken = exports.isValidTokenSafe = exports.isValidToken = exports.getVisibleV1Tokens = exports.getWhitelistedV1Tokens = exports.getTokensMap = exports.getV2Tokens = exports.getV1Tokens = exports.getTokens = exports.getNativeToken = exports.getWrappedToken = exports.getSyntheticTokens = exports.NATIVE_TOKENS_MAP = exports.WRAPPED_TOKENS_MAP = exports.TOKENS_BY_SYMBOL_MAP = exports.SYNTHETIC_TOKENS = exports.V2_TOKENS = exports.V1_TOKENS = exports.TOKENS_MAP = exports.TOKEN_COLOR_MAP = exports.TOKENS = exports.GLV_STUB_ADDRESS = exports.GM_STUB_ADDRESS = exports.NATIVE_TOKEN_ADDRESS = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const chains_1 = require("./chains");
|
|
6
6
|
const contracts_1 = require("./contracts");
|
|
7
7
|
exports.NATIVE_TOKEN_ADDRESS = viem_1.zeroAddress;
|
|
8
|
+
exports.GM_STUB_ADDRESS = "<GM-ADDRESS>";
|
|
9
|
+
exports.GLV_STUB_ADDRESS = "<GLV-ADDRESS>";
|
|
10
|
+
const GMX_STUB_ADDRESS = "<GMX-ADDRESS>";
|
|
11
|
+
const ESGMX_STUB_ADDRESS = "<ESGMX-ADDRESS>";
|
|
12
|
+
const GLP_STUB_ADDRESS = "<GLP-ADDRESS>";
|
|
8
13
|
exports.TOKENS = {
|
|
9
14
|
[chains_1.ARBITRUM]: [
|
|
10
15
|
{
|
|
@@ -1026,7 +1031,7 @@ exports.TOKENS = {
|
|
|
1026
1031
|
{
|
|
1027
1032
|
name: "GMX Market tokens",
|
|
1028
1033
|
symbol: "GM",
|
|
1029
|
-
address:
|
|
1034
|
+
address: exports.GM_STUB_ADDRESS,
|
|
1030
1035
|
decimals: 18,
|
|
1031
1036
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
|
|
1032
1037
|
isPlatformToken: true,
|
|
@@ -1034,7 +1039,7 @@ exports.TOKENS = {
|
|
|
1034
1039
|
{
|
|
1035
1040
|
name: "GLV Market tokens",
|
|
1036
1041
|
symbol: "GLV",
|
|
1037
|
-
address:
|
|
1042
|
+
address: exports.GLV_STUB_ADDRESS,
|
|
1038
1043
|
decimals: 18,
|
|
1039
1044
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
|
|
1040
1045
|
isPlatformToken: true,
|
|
@@ -1248,6 +1253,39 @@ exports.TOKENS = {
|
|
|
1248
1253
|
coingeckoUrl: "https://www.coingecko.com/en/coins/linea",
|
|
1249
1254
|
isSynthetic: true,
|
|
1250
1255
|
},
|
|
1256
|
+
{
|
|
1257
|
+
name: "Monad",
|
|
1258
|
+
symbol: "MON",
|
|
1259
|
+
address: "0xB96e60CA3a7677b29f1e10dd109E952B275038Be",
|
|
1260
|
+
decimals: 18,
|
|
1261
|
+
priceDecimals: 6,
|
|
1262
|
+
categories: ["layer1", "defi"],
|
|
1263
|
+
imageUrl: "https://assets.coingecko.com/coins/images/38927/standard/mon.png?1766029057",
|
|
1264
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/monad",
|
|
1265
|
+
isSynthetic: true,
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
name: "Sky",
|
|
1269
|
+
symbol: "SKY",
|
|
1270
|
+
address: "0xeeA41ceA2204D1156De1BDF2CF4ab6184d17f90B",
|
|
1271
|
+
decimals: 18,
|
|
1272
|
+
priceDecimals: 6,
|
|
1273
|
+
categories: ["defi"],
|
|
1274
|
+
imageUrl: "https://assets.coingecko.com/coins/images/39925/standard/sky.jpg?1724827980",
|
|
1275
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/sky",
|
|
1276
|
+
isSynthetic: true,
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
name: "Zcash",
|
|
1280
|
+
symbol: "ZEC",
|
|
1281
|
+
address: "0x6eAbbaA3278556Dc5b19c034dc26c0eaB60d65B5",
|
|
1282
|
+
decimals: 8,
|
|
1283
|
+
priceDecimals: 3,
|
|
1284
|
+
categories: ["layer1"],
|
|
1285
|
+
imageUrl: "https://assets.coingecko.com/coins/images/486/standard/circle-zcash-color.png?1696501740",
|
|
1286
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/zcash",
|
|
1287
|
+
isSynthetic: true,
|
|
1288
|
+
},
|
|
1251
1289
|
],
|
|
1252
1290
|
[chains_1.AVALANCHE]: [
|
|
1253
1291
|
{
|
|
@@ -1535,7 +1573,7 @@ exports.TOKENS = {
|
|
|
1535
1573
|
{
|
|
1536
1574
|
name: "GMX Market tokens",
|
|
1537
1575
|
symbol: "GM",
|
|
1538
|
-
address:
|
|
1576
|
+
address: exports.GM_STUB_ADDRESS,
|
|
1539
1577
|
decimals: 18,
|
|
1540
1578
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
|
|
1541
1579
|
isPlatformToken: true,
|
|
@@ -1543,7 +1581,7 @@ exports.TOKENS = {
|
|
|
1543
1581
|
{
|
|
1544
1582
|
name: "GLV Market tokens",
|
|
1545
1583
|
symbol: "GLV",
|
|
1546
|
-
address:
|
|
1584
|
+
address: exports.GLV_STUB_ADDRESS,
|
|
1547
1585
|
decimals: 18,
|
|
1548
1586
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
|
|
1549
1587
|
isPlatformToken: true,
|
|
@@ -1765,7 +1803,7 @@ exports.TOKENS = {
|
|
|
1765
1803
|
{
|
|
1766
1804
|
name: "GMX Market tokens",
|
|
1767
1805
|
symbol: "GM",
|
|
1768
|
-
address:
|
|
1806
|
+
address: exports.GM_STUB_ADDRESS,
|
|
1769
1807
|
decimals: 18,
|
|
1770
1808
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
|
|
1771
1809
|
isPlatformToken: true,
|
|
@@ -1773,7 +1811,7 @@ exports.TOKENS = {
|
|
|
1773
1811
|
{
|
|
1774
1812
|
name: "GLV Market tokens",
|
|
1775
1813
|
symbol: "GLV",
|
|
1776
|
-
address:
|
|
1814
|
+
address: exports.GLV_STUB_ADDRESS,
|
|
1777
1815
|
decimals: 18,
|
|
1778
1816
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
|
|
1779
1817
|
isPlatformToken: true,
|
|
@@ -1852,7 +1890,7 @@ exports.TOKENS = {
|
|
|
1852
1890
|
{
|
|
1853
1891
|
name: "GMX",
|
|
1854
1892
|
symbol: "GMX",
|
|
1855
|
-
address:
|
|
1893
|
+
address: GMX_STUB_ADDRESS,
|
|
1856
1894
|
decimals: 18,
|
|
1857
1895
|
imageUrl: "https://assets.coingecko.com/coins/images/18323/small/arbit.png?1631532468",
|
|
1858
1896
|
isPlatformToken: true,
|
|
@@ -1860,14 +1898,14 @@ exports.TOKENS = {
|
|
|
1860
1898
|
{
|
|
1861
1899
|
name: "Escrowed GMX",
|
|
1862
1900
|
symbol: "ESGMX",
|
|
1863
|
-
address:
|
|
1901
|
+
address: ESGMX_STUB_ADDRESS,
|
|
1864
1902
|
decimals: 18,
|
|
1865
1903
|
isPlatformToken: true,
|
|
1866
1904
|
},
|
|
1867
1905
|
{
|
|
1868
1906
|
name: "GMX LP",
|
|
1869
1907
|
symbol: "GLP",
|
|
1870
|
-
address:
|
|
1908
|
+
address: GLP_STUB_ADDRESS,
|
|
1871
1909
|
decimals: 18,
|
|
1872
1910
|
imageUrl: "https://github.com/gmx-io/gmx-assets/blob/main/GMX-Assets/PNG/GLP_LOGO%20ONLY.png?raw=true",
|
|
1873
1911
|
isPlatformToken: true,
|
|
@@ -1875,7 +1913,7 @@ exports.TOKENS = {
|
|
|
1875
1913
|
{
|
|
1876
1914
|
name: "GMX Market tokens",
|
|
1877
1915
|
symbol: "GM",
|
|
1878
|
-
address:
|
|
1916
|
+
address: exports.GM_STUB_ADDRESS,
|
|
1879
1917
|
decimals: 18,
|
|
1880
1918
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
|
|
1881
1919
|
isPlatformToken: true,
|
|
@@ -1883,7 +1921,7 @@ exports.TOKENS = {
|
|
|
1883
1921
|
{
|
|
1884
1922
|
name: "GLV Market tokens",
|
|
1885
1923
|
symbol: "GLV",
|
|
1886
|
-
address:
|
|
1924
|
+
address: exports.GLV_STUB_ADDRESS,
|
|
1887
1925
|
decimals: 18,
|
|
1888
1926
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
|
|
1889
1927
|
isPlatformToken: true,
|
|
@@ -1978,7 +2016,7 @@ exports.TOKENS = {
|
|
|
1978
2016
|
{
|
|
1979
2017
|
name: "GMX Market tokens",
|
|
1980
2018
|
symbol: "GM",
|
|
1981
|
-
address:
|
|
2019
|
+
address: exports.GM_STUB_ADDRESS,
|
|
1982
2020
|
decimals: 18,
|
|
1983
2021
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
|
|
1984
2022
|
isPlatformToken: true,
|
|
@@ -1986,7 +2024,7 @@ exports.TOKENS = {
|
|
|
1986
2024
|
{
|
|
1987
2025
|
name: "GLV Market tokens",
|
|
1988
2026
|
symbol: "GLV",
|
|
1989
|
-
address:
|
|
2027
|
+
address: exports.GLV_STUB_ADDRESS,
|
|
1990
2028
|
decimals: 18,
|
|
1991
2029
|
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
|
|
1992
2030
|
isPlatformToken: true,
|
|
@@ -2000,6 +2038,7 @@ exports.TOKEN_COLOR_MAP = {
|
|
|
2000
2038
|
PBTC: "#F7931A",
|
|
2001
2039
|
USDC: "#2775CA",
|
|
2002
2040
|
"USDC.E": "#2A5ADA",
|
|
2041
|
+
"USDC.SG": "#2775CA",
|
|
2003
2042
|
USDT: "#67B18A",
|
|
2004
2043
|
MIM: "#9695F8",
|
|
2005
2044
|
FRAX: "#000",
|
|
@@ -176,6 +176,8 @@ class Markets extends base_1.Module {
|
|
|
176
176
|
atomicSwapFeeFactor: dataStoreValues.atomicSwapFeeFactor.returnValues[0],
|
|
177
177
|
swapImpactFactorNegative: dataStoreValues.swapImpactFactorNegative.returnValues[0],
|
|
178
178
|
swapImpactExponentFactor: dataStoreValues.swapImpactExponentFactor.returnValues[0],
|
|
179
|
+
withdrawalFeeFactorBalanceWasImproved: dataStoreValues.withdrawalFeeFactorBalanceWasImproved.returnValues[0],
|
|
180
|
+
withdrawalFeeFactorBalanceWasNotImproved: dataStoreValues.withdrawalFeeFactorBalanceWasNotImproved.returnValues[0],
|
|
179
181
|
virtualMarketId: dataStoreValues.virtualMarketId.returnValues[0],
|
|
180
182
|
virtualLongTokenId: dataStoreValues.virtualLongTokenId.returnValues[0],
|
|
181
183
|
virtualShortTokenId: dataStoreValues.virtualShortTokenId.returnValues[0],
|
|
@@ -211,8 +213,8 @@ class Markets extends base_1.Module {
|
|
|
211
213
|
};
|
|
212
214
|
});
|
|
213
215
|
}
|
|
214
|
-
async getMarkets(offset = 0n, limit =
|
|
215
|
-
if (this._marketsData) {
|
|
216
|
+
async getMarkets(offset = 0n, limit = 300n) {
|
|
217
|
+
if (this._marketsData && this._marketsDataOffset === offset && this._marketsDataLimit === limit) {
|
|
216
218
|
return this._marketsData;
|
|
217
219
|
}
|
|
218
220
|
const readerAddress = (0, contracts_1.getContract)(this.chainId, "SyntheticsReader");
|
|
@@ -279,6 +281,8 @@ class Markets extends base_1.Module {
|
|
|
279
281
|
return acc;
|
|
280
282
|
}, { marketsData: {}, marketsAddresses: [] });
|
|
281
283
|
this._marketsData = marketsResult;
|
|
284
|
+
this._marketsDataOffset = offset;
|
|
285
|
+
this._marketsDataLimit = limit;
|
|
282
286
|
return marketsResult;
|
|
283
287
|
}
|
|
284
288
|
async getMarketsInfo() {
|
|
@@ -5,12 +5,12 @@ const testUtil_1 = require("../../utils/testUtil");
|
|
|
5
5
|
const index_1 = require("../../index");
|
|
6
6
|
(0, vitest_1.describe)("Markets", () => {
|
|
7
7
|
(0, vitest_1.describe)("getMarkets", () => {
|
|
8
|
-
(0, vitest_1.it)("should be able to get markets data", async () => {
|
|
8
|
+
(0, vitest_1.it)("should be able to get markets data", { timeout: 90000 }, async () => {
|
|
9
9
|
const marketsData = await testUtil_1.arbitrumSdk.markets.getMarkets();
|
|
10
10
|
(0, vitest_1.expect)(marketsData.marketsAddresses).toBeDefined();
|
|
11
11
|
(0, vitest_1.expect)(marketsData.marketsData).toBeDefined();
|
|
12
12
|
});
|
|
13
|
-
(0, vitest_1.it)("should respect config filters", async () => {
|
|
13
|
+
(0, vitest_1.it)("should respect config filters", { timeout: 90000 }, async () => {
|
|
14
14
|
const sdk = new index_1.GmxSdk({
|
|
15
15
|
...testUtil_1.arbitrumSdkConfig,
|
|
16
16
|
markets: {
|
|
@@ -26,15 +26,15 @@ const index_1 = require("../../index");
|
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
(0, vitest_1.describe)("getMarketsInfo", () => {
|
|
29
|
-
(0, vitest_1.it)("should be able to get markets info", async () => {
|
|
29
|
+
(0, vitest_1.it)("should be able to get markets info", { timeout: 90000 }, async () => {
|
|
30
30
|
const response = await testUtil_1.arbitrumSdk.markets.getMarketsInfo();
|
|
31
31
|
(0, vitest_1.expect)(response).toBeDefined();
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
(0, vitest_1.describe)("getDailyVolumes", () => {
|
|
35
|
-
(0, vitest_1.it)("should be able to get daily volumes", async () => {
|
|
35
|
+
(0, vitest_1.it)("should be able to get daily volumes", { timeout: 90000 }, async () => {
|
|
36
36
|
const response = await testUtil_1.arbitrumSdk.markets.getDailyVolumes();
|
|
37
37
|
(0, vitest_1.expect)(response).toBeDefined();
|
|
38
|
-
}
|
|
38
|
+
});
|
|
39
39
|
});
|
|
40
40
|
});
|
|
@@ -390,6 +390,14 @@ async function buildMarketsConfigsRequest(chainId, { marketsData, marketsAddress
|
|
|
390
390
|
methodName: "getUint",
|
|
391
391
|
params: [prebuiltHashedKeys.swapImpactExponentFactor],
|
|
392
392
|
},
|
|
393
|
+
withdrawalFeeFactorBalanceWasImproved: {
|
|
394
|
+
methodName: "getUint",
|
|
395
|
+
params: [prebuiltHashedKeys.withdrawalFeeFactorBalanceWasImproved],
|
|
396
|
+
},
|
|
397
|
+
withdrawalFeeFactorBalanceWasNotImproved: {
|
|
398
|
+
methodName: "getUint",
|
|
399
|
+
params: [prebuiltHashedKeys.withdrawalFeeFactorBalanceWasNotImproved],
|
|
400
|
+
},
|
|
393
401
|
virtualMarketId: {
|
|
394
402
|
methodName: "getBytes32",
|
|
395
403
|
params: [prebuiltHashedKeys.virtualMarketId],
|
|
@@ -79,7 +79,7 @@ async function increaseOrderHelper(sdk, params) {
|
|
|
79
79
|
gasPrice,
|
|
80
80
|
tokensData,
|
|
81
81
|
},
|
|
82
|
-
|
|
82
|
+
swapPricingType: orders_1.SwapPricingType.Swap,
|
|
83
83
|
});
|
|
84
84
|
const payOrSizeAmount = "payAmount" in params ? params.payAmount : params.sizeAmount;
|
|
85
85
|
const increaseAmounts = (0, increase_1.getIncreasePositionAmounts)({
|
|
@@ -170,7 +170,7 @@ async function swap(sdk, params) {
|
|
|
170
170
|
gasPrice,
|
|
171
171
|
tokensData,
|
|
172
172
|
},
|
|
173
|
-
|
|
173
|
+
swapPricingType: orders_1.SwapPricingType.Swap,
|
|
174
174
|
});
|
|
175
175
|
const isWrapOrUnwrap = Boolean(fromToken && toToken && ((0, tokens_1.getIsWrap)(fromToken, toToken) || (0, tokens_1.getIsUnwrap)(fromToken, toToken)));
|
|
176
176
|
if (isWrapOrUnwrap) {
|
|
@@ -60,7 +60,7 @@ const tradeAmounts = __importStar(require("../../utils/trade/increase"));
|
|
|
60
60
|
marketsInfoData,
|
|
61
61
|
tokensData,
|
|
62
62
|
};
|
|
63
|
-
});
|
|
63
|
+
}, 90000);
|
|
64
64
|
(0, vitest_1.describe)("validation", () => {
|
|
65
65
|
(0, vitest_1.it)("should throw an error if wrong collateral token selected", async () => {
|
|
66
66
|
const e = await testUtil_1.arbitrumSdk.orders
|
|
@@ -4,7 +4,7 @@ const vitest_1 = require("vitest");
|
|
|
4
4
|
const testUtil_1 = require("../../utils/testUtil");
|
|
5
5
|
(0, vitest_1.describe)("Positions", () => {
|
|
6
6
|
(0, vitest_1.describe)("read", () => {
|
|
7
|
-
(0, vitest_1.it)("should be able to get orders", async () => {
|
|
7
|
+
(0, vitest_1.it)("should be able to get orders", { timeout: 90000 }, async () => {
|
|
8
8
|
const { marketsInfoData, tokensData } = (await testUtil_1.arbitrumSdk.markets.getMarketsInfo()) ?? {};
|
|
9
9
|
if (!tokensData || !marketsInfoData) {
|
|
10
10
|
throw new Error("Tokens data or markets info is not available");
|
|
@@ -4,7 +4,7 @@ const vitest_1 = require("vitest");
|
|
|
4
4
|
const testUtil_1 = require("../../utils/testUtil");
|
|
5
5
|
(0, vitest_1.describe)("Positions", () => {
|
|
6
6
|
(0, vitest_1.describe)("getPositions", () => {
|
|
7
|
-
(0, vitest_1.it)("should be able to get positions data", async () => {
|
|
7
|
+
(0, vitest_1.it)("should be able to get positions data", { timeout: 90000 }, async () => {
|
|
8
8
|
const { marketsInfoData, tokensData } = (await testUtil_1.arbitrumSdk.markets.getMarketsInfo()) ?? {};
|
|
9
9
|
if (!tokensData || !marketsInfoData) {
|
|
10
10
|
throw new Error("Tokens data or markets info is not available");
|
|
@@ -12,7 +12,7 @@ const testUtil_1 = require("../../utils/testUtil");
|
|
|
12
12
|
const positions = await testUtil_1.arbitrumSdk.positions.getPositions({ tokensData, marketsData: marketsInfoData });
|
|
13
13
|
(0, vitest_1.expect)(positions).toBeDefined();
|
|
14
14
|
});
|
|
15
|
-
(0, vitest_1.it)("should be able to get positions info", async () => {
|
|
15
|
+
(0, vitest_1.it)("should be able to get positions info", { timeout: 90000 }, async () => {
|
|
16
16
|
const { marketsInfoData, tokensData } = (await testUtil_1.arbitrumSdk.markets.getMarketsInfo()) ?? {};
|
|
17
17
|
if (!tokensData || !marketsInfoData) {
|
|
18
18
|
throw new Error("Tokens data or markets info is not available");
|
|
@@ -4,7 +4,7 @@ const vitest_1 = require("vitest");
|
|
|
4
4
|
const testUtil_1 = require("../../utils/testUtil");
|
|
5
5
|
const __1 = require("../..");
|
|
6
6
|
(0, vitest_1.describe)("Tokens", () => {
|
|
7
|
-
(0, vitest_1.it)("should be able to fetch tokens", async () => {
|
|
7
|
+
(0, vitest_1.it)("should be able to fetch tokens", { timeout: 90000 }, async () => {
|
|
8
8
|
const response = await testUtil_1.arbitrumSdk.oracle.getTokens();
|
|
9
9
|
(0, vitest_1.expect)(response).toBeDefined();
|
|
10
10
|
});
|
|
@@ -22,7 +22,7 @@ const __1 = require("../..");
|
|
|
22
22
|
(0, vitest_1.expect)(sdk.tokens.tokensConfig[ARB]?.symbol).toBe("testARB");
|
|
23
23
|
(0, vitest_1.expect)(data.tokensData?.[ARB].symbol).toBe("testARB");
|
|
24
24
|
});
|
|
25
|
-
(0, vitest_1.it)("should be able to get tokens data", async () => {
|
|
25
|
+
(0, vitest_1.it)("should be able to get tokens data", { timeout: 90000 }, async () => {
|
|
26
26
|
const response = await testUtil_1.arbitrumSdk.tokens.getTokensData();
|
|
27
27
|
(0, vitest_1.expect)(response).toBeDefined();
|
|
28
28
|
});
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const vitest_1 = require("vitest");
|
|
4
4
|
const testUtil_1 = require("../../utils/testUtil");
|
|
5
5
|
(0, vitest_1.describe)("Trades", () => {
|
|
6
|
-
(0, vitest_1.it)("should be able to get positions", async () => {
|
|
6
|
+
(0, vitest_1.it)("should be able to get positions", { timeout: 90000 }, async () => {
|
|
7
7
|
const { marketsInfoData, tokensData } = await testUtil_1.arbitrumSdk.markets.getMarketsInfo();
|
|
8
8
|
const trades = await testUtil_1.arbitrumSdk.trades.getTradeHistory({
|
|
9
9
|
forAllAccounts: false,
|
|
@@ -5,6 +5,7 @@ const viem_1 = require("viem");
|
|
|
5
5
|
const chains_1 = require("../../configs/chains");
|
|
6
6
|
const contracts_1 = require("../../configs/contracts");
|
|
7
7
|
const dataStore_1 = require("../../configs/dataStore");
|
|
8
|
+
const gasLimits_1 = require("../../configs/gasLimits");
|
|
8
9
|
const bigmath_1 = require("../../utils/bigmath");
|
|
9
10
|
const estimateOraclePriceCount_1 = require("../../utils/fees/estimateOraclePriceCount");
|
|
10
11
|
const executionFee_1 = require("../../utils/fees/executionFee");
|
|
@@ -91,7 +92,7 @@ class Utils extends base_1.Module {
|
|
|
91
92
|
function getBigInt(key) {
|
|
92
93
|
return BigInt(results[key].returnValues[0]);
|
|
93
94
|
}
|
|
94
|
-
const staticGasLimits =
|
|
95
|
+
const staticGasLimits = gasLimits_1.GAS_LIMITS_STATIC_CONFIG[this.chainId];
|
|
95
96
|
return {
|
|
96
97
|
depositToken: getBigInt("depositToken"),
|
|
97
98
|
withdrawalMultiToken: getBigInt("withdrawalMultiToken"),
|
|
@@ -175,7 +176,7 @@ class Utils extends base_1.Module {
|
|
|
175
176
|
return (0, executionFee_1.getExecutionFee)(this.chainId, gasLimits, tokensData, estimatedGas, gasPrice, oraclePriceCount);
|
|
176
177
|
}
|
|
177
178
|
async getGasPrice() {
|
|
178
|
-
const executionFeeConfig = chains_1.
|
|
179
|
+
const executionFeeConfig = (0, chains_1.getExecutionFeeConfig)(this.chainId);
|
|
179
180
|
const feeData = await (0, viem_1.withRetry)(() => this.sdk.publicClient.estimateFeesPerGas({
|
|
180
181
|
chain: (0, chains_1.getViemChain)(this.chainId),
|
|
181
182
|
type: "legacy",
|
|
@@ -187,13 +188,13 @@ class Utils extends base_1.Module {
|
|
|
187
188
|
},
|
|
188
189
|
});
|
|
189
190
|
let gasPrice = feeData.gasPrice ?? 0n;
|
|
190
|
-
if (executionFeeConfig
|
|
191
|
-
const maxPriorityFeePerGas = bigmath_1.bigMath.max(feeData?.maxPriorityFeePerGas ?? 0n, chains_1.
|
|
191
|
+
if (executionFeeConfig?.shouldUseMaxPriorityFeePerGas) {
|
|
192
|
+
const maxPriorityFeePerGas = bigmath_1.bigMath.max(feeData?.maxPriorityFeePerGas ?? 0n, (0, chains_1.getMaxPriorityFeePerGas)(this.chainId) || 0n);
|
|
192
193
|
gasPrice = gasPrice + maxPriorityFeePerGas;
|
|
193
194
|
}
|
|
194
|
-
const premium = chains_1.
|
|
195
|
+
const premium = (0, chains_1.getGasPricePremium)(this.chainId) || 0n;
|
|
195
196
|
const price = gasPrice + premium;
|
|
196
|
-
return
|
|
197
|
+
return BigInt(price);
|
|
197
198
|
}
|
|
198
199
|
async getUiFeeFactor() {
|
|
199
200
|
if (this._uiFeeFactor) {
|
|
@@ -937,6 +937,30 @@
|
|
|
937
937
|
"baseBorrowingFactorShort": "0x420abcc48ffb985a690715aa2b538b95a3f63030f25937dc92d929503644ac74",
|
|
938
938
|
"aboveOptimalUsageBorrowingFactorLong": "0x357d8148aa930b7242653068b7a92fe6430b13a2461daaef913357788d198154",
|
|
939
939
|
"aboveOptimalUsageBorrowingFactorShort": "0x30441063c794feabe17080369a2b2ed756b28c18440a4e95d99242656014e524"
|
|
940
|
+
},
|
|
941
|
+
"0x66AB9D61A0124b61C8892A4ac687Ac48DbA8ff2c": {
|
|
942
|
+
"optimalUsageFactorLong": "0x2cad24e20c277d7f5d15e1ad883481451a46795ee99fcc06daf76114fa3f4ea4",
|
|
943
|
+
"optimalUsageFactorShort": "0x85950d6dae75c22c28212d750531eac58910d63e0d6e0b7968e6aed46a883d8b",
|
|
944
|
+
"baseBorrowingFactorLong": "0x5544458f656bfdf07463e02d9f37a9d124c03e5bb7c40b58d63ca0dc5711739d",
|
|
945
|
+
"baseBorrowingFactorShort": "0x60a57fe035177054d68dc68eb42e1b1560af301cc7d6bba51308167307b529b3",
|
|
946
|
+
"aboveOptimalUsageBorrowingFactorLong": "0xbcb0f4cf170454232e15621cf6bb2e15df23885305f1e4dd42c0d190009445ae",
|
|
947
|
+
"aboveOptimalUsageBorrowingFactorShort": "0x9aad04a946bbc2cf52b78cc92c6acb5c9c1980532e2444f5881a569f7efed575"
|
|
948
|
+
},
|
|
949
|
+
"0x587759c237acCa739bCE3911647BacF56C876E60": {
|
|
950
|
+
"optimalUsageFactorLong": "0x891b86b566f2c8bb0e8c45bcb976fb0f810122c022eac16ff9c579d195a73441",
|
|
951
|
+
"optimalUsageFactorShort": "0x8c236450ac9ff8ccbdb245613178845b9546fcd78869e1d490b5cbe8632cd731",
|
|
952
|
+
"baseBorrowingFactorLong": "0x6f55990e6024b64971d5b0c5f52611fcd80c730731298b1a1cc07996a71357fa",
|
|
953
|
+
"baseBorrowingFactorShort": "0xd66969b8ace1317938aee497955951a451b98cad7007b8108874a312e8c7723a",
|
|
954
|
+
"aboveOptimalUsageBorrowingFactorLong": "0xee2488d7e15a8cf6864f9ed2e82d1fba5dccef82b0c27639a460a169e5931ff0",
|
|
955
|
+
"aboveOptimalUsageBorrowingFactorShort": "0xecc81ea6500775be76e5b9f46a1d6bb62d01a63b8d027c6b8f0de46b5938eb2b"
|
|
956
|
+
},
|
|
957
|
+
"0x00310c6d8A9F821e3FE991f4835f2cA4d87034Cf": {
|
|
958
|
+
"optimalUsageFactorLong": "0x67907416cf716a8ab58e27f24dcf1cb2d5d2c42c3fe8c72018c67e96fa681892",
|
|
959
|
+
"optimalUsageFactorShort": "0xb88c05d1ecbacb28b55b268be130d519f1b85996e7bd78980dbefdeaec357ba5",
|
|
960
|
+
"baseBorrowingFactorLong": "0x1f5cc0e47162ceb52a4376ba4144358dc22d9f4ec8e608dc43ac6e7e9ed8b0b8",
|
|
961
|
+
"baseBorrowingFactorShort": "0x751c8941b4092c9a3ad24fed4204fd80472691e95370bd1fbef865e86da75d77",
|
|
962
|
+
"aboveOptimalUsageBorrowingFactorLong": "0x55e15ee294aa6f6b23491893e6b067805930a7fe5e98629675738761cf1d1f6f",
|
|
963
|
+
"aboveOptimalUsageBorrowingFactorShort": "0xcc46958a3873436f86a9484b826b92d81745e593f5550b125002610d7fd431b1"
|
|
940
964
|
}
|
|
941
965
|
},
|
|
942
966
|
"43113": {
|