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

@web3-onboard/uauth

v2.2.1

Published

Unstoppable Domains module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic moder

Downloads

519

Readme

@web3-onboard/uauth

Wallet module for connecting Unstoppable Domains to web3-onboard

Install

NPM npm i @web3-onboard/core @web3-onboard/uauth

Yarn yarn add @web3-onboard/core @web3-onboard/uauth

Options

Follow the Login Client Congifuration Docs on the Unstoppable Domains website to get setup with your clientID and redirectUri. Note: The Redirection URI value(s) in the client configuration MUST exactly match the redirect_uri parameter value used in UauthInitOptions. More specifics can be found in the Rules for Redirect URIs Docs.

type UauthInitOptions = {
  /**
   * Required and will throw an error if not included: links dapp to Unstoppable Domains for customization
   */
  clientID: string
  /**
   * Required and will throw an error if not included: used for pop-up and callback redirection
   */
  redirectUri: string
  /**
   * Optional string: Default = 'openid wallet'
   */
  scope?: string
  /**
   * Optional boolean: If true, redirects to your callback page
   */
  shouldLoginWithRedirect?: boolean
  /**
   * Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
   */
  walletConnectProjectId: string
  /**
   * Defaults to version: 2
   */
  version?: 2
  /**
   * List of Required Chain(s) ID for wallets to support in number format (integer or hex)
   * Defaults to [1] - Ethereum
   */
  requiredChains?: number[] | undefined
  /**
   * List of Optional Chain(s) ID for wallets to support in number format (integer or hex)
   * Defaults to the chains provided within the web3-onboard init chain property
   */
  optionalChains?: number[] | undefined
  /**
   * Additional methods to be added to the default list of ['eth_sendTransaction',  'eth_signTransaction',  'personal_sign',  'eth_sign',  'eth_signTypedData',  'eth_signTypedData_v4']
   * Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
   */
  additionalOptionalMethods?: string[] | undefined
  /**
   * Optional function to handle WalletConnect URI when it becomes available
   */
  handleUri?: (uri: string) => Promise<unknown>
}

Usage

import Onboard from '@web3-onboard/core'
import uauthModule from '@web3-onboard/uauth'

// initialize the module with options
const uauth = uauthModule({
  clientID: 'a25c3a65-a1f2-46cc-a515-a46fe7acb78c',
  walletConnectProjectId: 'f6bd6e2911b56f5ac3bc8b2d0e2d7ad5',
  redirectUri: 'http://localhost:8080/',
  scope:
    'openid wallet email:optional humanity_check:optional profile:optional social:optional'
})

// can also initialize with basic options...
// const uauth = uauthModule({
//  clientID: "YOUR_CLIENT_ID",
//  redirectUri: "YOUR_REDIRECT_URI",
// walletConnectProjectId: 'f6bd6e2911b56f5ac3bc8b2d0e2d7ad5',
// })

const onboard = Onboard({
  // ... other Onboard options
  wallets: [
    uauth
    //... other wallets
  ]
})

const connectedWallets = await onboard.connectWallet()
console.log(connectedWallets)

Accessing the UAuth configuration

When Unstoppable Domains is connected the UAuth user instance is exposed. This can be used to get information related to the user scopes requested through the UauthInitOptions.

const wallets$ = onboard.state.select('wallets').pipe(share())
wallets$.subscribe(wallet => {
  const unstoppableUser = wallet.find(
    provider => provider.label === 'Unstoppable'
  )
  if (unstoppableUser) console.log(unstoppableUser.instance.user)
})