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

@0xio/sdk

v2.3.0

Published

Official TypeScript SDK for 0xio Wallet - Secure Octra blockchain integration for dApps

Downloads

267

Readme

0xio Wallet SDK

Version: 2.3.0

Official TypeScript SDK for integrating DApps with 0xio Wallet on Octra Network.

What's New in v2.3.0

  • Smart Contract Calls: New callContract() for state-changing contract interaction (signed, with approval popup)
  • Contract View Calls: New contractCallView() for read-only queries (no signing, no popup)
  • Contract Storage: New getContractStorage() to read on-chain contract storage by key
  • Type Safety: New ContractParams type (ReadonlyArray<string | number | boolean>) replaces any in contract interfaces; typed event handlers
  • Error Consistency: getNetworkConfig() now throws ZeroXIOWalletError instead of generic Error
  • Security Fixes: Fixed wildcard origin in dev utils, added signMessage length limit, narrowed dev detection
  • Message Limit: Raised isValidMessage() from 280 to 100K chars to support contract call parameters

Installation

npm install @0xio/sdk

Quick Start

import { ZeroXIOWallet } from '@0xio/sdk';

// 1. Initialize
const wallet = new ZeroXIOWallet({
  appName: 'My DApp',
  requiredPermissions: ['read_balance', 'sign_messages']
});

await wallet.initialize();

// 2. Connect
const connection = await wallet.connect();
console.log('Connected:', connection.address);
console.log('Public Key:', connection.publicKey); // Base64 Ed25519 key

// 3. Get Balance
const balance = await wallet.getBalance();
console.log('Total:', balance.total, 'OCT');

// 4. Sign a Message
const signature = await wallet.signMessage('Hello, 0xio!');
console.log('Signature:', signature);

// 5. Send Transaction
const result = await wallet.sendTransaction({
  to: 'oct1recipient...',
  amount: 10.5,
  message: 'Payment'
});
console.log('TX Hash:', result.txHash);

API Reference

Connection

wallet.initialize(): Promise<boolean>

Initialize the SDK. Must be called first.

wallet.connect(options?): Promise<ConnectEvent>

Connect to the user's wallet. Shows approval popup if first time.

wallet.disconnect(): Promise<void>

Disconnect from the wallet.

wallet.isConnected(): boolean

Check if currently connected.

Balance

wallet.getBalance(forceRefresh?: boolean): Promise<Balance>

Get wallet balance (public + private).

interface Balance {
  public: number;   // Visible on-chain balance
  private: number;  // Encrypted (FHE) balance
  total: number;    // public + private
  currency: 'OCT';
}

Transactions

wallet.sendTransaction(txData): Promise<TransactionResult>

Send a transaction. Returns result with transaction finality status.

interface TransactionData {
  to: string;        // Recipient address (oct1...)
  amount: number;    // Amount in OCT
  message?: string;  // Optional memo
}

interface TransactionResult {
  txHash: string;
  success: boolean;
  finality?: 'pending' | 'confirmed' | 'rejected';
  message?: string;
  explorerUrl?: string;
}

Smart Contracts

wallet.callContract(data: ContractCallData): Promise<TransactionResult>

Execute a state-changing contract call. The extension signs and submits via octra_submit.

const result = await wallet.callContract({
  contract: 'oct26Lia...',  // Contract address
  method: 'swap',           // AML method name
  params: [100, true, 90],  // Method arguments (flat, not array-wrapped)
  amount: '0',              // Native OCT to send (optional, default '0')
  ou: '10000',              // Operational units (optional, default '10000')
});
console.log('TX Hash:', result.txHash);

wallet.contractCallView(data: ContractViewCallData): Promise<any>

Read-only contract query. No signing, no approval popup, no wallet unlock required.

const price = await wallet.contractCallView({
  contract: 'oct26Lia...',
  method: 'get_active_price',
  params: [],
});
console.log('Price:', price);

wallet.getContractStorage(contract: string, key: string): Promise<string | null>

Read contract storage by key.

const value = await wallet.getContractStorage('oct26Lia...', 'total_supply');
console.log('Total supply:', value);

Message Signing

wallet.signMessage(message: string): Promise<string>

Sign an arbitrary message with the wallet's private key. User will be prompted to approve.

// Sign a message for authentication
const message = `Login to MyDApp\nTimestamp: ${Date.now()}`;
const signature = await wallet.signMessage(message);

// Signature is base64-encoded Ed25519
console.log('Signature:', signature);

Use cases:

  • Prove wallet ownership for API authentication
  • Sign login challenges
  • Authorize off-chain actions
  • Create verifiable attestations

Events

wallet.on('connect', (event) => console.log('Connected:', event.address));
wallet.on('disconnect', (event) => console.log('Disconnected'));
wallet.on('balanceChanged', (event) => console.log('New balance:', event.newBalance.total));
wallet.on('accountChanged', (event) => console.log('Account changed:', event.newAddress));
wallet.on('networkChanged', (event) => console.log('Network:', event.newNetwork.name));

Error Handling

import { ZeroXIOWalletError, ErrorCode } from '@0xio/sdk';

try {
  const result = await wallet.sendTransaction({ to: 'oct1...', amount: 10 });
} catch (error) {
  if (error instanceof ZeroXIOWalletError) {
    switch (error.code) {
      case ErrorCode.USER_REJECTED:
        console.log('User rejected the request');
        break;
      case ErrorCode.INSUFFICIENT_BALANCE:
        console.log('Not enough balance');
        break;
      case ErrorCode.INVALID_SIGNATURE:
        console.log('Invalid transaction signature');
        break;
      case ErrorCode.DUPLICATE_TRANSACTION:
        console.log('Transaction already submitted');
        break;
      case ErrorCode.SELF_TRANSFER:
        console.log('Cannot send to yourself');
        break;
      case ErrorCode.NONCE_TOO_FAR:
        console.log('Transaction nonce too far ahead');
        break;
      case ErrorCode.WALLET_LOCKED:
        console.log('Please unlock your wallet');
        break;
    }
  }
}

Networks

The SDK ships with built-in configurations for Octra networks:

import { NETWORKS, getNetworkConfig } from '@0xio/sdk';

// Get devnet config
const devnet = getNetworkConfig('devnet');
console.log(devnet.rpcUrl);           // http://165.227.225.79:8080
console.log(devnet.supportsPrivacy);  // true
console.log(devnet.isTestnet);        // true

// Get mainnet config
const mainnet = getNetworkConfig('mainnet');
console.log(mainnet.rpcUrl);          // https://octra.network
console.log(mainnet.supportsPrivacy); // false

| Network | Privacy (FHE) | Explorer | |---------|:---:|---| | Mainnet Alpha | No | octrascan.io | | Devnet | Yes | devnet.octrascan.io |

NetworkInfo Type

interface NetworkInfo {
  id: string;
  name: string;
  rpcUrl: string;
  explorerUrl?: string;         // Transaction explorer base URL
  explorerAddressUrl?: string;  // Address explorer base URL
  indexerUrl?: string;          // Indexer/API base URL
  supportsPrivacy: boolean;     // FHE encrypted balance support
  color: string;                // Brand color hex
  isTestnet: boolean;
}

Requirements

  • 0xio Wallet Extension v2.0.1 or higher (Mainnet Alpha)
  • 0xio Wallet Extension v2.2.1 or higher (Devnet — required for contract calls and privacy features)
  • Modern browser (Chrome, Firefox, Edge, Brave)

Documentation

See DOCUMENTATION.md for complete API reference.

License

MIT License. Copyright 2026 0xio Labs.