You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BlockHeightExceeded means you need set higher priority fees, if you are swaping through high fluctuation price pool, it will have high possibility expired
`import {
SendTransactionError,
Transaction,
VersionedTransaction,
sendAndConfirmTransaction,
} from "@solana/web3.js";
import { NATIVE_MINT } from "@solana/spl-token";
import axios from "axios";
import { connection, owner, fetchTokenAccountData } from "./config";
import { API_URLS } from "@raydium-io/raydium-sdk-v2";
interface SwapCompute {
id: string;
success: true;
version: "V0" | "V1";
openTime?: undefined;
msg: undefined;
data: {
swapType: "BaseIn" | "BaseOut";
inputMint: string;
inputAmount: string;
outputMint: string;
outputAmount: string;
otherAmountThreshold: string;
slippageBps: number;
priceImpactPct: number;
routePlan: {
poolId: string;
inputMint: string;
outputMint: string;
feeMint: string;
feeRate: number;
feeAmount: string;
}[];
};
}
export const apiSwap = async () => {
try {
const inputMint = NATIVE_MINT.toBase58();
const outputMint = "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R"; // RAY
const amount = 100000;
const slippage = 0.5; // in percent, for this example, 0.5 means 0.5%
const txVersion: string = "LEGACY"; // or LEGACY
const isV0Tx = txVersion === "V0";
} catch (error) {
if (error instanceof SendTransactionError) {
console.error("Transaction failed:", error.message);
const logs = await error.getLogs(connection);
console.error("Transaction logs:", logs);
} else {
console.error("Unexpected error:", error);
}
console.log("error:", error);
}
}`
I used paid rpc mainnet and sometimes it worked, sometimes it got BlockHeightExceeded, sometimes it got Tick Array error.
The text was updated successfully, but these errors were encountered: