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
| Field | Description |
|---|---|
privateKey | Your wallet private key (base58) |
action | Must be "wrapSol" |
amount | Amount of SOL to wrap (e.g. "0.5") |
priorityFee | Priority fee in SOL (e.g. "0.00002") |
Code Examples
- Python
- JavaScript
- Go
- Rust
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())
const response = await fetch("https://api.pumpapi.io", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
privateKey: "base58_private_key",
action: "wrapSol",
amount: "0.5",
priorityFee: "0.00002",
}),
});
const result = await response.json();
console.log(result);
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
payload := map[string]string{
"privateKey": "base58_private_key",
"action": "wrapSol",
"amount": "0.5",
"priorityFee": "0.00002",
}
body, _ := json.Marshal(payload)
resp, err := http.Post("https://api.pumpapi.io", "application/json", bytes.NewBuffer(body))
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let payload = json!({
"privateKey": "base58_private_key",
"action": "wrapSol",
"amount": "0.5",
"priorityFee": "0.00002"
});
let res = client
.post("https://api.pumpapi.io")
.json(&payload)
.send()
.await?;
println!("{}", res.text().await?);
Ok(())
}
Need help? Join our Telegram group.