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

view0x-sdk

v1.0.0

Published

Official JavaScript/TypeScript SDK for view0x - Smart Contract Security Analysis Platform

Readme

view0x JavaScript/TypeScript SDK

Official JavaScript/TypeScript SDK for view0x - Smart Contract Security Analysis Platform.

Installation

npm install @view0x/sdk
# or
yarn add @view0x/sdk
# or
pnpm add @view0x/sdk

Quick Start

import { View0xSDK } from '@view0x/sdk';

// Initialize the SDK with your API key
const client = new View0xSDK({
  apiKey: 'your-api-key-here',
  // baseURL: 'https://api.view0x.com', // Optional: custom API URL
  // timeout: 30000, // Optional: request timeout in ms
});

// Create an analysis
const analysis = await client.createAnalysis({
  contractCode: `
    pragma solidity ^0.8.0;
    contract MyContract {
      // Your contract code
    }
  `,
  contractName: 'MyContract',
});

console.log('Analysis ID:', analysis.id);
console.log('Status:', analysis.status);

// Get analysis results
const result = await client.getAnalysis(analysis.id);
console.log('Vulnerabilities found:', result.vulnerabilities?.length);

Features

  • Full TypeScript support with type definitions
  • Promise-based API
  • Automatic authentication handling
  • Comprehensive error handling
  • Support for all view0x API endpoints
  • Repository analysis (GitHub/GitLab)
  • Webhook management
  • Analytics and reporting
  • Zero hardcoded values - fully configurable

API Reference

Authentication

// Login
const { token, user } = await client.login({
  email: '[email protected]',
  password: 'password',
});

// Register
const { token, user } = await client.register({
  name: 'John Doe',
  email: '[email protected]',
  password: 'securepassword',
  company: 'My Company', // optional
});

// Get current user
const user = await client.getCurrentUser();

Analysis

// Create analysis
const analysis = await client.createAnalysis({
  contractCode: solidityCode,
  contractName: 'MyContract', // optional
  options: {}, // optional
});

// Get analysis by ID
const analysis = await client.getAnalysis('analysis-id');

// Get analysis history with pagination
const history = await client.getAnalysisHistory({
  page: 1,
  limit: 10,
  search: 'MyContract', // optional
  sortBy: 'createdAt', // optional
  sortOrder: 'DESC', // optional
});

// Generate report
const pdfBlob = await client.generateReport('analysis-id', 'pdf');
// Save to file or download

// Share analysis
const { shareToken, shareUrl } = await client.shareAnalysis('analysis-id');

// Revoke share
await client.revokeShare('analysis-id');

Repository Analysis

// Analyze GitHub repository
const analyses = await client.analyzeGitHubRepository({
  repositoryUrl: 'https://github.com/user/repo',
  branch: 'main', // optional
  token: 'github-token', // optional, for private repos
});

// Analyze GitLab repository
const analyses = await client.analyzeGitLabRepository({
  repositoryUrl: 'https://gitlab.com/user/repo',
  branch: 'main', // optional
  token: 'gitlab-token', // optional, for private repos
});

// Auto-detect platform
const analyses = await client.analyzeRepository({
  repositoryUrl: 'https://github.com/user/repo',
});

Webhooks

// Create webhook
const webhook = await client.createWebhook(
  'https://myapp.com/webhook',
  ['analysis.completed', 'analysis.failed'],
  'webhook-secret' // optional
);

// Get all webhooks
const webhooks = await client.getWebhooks();

// Update webhook
const updated = await client.updateWebhook(
  'webhook-id',
  'https://myapp.com/new-webhook',
  ['analysis.completed'],
  'new-secret',
  true // isActive
);

// Delete webhook
await client.deleteWebhook('webhook-id');

// Test webhook
await client.testWebhook('webhook-id');

Analytics

// Get analytics dashboard
const dashboard = await client.getAnalyticsDashboard({
  dateRange: '7d', // optional: 7d, 30d, 90d
  startDate: '2024-01-01', // optional
  endDate: '2024-01-31', // optional
});

// Get endpoint-specific analytics
const endpointStats = await client.getEndpointAnalytics('/api/analysis');

// Export analytics
const csvBlob = await client.exportAnalytics('csv');
const jsonBlob = await client.exportAnalytics('json');

Error Handling

try {
  const analysis = await client.createAnalysis({
    contractCode: code,
  });
} catch (error) {
  console.error('Analysis failed:', error.message);
}

Environment Configuration

The SDK respects environment variables:

# Use custom API URL
export VIEW0X_API_URL=https://api.view0x.com

# Set default timeout
export VIEW0X_TIMEOUT=30000

TypeScript Support

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

import { View0xSDK, Analysis, Vulnerability } from '@view0x/sdk';

const client = new View0xSDK({ apiKey: 'key' });

const analysis: Analysis = await client.getAnalysis('id');
const vulnerabilities: Vulnerability[] = analysis.vulnerabilities || [];

Contributing

See CONTRIBUTING.md

License

MIT © Nsisong Labs

Links