@lightninglabs/lnc-web
Version:
Lightning Node Connect npm module for web
64 lines • 2.24 kB
TypeScript
import { FaradayApi, LitApi, LndApi, LoopApi, PoolApi, TaprootAssetsApi } from '@lightninglabs/lnc-core';
import { CredentialStore, LncConfig } from './types/lnc';
export default class LNC {
go: any;
result?: {
module: WebAssembly.Module;
instance: WebAssembly.Instance;
};
_wasmClientCode: any;
_namespace: string;
credentials: CredentialStore;
lnd: LndApi;
loop: LoopApi;
pool: PoolApi;
faraday: FaradayApi;
tapd: TaprootAssetsApi;
lit: LitApi;
constructor(lncConfig?: LncConfig);
private get wasm();
private set wasm(value);
get isReady(): any;
get isConnected(): any;
get status(): any;
get expiry(): Date;
get isReadOnly(): any;
hasPerms(permission: string): any;
/**
* Downloads the WASM client binary
*/
preload(): Promise<void>;
/**
* Loads keys from storage and runs the Wasm client binary
*/
run(): Promise<void>;
/**
* Connects to the LNC proxy server
* @returns a promise that resolves when the connection is established
*/
connect(): Promise<void>;
/**
* Disconnects from the proxy server
*/
disconnect(): void;
/**
* Waits until the WASM client is executed and ready to accept connection info
*/
waitTilReady(): Promise<void>;
/**
* Emulates a GRPC request but uses the WASM client instead to communicate with the LND node
* @param method the GRPC method to call on the service
* @param request The GRPC request message to send
*/
request<TRes>(method: string, request?: object): Promise<TRes>;
/**
* Subscribes to a GRPC server-streaming endpoint and executes the `onMessage` handler
* when a new message is received from the server
* @param method the GRPC method to call on the service
* @param request the GRPC request message to send
* @param onMessage the callback function to execute when a new message is received
* @param onError the callback function to execute when an error is received
*/
subscribe<TRes>(method: string, request?: object, onMessage?: (res: TRes) => void, onError?: (res: Error) => void): void;
}
//# sourceMappingURL=lnc.d.ts.map