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

PhaseWhat happensWhere
Round-upSpare change transferred to Buff walletPer transaction (via getWrapInstructions)
AccumulateSOL balance grows in Buff walletAutomatic
Threshold checkBalance compared to USD thresholdVia getAccumulator(address)
SwapSOL swapped to target asset via JupiterServer-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)
2
3console.log(state)
4// {
5// balanceSol: 0.034,
6// balanceUsd: 5.10, // above $5 threshold!
7// thresholdReached: true,
8// solPriceUsd: 150,
9// }
10
11if (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 construction
2const buff = new Buff({
3 investThreshold: 10, // wait until $10
4 // ...
5})
6
7// Or change at runtime
8buff.setThreshold(25) // accumulate more before swapping

Supported Assets

AssetTokenMainnet Mint
BTCwBTC (Portal)3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh
ETHwETH (Portal)7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs
SOLNative SOLSo11111111111111111111111111111111111111112
USDCUSDCEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
USDTUSDTEs9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
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.