Burn
POST https://sol.shrine.trade/api/burn
Destroys tokens for good. Burning everything also closes the token account, which refunds its rent.
{ "publicKey": "<wallet>", "mint": "<mint>", "amount": "100%" }
| Field | Notes |
|---|---|
amount | Tokens in normal units, or a percentage of the balance. |
priorityFee, jitoTip | Optional, SOL. |
Example
Build, sign, send through the relay. The relay broadcasts through our own Solana endpoint, so the script needs no RPC.
- JavaScript
- Python
import { Keypair, VersionedTransaction } from "@solana/web3.js";
import bs58 from "bs58";
const wallet = Keypair.fromSecretKey(bs58.decode("<your wallet private key, base58>"));
// Burn everything and close the account.
const { tx } = await (await fetch("https://sol.shrine.trade/api/burn", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ publicKey: wallet.publicKey.toBase58(), mint: "<mint>", amount: "100%" }),
})).json();
const transaction = VersionedTransaction.deserialize(Buffer.from(tx, "base64"));
transaction.sign([wallet]);
const sent = await (await fetch("https://sol.shrine.trade/api/send", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ signedTx: Buffer.from(transaction.serialize()).toString("base64") }),
})).json();
console.log(sent.status, `https://solscan.io/tx/${sent.signature}`);
import base64, requests
from solders.keypair import Keypair
from solders.transaction import VersionedTransaction
wallet = Keypair.from_base58_string("<your wallet private key, base58>")
# Burn everything and close the account.
r = requests.post("https://sol.shrine.trade/api/burn",
json={"publicKey": str(wallet.pubkey()), "mint": "<mint>", "amount": "100%"}).json()
raw = VersionedTransaction.from_bytes(base64.b64decode(r["tx"]))
signed = VersionedTransaction(raw.message, [wallet])
sent = requests.post("https://sol.shrine.trade/api/send",
json={"signedTx": base64.b64encode(bytes(signed)).decode()}).json()
print(sent["status"], sent["explorer"])