Quickstart

One call sends a swap whose rebate burns the token it trades.

Install

shell
npm i @backburn/sdk

Send a swap

ts
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 null

wallet 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

ts
await backburn.swap({ wallet, from: SOL, to: mint, amount, speed: 'fast' })
SpeedPriority fee levelSent through
ecolowRebate endpoint
standardmediumRebate endpoint
fasthighRebate endpoint
turboveryHighRebate 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.

ts
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.