npm.io
1.9.1 • Published 3d ago

@webacy-xyz/sdk-core

Licence
MIT
Version
1.9.1
Deps
0
Size
246 kB
Vulns
0
Weekly
0
Stars
4

@webacy-xyz/sdk-core

Core utilities and shared internals for Webacy SDK packages. This package is automatically installed as a dependency of @webacy-xyz/sdk-trading and @webacy-xyz/sdk-threat.

Installation

This package is typically not installed directly. Instead, install one of the SDK packages:

npm install @webacy-xyz/sdk           # Full SDK
npm install @webacy-xyz/sdk-trading   # Trading analysis only
npm install @webacy-xyz/sdk-threat    # Threat analysis only

What's Included

Chain Support
import { Chain, isEvmChain, CHAIN_IDS, CHAIN_NAMES } from '@webacy-xyz/sdk-core';

// Check if a chain is EVM-compatible
if (isEvmChain(Chain.ETH)) {
  console.log('Using EVM chain');
}

// Get chain metadata
console.log(CHAIN_NAMES[Chain.SOL]); // "Solana"
console.log(CHAIN_IDS[Chain.ETH]);   // 1
Error Classes
import {
  WebacyError,
  AuthenticationError,
  RateLimitError,
  ValidationError,
  NotFoundError,
  NetworkError,
} from '@webacy-xyz/sdk-core';

try {
  await client.addresses.analyze('0x...');
} catch (error) {
  if (error instanceof RateLimitError) {
    console.log(`Retry after ${error.retryAfter} seconds`);
  }
}
Type Definitions
import type {
  RiskTag,
  RiskModule,
  RiskCategory,
  TokenMetadata,
  OwnershipDistribution,
} from '@webacy-xyz/sdk-core';
Address Validation
import {
  isValidAddress,
  isValidEvmAddress,
  isValidSolanaAddress,
} from '@webacy-xyz/sdk-core';

isValidAddress('0x742d35Cc...', Chain.ETH); // true
isValidSolanaAddress('EPjFWdd5Aufq...'); // true

Supported Chains

Chain Code EVM
Ethereum eth Yes
Base base Yes
BSC bsc Yes
Polygon pol Yes
Arbitrum arb Yes
Optimism opt Yes
Solana sol No
TON ton No
Sui sui No
Stellar stellar No
Bitcoin btc No

License

MIT

Keywords