⚙️Customization
Rango Widget Config
Overview
The WidgetConfig object allows you to customize your widget to fit your application's needs. The following sections provide a detailed breakdown of all available properties, organized by category.
1. Core Configuration
apiKey(string) - RequiredYour API key for accessing the Rango API. This key is required to make widget requests.
apiUrl(string) - OptionalThe base API URL for custom API endpoints.
walletConnectProjectId(string) - OptionalThe Wallet Connect Project ID used for integrating WalletConnect. Obtain it from WalletConnect Cloud.
title(string) - OptionalThe title that appears on top of the widget.
variant(WidgetVariant) - OptionalThe layout variant of the widget.
'default': Standard view.'expanded': Expanded view showing multiple routes.'full-expanded': Full route information visible on the homepage.
amount(number) - OptionalThe default value to be displayed in the swap input field.
2. Blockchain & Token Configuration
from(BlockchainAndTokenConfig) - OptionalConfiguration for the source blockchain and token.
blockchains (
string[]): A list of allowed source blockchains.blockchain (
string): The default blockchain.token (
Asset): The default token configuration.
to(BlockchainAndTokenConfig) - OptionalConfiguration for the destination blockchain and token.
blockchains (
string[]): A list of allowed destination blockchains.blockchain (
string): The default blockchain.token (
Asset): The default token configuration.
liquiditySources(string[]) - OptionalA list of allowed DEXes and bridges used for routing liquidity.
excludeLiquiditySources(boolean) - OptionalIf set to
true, the liquidity sources defined inliquiditySourceswill be excluded instead of included.
customDestination(boolean) - OptionalEnables the user to enter a custom blockchain address as the destination.
3. Theme Configuration
theme(WidgetTheme) - OptionalCustomize the visual appearance of the widget.
mode (
'auto' | 'light' | 'dark'): Defines the theme mode.fontFamily (
string): Sets the font for the widget. To do this, please also include your preferred font in your HTML file.colors (
object): Customize colors for both light and dark modes. (Please check playground to play with different colors and presets.)dark: Color configuration for dark mode.
light: Color configuration for light mode.
borderRadius (
number): The border radius for the widget container.secondaryBorderRadius (
number): The border radius for buttons within the widget.singleTheme (
boolean): If set totrue, limits the widget to one theme (dark or light) based on themodevalue.
4. Routing Configuration
routing(Routing) - OptionalmaxLength (
number): limit the maximum acceptable length of a routeavoidNativeFee (
'enabled' | 'disabled'): Enable/disable avoid native fee.experimental (
'enabled' | 'disabled'): Enable/disable experimental routing.enableCentralizedSwappers (
'enabled' | 'disabled'): Enable/disable centralized swappers.
5. Wallet & Signers Configuration
wallets(string[]) - OptionalA list of supported wallet types for connecting to the widget. Example:
['metamask', 'phantom'].
multiWallets(boolean) - OptionalIf set to
true, the user can connect multiple wallets. Otherwise, he could only connect one wallet at the same time. (Not recommended)
externalWallets(boolean) - OptionalAllows external wallet integration.
signers(SignersConfig) - OptionalCustom RPC configuration for specific blockchains.
customSolanaRPC (
string): Custom Solana RPC endpoint URL.
trezorManifest(TrezorManifest) - OptionalRequired for integrating Trezor wallets. Provide your app's URL and a contact email.
email (
string): your email addressappUrl (
string): your application URL
tonConnect (
TonConnectConfig) - OptionalRequired for integrating Ton wallets.
manifestUrl (
string): The link to your app URL containing your app URL, name and iconUrl. Sample: https://app.rango.exchange/tonconnect-manifest.json
6. Affiliate Configuration
affiliate(WidgetAffiliate) - OptionalConfiguration for charging affiliate fees. Please check widget monetization guide.
ref (
string): Your affiliate referral code.percent (
number): The percentage of fees charged per transaction.wallets (
object): A map of blockchain names to affiliate wallet addresses.
7. Feature Toggles
features(Features) - OptionalControls the visibility of various features. For example, you could hide the theme or language settings in widget if you want to control it from your dApp.
theme (
'visible' | 'hidden'): Show/hide the theme feature.language (
'visible' | 'hidden'): Show/hide the language selector.connectWalletButton (
'visible' | 'hidden'): Show/hide the connect wallet button.notification (
'visible' | 'hidden'): Show/hide the notification icon.liquiditySource (
'visible' | 'hidden'): Show/hide liquidity source information.customTokens (
'visible' | 'hidden'): Show/hide the custom token feature.
Sample Configuration Code
Last updated