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
Hello everyone,
i would like to highlight a little problem about the BUY function. First of all you have done a great work so many thanks for your open source porject with so many functionalities.
I got a specific problem related with new tokens. In particular, when you try to buy a new created token (for example after 1 second) using your buy function. Let me show the code i'm using (very similar to original one). The buy function is the called by buy.js that you already provide.
/** * Buys tokens from the bonding curve. * @param {string} mintPubKey - The public key of the token mint. * @param {number} solPerOrder - The amount of SOL to spend per order. * @returns {Promise<void>} - A promise that resolves when the buy operation is complete. */asyncfunctionbuy(mintPubKey,solPerOrder){constprovider=newAnchorProvider(connection,wallet,{commitment: "finalized",});constsdk=newPumpFunSDK(provider);// Numero massimo di tentativiconstmaxRetries=20;letbondingCurveAccount=null;for(letattempt=1;attempt<=maxRetries;attempt++){bondingCurveAccount=awaitsdk.getBondingCurveAccount(mintPubKey);if(bondingCurveAccount){constbondingCurveAddress=bondingCurveAccount.toBase58
? bondingCurveAccount.toBase58()
: bondingCurveAccount;// Adatta in base al tipo di daticonsole.log("Bonding curve account trovata:",bondingCurveAddress);// Procedi con l'acquistoletbuyResults=awaitsdk.buy(wallet,mintPubKey,BigInt(solPerOrder*LAMPORTS_PER_SOL),SLIPPAGE_BASIS_POINTS,{unitLimit: 250000,unitPrice: 250000,});if(buyResults.success){awaitprintSPLBalance(connection,mintPubKey,wallet.publicKey);console.log("Bonding curve after buy:",bondingCurveAccount);}else{console.log("Buy failed");}return;// Esci dalla funzione se l'acquisto è stato completato}else{console.log("❌ Tentativo ${attempt}: Bonding curve account non trovata, riprovo tra 1 secondo...");awaitnewPromise(resolve=>setTimeout(resolve,1000));// Attendi 1 secondo}}console.log("❌ Raggiunto il numero massimo di tentativi. Impossibile trovare la bonding curve.");}
So this code works properly but just after 10 seconds of creation. Infact, as you can see, there is a retry so if you start this code immediatly after creation you receive the results in the photo. He has to retry saying "Bonding curve not found". I have also tried to modify the code in order to give the bondingCurveAccount but still does'nt work properly. Do you have any idea??
Many thanks for your time. If you need more details please let me know.
The text was updated successfully, but these errors were encountered:
Hello everyone,
i would like to highlight a little problem about the BUY function. First of all you have done a great work so many thanks for your open source porject with so many functionalities.
I got a specific problem related with new tokens. In particular, when you try to buy a new created token (for example after 1 second) using your buy function. Let me show the code i'm using (very similar to original one). The buy function is the called by buy.js that you already provide.
So this code works properly but just after 10 seconds of creation. Infact, as you can see, there is a retry so if you start this code immediatly after creation you receive the results in the photo. He has to retry saying "Bonding curve not found". I have also tried to modify the code in order to give the bondingCurveAccount but still does'nt work properly. Do you have any idea??
Many thanks for your time. If you need more details please let me know.
The text was updated successfully, but these errors were encountered: