跳到主要内容

销毁

POST https://sol.shrine.trade/api/burn

永久销毁代币。全部销毁时还会关闭代币账户,退还其租金。

{ "publicKey": "<wallet>", "mint": "<mint>", "amount": "100%" }
字段说明
amount以常规单位表示的代币数量,或余额的百分比。
priorityFee、jitoTip可选,单位 SOL。

示例​

构建、签名、通过中继发送。中继通过我们自己的 Solana 节点广播,所以脚本不需要 RPC。

import { Keypair, VersionedTransaction } from "@solana/web3.js";
import bs58 from "bs58";

const wallet = Keypair.fromSecretKey(bs58.decode("<your wallet private key, base58>"));

// 全部销毁并关闭账户。
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}`);