Plugin Usage

Examples of basic use.

import Bridge from "@chainge/plugin";

const root = ReactDOM.createRoot(document.getElementById("root") as any);
root.render(
  <React.StrictMode>
    <Bridge
      feeLevel={0}
      options={{
        appKey: "your appKey",
        secret:"your secret",
      }}
    ></Bridge>
  </React.StrictMode>
);

Params:

isConnected: optional, Defaults to true to handle the wallet's non-true broken link

feeLevel: required, Please refer to FeeLevel

options: required, Please refer to Set up the SDK

options = {{
  appKey: '', // required, your appKey 
  secret: '', // optional, your secret
  signUrl: '', // optional, url of the signature service
}}

language: optional, defaults to "en". Only English("en") and Chinese("zh-cn") are supported.

defaultParams: optional, Default initial value

defaultParams={{
    fromChain: "",
    fromToken: "",
    toChain: "",
    toToken: "",
    fromAmount: ""
}}

paramsChange: optional, A callback function whose parameters change

transacteChainChange: optional, A callback function that changes the main trade chain

connectWallet:optional, Connect wallet callback function, you can open your wallet related here

theme: optional, theme

// black theme
theme={{
        mainBackground: '#18191f',
        secondBackground: '#3f415b',
        textColor: '#ffffff',
        secondTextColor: '#ffffff',

        valueColor: '#ffffff',

        btnBackgroundColor: '#F9DB4A',
        btnTextColor: '#333333',

        loadingColor: '#F9DB4A',
      }}

Last updated