Registry / payments / kaspa-rpc-client

kaspa-rpc-client

JSON →
library1.1.8jsnpmunverified

A TypeScript-based gRPC client for the Kaspa cryptocurrency network (v1.1.8). Provides auto-generated typed methods for RPC calls, connection failover across multiple servers, and experimental wallet/account management via WASM. Requires Node >=16.14. Supports both Node.js and browser (CodeSandbox demo). Alternative to direct gRPC usage with built-in failover and typed interfaces.

npm install kaspa-rpc-client
INSTALL
IMPORT
SIG · KASPA-RPC-CLIENT
K
kaspa-rpc-client
paymentsjavascriptv1.1.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ClientWrapper
import { ClientWrapper } from 'kaspa-rpc-client'
const ClientWrapper = require('kaspa-rpc-client')
Use ESM import for TypeScript projects; CJS require works but may lack types.
Client
import { Client } from 'kaspa-rpc-client'
import Client from 'kaspa-rpc-client'
Client is a named export, not default.
KaspaWallet
import { KaspaWallet } from 'kaspa-rpc-client'
Wallet API is experimental; may change in future versions.

Shows how to initialize ClientWrapper with a host, get a client, and make basic RPC calls (getBlock, getBalanceByAddress).

import { ClientWrapper } from 'kaspa-rpc-client'; async function main() { const wrapper = new ClientWrapper({ hosts: ['seeder2.kaspad.net:16110'], verbose: true, }); await wrapper.initialize(); const client = await wrapper.getClient(); const block = await client.getBlock({ hash: '6ef1913d30316304254aa5ce6c34ff9dd2b519231bb80194d4b5e5449412e924', includeTransactions: true, }); console.log('Block:', block); const balance = await client.getBalanceByAddress({ address: 'kaspa:qrrzeucwfetuty3qserqydw4z4ax9unxd23zwp7tndvg7cs3ls8dvwldeayv5', }); console.log('Balance:', balance); } main().catch(console.error);
Debug
Known issues
deprecatedWallet APIs in v1.x are preview/experimental and not production-ready.
fix
Use for testing only; avoid in production until stable release.
affects: 1.0.0 - 1.1.8
breakingv1.0.0 changed initialization to require explicit wrapper initialization with separate client pool.
fix
Migrate from direct Client usage to ClientWrapper with initialize() call.
affects: <1.0.0
gotchaESM-only import paths; CommonJS require may not resolve types correctly.
fix
Use TypeScript with ES module resolution or set module to NodeNext.
affects: >=1.0.0
gotchaHost strings must include port (e.g., host:port). Missing port may cause connection failure.
fix
Always specify port in hosts array.
affects: >=1.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM
Using require() with ESM-only package.
fix
Use import instead of require(), or set type: module in package.json.
Error: No host provided
Empty or missing hosts array in ClientWrapper constructor.
fix
Provide at least one host string (e.g., ['seeder2.kaspad.net:16110']).
TypeError: wrapper.initialize is not a function
Using an older version (<1.0.0) without initialize method.
fix
Upgrade to v1.0.0+ and call wrapper.initialize() before getClient().
Upgrade
Version history
1.1.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Resources
kaspa-rpc-client — npm install kaspa-rpc-client · libregistry