Skip to main content

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%" }
FieldNotes
amountTokens in normal units, or a percentage of the balance.
priorityFee, jitoTipOptional, SOL.

Example​

Build, sign, send through the relay. The relay broadcasts through our own Solana endpoint, so the script needs no RPC.

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}`);