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

@yativo/crypto-sdk

v1.0.3

Published

Official Yativo Crypto SDK for JavaScript/TypeScript

Readme

Yativo Crypto SDK

Official JavaScript/TypeScript SDK for the Yativo Crypto Platform. Seamlessly integrate cryptocurrency wallets, transactions, and blockchain operations into your application.

Features

  • 🔐 Passwordless Authentication - OTP, 2FA (TOTP), passkeys, and API keys
  • USDC on Solana - ~2–5 second finality, low fees
  • USDC on XDC - ~2 second finality, near-zero fees
  • 💼 Account Management - Create and manage user accounts
  • 💰 Wallet Operations - Multi-chain wallet creation and management
  • 🔄 Transactions - Send, receive, and track crypto transactions
  • 🔔 Webhooks - Real-time event notifications
  • 🔑 API Key Management - Secure programmatic access
  • 🛡️ Type Safety - Full TypeScript support

Installation

npm install @yativo/crypto-sdk
# or
yarn add @yativo/crypto-sdk
# or
pnpm add @yativo/crypto-sdk

Quick Start

Initialize the SDK

import YativoSDK from '@yativo/crypto-sdk';

// Initialize with API credentials
const yativo = new YativoSDK({
  apiKey: 'your-api-key',
  apiSecret: 'your-api-secret',
  baseURL: 'https://crypto-api.yativo.com', // Optional, defaults to production
});

// Or initialize without credentials (for registration/login)
const yativo = new YativoSDK();

Authentication

Yativo uses passwordless authentication. There is no password — users verify their identity via a one-time code sent to their email, an authenticator app (2FA), or a passkey.

Step 1 — Request OTP

// Sends a one-time code to the user's email
await yativo.auth.login('[email protected]');

Step 2 — Verify OTP

// Verify the email OTP — returns access token
const response = await yativo.auth.verifyOTP('123456');

// Or verify with a 2FA authenticator code if the account has 2FA enabled
const response = await yativo.auth.verify2FA('654321');

Passkey Authentication

// Get passkey challenge, complete WebAuthn ceremony client-side, then verify
const options = await yativo.auth.passkeyOptions('[email protected]');
// ... complete WebAuthn assertion client-side ...
const response = await yativo.auth.passkeyVerify(options);

Server-to-Server (API Key)

// Authenticate with API key + secret — no OTP required
const yativo = new YativoSDK({
  apiKey: process.env.YATIVO_API_KEY,
  apiSecret: process.env.YATIVO_API_SECRET,
  baseURL: 'https://crypto-api.yativo.com',
});

Using Existing Token

const yativo = new YativoSDK();
yativo.setAccessToken('your-existing-jwt-token');

Account Management

Create an Account

const { account } = await yativo.accounts.create({
  account_name: 'My Trading Account',
  account_type: 'personal',
});

console.log(account.account_id);

List Accounts

const { accounts } = await yativo.accounts.list();

accounts.forEach(account => {
  console.log(`${account.account_name}: ${account.account_id}`);
});

Asset/Wallet Management

Create a USDC on Solana Wallet

// USDC on Solana — ~2–5 second finality
const { asset } = await yativo.assets.create({
  account_id: 'account-id',
  chain: 'solana',
  ticker: 'USDC_SOL',
});

console.log(`Solana address: ${asset.wallet_address}`);

Create a USDC on XDC Wallet

// USDC on XDC — ~2 second finality, ultra-low fees
const { asset } = await yativo.assets.create({
  account_id: 'account-id',
  chain: 'xdc',
  ticker: 'USDC_XDC',
});

console.log(`XDC address: ${asset.wallet_address}`);

Create Multiple Wallets

// Create wallets for multiple chains
const { assets } = await yativo.assets.createBatch({
  account_id: 'account-id',
  chains: ['ethereum', 'bitcoin', 'polygon'],
});

assets.forEach(asset => {
  console.log(`${asset.ticker} - ${asset.address}`);
});

Get Wallet Balance

const { balance } = await yativo.assets.getBalance('asset-id');

console.log(`${balance.ticker}: ${balance.balance} ($${balance.usd_value})`);

List User Wallets

const { assets } = await yativo.assets.list({
  account_id: 'account-id', // Optional filter
});

Transactions

Send Cryptocurrency

const { transaction } = await yativo.transactions.send({
  from_asset_id: 'your-wallet-asset-id',
  to_address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
  amount: '0.1',
  chain: 'ethereum',
  ticker: 'ETH',
  priority: 'medium', // low, medium, high
});

console.log(`Transaction Hash: ${transaction.tx_hash}`);
console.log(`Status: ${transaction.status}`);

Get Gas Fee Estimate

const gasFee = await yativo.transactions.getGasFee({
  chainType: 'ethereum',
  priority: 'medium',
  amount_usd: '100',
  token_symbol: 'ETH',
});

console.log(`Gas Fee: ${gasFee.total_gas_fee} ETH ($${gasFee.total_gas_fee_usd})`);

List Transactions

const { data, pagination } = await yativo.transactions.list({
  page: 1,
  limit: 20,
  status: 'completed',
  type: 'send',
});

