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 🙏

© 2025 – Pkg Stats / Ryan Hefner

one-wallet-react

v0.1.4

Published

A React library for wallet operations, providing customizable components for deposits, withdrawals, and balance display.

Readme

one-wallet-react

A React library for wallet operations, providing customizable components for deposits, withdrawals, and balance display.

Installation

npm install one-wallet-react
# or
yarn add one-wallet-react

Components

This library exports the following components:

  • Deposit: A form for depositing funds.
  • Withdraw: A form for withdrawing funds.
  • Hybrid: A tabbed interface combining both Deposit and Withdraw.
  • BalanceDisplay: A component to show the user's current balance.
  • WalletConnectButton: A button to connect a wallet (basic implementation).

Usage

1. Hybrid Component (Recommended)

The Hybrid component is the most versatile, allowing users to switch between depositing and withdrawing.

import React from 'react';
import { Hybrid } from 'one-wallet-react';

const WalletPage = () => {
  const handleTransactionSuccess = (type: 'deposit' | 'withdraw', amount: number) => {
    console.log(`${type} successful: ${amount}`);
    // Refresh balance or show notification
  };

  return (
    <Hybrid
      accessCode="USER_ACCESS_CODE"
      userId="USER_ID"
      onTransactionSuccess={handleTransactionSuccess}
      // Optional Customization
      depositLabel="Add Funds"
      withdrawLabel="Cash Out"
      containerStyle={{ border: '1px solid #ddd', boxShadow: '0 4px 8px rgba(0,0,0,0.1)' }}
      activeTabStyle={{ color: '#007bff', borderBottom: '2px solid #007bff' }}
    />
  );
};

2. Deposit Component

Use this if you only need the deposit functionality.

import React from 'react';
import { Deposit } from 'one-wallet-react';

const DepositPage = () => {
  return (
    <Deposit
      accessCode="USER_ACCESS_CODE"
      userId="USER_ID"
      onDepositSuccess={(amount) => console.log(`Deposited: ${amount}`)}
      title="Top Up Wallet"
      buttonText="Pay Now"
      buttonStyle={{ backgroundColor: '#28a745' }}
    />
  );
};

3. Withdraw Component

Use this if you only need the withdraw functionality.

import React from 'react';
import { Withdraw } from 'one-wallet-react';

const WithdrawPage = () => {
  return (
    <Withdraw
      accessCode="USER_ACCESS_CODE"
      userId="USER_ID"
      onWithdrawSuccess={(amount) => console.log(`Withdrew: ${amount}`)}
      title="Request Payout"
      buttonText="Withdraw Funds"
      buttonStyle={{ backgroundColor: '#dc3545' }}
    />
  );
};

4. BalanceDisplay Component

Displays the user's balance.

import React from 'react';
import { BalanceDisplay } from 'one-wallet-react';

const Header = () => {
  return (
    <header>
      <h1>My App</h1>
      <BalanceDisplay accessCode="USER_ACCESS_CODE" userId="USER_ID" />
    </header>
  );
};

Wallet Connection

All components (Deposit, Withdraw, Hybrid, BalanceDisplay) support a wallet connection check.

  • isWalletConnected (boolean): If false, the component hides its main content and shows a "Connect Wallet" button. Defaults to true.
  • onConnectWallet (function): Callback function triggered when the "Connect Wallet" button is clicked.
<Hybrid
  accessCode="123"
  userId="456"
  isWalletConnected={isWalletConnected}
  onConnectWallet={() => connectWallet()}
/>

Customization

All form components (Deposit, Withdraw, Hybrid) accept the following style props:

  • containerStyle: Style for the outer container.
  • inputStyle: Style for the input field.
  • buttonStyle: Style for the action button.
  • labelStyle: Style for the input label.
  • className: CSS class for the container.

And label props:

  • title: Component title (for Deposit/Withdraw).
  • buttonText: Text on the action button.
  • placeholder: Placeholder text for the input.

The Hybrid component also accepts:

  • tabStyle: Style for the tabs.
  • activeTabStyle: Style for the active tab.
  • depositLabel: Label for the deposit tab.
  • withdrawLabel: Label for the withdraw tab.
  • depositProps: Props object passed to the internal Deposit component.
  • withdrawProps: Props object passed to the internal Withdraw component.

Optimization

All components are optimized using React.memo to prevent unnecessary re-renders. Event handlers are memoized with useCallback.