File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { snakeKeysToCamel } from './util/objects';
66
77/** The default values for the LncConfig options */
88const DEFAULT_CONFIG = {
9- wasmClientCode : 'https://lightning.engineering/lnc-v0.1.10 -alpha.wasm' ,
9+ wasmClientCode : 'https://lightning.engineering/lnc-v0.1.11 -alpha.wasm' ,
1010 namespace : 'default' ,
1111 serverHost : 'mailbox.terminal.lightning.today:443'
1212} as Required < LncConfig > ;
@@ -78,6 +78,38 @@ export default class LNC {
7878 ) ;
7979 }
8080
81+ get status ( ) {
82+ return (
83+ this . wasm &&
84+ this . wasm . wasmClientStatus &&
85+ this . wasm . wasmClientStatus ( )
86+ ) ;
87+ }
88+
89+ get expiry ( ) : Date {
90+ return (
91+ this . wasm &&
92+ this . wasm . wasmClientGetExpiry &&
93+ new Date ( this . wasm . wasmClientGetExpiry ( ) * 1000 )
94+ ) ;
95+ }
96+
97+ get isReadOnly ( ) {
98+ return (
99+ this . wasm &&
100+ this . wasm . wasmClientIsReadOnly &&
101+ this . wasm . wasmClientIsReadOnly ( )
102+ ) ;
103+ }
104+
105+ hasPerms ( permission : string ) {
106+ return (
107+ this . wasm &&
108+ this . wasm . wasmClientHasPerms &&
109+ this . wasm . wasmClientHasPerms ( permission )
110+ ) ;
111+ }
112+
81113 /**
82114 * Downloads the WASM client binary
83115 */
Original file line number Diff line number Diff line change @@ -31,6 +31,23 @@ export interface WasmGlobal {
3131 request : any ,
3232 callback : ( response : string ) => any
3333 ) => void ;
34+ /**
35+ * Returns true if client has specific permissions
36+ * e.g. 'lnrpc.Lightning.GetInfo'
37+ */
38+ wasmClientHasPerms : ( permission : string ) => boolean ;
39+ /**
40+ * Returns true if the WASM client is read only
41+ */
42+ wasmClientIsReadOnly : ( ) => boolean ;
43+ /**
44+ * Returns the WASM client status
45+ */
46+ wasmClientStatus : ( ) => string ;
47+ /**
48+ * Returns the WASM client expiry time
49+ */
50+ wasmClientGetExpiry : ( ) => number ;
3451}
3552
3653export interface LncConfig {
You can’t perform that action at this time.
0 commit comments