Stake SOL
Effortlessly stake SOL on the Jup validator using the StakeManager class. This guide explains how to execute staking operations with simplicity and precision.
url = f"https://worker.jup.ag/blinks/swap/So11111111111111111111111111111111111111112/jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v/{amount}"
payload = {"account": str(agent.wallet_address)}
async with aiohttp.ClientSession() as session:
async with session.post(url, json=payload) as res:
if res.status != 200:
raise Exception(f"Failed to fetch transaction: {res.status}")
data = await res.json() txn = VersionedTransaction.deserialize(base64.b64decode(data["transaction"]))
latest_blockhash = await agent.connection.get_latest_blockhash()
txn.message.recent_blockhash = latest_blockhash.value.blockhash
txn.sign([agent.wallet]) Last updated
