Request Quotes
Request quotes for the best on-ramping process onto ZKsync
This guide will demonstrate how to make a request to receive a list of quotes from the SDK.
How to request quotes
The following is an example of the minimum needed to request a list of quotes.
import { fetchQuotes } from 'zksync-easy-onramp';
// fetching quotes for $25 USD for Ether on ZKsync
const quotes = await fetchQuotes({
toAddress: "0xE6a8bEEFC1Bca3046235e0d1f8db805734949024",
fiatAmount: 25,
fiatCurrency: "USD",
chainId: 324,
toToken: "0x000000000000000000000000000000000000800A", // Ether on ZKsync
});
The fetchQuotes
method will return an array of quotes containing the necessary information to
execute the quote.
Parameters
toAddress
(Address, required)
The address to send the completed transaction to on the destination chain.fiatAmount
(number, optional)
The value in fiat to spend if purchasing tokens with fiat.fiatCurrency
(SupportedFiatCurrencies, optional)
The fiat code (e.g. "USD") if the fiat amount is specified.chainId
(number, required)
The destination chain's ID where the tokens will be deposited.toToken
(Address, required)
The token contract address on the destination chain. This address must correspond with the specifiedchainId
.amount
(number, optional)
The amount of the requested token to purchase. Use this instead of thefiatAmount
to receive quotes based on the amount of tokens the user wants to purchase.providerTypes
(array of QuoteProviderType, optional)
Specify a list of provider types to customize the quotes returned.paymentMethods
(array of PaymentMethod, optional)
Include an array of payment methods to customize the type of quotes returned.routeType
('"buy"' | '"sell"', required)
Currently only the"buy"
option is available. Specify what type of action you want to do with a quote.