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 🙏

© 2026 – Pkg Stats / Ryan Hefner

upcx-auth

v1.0.24

Published

A React TypeScript library providing authentication modal components and common utility functions for UPCX based projects.

Readme

upcx-auth

A React TypeScript library providing authentication context provider and common utility functions for UPCX-based projects.


Installation

Install via npm:

npm install upcx-auth

or via yarn:

yarn add upcx-auth

Usage

1. Wrap Your App with UPCXAuthProvider

To enable authentication context and modal functionality, wrap your application with the UPCXAuthProvider:

import React from "react";
import { UPCXAuthProvider } from "upcx-auth";

const App = () => (
  <UPCXAuthProvider>{/* your app components */}</UPCXAuthProvider>
);

export default App;

2. Access Auth Context

You can access authentication state and helper methods using the useUPCXAuthContext hook:

import { useUPCXAuthContext } from "upcx-auth";

const MyComponent = () => {
  const {
    account,
    accountID,
    pubKey,
    accountIconType,
    authLoaded,
    handleShowLoading,
    handleShowAuthModal,
    setHandleSignInSuccessed,
    setHandleSignInFailed,
    setHandleError,
    handleDisconnect,
    handleTransfer,
    handleSignMessage,
    handleExecuteContract,
  } = useUPCXAuthContext();

  // Example usage
  return (
    <div>
      {account ? (
        <span>Welcome, {account}</span>
      ) : (
        <button onClick={() => handleShowAuthModal(true)}>Sign In</button>
      )}
    </div>
  );
};

UPCXAuthContext Values & Methods

The context provides the following values and methods:

| Name | Type | Description | | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | | account | string \| undefined | Current account name (if signed in) | | accountID | string \| undefined | Current account ID | | pubKey | string \| undefined | Public key | | accountIconType | number | Account icon type | | authLoaded | boolean | Whether authentication is loaded | | handleShowLoading | (show: boolean) => void | Show or hide loading indicator | | handleShowAuthModal | (show: boolean) => void | Show or hide authentication modal | | setHandleSignInSuccessed | (callback: () => void) => void | Set callback for successful sign-in | | setHandleSignInFailed | (callback: (err: Error) => void) => void | Set callback for failed sign-in | | setHandleError | (callback: (err: Error) => void) => void | Set callback for general errors | | handleDisconnect | () => void | Disconnect the current session | | handleTransfer | (toAccount: string, amount: number, tokenName: string, precision: number, onSuccess: () => void, onFailed: (err: Error) => void) => Promise<void> | Transfer tokens to another account | | handleSignMessage | (message: string, onSuccess: (signedMessage: string) => void, onFailed: (err: Error) => void) => void | Sign a message | | handleExecuteContract | (contractName: string, funcName: string, params: any, onSuccess: () => void, onFailed: (err: Error) => void) => Promise<void> | Execute a smart contract |


Utility Functions

The library also exports common utility functions:

import {
  recoverPrivateKey,
  saveAuthData,
  getAccountName,
  getPublicKey,
  signOut,
} from "upcx-auth";

// Example usage:
recoverPrivateKey().then((key) => console.log(key));

Demo

A demo website using this library is available at UPCX-Auth-Demo-Web.
Refer to this project for a full integration example.


Assets

SVG and image assets (such as Google, Facebook, X icons) are included and imported as modules.
Note: Ensure your build process copies the asset directory to your output (dist) directory.


License

MIT License.