Byreal for developers: Integrating swaps and markets
Byreal is a Solana decentralized exchange and liquidity hub for spot swaps, concentrated liquidity, perpetuals and prediction markets. Before routing a swap through Byreal, verify both token mint addresses and inspect an executable quote; a ticker or displayed price cannot establish token identity or the final fill. Each product needs its own integration path.
How does Byreal route and settle a spot swap?
A spot swap can route through concentrated liquidity pools, other Solana liquidity sources or a request for quote (RFQ) from a market maker. Think of the router as a dispatcher comparing available offers for a particular pair and size. A pool’s price changes as the trade uses its liquidity; an RFQ offers a quoted amount that may expire before execution.
For an integration, request a quote with the input and output mint addresses, an integer input amount, the user’s public key and a slippage limit. For example, one SOL is 1,000,000,000 lamports, and 50 basis points means 0.5% slippage tolerance. Show the expected output and route, obtain the wallet signature, then confirm the transaction and read the actual token balance changes. Requote if the offer expires or the user changes the amount.
Compare the amount received after pool fees and price impact, rather than comparing headline fees alone. On-chain execution also needs SOL for network fees, typically around 0.00001–0.00002 SOL per transaction before any variable priority fee; creating a token account can require refundable rent. An RFQ has a different cost path, so use the returned quote and transaction details for the user’s estimate.
How do concentrated liquidity positions work?
A liquidity provider deposits two tokens into a CLMM position with a chosen price range and pool fee tier. The position earns a share of trading fees while the market price is inside that range. If it moves outside, the position stops earning swap fees until the price returns or the provider changes the range.
Say a provider places SOL and USDC in a range of $140–$160 per SOL. As traders move the price through that range, the position’s token mix changes; above the range, it can end up mostly in USDC. A narrow range puts more capital near the current price but needs closer monitoring and can underperform simply holding the tokens when their prices diverge.
Build position management around the pool address, tick-aligned price bounds, token amounts and wallet-authorized transactions. The SDK supports opening and closing positions and claiming fees; the agent CLI also supports a one-token deposit that swaps part of the input before adding liquidity. Preview that swap and its price impact before signing, then track the position’s range, token mix and unclaimed fees separately from any incentive rewards.
What changes for perpetuals and prediction markets?
Byreal perpetuals are leveraged contracts powered by Hyperliquid, so a Solana spot balance is not itself a funded perps position. The agent workflow can move USDC from a Solana wallet through the funding path before placing an order. An integration must track margin, leverage, funding payments, liquidation risk and open orders as well as the entry price; spot swap confirmation does not cover those states.
Prediction markets trade Yes or No outcomes rather than token pairs. An outcome position is priced between $0 and $1 and settles at $1 if correct when the event resolves. Before offering a market, show its exact question, resolution rules, order price and settlement status: a plausible event title is insufficient when one disputed condition can decide the payout. Treat market discovery, orders and resolution as a separate workflow from the spot SDK.