npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

crosschain-widget

v1.1.2

Published

Crosschain Governance Widget

Downloads

3

Readme

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:

| Property | Description | Type | Default value | | --------------------- | ---------------------------------------------------------------------------------------------------------- | --------------------------- | ---------------------------- | | originAddress | The origin address associated with the user's account | string | N/A | | userChainId | The chain ID of the user's blockchain network | number | N/A | | setTx | A callback function that receives the transaction data after submission | (tx: string) => void | N/A | | text (optional) | The text to display on the widget button | string | "Cross-Chain Widget" | | provider (optional) | An instance of the providers.JsonRpcProvider from ethers.js | providers.JsonRpcProvider | undefined | | signer (optional) | An instance of the providers.JsonRpcSigner to execute the transaction on the final step | providers.JsonRpcSigner | undefined | | modal (optional) | Flag to enable or disable modal behavior for the widget | boolean | true | | className (optional) | classname to add styles to open modal button | string | "crosschain-widget-button" | | lightTheme (optional) | Flag to enable a light theme for the widget | boolean | false | | alchemyKey (optional) | Alchemy API Key | string | undefined | | infuraKey (optional) | Infura API Key | string | undefined | | testnet (optional) | Flag to enable or disable testnet chains | boolean | false |

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.