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

@peersky/next-web3-chakra

v0.5.3

Published

Web3 enabled react components made for nextjs and chakra ui

Downloads

34

Readme

Web3 react components for Chakra on Next

React(18) components for chakra(2) using next(13).

This is a website building bricks package such as navbar, footer, cards, layouts etc.

It is intended to be used for Web3 specific projects - grants you a web3 provider interface, chain selector drop down, and allows to build generic smart contract interface by just pointing address and ABI. How cool is that?

Use case

https://peersky.github.io/daococoa/

How to use

Getting started

Install yarn add @peersky/next-web3-chakra

Create config.ts that has exports SITEMAP:

import { SiteMap, SiteMapItemType } from "@peersky/next-web3-chakra/dist/types";
export const SITEMAP: SiteMap = [
  {
    title: "Blog",
    path: "/blog",
    type: SiteMapItemType.CONTENT,
  }]

create your theme. Here is how you start with default theme:

import { default as defaultTheme } from "@peersky/next-web3-chakra/dist/theme/";

import { extendTheme } from "@chakra-ui/react";

const theme = extendTheme({
  ...defaultTheme,
  //Here can override library theme items
});

export default theme;

Wrap your application:

import { UIProvider, Web3Provider } from "@peersky/next-web3-chakra/dist/providers";
import { SITEMAP } from "./config";
import theme from "./theme";
....
 <ChakraProvider theme={theme}>
      {/* <Fonts /> */}
      <Web3Provider>
        <UIProvider config={{ SITEMAP: SITEMAP }}>{props.children}</UIProvider>
      </Web3Provider>
</ChakraProvider>

Layouts

This package does not use next13 layouts. Instead old fashioned way is preserved. Use as follows to ensure items defined in layouts do not rerender when you switch between pages:

import { getLayout } from "@peersky/next-web3-chakra/dist/layouts/BlogLayout";
const Blog = <div>lorem<div>
Blog.getLayout = getLayout();
export default Blog;

Components

Import from @peersky/next-web3-chakra/dist/components see inside repository for more details

Providers

Import from @peersky/next-web3-chakra/dist/providers

UI Provider gives you general information about state of UI:

export interface UIProviderInterface {
  sidebarVisible: boolean | undefined;
  searchBarActive: boolean | undefined;
  isMobileView: boolean | undefined;
  sidebarCollapsed: boolean | undefined;
  sidebarToggled: boolean | undefined;
  searchTerm: string | undefined;
  setSearchBarActive: Function;
  setSidebarCollapsed: Function;
  setSearchTerm: Function;
  setSidebarToggled: Function;
  setSidebarVisible: Function;
  sessionId: string | undefined;
  webSiteConfig: WebSiteConfig;
}

Web3 Provider gives a convinient access to blockchain related operations:

export interface Web3ProviderInterface {
  web3: Web3; //web3js
  onConnectWalletClick: Function;
  buttonText: String;
  WALLET_STATES: WalletStatesInterface; //onboard/conect/connected/unknown-chain
  account: string; //address
  chainId: number;
  defaultTxConfig: Object;
  // signAccessToken: Function;
  getMethodsABI: typeof GetMethodsAbiType; //Takes contract ABI and returns method with given name
  changeChain: typeof ChangeChain; //Request wallet to switch chain
  targetChain: ChainInterface | undefined; //Desired chain
  getChainFromId: typeof getChainFromId; //Read chain name from chain id
}

Why there is no <you_name_it>

Author works on this package for pure enthusiasm. If you want to contribute or request a feature: please contact on github: https://github.com/peersky/daococoa/issues

Fund

You can fund this project to make it more fun.