Helper module for Nano x402 Clients, Resource Servers and Facilitators
helper is an early-stage TypeScript project in the AI payments / x402 ecosystem, focused on 402, ai-agents, nano, nanocurrency. It currently has 1 GitHub stars and 0 forks, and sits alongside related tools like exact, typescript-common, facilitator, tdm-integration-kit, TDM-Agent-Integration-Kit, nano-currency-mcp-server.
Helper module for Nano x402 Clients, Resource Servers and Facilitators
Used by scheme implementations on nano:* family, e.g. exact.
account_info)process)TypeScript
npm install @x402nano/helper
TypeScript
// ** Usage of Helper module within a Facilitator that supports the exact scheme on nano:* family **
import { x402Facilitator } from '@x402/core/facilitator'
import { ExactNanoScheme } from '@x402nano/exact/facilitator'
import { Helper } from '@x402nano/helper' // Helper
// Create x402 core Facilitator instance
const facilitator = new x402Facilitator()
// Create instance of Helper module and configure with Nano RPC endpoint
const helper = new Helper({
NANO_RPC_URL: 'https://example-nano-rpc-endpoint.com/rpc',
})
// Pass Helper module instance into scheme instance.
// Scheme code can now access the Nano network through use
// of the configured Helper module instance.
const exactNanoScheme = new ExactNanoScheme(helper)
// Register the scheme loaded with Helper module instance into the Facilitator instance
facilitator.register('nano:mainnet', exactNanoScheme)
💡 Detailed examples of usage can be viewed in the /examples/ folder for the x402nano exact scheme.
| Method | Description |
|---|---|
generateSendBlock({ payTo, amount }) |
Generates Nano send blocks (including Proof-of-Work generation) |
getAccountInfo({ account }) |
Calls account_info RPC |
processBlock({ block }) |
Publishes block via process RPC |
setNanoRpcUrl(url) |
Set Nano RPC endpoint |
setNanoAccountPrivateKey(privateKey) |
Sets the Nano account private key to use during block generation. |
clearNanoAccountPrivateKey() |
Clear Nano account private key (security / session cleanup) |
setNanoWorkGenerationUrl(url) |
Change Proof-of-Work generation endpoint |
setCustomWorkGenerator(workGenerator) |
Set a custom Proof-of-Work generator |
onBeforeWorkGeneration(hook) |
Register hook called before Proof-of-Work generation starts |
onAfterWorkGeneration(hook) |
Register hook called after Proof-of-Work generation finishes |
getConfig() |
Returns the current configuration for Helper instance (minus NANO_ACCOUNT_PRIVATE_KEY). |
TypeScript
Pass configuration values directly to the constructor:
const helper = new Helper({
NANO_RPC_URL: 'https://...' // Required
NANO_WORK_GENERATION_URL: 'https://...' // Optional, defaults to NANO_RPC_URL
NANO_ACCOUNT_PRIVATE_KEY: 'FEEDFACE1234...' // Required if using generateSendBlock
})
Or you can use the following setters:
const helper = new Helper()
helper.setNanoRpcUrl('https://example-nano-rpc-endpoint.com/rpc')
helper.setNanoWorkGenerationUrl('https://example-nano-work-generation-endpoint.com/rpc')
helper.setNanoAccountPrivateKey('FEEDFACE1234...')
The setCustomWorkGenerator setter takes a function as a parameter. This function must accept as a parameter the hash you wish to generate Proof-of-Work for, and must return the work computed.
helper.setCustomWorkGenerator(function (hash: string): string {
const work = // ...perform work generation using "hash" parameter here...
return work
})
Errors include one of the following codes, as well as more descriptive debugging information.
| Error | Description |
|---|---|
error_config |
Incorrect configuration value |
error_block_generation |
Error during block generation |
error_nano_rpc_connection |
Error during Nano RPC communication |
error_nano_work_generation |
Error during Proof-of-Work generation |
error_insufficient_nano_balance |
Insufficient balance to create a send block |
TypeScript
helper/src/typescript/
├── index.ts # Main code for Helper
└── common.ts # Shared constants used by Helper code and tests
helper/src/typescript/test
└── index.test.ts # Test script (run with `npm run test`)
TypeScript
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm run test
We welcome developers to submit implementations of the Helper module in other languages e.g. Python, Go, etc...
Join the x402 Nano Discord for coordination and discussion!
clearNanoAccountPrivateKey to clear private key in long-running processesexact scheme for fixed-amount Nano (XNO) payments over x402 protocolMIT
Implementation of exact scheme for fixed-amount Nano (XNO) payments over x402 protocol
Typescript type definitions and Zod schemas for x402 payment protocol Nano implementation
x402 Protocol Facilitator for the Nano network
Developer integration tools for adding TDM payments to AI agents, apps, and workflows. CLI, MCP server, and copy-paste examples
Developer integration tools for adding TDM payments to AI agents, apps, and workflows. CLI, MCP server, and copy-paste examples
Send Nano currency from AI agents/LLMs
Your AI trading terminal assistant for US stocks, commodities, forex, and crypto.
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The living ecosystem where AI agents complete tasks through workflow loops, improve through iterative execution, are evaluated by mentor agents or humans in the loop, and turn completed work into reusable work experience and data to improve future agents.
The living ecosystem where AI agents complete tasks through workflow loops, improve through iterative execution, are evaluated by mentor agents or humans in the loop, and turn completed work into reusable work experience and data to improve future agents.
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.