Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

crosschain-widget

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crosschain-widget

Crosschain Governance Widget

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Cross-chain Governance Widget

The Cross-chain Governance Widget is a user-friendly React component library that enables users to deploy and manage their Avatar's Zodiac Connext Module and easily build the transaction data required for executing desired actions through an xcall function in Connext.

Development

To set up the development environment, first clone the repository:

git clone [this repo link] && cd [this repo name]

Local environment

Install dependencies:

yarn

Start the testing app:

yarn dev

The app should be live at http://localhost:5173/.

Production

To build the production-ready version, run the following command:

yarn build

Now you can use yarn link to test the library.

You can also run yarn build:dev and yarn preview to use the built-in application to try out the widget.

Example

To use the Crosschain Widget in your React application, import the ZodiacConnextWidget component from the package and provide the required props.

import { ZodiacConnextWidget } from "crosschain-widget";

// Inside your React component
const MyComponent = () => {
  const handleTransaction = (tx) => {
    // Handle the transaction data
  };

  return (
    <ZodiacConnextWidget
      originAddress="0x123abc..."
      userChainId={1}
      setTx={handleTransaction}
      text="Open Widget Modal!"
      modal={true}
      provider={myProviderInstance}
      lightTheme={true}
    />
  );
};

Please note that you need to provide appropriate values for the originAddress, userChainId, setTx, and provider props according to your application's requirements.

Props

The following props are available for the ZodiacConnextWidget component:

PropertyDescriptionTypeDefault value
originAddressThe origin address associated with the user's accountstringN/A
userChainIdThe chain ID of the user's blockchain networknumberN/A
setTxA callback function that receives the transaction data after submission(tx: string) => voidN/A
text (optional)The text to display on the widget buttonstring"Cross-Chain Widget"
provider (optional)An instance of the providers.JsonRpcProvider from ethers.jsproviders.JsonRpcProviderundefined
signer (optional)An instance of the providers.JsonRpcSigner to execute the transaction on the final stepproviders.JsonRpcSignerundefined
modal (optional)Flag to enable or disable modal behavior for the widgetbooleantrue
className (optional)classname to add styles to open modal buttonstring"crosschain-widget-button"
lightTheme (optional)Flag to enable a light theme for the widgetbooleanfalse
alchemyKey (optional)Alchemy API Keystringundefined
infuraKey (optional)Infura API Keystringundefined
testnet (optional)Flag to enable or disable testnet chainsbooleanfalse

Live example

You can find the example implementation repository here and the live code example here.

License

This project is licensed under the AGPL-3.0-only License.

FAQs

Package last updated on 18 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc