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.
Property coinsToRetain
The indices of all inputs from the provided transaction which spend previously-admitted outputs that should be retained for historical record-keeping.
Property outputsToAdmit
The indices of all admissible outputs into the managed topic from the provided transaction.
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.
Property query
The query which will be forwarded to the Lookup Service. Its type depends on that prescribed by the Lookup Service employed.
Property service
The identifier for a Lookup Service which the person asking the question wishes to use.
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Interface: LookupResolverConfig
Configuration options for the Lookup resolver.
export interface LookupResolverConfig {
networkPreset?: "mainnet" | "testnet" | "local";
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.
Property facilitator
The facilitator used to make requests to Overlay Services hosts.
See also: OverlayLookupFacilitatorProperty hostOverrides
Map of lookup service names to arrays of hosts to use in place of resolving via SLAP.
Property networkPreset
The network preset to use, unless other options override it. - mainnet: use mainnet SLAP trackers and HTTPS facilitator - testnet: use testnet SLAP trackers and HTTPS facilitator - local: directly query from localhost:8080 and a facilitator that permits plain HTTP
Property slapTrackers
The list of SLAP trackers queried to resolve Overlay Services hosts for a given lookup service.
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
See also: LookupAnswer, LookupQuestionLinks: API, Interfaces, Classes, Functions, Types, Enums, Variables
Interface: SHIPBroadcasterConfig
Configuration options for the SHIP broadcaster.
export interface SHIPBroadcasterConfig {
networkPreset?: "mainnet" | "testnet" | "local";
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.
See also: OverlayBroadcastFacilitatorProperty networkPreset
The network preset to use, unless other options override it. - mainnet: use mainnet resolver and HTTPS facilitator - testnet: use testnet resolver and HTTPS facilitator - local: directly send to localhost:8080 and a facilitator that permits plain HTTP
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.
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.
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.
Property resolver
The resolver used to locate suitable hosts with SHIP
See also: LookupResolverLinks: API, Interfaces, Classes, Functions, Types, Enums, Variables
Interface: TaggedBEEF
Tagged BEEF
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Classes
HTTPSOverlayBroadcastFacilitator |
HTTPSOverlayLookupFacilitator |
LookupResolver |
OverlayAdminTokenTemplate |
TopicBroadcaster |
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Class: HTTPSOverlayBroadcastFacilitator
export class HTTPSOverlayBroadcastFacilitator implements OverlayBroadcastFacilitator {
httpClient: typeof fetch;
allowHTTP: boolean;
constructor(httpClient = fetch, allowHTTP: boolean = false)
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;
allowHTTP: boolean;
constructor(httpClient = fetch, allowHTTP: boolean = false)
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.
See also: LookupAnswer, LookupQuestionLinks: 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
See also: WalletInterfaceArgument Details
- wallet
- Wallet to use for locking and unlocking
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;
}
Returns
Decoded SHIP or SLAP advertisement
Argument Details
- script
- Locking script comprising a SHIP or SLAP token to decode
Method lock
Creates a new advertisement locking script
async lock(protocol: "SHIP" | "SLAP", domain: string, topicOrService: string): Promise<LockingScript>
Returns
Locking script comprising the advertisement token
Argument Details
- protocol
- SHIP or SLAP
- domain
- Domain where the topic or service is available
- topicOrService
- Topic or service to advertise
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>;
}
Returns
Script unlocker capable of unlocking the advertisement token
Argument Details
- protocol
- SHIP or SLAP, depending on the token to unlock
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Class: TopicBroadcaster
Broadcasts transactions to one or more overlay topics.
export default class TopicBroadcaster 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.
See also: SHIPBroadcasterConfigArgument Details
- topics
- The list of SHIP topic names where transactions are to be sent.
- config
- Configuration options for the SHIP broadcaster.
Method broadcast
Broadcasts a transaction to Overlay Services via SHIP.
See also: BroadcastFailure, BroadcastResponse, TransactionReturns
A promise that resolves to either a success or failure response.
Argument Details
- tx
- The transaction to be sent.
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;
context?: number[];
}>;
}
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Type: STEAK
Submitted Transaction Execution AcKnowledgment
See also: AdmittanceInstructions
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Enums
Variables
DEFAULT_SLAP_TRACKERS |
DEFAULT_TESTNET_SLAP_TRACKERS |
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Variable: DEFAULT_SLAP_TRACKERS
DEFAULT_SLAP_TRACKERS: string[] = [
"https://overlay-us-1.bsvb.tech",
"https://overlay-eu-1.bsvb.tech",
"https://overlay-ap-1.bsvb.tech",
"https://users.bapp.dev"
]
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables
Variable: DEFAULT_TESTNET_SLAP_TRACKERS
Links: API, Interfaces, Classes, Functions, Types, Enums, Variables