JSPM

@1claw/wallet-react

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q70727F
  • License MIT

Embeddable treasury wallet component for Platform API apps built on 1Claw

Package Exports

  • @1claw/wallet-react

Readme

@1claw/wallet-react

Embeddable treasury wallet React component for Platform API apps built on 1Claw.

Installation

npm install @1claw/wallet-react

Quick Start

import { OneclawTreasuryWidget } from "@1claw/wallet-react";

function App() {
  return (
    <OneclawTreasuryWidget
      apiKey="plt_your_platform_api_key"
      chains={["ethereum", "base"]}
      onTransactionSent={(tx) => console.log("Sent:", tx.txHash)}
      onError={(err) => console.error(err)}
    />
  );
}

Components

<OneclawTreasuryWidget />

All-in-one widget that displays wallet balances and allows transfers.

Prop Type Required Description
apiKey string Yes Platform API key (plt_...)
baseUrl string No API base URL (default: https://api.1claw.xyz)
chains string[] No Chains to generate wallets for
theme "light" | "dark" | "auto" No Color theme
onError (error: Error) => void No Error callback
onTransactionSent (result) => void No Transaction success callback
className string No CSS class for outer container

<OneclawWalletProvider />

Lower-level provider for building custom UI:

import { OneclawWalletProvider, useOneclawWallet } from "@1claw/wallet-react";

function CustomWalletUI() {
  const { wallets, balances, send, refreshBalance } = useOneclawWallet();
  // Build your own UI...
}

function App() {
  return (
    <OneclawWalletProvider apiKey="plt_...">
      <CustomWalletUI />
    </OneclawWalletProvider>
  );
}

Hooks

useOneclawWallet()

Returns:

Field Type Description
wallets WalletInfo[] Active wallets
balances Record<string, WalletBalance> Cached balances by chain
loading boolean Initial load state
error Error | null Last error
refreshWallets() () => Promise<void> Refetch wallet list
refreshBalance(chain) (chain: string) => Promise<WalletBalance> Fetch balance
generateWallets(chains?) (chains?: string[]) => Promise<WalletInfo[]> Generate new wallets
send(params) (params: SendTransactionParams) => Promise<SendTransactionResult> Send a transaction

Security

  • The apiKey is a Platform API key, not a user key — it inherits platform custody guarantees.
  • Sends require password re-authentication via the password field in SendTransactionParams.
  • The widget never stores or caches private keys client-side.