@agent-society/shared

v1.0.1

Published

Shared TypeScript types and utilities for Agent Runtime

Readme

@agent-society/shared

npm License: MIT

Shared ILP types and OER codec for the agent-runtime monorepo.

Install

npm install @agent-society/shared

Usage

import {
  ILPPreparePacket,
  PacketType,
  serializePacket,
  deserializePacket,
} from '@agent-society/shared';

// Create an ILP Prepare packet
const prepare: ILPPreparePacket = {
  type: PacketType.Prepare,
  amount: BigInt(1000),
  expiresAt: new Date(Date.now() + 30000),
  executionCondition: Buffer.alloc(32),
  destination: 'g.example.receiver',
  data: Buffer.alloc(0),
};

// Serialize to binary (OER encoding per RFC-0030)
const encoded: Buffer = serializePacket(prepare);

// Deserialize back
const decoded = deserializePacket(encoded);

Exports

ILP Packets: ILPPreparePacket, ILPFulfillPacket, ILPRejectPacket, ILPPacket, PacketType, ILPErrorCode

BTP Types: BTP message and frame types for bilateral transfer protocol

Routing: RoutingTableEntry and routing table structures

Telemetry: TelemetryEvent, settlement events, payment channel events

Payment Channels: ChannelState, ChannelStatus, BalanceProof

Validation: isValidILPAddress, isPreparePacket, isFulfillPacket, isRejectPacket

OER Codec: serializePacket, deserializePacket, OER primitives

License

MIT — see LICENSE.