Skip to main content

API Reference

NOTE : Props marked with * are required. The rest are optional.​

Bridge Component Props​

PropTypeDescription
provider [*]ProviderWeb3 Provider initialised from user’s connected wallet. When a user changes network/account, it’s best practice to pass the provider again
API_KEY [*]stringSocket’s API Key
singleTxOnlybooleanWhen true, only returns bridge routes that can be completed by a single tx on the source chain. Single Transaction Bridging NOTE : Users won’t have an option to toggle between single/multi tx mode in the widget settings if this param is set true.
sourceNetworksnumber[]Array of chainIDs of source chains the widget should support.
destNetworksnumber[]Array of chainIDs of destination chains the widget should support.
defaultSourceNetworknumberchainID of network that should be selected as source chain by default
defaultDestNetworknumberchainID of network that should be selected as destination chain by default
tokenListstringURL of list with token addresses on all chains the widget should support. The schema of the token list should be similar to Uniswap Token List.
defaultSourceTokenstringAddress of token that should be selected as source token by default
defaultDestTokenstringAddress of token that should be selected as destination token by default
singleTxOnlybooleanWhen true includes routes requiring only one transaction to bridge.
enableRefuelbooleanRefuel option is visible on the UI when set to true. Users can toggle it on to receive GAS on destination chain in addition to bridging tokens. Refuel Overview.
enableSameChainSwapsbooleanWhen set to true enables same chain swaps in addition to cross-chain swaps.
localestringTBD
customizeCustomizationPropsCSS properties that can be customised. The properties & their type is highlighted below.
includeBridgesstring[]Bridges to be included in routes returned. The remaining bridges are excluded. Find all here. e.g ["across”, “hyphen”]
excludeBridgesstring[]Bridges to be excluded from routes returned. The remaining bridges are included. Find all here. e.g ["anyswap-router-v4”, “polygon-bridge”]

NOTE: If both includeBridges & excludeBridges are passed, includeBridges takes precedence. |

Example for event handlers

  • ➡️ **Example for event handlers ⬅️**
    <Bridge
    API_KEY="72a5b4b0-e727-48be-8aa1-5da9d62fe635"
    onSourceTokenChange={(value) =>
    console.log("New source Token :", value?.name)
    }
    onDestinationTokenChange={(value) =>
    console.log("New Destination Token : ", value?.name)
    }
    onSubmit={(value) => console.log("New Route Initiated: ", value)}
    onBridgeSuccess={(value) => LogBridgingCompletion(value)}
    />

CustomizationProps

type CustomizationProps = {
width: number;
responsiveWidth?: boolean;
borderRadius?: number;
accent?: string;
onAccent?: string;
primary?: string;
secondary?: string;
text?: string;
secondaryText?: string;
interactive?: string;
onInteractive?: string;
fontFamily?: string;
};
NameTypeDescription
widthstringWidth of the widget in px
responsiveWidthbooleanWidget is responsive relative to the parent element
borderRadiusnumberRadius of all borders in widget, takes values between 0 - 1
accentstringBackground color of buttons
onAccentstringColor of text in buttons
primarystringBackground color of widget and modals
secondarystringForeground color of info section, hover hightlights, cards
textstringColor of all text, headings and emphasised font on widget
secondaryTextstringColor of labels, icons, footer text on widget
interactivestringBackground color of dropdown elements
onInteractivestringColor of text in dropdowns
fontFamilystringChanges font family. The font specified needs to be imported in the project.

Widget Playground :​

We also have a Storybook playground for testing different widget customisations. You can try it out here

To get started :

  • Connect your browser wallet