Skip to main content

Wrap SOL

The wrapSol action converts native SOL into Wrapped SOL (wSOL) β€” an SPL token version of SOL. If you need to convert it back, just buy or sell any token on pump-amm. This will automatically close the wSOL token account and return everything back to SOL.


Endpoint​

POST https://api.pumpapi.io

Request Fields​

FieldDescription
privateKeyYour wallet private key (base58). Not required if you pass apiKey instead.
apiKeyOptional. Not required. Pass it instead of privateKey if you prefer not to send your private key. Generate one on the Trade API page (πŸ”‘ spoiler).
actionMust be "wrapSol"
amountAmount of SOL to wrap (e.g. "0.5")
priorityFeePriority fee in SOL (e.g. "0.00002")

Code Examples​

import aiohttp
import asyncio

async def wrap_sol():
url = "https://api.pumpapi.io"
data = {
"privateKey": "base58_private_key", # or use "apiKey": "your_api_key" instead β€” generate one at pumpapi.io/trade-api (πŸ”‘ spoiler)
"action": "wrapSol",
"amount": "0.5",
"priorityFee": "0.00002",
}
async with aiohttp.ClientSession() as session:
async with session.post(url, json=data) as response:
result = await response.json()
print(result)

asyncio.run(wrap_sol())

Need help? Join our Telegram group.