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

trusset-sdk

v1.0.0

Published

Professional SDK for tokenized assets and security tokens on blockchain

Readme

Trusset Framework

npm version License: MIT TypeScript React

The most advanced and developer-friendly SDK for tokenized assets and security tokens on blockchain. Built for modern web applications with TypeScript, React integration, and comprehensive error handling.

🚀 Features

  • 🔧 Simple & Powerful API - Intuitive SDK design for all skill levels
  • ⚡ React Integration - Pre-built hooks and components
  • 🛡️ Type Safety - Full TypeScript support with comprehensive types
  • 🔄 Auto-Retry Logic - Built-in retry mechanisms for failed transactions
  • 📊 Advanced Caching - Smart caching system for optimal performance
  • 🎯 Event System - Real-time blockchain event monitoring
  • 🧪 Testing Suite - Comprehensive testing utilities and CLI tools
  • 📱 Responsive Components - Ready-to-use UI components
  • 🔍 Error Handling - Advanced error handling with custom error types
  • ⚡ Multi-Network - Support for Ethereum, Polygon, BSC, and testnets

📦 Installation

npm install @trusset/framework ethers@^5.7.2
yarn add @trusset/framework ethers@^5.7.2
pnpm add @trusset/framework ethers@^5.7.2

🚀 Quick Start

Basic Setup

import { TrussetClient, Network } from '@trusset/framework';
import { ethers } from 'ethers';

const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();

const client = new TrussetClient({
  provider,
  signer,
  config: {
    defaultNetwork: Network.SEPOLIA,
    autoRetry: true,
    cacheEnabled: true
  },
  autoConnect: true
});

await client.connect();

Create Your First Asset

import { createStandardAsset, AssetType } from '@trusset/framework';

const assetConfig = createStandardAsset(
  'My Real Estate Token',
  'MRET',
  10000,
  AssetType.REAL_ESTATE,
  'https://example.com/property.jpg'
);

const { assetId, tx } = await client.createAsset(assetConfig);
console.log(`Asset created with ID: ${assetId}`);
console.log(`Transaction: ${tx.hash}`);

Transfer Shares

const shareIds = [1, 2, 3];
const recipient = '0x742d35Cc6634C0532925a3b8D36Bc57c';

const tx = await client.transferShares(
  assetId,
  shareIds,
  recipient
);

console.log(`Shares transferred: ${tx.hash}`);

🎯 React Integration

Provider Setup

import { TrussetAppProvider } from '@trusset/framework';
import { ethers } from 'ethers';

function App() {
  return (
    <TrussetAppProvider 
      autoConnect={true}
      config={{
        defaultNetwork: Network.SEPOLIA,
        cacheEnabled: true
      }}
    >
      <YourApp />
    </TrussetAppProvider>
  );
}

Using Hooks

import { 
  useTrussetContext, 
  useUserAssets, 
  useAssetCreation,
  useShareTransfer 
} from '@trusset/framework';

function Dashboard() {
  const { client, address, connected } = useTrussetContext();
  const { assets, loading, error } = useUserAssets(client, address);
  const { createAsset, loading: creating } = useAssetCreation(client);
  const { transferShares } = useShareTransfer(client);

  const handleCreateAsset = async () => {
    const config = createStandardAsset(
      'New Asset',
      'NEW',
      1000,
      AssetType.EQUITY
    );
    
    const result = await createAsset(config);
    console.log('Asset created:', result.assetId);
  };

  if (!connected) return <div>Please connect your wallet</div>;
  if (loading) return <div>Loading assets...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <div>
      <h2>Your Assets ({assets.length})</h2>
      {assets.map(asset => (
        <div key={asset.id}>
          <h3>{asset.name} ({asset.symbol})</h3>
          <p>Supply: {asset.totalSupply}</p>
          <p>Type: {getAssetTypeName(asset.assetType)}</p>
        </div>
      ))}
      
      <button onClick={handleCreateAsset} disabled={creating}>
        {creating ? 'Creating...' : 'Create Asset'}
      </button>
    </div>
  );
}

Pre-built Components

import { 
  AssetCard, 
  SharesList, 
  AssetCreationForm,
  WalletConnectButton 
} from '@trusset/framework';

function AssetManagement() {
  return (
    <div>
      <WalletConnectButton />
      
      <AssetCreationForm
        onSubmit={async (config) => {
          const result = await client.createAsset(config);
          console.log('Created asset:', result.assetId);
        }}
      />
      
      <SharesList
        assetId={123}
        owner={address}
        onTransfer={(shareIds) => console.log('Transfer:', shareIds)}
        onBurn={(shareIds) => console.log('Burn:', shareIds)}
      />
    </div>
  );
}

🏗️ Advanced Features

Event Monitoring

import { useEventSubscription } from '@trusset/framework';

function EventMonitor() {
  const { events } = useEventSubscription(client, { 
    assetId: 123 
  });

  return (
    <div>
      <h3>Recent Events</h3>
      {events.map((event, index) => (
        <div key={index}>
          {event.event}: {JSON.stringify(event.args)}
        </div>
      ))}
    </div>
  );
}

