Add a donation
Let a cleanup donate a share of what it reclaims to the burner's organization.
A donation is a share of what a cleanup reclaims, in basis points, up to donation.maxBps from the fee schedule. It goes to the organization whose burner the cleanup runs on: pass the burner's slug as burner, and the API pays that organization's verified payout wallet. Without burner, the cleanup runs on Burn & Claim's own burner, an organization's burner like any other, and the donation goes to Burn & Claim's organization. It's taken first, and the service fee applies to what's left. Fees and donations has the details.
const fees = await bnc.fees()
console.log(`Up to ${fees.donation.maxBps / 100}%`)
const quote = await bnc.quote({ wallet, items, burner, donationBps: 500 })
console.log(`Donating ${quote.totals.donationLamports} lamports`)
console.log(quote.beneficiary?.name ?? 'No one can take a donation here yet')
for (const warning of quote.warnings) console.log(warning.code, warning.message)The quote's beneficiary is the organization the server resolved from the burner, null while it can't be paid. Show it, the totals and the warnings before the person approves. A burner whose payout wallet can't receive takes no donation: the quote zeroes it and says so with donation_not_taken, and the donation never goes anywhere else.
await reclaim(bnc, {
wallet,
items,
burner,
donationBps: 500,
signTransactions: signWithYourWallet,
})Quote and reclaim with the same burner and donationBps, so the person agrees to what lands. reclaim opens the wallet once per approval, and nothing is sent until the person approves it there.