Compass Widget
This is an outdated version of our documentation.
Please visit the latest version at https://docs.blockend.com/ for up-to-date and accurate information.
npm install blockendyarn:
yarn add blockendGetting started with Blockend Widget
Integrating widget to your dapp or webiste is very easy. It takes a full 3 line of code to integrate and start using Blockend Widget, now that's a lot of work for a human dev.
1. Import Widget dependencies
In your react app, start by importing the Blockend Widget and its styles
import Blockend from "blockend";
import "blockend/dist/main.css";You may encounter Server Error... ReferenceError: self is not defined in your Next JS app, this is because blockend requires web apis to work and the web apis are not available on the server side when next js renders a page, in order to avoid this you can start by importing the Blockend Widget like below
import dynamic from "next/dynamic";
const Blockend = dynamic(() => import("blockend"), {
ssr: false,
});
import "blockend/dist/main.css";2. Initialize the Widget
Add the widget component to your app
Integrator Id (Required)
Unique identifier assigned to each integration partner. It is used to track and manage various integrations within our system.Error will be thrown if this field is empty.
This id will be added in the request header of api calls that is made by the widget.
And that is it, you have successfully integrated the Blockend Widget.
3. (optional) Customizing the Widget
As an optional step, you can also customize the look and feel of the widget. This can be done by passing a configuration object as prop when initializing the widget.
Full list of configuration options can be found here
Configuration Options
Customizing gradient colors
You can customize the gradient colors of the widget by passing gradientStyle object in configuration.
You can customize the theme of the widget by passing customTheme object in configuration.
Setting Default Chains and Tokens
Widget gives you the option to set default chains and tokens to be shown to the user. This can be done by passing defaultChains and defaultTokens in configuration when initializing the widget.
See list of supported chains and tokens below.
Note: token address for native tokens is set to 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Here is what a integration of widget on your frontend might look like:
Supported Chains
Solana
sol
Ethereum
1
Optimism
10
BSC
56
Polygon
137
FUSE
122
Gnosis
100
Fantom
250
Base
8453
Arbitrum
42161
zkSync Era
324
Polygon zkEVM
1101
Avalanche
43114
Boba
288
OKXChain
66
Moonbeam
1284
Moonriver
1285
Cronos
25
Heco
128
Aurora
1313161554
Harmony
1666600000
Evmos
9001
Supported Tokens
Blockend Widget supports a whole array of token which would be difficult to list here, so we have built a handy API just for that
You can also pass chainId as query parameter to get tokens for a specific chain
You can also get list of supported chains by calling the following endpoint
Last updated
Was this helpful?