ts-sdk

API

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables

Interfaces

 
AdmittanceInstructions
LookupQuestion
LookupResolverConfig
OverlayBroadcastFacilitator
OverlayLookupFacilitator
SHIPBroadcasterConfig
TaggedBEEF

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Interface: AdmittanceInstructions

Instructs the Overlay Services Engine about which outputs to admit and which previous outputs to retain. Returned by a Topic Manager.

export interface AdmittanceInstructions {
    outputsToAdmit: number[];
    coinsToRetain: number[];
    coinsRemoved?: number[];
}

Property coinsRemoved

The indices of all inputs from the provided transaction which reference previously-admitted outputs, which are now considered spent and have been removed from the managed topic.

coinsRemoved?: number[]

Property coinsToRetain

The indices of all inputs from the provided transaction which spend previously-admitted outputs that should be retained for historical record-keeping.

coinsToRetain: number[]

Property outputsToAdmit

The indices of all admissible outputs into the managed topic from the provided transaction.

outputsToAdmit: number[]

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Interface: LookupQuestion

The question asked to the Overlay Services Engine when a consumer of state wishes to look up information.

export interface LookupQuestion {
    service: string;
    query: unknown;
}

Property query

The query which will be forwarded to the Lookup Service. Its type depends on that prescribed by the Lookup Service employed.

query: unknown

Property service

The identifier for a Lookup Service which the person asking the question wishes to use.

service: string

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Interface: LookupResolverConfig

Configuration options for the Lookup resolver.

export interface LookupResolverConfig {
    facilitator?: OverlayLookupFacilitator;
    slapTrackers?: string[];
    hostOverrides?: Record<string, string[]>;
    additionalHosts?: Record<string, string[]>;
}

See also: OverlayLookupFacilitator

Property additionalHosts

Map of lookup service names to arrays of hosts to use in addition to resolving via SLAP.

additionalHosts?: Record<string, string[]>

Property facilitator

The facilitator used to make requests to Overlay Services hosts.

facilitator?: OverlayLookupFacilitator

See also: OverlayLookupFacilitator

Property hostOverrides

Map of lookup service names to arrays of hosts to use in place of resolving via SLAP.

hostOverrides?: Record<string, string[]>

Property slapTrackers

The list of SLAP trackers queried to resolve Overlay Services hosts for a given lookup service.

slapTrackers?: string[]

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Interface: OverlayBroadcastFacilitator

Facilitates transaction broadcasts that return STEAK.

export interface OverlayBroadcastFacilitator {
    send: (url: string, taggedBEEF: TaggedBEEF) => Promise<STEAK>;
}

See also: STEAK, TaggedBEEF

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Interface: OverlayLookupFacilitator

Facilitates lookups to URLs that return answers.

export interface OverlayLookupFacilitator {
    lookup: (url: string, question: LookupQuestion, timeout?: number) => Promise<LookupAnswer>;
}

See also: LookupAnswer, LookupQuestion

Property lookup

Returns a lookup answer for a lookup question

lookup: (url: string, question: LookupQuestion, timeout?: number) => Promise<LookupAnswer>

See also: LookupAnswer, LookupQuestion

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Interface: SHIPBroadcasterConfig

Configuration options for the SHIP broadcaster.

export interface SHIPBroadcasterConfig {
    facilitator?: OverlayBroadcastFacilitator;
    resolver: LookupResolver;
    requireAcknowledgmentFromAllHostsForTopics?: "all" | "any" | string[];
    requireAcknowledgmentFromAnyHostForTopics?: "all" | "any" | string[];
    requireAcknowledgmentFromSpecificHostsForTopics?: Record<string, "all" | "any" | string[]>;
}

See also: LookupResolver, OverlayBroadcastFacilitator

Property facilitator

The facilitator used to make requests to Overlay Services hosts.

facilitator?: OverlayBroadcastFacilitator

See also: OverlayBroadcastFacilitator

Property requireAcknowledgmentFromAllHostsForTopics

Determines which topics (all, any, or a specific list) must be present within all STEAKs received from every host for the broadcast to be considered a success. By default, all hosts must acknowledge all topics.

requireAcknowledgmentFromAllHostsForTopics?: "all" | "any" | string[]

Property requireAcknowledgmentFromAnyHostForTopics

Determines which topics (all, any, or a specific list) must be present within STEAK received from at least one host for the broadcast to be considered a success.

requireAcknowledgmentFromAnyHostForTopics?: "all" | "any" | string[]

Property requireAcknowledgmentFromSpecificHostsForTopics

Determines a mapping whose keys are specific hosts and whose values are the topics (all, any, or a specific list) that must be present within the STEAK received by the given hosts, in order for the broadcast to be considered a success.

requireAcknowledgmentFromSpecificHostsForTopics?: Record<string, "all" | "any" | string[]>

Property resolver

The resolver used to locate suitable hosts with SHIP

resolver: LookupResolver

See also: LookupResolver

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Interface: TaggedBEEF

Tagged BEEF

