Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 988 Bytes

File metadata and controls

34 lines (26 loc) · 988 Bytes

JavaScript / TypeScript SDK

A client library for interacting with the stellar-router contracts from JS/TS.

Installation

npm install stellar-router-sdk

Quick Start

import { RouterClient } from "stellar-router-sdk";

const client = new RouterClient({ network: "testnet", coreContractId: "C...", keypair: Keypair.fromSecret("S..."), });

const address = await client.resolve("oracle"); await client.registerRoute("oracle", "C...", { description: "Price feed" });

API

  • resolve(name) → Promise
  • registerRoute(name, address, metadata?) → Promise
  • updateRoute(name, newAddress) → Promise
  • removeRoute(name) → Promise
  • setRoutePaused(name, paused) → Promise
  • setPaused(paused) → Promise
  • getRoute(name) → Promise<RouteEntry | null>
  • totalRouted() → Promise

Error Handling

All methods throw RouterSdkError with a .code (e.g. "RouteNotFound") on failure.

Publishing

npm version patch && npm publish