Skip to content

Quotes

quote accepts an outputs[] array. Private wallet-funded requests allow 1–20 outputs; address-funded and Simple Bridge requests require exactly one.

Curated input asset

Use sourceAsset for an asset from @silentswap/assets.

import type {
  QuoteRequest,
  SilentSwapClient,
} from '@silentswap/sdk';
import { parseUsdc } from '@silentswap/sdk';
 
declare const client: SilentSwapClient;
 
const intent: QuoteRequest = {
  privacy: true,
  inputAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
  sourceAsset: 'ETH',
  sourceChainId: 1,
  outputs: [{
    address: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
    chainId: 8453,
    amount: parseUsdc('100'),
  }],
};
 
const quote = await client.quote(intent);

Amounts and units

Every private API USDC field uses the gateway chain's USDC precision, regardless of source or recipient chain. Use parseUsdc to build fixed payouts and formatUsdc to display quote, fee, and order amounts; never hardcode a decimals literal. Amount-range 400 responses and GET /dest-assets include usdcDecimals for direct HTTP integrations.

Exact input

Set amount on a wallet-funded private request to spend exactly what the user typed, in source-token base units. The wallet pulls precisely that amount, and outputs[].amount stop being targets — they become ratio weights, with the API sizing real payouts from the route's guaranteed minimum output.

import type { QuoteRequest, SilentSwapClient } from '@silentswap/sdk';
 
declare const client: SilentSwapClient;
 
const exactInput: QuoteRequest = {
  privacy: true,
  inputAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
  sourceAsset: 'ETH',
  sourceChainId: 1,
  amount: 1_000_000_000_000_000_000n, // spend exactly 1 ETH
  outputs: [
    { address: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC', chainId: 8453, amount: 70n },
    { address: '0x90F79bf6EB2c4f870365E785982E1f101E93b906', chainId: 8453, amount: 30n },
  ],
};
 
const quote = await client.quote(exactInput);

The weights above split 70/30. Omit amount to keep the legacy behavior where outputs[].amount are exact USDC targets.

Exact input is not valid with utxoSource — that rail is already exact-input — nor with integrator orders. BTC/LTC requests (UtxoFundedPrivateQuoteRequest) still require amount and a single output; TON/TRON (AccountFundedPrivateQuoteRequest) accept weighted splits through a wallet adapter.

Payout figures are estimates until the deposit lands

On an exact-input order the quote's payoutAmount is a pre-deposit estimate. The gateway deposit event's credited amount becomes the authoritative principal and resizes every recipient pro-rata. Render these with "≈" — see Tracking for the payoutsAreEstimates flag that tells you when the number has firmed up.

Discovered input token

Use sourceToken for a token outside the curated registry. Supply the live address/mint, decimals, and symbol from a token-data source. Never set both sourceAsset and sourceToken.

Arbitrary output asset

Set outputs[0].dest with the destination asset ID, live decimals, kind, and slippage. The quote returns dest.minDestAmount; display it as the minimum received. Arbitrary-output routes are currently single-recipient.

import { parseUsdc, type QuoteRequest } from '@silentswap/sdk';
 
const outputIntent: QuoteRequest = {
  privacy: true,
  inputAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
  sourceAsset: 'USDC',
  sourceChainId: 56,
  outputs: [{
    address: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
    chainId: 1,
    amount: parseUsdc('50'),
    dest: {
      kind: 'evm',
      chainId: 1,
      assetId: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
      assetSymbol: 'WETH',
      assetDecimals: 18,
      slippageBps: 100,
    },
  }],
};
 
void outputIntent;