@lightninglabs/lnc-web
Version:
Lightning Node Connect npm module for web
15 lines • 679 B
TypeScript
/**
* Structural type for any object that can handle RPC requests and subscriptions.
* Both LNC and LightningNodeConnect satisfy this contract.
*/
export type RpcClient = {
request<TRes>(method: string, request?: object): Promise<TRes>;
subscribe<TRes>(method: string, request?: object, onMessage?: (res: TRes) => void, onError?: (res: Error) => void): void;
};
/**
* Creates a typed Proxy object which calls the WASM request or
* subscribe methods depending on which function is called on the object
*/
export declare function createRpc<T extends object>(packageName: string, client: RpcClient): T;
export default createRpc;
//# sourceMappingURL=createRpc.d.ts.map