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

@mindsorg/web3modal-ts

v1.3.0

Published

Web3modal's provider layer abstraction for simple implementation of web3 wallet connections

Downloads

274

Readme

Web3Modal-TS

Fork of https://github.com/Web3Modal/web3modal, without any React or visual component implemented. Just the typescript core.

Motivation

Web3Modal is a very useful and easy to use library, that allows developers to add support for multiple providers in their apps with a simple customizable configuration.

However, the original package uses React and its bundled vanilla JS version also has React bundled with it. Therefore, separating the typescript core from the React data providers and visual components is particularly useful, not only to allow full customization of the UI, but can also serve as a starting point for implementations in other frameworks like Angular and VueJS.

Usage

  1. Install Web3Modal-TS NPM package
npm install --save @mindsorg/web3modal-ts

Or

yarn add @mindsorg/web3modal-ts
  1. Instantiate a Web3WalletConnector object
const web3walletConnector = new Web3WalletConnector({
  network: "mainnet", // optional
  cacheProvider: true, // optional
  providerOptions // required
})

The Web3WalletConnector constructors takes an optional configuration argument that matches the original web3modal's configuration object

See Web3Modal's provider options

Optionally the object can be instantiated and the configuration added/overriden later with the setConfiguration method:

  web3WalletConnector.setConfiguration({
    network: "mainnet", // optional
    cacheProvider: true, // optional
    providerOptions // required
  })
  1. Set connection and error event handlers

The web3WalletConnector object contains the event handlers for errors and connection to a wallet provider:

  web3WalletConnector.providerController.on(CONNECT_EVENT, provider => { ... });

  web3WalletConnector.providerController.on(ERROR_EVENT, error => { ... });

It also contains the methods to handle provider caching:

  web3WalletConnector.providerController.clearCachedProvider();

  web3WalletConnector.providerController.setCachedProvider(idString);

Provider Options

Web3Modal-TS supports the original Web3modal's Metamask WalletConnect, Fortmatic, Torus, Authereum, UniLogin, BurnerConnect, Portis, Squarelink, Arkane, Mew Connect protocol, D'CENT Wallet and Bitski. See Web3Modal's provider options

Additionally, it supports:

WalletLink

  1. Install Provider Package
npm install --save walletlink

# OR

yarn add walletlink
  1. Set Provider Options
import WalletLink from "walletlink";

const providerOptions = {
  walletlink: {
    package: WalletLink,
    options: {
      infuraUrl: 'https://mainnet.infura.io/v3/PROJECT_ID',
      appName: "My Awesome DApp",
      appLogoUrl: "https://example.com/logo.png",
      darkMode: false
    },
  },
};

License

MIT