Quickstart
One call sends a swap whose rebate burns the token it trades.
Install
npm i @backburn/sdkSend a swap
import { backburn, SOL } from '@backburn/sdk'
const result = await backburn.swap({ wallet, from: SOL, to: mint, amount })
result.signature // the swap's signature
result.vault // the vault this trade's rebate went to
result.rebate // lamports the vault received from this trade, or nullwallet is any signer with a publicKey and signTransaction: a keypair in a bot, a wallet adapter in a site. amount is in the input token’s base units. swap quotes, sets the fee plan, builds, signs with your signer, relays through Backburn and follows the transaction until it lands.
Pick a speed
await backburn.swap({ wallet, from: SOL, to: mint, amount, speed: 'fast' })| Speed | Priority fee level | Sent through |
|---|---|---|
eco | low | Rebate endpoint |
standard | medium | Rebate endpoint |
fast | high | Rebate endpoint |
turbo | veryHigh | Rebate endpoint and Helius Sender |
The default is standard. Fee plan says how each line is set.
Send a transaction you built
If you already build your own swaps, keep building them and let Backburn relay them. The mint names the vault.
const sent = await backburn.send(signedTransaction, { mint })Senders with their own Helius key can skip the relay: backburn.rebateUrl(mint, { apiKey }) returns the Helius URL that carries the vault as the rebate address.