
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
onchain-assistant-sdk
Advanced tools
An AI-powered blockchain interaction SDK for the browser, leveraging OpenAI's function calling and thirdweb's wallet connectors.
npm install onchain-assistant-sdk thirdweb
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);
});
See the examples/react-integration.js
file for a complete React component example that shows how to integrate the SDK with a chat interface.
The SDK currently supports these blockchain operations through natural language:
For more detailed documentation, see the SDK-README.md
file.
ISC
FAQs
AI-powered blockchain interactions for the browser
The npm package onchain-assistant-sdk receives a total of 80 weekly downloads. As such, onchain-assistant-sdk popularity was classified as not popular.
We found that onchain-assistant-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.