Guide

Vanilla JS

No framework needed. Phantom direct, Reown modal, or pure REST API.

Phantom / Solflare Direct

$npm install @buff/sdk @solana/web3.jsCopy
app.ts
typescript
1import { Buff } from '@buff/sdk'
2
3const provider = (window as any).solana
4await provider.connect()
5
6const buff = await Buff.init({
7 platformId: 'your-platform-id',
8 signMessage: (msg) => provider.signMessage(msg, 'utf8'),
9 plan: 'sprout',
10})
11
12const { transaction, breakdown } = await buff.wrap(
13 tx, provider.publicKey, { txValueUsd: 15.42 }
14)
15
16const signed = await provider.signTransaction(transaction)
17// send signed transaction...
Note
All approaches produce identical results. Choose based on your environment.