TypeScript Examples

These examples show a minimal pattern for calling the RFQ HTTP API.

Indicative Quote

export async function getIndicativeQuote(args: {
  baseUrl: string;
  jwtToken: string;
  srcChainId: number;
  dstChainId: number;
  tokenIn: string;
  tokenOut: string;
  amountInWei: string;
}) {
  const res = await fetch(`${args.baseUrl}/v1/quote/indicative`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": `Bearer ${args.jwtToken}`,
    },
    body: JSON.stringify({
      src_chain_id: args.srcChainId,
      dst_chain_id: args.dstChainId,
      token_in: args.tokenIn,
      token_out: args.tokenOut,
      amount_in: args.amountInWei,
    }),
  });

  const data = await res.json();
  return data;
}

Firm Quote

Basic Business-Error Handling

Last updated