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

yokopay

v0.3.0

Published

YokoPay TypeScript SDK - deposit and withdrawal API client with ECDSA signature authentication

Downloads

41

Readme

yokopay

YokoPay TypeScript SDK — type-safe client for deposit and withdrawal APIs with ECDSA signature and API key authentication.

Installation

npm install yokopay
# or
pnpm add yokopay

Requires Node.js 18+.

Quick Start

import { YokoPay } from "yokopay";

const client = new YokoPay({
  projectId: "your-project-id",
  privateKey: "0x...",
  publicKey: "0x...",
  platformPublicKey: "0x...",
  apiKey: "your-api-key",
});

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | baseUrl | string | No | API base URL (default: https://api.yokopay.com) | | projectId | string | Yes | Project UID from the dashboard | | privateKey | string | Yes | Your ECDSA private key (0x-prefixed hex) — used to sign POST requests | | publicKey | string | Yes | Your ECDSA public key (0x-prefixed, uncompressed 65-byte) | | platformPublicKey | string | Yes | YokoPay platform public key for callback verification | | apiKey | string | Yes | API key for authenticating GET requests (sent as X-API-Key) | | timeout | number | No | Request timeout in seconds (default: 30) |

Key Generation

const keys = YokoPay.generateKeys();

console.log(keys.privateKey); // "0x..."
console.log(keys.publicKey);  // "0x04..."
console.log(keys.address);    // "0x..."

Deposit Addresses

Batch Generate

const result = await client.generateDepositAddresses({
  count: 3,
  networkId: 11155111,
});

console.log(result.data.addresses);

Single Generate

const result = await client.generateDepositAddress({
  userUid: "user123", // project ID is auto-prefixed if missing
  networkId: 11155111,
});

console.log(result.data.address);

Get by UID

const result = await client.getDepositAddress("userUid", 11155111);

console.log(result.data.address);

Deposits & Withdrawals

Get Deposit Records

const deposits = await client.getDeposits({ page: 1, pageSize: 10 });

Get Withdrawal Records

const withdrawals = await client.getWithdrawals({ page: 1, pageSize: 10 });

Request Withdrawal

const result = await client.requestWithdrawal({
  uid: "unique-withdrawal-id",
  assetId: 1,
  amount: 100.0,
  toAddress: "0x...",
  networkId: 11155111,
});

console.log(result.data.status); // "pending"

Consolidation Balances

Get the warm wallet balances of the platform across all networks and tokens.

const result = await client.getConsolidationBalances();

for (const balance of result.data) {
  console.log(`${balance.networkName} ${balance.tokenName}: ${balance.balanceFloat}`);
}

Callback Verification

YokoPay sends webhook callbacks for deposit/withdrawal events. Verify the platform signature before processing:

app.post("/webhook", (req, res) => {
  try {
    const data = client.parseCallbackData(req.body);

    if (data.type === "deposit" && data.confirmed) {
      console.log(`Deposit ${data.floatAmount} ${data.assetName}`);
    }

    if (data.type === "withdraw") {
      console.log(`Withdrawal ${data.uid} status: ${data.status}`);
    }

    res.status(201).json({ message: "callback received" });
  } catch {
    res.status(401).json({ error: "Invalid signature" });
  }
});

Or verify manually:

const isValid = client.verifyPlatformSignature(payload.verify_data, payload.sig);

Constants

import { NetworkId, AssetId, AssetName, TxStatus, WithdrawStatus } from "yokopay";

NetworkId.Sepolia;          // 11155111
AssetId.USDC;               // 1
AssetName.USDT;             // "USDT"
TxStatus.Confirmed;         // "confirmed"
WithdrawStatus.UnderReview;  // "under_review"

| Network | ID | |---------|----| | Ethereum Mainnet | 1 | | BSC Mainnet | 56 | | BSC Testnet | 67 | | Sepolia | 11155111 | | TRX | 4 | | TRX Shasta | 5 |

Error Handling

import { YokoPayError } from "yokopay";

try {
  await client.requestWithdrawal(params);
} catch (error) {
  if (error instanceof YokoPayError) {
    console.error(error.code);    // HTTP status code
    console.error(error.message); // Error message
  }
}

License

MIT