Chainhop UI-Widget
UI Widget offers a convenient approach to embed the Chainhop components into your website.
The communication between your host website and the iframe widget via the window message. Once the widget identifies the source, this inner CustomIframeProvider will transform all JSON RPC to the parent host website.
Quick start
Import Chainhop widget to your host website
While you are adding the iframe to your website, you must make sure your website domain is whitelisted by ChainHop server.
2. Provide your custom chain & tokens configuration (Optional)
By default, all the chains and tokens supported in Chainhop will expose to you. However. if you expect specific chains and tokens, you can post a JSON message to the widget like this.
3. Handle Messages from the widget.
The Provider communication in the widget will be transformed into your host website. You may implement these functions or use functions provided by web3provider/ether.js. Here is an example, https://github.com/cryptyuyuan/chainhop-widget-demo/blob/e3b9146d940ed0a1042afe685460b2e2530538e5/src/iframe/CustomIframe.tsx#L84
• get_widgetConfig
• wallet_connect
• eth_chainId
• eth_accounts
• eth_requestAccounts
• wallet_switchEthereumChain
• eth_sendTransaction
•eth_getBalance
• eth_call
• eth_getTransactionReceipt
• eth_blockNumber
• eth_estimateGas
• eth_getTransactionByHash
ChainHop Widget Demo Application
You can check our public repo as a quick start demo. Meanwhile, we provide the corresponding demo website here.
Last updated