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

@varity-labs/types

v2.0.0-alpha.1

Published

Shared TypeScript type definitions for Varity SDK - Multi-chain types, thirdweb integration types

Readme

@varity/types

TypeScript Type Definitions for Varity SDK - Comprehensive types for multi-chain Web3 development, thirdweb integration, and enterprise features.

Installation

npm install @varity/types@alpha

Quick Start

import type {
  ChainSelection,
  ChainMetadata,
  EngineTransactionParams,
  SmartWalletConfig,
  Purchase,
} from '@varity/types';

// Type-safe chain selection
const chainConfig: ChainSelection = {
  optimize: 'cost',
  requirements: {
    testnet: true,
    maxGasPrice: BigInt(1000000000)
  }
};

// Type-safe transaction parameters
const txParams: EngineTransactionParams = {
  chainId: 33529,
  to: '0x...',
  data: '0x...',
  value: 0n,
  gasLimit: 100000n
};

Features

🔗 Multi-Chain Types

  • ChainSelection - Configuration for intelligent chain selection
  • ChainMetadata - Chain information with cost/speed/security ratings
  • Chain-specific types for Varity L3, Arbitrum, Base

⚡ thirdweb Integration Types

  • Engine - Transaction management types (EngineConfig, EngineTransactionParams, EngineWebhookPayload)
  • Nebula AI - AI-powered blockchain types (GenerateContractOptions, QueryChainOptions)
  • Storage - IPFS/Arweave types (ThirdwebUploadResult, ThirdwebDownloadOptions)
  • Bridge - Cross-chain types (BridgeRoute, BridgeQuote, BridgeTransactionResult)
  • Gateway - RPC types (RPCRequestOptions, GatewayStats, WebSocketOptions)
  • x402 - Payment protocol types (PaymentEndpointConfig, PaymentStats, Subscription)

🔐 Smart Wallet Types

  • SmartWalletConfig - ERC-4337 configuration
  • GaslessConfig - Paymaster and gas sponsorship
  • WalletMetadata - Server wallet management

💳 On-Ramp Types

  • Purchase - Payment transaction types
  • OnrampWidgetProps - Widget configuration

🎯 SDK Core Types

  • VaritySDKConfig - Main SDK configuration
  • NetworkConfig - Network settings
  • TemplateConfig - Template system types
  • StorageOptions - Multi-provider storage

Key Type Exports

Multi-Chain

export interface ChainSelection {
  optimize: 'cost' | 'speed' | 'security';
  requirements?: {
    maxGasPrice?: bigint;
    minTPS?: number;
    privacy?: 'none' | 'lit' | 'fhe' | 'tee';
    testnet?: boolean;
  };
}

export interface ChainMetadata {
  chain: Chain;
  averageGasPrice: bigint;
  estimatedTPS: number;
  privacyLevel: 'none' | 'lit' | 'fhe' | 'tee';
  costRating: number;      // 1-10 (1 = cheapest)
  speedRating: number;     // 1-10 (10 = fastest)
  securityRating: number;  // 1-10 (10 = most secure)
}

thirdweb Engine

export interface EngineConfig {
  engineUrl: string;
  accessToken: string;
  backendWallet: string;
}

export interface EngineTransactionParams {
  chainId: number;
  to: string;
  data: string;
  value: bigint;
  gasLimit?: bigint;
}

export type EngineTransactionStatus =
  | 'queued'
  | 'processing'
  | 'mined'
  | 'errored'
  | 'cancelled';

export interface EngineTransactionResult {
  queueId: string;
  status: EngineTransactionStatus;
  transactionHash?: string;
  errorMessage?: string;
}

Nebula AI

export interface GenerateContractOptions {
  prompt: string;
  language: 'solidity' | 'vyper';
  framework?: 'hardhat' | 'foundry' | 'truffle';
}

export interface QueryChainOptions {
  prompt: string;
  chainId: number;
  includeTransactions?: boolean;
}

Storage

