admin管理员组文章数量:1129075
I use quicknode metis jup to get quotes to build swaps, and trade through quicknode's solana nodes.I tried a lot, and even if I set the quote slippage parameter and swap priority fee to automatic, my transaction success rate was still low.Many transactions cannot be found on the chain at all, as if nothing happened.Below are the parameters I currently use to obtain quotes and build swaps:
`const params = {
inputMint: "So11111111111111111111111111111111111111112",
outputMint: "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
amount: 10000000,
slippageBps: 20,
onlyDirectRoutes: true,
autoSlippage: true
};
const quote = await jupiterTrader.getQuoteBase(params);`
`async getSwapTransaction(quoteResponse) {
return await promiseRetry(async (retry) => {
try {
const response = await fetch('', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
quoteResponse,
userPublicKey: this.wallet.publicKey.toString(),
wrapAndUnwrapSol: true,
dynamicComputeUnitLimit: true,
prioritizationFeeLamports: 'auto'
})
});
if (!response.ok) {
throw new Error(`API请求失败: ${response.status}`);
}
return response.json();
} catch (error) {
return retry(error);
}
}, this.RETRY_OPTIONS);
}`
I want to achieve a 90% success rate in my transactions. I mainly trade mainstream currencies through JUP's API, and I am willing to pay priority fees. I hope you can share some good code snippets or point out problems with my code.
本文标签:
版权声明:本文标题:javascript - I only succeed once out of 10 times when using solana.js to perform swap transactions?How to prove it - Stack Overf 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736725812a1949719.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论