Core Concept
Accumulate & Invest
Round-ups accumulate in the Buff wallet until the threshold is reached, then auto-swap via Jupiter.
The Flow
| Phase | What happens | Where |
|---|---|---|
| Round-up | Spare change transferred to Buff wallet | Per transaction |
| Accumulate | SOL balance grows in Buff wallet | Automatic |
| Threshold check | Balance compared to USD threshold | After each wrap() |
| Swap | SOL → target asset via Jupiter | When threshold reached |
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, swap, quote } = await buff.checkAndInvest()23console.log(state)4// {5// balanceSol: 0.034,6// balanceUsd: 5.10, // above $5 threshold!7// thresholdReached: true,8// solPriceUsd: 150,9// }1011if (swap) {12 console.log("Swapped!", swap.txSignature)13 // Buff wallet now holds BTC (or target asset)14}Configuring the Threshold
threshold.ts
typescript
1// Set during init2const buff = await Buff.init({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. The SDK keeps a 0.01 SOL reserve in the Buff wallet for future transaction fees.