JavaScript SDK

The official Elydora SDK for Node.js and TypeScript applications. Full TypeScript type definitions included.

Installation

bash
npm install @elydora/sdk

Quick Start

typescript
import { ElydoraClient } from '@elydora/sdk';

const client = new ElydoraClient({
  orgId: 'org_acme',
  agentId: 'agent_underwriter',
  privateKey: process.env.ELYDORA_KEY,
});

Register an Agent

typescript
const agent = await client.registerAgent({
  agentId: 'agent_underwriter',
  publicKey: publicKeyBase64,
  label: 'Loan Underwriter v2',
});

console.log(agent.status); // 'active'

Submit an Operation

The SDK automatically handles signing, chain-hashing, nonce generation, and TTL computation.

typescript
const record = client.createOperation({
  type: 'loan.approve',
  payload: { loanId: 'LN-2026-001', amount: 50000 },
});

const receipt = await client.submitOperation(record);

console.log(receipt.ear.receipt_id);  // 'rcpt_xyz789'
console.log(receipt.ear.seq_no);      // 42
console.log(receipt.ech.chain_hash);  // 'sha256:...'

Verify an Operation

typescript
const result = await client.verifyOperation(operationId);

console.log(result.valid);                // true
console.log(result.checks.signature);     // true
console.log(result.checks.chain_hash);    // true

Query Audit Log

typescript
const results = await client.audit.query({
  agentId: 'agent_underwriter',
  operationType: 'loan.approve',
  startTime: '2026-02-01T00:00:00Z',
  endTime: '2026-02-28T23:59:59Z',
  limit: 50,
});

for (const record of results.data) {
  console.log(record.operation_id, record.issued_at);
}

Error Handling

typescript
import { ElydoraError } from '@elydora/sdk';

try {
  await client.submitOperation(record);
} catch (err) {
  if (err instanceof ElydoraError) {
    console.error(err.code);    // 'AGENT_FROZEN'
    console.error(err.message); // 'Agent is frozen...'
  }
}

Configuration Options