Comments (5)
An even better addition:
// Execute the transaction
var tryAgain=true;
var objSignatureStatusResult;
var maxTriesCounter=0;
var maxTries=5;
while (tryAgain) {
maxTriesCounter++;
const rawTransaction = transaction.serialize()
const txid = await connection.sendRawTransaction(rawTransaction, {
skipPreflight: true,
maxRetries: 2
});
console.log(`https://solscan.io/tx/${txid}`);
await new Promise(r => setTimeout(r, 1500));
const result = await connection.getSignatureStatus(txid, {
searchTransactionHistory: true,
});
objSignatureStatusResult = JSON.parse(JSON.stringify(result));
if ( objSignatureStatusResult.value !== null) tryAgain=false;
if (maxTriesCounter>maxTries) tryAgain=false;
}
from jupiter-core-example.
I'm facing the exact same issue. If I try to swap a less busy token - it works almost every time, however, with busier tokens it rarely succeeds. Did you ever find a solution to the problem?
from jupiter-core-example.
For me it helped to wait 5 seconds and use another way to validate the transaction:
await new Promise(r => setTimeout(r, 5000));
const result = await connection.getSignatureStatus(txid, {
searchTransactionHistory: true,
});
console.log(result);
from jupiter-core-example.
An even better addition:
// Execute the transaction var tryAgain=true; var objSignatureStatusResult; var maxTriesCounter=0; var maxTries=5; while (tryAgain) { maxTriesCounter++; const rawTransaction = transaction.serialize() const txid = await connection.sendRawTransaction(rawTransaction, { skipPreflight: true, maxRetries: 2 }); console.log(`https://solscan.io/tx/${txid}`); await new Promise(r => setTimeout(r, 1500)); const result = await connection.getSignatureStatus(txid, { searchTransactionHistory: true, }); objSignatureStatusResult = JSON.parse(JSON.stringify(result)); if ( objSignatureStatusResult.value !== null) tryAgain=false; if (maxTriesCounter>maxTries) tryAgain=false; }
You are a life saver, thank you very much! Everything works now!
from jupiter-core-example.
I'm facing the exact same issue. If I try to swap a less busy token - it works almost every time, however, with busier tokens it rarely succeeds. Did you ever find a solution to the problem?
Yes, as zerotop pointed out, you have to add the while loop, that basically retries to executing the transaction.
from jupiter-core-example.
Related Issues (9)
- TypeError: fields must be array of Layout instances HOT 4
- Error - error: TypeError: items.at is not a function or its return value is not iterable
- Buffer Layout Type throwing error - causes Jupiter SDK to globally fail and crash app HOT 3
- Tick Array error
- Errors while creating open orders for serum.
- Is there any way to set intermediateTokens
- SDK: can't cancel orders + expired orders issue HOT 1
- API: add information about order filling
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jupiter-core-example.