Bonding Curve Complete
Closed this issue · 5 comments
When calling the createAndBuy function and attempting to purchase a token for 1 SOL, I encounter an issue where I cannot buy or sell tokens because the bonding curve is complete. I have tried using different wallets to execute the transaction but encountered the same problem with each. Why can’t my main wallet or any other wallet successfully complete the token transactions? How can I ensure that I keep buying the token? @rckprtr I’m fairly new to this, so any detailed explanation would be greatly appreciated.
P.S. I've sent you a message on TG @rckprtr
Sample code:
const buyAmountSol = BigInt(1000000000); // 1 SOL in lamports
const pumpFunSDK = new PumpFunSDK(provider);
(async () => {
const result = await pumpFunSDK.createAndBuy(creator, mint, createTokenMetadata, buyAmountSol);
console.log(result);
let bondingCurveAccount = await pumpFunSDK.getBondingCurveAccount(mintKeypair.publicKey);
console.log(bondingCurveAccount);
})();
bondingCurveAccount:
BondingCurveAccount {discriminator: 6966180631402821399n, virtualTokenReserves: 1022900000000000n, virtualSolReserves: 31469351843n, realTokenReserves: 0n, realSolReserves: 1469351843n, …} complete: true discriminator: 6966180631402821399n realSolReserves: 1469351843n realTokenReserves: 0n tokenTotalSupply: 1000000000000000n virtualSolReserves: 31469351843n virtualTokenReserves: 1022900000000000n [[Prototype]]: Object
Are you on devnet or mainnet?
Are you on devnet or mainnet?
I'm testing it on devnet. Is this isolated to devnet? Will I encounter the same issue on mainnet?
I just tested devnet and everything worked with a new mint.
I noticed in your code mint
and minterKeyPair
are different names, is it possible you are creating a token with one mint and trying to buy a token from a different bonding curve? Can you confirm the mintKeypair.publicKey and the mint value are the same?
Also do you have any tx signatures to share? It might make it easier to debug.
I just tested devnet and everything worked with a new mint.
I noticed in your code
mint
andminterKeyPair
are different names, is it possible you are creating a token with one mint and trying to buy a token from a different bonding curve? Can you confirm the mintKeypair.publicKey and the mint value are the same?Also do you have any tx signatures to share? It might make it easier to debug.
Thanks for responding.
This is embarrassing. I miscalculated the SOL amount when buying the token. Instead of 0.08 SOL, I bought the entire supply of the token, resulting in 0 tokens in the reserves.
I appreciate your help @rckprtr !
No problem, I assumed so and double checked the 0s in the buyAmountSOL but great its fixed.