@libertasinception/core
v0.1.0
Published
Core client library for Helix Synapse — HelixClient, TxClient, signers, queries, WebSocket subscriptions, and batch operations
Downloads
66
Maintainers
Readme
@libertasinception/core
Core client library for Helix Synapse — HelixClient, TxClient, signers, queries, WebSocket subscriptions, and batch operations
Installation
npm install @libertasinception/coreQuick Start
import { HelixClient } from "@libertasinception/core";
const client = new HelixClient({
chainId: "n1a-security",
rpcUrl: "http://localhost:26857",
});
// Query balance
const balance = await client.query.balance("n1a1addr...", "uphi");
console.log("PHI:", Number(balance.amount) / 1_000_000);
// Send tokens
import { TxClient, MemorySigner } from "@libertasinception/core";
const signer = await MemorySigner.fromMnemonic("your mnemonic...", { prefix: "n1a" });
const tx = new TxClient(client, signer);
const result = await tx.send({
recipient: "n1a1recipient...",
amount: { denom: "uphi", amount: "1000000" },
});
// Subscribe to events (AsyncIterator)
const sub = client.subscribe("transfer");
for await (const event of sub) {
console.log(event.data);
}
// Batch queries with concurrency control
const results = await batch(
addresses.map(a => () => client.query.balance(a, "uphi")),
{ concurrency: 10 }
);Features
- SHA3-512 / SHAKE-256 post-quantum cryptography
- secp256k1 signing & verification
- WebSocket subscriptions with AsyncIterator
- Circuit breaker for resilient RPC calls
- Configurable retry with exponential backoff
- Batch operations with concurrency control
- Injectable TokenStore, CacheStore, HttpTransport
- Zod schema validation at system boundaries
- ESM + CJS dual output with TypeScript declarations
API Reference
Classes
HelixClientAuthClientQueryClientChainClientRawClientTxClientStreamSubscriptionWsManagerCircuitBreakerLruCacheMemoryTokenStore
Functions
sha3_512()shake256_1024()secp256k1Sign()secp256k1Verify()secp256k1GetPublicKey()batch()withRetry()toHash512()toHash1024()
Types
HelixConfigSignerTxResultFeeEstimateSendParamsStakeParamsVoteParamsBatchResultBatchConfigTokenStoreCacheStoreBalanceResponseStatusResponse
Dependencies
@noble/hashes@noble/curvesofetchzod
Requirements
- Node.js >= 18.0.0
- TypeScript >= 5.7 (recommended)
Links
License
MIT - see LICENSE for details.
