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';
 
declare const client: SilentSwapClient;
 
const intent: QuoteRequest = {
  privacy: true,
  inputAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
  sourceAsset: 'ETH',
  sourceChainId: 1,
  outputs: [{
    address: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
    chainId: 8453,
    amount: 100_000_000n,
  }],
};
 
const quote = await client.quote(intent);

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 type { QuoteRequest } from '@silentswap/sdk';
 
const outputIntent: QuoteRequest = {
  privacy: true,
  inputAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
  sourceAsset: 'USDC',
  sourceChainId: 56,
  outputs: [{
    address: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
    chainId: 1,
    amount: 50_000_000n,
    dest: {
      kind: 'evm',
      chainId: 1,
      assetId: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
      assetSymbol: 'WETH',
      assetDecimals: 18,
      slippageBps: 100,
    },
  }],
};
 
void outputIntent;