skip eth approve

This commit is contained in:
2025-09-06 13:49:25 +07:00
parent 5199f533b3
commit 057abcd04d

View File

@@ -1770,6 +1770,10 @@ export const swapGmxTokensImpl = async (
// Check and handle token allowance for ExchangeRouter contract // Check and handle token allowance for ExchangeRouter contract
const syntheticsRouterRouterAddress = getContract(sdk.chainId, "SyntheticsRouter"); const syntheticsRouterRouterAddress = getContract(sdk.chainId, "SyntheticsRouter");
// If ticker ETH no need to check allowance
if (fromTicker === "ETH") {
console.log(`✅ ETH no need to check allowance`);
}else {
try { try {
const currentAllowance = await getTokenAllowance( const currentAllowance = await getTokenAllowance(
sdk.account, sdk.account,
@@ -1805,6 +1809,7 @@ export const swapGmxTokensImpl = async (
console.warn('Could not check or approve token allowance:', allowanceError); console.warn('Could not check or approve token allowance:', allowanceError);
throw new Error(`Failed to handle token allowance: ${allowanceError instanceof Error ? allowanceError.message : 'Unknown error'}`); throw new Error(`Failed to handle token allowance: ${allowanceError instanceof Error ? allowanceError.message : 'Unknown error'}`);
} }
}
// Calculate trigger price for limit orders // Calculate trigger price for limit orders
let triggerPrice: bigint | undefined; let triggerPrice: bigint | undefined;