@totemsdk/node
v1.0.9
Published
Totem SDK for Node.js applications
Maintainers
Readme
@totemsdk/node
Core SDK wired for Node.js — server-side wallet operations.
Re-exports everything from @totemsdk/core and adds MinimaClient, MinimaWallet, and MinimaProvider for running a wallet on a server or in a bot/agent.
Install
npm install @totemsdk/node @noble/hashesRequires Node.js ≥ 16. Dependencies: node-fetch, ws.
What's inside
| Export | What it does |
|--------|-------------|
| MinimaClient | WebSocket/HTTP client to a running Minima node |
| MinimaWallet | Server-side wallet (sign, derive addresses, send transactions) |
| MinimaProvider | Node.js ChainStateProvider implementation |
| Everything from @totemsdk/core | Re-exported for convenience |
Usage
Connect to a node and sign
import { MinimaClient, MinimaWallet } from '@totemsdk/node';
const client = new MinimaClient({ nodeUrl: 'http://localhost:9005' });
const wallet = new MinimaWallet({ client });
// Initialize a fresh wallet (or pass a 24-word phrase to restore)
const seedPhrase = await wallet.initialize();
console.log('Seed phrase (store securely!):', seedPhrase);
// Derive an address
const account = await wallet.createAccount('main');
console.log('Address:', account.address);
// Sign arbitrary data
const sig = await wallet.signData(Buffer.from('hello world'), account.address);
console.log('Signature:', Buffer.from(sig).toString('hex'));Use as a chain provider
import { MinimaClient, MinimaProvider } from '@totemsdk/node';
const client = new MinimaClient({ nodeUrl: 'http://localhost:9005' });
const provider = new MinimaProvider(client);
const tip = await provider.getChainTip();
const coins = await provider.getCoins({ address: 'Mx...' });Send a transaction
const result = await wallet.send({
to: 'MxDEF456...',
amount: '10',
tokenid: '0x00',
});
console.log('TxPoW ID:', result.txpowid);See also
@totemsdk/core— cryptographic primitives (re-exported by this package)@totemsdk/chain-provider— provider interface and composites@totemsdk/txpow— proof-of-work mining@totemsdk/tx-builder— raw transaction construction