export interface ThirdwebUploadResult {
  uri: string;         // ipfs://... or ar://...
  cid: string;         // IPFS CID or Arweave transaction ID
  size: number;        // File size in bytes
  gateway: string;     // Public gateway URL
}

export interface ThirdwebDownloadOptions {
  uri: string;
  timeout?: number;
  progressCallback?: (progress: number) => void;
}

Bridge

export interface BridgeRoute {
  fromChain: Chain;
  toChain: Chain;
  token: string;
  estimatedTime: number;  // seconds
  estimatedFee: bigint;
}

export interface BridgeQuote {
  route: BridgeRoute;
  amountIn: bigint;
  amountOut: bigint;
  priceImpact: number;    // percentage
  validUntil: Date;
}

x402 Payment Protocol

export interface PaymentEndpointConfig {
  apiUrl: string;
  pricePerCall: bigint;
  paymentToken: 'USDC' | 'ETH' | 'MATIC';
  chain: Chain;
  revenueSplit?: {
    developer: number;    // 70% default
    platform: number;     // 30% default
  };
}

export interface PaymentStats {
  totalCalls: number;
  totalRevenue: bigint;
  developerEarnings: bigint;
  platformFee: bigint;
}

Smart Wallets

export interface SmartWalletConfig {
  chain: Chain;
  factoryAddress?: string;
  gasless?: {
    enabled: boolean;
    paymaster?: string | 'auto';
    maxGasLimit?: bigint;
  };
  sessionKeys?: boolean;
}

export interface WalletMetadata {
  address: string;
  label: string;
  encryptedKey: string;
  createdAt: Date;
}

On-Ramp

export interface Purchase {
  id: string;
  amount: number;
  currency: string;
  status: 'pending' | 'processing' | 'completed' | 'failed';
  timestamp: Date;
  txHash?: string;
}

export interface OnrampWidgetProps {
  walletAddress: string;
  clientId: string;
  defaultAmount?: number;
  minAmount?: number;
  maxAmount?: number;
  onComplete?: (purchase: Purchase) => void;
  onError?: (error: Error) => void;
  showHistory?: boolean;
  theme?: 'light' | 'dark';
}

USDC Decimal Handling

CRITICAL: Varity L3 uses USDC with 6 decimals (not 18 like ETH):

// USDC Constants
export const USDC_DECIMALS = 6;
export const VARITY_USDC_ADDRESS = '0x...'; // Actual USDC contract on Varity L3

// Correct USDC formatting
const amount = 1000000n;  // 1 USDC = 1,000,000 units (6 decimals)

// Helper functions
export function formatUSDC(amount: bigint): string;
export function parseUSDC(amount: string): bigint;

Usage Examples

Type-Safe Chain Selection

import type { ChainSelection, ChainMetadata } from '@varity/types';

const config: ChainSelection = {
  optimize: 'speed',
  requirements: {
    minTPS: 1000,
    testnet: false
  }
};

function selectChain(config: ChainSelection): ChainMetadata {
  // Implementation with full type safety
}

Type-Safe thirdweb Engine

import type { EngineTransactionParams, EngineTransactionResult } from '@varity/types';

const params: EngineTransactionParams = {
  chainId: 33529,
  to: contractAddress,
  data: encodedData,
  value: 0n
};

const result: EngineTransactionResult = await engine.sendTransaction(params);

Type-Safe Smart Wallet

import type { SmartWalletConfig } from '@varity/types';

const walletConfig: SmartWalletConfig = {
  chain: varityL3,
  gasless: {
    enabled: true,
    paymaster: 'auto',
    maxGasLimit: 500000n
  }
};

Version

Current version: 2.0.0-alpha.1

License

MIT - See LICENSE file

Documentation

See docs.varity.ai/packages/types for full documentation.

Support

  • Documentation: https://docs.varity.ai
  • Discord: https://discord.gg/varity
  • GitHub Issues: https://github.com/varity-labs/varity-sdk/issues
  • Email: [email protected]

Powered by Varity | Website | Twitter | Discord