@coinsensors/shared

v0.1.3

Published

Shared types, constants, and utilities for the CoinSensors platform

Readme

@coinsensors/shared

Shared types, constants, and utilities for the CoinSensors platform. Used internally by @coinsensors/sdk — you typically don't need to install this directly.

Installation

npm install @coinsensors/shared

If you're using @coinsensors/sdk, these types are already re-exported for you.

Types

Token Analysis

import type {
  TokenInfo,       // Base token metadata (chain, address, name, symbol, authorities)
  TokenScore,      // Trust score (0-100) with 5 component scores
  TokenDetail,     // Full analysis: info + score + checks + AI narrative + market data
  CheckResult,     // Individual check result (passed, score, details)
  DeployerProfile, // Deployer wallet risk data
  AiNarrative,     // AI-generated risk summary
  MarketData,      // Market cap, liquidity, volume, token age
  TokenTier,       // 'blue_chip' | 'established' | 'mid_cap' | 'new'
} from '@coinsensors/shared';

API Contracts

import type {
  ScanRequest,
  ScanResponse,
  PaginatedResponse,
  TokenListItem,
  TokenListQuery,
  StatsResponse,
  HealthResponse,
} from '@coinsensors/shared';

Wallet Scanning

import type {
  WalletTokenHolding,
  WalletTokenResult,
  PortfolioSummary,
  WalletScanResponse,
  WalletScanSSEMessage,
} from '@coinsensors/shared';

Chain Types

import type { Chain, EvmChain, ChainConfig } from '@coinsensors/shared';
import { isEvmChain, CHAIN_CONFIG, ALL_CHAINS } from '@coinsensors/shared';

Constants

Scoring Weights

import { SCORING_WEIGHTS, MAX_SCORE, RISK_TIERS, getRiskTier } from '@coinsensors/shared';

// SCORING_WEIGHTS = { MINT_AUTHORITY: 25, FREEZE_AUTHORITY: 20, TOP_HOLDER_CONCENTRATION: 20, DEPLOYER_HISTORY: 15, LP_LOCK: 20 }
// RISK_TIERS = { LOW: { min: 70, max: 100 }, MODERATE: { min: 40, max: 69 }, HIGH: { min: 0, max: 39 } }

getRiskTier(85); // { min: 70, max: 100, label: 'Low Risk', color: 'green' }

Solana Program IDs

import { PROGRAM_IDS } from '@coinsensors/shared';

// PROGRAM_IDS.PUMP_FUN, PROGRAM_IDS.RAYDIUM_AMM, PROGRAM_IDS.TOKEN_PROGRAM, etc.

Utilities

Chain Detection

import { detectChainFromAddress } from '@coinsensors/shared';

detectChainFromAddress('So11111111111111111111111111111111111111112'); // 'solana'
detectChainFromAddress('0xdAC17F958D2ee523a2206206994597C13D831ec7'); // 'ethereum'
detectChainFromAddress('invalid'); // null

Block Explorer URLs

import { getExplorerUrl, getExplorerName } from '@coinsensors/shared';

getExplorerUrl('solana', 'token', 'So1111...');  // 'https://solscan.io/token/So1111...'
getExplorerUrl('ethereum', 'token', '0xdAC1...'); // 'https://etherscan.io/token/0xdAC1...'
getExplorerName('solana'); // 'Solscan'

License

MIT