@gmx-io/sdk 1.5.0-alpha-7 → 1.5.0-alpha-9
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/clients/v1/testUtil.js +1 -1
- package/build/cjs/src/clients/v2/index.js +42 -9
- package/build/cjs/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +34 -0
- package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +230 -0
- package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +62 -0
- package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -0
- package/build/cjs/src/configs/api.js +4 -3
- package/build/cjs/src/configs/batch.js +13 -0
- package/build/cjs/src/configs/chainIds.js +2 -1
- package/build/cjs/src/configs/chains.js +48 -2
- package/build/cjs/src/configs/contracts.js +67 -0
- package/build/cjs/src/configs/express.js +3 -6
- package/build/cjs/src/configs/fees.js +9 -0
- package/build/cjs/src/configs/gasLimits.js +7 -0
- package/build/cjs/src/configs/markets.js +30 -0
- package/build/cjs/src/configs/oracleKeeper.js +2 -0
- package/build/cjs/src/configs/tokens.js +89 -1
- package/build/cjs/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +2 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/swapOrders.spec.js +1 -0
- package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +24 -0
- package/build/cjs/src/utils/apy/api.js +11 -0
- package/build/cjs/src/utils/apy/types.js +2 -0
- package/build/cjs/src/utils/errors/parseError.js +3 -0
- package/build/cjs/src/utils/fees/executionFee.js +11 -3
- package/build/cjs/src/utils/markets/api.js +16 -1
- package/build/cjs/src/utils/numbers/utils.js +4 -0
- package/build/cjs/src/utils/orderTransactions/utils.js +2 -2
- package/build/cjs/src/utils/pairs/api.js +7 -0
- package/build/cjs/src/utils/pairs/types.js +2 -0
- package/build/cjs/src/utils/performance/api.js +21 -0
- package/build/cjs/src/utils/performance/types.js +2 -0
- package/build/cjs/src/utils/rates/api.js +13 -0
- package/build/cjs/src/utils/rates/types.js +2 -0
- package/build/cjs/src/utils/staking/api.js +11 -0
- package/build/cjs/src/utils/staking/types.js +2 -0
- package/build/cjs/src/utils/swap/swapValues.js +3 -3
- package/build/cjs/src/utils/tokens/api.js +7 -0
- package/build/cjs/src/utils/trade/decrease.js +131 -6
- package/build/cjs/src/utils/trade/increase.js +2 -6
- package/build/cjs/src/utils/twap/uiFeeReceiver.js +29 -13
- package/build/esm/src/clients/v1/testUtil.js +1 -1
- package/build/esm/src/clients/v2/index.js +34 -1
- package/build/esm/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +34 -0
- package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +230 -0
- package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +62 -0
- package/build/esm/src/configs/__tests__/tokens.spec.js +2 -1
- package/build/esm/src/configs/api.js +5 -4
- package/build/esm/src/configs/batch.js +14 -1
- package/build/esm/src/configs/chainIds.js +1 -0
- package/build/esm/src/configs/chains.js +48 -3
- package/build/esm/src/configs/contracts.js +68 -1
- package/build/esm/src/configs/express.js +4 -7
- package/build/esm/src/configs/fees.js +6 -0
- package/build/esm/src/configs/gasLimits.js +8 -1
- package/build/esm/src/configs/markets.js +31 -1
- package/build/esm/src/configs/oracleKeeper.js +3 -1
- package/build/esm/src/configs/tokens.js +90 -2
- package/build/esm/src/utils/__tests__/orderTransactions/decreaseOrders.spec.js +2 -0
- package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
- package/build/esm/src/utils/__tests__/orderTransactions/swapOrders.spec.js +1 -0
- package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +25 -1
- package/build/esm/src/utils/apy/api.js +7 -0
- package/build/esm/src/utils/apy/types.js +1 -0
- package/build/esm/src/utils/errors/parseError.js +3 -0
- package/build/esm/src/utils/fees/executionFee.js +8 -2
- package/build/esm/src/utils/markets/api.js +13 -0
- package/build/esm/src/utils/numbers/utils.js +4 -0
- package/build/esm/src/utils/orderTransactions/utils.js +2 -2
- package/build/esm/src/utils/pairs/api.js +3 -0
- package/build/esm/src/utils/pairs/types.js +1 -0
- package/build/esm/src/utils/performance/api.js +16 -0
- package/build/esm/src/utils/performance/types.js +1 -0
- package/build/esm/src/utils/rates/api.js +9 -0
- package/build/esm/src/utils/rates/types.js +1 -0
- package/build/esm/src/utils/staking/api.js +7 -0
- package/build/esm/src/utils/staking/types.js +1 -0
- package/build/esm/src/utils/swap/swapValues.js +3 -3
- package/build/esm/src/utils/tokens/api.js +3 -0
- package/build/esm/src/utils/trade/decrease.js +127 -7
- package/build/esm/src/utils/trade/increase.js +3 -7
- package/build/esm/src/utils/twap/uiFeeReceiver.js +27 -12
- package/build/types/src/clients/v1/index.d.ts +1 -1
- package/build/types/src/clients/v1/modules/base.d.ts +1 -1
- package/build/types/src/clients/v1/multicall.d.ts +1 -1
- package/build/types/src/clients/v2/index.d.ts +26 -1
- package/build/types/src/codegen/prebuilt/index.d.ts +326 -0
- package/build/types/src/configs/chainIds.d.ts +1 -0
- package/build/types/src/configs/chains.d.ts +26 -6
- package/build/types/src/configs/contracts.d.ts +64 -0
- package/build/types/src/configs/express.d.ts +0 -4
- package/build/types/src/configs/fees.d.ts +4 -0
- package/build/types/src/utils/apy/api.d.ts +5 -0
- package/build/types/src/utils/apy/types.d.ts +13 -0
- package/build/types/src/utils/errors/parseError.d.ts +3 -0
- package/build/types/src/utils/fees/executionFee.d.ts +2 -0
- package/build/types/src/utils/markets/api.d.ts +10 -1
- package/build/types/src/utils/numbers/utils.d.ts +1 -0
- package/build/types/src/utils/orderTransactions/utils.d.ts +2 -1
- package/build/types/src/utils/pairs/api.d.ts +5 -0
- package/build/types/src/utils/pairs/types.d.ts +20 -0
- package/build/types/src/utils/performance/api.d.ts +8 -0
- package/build/types/src/utils/performance/types.d.ts +19 -0
- package/build/types/src/utils/rates/api.d.ts +5 -0
- package/build/types/src/utils/rates/types.d.ts +19 -0
- package/build/types/src/utils/staking/api.d.ts +7 -0
- package/build/types/src/utils/staking/types.d.ts +14 -0
- package/build/types/src/utils/swap/swapValues.d.ts +2 -0
- package/build/types/src/utils/tokens/api.d.ts +5 -0
- package/build/types/src/utils/trade/decrease.d.ts +41 -2
- package/build/types/src/utils/trade/types.d.ts +8 -0
- package/build/types/src/utils/twap/uiFeeReceiver.d.ts +9 -6
- package/package.json +1 -1
|
@@ -203,6 +203,73 @@ exports.CONTRACTS = {
|
|
|
203
203
|
StBTC: "0xF4586028FFdA7Eca636864F80f8a3f2589E33795",
|
|
204
204
|
PBTC: "0x0D2437F93Fed6EA64Ef01cCde385FB1263910C56",
|
|
205
205
|
},
|
|
206
|
+
[chains_1.MEGAETH]: {
|
|
207
|
+
// Synthetics
|
|
208
|
+
DataStore: "0xE43C7B694f6b652a9F4A0f275C008d18758Dce35",
|
|
209
|
+
EventEmitter: "0xAf2E131d483cedE068e21a9228aD91E623a989C2",
|
|
210
|
+
SubaccountRouter: "0x3133aC88af73d3187f1700a2426AD95B5d6E0562",
|
|
211
|
+
ExchangeRouter: "0x73B3593F01CF8e573a412D1d0c972b581794ebE0",
|
|
212
|
+
DepositVault: "0x8231A60862F9b0bA93fFA050c0E94AC902D901d2",
|
|
213
|
+
WithdrawalVault: "0x0Ec53dda9676219dE63eC703212219b07811F33C",
|
|
214
|
+
OrderVault: "0xD5AE04762E2afb1506695b3F36286EBE7B0E6772",
|
|
215
|
+
ShiftVault: "0xC255c70b50623054CADbAD9A02E1CFE73d286666",
|
|
216
|
+
SyntheticsReader: "0x0f038EB4a38B08cd3c937a3256b51aa01904a684",
|
|
217
|
+
SyntheticsRouter: "0x1eAfB14236C489C28845EC04F78DECA5Fb9879Aa",
|
|
218
|
+
GlvReader: "0x424527a588D56513cB2F5161958D83883EE8aB0f",
|
|
219
|
+
GlvRouter: "0x505F0cCADA00F0CcB4EEbf6467531cF4dd907B0E",
|
|
220
|
+
GlvVault: "0x52e4875EB5603d21912d30A1dBA6B0B97192459A",
|
|
221
|
+
GelatoRelayRouter: "0x24eD625B9C47fDEbF088A4d12B7f9B4B2f556297",
|
|
222
|
+
SubaccountGelatoRelayRouter: "0xD515fA0B4d704f3E2C57270F1F53BEeE16348B3b",
|
|
223
|
+
MultichainClaimsRouter: "0xfE9fD31e499bA6d8733Aec49ECe5b41381103433",
|
|
224
|
+
MultichainGlvRouter: "0x7EF7d01316425de5d7C2EFDf8b802A250c222faB",
|
|
225
|
+
MultichainGmRouter: "0x041336A3DaF0a12d004a95f1511393d9A3d7236d",
|
|
226
|
+
MultichainOrderRouter: "0x976363dFbA3AeB8Fb10b733baD74e7099cCB558A",
|
|
227
|
+
MultichainSubaccountRouter: "0xeB8f828A4B89dc3A854f278227A2A5E136E50bF9",
|
|
228
|
+
MultichainTransferRouter: "0xCa62C570D8667a00A56EB989881ECbA4364BFe9e",
|
|
229
|
+
MultichainVault: "0xd6922E889cE4CF14e59427F20e7d857ff81A5A9D",
|
|
230
|
+
LayerZeroProvider: "0x9c41F854f123a7905907FfcF2578dFB7E47D02E0",
|
|
231
|
+
ChainlinkPriceFeedProvider: "0x7452c558d45f8afC8c83dAe62C3f8A5BE19c71f6",
|
|
232
|
+
ClaimHandler: "0x7e42e350FEF7c0A766590A6b2F4eF3F38D8A2988",
|
|
233
|
+
// External
|
|
234
|
+
ExternalHandler: "0xa7EE2737249e0099906cB079BCEe85f0bbd837d4",
|
|
235
|
+
OpenOceanRouter: viem_1.zeroAddress,
|
|
236
|
+
Multicall: "0xF516BC01c50eebdBad4d7E506c8f690ae8EAFc52",
|
|
237
|
+
LayerZeroEndpoint: "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B",
|
|
238
|
+
ArbitrumNodeInterface: viem_1.zeroAddress,
|
|
239
|
+
GelatoRelayAddress: "0xcd565435e0d2109feFde337a66491541Df0D1420",
|
|
240
|
+
Vault: viem_1.zeroAddress,
|
|
241
|
+
Reader: viem_1.zeroAddress,
|
|
242
|
+
PositionRouter: viem_1.zeroAddress,
|
|
243
|
+
ReferralStorage: "0xAd917849372eaEF498E982F90bA6459a43ecbd31",
|
|
244
|
+
VaultReader: viem_1.zeroAddress,
|
|
245
|
+
GlpManager: viem_1.zeroAddress,
|
|
246
|
+
RewardRouter: viem_1.zeroAddress,
|
|
247
|
+
RewardReader: viem_1.zeroAddress,
|
|
248
|
+
GlpRewardRouter: viem_1.zeroAddress,
|
|
249
|
+
StakedGmxTracker: viem_1.zeroAddress,
|
|
250
|
+
FeeGmxTracker: viem_1.zeroAddress,
|
|
251
|
+
GLP: viem_1.zeroAddress,
|
|
252
|
+
GMX: viem_1.zeroAddress,
|
|
253
|
+
ES_GMX: viem_1.zeroAddress,
|
|
254
|
+
BN_GMX: viem_1.zeroAddress,
|
|
255
|
+
USDG: viem_1.zeroAddress,
|
|
256
|
+
BonusGmxTracker: viem_1.zeroAddress,
|
|
257
|
+
StakedGlpTracker: viem_1.zeroAddress,
|
|
258
|
+
FeeGlpTracker: viem_1.zeroAddress,
|
|
259
|
+
ExtendedGmxTracker: viem_1.zeroAddress,
|
|
260
|
+
StakedGmxDistributor: viem_1.zeroAddress,
|
|
261
|
+
StakedGlpDistributor: viem_1.zeroAddress,
|
|
262
|
+
GmxVester: viem_1.zeroAddress,
|
|
263
|
+
GlpVester: viem_1.zeroAddress,
|
|
264
|
+
AffiliateVester: viem_1.zeroAddress,
|
|
265
|
+
Router: viem_1.zeroAddress,
|
|
266
|
+
GovToken: viem_1.zeroAddress,
|
|
267
|
+
ES_GMX_IOU: viem_1.zeroAddress,
|
|
268
|
+
OrderBook: viem_1.zeroAddress,
|
|
269
|
+
UniswapGmxEthPool: viem_1.zeroAddress,
|
|
270
|
+
// megaeth specific
|
|
271
|
+
NATIVE_TOKEN: "0x4200000000000000000000000000000000000006",
|
|
272
|
+
},
|
|
206
273
|
[chains_1.AVALANCHE_FUJI]: {
|
|
207
274
|
// V1
|
|
208
275
|
Vault: viem_1.zeroAddress,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRelayerFeeToken = exports.getDefaultGasPaymentToken = exports.getGasPaymentTokens = exports.
|
|
3
|
+
exports.getRelayerFeeToken = exports.getDefaultGasPaymentToken = exports.getGasPaymentTokens = exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = exports.GELATO_API_KEYS = exports.MIN_RELAYER_FEE_USD = exports.DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = exports.DEFAULT_PERMIT_DEADLINE_DURATION = exports.DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = exports.DEFAULT_SUBACCOUNT_EXPIRY_DURATION = exports.SUBACCOUNT_DOCS_URL = exports.SUBACCOUNT_MESSAGE = void 0;
|
|
4
4
|
const numbers_1 = require("../utils/numbers");
|
|
5
5
|
const time_1 = require("../utils/time");
|
|
6
6
|
const chains_1 = require("./chains");
|
|
@@ -17,13 +17,9 @@ exports.GELATO_API_KEYS = {
|
|
|
17
17
|
[chains_1.AVALANCHE]: "FalsQh9loL6V0rwPy4gWgnQPR6uTHfWjSVT2qlTzUq4_",
|
|
18
18
|
[chains_1.BOTANIX]: "s5GgkfX7dvd_2uYqsRSCjzMekUrXh0dibUvfLab1Anc_",
|
|
19
19
|
[chains_1.ARBITRUM_SEPOLIA]: "nx5nyAg4h2kI_64YtOuPt7LSPDEXo4u8eJY_idF9xDw_",
|
|
20
|
+
[chains_1.MEGAETH]: "MDPcJgFTWgc8ifFElmv_vHLaioG_h8GU2ZDju1eyQ4Y_",
|
|
20
21
|
};
|
|
21
22
|
exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
|
|
22
|
-
exports.EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER = 20;
|
|
23
|
-
exports.EXPRESS_DEFAULT_MIN_RESIDUAL_USD = (0, numbers_1.expandDecimals)(exports.EXPRESS_DEFAULT_MIN_RESIDUAL_USD_NUMBER, numbers_1.USD_DECIMALS);
|
|
24
|
-
const EXPRESS_DEFAULT_MAX_RESIDUAL_USD_NUMBER = 40;
|
|
25
|
-
exports.EXPRESS_DEFAULT_MAX_RESIDUAL_USD = (0, numbers_1.expandDecimals)(EXPRESS_DEFAULT_MAX_RESIDUAL_USD_NUMBER, numbers_1.USD_DECIMALS);
|
|
26
|
-
exports.EXPRESS_RESIDUAL_AMOUNT_MULTIPLIER = 20n;
|
|
27
23
|
const GAS_PAYMENT_TOKENS = {
|
|
28
24
|
[chains_1.ARBITRUM]: [
|
|
29
25
|
(0, tokens_1.getTokenBySymbol)(chains_1.ARBITRUM, "USDC").address,
|
|
@@ -44,6 +40,7 @@ const GAS_PAYMENT_TOKENS = {
|
|
|
44
40
|
(0, tokens_1.getTokenBySymbol)(chains_1.ARBITRUM_SEPOLIA, "WETH").address,
|
|
45
41
|
],
|
|
46
42
|
[chains_1.BOTANIX]: [(0, tokens_1.getTokenBySymbol)(chains_1.BOTANIX, "pBTC").address],
|
|
43
|
+
[chains_1.MEGAETH]: [(0, tokens_1.getTokenBySymbol)(chains_1.MEGAETH, "USDM").address, (0, tokens_1.getTokenBySymbol)(chains_1.MEGAETH, "WETH").address],
|
|
47
44
|
};
|
|
48
45
|
function getGasPaymentTokens(chainId) {
|
|
49
46
|
return GAS_PAYMENT_TOKENS[chainId];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RESIDUAL_GAS_AMOUNT_MULTIPLIER = exports.DEFAULT_MAX_RESIDUAL_GAS_USD = exports.DEFAULT_MIN_RESIDUAL_GAS_USD = exports.DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER = void 0;
|
|
4
|
+
const numbers_1 = require("../utils/numbers");
|
|
5
|
+
exports.DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER = 20;
|
|
6
|
+
exports.DEFAULT_MIN_RESIDUAL_GAS_USD = (0, numbers_1.expandDecimals)(exports.DEFAULT_MIN_RESIDUAL_GAS_USD_NUMBER, numbers_1.USD_DECIMALS);
|
|
7
|
+
const DEFAULT_MAX_RESIDUAL_GAS_USD_NUMBER = 40;
|
|
8
|
+
exports.DEFAULT_MAX_RESIDUAL_GAS_USD = (0, numbers_1.expandDecimals)(DEFAULT_MAX_RESIDUAL_GAS_USD_NUMBER, numbers_1.USD_DECIMALS);
|
|
9
|
+
exports.RESIDUAL_GAS_AMOUNT_MULTIPLIER = 20n;
|
|
@@ -38,4 +38,11 @@ exports.GAS_LIMITS_STATIC_CONFIG = {
|
|
|
38
38
|
tokenPermitGasLimit: 90000n,
|
|
39
39
|
gmxAccountCollateralGasLimit: 0n,
|
|
40
40
|
},
|
|
41
|
+
[chainIds_1.MEGAETH]: {
|
|
42
|
+
createOrderGasLimit: 4000000n,
|
|
43
|
+
updateOrderGasLimit: 3200000n,
|
|
44
|
+
cancelOrderGasLimit: 2800000n,
|
|
45
|
+
tokenPermitGasLimit: 360000n,
|
|
46
|
+
gmxAccountCollateralGasLimit: 0n,
|
|
47
|
+
},
|
|
41
48
|
};
|
|
@@ -1249,6 +1249,36 @@ exports.MARKETS = {
|
|
|
1249
1249
|
shortTokenAddress: "0x0D2437F93Fed6EA64Ef01cCde385FB1263910C56",
|
|
1250
1250
|
},
|
|
1251
1251
|
},
|
|
1252
|
+
[chains_1.MEGAETH]: {
|
|
1253
|
+
// BTC/USD [USDM-USDM]
|
|
1254
|
+
"0x31EdCc52bE2Fa55Ba68f50409F9e6b7d9EbF3D59": {
|
|
1255
|
+
marketTokenAddress: "0x31EdCc52bE2Fa55Ba68f50409F9e6b7d9EbF3D59",
|
|
1256
|
+
indexTokenAddress: "0xc258141Ad80cafF9ab82a04bEb1c10F4B5bCb8F4",
|
|
1257
|
+
longTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
|
|
1258
|
+
shortTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
|
|
1259
|
+
},
|
|
1260
|
+
// ETH/USD [USDM-USDM]
|
|
1261
|
+
"0x9b1B72720f6D277F3b1e607a0c5fab1B300248b1": {
|
|
1262
|
+
marketTokenAddress: "0x9b1B72720f6D277F3b1e607a0c5fab1B300248b1",
|
|
1263
|
+
indexTokenAddress: "0x4200000000000000000000000000000000000006",
|
|
1264
|
+
longTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
|
|
1265
|
+
shortTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
|
|
1266
|
+
},
|
|
1267
|
+
// SOL/USD [USDM-USDM]
|
|
1268
|
+
"0xe8E716F1cddfFD0698B86919D41A8228d701fEe9": {
|
|
1269
|
+
marketTokenAddress: "0xe8E716F1cddfFD0698B86919D41A8228d701fEe9",
|
|
1270
|
+
indexTokenAddress: "0x30998706b1e5C95e9d3645D2e9E0EB1466819962",
|
|
1271
|
+
longTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
|
|
1272
|
+
shortTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
|
|
1273
|
+
},
|
|
1274
|
+
// SWAP-ONLY [ETH-USDM]
|
|
1275
|
+
"0xc5c9B5E23810565763De41144741477eeCB25e2e": {
|
|
1276
|
+
marketTokenAddress: "0xc5c9B5E23810565763De41144741477eeCB25e2e",
|
|
1277
|
+
indexTokenAddress: "0x0000000000000000000000000000000000000000",
|
|
1278
|
+
longTokenAddress: "0x4200000000000000000000000000000000000006",
|
|
1279
|
+
shortTokenAddress: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
|
|
1280
|
+
},
|
|
1281
|
+
},
|
|
1252
1282
|
};
|
|
1253
1283
|
function getMarketsByChainId(chainId) {
|
|
1254
1284
|
if (!exports.MARKETS[chainId]) {
|
|
@@ -20,6 +20,7 @@ const ORACLE_KEEPER_URLS = {
|
|
|
20
20
|
[chains_1.AVALANCHE]: "https://avalanche-api.gmxinfra.io",
|
|
21
21
|
[chains_1.AVALANCHE_FUJI]: "https://synthetics-api-avax-fuji-upovm.ondigitalocean.app",
|
|
22
22
|
[chains_1.BOTANIX]: "https://botanix-api.gmxinfra.io",
|
|
23
|
+
[chains_1.MEGAETH]: "https://megaeth-api.gmxinfra.io",
|
|
23
24
|
[chains_1.ARBITRUM_SEPOLIA]: "https://dolphin-app-a2dup.ondigitalocean.app",
|
|
24
25
|
};
|
|
25
26
|
const ORACLE_KEEPER_FALLBACK_URLS = {
|
|
@@ -27,6 +28,7 @@ const ORACLE_KEEPER_FALLBACK_URLS = {
|
|
|
27
28
|
[chains_1.AVALANCHE]: ["https://avalanche-api-fallback.gmxinfra.io", "https://avalanche-api-fallback.gmxinfra2.io"],
|
|
28
29
|
[chains_1.AVALANCHE_FUJI]: ["https://synthetics-api-avax-fuji.gmxinfra.io"],
|
|
29
30
|
[chains_1.BOTANIX]: ["https://botanix-api-fallback.gmxinfra.io", "https://botanix-api-fallback.gmxinfra2.io"],
|
|
31
|
+
[chains_1.MEGAETH]: ["https://megaeth-api-fallback.gmxinfra.io"],
|
|
30
32
|
[chains_1.ARBITRUM_SEPOLIA]: ["https://dolphin-app-a2dup.ondigitalocean.app"],
|
|
31
33
|
};
|
|
32
34
|
function getOracleKeeperUrl(chainId) {
|
|
@@ -1964,6 +1964,94 @@ exports.TOKENS = {
|
|
|
1964
1964
|
isPlatformToken: true,
|
|
1965
1965
|
},
|
|
1966
1966
|
],
|
|
1967
|
+
[chains_1.MEGAETH]: [
|
|
1968
|
+
{
|
|
1969
|
+
name: "Ethereum",
|
|
1970
|
+
symbol: "ETH",
|
|
1971
|
+
address: exports.NATIVE_TOKEN_ADDRESS,
|
|
1972
|
+
decimals: 18,
|
|
1973
|
+
isNative: true,
|
|
1974
|
+
isShortable: true,
|
|
1975
|
+
categories: ["layer1"],
|
|
1976
|
+
imageUrl: "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
name: "Wrapped Ethereum",
|
|
1980
|
+
symbol: "WETH",
|
|
1981
|
+
address: "0x4200000000000000000000000000000000000006",
|
|
1982
|
+
decimals: 18,
|
|
1983
|
+
isWrapped: true,
|
|
1984
|
+
baseSymbol: "ETH",
|
|
1985
|
+
imageUrl: "https://assets.coingecko.com/coins/images/2518/thumb/weth.png?1628852295",
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
name: "Bitcoin",
|
|
1989
|
+
symbol: "BTC",
|
|
1990
|
+
address: "0xc258141Ad80cafF9ab82a04bEb1c10F4B5bCb8F4",
|
|
1991
|
+
isSynthetic: true,
|
|
1992
|
+
decimals: 8,
|
|
1993
|
+
categories: ["layer1"],
|
|
1994
|
+
imageUrl: "https://assets.coingecko.com/coins/images/7598/thumb/wrapped_bitcoin_wbtc.png?1548822744",
|
|
1995
|
+
},
|
|
1996
|
+
{
|
|
1997
|
+
name: "Solana",
|
|
1998
|
+
symbol: "SOL",
|
|
1999
|
+
address: "0x30998706b1e5C95e9d3645D2e9E0EB1466819962",
|
|
2000
|
+
isSynthetic: true,
|
|
2001
|
+
priceDecimals: 3,
|
|
2002
|
+
decimals: 9,
|
|
2003
|
+
categories: ["layer1"],
|
|
2004
|
+
imageUrl: "https://assets.coingecko.com/coins/images/4128/small/solana.png?1640133422",
|
|
2005
|
+
},
|
|
2006
|
+
{
|
|
2007
|
+
name: "USDM",
|
|
2008
|
+
symbol: "USDM",
|
|
2009
|
+
address: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
|
|
2010
|
+
decimals: 18,
|
|
2011
|
+
isStable: true,
|
|
2012
|
+
imageUrl: "https://assets.coingecko.com/coins/images/69955/standard/USDm.png?1760170136",
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
name: "GMX",
|
|
2016
|
+
symbol: "GMX",
|
|
2017
|
+
address: GMX_STUB_ADDRESS,
|
|
2018
|
+
decimals: 18,
|
|
2019
|
+
imageUrl: "https://assets.coingecko.com/coins/images/18323/small/arbit.png?1631532468",
|
|
2020
|
+
isPlatformToken: true,
|
|
2021
|
+
},
|
|
2022
|
+
{
|
|
2023
|
+
name: "Escrowed GMX",
|
|
2024
|
+
symbol: "ESGMX",
|
|
2025
|
+
address: ESGMX_STUB_ADDRESS,
|
|
2026
|
+
decimals: 18,
|
|
2027
|
+
isPlatformToken: true,
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
name: "GMX LP",
|
|
2031
|
+
symbol: "GLP",
|
|
2032
|
+
address: GLP_STUB_ADDRESS,
|
|
2033
|
+
decimals: 18,
|
|
2034
|
+
imageUrl: "https://github.com/gmx-io/gmx-assets/blob/main/GMX-Assets/PNG/GLP_LOGO%20ONLY.png?raw=true",
|
|
2035
|
+
isPlatformToken: true,
|
|
2036
|
+
},
|
|
2037
|
+
/** Placeholder tokens */
|
|
2038
|
+
{
|
|
2039
|
+
name: "GMX Market tokens",
|
|
2040
|
+
symbol: "GM",
|
|
2041
|
+
address: exports.GM_STUB_ADDRESS,
|
|
2042
|
+
decimals: 18,
|
|
2043
|
+
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GM_LOGO.png",
|
|
2044
|
+
isPlatformToken: true,
|
|
2045
|
+
},
|
|
2046
|
+
{
|
|
2047
|
+
name: "GLV Market tokens",
|
|
2048
|
+
symbol: "GLV",
|
|
2049
|
+
address: exports.GLV_STUB_ADDRESS,
|
|
2050
|
+
decimals: 18,
|
|
2051
|
+
imageUrl: "https://raw.githubusercontent.com/gmx-io/gmx-assets/main/GMX-Assets/PNG/GLV_LOGO.png",
|
|
2052
|
+
isPlatformToken: true,
|
|
2053
|
+
},
|
|
2054
|
+
],
|
|
1967
2055
|
};
|
|
1968
2056
|
exports.TOKEN_COLOR_MAP = {
|
|
1969
2057
|
ETH: "#6062a6",
|
|
@@ -2007,7 +2095,7 @@ exports.SYNTHETIC_TOKENS = {};
|
|
|
2007
2095
|
exports.TOKENS_BY_SYMBOL_MAP = {};
|
|
2008
2096
|
exports.WRAPPED_TOKENS_MAP = {};
|
|
2009
2097
|
exports.NATIVE_TOKENS_MAP = {};
|
|
2010
|
-
const CHAIN_IDS = [chains_1.ARBITRUM, chains_1.AVALANCHE, chains_1.AVALANCHE_FUJI, chains_1.BOTANIX, chains_1.ARBITRUM_SEPOLIA];
|
|
2098
|
+
const CHAIN_IDS = [chains_1.ARBITRUM, chains_1.AVALANCHE, chains_1.AVALANCHE_FUJI, chains_1.BOTANIX, chains_1.ARBITRUM_SEPOLIA, chains_1.MEGAETH];
|
|
2011
2099
|
for (let j = 0; j < CHAIN_IDS.length; j++) {
|
|
2012
2100
|
const chainId = CHAIN_IDS[j];
|
|
2013
2101
|
exports.TOKENS_MAP[chainId] = {};
|
|
@@ -376,6 +376,7 @@ const uiFeeReceiver_1 = require("../../twap/uiFeeReceiver");
|
|
|
376
376
|
twapId: "8000",
|
|
377
377
|
numberOfParts: twapParams.numberOfParts,
|
|
378
378
|
isExpress: false,
|
|
379
|
+
isJit: false,
|
|
379
380
|
});
|
|
380
381
|
return {
|
|
381
382
|
orderPayload: {
|
|
@@ -470,6 +471,7 @@ const uiFeeReceiver_1 = require("../../twap/uiFeeReceiver");
|
|
|
470
471
|
const decoded = (0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)(uiFeeReceiver);
|
|
471
472
|
(0, vitest_1.expect)(decoded).toEqual({
|
|
472
473
|
isExpress: false,
|
|
474
|
+
isJit: false,
|
|
473
475
|
twapId: "8000",
|
|
474
476
|
numberOfParts: twapParams.numberOfParts,
|
|
475
477
|
});
|
|
@@ -544,6 +544,7 @@ const uiFeeReceiver_1 = require("../../twap/uiFeeReceiver");
|
|
|
544
544
|
const decoded = (0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)(uiFeeReceiver);
|
|
545
545
|
(0, vitest_1.expect)(decoded).toEqual({
|
|
546
546
|
isExpress: false,
|
|
547
|
+
isJit: false,
|
|
547
548
|
twapId: "8000",
|
|
548
549
|
numberOfParts: twapParams.numberOfParts,
|
|
549
550
|
});
|
|
@@ -640,6 +641,7 @@ const uiFeeReceiver_1 = require("../../twap/uiFeeReceiver");
|
|
|
640
641
|
const decoded = (0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)(uiFeeReceiver);
|
|
641
642
|
(0, vitest_1.expect)(decoded).toEqual({
|
|
642
643
|
isExpress: false,
|
|
644
|
+
isJit: false,
|
|
643
645
|
twapId: "8000",
|
|
644
646
|
numberOfParts: twapParams.numberOfParts,
|
|
645
647
|
});
|
|
@@ -16,6 +16,15 @@ const uiFeeReceiver_1 = require("../twap/uiFeeReceiver");
|
|
|
16
16
|
(0, vitest_1.it)("should correctly decode isExpress", () => {
|
|
17
17
|
(0, vitest_1.expect)((0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)("0xff0000000000000000000000000000010a123401")).toEqual({
|
|
18
18
|
isExpress: true,
|
|
19
|
+
isJit: false,
|
|
20
|
+
twapId: "1234",
|
|
21
|
+
numberOfParts: 10,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.it)("should correctly decode isJit", () => {
|
|
25
|
+
(0, vitest_1.expect)((0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)("0xff0000000000000000000000000001000a123401")).toEqual({
|
|
26
|
+
isExpress: false,
|
|
27
|
+
isJit: true,
|
|
19
28
|
twapId: "1234",
|
|
20
29
|
numberOfParts: 10,
|
|
21
30
|
});
|
|
@@ -23,11 +32,13 @@ const uiFeeReceiver_1 = require("../twap/uiFeeReceiver");
|
|
|
23
32
|
(0, vitest_1.it)("should return the twapId and numberOfParts if the uiFeeReceiver is valid twap", () => {
|
|
24
33
|
(0, vitest_1.expect)((0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)("0xff0000000000000000000000000000000a123401")).toEqual({
|
|
25
34
|
isExpress: false,
|
|
35
|
+
isJit: false,
|
|
26
36
|
twapId: "1234",
|
|
27
37
|
numberOfParts: 10,
|
|
28
38
|
});
|
|
29
39
|
(0, vitest_1.expect)((0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)("0xff000000000000000000000000000000153a4f01")).toEqual({
|
|
30
40
|
isExpress: false,
|
|
41
|
+
isJit: false,
|
|
31
42
|
twapId: "3a4f",
|
|
32
43
|
numberOfParts: 21,
|
|
33
44
|
});
|
|
@@ -62,3 +73,16 @@ const uiFeeReceiver_1 = require("../twap/uiFeeReceiver");
|
|
|
62
73
|
(0, vitest_1.expect)((0, uiFeeReceiver_1.setUiFeeReceiverIsExpress)("0xff0000000000000000000000000000000a123401", false)).toEqual("0xff0000000000000000000000000000000a123401");
|
|
63
74
|
});
|
|
64
75
|
});
|
|
76
|
+
(0, vitest_1.describe)("setUiFeeReceiverIsJit", () => {
|
|
77
|
+
(0, vitest_1.it)("should correctly set isJit for simple uiFeeReceiver", () => {
|
|
78
|
+
(0, vitest_1.expect)((0, uiFeeReceiver_1.setUiFeeReceiverIsJit)("0xff00000000000000000000000000000000000001", true)).toEqual("0xff00000000000000000000000000010000000001");
|
|
79
|
+
(0, vitest_1.expect)((0, uiFeeReceiver_1.setUiFeeReceiverIsJit)("0xff00000000000000000000000000010000000001", false)).toEqual("0xff00000000000000000000000000000000000001");
|
|
80
|
+
});
|
|
81
|
+
(0, vitest_1.it)("should preserve isExpress when setting isJit", () => {
|
|
82
|
+
(0, vitest_1.expect)((0, uiFeeReceiver_1.setUiFeeReceiverIsJit)("0xff0000000000000000000000000000010a123401", true)).toEqual("0xff0000000000000000000000000001010a123401");
|
|
83
|
+
});
|
|
84
|
+
(0, vitest_1.it)("should correctly set isJit for twap uiFeeReceiver", () => {
|
|
85
|
+
(0, vitest_1.expect)((0, uiFeeReceiver_1.setUiFeeReceiverIsJit)("0xff0000000000000000000000000000000a123401", true)).toEqual("0xff0000000000000000000000000001000a123401");
|
|
86
|
+
(0, vitest_1.expect)((0, uiFeeReceiver_1.setUiFeeReceiverIsJit)("0xff0000000000000000000000000001000a123401", false)).toEqual("0xff0000000000000000000000000000000a123401");
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchApiApy = void 0;
|
|
4
|
+
async function fetchApiApy(ctx, params) {
|
|
5
|
+
return ctx.api.fetchJson("/apy", {
|
|
6
|
+
query: {
|
|
7
|
+
period: params?.period,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
exports.fetchApiApy = fetchApiApy;
|
|
@@ -38,6 +38,7 @@ function extendError(error, params) {
|
|
|
38
38
|
error.errorSource = params.errorSource;
|
|
39
39
|
error.isAdditionalValidationPassed = params.isAdditionalValidationPassed;
|
|
40
40
|
error.additionalValidationType = params.additionalValidationType;
|
|
41
|
+
error.simulationMethod = params.simulationMethod;
|
|
41
42
|
error.data = params.data;
|
|
42
43
|
return error;
|
|
43
44
|
}
|
|
@@ -52,6 +53,7 @@ function parseError(error, errorDepth = 0) {
|
|
|
52
53
|
const errorContext = typeof error === "string" ? undefined : error?.errorContext;
|
|
53
54
|
const isAdditionalValidationPassed = typeof error === "string" ? undefined : error?.isAdditionalValidationPassed;
|
|
54
55
|
const additionalValidationType = typeof error === "string" ? undefined : error?.additionalValidationType;
|
|
56
|
+
const simulationMethod = typeof error === "string" ? undefined : error?.simulationMethod;
|
|
55
57
|
const data = typeof error === "string" ? undefined : error?.data;
|
|
56
58
|
let errorMessage = "Unknown error";
|
|
57
59
|
let errorStack = undefined;
|
|
@@ -161,6 +163,7 @@ function parseError(error, errorDepth = 0) {
|
|
|
161
163
|
parentError,
|
|
162
164
|
isAdditionalValidationPassed,
|
|
163
165
|
additionalValidationType,
|
|
166
|
+
simulationMethod,
|
|
164
167
|
errorDepth,
|
|
165
168
|
};
|
|
166
169
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.estimateExecuteShiftGasLimit = exports.estimateExecuteWithdrawalGasLimit = exports.estimateExecuteGlvWithdrawalGasLimit = exports.estimateExecuteGlvDepositGasLimit = exports.estimateExecuteDepositGasLimit = exports.estimateExecuteSwapOrderGasLimit = exports.estimateExecuteDecreaseOrderGasLimit = exports.estimateExecuteIncreaseOrderGasLimit = exports.estimateBatchMinGasPaymentTokenAmount = exports.estimateBatchGasLimit = exports.approximateL1GasBuffer = exports.estimateRelayerGasLimit = exports.getExecutionFee = void 0;
|
|
3
|
+
exports.estimateExecuteShiftGasLimit = exports.estimateExecuteWithdrawalGasLimit = exports.estimateExecuteGlvWithdrawalGasLimit = exports.estimateExecuteGlvDepositGasLimit = exports.estimateExecuteDepositGasLimit = exports.estimateExecuteSwapOrderGasLimit = exports.estimateExecuteDecreaseOrderGasLimit = exports.estimateExecuteIncreaseOrderGasLimit = exports.estimateBatchMinGasPaymentTokenAmount = exports.estimateBatchGasLimit = exports.approximateL1GasBuffer = exports.estimateRelayerGasLimit = exports.getExecutionFee = exports.getIsExecutionFeeVeryHigh = exports.getIsExecutionFeeHigh = void 0;
|
|
4
4
|
const chains_1 = require("../../configs/chains");
|
|
5
5
|
const factors_1 = require("../../configs/factors");
|
|
6
6
|
const tokens_1 = require("../../configs/tokens");
|
|
@@ -8,6 +8,14 @@ const bigmath_1 = require("../bigmath");
|
|
|
8
8
|
const numbers_1 = require("../numbers");
|
|
9
9
|
const types_1 = require("../orders/types");
|
|
10
10
|
const tokens_2 = require("../tokens");
|
|
11
|
+
function getIsExecutionFeeHigh(chainId, feeUsd) {
|
|
12
|
+
return feeUsd > (0, numbers_1.expandDecimals)((0, chains_1.getHighExecutionFee)(chainId), factors_1.USD_DECIMALS);
|
|
13
|
+
}
|
|
14
|
+
exports.getIsExecutionFeeHigh = getIsExecutionFeeHigh;
|
|
15
|
+
function getIsExecutionFeeVeryHigh(chainId, feeUsd) {
|
|
16
|
+
return feeUsd > (0, numbers_1.expandDecimals)((0, chains_1.getExcessiveExecutionFee)(chainId), factors_1.USD_DECIMALS);
|
|
17
|
+
}
|
|
18
|
+
exports.getIsExecutionFeeVeryHigh = getIsExecutionFeeVeryHigh;
|
|
11
19
|
function getExecutionFee(chainId, gasLimits,
|
|
12
20
|
// TODO optimize we only need the native token data
|
|
13
21
|
tokensData, estimatedGasLimit, gasPrice, oraclePriceCount, numberOfParts) {
|
|
@@ -29,8 +37,8 @@ tokensData, estimatedGasLimit, gasPrice, oraclePriceCount, numberOfParts) {
|
|
|
29
37
|
}
|
|
30
38
|
const feeTokenAmount = feeTokenAmountPerExecution * BigInt(numberOfParts ?? 1);
|
|
31
39
|
const feeUsd = (0, tokens_2.convertToUsd)(feeTokenAmount, nativeToken.decimals, nativeToken.prices.minPrice);
|
|
32
|
-
const isFeeHigh =
|
|
33
|
-
const isFeeVeryHigh =
|
|
40
|
+
const isFeeHigh = getIsExecutionFeeHigh(chainId, feeUsd);
|
|
41
|
+
const isFeeVeryHigh = getIsExecutionFeeVeryHigh(chainId, feeUsd);
|
|
34
42
|
return {
|
|
35
43
|
feeUsd,
|
|
36
44
|
feeTokenAmount,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchApiTokensData = exports.fetchApiMarketsInfo = void 0;
|
|
3
|
+
exports.fetchApiMarketsTickers = exports.fetchApiMarkets = exports.fetchApiTokensData = exports.fetchApiMarketsInfo = void 0;
|
|
4
4
|
const numbers_1 = require("../numbers");
|
|
5
5
|
async function fetchApiMarketsInfo(ctx) {
|
|
6
6
|
const mInfos = await ctx.api.fetchJson("/markets/info");
|
|
@@ -12,3 +12,18 @@ async function fetchApiTokensData(ctx) {
|
|
|
12
12
|
return tInfos.map((tInfo) => (0, numbers_1.deserializeBigIntsInObject)(tInfo, { handleInts: true }));
|
|
13
13
|
}
|
|
14
14
|
exports.fetchApiTokensData = fetchApiTokensData;
|
|
15
|
+
async function fetchApiMarkets(ctx) {
|
|
16
|
+
const markets = await ctx.api.fetchJson("/markets");
|
|
17
|
+
return markets.map((m) => (0, numbers_1.deserializeBigIntsInObject)(m, { handleInts: true }));
|
|
18
|
+
}
|
|
19
|
+
exports.fetchApiMarkets = fetchApiMarkets;
|
|
20
|
+
async function fetchApiMarketsTickers(ctx, params) {
|
|
21
|
+
const tickers = await ctx.api.fetchJson("/markets/tickers", {
|
|
22
|
+
query: {
|
|
23
|
+
addresses: params?.addresses,
|
|
24
|
+
symbols: params?.symbols,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return tickers.map((t) => (0, numbers_1.deserializeBigIntsInObject)(t, { handleInts: true }));
|
|
28
|
+
}
|
|
29
|
+
exports.fetchApiMarketsTickers = fetchApiMarketsTickers;
|
|
@@ -137,6 +137,10 @@ function formatUsd(usd, opts = {}) {
|
|
|
137
137
|
if (opts.visualMultiplier) {
|
|
138
138
|
usd *= BigInt(opts.visualMultiplier);
|
|
139
139
|
}
|
|
140
|
+
if (opts.roundMode === "floor" && displayDecimals < exports.USD_DECIMALS) {
|
|
141
|
+
const factor = expandDecimals(1, exports.USD_DECIMALS - displayDecimals);
|
|
142
|
+
usd = usd >= 0n ? (usd / factor) * factor : ((usd - factor + 1n) / factor) * factor;
|
|
143
|
+
}
|
|
140
144
|
const defaultMinThreshold = displayDecimals > 1 ? "0." + "0".repeat(displayDecimals - 1) + "1" : undefined;
|
|
141
145
|
const exceedingInfo = getLimitedDisplay(usd, exports.USD_DECIMALS, {
|
|
142
146
|
maxThreshold: opts.maxThreshold,
|
|
@@ -283,8 +283,8 @@ function buildUpdateOrderPayload(p) {
|
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
285
|
exports.buildUpdateOrderPayload = buildUpdateOrderPayload;
|
|
286
|
-
function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, }) {
|
|
287
|
-
if (getIsEmptyBatch(batchParams)) {
|
|
286
|
+
function getBatchTotalExecutionFee({ batchParams, tokensData, chainId, allowEmptyBatch = false, }) {
|
|
287
|
+
if (getIsEmptyBatch(batchParams) && !allowEmptyBatch) {
|
|
288
288
|
return undefined;
|
|
289
289
|
}
|
|
290
290
|
let feeTokenAmount = 0n;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchApiPerformanceSnapshots = exports.fetchApiPerformanceAnnualized = void 0;
|
|
4
|
+
async function fetchApiPerformanceAnnualized(ctx, params) {
|
|
5
|
+
return ctx.api.fetchJson("/performance/annualized", {
|
|
6
|
+
query: {
|
|
7
|
+
period: params?.period,
|
|
8
|
+
address: params?.address,
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
exports.fetchApiPerformanceAnnualized = fetchApiPerformanceAnnualized;
|
|
13
|
+
async function fetchApiPerformanceSnapshots(ctx, params) {
|
|
14
|
+
return ctx.api.fetchJson("/performance/snapshots", {
|
|
15
|
+
query: {
|
|
16
|
+
period: params?.period,
|
|
17
|
+
address: params?.address,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.fetchApiPerformanceSnapshots = fetchApiPerformanceSnapshots;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchApiRates = void 0;
|
|
4
|
+
async function fetchApiRates(ctx, params) {
|
|
5
|
+
return ctx.api.fetchJson("/rates", {
|
|
6
|
+
query: {
|
|
7
|
+
period: params?.period,
|
|
8
|
+
averageBy: params?.averageBy,
|
|
9
|
+
address: params?.address,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.fetchApiRates = fetchApiRates;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchApiStakingPower = void 0;
|
|
4
|
+
const numbers_1 = require("../numbers");
|
|
5
|
+
async function fetchApiStakingPower(ctx, params) {
|
|
6
|
+
const data = await ctx.api.fetchJson("/staking/power", {
|
|
7
|
+
query: { address: params.address },
|
|
8
|
+
});
|
|
9
|
+
return (0, numbers_1.deserializeBigIntsInObject)(data, { handleInts: true });
|
|
10
|
+
}
|
|
11
|
+
exports.fetchApiStakingPower = fetchApiStakingPower;
|
|
@@ -80,7 +80,7 @@ function getSwapAmountsByFromValue(p) {
|
|
|
80
80
|
}
|
|
81
81
|
exports.getSwapAmountsByFromValue = getSwapAmountsByFromValue;
|
|
82
82
|
function getSwapAmountsByToValue(p) {
|
|
83
|
-
const { tokenIn, tokenOut, amountOut, triggerRatio, isLimit, uiFeeFactor, swapOptimizationOrder, allowedSwapSlippageBps, marketsInfoData, chainId, externalSwapQuoteParams, allowSameTokenSwap, } = p;
|
|
83
|
+
const { tokenIn, tokenOut, amountOut, triggerRatio, isLimit, uiFeeFactor, swapOptimizationOrder, allowedSwapSlippageBps, marketsInfoData, chainId, externalSwapQuoteParams, allowSameTokenSwap, swapPricingType = types_1.SwapPricingType.Swap, } = p;
|
|
84
84
|
if (!externalSwapQuoteParams) {
|
|
85
85
|
return getSwapAmountsByToValueDefault(p);
|
|
86
86
|
}
|
|
@@ -92,7 +92,7 @@ function getSwapAmountsByToValue(p) {
|
|
|
92
92
|
chainId,
|
|
93
93
|
externalSwapQuoteParams,
|
|
94
94
|
swapOptimizationOrder,
|
|
95
|
-
swapPricingType
|
|
95
|
+
swapPricingType,
|
|
96
96
|
allowSameTokenSwap,
|
|
97
97
|
});
|
|
98
98
|
const swapStrategy = (0, buildSwapStrategy_1.buildSwapStrategy)({
|
|
@@ -103,7 +103,7 @@ function getSwapAmountsByToValue(p) {
|
|
|
103
103
|
chainId,
|
|
104
104
|
swapOptimizationOrder,
|
|
105
105
|
externalSwapQuoteParams,
|
|
106
|
-
swapPricingType
|
|
106
|
+
swapPricingType,
|
|
107
107
|
allowSameTokenSwap,
|
|
108
108
|
});
|
|
109
109
|
const uiFeeUsd = (0, numbers_1.applyFactor)(swapStrategy.usdIn, uiFeeFactor);
|