Key Concepts
β οΈ Important: Quotes simulation
π Connect your wallet to get real, pre-simulated pricing from the Ooga Booga backend.
Without wallet connection, quotes may be spoofed or manipulated by aggregators. Connected wallets receive verified quotes that reflect actual execution prices.
π Quote Stream API
The application connects to a streaming API for real-time swap quotes:
const AGGREGATOR_BASE_URL = 'https://hyperevm.api.oogabooga.io/meta/stream/swap'
Supported Parameters
tokenIn
string
Input token address
tokenOut
string
Output token address
amount
string
Amount to swap (in token units)
maxSlippage
string
Maximum acceptable slippage (default: 0.01)
to
string
Recipient address
aggregators
string[]
Specific aggregators to query
π‘ Event Types
The SSE stream emits the following events:
connected
- Initial connection establishedquote
- New quote data receivederror
- Error occurred during streamingheartbeat
- Keep-alive signal
π Quote Data Structure
Each quote contains comprehensive swap information:
interface QuoteResponse {
aggregator: string;
quote: {
status: string;
amountIn: string;
amountOut: string;
fee: string;
value: string;
aggregator: string;
routerAddr: string;
calldata: string;
gas: string;
simulationAmountOut: string;
priceImpact: number;
};
timestamp: number;
}
π§ Usage Examples
Basic Quote Stream Implementation
import { useQuoteStream } from '@/hooks/use-quote-stream'
const QuoteStreamComponent = () => {
const { isConnected, latestQuote, error } = useQuoteStream({
chainId: 999, // HyperEVM chain ID
params: {
tokenIn: '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb', // USDT
tokenOut: '0x0000000000000000000000000000000000000000', // HYPE
amount: '10000000', // 10 USDT
maxSlippage: '0.5',
},
enabled: true
})
if (!isConnected) {
return <div>π Connecting to quote stream...</div>
}
if (error) {
return <div>β Error: {error.message}</div>
}
return (
<div>
<h3>π Latest Quote</h3>
<pre>{JSON.stringify(latestQuote, null, 2)}</pre>
</div>
)
}
Last updated