Quickstart
Get from zero to a working burn flow in under 5 minutes.
1. Install the SDK
npm install @burnandclaim/sdk2. Create an API key
Sign in to the Burn & Claim Dashboard and navigate to Settings > API Keys. Create a key and store it securely in your backend environment variables.
BURNER_API_KEY=ak_live_...Never expose this key in client-side code.
3. Create a session token (backend)
Your backend creates a short-lived session token scoped to the user’s wallet. Forward it to your frontend.
import { BurnerClient } from '@burnandclaim/sdk'
const server = new BurnerClient({
apiKey: process.env.BURNER_API_KEY,
})
// Express / Next.js API route handler
app.post('/api/burn-session', async (req, res) => {
const { walletAddress } = req.body
const session = await server.createSession({
walletAddress,
scopes: [
'wallet:read',
'transactions:build',
'transactions:submit',
],
ttlSeconds: 600, // 10 minutes
})
res.json({ token: session.token, expiresAt: session.expiresAt })
})4. Scan, build, sign, submit (frontend)
import { BurnerClient } from '@burnandclaim/sdk'
// 1. Create a client with the session token from your backend
const client = new BurnerClient({ sessionToken: token })
// 2. Discover burnable assets in the user's wallet
const { items } = await client.getWalletAssets(walletAddress)
// 3. Let the user pick items, then build unsigned transactions
const { transactions, totals } = await client.buildTransactions(
walletAddress,
{
items: items.map((item) => ({
type: item.type,
address: item.address,
action: item.actions[0], // use the first available action
})),
}
)
// 4. Sign with the user's wallet adapter
const unsigned = transactions.map((tx) =>
VersionedTransaction.deserialize(
Buffer.from(tx.transactionBase64, 'base64')
)
)
const signed = await wallet.signAllTransactions(unsigned)
// 5. Submit the signed transactions
const { results } = await client.submitTransactions(walletAddress, {
signed: signed.map((tx, i) => ({
transactionBase64: Buffer.from(tx.serialize()).toString('base64'),
submissionTicket: transactions[i].submissionTicket,
})),
})
// 6. Check results
for (const result of results) {
if (result.status === 'submitted') {
console.log(`Success: ${result.signature}`)
} else if (result.status === 'failed') {
console.error(`Failed: ${result.error?.message}`)
}
}5. Verify
The totals object from buildTransactions tells you how much SOL the user will reclaim:
console.log(`Burning ${totals.itemCount} items`)
console.log(`SOL reclaimed: ${totals.netRebate / 1e9} SOL`)Next steps
- Authentication — Understand API keys, session tokens, and scopes
- SDK Reference — Full
BurnerClientmethod reference - Cookbook — Complete reclaim flow with error handling
Last updated on