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
New tokens return an empty response value. Is there an alternative method to retrieve the token price? I keep encountering the error 'Invalid curve state: No data,' but this issue doesn’t occur for tokens launched 3–10 minutes ago.
async def get_pump_curve_state(conn: AsyncClient, curve_address: Pubkey) -> BondingCurveState:
response = await conn.get_account_info(curve_address)
if not response.value or not response.value.data:
raise ValueError("Invalid curve state: No data")
data = response.value.data
if data[:8] != EXPECTED_DISCRIMINATOR:
raise ValueError("Invalid curve state discriminator")
return BondingCurveState(data)
def calculate_pump_curve_price(curve_state: BondingCurveState) -> float:
if curve_state.virtual_token_reserves <= 0 or curve_state.virtual_sol_reserves <= 0:
raise ValueError("Invalid reserve state")
return (curve_state.virtual_sol_reserves / LAMPORTS_PER_SOL) / (
curve_state.virtual_token_reserves / 10 ** TOKEN_DECIMALS)
Did you try increasing the waiting time (trade.py)? If not try increasing it to 20 seconds. print("Waiting for 15 seconds for things to stabilize...") await asyncio.sleep(15)
New tokens return an empty response value. Is there an alternative method to retrieve the token price? I keep encountering the error 'Invalid curve state: No data,' but this issue doesn’t occur for tokens launched 3–10 minutes ago.
The text was updated successfully, but these errors were encountered: