Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4c18696
Refactor multichain integration by removing unused IStargateAbi impor…
midas-myth Dec 12, 2025
078283a
Remove unused Typechain files for IStargate, including common types, …
midas-myth Dec 12, 2025
fb899ad
Enhance error handling and refactor event subscription methods across…
midas-myth Dec 13, 2025
f83c75a
Refactor transaction encoding in synthetic markets and multichain dep…
midas-myth Dec 13, 2025
dac148e
Remove unused Typechain files and factories to streamline the codebas…
midas-myth Dec 13, 2025
753c55a
Refactor address handling across multiple components to utilize and …
midas-myth Dec 13, 2025
2407fe9
Refactor multichain and transaction handling by introducing ISigner f…
midas-myth Dec 13, 2025
65031fc
Merge branch 'roll-out-rpc-fallbacks' of github.com:gmx-io/gmx-interf…
midas-myth Dec 24, 2025
f60a8aa
Remove unused typechain types and related factory files from the proj…
midas-myth Dec 24, 2025
b77d1d8
Refactor address validation to use non-strict mode across multiple co…
midas-myth Dec 26, 2025
e5e17eb
Enhance RPC transport configuration by introducing type safety for pr…
midas-myth Dec 26, 2025
87c501f
Refactor error handling in trade history utilities by introducing a n…
midas-myth Dec 26, 2025
4232eb7
Merge branch 'release' of github.com:gmx-io/gmx-interface into remove…
midas-myth Jan 7, 2026
e8c8e26
Update subsquid URLs in indexers configuration to use production endp…
midas-myth Jan 7, 2026
17ed4af
Merge branch 'release' of github.com:gmx-io/gmx-interface into remove…
midas-myth Jan 7, 2026
2c7170d
Merge branch 'release' of github.com:gmx-io/gmx-interface into remove…
midas-myth Jan 8, 2026
7880857
Refactor multichain event handling and websocket context. Simplified …
midas-myth Jan 8, 2026
e3b357e
Remove WebsocketContextProvider and related references. Update event …
midas-myth Jan 9, 2026
2ee3104
Refactor block timestamp and block number retrieval in simulateExecut…
midas-myth Jan 9, 2026
913e803
Refactor error handling in simulateExecuteTxn and simulation functions
midas-myth Jan 14, 2026
430cb61
Merge branch 'release' of github.com:gmx-io/gmx-interface into remove…
midas-myth Jan 14, 2026
5064962
Enhance error handling in parseError and related utilities; add tests…
midas-myth Jan 15, 2026
91678db
Refactor useMultichainEvents to utilize getByKey for token ID retriev…
midas-myth Jan 15, 2026
4847e92
Merge branch 'release' of github.com:gmx-io/gmx-interface into remove…
midas-myth Jan 15, 2026
580cbc7
Merge branch 'release' of github.com:gmx-io/gmx-interface into remove…
midas-myth Jan 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"local-rules/no-logical-bigint": "off",

"es-x/no-bigint": "off",
"es-x/no-optional-catch-binding": "off",
"es-x/no-optional-chaining": "off",
"es-x/no-import-meta": "off",
"es-x/no-dynamic-import": "off",
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
.pnp.js
.vscode

# typechain-types
/src/typechain-types

# lingui
/src/locales/**/*.js
Expand Down
2 changes: 0 additions & 2 deletions sdk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ yarn-error.log*
# For publish
.npmrc

typechain-types

package-lock.json

