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

onchain-assistant-sdk

v0.3.1

Published

AI-powered blockchain interactions for the browser

Readme

OnChain Assistant SDK

An AI-powered blockchain interaction SDK for the browser, leveraging OpenAI's function calling and thirdweb's wallet connectors.

Features

  • 🧠 Natural language processing of user queries
  • 🔗 Seamless blockchain interactions via thirdweb
  • 🛠️ Smart contract read/write operations
  • 💰 Token balances and transfers
  • 📊 Real-time cryptocurrency market data via CoinGecko
  • 📈 Token price lookups and market statistics
  • 🔍 Token search functionality
  • 🔐 Secure wallet integration (no private keys required)
  • 📝 Advanced transaction management
  • 📘 Full TypeScript support with declaration files

Installation

npm install onchain-assistant-sdk thirdweb

Requirements

  • OpenAI API key
  • thirdweb SDK v5
  • A browser environment

Quick Start

import { createOnChainAssistant } from 'onchain-assistant-sdk';
import { createThirdwebClient } from 'thirdweb';
import { useActiveAccount, useActiveWallet } from 'thirdweb/react';

// In your React component
function MyComponent() {
  // Get wallet from thirdweb hooks
  const account = useActiveAccount();
  const wallet = useActiveWallet();
  const address = account?.address;
  
  // Initialize thirdweb client
  const thirdwebClient = createThirdwebClient({
    clientId: "your-thirdweb-client-id"
  });

  // Initialize the OnChain Assistant SDK with wallet from hooks
  const assistant = createOnChainAssistant({
    openAIApiKey: 'your-openai-api-key',
    thirdwebClient,
    connectedWallet: wallet,     // Pass the wallet from hooks
    connectedAddress: address,   // Pass the address from hooks
    coinGeckoApiKey: 'your-coingecko-api-key', // Optional
    enableMarketData: true,      // Enable market data tools (default: true)
    aiOptions: {
      model: 'gpt-4o-mini',
      temperature: 0.7
    }
  });
  
  // Rest of your component...
}

// Process a user query
const handleUserQuery = async (userInput) => {
  if (!assistant.isWalletConnected()) {
    console.log('Please connect your wallet first');
    return;
  }
  
  try {
    const result = await assistant.processUserQuery(userInput);
    console.log('AI Response:', result.response);
    
    if (result.transaction) {
      console.log('Transaction:', result.transaction);
    }
  } catch (error) {
    console.error('Error:', error);
  }
};

// Subscribe to events
assistant.subscribe('transaction:succeeded', (data) => {
  console.log('Transaction successful:', data);
});

React Integration Example

See the examples/react-integration.js file for a complete React component example that shows how to integrate the SDK with a chat interface.

Available Tools

The SDK currently supports these blockchain operations through natural language:

  • Getting wallet balances (native tokens)
  • Getting token balances (ERC20)
  • Reading smart contract data
  • Writing to smart contracts
  • Viewing transaction information

Documentation

For more detailed documentation, see the SDK-README.md file.

License

ISC