Documentation Index
Fetch the complete documentation index at: https://base-a060aa97-pat-schemav2-docs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The fetchOnrampOptions utility retrieves supported fiat currencies and available crypto assets for a specific country. This information is essential for determining which assets can be purchased in the user’s jurisdiction.
Usage
import { fetchOnrampOptions } from '@coinbase/onchainkit/fund';
const options = await fetchOnrampOptions({
country: 'US',
subdivision: 'CA', // Required for US residents
apiKey: 'your-api-key', // Required when using without OnchainKitProvider or in non-React environment
});
Parameters
{
/**
* ISO 3166-1 two-letter country code string representing
* the purchasing user’s country of residence, e.g., US.
*/
country: string;
/**
* ISO 3166-2 two-letter country subdivision code representing
* the purchasing user’s subdivision of residence within their country,
* e.g. NY. Required if the country=“US” because certain states (e.g., NY)
* have state specific asset restrictions.
*/
subdivision?: string;
/**
* Optional API key for Coinbase Onramp. If not provided, the API key from
* OnchainKitProvider will be used. Required when using the utility without
* OnchainKitProvider or in a non-React environment.
*/
apiKey?: string;
}
Returns
Promise<OnrampOptionsResponseData> - Returns a promise that resolves to the available options for the specified location.
type OnrampOptionsResponseData = {
/**
* List of supported fiat currencies that can be exchanged for crypto on Onramp in the given location.
* Each currency contains a list of available payment methods, with min and max transaction limits for that currency.
*/
paymentCurrencies: OnrampPaymentCurrency[];
/**
* List of available crypto assets that can be bought on Onramp in the given location.
*/
purchaseCurrencies: OnrampPurchaseCurrency[];
};
type OnrampPurchaseCurrency = {
id: string;
name: string;
symbol: string;
iconUrl: string;
networks: OnrampNetwork[];
};
type OnrampPaymentCurrency = {
id: string;
limits: OnrampPaymentMethodLimit[];
iconUrl: string;
};
type OnrampPaymentMethodLimit = {
id: string;
min: string;
max: string;
};
type OnrampNetwork = {
name: string;
displayName: string;
chainId: string;
contractAddress: string;
};