@gmx-io/sdk 1.9.1 → 2.0.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/clients/v2/__tests__/decrease.spec.js +1 -1
- package/build/cjs/src/clients/v2/__tests__/multichain.spec.js +2 -2
- package/build/cjs/src/configs/contracts.js +0 -4
- package/build/cjs/src/configs/express.js +1 -10
- package/build/cjs/src/utils/express/index.js +1 -0
- package/build/cjs/src/utils/express/relayStatus.js +11 -0
- package/build/cjs/src/utils/express/utils/gmxRelayUtils.js +0 -1
- package/build/cjs/src/utils/express/utils/gmxRelayUtils.spec.js +1 -1
- package/build/cjs/src/utils/express/utils/index.js +0 -2
- package/build/cjs/src/utils/multichain/api.js +1 -1
- package/build/esm/src/clients/v2/__tests__/decrease.spec.js +1 -1
- package/build/esm/src/clients/v2/__tests__/multichain.spec.js +2 -2
- package/build/esm/src/configs/contracts.js +0 -4
- package/build/esm/src/configs/express.js +0 -9
- package/build/esm/src/utils/express/index.js +1 -0
- package/build/esm/src/utils/express/relayStatus.js +8 -0
- package/build/esm/src/utils/express/utils/gmxRelayUtils.js +0 -1
- package/build/esm/src/utils/express/utils/gmxRelayUtils.spec.js +1 -1
- package/build/esm/src/utils/express/utils/index.js +0 -2
- package/build/esm/src/utils/multichain/api.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/src/configs/contracts.d.ts +0 -4
- package/build/types/src/configs/express.d.ts +0 -4
- package/build/types/src/utils/express/index.d.ts +1 -0
- package/build/types/src/utils/express/relayStatus.d.ts +7 -0
- package/build/types/src/utils/express/utils/index.d.ts +0 -2
- package/build/types/src/utils/gmxAccountApi/api.d.ts +0 -1
- package/build/types/src/utils/multichain/api.d.ts +1 -1
- package/package.json +1 -11
- package/build/cjs/src/utils/express/utils/fetchGelatoGasTankBalance.js +0 -13
- package/build/cjs/src/utils/express/utils/gelatoRelayUtils.js +0 -79
- package/build/cjs/src/utils/gelatoRelay/index.js +0 -17
- package/build/cjs/src/utils/gelatoRelay/utils.js +0 -16
- package/build/esm/src/utils/express/utils/fetchGelatoGasTankBalance.js +0 -9
- package/build/esm/src/utils/express/utils/gelatoRelayUtils.js +0 -73
- package/build/esm/src/utils/gelatoRelay/index.js +0 -1
- package/build/esm/src/utils/gelatoRelay/utils.js +0 -11
- package/build/types/src/utils/express/utils/fetchGelatoGasTankBalance.d.ts +0 -5
- package/build/types/src/utils/express/utils/gelatoRelayUtils.d.ts +0 -27
- package/build/types/src/utils/gelatoRelay/index.d.ts +0 -1
- package/build/types/src/utils/gelatoRelay/utils.d.ts +0 -4
|
@@ -30,7 +30,7 @@ async function ensureLongPosition() {
|
|
|
30
30
|
const pos = positions.find((p) => p.isLong && p.indexName?.includes("ETH/USD"));
|
|
31
31
|
if (pos)
|
|
32
32
|
return pos;
|
|
33
|
-
// Retry once — first
|
|
33
|
+
// Retry once — first relay call in a test run can be flaky
|
|
34
34
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
35
35
|
try {
|
|
36
36
|
await openLongPosition();
|
|
@@ -78,7 +78,7 @@ const WITHDRAW_AMOUNT = 500000n; // 0.5 USDC
|
|
|
78
78
|
(0, vitest_1.expect)(result.nativeFee).toBeGreaterThan(0n);
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
|
-
(0, vitest_1.describe)("multichain cross-chain withdraw (Arbitrum → Base, via
|
|
81
|
+
(0, vitest_1.describe)("multichain cross-chain withdraw (Arbitrum → Base, via GMX Relay)", () => {
|
|
82
82
|
(0, vitest_1.it)("prepare: returns typed-data + gasPaymentParams", async () => {
|
|
83
83
|
const bridgeOutParams = sdk.buildCrossChainWithdrawBridgeOutParams({
|
|
84
84
|
tokenAddress: multichainTestUtil_1.USDC_ARBITRUM,
|
|
@@ -95,7 +95,7 @@ const WITHDRAW_AMOUNT = 500000n; // 0.5 USDC
|
|
|
95
95
|
(0, vitest_1.expect)(prepared.payload.typedData.primaryType).toBe("BridgeOut");
|
|
96
96
|
(0, vitest_1.expect)(prepared.payload.gasPaymentParams.relayerFeeAmount).toBeGreaterThan(0n);
|
|
97
97
|
});
|
|
98
|
-
vitest_1.it.skipIf(!(0, multichainTestUtil_1.shouldSendOnChain)())("execute: resolves to terminal
|
|
98
|
+
vitest_1.it.skipIf(!(0, multichainTestUtil_1.shouldSendOnChain)())("execute: resolves to terminal relay status", async () => {
|
|
99
99
|
const bridgeOutParams = sdk.buildCrossChainWithdrawBridgeOutParams({
|
|
100
100
|
tokenAddress: multichainTestUtil_1.USDC_ARBITRUM,
|
|
101
101
|
amount: WITHDRAW_AMOUNT,
|
|
@@ -69,7 +69,6 @@ exports.CONTRACTS = {
|
|
|
69
69
|
ArbitrumNodeInterface: "0x00000000000000000000000000000000000000C8",
|
|
70
70
|
ArbSys: "0x0000000000000000000000000000000000000064",
|
|
71
71
|
LayerZeroEndpoint: "0x1a44076050125825900e736c501f859c50fE728c",
|
|
72
|
-
GelatoRelayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92",
|
|
73
72
|
},
|
|
74
73
|
[chains_1.AVALANCHE]: {
|
|
75
74
|
// V1
|
|
@@ -135,7 +134,6 @@ exports.CONTRACTS = {
|
|
|
135
134
|
Multicall: "0x50474CAe810B316c294111807F94F9f48527e7F8",
|
|
136
135
|
ArbitrumNodeInterface: viem_1.zeroAddress,
|
|
137
136
|
LayerZeroEndpoint: "0x1a44076050125825900e736c501f859c50fE728c",
|
|
138
|
-
GelatoRelayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92",
|
|
139
137
|
},
|
|
140
138
|
[chains_1.MEGAETH]: {
|
|
141
139
|
// Synthetics
|
|
@@ -171,7 +169,6 @@ exports.CONTRACTS = {
|
|
|
171
169
|
Multicall: "0xF516BC01c50eebdBad4d7E506c8f690ae8EAFc52",
|
|
172
170
|
LayerZeroEndpoint: "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B",
|
|
173
171
|
ArbitrumNodeInterface: viem_1.zeroAddress,
|
|
174
|
-
GelatoRelayAddress: "0xcd565435e0d2109feFde337a66491541Df0D1420",
|
|
175
172
|
Vault: viem_1.zeroAddress,
|
|
176
173
|
Reader: viem_1.zeroAddress,
|
|
177
174
|
PositionRouter: viem_1.zeroAddress,
|
|
@@ -304,7 +301,6 @@ exports.CONTRACTS = {
|
|
|
304
301
|
LayerZeroEndpoint: "0x6EDCE65403992e310A62460808c4b910D972f10f",
|
|
305
302
|
ArbitrumNodeInterface: "0x00000000000000000000000000000000000000C8",
|
|
306
303
|
ArbSys: "0x0000000000000000000000000000000000000064",
|
|
307
|
-
GelatoRelayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92",
|
|
308
304
|
ExternalHandler: viem_1.zeroAddress,
|
|
309
305
|
GLP: viem_1.zeroAddress,
|
|
310
306
|
GMX: viem_1.zeroAddress,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRelayerFeeToken = exports.getDefaultGasPaymentToken = exports.getGasPaymentTokens = exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = exports.
|
|
4
|
-
const numbers_1 = require("../utils/numbers");
|
|
3
|
+
exports.getRelayerFeeToken = exports.getDefaultGasPaymentToken = exports.getGasPaymentTokens = exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 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;
|
|
5
4
|
const time_1 = require("../utils/time");
|
|
6
5
|
const chains_1 = require("./chains");
|
|
7
6
|
const tokens_1 = require("./tokens");
|
|
@@ -11,14 +10,6 @@ exports.DEFAULT_SUBACCOUNT_EXPIRY_DURATION = (0, time_1.periodToSeconds)(7, "1d"
|
|
|
11
10
|
exports.DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = 90;
|
|
12
11
|
exports.DEFAULT_PERMIT_DEADLINE_DURATION = (0, time_1.periodToSeconds)(1, "1h");
|
|
13
12
|
exports.DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = (0, time_1.periodToSeconds)(1, "1h");
|
|
14
|
-
exports.MIN_RELAYER_FEE_USD = 5n ** BigInt(numbers_1.USD_DECIMALS - 1); // 0.5$
|
|
15
|
-
/** @deprecated Gelato shuts its relay services down on 2026-09-01; use GMX Relay (`sendToGmxRelay`). */
|
|
16
|
-
exports.GELATO_API_KEYS = {
|
|
17
|
-
[chains_1.ARBITRUM]: "6dE6kOa9pc1ap4dQQC2iaK9i6nBFp8eYxQlm00VreWc_",
|
|
18
|
-
[chains_1.AVALANCHE]: "FalsQh9loL6V0rwPy4gWgnQPR6uTHfWjSVT2qlTzUq4_",
|
|
19
|
-
[chains_1.ARBITRUM_SEPOLIA]: "nx5nyAg4h2kI_64YtOuPt7LSPDEXo4u8eJY_idF9xDw_",
|
|
20
|
-
[chains_1.MEGAETH]: "MDPcJgFTWgc8ifFElmv_vHLaioG_h8GU2ZDju1eyQ4Y_",
|
|
21
|
-
};
|
|
22
13
|
exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
|
|
23
14
|
const GAS_PAYMENT_TOKENS = {
|
|
24
15
|
[chains_1.ARBITRUM]: [
|
|
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./relayStatus"), exports);
|
|
17
18
|
__exportStar(require("./types"), exports);
|
|
18
19
|
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatusCode = void 0;
|
|
4
|
+
var StatusCode;
|
|
5
|
+
(function (StatusCode) {
|
|
6
|
+
StatusCode[StatusCode["Pending"] = 100] = "Pending";
|
|
7
|
+
StatusCode[StatusCode["Submitted"] = 110] = "Submitted";
|
|
8
|
+
StatusCode[StatusCode["Success"] = 200] = "Success";
|
|
9
|
+
StatusCode[StatusCode["Rejected"] = 400] = "Rejected";
|
|
10
|
+
StatusCode[StatusCode["Reverted"] = 500] = "Reverted";
|
|
11
|
+
})(StatusCode || (exports.StatusCode = StatusCode = {}));
|
|
@@ -26,7 +26,6 @@ function isPermanentRelayError(error) {
|
|
|
26
26
|
}
|
|
27
27
|
exports.isPermanentRelayError = isPermanentRelayError;
|
|
28
28
|
async function sendToGmxRelay({ chainId, txnData, apiUrl, }) {
|
|
29
|
-
// bare relay-router calldata: the fee is computed on-chain, so no Gelato fee suffix is appended
|
|
30
29
|
const result = await post(resolveApiUrl(chainId, apiUrl), "/v1/relay/submit", { to: txnData.to, data: txnData.callData }, SUBMIT_TIMEOUT_MS);
|
|
31
30
|
if (!result.taskId) {
|
|
32
31
|
throw new GmxRelayError("GMX Relay returned no taskId");
|
|
@@ -26,7 +26,7 @@ function jsonResponse(body, status = 200) {
|
|
|
26
26
|
(0, vitest_1.expect)(error).toBeInstanceOf(gmxRelayUtils_1.GmxRelayError);
|
|
27
27
|
(0, vitest_1.expect)(error.data).toEqual({ traceId: "tr-1" });
|
|
28
28
|
});
|
|
29
|
-
(0, vitest_1.it)("posts bare calldata
|
|
29
|
+
(0, vitest_1.it)("posts bare relay-router calldata", async () => {
|
|
30
30
|
const fetchMock = vitest_1.vi.fn(async () => jsonResponse({ taskId: TASK_ID, status: "pending" }));
|
|
31
31
|
vitest_1.vi.stubGlobal("fetch", fetchMock);
|
|
32
32
|
const result = await (0, gmxRelayUtils_1.sendToGmxRelay)({ chainId: chains_1.ARBITRUM, txnData: TXN_DATA });
|
|
@@ -18,11 +18,9 @@ __exportStar(require("../types"), exports);
|
|
|
18
18
|
__exportStar(require("./oracleParamsUtils"), exports);
|
|
19
19
|
__exportStar(require("./relayParamsUtils"), exports);
|
|
20
20
|
__exportStar(require("./batchOrderUtils"), exports);
|
|
21
|
-
__exportStar(require("./gelatoRelayUtils"), exports);
|
|
22
21
|
__exportStar(require("./gmxRelayUtils"), exports);
|
|
23
22
|
__exportStar(require("./globalExpressParams"), exports);
|
|
24
23
|
__exportStar(require("./expressParamsUtils"), exports);
|
|
25
24
|
__exportStar(require("./estimateExpressParams"), exports);
|
|
26
|
-
__exportStar(require("./fetchGelatoGasTankBalance"), exports);
|
|
27
25
|
__exportStar(require("./bridgeOutUtils"), exports);
|
|
28
26
|
__exportStar(require("./referralUtils"), exports);
|
|
@@ -80,7 +80,7 @@ exports.buildSameChainWithdrawTxn = buildSameChainWithdrawTxn;
|
|
|
80
80
|
/**
|
|
81
81
|
* `BridgeOutParams.data` for cross-chain delivery is a single `uint32 dstEid`
|
|
82
82
|
* pointing at the destination LayerZero endpoint; the on-chain provider takes
|
|
83
|
-
* care of building the actual Stargate `sendParams`. Wrap into a
|
|
83
|
+
* care of building the actual Stargate `sendParams`. Wrap into a relayed
|
|
84
84
|
* express transaction via `buildAndSignBridgeOutTxn` from
|
|
85
85
|
* `utils/express/utils/bridgeOutUtils`.
|
|
86
86
|
*/
|
|
@@ -28,7 +28,7 @@ async function ensureLongPosition() {
|
|
|
28
28
|
const pos = positions.find((p) => p.isLong && p.indexName?.includes("ETH/USD"));
|
|
29
29
|
if (pos)
|
|
30
30
|
return pos;
|
|
31
|
-
// Retry once — first
|
|
31
|
+
// Retry once — first relay call in a test run can be flaky
|
|
32
32
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
33
33
|
try {
|
|
34
34
|
await openLongPosition();
|
|
@@ -76,7 +76,7 @@ describe("multichain cross-chain deposit (Base → Arbitrum, API-driven)", () =>
|
|
|
76
76
|
expect(result.nativeFee).toBeGreaterThan(0n);
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
|
-
describe("multichain cross-chain withdraw (Arbitrum → Base, via
|
|
79
|
+
describe("multichain cross-chain withdraw (Arbitrum → Base, via GMX Relay)", () => {
|
|
80
80
|
it("prepare: returns typed-data + gasPaymentParams", async () => {
|
|
81
81
|
const bridgeOutParams = sdk.buildCrossChainWithdrawBridgeOutParams({
|
|
82
82
|
tokenAddress: USDC_ARBITRUM,
|
|
@@ -93,7 +93,7 @@ describe("multichain cross-chain withdraw (Arbitrum → Base, via Gelato)", () =
|
|
|
93
93
|
expect(prepared.payload.typedData.primaryType).toBe("BridgeOut");
|
|
94
94
|
expect(prepared.payload.gasPaymentParams.relayerFeeAmount).toBeGreaterThan(0n);
|
|
95
95
|
});
|
|
96
|
-
it.skipIf(!shouldSendOnChain())("execute: resolves to terminal
|
|
96
|
+
it.skipIf(!shouldSendOnChain())("execute: resolves to terminal relay status", async () => {
|
|
97
97
|
const bridgeOutParams = sdk.buildCrossChainWithdrawBridgeOutParams({
|
|
98
98
|
tokenAddress: USDC_ARBITRUM,
|
|
99
99
|
amount: WITHDRAW_AMOUNT,
|
|
@@ -66,7 +66,6 @@ export const CONTRACTS = {
|
|
|
66
66
|
ArbitrumNodeInterface: "0x00000000000000000000000000000000000000C8",
|
|
67
67
|
ArbSys: "0x0000000000000000000000000000000000000064",
|
|
68
68
|
LayerZeroEndpoint: "0x1a44076050125825900e736c501f859c50fE728c",
|
|
69
|
-
GelatoRelayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92",
|
|
70
69
|
},
|
|
71
70
|
[AVALANCHE]: {
|
|
72
71
|
// V1
|
|
@@ -132,7 +131,6 @@ export const CONTRACTS = {
|
|
|
132
131
|
Multicall: "0x50474CAe810B316c294111807F94F9f48527e7F8",
|
|
133
132
|
ArbitrumNodeInterface: zeroAddress,
|
|
134
133
|
LayerZeroEndpoint: "0x1a44076050125825900e736c501f859c50fE728c",
|
|
135
|
-
GelatoRelayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92",
|
|
136
134
|
},
|
|
137
135
|
[MEGAETH]: {
|
|
138
136
|
// Synthetics
|
|
@@ -168,7 +166,6 @@ export const CONTRACTS = {
|
|
|
168
166
|
Multicall: "0xF516BC01c50eebdBad4d7E506c8f690ae8EAFc52",
|
|
169
167
|
LayerZeroEndpoint: "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B",
|
|
170
168
|
ArbitrumNodeInterface: zeroAddress,
|
|
171
|
-
GelatoRelayAddress: "0xcd565435e0d2109feFde337a66491541Df0D1420",
|
|
172
169
|
Vault: zeroAddress,
|
|
173
170
|
Reader: zeroAddress,
|
|
174
171
|
PositionRouter: zeroAddress,
|
|
@@ -301,7 +298,6 @@ export const CONTRACTS = {
|
|
|
301
298
|
LayerZeroEndpoint: "0x6EDCE65403992e310A62460808c4b910D972f10f",
|
|
302
299
|
ArbitrumNodeInterface: "0x00000000000000000000000000000000000000C8",
|
|
303
300
|
ArbSys: "0x0000000000000000000000000000000000000064",
|
|
304
|
-
GelatoRelayAddress: "0xaBcC9b596420A9E9172FD5938620E265a0f9Df92",
|
|
305
301
|
ExternalHandler: zeroAddress,
|
|
306
302
|
GLP: zeroAddress,
|
|
307
303
|
GMX: zeroAddress,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { USD_DECIMALS } from "../utils/numbers";
|
|
2
1
|
import { periodToSeconds } from "../utils/time";
|
|
3
2
|
import { ARBITRUM, ARBITRUM_SEPOLIA, AVALANCHE, AVALANCHE_FUJI, MEGAETH } from "./chains";
|
|
4
3
|
import { getTokenBySymbol, getWrappedToken } from "./tokens";
|
|
@@ -8,14 +7,6 @@ export const DEFAULT_SUBACCOUNT_EXPIRY_DURATION = periodToSeconds(7, "1d"); // 1
|
|
|
8
7
|
export const DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = 90;
|
|
9
8
|
export const DEFAULT_PERMIT_DEADLINE_DURATION = periodToSeconds(1, "1h");
|
|
10
9
|
export const DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = periodToSeconds(1, "1h");
|
|
11
|
-
export const MIN_RELAYER_FEE_USD = 5n ** BigInt(USD_DECIMALS - 1); // 0.5$
|
|
12
|
-
/** @deprecated Gelato shuts its relay services down on 2026-09-01; use GMX Relay (`sendToGmxRelay`). */
|
|
13
|
-
export const GELATO_API_KEYS = {
|
|
14
|
-
[ARBITRUM]: "6dE6kOa9pc1ap4dQQC2iaK9i6nBFp8eYxQlm00VreWc_",
|
|
15
|
-
[AVALANCHE]: "FalsQh9loL6V0rwPy4gWgnQPR6uTHfWjSVT2qlTzUq4_",
|
|
16
|
-
[ARBITRUM_SEPOLIA]: "nx5nyAg4h2kI_64YtOuPt7LSPDEXo4u8eJY_idF9xDw_",
|
|
17
|
-
[MEGAETH]: "MDPcJgFTWgc8ifFElmv_vHLaioG_h8GU2ZDju1eyQ4Y_",
|
|
18
|
-
};
|
|
19
10
|
export const EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
|
|
20
11
|
const GAS_PAYMENT_TOKENS = {
|
|
21
12
|
[ARBITRUM]: [
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var StatusCode;
|
|
2
|
+
(function (StatusCode) {
|
|
3
|
+
StatusCode[StatusCode["Pending"] = 100] = "Pending";
|
|
4
|
+
StatusCode[StatusCode["Submitted"] = 110] = "Submitted";
|
|
5
|
+
StatusCode[StatusCode["Success"] = 200] = "Success";
|
|
6
|
+
StatusCode[StatusCode["Rejected"] = 400] = "Rejected";
|
|
7
|
+
StatusCode[StatusCode["Reverted"] = 500] = "Reverted";
|
|
8
|
+
})(StatusCode || (StatusCode = {}));
|
|
@@ -21,7 +21,6 @@ export function isPermanentRelayError(error) {
|
|
|
21
21
|
return error instanceof GmxRelayError && error.isPermanent;
|
|
22
22
|
}
|
|
23
23
|
export async function sendToGmxRelay({ chainId, txnData, apiUrl, }) {
|
|
24
|
-
// bare relay-router calldata: the fee is computed on-chain, so no Gelato fee suffix is appended
|
|
25
24
|
const result = await post(resolveApiUrl(chainId, apiUrl), "/v1/relay/submit", { to: txnData.to, data: txnData.callData }, SUBMIT_TIMEOUT_MS);
|
|
26
25
|
if (!result.taskId) {
|
|
27
26
|
throw new GmxRelayError("GMX Relay returned no taskId");
|
|
@@ -24,7 +24,7 @@ describe("sendToGmxRelay", () => {
|
|
|
24
24
|
expect(error).toBeInstanceOf(GmxRelayError);
|
|
25
25
|
expect(error.data).toEqual({ traceId: "tr-1" });
|
|
26
26
|
});
|
|
27
|
-
it("posts bare calldata
|
|
27
|
+
it("posts bare relay-router calldata", async () => {
|
|
28
28
|
const fetchMock = vi.fn(async () => jsonResponse({ taskId: TASK_ID, status: "pending" }));
|
|
29
29
|
vi.stubGlobal("fetch", fetchMock);
|
|
30
30
|
const result = await sendToGmxRelay({ chainId: ARBITRUM, txnData: TXN_DATA });
|
|
@@ -2,11 +2,9 @@ export * from "../types";
|
|
|
2
2
|
export * from "./oracleParamsUtils";
|
|
3
3
|
export * from "./relayParamsUtils";
|
|
4
4
|
export * from "./batchOrderUtils";
|
|
5
|
-
export * from "./gelatoRelayUtils";
|
|
6
5
|
export * from "./gmxRelayUtils";
|
|
7
6
|
export * from "./globalExpressParams";
|
|
8
7
|
export * from "./expressParamsUtils";
|
|
9
8
|
export * from "./estimateExpressParams";
|
|
10
|
-
export * from "./fetchGelatoGasTankBalance";
|
|
11
9
|
export * from "./bridgeOutUtils";
|
|
12
10
|
export * from "./referralUtils";
|
|
@@ -74,7 +74,7 @@ export function buildSameChainWithdrawTxn(request) {
|
|
|
74
74
|
/**
|
|
75
75
|
* `BridgeOutParams.data` for cross-chain delivery is a single `uint32 dstEid`
|
|
76
76
|
* pointing at the destination LayerZero endpoint; the on-chain provider takes
|
|
77
|
-
* care of building the actual Stargate `sendParams`. Wrap into a
|
|
77
|
+
* care of building the actual Stargate `sendParams`. Wrap into a relayed
|
|
78
78
|
* express transaction via `buildAndSignBridgeOutTxn` from
|
|
79
79
|
* `utils/express/utils/bridgeOutUtils`.
|
|
80
80
|
*/
|