Custom Asset Types

import { createComplianceAsset } from '@trusset/framework';

const complianceAsset = createComplianceAsset(
  'Regulated Security Token',
  'RST',
  50000,
  AssetType.EQUITY,
  '0x...', // authority address
  {
    kyc: true,
    whitelist: true,
    blacklist: true,
    freeze: true
  }
);

const { assetId } = await client.createAsset(complianceAsset);

Error Handling

import { 
  TrussetError, 
  ContractError, 
  ValidationError,
  NetworkError 
} from '@trusset/framework';

try {
  await client.createAsset(invalidConfig);
} catch (error) {
  if (error instanceof ValidationError) {
    console.error('Validation failed:', error.message);
    console.error('Field:', error.field);
  } else if (error instanceof ContractError) {
    console.error('Contract error:', error.message);
    console.error('Contract:', error.contractName);
    console.error('Method:', error.method);
  } else if (error instanceof NetworkError) {
    console.error('Network error:', error.message);
    console.error('Chain ID:', error.chainId);
  }
}

🧪 Testing

CLI Testing Suite

# Initialize test environment
npx trusset init my-test-project

# Run integration tests
npx trusset test --rpc http://localhost:8545 --wallets 5

# Deploy contracts
npx trusset deploy --network sepolia --key YOUR_PRIVATE_KEY

Programmatic Testing

import { TrussetTestSuite, createMockAssets } from '@trusset/framework';

const testSuite = new TrussetTestSuite('http://localhost:8545');

describe('Asset Management', () => {
  beforeAll(async () => {
    await testSuite.setup(3); // Create 3 test wallets
  });

  afterAll(async () => {
    await testSuite.cleanup();
  });

  test('should create and transfer assets', async () => {
    const { assetId } = await testSuite.createTestAsset();
    
    await testSuite.transferTestShares(
      assetId,
      0, // from wallet index
      1, // to wallet index
      5  // number of shares
    );

    const shares = await testSuite.getClient(1)
      .getUserShares(assetId, testSuite.getWallet(1).address);
    
    expect(shares.length).toBe(5);
  });
});

🔧 Configuration

Network Configuration

import { Network, TrussetConfig } from '@trusset/framework';

const config: TrussetConfig = {
  networks: {
    [Network.ETHEREUM]: {
      chainId: 1,
      name: 'Ethereum Mainnet',
      rpcUrl: 'https://eth.llamarpc.com',
      contracts: {
        // ... contract addresses
      }
    },
    [Network.POLYGON]: {
      chainId: 137,
      name: 'Polygon',
      rpcUrl: 'https://polygon.llamarpc.com',
      contracts: {
        // ... contract addresses
      }
    }
  },
  defaultNetwork: Network.ETHEREUM,
  autoRetry: true,
  retryAttempts: 3,
  retryDelay: 1000,
  cacheEnabled: true,
  cacheTTL: 60000,
  eventPollingInterval: 5000
};

Custom Provider Integration

import { createMockProvider } from '@trusset/framework';

// For testing
const mockProvider = createMockProvider('http://localhost:8545');

// With custom RPC
const customProvider = new ethers.providers.JsonRpcProvider('YOUR_RPC_URL');

const client = new TrussetClient({
  provider: customProvider,
  config: customConfig
});

📚 API Reference

Core Classes

  • TrussetClient - Main SDK client for blockchain interactions
  • TrussetCache - Advanced caching system
  • TrussetEvents - Event monitoring and subscription system
  • TrussetTestSuite - Comprehensive testing utilities

React Hooks

  • useTrussetContext() - Access SDK context and connection state
  • useAsset(assetId) - Get asset details with caching
  • useUserAssets(address) - Get user's assets
  • useUserShares(assetId, owner) - Get user's shares for an asset
  • useTransaction() - Handle transaction states
  • useAssetCreation() - Create new assets
  • useShareTransfer() - Transfer asset shares
  • useEventSubscription() - Subscribe to blockchain events

Utility Functions

  • createStandardAsset() - Create basic asset configuration
  • createDecentralizedAsset() - Create decentralized asset
  • createComplianceAsset() - Create compliance-enabled asset
  • formatAddress() - Format Ethereum addresses
  • formatTokenAmount() - Format token amounts
  • validateAssetConfig() - Validate asset configurations

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

git clone https://github.com/trusset/framework.git
cd framework
npm install
npm run build
npm run test

Running Examples

npm run dev

📄 License

MIT License - see the LICENSE file for details.

🔗 Links

🚨 Security

For security concerns, please email [email protected] instead of using public issues.

📈 Roadmap

  • [ ] Layer 2 support (Arbitrum, Optimism)
  • [ ] Mobile SDK (React Native)
  • [ ] Advanced analytics dashboard
  • [ ] Cross-chain bridge integration
  • [ ] DeFi protocol integrations
  • [ ] Governance token features
  • [ ] Advanced compliance tools
  • [ ] Mobile wallet integration

Built with ❤️ by the Trusset Team