.yarn/*
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/types/tradeHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type PositionTradeAction = {
orderKey: string;
isLong: boolean;
reason?: string;
reasonBytes?: string | Uint8Array;
reasonBytes?: string;
shouldUnwrapNativeToken: boolean;
totalImpactUsd?: bigint;
liquidationFeeAmount?: bigint;
Expand Down Expand Up @@ -78,7 +78,7 @@ export type SwapTradeAction = {
orderType: OrderType;
orderKey: string;
reason?: string;
reasonBytes?: string | Uint8Array;
reasonBytes?: string;
twapParams:
| {
twapGroupId: string;
Expand Down
7 changes: 3 additions & 4 deletions src/App/AppRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ethers } from "ethers";
import { useCallback, useEffect, useState } from "react";
import { useHistory, useLocation } from "react-router-dom";
import { cssTransition, ToastContainer } from "react-toastify";
import { Hash } from "viem";
import { Hash, zeroHash } from "viem";

import { CONTRACTS_CHAIN_IDS, ContractsChainId } from "config/chains";
import { REFERRAL_CODE_KEY } from "config/localStorage";
Expand Down Expand Up @@ -71,7 +70,7 @@ export function AppRoutes() {

if (referralCode && referralCode.length <= 20) {
const encodedReferralCode = encodeReferralCode(referralCode);
if (encodedReferralCode !== ethers.ZeroHash) {
if (encodedReferralCode !== zeroHash) {
localStorage.setItem(REFERRAL_CODE_KEY, encodedReferralCode);
const queryParams = new URLSearchParams(location.search);
if (queryParams.has(REFERRAL_CODE_QUERY_PARAM)) {
Expand All @@ -96,7 +95,7 @@ export function AppRoutes() {
const localStorageCode = window.localStorage.getItem(REFERRAL_CODE_KEY);
const baseUrl = getAppBaseUrl();
let appRedirectUrl = baseUrl;
if (localStorageCode && localStorageCode.length > 0 && localStorageCode !== ethers.ZeroHash) {
if (localStorageCode && localStorageCode.length > 0 && localStorageCode !== zeroHash) {
const decodedRefCode = decodeReferralCode(localStorageCode as Hash);
if (decodedRefCode) {
appRedirectUrl = `${appRedirectUrl}?ref=${decodedRefCode}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Trans, t } from "@lingui/macro";
import cx from "classnames";
import { ZeroAddress, ethers } from "ethers";
import { ethers } from "ethers";
import { useCallback, useEffect, useMemo, useState } from "react";
import { zeroAddress } from "viem";

import { ARBITRUM, ContractsChainId } from "config/chains";
import { BASIS_POINTS_DIVISOR_BIGINT } from "config/factors";
Expand Down Expand Up @@ -121,7 +122,7 @@ export function StakeModal(props: {
}, [isVisible, setStakeValue, setUnstakeValue]);

const needApproval =
stakeFarmAddress !== ZeroAddress &&
stakeFarmAddress !== zeroAddress &&
tokenAllowance !== undefined &&
stakeAmount !== undefined &&
stakeAmount > tokenAllowance;
Expand Down
1 change: 0 additions & 1 deletion src/components/GmxAccountModal/DepositView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ export const DepositView = () => {
const quoteOft = useQuoteOft({
sendParams: sendParamsWithoutSlippage,
fromStargateAddress: selectedTokenSourceChainTokenId?.stargate,
fromChainProvider: sourceChainProvider,
fromChainId: depositViewChain,
toChainId: settlementChainId,
});
Expand Down
1 change: 0 additions & 1 deletion src/components/GmxAccountModal/WithdrawalView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ export const WithdrawalView = () => {
const quoteOft = useQuoteOft({
sendParams: sendParamsWithoutSlippage,
fromStargateAddress: selectedTokenSettlementChainTokenId?.stargate,
fromChainProvider: provider,
fromChainId: chainId,
toChainId: withdrawalViewChain,
});
Expand Down
43 changes: 30 additions & 13 deletions src/components/Referrals/JoinReferralCode.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { t, Trans } from "@lingui/macro";
import { useConnectModal } from "@rainbow-me/rainbowkit";
import { Contract } from "ethers";
import { useEffect, useMemo, useRef, useState } from "react";
import { encodeFunctionData, zeroAddress } from "viem";
import { createWalletClient, encodeFunctionData, publicActions, zeroAddress } from "viem";
import { usePublicClient } from "wagmi";

import {
CHAIN_ID_PREFERRED_DEPOSIT_TOKEN,
FAKE_INPUT_AMOUNT_MAP,
getMappedTokenId,
isSettlementChain,
IStargateAbi,
RANDOM_WALLET,
RANDOM_ACCOUNT,
} from "config/multichain";
import { usePendingTxns } from "context/PendingTxnsContext/PendingTxnsContext";
import { selectExpressGlobalParams } from "context/SyntheticsStateContext/selectors/expressSelectors";
Expand All @@ -32,14 +30,17 @@ import { helperToast } from "lib/helperToast";
import { formatUsd, numberToBigint } from "lib/numbers";
import { useJsonRpcProvider } from "lib/rpc";
import { sendWalletTransaction } from "lib/transactions";
import { ISigner } from "lib/transactions/iSigner";
import { useHasOutdatedUi } from "lib/useHasOutdatedUi";
import { useThrottledAsync } from "lib/useThrottledAsync";
import { getPublicClientWithRpc, getRpcTransport } from "lib/wallets/rainbowKitConfig";
import useWallet from "lib/wallets/useWallet";
import { abis } from "sdk/abis";
import { getViemChain } from "sdk/configs/chains";
import { DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION } from "sdk/configs/express";
import { getEmptyExternalCallsPayload } from "sdk/utils/orderTransactions";
import { encodeReferralCode } from "sdk/utils/referrals";
import { nowInSeconds } from "sdk/utils/time";
import type { IStargate } from "typechain-types-stargate";

import Button from "components/Button/Button";
import { useMultichainTradeTokensRequest } from "components/GmxAccountModal/hooks";
Expand Down Expand Up @@ -253,12 +254,18 @@ function ReferralCodeFormMultichain({
const hasOutdatedUi = useHasOutdatedUi();

const simulationSigner = useMemo(() => {
if (!signer?.provider) {
if (srcChainId === undefined) {
return;
}

return RANDOM_WALLET.connect(signer?.provider);
}, [signer?.provider]);
return ISigner.fromViemSigner(
createWalletClient({
chain: getViemChain(srcChainId),
account: RANDOM_ACCOUNT,
transport: getRpcTransport(srcChainId, "default"),
}).extend(publicActions)
);
}, [srcChainId]);

const globalExpressParams = useSelector(selectExpressGlobalParams);

Expand Down Expand Up @@ -344,8 +351,6 @@ function ReferralCodeFormMultichain({

const sourceChainStargateAddress = p.sourceChainTokenId.stargate;

const iStargateInstance = new Contract(sourceChainStargateAddress, IStargateAbi, signer) as unknown as IStargate;

const tokenAmount =
FAKE_INPUT_AMOUNT_MAP[p.sourceChainTokenId.symbol] ?? numberToBigint(0.02, p.sourceChainTokenId.decimals);

Expand All @@ -360,7 +365,14 @@ function ReferralCodeFormMultichain({
action,
});

const [limit, oftFeeDetails] = await iStargateInstance.quoteOFT(sendParamsWithRoughAmount);
const sourceChainPublicClient = getPublicClientWithRpc(p.srcChainId);

const [limit, oftFeeDetails] = await sourceChainPublicClient.readContract({
address: sourceChainStargateAddress,
abi: abis.IStargate,
functionName: "quoteOFT",
args: [sendParamsWithRoughAmount],
});

let negativeFee = 0n;
for (const oftFeeDetail of oftFeeDetails) {
Expand All @@ -379,7 +391,12 @@ function ReferralCodeFormMultichain({
minAmountLD: 0n,
};

const quoteSend = await iStargateInstance.quoteSend(sendParamsWithMinimumAmount, false);
const quoteSend = await sourceChainPublicClient.readContract({
address: sourceChainStargateAddress,
abi: abis.IStargate,
functionName: "quoteSend",
args: [sendParamsWithMinimumAmount, false],
});

return {
nativeFee: quoteSend.nativeFee,
Expand Down Expand Up @@ -498,7 +515,7 @@ function ReferralCodeFormMultichain({
to: sourceChainStargateAddress,
signer: signer,
callData: encodeFunctionData({
abi: IStargateAbi,
abi: abis.IStargate,
functionName: "sendToken",
args: [sendParams, { nativeFee: result.data.nativeFee, lzTokenFee: 0n }, account],
}),
Expand Down
90 changes: 48 additions & 42 deletions src/components/TradeHistory/TradeHistoryRow/utils/position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,19 @@ export const formatPositionMessage = (
const customSize = sizeDeltaUsd > 0 ? sizeDeltaText : formattedCollateralDelta;
const customPrice = acceptablePriceInequality + formattedAcceptablePrice;
const error = tradeAction.reasonBytes ? tryGetError(tradeAction.reasonBytes) ?? undefined : undefined;

const priceComment = lines(
t`Acceptable price for the order.`,
error?.args?.price && "",
error?.args?.price &&
infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
error?.args?.price !== undefined ? "" : undefined,
error?.args?.price !== undefined
? infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
: undefined
);

result = {
Expand Down Expand Up @@ -333,14 +335,15 @@ export const formatPositionMessage = (
isAcceptablePriceUseful
? infoRow(t`Order Acceptable Price`, acceptablePriceInequality + formattedAcceptablePrice)
: undefined,
error?.args?.price &&
infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
error?.args?.price !== undefined
? infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
: undefined
),
acceptablePrice: isAcceptablePriceUseful ? acceptablePriceInequality + formattedAcceptablePrice : undefined,
isActionError: true,
Expand All @@ -367,15 +370,16 @@ export const formatPositionMessage = (
const error = tradeAction.reasonBytes ? tryGetError(tradeAction.reasonBytes) ?? undefined : undefined;
const priceComment = lines(
t`Acceptable price for the order.`,
error?.args?.price && "",
error?.args?.price &&
infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
error?.args?.price !== undefined ? "" : undefined,
error?.args?.price !== undefined
? infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
: undefined
);

result = {
Expand Down Expand Up @@ -458,14 +462,15 @@ export const formatPositionMessage = (
"",
infoRow(t`Order Trigger Price`, triggerPriceInequality + formattedTriggerPrice),
infoRow(t`Order Acceptable Price`, acceptablePriceInequality + formattedAcceptablePrice),
error?.args?.price &&
infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
error?.args?.price !== undefined
? infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
: undefined
),
acceptablePrice: acceptablePriceInequality + formattedAcceptablePrice,
isActionError: true,
Expand Down Expand Up @@ -520,14 +525,15 @@ export const formatPositionMessage = (
isAcceptablePriceUseful
? infoRow(t`Order Acceptable Price`, acceptablePriceInequality + formattedAcceptablePrice)
: undefined,
error?.args?.price &&
infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
error?.args?.price !== undefined
? infoRow(
t`Order Execution Price`,
formatUsd(parseContractPrice(error.args.price, tradeAction.indexToken.decimals), {
displayDecimals: marketPriceDecimals,
visualMultiplier: tradeAction.indexToken.visualMultiplier,
})
)
: undefined
),
isActionError: true,
};
Expand Down
Loading