Skip to content
Alchemy Logo

requestQuoteV0 (experimental)

Experimental: This API is experimental and may change in a future release.

function requestQuoteV0(client, params): Promise<RequestQuoteV0Result>;

Defined in: packages/wallet-apis/src/experimental/actions/requestQuoteV0.ts:119

Requests a quote for a token swap, returning either prepared calls for smart wallets or raw calls for EOA wallets depending on the returnRawCalls parameter.

// Request a quote for smart wallet (prepared calls)
const quote = await client.requestQuoteV0({
  fromToken: "0xA0b86a33E6441e1d6a8E8C7a8E8E8E8E8E8E8E8E",
  toToken: "0xB0b86a33E6441e1d6a8E8C7a8E8E8E8E8E8E8E8E",
  fromAmount: 1000000000000000000n, // 1 ETH
  chainId: 42161, // Arbitrum
  capabilities: {
    paymaster: { policyId: "your-policy-id" },
  },
});
 
// Request a quote for EOA wallet (raw calls)
const rawQuote = await client.requestQuoteV0({
  fromToken: "0xA0b86a33E6441e1d6a8E8C7a8E8E8E8E8E8E8E8E",
  toToken: "0xB0b86a33E6441e1d6a8E8C7a8E8E8E8E8E8E8E8E",
  fromAmount: 1000000000000000000n,
  chainId: 42161,
  returnRawCalls: true,
});

ParameterTypeDescription

client

InnerWalletApiClient

The wallet API client to use for the request

params

RequestQuoteV0Params

Parameters for requesting a swap quote

Promise<RequestQuoteV0Result>

A Promise that resolves to either prepared calls or raw calls depending on returnRawCalls

Was this page helpful?