Preview the amount a crypto deposit delivers after conversion, before creating a deposit address.
A quote previews how much of the target asset a deposit delivers after conversion. Use quotes to check that a route is supported, or to show users an estimate before they send funds.Quotes do not require a wallet ID or an authorization signature. Quotes reflect the app’s gas and fee sponsorship settings.Quotes are indicative. A deposit address does not lock this price for later deposits. Fetch a fresh quote when displaying an estimate, since market conditions and liquidity can change before conversion.
Use getQuote from the useHeadlessCryptoDeposit hook.
useHeadlessCryptoDeposit is experimental and requires @privy-io/react-auth 3.46.0 or later.
The interface may change without a major SDK version bump.
import {useHeadlessCryptoDeposit} from '@privy-io/react-auth';const {getQuote} = useHeadlessCryptoDeposit();// Quote 1.5 USDC on Base delivered as PathUSD on Tempoconst quote = await getQuote({ source: {chain: 'base', asset: 'usdc'}, destination: {chain: 'tempo', asset: 'pathusd'}, inputAmount: '1.5'});console.log(quote.estimated_output_amount);
ParametersgetQuote accepts an object with the following fields:
object
required
Asset the user would deposit. Unlike create, both chain and asset are required.
Show properties
string
required
Chain alias or CAIP-2 identifier, such as base or eip155:8453.
string
required
Asset alias or token contract address, such as usdc or 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913.
object
required
Asset delivered to the destination wallet.
Show properties
string
required
Chain alias or CAIP-2 identifier, such as base or eip155:8453.
string
required
Asset alias or token contract address, such as usdc or 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913.
string
Amount as a decimal string in the source token’s standard unit, such as '1.5' for 1.5 USDC. Omit
to quote approximately $50 of the source asset.