UNPKG

@nubit/modular-indexer-light-sdk

Version:

WebAssembly-based Nubit Modular Indexer (Light) SDK for Bitcoin meta-protocol verification

89 lines (87 loc) 2.05 kB
export interface Config { verification: { bitcoinRPC: string; metaProtocol: string; minimalCheckpoint: number; }; committeeIndexers: { s3: { region: string; bucket: string; name: string; }[]; da: { network: string; namespaceID: string; name: string; }[]; }; } export type Status = "verifying" | "verified" | "unverified"; export interface BalanceOfPkScript { error?: string; result?: { availableBalance: string; overallBalance: string; }; proof?: string; } export interface BalanceOfWallet { error?: string; result?: { availableBalance: string; overallBalance: string; pkscript: string; }; proof?: string; } export interface Checkpoint { commitment: string; hash: string; height: string; metaProtocol: string; name: string; url: string; version: string; } /** * Light indexer SDK. */ export declare class SDK { /** * Load the WebAssembly module and run the light indexer. * * @param c configuration */ run(c: Config): Promise<void>; /** * Get the status of the light indexer. */ getStatus(): Promise<Status>; /** * Get current BTC block height. */ getBlockHeight(): Promise<number>; /** * Get balance via PkScript. * * @param tick token * @param pkscript public key script */ getBalanceOfPkScript(tick: string, pkscript: string): Promise<BalanceOfPkScript>; /** * Get balance via wallet. * * @param tick token * @param wallet wallet address */ getBalanceOfWallet(tick: string, wallet: string): Promise<BalanceOfWallet>; /** * Get current checkpoints from all the committee indexers. */ getCurrentCheckpoints(): Promise<Checkpoint[]>; /** * Get the previous consensus-reached checkpoint. */ getLastCheckpoint(): Promise<Checkpoint>; }