@gmx-io/sdk 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/src/abis/StBTC.json +1225 -0
- package/build/cjs/src/abis/SyntheticsReader.json +480 -19
- package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -0
- package/build/cjs/src/configs/chains.js +57 -6
- package/build/cjs/src/configs/contracts.js +64 -68
- package/build/cjs/src/configs/dataStore.js +4 -3
- package/build/cjs/src/configs/express.js +2 -1
- package/build/cjs/src/configs/factors.js +2 -1
- package/build/cjs/src/configs/markets.js +37 -0
- package/build/cjs/src/configs/oracleKeeper.js +1 -0
- package/build/cjs/src/configs/tokens.js +130 -1
- package/build/cjs/src/modules/orders/helpers.js +13 -14
- 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/positions/positions.js +9 -0
- package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +42 -0
- package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +257 -0
- package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +77 -0
- package/build/cjs/src/types/subsquid.js +2405 -0
- package/build/cjs/src/utils/__tests__/numbers.spec.js +17 -9
- 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__/prices.spec.js +3 -2
- package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +9 -0
- package/build/cjs/src/utils/errors/transactionsErrors.js +2 -1
- package/build/cjs/src/utils/fees/executionFee.js +9 -1
- package/build/cjs/src/utils/markets.js +2 -2
- package/build/cjs/src/utils/numbers.js +52 -33
- package/build/cjs/src/utils/orderTransactions.js +3 -0
- package/build/cjs/src/utils/orders.js +8 -2
- package/build/cjs/src/utils/prices.js +1 -1
- package/build/cjs/src/utils/swap/swapValues.js +40 -0
- package/build/cjs/src/utils/tokens.js +10 -1
- package/build/cjs/src/utils/tradeHistory.js +4 -4
- package/build/cjs/src/utils/twap/uiFeeReceiver.js +26 -6
- package/build/esm/src/abis/StBTC.json +1225 -0
- package/build/esm/src/abis/SyntheticsReader.json +480 -19
- package/build/esm/src/configs/__tests__/tokens.spec.js +2 -1
- package/build/esm/src/configs/chains.js +56 -5
- package/build/esm/src/configs/contracts.js +65 -69
- package/build/esm/src/configs/dataStore.js +1 -0
- package/build/esm/src/configs/express.js +4 -3
- package/build/esm/src/configs/factors.js +1 -1
- package/build/esm/src/configs/markets.js +38 -1
- package/build/esm/src/configs/oracleKeeper.js +2 -1
- package/build/esm/src/configs/tokens.js +131 -2
- package/build/esm/src/modules/orders/helpers.js +13 -14
- 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/positions/positions.js +9 -0
- package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +42 -0
- package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +257 -0
- package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +77 -0
- package/build/esm/src/types/subsquid.js +2402 -0
- package/build/esm/src/utils/__tests__/numbers.spec.js +18 -10
- 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__/prices.spec.js +3 -2
- package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +9 -0
- package/build/esm/src/utils/errors/transactionsErrors.js +2 -1
- package/build/esm/src/utils/fees/executionFee.js +11 -3
- package/build/esm/src/utils/markets.js +2 -2
- package/build/esm/src/utils/numbers.js +51 -31
- package/build/esm/src/utils/orderTransactions.js +3 -0
- package/build/esm/src/utils/orders.js +8 -2
- package/build/esm/src/utils/prices.js +1 -1
- package/build/esm/src/utils/swap/swapValues.js +41 -1
- package/build/esm/src/utils/tokens.js +7 -0
- package/build/esm/src/utils/tradeHistory.js +4 -4
- package/build/esm/src/utils/twap/uiFeeReceiver.js +24 -5
- package/build/types/src/configs/chains.d.ts +20 -37
- package/build/types/src/configs/contracts.d.ts +60 -63
- package/build/types/src/configs/dataStore.d.ts +1 -0
- package/build/types/src/configs/factors.d.ts +1 -1
- package/build/types/src/configs/markets.d.ts +2 -1
- package/build/types/src/configs/oracleKeeper.d.ts +1 -1
- package/build/types/src/configs/tokens.d.ts +1 -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/orders/helpers.d.ts +10 -2
- package/build/types/src/modules/orders/orders.d.ts +10 -1
- package/build/types/src/types/orders.d.ts +1 -1
- package/build/types/src/types/sdk.d.ts +2 -1
- package/build/types/src/types/subsquid.d.ts +7304 -0
- package/build/types/src/types/tokens.d.ts +1 -0
- package/build/types/src/types/trade.d.ts +1 -0
- package/build/types/src/types/tradeHistory.d.ts +0 -40
- package/build/types/src/utils/markets.d.ts +1 -1
- package/build/types/src/utils/multicall.d.ts +1 -1
- package/build/types/src/utils/numbers.d.ts +9 -3
- package/build/types/src/utils/orderTransactions.d.ts +2 -3
- package/build/types/src/utils/prices.d.ts +1 -1
- package/build/types/src/utils/tokens.d.ts +2 -0
- package/build/types/src/utils/tradeHistory.d.ts +2 -2
- package/build/types/src/utils/twap/uiFeeReceiver.d.ts +13 -0
- package/package.json +7 -2
|
@@ -234,7 +234,7 @@ const numbers_1 = require("../numbers");
|
|
|
234
234
|
(0, vitest_1.it)("should display balance amount", () => {
|
|
235
235
|
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD * 1000n, factors_1.USD_DECIMALS)).toBe("1,000.0000");
|
|
236
236
|
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(0n, factors_1.USD_DECIMALS)).toBe("-");
|
|
237
|
-
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(0n, factors_1.USD_DECIMALS, undefined, true)).toBe("0.0000");
|
|
237
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(0n, factors_1.USD_DECIMALS, undefined, { showZero: true })).toBe("0.0000");
|
|
238
238
|
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD * 1n, factors_1.USD_DECIMALS)).toBe("1.0000");
|
|
239
239
|
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 10n, factors_1.USD_DECIMALS)).toBe("0.10000");
|
|
240
240
|
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 100n, factors_1.USD_DECIMALS)).toBe("0.010000");
|
|
@@ -250,14 +250,22 @@ const numbers_1 = require("../numbers");
|
|
|
250
250
|
});
|
|
251
251
|
(0, vitest_1.it)("should display balance amount with symbol", () => {
|
|
252
252
|
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD, factors_1.USD_DECIMALS, "USDC")).toBe("1.0000 USDC");
|
|
253
|
-
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(0n, factors_1.USD_DECIMALS, "USDC", true)).toBe("0.0000 USDC");
|
|
254
|
-
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(0n, factors_1.USD_DECIMALS, "USDC", false)).toBe("-");
|
|
255
|
-
});
|
|
256
|
-
(0, vitest_1.it)("should display balance
|
|
257
|
-
(0, vitest_1.expect)((0, numbers_1.
|
|
258
|
-
(0, vitest_1.expect)((0, numbers_1.
|
|
259
|
-
(0, vitest_1.expect)((0, numbers_1.
|
|
260
|
-
(0, vitest_1.expect)((0, numbers_1.
|
|
253
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(0n, factors_1.USD_DECIMALS, "USDC", { showZero: true })).toBe("0.0000 USDC");
|
|
254
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(0n, factors_1.USD_DECIMALS, "USDC", { showZero: false })).toBe("-");
|
|
255
|
+
});
|
|
256
|
+
(0, vitest_1.it)("should display balance of stable token correctly", () => {
|
|
257
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("1.00");
|
|
258
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 10n, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("0.100");
|
|
259
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 100n, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("0.0100");
|
|
260
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 1000n, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("0.00100");
|
|
261
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 10000n, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("0.00010000");
|
|
262
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 100000n, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("0.00001000");
|
|
263
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 1000000n, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("0.00000100");
|
|
264
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 10000000n, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("0.00000010");
|
|
265
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 100000000n, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("0.00000001");
|
|
266
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(ONE_USD / 1000000000n, factors_1.USD_DECIMALS, undefined, { isStable: true })).toBe("1.00e-9");
|
|
267
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(0n, factors_1.USD_DECIMALS, undefined, { isStable: true, showZero: true })).toBe("0.00");
|
|
268
|
+
(0, vitest_1.expect)((0, numbers_1.formatBalanceAmount)(0n, factors_1.USD_DECIMALS, undefined, { isStable: true, showZero: false })).toBe("-");
|
|
261
269
|
});
|
|
262
270
|
});
|
|
263
271
|
(0, vitest_1.describe)("formatFactor", () => {
|
|
@@ -370,6 +370,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
370
370
|
(0, vitest_1.expect)(decoded).toEqual({
|
|
371
371
|
twapId: "8000",
|
|
372
372
|
numberOfParts: twapParams.numberOfParts,
|
|
373
|
+
isExpress: false,
|
|
373
374
|
});
|
|
374
375
|
return {
|
|
375
376
|
orderPayload: {
|
|
@@ -462,6 +463,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
462
463
|
const uiFeeReceiver = `0xff00000000000000000000000000000004800001`;
|
|
463
464
|
const decoded = (0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)(uiFeeReceiver);
|
|
464
465
|
(0, vitest_1.expect)(decoded).toEqual({
|
|
466
|
+
isExpress: false,
|
|
465
467
|
twapId: "8000",
|
|
466
468
|
numberOfParts: twapParams.numberOfParts,
|
|
467
469
|
});
|
|
@@ -534,6 +534,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
534
534
|
const uiFeeReceiver = `0xff00000000000000000000000000000004800001`;
|
|
535
535
|
const decoded = (0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)(uiFeeReceiver);
|
|
536
536
|
(0, vitest_1.expect)(decoded).toEqual({
|
|
537
|
+
isExpress: false,
|
|
537
538
|
twapId: "8000",
|
|
538
539
|
numberOfParts: twapParams.numberOfParts,
|
|
539
540
|
});
|
|
@@ -628,6 +629,7 @@ const mock_1 = require("../../../test/mock");
|
|
|
628
629
|
const uiFeeReceiver = `0xff00000000000000000000000000000004800001`;
|
|
629
630
|
const decoded = (0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)(uiFeeReceiver);
|
|
630
631
|
(0, vitest_1.expect)(decoded).toEqual({
|
|
632
|
+
isExpress: false,
|
|
631
633
|
twapId: "8000",
|
|
632
634
|
numberOfParts: twapParams.numberOfParts,
|
|
633
635
|
});
|
|
@@ -63,7 +63,8 @@ const prices_1 = require("../prices");
|
|
|
63
63
|
const result = (0, prices_1.getOrderThresholdType)(orders_1.OrderType.StopIncrease, false);
|
|
64
64
|
(0, vitest_1.expect)(result).toBe(trade_1.TriggerThresholdType.Below);
|
|
65
65
|
});
|
|
66
|
-
(0, vitest_1.it)("
|
|
67
|
-
|
|
66
|
+
(0, vitest_1.it)("returns undefined for invalid order type", () => {
|
|
67
|
+
const result = (0, prices_1.getOrderThresholdType)("SomeInvalidType", true);
|
|
68
|
+
(0, vitest_1.expect)(result).toBeUndefined();
|
|
68
69
|
});
|
|
69
70
|
});
|
|
@@ -13,12 +13,21 @@ const uiFeeReceiver_1 = require("../twap/uiFeeReceiver");
|
|
|
13
13
|
(0, vitest_1.it)("should return undefined if twapId inside is 0000", () => {
|
|
14
14
|
(0, vitest_1.expect)((0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)("0xff00000000000000000000000000000000000001")).toBeUndefined();
|
|
15
15
|
});
|
|
16
|
+
(0, vitest_1.it)("should correctly decode isExpress", () => {
|
|
17
|
+
(0, vitest_1.expect)((0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)("0xff0000000000000000000000000000010a123401")).toEqual({
|
|
18
|
+
isExpress: true,
|
|
19
|
+
twapId: "1234",
|
|
20
|
+
numberOfParts: 10,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
16
23
|
(0, vitest_1.it)("should return the twapId and numberOfParts if the uiFeeReceiver is valid twap", () => {
|
|
17
24
|
(0, vitest_1.expect)((0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)("0xff0000000000000000000000000000000a123401")).toEqual({
|
|
25
|
+
isExpress: false,
|
|
18
26
|
twapId: "1234",
|
|
19
27
|
numberOfParts: 10,
|
|
20
28
|
});
|
|
21
29
|
(0, vitest_1.expect)((0, uiFeeReceiver_1.decodeTwapUiFeeReceiver)("0xff000000000000000000000000000000153a4f01")).toEqual({
|
|
30
|
+
isExpress: false,
|
|
22
31
|
twapId: "3a4f",
|
|
23
32
|
numberOfParts: 21,
|
|
24
33
|
});
|
|
@@ -19,9 +19,10 @@ const TX_ERROR_PATTERNS = {
|
|
|
19
19
|
[TxErrorType.UserDenied]: [
|
|
20
20
|
{ msg: "User denied transaction signature" },
|
|
21
21
|
{ msg: "User rejected" },
|
|
22
|
+
{ msg: "User cancelled" },
|
|
22
23
|
{ msg: "user rejected action" },
|
|
23
24
|
{ msg: "ethers-user-denied" },
|
|
24
|
-
{ msg: "
|
|
25
|
+
{ msg: "Action cancelled by user" },
|
|
25
26
|
{ msg: "Signing aborted by user" },
|
|
26
27
|
],
|
|
27
28
|
[TxErrorType.Slippage]: [
|
|
@@ -5,6 +5,7 @@ const chains_1 = require("../../configs/chains");
|
|
|
5
5
|
const factors_1 = require("../../configs/factors");
|
|
6
6
|
const tokens_1 = require("../../configs/tokens");
|
|
7
7
|
const orders_1 = require("../../types/orders");
|
|
8
|
+
const bigmath_1 = require("../bigmath");
|
|
8
9
|
const numbers_1 = require("../numbers");
|
|
9
10
|
const tokens_2 = require("../tokens");
|
|
10
11
|
function getExecutionFee(chainId, gasLimits,
|
|
@@ -19,7 +20,14 @@ tokensData, estimatedGasLimit, gasPrice, oraclePriceCount, numberOfParts) {
|
|
|
19
20
|
const multiplierFactor = gasLimits.estimatedFeeMultiplierFactor;
|
|
20
21
|
const gasLimit = baseGasLimit + (0, numbers_1.applyFactor)(estimatedGasLimit, multiplierFactor);
|
|
21
22
|
// #endregion
|
|
22
|
-
|
|
23
|
+
// avoid botanix gas spikes when chain is not actively used
|
|
24
|
+
const minGasCostUsd = chains_1.MIN_EXECUTION_FEE_USD[chainId];
|
|
25
|
+
const minGasCost = (0, tokens_2.convertToTokenAmount)(minGasCostUsd, nativeToken.decimals, nativeToken.prices.minPrice);
|
|
26
|
+
let feeTokenAmountPerExecution = gasLimit * gasPrice;
|
|
27
|
+
if (minGasCost) {
|
|
28
|
+
feeTokenAmountPerExecution = bigmath_1.bigMath.max(feeTokenAmountPerExecution, minGasCost);
|
|
29
|
+
}
|
|
30
|
+
const feeTokenAmount = feeTokenAmountPerExecution * BigInt(numberOfParts ?? 1);
|
|
23
31
|
const feeUsd = (0, tokens_2.convertToUsd)(feeTokenAmount, nativeToken.decimals, nativeToken.prices.minPrice);
|
|
24
32
|
const isFeeHigh = feeUsd > (0, numbers_1.expandDecimals)((0, chains_1.getHighExecutionFee)(chainId), factors_1.USD_DECIMALS);
|
|
25
33
|
const isFeeVeryHigh = feeUsd > (0, numbers_1.expandDecimals)((0, chains_1.getExcessiveExecutionFee)(chainId), factors_1.USD_DECIMALS);
|
|
@@ -21,9 +21,9 @@ function getMarketIndexName(p) {
|
|
|
21
21
|
return `${prefix}${firstToken.baseSymbol || firstToken.symbol}/USD`;
|
|
22
22
|
}
|
|
23
23
|
exports.getMarketIndexName = getMarketIndexName;
|
|
24
|
-
function getMarketPoolName(p) {
|
|
24
|
+
function getMarketPoolName(p, separator = "-") {
|
|
25
25
|
const { longToken, shortToken } = p;
|
|
26
|
-
return `${longToken.symbol}
|
|
26
|
+
return `${longToken.symbol}${separator}${shortToken.symbol}`;
|
|
27
27
|
}
|
|
28
28
|
exports.getMarketPoolName = getMarketPoolName;
|
|
29
29
|
function getContractMarketPrices(tokensData, market) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.roundBigIntToDecimals = exports.roundToOrder = exports.roundToTwoDecimals = exports.roundUpDivision = exports.parseValue = exports.bigNumberify = exports.toBigNumberWithDecimals = exports.roundWithDecimals = exports.getPlusOrMinusSymbol = exports.padDecimals = exports.limitDecimals = exports.getLimitedDisplay = exports.formatAmountFree = exports.formatArrayAmount = exports.formatKeyAmount = exports.formatAmount = exports.numberWithCommas = exports.formatFactor = exports.
|
|
3
|
+
exports.roundBigIntToDecimals = exports.roundToOrder = exports.roundToTwoDecimals = exports.roundUpDivision = exports.parseValue = exports.bigNumberify = exports.toBigNumberWithDecimals = exports.roundWithDecimals = exports.getPlusOrMinusSymbol = exports.padDecimals = exports.limitDecimals = exports.getLimitedDisplay = exports.formatAmountFree = exports.formatArrayAmount = exports.formatKeyAmount = exports.formatAmount = exports.numberWithCommas = exports.formatFactor = exports.formatBalanceAmount = exports.formatAmountHuman = exports.formatPercentageDisplay = exports.formatUsdPrice = exports.formatRatePercentage = exports.formatTokenAmountWithUsd = exports.formatTokenAmount = exports.formatPercentage = exports.formatDeltaUsd = exports.formatUsd = exports.adjustForDecimals = exports.bigintToNumber = exports.trimZeroDecimals = exports.numberToBigint = exports.applyFactor = exports.roundUpMagnitudeDivision = exports.getBasisPoints = exports.basisPointsToFloat = exports.expandDecimals = exports.TRIGGER_PREFIX_BELOW = exports.TRIGGER_PREFIX_ABOVE = exports.PERCENT_PRECISION_DECIMALS = exports.MaxUint256 = exports.BN_NEGATIVE_ONE = exports.BN_ONE = exports.BN_ZERO = exports.PRECISION = exports.PRECISION_DECIMALS = exports.BASIS_POINTS_DECIMALS = exports.BASIS_POINTS_DIVISOR_BIGINT = exports.BASIS_POINTS_DIVISOR = exports.USD_DECIMALS = void 0;
|
|
4
4
|
exports.absDiffBps = exports.clamp = exports.calculateDisplayDecimals = exports.deserializeBigIntsInObject = exports.serializeBigIntsInObject = exports.removeTrailingZeros = exports.maxbigint = exports.minBigNumber = void 0;
|
|
5
5
|
const viem_1 = require("viem");
|
|
6
6
|
const bigmath_1 = require("./bigmath");
|
|
7
7
|
exports.USD_DECIMALS = 30;
|
|
8
8
|
exports.BASIS_POINTS_DIVISOR = 10000;
|
|
9
9
|
exports.BASIS_POINTS_DIVISOR_BIGINT = 10000n;
|
|
10
|
+
exports.BASIS_POINTS_DECIMALS = 4;
|
|
10
11
|
exports.PRECISION_DECIMALS = 30;
|
|
11
12
|
exports.PRECISION = expandDecimals(1, exports.PRECISION_DECIMALS);
|
|
12
13
|
exports.BN_ZERO = 0n;
|
|
@@ -142,7 +143,8 @@ function formatPercentage(percentage, opts = {}) {
|
|
|
142
143
|
}
|
|
143
144
|
exports.formatPercentage = formatPercentage;
|
|
144
145
|
function formatTokenAmount(amount, tokenDecimals, symbol, opts = {}) {
|
|
145
|
-
const {
|
|
146
|
+
const { showAllSignificant = false, fallbackToZero = false, useCommas = false, minThreshold = "0", maxThreshold, } = opts;
|
|
147
|
+
const displayDecimals = opts.displayDecimals ?? (opts.isStable ? 2 : 4);
|
|
146
148
|
const symbolStr = symbol ? ` ${symbol}` : "";
|
|
147
149
|
if (typeof amount !== "bigint" || !tokenDecimals) {
|
|
148
150
|
if (fallbackToZero) {
|
|
@@ -162,7 +164,7 @@ function formatTokenAmount(amount, tokenDecimals, symbol, opts = {}) {
|
|
|
162
164
|
else {
|
|
163
165
|
const exceedingInfo = getLimitedDisplay(amount, tokenDecimals, { maxThreshold, minThreshold });
|
|
164
166
|
const symbol = exceedingInfo.symbol ? `${exceedingInfo.symbol} ` : "";
|
|
165
|
-
amountStr = `${symbol}${sign}${(0, exports.formatAmount)(exceedingInfo.value, tokenDecimals, displayDecimals, useCommas)}`;
|
|
167
|
+
amountStr = `${symbol}${sign}${(0, exports.formatAmount)(exceedingInfo.value, tokenDecimals, displayDecimals, useCommas, undefined)}`;
|
|
166
168
|
}
|
|
167
169
|
return `${amountStr}${symbolStr}`;
|
|
168
170
|
}
|
|
@@ -244,14 +246,20 @@ function formatAmountHuman(amount, tokenDecimals, showDollar = false, displayDec
|
|
|
244
246
|
return `${isNegative ? "-" : ""}${sign}${absN.toFixed(displayDecimals)}`;
|
|
245
247
|
}
|
|
246
248
|
exports.formatAmountHuman = formatAmountHuman;
|
|
247
|
-
function formatBalanceAmount(amount, tokenDecimals, tokenSymbol, showZero = false, toExponential = true) {
|
|
249
|
+
function formatBalanceAmount(amount, tokenDecimals, tokenSymbol, { showZero = false, toExponential = true, isStable = false, } = {}) {
|
|
248
250
|
if (amount === undefined)
|
|
249
251
|
return "-";
|
|
250
252
|
if (amount === 0n) {
|
|
251
253
|
if (showZero === true) {
|
|
252
254
|
if (tokenSymbol) {
|
|
255
|
+
if (isStable) {
|
|
256
|
+
return `0.00 ${tokenSymbol}`;
|
|
257
|
+
}
|
|
253
258
|
return `0.0000 ${tokenSymbol}`;
|
|
254
259
|
}
|
|
260
|
+
if (isStable) {
|
|
261
|
+
return "0.00";
|
|
262
|
+
}
|
|
255
263
|
return "0.0000";
|
|
256
264
|
}
|
|
257
265
|
return "-";
|
|
@@ -259,14 +267,15 @@ function formatBalanceAmount(amount, tokenDecimals, tokenSymbol, showZero = fals
|
|
|
259
267
|
const absAmount = bigmath_1.bigMath.abs(amount);
|
|
260
268
|
const absAmountFloat = bigintToNumber(absAmount, tokenDecimals);
|
|
261
269
|
let value = "";
|
|
270
|
+
const baseDecimals = isStable ? 2 : 4;
|
|
262
271
|
if (absAmountFloat >= 1)
|
|
263
|
-
value = (0, exports.formatAmount)(amount, tokenDecimals,
|
|
272
|
+
value = (0, exports.formatAmount)(amount, tokenDecimals, baseDecimals, true);
|
|
264
273
|
else if (absAmountFloat >= 0.1)
|
|
265
|
-
value = (0, exports.formatAmount)(amount, tokenDecimals,
|
|
274
|
+
value = (0, exports.formatAmount)(amount, tokenDecimals, baseDecimals + 1, true);
|
|
266
275
|
else if (absAmountFloat >= 0.01)
|
|
267
|
-
value = (0, exports.formatAmount)(amount, tokenDecimals,
|
|
276
|
+
value = (0, exports.formatAmount)(amount, tokenDecimals, baseDecimals + 2, true);
|
|
268
277
|
else if (absAmountFloat >= 0.001)
|
|
269
|
-
value = (0, exports.formatAmount)(amount, tokenDecimals,
|
|
278
|
+
value = (0, exports.formatAmount)(amount, tokenDecimals, baseDecimals + 3, true);
|
|
270
279
|
else if (absAmountFloat >= 1e-8)
|
|
271
280
|
value = (0, exports.formatAmount)(amount, tokenDecimals, 8, true);
|
|
272
281
|
else {
|
|
@@ -284,16 +293,6 @@ function formatBalanceAmount(amount, tokenDecimals, tokenSymbol, showZero = fals
|
|
|
284
293
|
return value;
|
|
285
294
|
}
|
|
286
295
|
exports.formatBalanceAmount = formatBalanceAmount;
|
|
287
|
-
function formatBalanceAmountWithUsd(amount, amountUsd, tokenDecimals, tokenSymbol, showZero = false) {
|
|
288
|
-
if (showZero === false && amount === 0n) {
|
|
289
|
-
return "-";
|
|
290
|
-
}
|
|
291
|
-
const value = formatBalanceAmount(amount, tokenDecimals, tokenSymbol, showZero);
|
|
292
|
-
const usd = formatUsd(amountUsd);
|
|
293
|
-
// Regular space
|
|
294
|
-
return `${value} (${usd})`;
|
|
295
|
-
}
|
|
296
|
-
exports.formatBalanceAmountWithUsd = formatBalanceAmountWithUsd;
|
|
297
296
|
function formatFactor(factor) {
|
|
298
297
|
if (factor == 0n) {
|
|
299
298
|
return "0";
|
|
@@ -588,26 +587,46 @@ function deserializeBigIntsInObject(obj) {
|
|
|
588
587
|
return result;
|
|
589
588
|
}
|
|
590
589
|
exports.deserializeBigIntsInObject = deserializeBigIntsInObject;
|
|
591
|
-
function calculateDisplayDecimals(price, decimals = exports.USD_DECIMALS, visualMultiplier = 1) {
|
|
590
|
+
function calculateDisplayDecimals(price, decimals = exports.USD_DECIMALS, visualMultiplier = 1, isStable = false) {
|
|
592
591
|
if (price === undefined || price === 0n)
|
|
593
592
|
return 2;
|
|
594
593
|
const priceNumber = bigintToNumber(bigmath_1.bigMath.abs(price) * BigInt(visualMultiplier), decimals);
|
|
595
594
|
if (isNaN(priceNumber))
|
|
596
595
|
return 2;
|
|
597
|
-
if (
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
596
|
+
if (isStable) {
|
|
597
|
+
if (priceNumber >= 0.1)
|
|
598
|
+
return 2;
|
|
599
|
+
if (priceNumber >= 0.01)
|
|
600
|
+
return 3;
|
|
601
|
+
if (priceNumber >= 0.001)
|
|
602
|
+
return 4;
|
|
603
|
+
if (priceNumber >= 0.0001)
|
|
604
|
+
return 5;
|
|
605
|
+
if (priceNumber >= 0.00001)
|
|
606
|
+
return 6;
|
|
607
|
+
if (priceNumber >= 0.000001)
|
|
608
|
+
return 7;
|
|
609
|
+
if (priceNumber >= 0.0000001)
|
|
610
|
+
return 8;
|
|
611
|
+
if (priceNumber >= 0.00000001)
|
|
612
|
+
return 9;
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
if (priceNumber >= 1000)
|
|
616
|
+
return 2;
|
|
617
|
+
if (priceNumber >= 100)
|
|
618
|
+
return 3;
|
|
619
|
+
if (priceNumber >= 1)
|
|
620
|
+
return 4;
|
|
621
|
+
if (priceNumber >= 0.1)
|
|
622
|
+
return 5;
|
|
623
|
+
if (priceNumber >= 0.01)
|
|
624
|
+
return 6;
|
|
625
|
+
if (priceNumber >= 0.0001)
|
|
626
|
+
return 7;
|
|
627
|
+
if (priceNumber >= 0.00001)
|
|
628
|
+
return 8;
|
|
629
|
+
}
|
|
611
630
|
return 9;
|
|
612
631
|
}
|
|
613
632
|
exports.calculateDisplayDecimals = calculateDisplayDecimals;
|
|
@@ -180,6 +180,9 @@ function buildTwapOrdersPayloads(p, twapParams) {
|
|
|
180
180
|
referralCode: params.referralCode,
|
|
181
181
|
autoCancel: params.autoCancel,
|
|
182
182
|
allowedSlippage: 0,
|
|
183
|
+
...(params.expectedOutputAmount !== undefined && {
|
|
184
|
+
expectedOutputAmount: params.expectedOutputAmount / BigInt(twapParams.numberOfParts),
|
|
185
|
+
}),
|
|
183
186
|
payTokenAmount: params.payTokenAmount / BigInt(twapParams.numberOfParts),
|
|
184
187
|
executionFeeAmount: params.executionFeeAmount / BigInt(twapParams.numberOfParts),
|
|
185
188
|
validFromTime: (0, twap_1.getTwapValidFromTime)(twapParams.duration, twapParams.numberOfParts, i),
|
|
@@ -179,7 +179,10 @@ function getOrderInfo(p) {
|
|
|
179
179
|
shouldApplyPriceImpact: true,
|
|
180
180
|
isAtomicSwap: false,
|
|
181
181
|
});
|
|
182
|
-
|
|
182
|
+
let triggerThresholdType;
|
|
183
|
+
if (!isMarketOrderType(order.orderType)) {
|
|
184
|
+
triggerThresholdType = (0, prices_1.getOrderThresholdType)(order.orderType, order.isLong);
|
|
185
|
+
}
|
|
183
186
|
const orderInfo = {
|
|
184
187
|
...order,
|
|
185
188
|
swapPathStats,
|
|
@@ -198,7 +201,10 @@ function getOrderInfo(p) {
|
|
|
198
201
|
}
|
|
199
202
|
exports.getOrderInfo = getOrderInfo;
|
|
200
203
|
function isVisibleOrder(orderType) {
|
|
201
|
-
return isLimitOrderType(orderType) ||
|
|
204
|
+
return (isLimitOrderType(orderType) ||
|
|
205
|
+
isTriggerDecreaseOrderType(orderType) ||
|
|
206
|
+
isLimitSwapOrderType(orderType) ||
|
|
207
|
+
isMarketOrderType(orderType));
|
|
202
208
|
}
|
|
203
209
|
exports.isVisibleOrder = isVisibleOrder;
|
|
204
210
|
function isOrderForPosition(order, positionKey) {
|
|
@@ -38,7 +38,7 @@ function getOrderThresholdType(orderType, isLong) {
|
|
|
38
38
|
if (orderType === orders_1.OrderType.StopLossDecrease) {
|
|
39
39
|
return isLong ? trade_1.TriggerThresholdType.Below : trade_1.TriggerThresholdType.Above;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
return undefined;
|
|
42
42
|
}
|
|
43
43
|
exports.getOrderThresholdType = getOrderThresholdType;
|
|
44
44
|
function getAcceptablePriceInfo(p) {
|
|
@@ -42,6 +42,9 @@ function getSwapAmountsByFromValue(p) {
|
|
|
42
42
|
swapPathStats: undefined,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
if ((0, tokens_1.getIsStake)(tokenIn, tokenOut) || (0, tokens_1.getIsUnstake)(tokenIn, tokenOut)) {
|
|
46
|
+
return getPlainSwapAmountsByFromToken(tokenIn, tokenOut, amountIn);
|
|
47
|
+
}
|
|
45
48
|
const swapPathStats = findSwapPath(defaultAmounts.usdIn, { order: swapOptimizationOrder });
|
|
46
49
|
const totalSwapVolume = (0, fees_1.getTotalSwapVolumeFromSwapStats)(swapPathStats?.swapSteps);
|
|
47
50
|
const swapUiFeeUsd = (0, numbers_1.applyFactor)(totalSwapVolume, uiFeeFactor);
|
|
@@ -123,6 +126,9 @@ function getSwapAmountsByToValue(p) {
|
|
|
123
126
|
swapPathStats: undefined,
|
|
124
127
|
};
|
|
125
128
|
}
|
|
129
|
+
if ((0, tokens_1.getIsStake)(tokenIn, tokenOut) || (0, tokens_1.getIsUnstake)(tokenIn, tokenOut)) {
|
|
130
|
+
return getPlainSwapAmountsByToToken(tokenIn, tokenOut, amountOut);
|
|
131
|
+
}
|
|
126
132
|
const baseUsdIn = usdOut;
|
|
127
133
|
const swapPathStats = findSwapPath(baseUsdIn, { order: swapOptimizationOrder });
|
|
128
134
|
if (!swapPathStats) {
|
|
@@ -188,3 +194,37 @@ function getSwapPathComparator(order) {
|
|
|
188
194
|
};
|
|
189
195
|
}
|
|
190
196
|
exports.getSwapPathComparator = getSwapPathComparator;
|
|
197
|
+
function getPlainSwapAmountsByFromToken(tokenIn, tokenOut, amountIn) {
|
|
198
|
+
const usdIn = (0, tokens_1.convertToUsd)(amountIn, tokenIn.decimals, tokenIn.prices.minPrice);
|
|
199
|
+
const usdOut = usdIn;
|
|
200
|
+
const amountOut = (0, tokens_1.convertToTokenAmount)(usdOut, tokenOut.decimals, tokenOut.prices.maxPrice);
|
|
201
|
+
const priceIn = tokenIn.prices.minPrice;
|
|
202
|
+
const priceOut = tokenOut.prices.maxPrice;
|
|
203
|
+
return {
|
|
204
|
+
amountIn,
|
|
205
|
+
usdIn,
|
|
206
|
+
amountOut,
|
|
207
|
+
usdOut,
|
|
208
|
+
minOutputAmount: amountOut,
|
|
209
|
+
priceIn,
|
|
210
|
+
priceOut,
|
|
211
|
+
swapPathStats: undefined,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function getPlainSwapAmountsByToToken(tokenIn, tokenOut, amountOut) {
|
|
215
|
+
const priceIn = tokenIn.prices.minPrice;
|
|
216
|
+
const priceOut = tokenOut.prices.maxPrice;
|
|
217
|
+
const usdOut = (0, tokens_1.convertToUsd)(amountOut, tokenOut.decimals, priceOut);
|
|
218
|
+
const usdIn = usdOut;
|
|
219
|
+
const amountIn = (0, tokens_1.convertToTokenAmount)(usdIn, tokenIn.decimals, priceIn);
|
|
220
|
+
return {
|
|
221
|
+
amountIn,
|
|
222
|
+
usdIn,
|
|
223
|
+
amountOut,
|
|
224
|
+
usdOut,
|
|
225
|
+
minOutputAmount: amountOut,
|
|
226
|
+
priceIn,
|
|
227
|
+
priceOut,
|
|
228
|
+
swapPathStats: undefined,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTokensRatioByPrice = exports.getIsUnwrap = exports.getIsWrap = exports.getAmountByRatio = exports.getTokensRatioByMinOutputAmountAndTriggerPrice = exports.getTokensRatioByAmounts = exports.getTokenData = exports.getIsEquivalentTokens = exports.getMidPrice = exports.convertBetweenTokens = exports.convertToUsd = exports.convertToTokenAmount = exports.convertToContractTokenPrices = exports.convertToContractPrice = exports.parseContractPrice = void 0;
|
|
3
|
+
exports.getTokensRatioByPrice = exports.getIsUnstake = exports.getIsStake = exports.getIsUnwrap = exports.getIsWrap = exports.getAmountByRatio = exports.getTokensRatioByMinOutputAmountAndTriggerPrice = exports.getTokensRatioByAmounts = exports.getTokenData = exports.getIsEquivalentTokens = exports.getMidPrice = exports.convertBetweenTokens = exports.convertToUsd = exports.convertToTokenAmount = exports.convertToContractTokenPrices = exports.convertToContractPrice = exports.parseContractPrice = void 0;
|
|
4
4
|
const factors_1 = require("../configs/factors");
|
|
5
5
|
const tokens_1 = require("../configs/tokens");
|
|
6
6
|
const bigmath_1 = require("./bigmath");
|
|
@@ -149,6 +149,15 @@ function getIsUnwrap(token1, token2) {
|
|
|
149
149
|
return token1.isWrapped && token2.isNative;
|
|
150
150
|
}
|
|
151
151
|
exports.getIsUnwrap = getIsUnwrap;
|
|
152
|
+
function getIsStake(token1, token2) {
|
|
153
|
+
return (token1.isWrapped || token1.isNative) && token2.isStaking;
|
|
154
|
+
}
|
|
155
|
+
exports.getIsStake = getIsStake;
|
|
156
|
+
function getIsUnstake(token1, token2) {
|
|
157
|
+
// can't unstake straight to native token
|
|
158
|
+
return token1.isStaking && token2.isWrapped;
|
|
159
|
+
}
|
|
160
|
+
exports.getIsUnstake = getIsUnstake;
|
|
152
161
|
function getTokensRatioByPrice(p) {
|
|
153
162
|
const { fromToken, toToken, fromPrice, toPrice } = p;
|
|
154
163
|
const [largestToken, smallestToken, largestPrice, smallestPrice] = fromPrice > toPrice ? [fromToken, toToken, fromPrice, toPrice] : [toToken, fromToken, toPrice, fromPrice];
|
|
@@ -41,8 +41,8 @@ function createRawTradeActionTransformer(marketsInfoData, wrappedToken, tokensDa
|
|
|
41
41
|
initialCollateralToken,
|
|
42
42
|
timestamp: rawAction.timestamp,
|
|
43
43
|
transaction: rawAction.transaction,
|
|
44
|
-
reason: rawAction.reason,
|
|
45
|
-
reasonBytes: rawAction.reasonBytes,
|
|
44
|
+
reason: rawAction.reason ?? undefined,
|
|
45
|
+
reasonBytes: rawAction.reasonBytes ?? undefined,
|
|
46
46
|
twapParams: rawAction.twapGroupId && rawAction.numberOfParts
|
|
47
47
|
? {
|
|
48
48
|
twapGroupId: rawAction.twapGroupId,
|
|
@@ -115,8 +115,8 @@ function createRawTradeActionTransformer(marketsInfoData, wrappedToken, tokensDa
|
|
|
115
115
|
borrowingFeeAmount: rawAction.borrowingFeeAmount ? BigInt(rawAction.borrowingFeeAmount) : undefined,
|
|
116
116
|
fundingFeeAmount: rawAction.fundingFeeAmount ? BigInt(rawAction.fundingFeeAmount) : undefined,
|
|
117
117
|
liquidationFeeAmount: rawAction.liquidationFeeAmount ? BigInt(rawAction.liquidationFeeAmount) : undefined,
|
|
118
|
-
reason: rawAction.reason,
|
|
119
|
-
reasonBytes: rawAction.reasonBytes,
|
|
118
|
+
reason: rawAction.reason ?? undefined,
|
|
119
|
+
reasonBytes: rawAction.reasonBytes ?? undefined,
|
|
120
120
|
transaction: rawAction.transaction,
|
|
121
121
|
timestamp: rawAction.timestamp,
|
|
122
122
|
shouldUnwrapNativeToken: rawAction.shouldUnwrapNativeToken,
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidTwapUiFeeReceiver = exports.decodeTwapUiFeeReceiver = exports.createTwapUiFeeReceiver = exports.generateTwapId = void 0;
|
|
3
|
+
exports.setUiFeeReceiverIsExpress = exports.isValidTwapUiFeeReceiver = exports.decodeTwapUiFeeReceiver = exports.createTwapUiFeeReceiver = exports.generateTwapId = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const VERSION = "01";
|
|
6
|
-
const PREFIX = "
|
|
6
|
+
const PREFIX = "0xff0000";
|
|
7
|
+
/**
|
|
8
|
+
* Ui fee receiver structure:
|
|
9
|
+
* 0..3 bytes (0..7 chars) - PREFIX
|
|
10
|
+
* 4..16 bytes (8..27 chars) - 12 bytes buffer
|
|
11
|
+
* 17 byte (27..29 chars) - isExpress flag
|
|
12
|
+
* 18 byte (30..32 chars) - numberOfParts (hex encoded)
|
|
13
|
+
* 19..20 bytes (34..38 chars) - twapId
|
|
14
|
+
* 20 byte (38..40 chars) - VERSION
|
|
15
|
+
*
|
|
16
|
+
* Total: 20 bytes (40 hex characters)
|
|
17
|
+
*/
|
|
7
18
|
function generateTwapId() {
|
|
8
19
|
return Math.floor(Math.random() * 256 * 256)
|
|
9
20
|
.toString(16)
|
|
@@ -13,19 +24,28 @@ exports.generateTwapId = generateTwapId;
|
|
|
13
24
|
function createTwapUiFeeReceiver({ numberOfParts }) {
|
|
14
25
|
const twapId = generateTwapId();
|
|
15
26
|
const numberOfPartsInHex = numberOfParts.toString(16).padStart(2, "0");
|
|
16
|
-
|
|
27
|
+
const isExpressHex = "00";
|
|
28
|
+
const buffer = "00".repeat(12);
|
|
29
|
+
return `${PREFIX}${buffer}${isExpressHex}${numberOfPartsInHex}${twapId}${VERSION}`;
|
|
17
30
|
}
|
|
18
31
|
exports.createTwapUiFeeReceiver = createTwapUiFeeReceiver;
|
|
19
32
|
function decodeTwapUiFeeReceiver(address) {
|
|
20
|
-
const
|
|
33
|
+
const byteString = address.slice(2);
|
|
34
|
+
const twapId = byteString.slice(34, 38);
|
|
35
|
+
const isExpress = byteString.slice(30, 32) === "01";
|
|
21
36
|
if (!isValidTwapUiFeeReceiver(address) || twapId === "0000") {
|
|
22
37
|
return;
|
|
23
38
|
}
|
|
24
|
-
const numberOfParts = parseInt(
|
|
25
|
-
return { twapId, numberOfParts };
|
|
39
|
+
const numberOfParts = parseInt(byteString.slice(32, 34), 16);
|
|
40
|
+
return { twapId, numberOfParts, isExpress };
|
|
26
41
|
}
|
|
27
42
|
exports.decodeTwapUiFeeReceiver = decodeTwapUiFeeReceiver;
|
|
28
43
|
function isValidTwapUiFeeReceiver(address) {
|
|
29
44
|
return (0, viem_1.isAddress)(address) && address.toLowerCase().startsWith(PREFIX.toLowerCase());
|
|
30
45
|
}
|
|
31
46
|
exports.isValidTwapUiFeeReceiver = isValidTwapUiFeeReceiver;
|
|
47
|
+
function setUiFeeReceiverIsExpress(uiFeeReceiver, isExpress) {
|
|
48
|
+
const isExpressInHex = isExpress ? "01" : "00";
|
|
49
|
+
return `${uiFeeReceiver.slice(0, 27)}${isExpressInHex}${uiFeeReceiver.slice(29)}`;
|
|
50
|
+
}
|
|
51
|
+
exports.setUiFeeReceiverIsExpress = setUiFeeReceiverIsExpress;
|