Skip to content

Quote

The quote endpoint returns a projected conversion result for a given source token, destination token, and amount. Use it to show fee breakdowns and expected output to users before they initiate a deposit or withdrawal.

POST https://bridge.openfish.fun/quote
FieldTypeRequiredDescription
from_chain_idstringYesSource chain ID (e.g., "1" for Ethereum)
from_token_addressstringYesToken contract address on the source chain
to_token_addressstringYesToken contract address on the destination chain
from_amount_base_unitstringYesAmount to convert in base units (e.g., "10000000" for 10 USDC)
Terminal window
curl -X POST https://bridge.openfish.fun/quote \
-H "Content-Type: application/json" \
-d '{
"from_chain_id": "1",
"from_token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"to_token_address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
"from_amount_base_unit": "10000000"
}'
{
"estimated_output": "9985000",
"estimated_output_usd": 9.985,
"gas_cost_usd": 0.012,
"bridge_fee_usd": 0.003,
"slippage_percent": 0.05,
"route": "1inch",
"expires_at": 1700000000
}
FieldTypeDescription
estimated_outputstringExpected output amount in destination base units
estimated_output_usdnumberEstimated output value in USD
gas_cost_usdnumberEstimated gas fee in USD
bridge_fee_usdnumberBridge routing fee in USD
slippage_percentnumberEstimated price slippage as a percentage
routestringAggregator used for the swap route
expires_atnumberUnix timestamp when the quote expires
use openfish_client_sdk::BridgeClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let bridge = BridgeClient::new("https://bridge.openfish.fun");
let quote = bridge
.quote(
"1", // Ethereum
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", // USDC.e on Polygon
"10000000", // 10 USDC
)
.await?;
println!("Estimated output: {} base units", quote.estimated_output);
println!("Gas cost: ${:.4}", quote.gas_cost_usd);
println!("Slippage: {:.2}%", quote.slippage_percent);
Ok(())
}

Openfish routes quote calculations through the 1inch aggregator API, finding the best swap path between source and destination tokens. The returned estimate factors in:

  • Gas costs on both the source and destination chains.
  • Bridge fees imposed by the underlying cross-chain relay.
  • Swap slippage determined by current DEX pool depth.

Quotes are informational projections. The actual output may shift slightly due to price movement between quote time and execution.

  • Before a deposit, to preview the USDC.e amount that will be credited.
  • Before a withdrawal, to show the expected destination token amount.
  • To compare costs across different source tokens or source chains.

Every quote carries an expires_at timestamp. Once expired, the estimate is stale and should be refreshed. Quotes are typically valid for 30 seconds.

  • Deposit — Execute a deposit after reviewing the quote.
  • Withdraw — Execute a withdrawal after reviewing the quote.
  • Supported Assets — Check which tokens and chains are available.