Skip to content

Commit e81471c

Browse files
committed
api: add LitApi class
1 parent 5f0e282 commit e81471c

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

lib/api/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { default as LndApi } from './lnd';
22
export { default as LoopApi } from './loop';
33
export { default as PoolApi } from './pool';
44
export { default as FaradayApi } from './faraday';
5+
export { default as LitApi } from './lit';

lib/api/lit.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Autopilot, Firewall, Sessions } from '../types/proto/litrpc';
2+
import { serviceNames as sn } from '../types/proto/schema';
3+
4+
/**
5+
* An API wrapper to communicate with the LiT node via GRPC
6+
*/
7+
class LitApi {
8+
autopilot: Autopilot;
9+
firewall: Firewall;
10+
sessions: Sessions;
11+
12+
constructor(createRpc: Function, lnc: any) {
13+
this.autopilot = createRpc(sn.litrpc.Autopilot, lnc);
14+
this.firewall = createRpc(sn.litrpc.Firewall, lnc);
15+
this.sessions = createRpc(sn.litrpc.Sessions, lnc);
16+
}
17+
}
18+
19+
export default LitApi;

lib/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export * from './types/proto';
22
export { camelKeysToSnake, isObject, snakeKeysToCamel } from './util/objects';
3-
export { LndApi, LoopApi, PoolApi, FaradayApi } from './api';
3+
export { LndApi, LoopApi, PoolApi, FaradayApi, LitApi } from './api';
44
export { subscriptionMethods } from './types/proto/schema';

0 commit comments

Comments
 (0)