export interface TaggedBEEF {
    beef: number[];
    topics: string[];
}

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Classes

 
HTTPSOverlayBroadcastFacilitator
HTTPSOverlayLookupFacilitator
LookupResolver
OverlayAdminTokenTemplate
SHIPCast

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Class: HTTPSOverlayBroadcastFacilitator

export class HTTPSOverlayBroadcastFacilitator implements OverlayBroadcastFacilitator {
    httpClient: typeof fetch;
    constructor(httpClient = fetch) 
    async send(url: string, taggedBEEF: TaggedBEEF): Promise<STEAK> 
}

See also: OverlayBroadcastFacilitator, STEAK, TaggedBEEF

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Class: HTTPSOverlayLookupFacilitator

export class HTTPSOverlayLookupFacilitator implements OverlayLookupFacilitator {
    fetchClient: typeof fetch;
    constructor(httpClient = fetch) 
    async lookup(url: string, question: LookupQuestion, timeout: number = 5000): Promise<LookupAnswer> 
}

See also: LookupAnswer, LookupQuestion, OverlayLookupFacilitator

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Class: LookupResolver

Represents an SHIP transaction broadcaster.

export default class LookupResolver {
    constructor(config?: LookupResolverConfig) 
    async query(question: LookupQuestion, timeout?: number): Promise<LookupAnswer> 
}

See also: LookupAnswer, LookupQuestion, LookupResolverConfig

Method query

Given a LookupQuestion, returns a LookupAnswer. Aggregates across multiple services and supports resiliency.

async query(question: LookupQuestion, timeout?: number): Promise<LookupAnswer> 

See also: LookupAnswer, LookupQuestion

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Class: OverlayAdminTokenTemplate

Script template enabling the creation, unlocking, and decoding of SHIP and SLAP advertisements.

export default class OverlayAdminTokenTemplate implements ScriptTemplate {
    pushDrop: PushDrop;
    static decode(script: LockingScript): {
        protocol: "SHIP" | "SLAP";
        identityKey: string;
        domain: string;
        topicOrService: string;
    } 
    constructor(wallet: WalletInterface) 
    async lock(protocol: "SHIP" | "SLAP", domain: string, topicOrService: string): Promise<LockingScript> 
    unlock(protocol: "SHIP" | "SLAP"): {
        sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
        estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
    } 
}

See also: LockingScript, PushDrop, ScriptTemplate, Transaction, UnlockingScript, WalletInterface, sign

Constructor

Constructs a new Overlay Admin template instance

constructor(wallet: WalletInterface) 

See also: WalletInterface

Argument Details

Method decode

Decodes a SHIP or SLAP advertisement from a given locking script.

static decode(script: LockingScript): {
    protocol: "SHIP" | "SLAP";
    identityKey: string;
    domain: string;
    topicOrService: string;
} 

See also: LockingScript

Returns

Decoded SHIP or SLAP advertisement

Argument Details

Method lock

Creates a new advertisement locking script

async lock(protocol: "SHIP" | "SLAP", domain: string, topicOrService: string): Promise<LockingScript> 

See also: LockingScript

Returns

Locking script comprising the advertisement token

Argument Details

Method unlock

Unlocks an advertisement token as part of a transaction.

unlock(protocol: "SHIP" | "SLAP"): {
    sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
    estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
} 

See also: Transaction, UnlockingScript, sign

Returns

Script unlocker capable of unlocking the advertisement token

Argument Details

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Class: SHIPCast

Represents a SHIP transaction broadcaster.

export default class SHIPCast implements Broadcaster {
    constructor(topics: string[], config?: SHIPBroadcasterConfig) 
    async broadcast(tx: Transaction): Promise<BroadcastResponse | BroadcastFailure> 
}

See also: BroadcastFailure, BroadcastResponse, Broadcaster, SHIPBroadcasterConfig, Transaction

Constructor

Constructs an instance of the SHIP broadcaster.

constructor(topics: string[], config?: SHIPBroadcasterConfig) 

See also: SHIPBroadcasterConfig

Argument Details

Method broadcast

Broadcasts a transaction to Overlay Services via SHIP.

async broadcast(tx: Transaction): Promise<BroadcastResponse | BroadcastFailure> 

See also: BroadcastFailure, BroadcastResponse, Transaction

Returns

A promise that resolves to either a success or failure response.

Argument Details

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Functions

Types

 
LookupAnswer
STEAK

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Type: LookupAnswer

How the Overlay Services Engine responds to a Lookup Question. It may comprise either an output list or a freeform response from the Lookup Service.

export type LookupAnswer = {
    type: "output-list";
    outputs: Array<{
        beef: number[];
        outputIndex: number;
    }>;
} | {
    type: "freeform";
    result: unknown;
}

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Type: STEAK

Submitted Transaction Execution AcKnowledgment

export type STEAK = Record<string, AdmittanceInstructions>

See also: AdmittanceInstructions

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables


Enums

Variables

Variable: DEFAULT_SLAP_TRACKERS

DEFAULT_SLAP_TRACKERS: string[] = [
    "https://overlay.babbage.systems",
    "https://overlay-example.babbage.systems",
    "https://office.babbage.systems"
]

Links: API, Interfaces, Classes, Functions, Types, Enums, Variables