@infracash/settlement-service
v0.0.2
Published
Client SDK and protocol definitions for the Infracash Settlement Service.
Readme
Infra.cash Settlement Service Client
A TypeScript client for interacting with the Infra.cash Settlement Server API. Requests are automatically authenticated and signed using the provided private key.
Features
- Automatic Request Signing: Handles signature headers (
x-public-key,x-timestamp,x-signature). - Runtime Validation: Validates API responses using
Zodschemas. - Extended JSON: Uses
@cashconnect-js/core/primitivesfor encoding and decoding payload primitives.
Quick Start
1. Initialization
import { SettlementServiceClient } from './SettlementServiceClient';
const client = new SettlementServiceClient({
privateKey: 'your-private-key-here',
// endpoint: 'https://v0.settlement.infra.cash' // Optional (default)
});API Reference
isLive()
Checks server health status.
const isAlive = await client.isLive(); // returns booleancreate(payload)
Creates a new settlement item owned by your public key.
const result = await client.create({
id: 'item-123',
// ...other SettlementItem properties
});
// Returns: { id: string }get(payload)
Retrieves a settlement item by ID.
const item = await client.get({ id: 'item-123' });
// Returns: SettlementItem with idlist(payload?)
Lists all settlement items owned by your public key.
const { items } = await client.list();
// Returns: { items: SettlementItem[] }delete(payload)
Deletes a settlement item by ID.
const response = await client.delete({ id: 'item-123' });
// Returns: { status: 'deleted' }