Skip to main content

Usage

quote(input)

Both speeds for an amount, before anything is signed. Returns Promise<Record<CctpFinality, CctpQuote>>.
  • chain (CctpEvmChain): the source chain, from CCTP_EVM_CHAINS.
  • amount (string | number): human USDC, e.g. "25".
Each CctpQuote has feeBps, fee and feeUsdc (Circle’s fee, taken from the amount), receives and receivesUsdc, and eta ({ minSeconds, maxSeconds }, the attestation time; formatCctpEta(eta) turns it into copy).

depositAsync(input)

  • provider (Eip1193Provider): the user’s EVM wallet, e.g. (await discoverEvmWallets())[0].provider.
  • chain (CctpEvmChain): the source chain.
  • amount (string | number): human USDC.
  • walletAddress (string): the Chipi wallet that receives the USDC. It is the only possible recipient and is checked before signing.
  • finality ("standard" | "fast", optional): standard (default) is free and waits for the source chain’s finality (15–20 minutes from an L2); fast costs Circle’s fee and takes about a minute.
  • getBearerToken (() => Promise<string | null | undefined>): called at every step, since tokens expire during the wait.
  • onStatus (optional): ({ step, eta, burnTxHash?, mintTxHash? }) => void. Steps: quoting, switching-chain, approving, burning, registering, attesting, minting, recording, done.
  • account (optional): the EVM account to burn from; defaults to the wallet’s first account.
  • pollIntervalMs (optional, default 15000) and timeoutMs (optional, default 45 minutes): how the hook follows the mint. On timeout it resolves with mintTxHash: null; the deposit still completes server-side.
Resolves with { burnTxHash, sourceDomain, mintTxHash, account, batched, quote, startedAt }.

Errors

A CrossChainDepositError means the burn already happened on the source chain and a later step failed. It carries burnTxHash and sourceDomain: register again with registerCctpDeposit, or follow the deposit with useCctpDepositStatus. Any other error happened before signing; nothing moved.

Return Value

  • quote: the quote function above
  • deposit: fire-and-forget deposit
  • depositAsync: Promise-based deposit
  • data: the last result
  • isLoading, isError, error, isSuccess, reset: mutation state

Example Implementation