console.log(`Total: ${pagination.total} transactions`);

Get Transaction Details

const { transaction } = await yativo.transactions.get('transaction-id');

console.log(transaction);

Webhooks

Create a Webhook

const { webhook } = await yativo.webhooks.create({
  url: 'https://your-app.com/webhooks/yativo',
  events: ['transaction.completed', 'deposit.received', 'withdrawal.completed'],
  description: 'Production webhook',
});

console.log(`Webhook Secret: ${webhook.secret}`); // Save this securely

List Webhooks

const { webhooks } = await yativo.webhooks.list();

Verify Webhook Signature (in your webhook handler)

import { Webhooks } from '@yativo/crypto-sdk';

// In your Express/Next.js webhook handler
app.post('/webhooks/yativo', (req, res) => {
  const signature = req.headers['x-yativo-signature'];
  const payload = JSON.stringify(req.body);
  const secret = 'your-webhook-secret';

  const isValid = Webhooks.verifySignature(payload, signature, secret);

  if (!isValid) {
    return res.status(401).send('Invalid signature');
  }

  // Process webhook event
  const event = req.body;
  console.log(`Event: ${event.type}`, event.data);

  res.status(200).send('OK');
});

API Key Management

Create API Key (Requires 2FA)

const { api_key } = await yativo.apiKeys.create({
  name: 'Production API Key',
  permissions: ['read', 'write', 'withdraw'],
  expires_in_days: 90,
  two_factor_token: '123456', // Google Authenticator code
});

console.log(`API Key: ${api_key.api_key}`);
console.log(`API Secret: ${api_key.api_secret}`); // Only shown once - save securely!

List API Keys

const { api_keys } = await yativo.apiKeys.list();

api_keys.forEach(key => {
  console.log(`${key.name}: ${key.status} (Last used: ${key.last_used})`);
});

Revoke API Key

await yativo.apiKeys.revoke('key-id', '123456'); // Requires 2FA

Error Handling

All SDK methods throw errors with detailed information:

try {
  const { transaction } = await yativo.transactions.send({
    from_asset_id: 'asset-id',
    to_address: 'invalid-address',
    amount: '1.0',
    chain: 'ethereum',
    ticker: 'ETH',
  });
} catch (error) {
  console.error('Error Code:', error.code);
  console.error('Error Message:', error.error);
  console.error('Details:', error.details);
}

TypeScript Support

The SDK is written in TypeScript and includes full type definitions:

import YativoSDK, { 
  Transaction, 
  Asset, 
  Account,
  SendFundsRequest,
  YativoError
} from '@yativo/crypto-sdk';

// All types are exported and fully typed
const sdk = new YativoSDK();

// TypeScript will autocomplete and type-check everything
const result: { success: boolean; transaction: Transaction } = 
  await sdk.transactions.send({...});

Advanced Usage

Custom Base URL (for development/staging)

const yativo = new YativoSDK({
  baseURL: 'http://localhost:3000', // Your local backend
  timeout: 60000, // 60 second timeout
});

Using with API Keys (Server-Side)

const yativo = new YativoSDK({
  apiKey: process.env.YATIVO_API_KEY,
  apiSecret: process.env.YATIVO_API_SECRET,
  baseURL: 'https://crypto-api.yativo.com',
});

// No OTP needed — API keys authenticate automatically
const { assets } = await yativo.assets.list();

Token Refresh

The SDK automatically handles token refresh when the access token expires:

const yativo = new YativoSDK();

// Authenticate once (passwordless)
await yativo.auth.login('[email protected]');
await yativo.auth.verifyOTP('123456');

// SDK will automatically refresh token when needed
await yativo.transactions.list(); // Works even after token expires

Idempotency for Transactions

Transactions are automatically idempotent to prevent duplicates:

// Same transaction won't be sent twice
const tx1 = await yativo.transactions.send({
  from_asset_id: 'asset-id',
  to_address: '0x...',
  amount: '1.0',
  chain: 'ethereum',
  ticker: 'ETH',
  idempotency_key: 'unique-key-123', // Optional - auto-generated if not provided
});

// If retried with same idempotency_key, returns original transaction
const tx2 = await yativo.transactions.send({
  from_asset_id: 'asset-id',
  to_address: '0x...',
  amount: '1.0',
  chain: 'ethereum',
  ticker: 'ETH',
  idempotency_key: 'unique-key-123',
});

console.log(tx1.transaction_id === tx2.transaction_id); // true

Supported Assets

| Asset | Chain | Finality | |-------|-------|----------| | USDC_SOL | Solana | ~2–5 seconds | | USDC_XDC | XDC Network | ~2 seconds, near-zero fees | | USDC | Ethereum | ~12 seconds | | USDC_POLYGON | Polygon | ~2 seconds | | USDC_ARBITRUM | Arbitrum | ~1 second | | USDC_BASE | Base | ~2 seconds | | And more... | | |

Query available chains:

const { chains } = await yativo.assets.getChains();

chains.forEach(chain => {
  console.log(`${chain.name}: ${chain.supported_tokens.join(', ')}`);
});

Resources

License

MIT © Yativo

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.