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)
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",
"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.