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

@unilogin/web3

v0.5.11

Published

The easiest way to interact with Universal Login is via web3 providers, that allow interacting with UniLogin contracts via web3js, ethers.js, or similar libraries.

Downloads

27

Readme

Using Web3 providers

The easiest way to interact with Universal Login is via web3 providers, that allow interacting with UniLogin contracts via web3js, ethers.js, or similar libraries.

Installation

To add universal login web3 to project with yarn, type:

yarn add @unilogin/web3

ULWeb3Provider

ULWeb3Provider allows interacting with UniLogin contracts. Before triggering actions on the blockchain, it will show related dialogs.

Below is example creation of the wallet:

  const ulWeb3 = new ULWeb3Provider({
    provider: new Web3.providers.HttpProvider(
      'https://kovan.infura.io/v3/b3026fc5137a4bd18e5d5906ed49f77d'
    ),
    relayerUrl: 'https://relayer-kovan.herokuapp.com',
    ensDomains: ['poppularapp.test'],
    applicationInfo: {
      applicationName: 'Kickback',
      logo: 'https://kickback.events/favicon.ico',
      type: 'laptop'
    }

Constructor takes one argument - ULWeb3ProviderOptions:

export interface ULWeb3ProviderOptions {
  provider: Provider; //web3Provider
  relayerUrl: string; //url to ethereum node (as an alternative to proivder)
  ensDomains: string[]; //list of supported domains
  applicationInfo?: ApplicationInfo; // see below
  ...
}

Application info allows passing meta-data about an application, that can be later used in a user interface to identify which keys belong to which application and devices

export interface ApplicationInfo {
  applicationName: string; // Name of the application
  type: string; // 'laptop', 'mobile', 'browser'
  logo: string; //Url to application logo
}

Web3Strategy

Web3Strategy is useful to work with applications that are already working with other existing web3 providers. It allows delaying user choice of web3 provider (e.g. MetaMask vs Universal Login). Web3Strategy will allow reading from a provider. The first action that requires a wallet will trigger dialog that allows picking web3 provider.

See the example below.

function setupWeb3(web3) {
  const provider = web3.currentProvider //or however you were creating provider before
  web3.setProvider(
    new Web3Strategy(
      [
        {
          name: 'UniLogin',
          icon: 'UniLogin logo',
          create: () => ulWeb3
        },
        {
          create: () => provider,
          icon: 'Kickback icon',
          name: 'Kickback default provider'
        }
      ],
      provider
    )
  )
}

Example integration

We are working on Example integration with Kickback. Take a look at following (PR)[https://github.com/UniversalLogin/UniversalKickback/pull/3/files] to see latest working approach.

Button

Log in with Ethereum button is comming.