Core Concept
Accumulate & Invest
Round-ups accumulate in the Buff wallet until the threshold is reached, then swap via the Buff API using Jupiter.
The Flow
| Phase | What happens | Where |
|---|---|---|
| Round-up | Spare change transferred to Buff wallet | Per transaction (via getWrapInstructions) |
| Accumulate | SOL balance grows in Buff wallet | Automatic |
| Threshold check | Balance compared to USD threshold | Via getAccumulator(address) |
| Swap | SOL swapped to target asset via Jupiter | Server-side via buildSwap + executeSwap |
Why Accumulate?
Individual round-ups are small ($0.03 - $0.99). Swapping $0.03 worth of SOL into BTC would cost more in swap fees than the amount itself. By accumulating to $5 (default), the swap is meaningful and cost-efficient.
Checking the Balance
check.ts
typescript
1const state = await buff.getAccumulator(buffWalletPubkey)23console.log(state)4// {5// balanceSol: 0.034,6// balanceUsd: 5.10, // above $5 threshold!7// thresholdReached: true,8// solPriceUsd: 150,9// }1011if (state.thresholdReached) {12 const { ready, transactions } = await buff.buildSwap(buffWalletPubkey)13 if (ready) {14 for (const tx of transactions) {15 const signed = await signTransaction(tx)16 await buff.executeSwap(signed)17 }18 console.log("Swaps executed!")19 }20}Configuring the Threshold
threshold.ts
typescript
1// Set during construction2const buff = new Buff({3 investThreshold: 10, // wait until $104 // ...5})67// Or change at runtime8buff.setThreshold(25) // accumulate more before swappingSupported Assets
| Asset | Token | Mainnet Mint |
|---|---|---|
| BTC | wBTC (Portal) | 3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh |
| ETH | wETH (Portal) | 7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs |
| SOL | Native SOL | So11111111111111111111111111111111111111112 |
| USDC | USDC | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
| USDT | USDT | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB |
Note
Jupiter handles the swap routing automatically — it finds the best price across all Solana DEXes. Swap transactions are built server-side via buildSwap() — the client only needs to sign and submit them. A 0.01 SOL reserve is kept in the Buff wallet for future transaction fees.