Skip to content

Commit 9a487db

Browse files
authored
Merge pull request #78 from lightninglabs/autopilot
lib: add LitApi to LNC
2 parents 988a8fa + f05b30e commit 9a487db

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

lib/lnc.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
FaradayApi,
3+
LitApi,
34
LndApi,
45
LoopApi,
56
PoolApi,
@@ -12,7 +13,7 @@ import { wasmLog as log } from './util/log';
1213

1314
/** The default values for the LncConfig options */
1415
const DEFAULT_CONFIG = {
15-
wasmClientCode: 'https://lightning.engineering/lnc-v0.2.2-alpha.wasm',
16+
wasmClientCode: 'https://lightning.engineering/lnc-v0.2.3-alpha.wasm',
1617
namespace: 'default',
1718
serverHost: 'mailbox.terminal.lightning.today:443'
1819
} as Required<LncConfig>;
@@ -32,6 +33,7 @@ export default class LNC {
3233
loop: LoopApi;
3334
pool: PoolApi;
3435
faraday: FaradayApi;
36+
lit: LitApi;
3537

3638
constructor(lncConfig?: LncConfig) {
3739
// merge the passed in config with the defaults
@@ -62,6 +64,7 @@ export default class LNC {
6264
this.loop = new LoopApi(createRpc, this);
6365
this.pool = new PoolApi(createRpc, this);
6466
this.faraday = new FaradayApi(createRpc, this);
67+
this.lit = new LitApi(createRpc, this);
6568
}
6669

6770
private get wasm() {

lib/util/credentialStore.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ export default class LncCredentialStore implements CredentialStore {
189189

190190
/** Loads persisted data from localStorage */
191191
private _load() {
192+
// do nothing if localStorage is not available
193+
if (typeof localStorage === 'undefined') return;
194+
192195
try {
193196
const key = `${STORAGE_KEY}:${this.namespace}`;
194197
const json = localStorage.getItem(key);
@@ -202,6 +205,9 @@ export default class LncCredentialStore implements CredentialStore {
202205

203206
/** Saves persisted data to localStorage */
204207
private _save() {
208+
// do nothing if localStorage is not available
209+
if (typeof localStorage === 'undefined') return;
210+
205211
const key = `${STORAGE_KEY}:${this.namespace}`;
206212
localStorage.setItem(key, JSON.stringify(this.persisted));
207213
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"webpack-cli": "4.9.2"
5252
},
5353
"dependencies": {
54-
"@lightninglabs/lnc-core": "0.2.2-alpha",
54+
"@lightninglabs/lnc-core": "0.2.3-alpha",
5555
"crypto-js": "4.1.1"
5656
},
5757
"browser": {

webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = {
2828
name: '@lightninglabs/lnc-web',
2929
type: "umd", // see https://webpack.js.org/configuration/output/#outputlibrarytype
3030
},
31+
globalObject: 'this',
3132
path: path.resolve(__dirname, 'dist'),
3233
},
3334
};

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@
8080
"@jridgewell/resolve-uri" "3.1.0"
8181
"@jridgewell/sourcemap-codec" "1.4.14"
8282

83-
"@lightninglabs/[email protected].2-alpha":
84-
version "0.2.2-alpha"
85-
resolved "https://registry.yarnpkg.com/@lightninglabs/lnc-core/-/lnc-core-0.2.2-alpha.tgz#37e1dcf3419844f70e5df7901ec55cb62a9b0b1e"
86-
integrity sha512-S46tZ6cH7jPgrotbZS9Pceyb2Nf+gaC9gmorm1DC7OpWxaf2gilelNk+0wVf9B8pqIwnBfr1z3h/sTophvLkUQ==
83+
"@lightninglabs/[email protected].3-alpha":
84+
version "0.2.3-alpha"
85+
resolved "https://registry.yarnpkg.com/@lightninglabs/lnc-core/-/lnc-core-0.2.3-alpha.tgz#e1b92a9071d1dfb92e2d565710b56f28f57cbbd4"
86+
integrity sha512-93D/uU64ayAaJv5kv4Pqwvkt+uT7yCtmHD08aUzvql+lbWm6U7m5loZLxz7tACFLXVPOQ8OHJL25W+3QMEYthg==
8787

8888
"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
8989
version "1.1.2"

0 commit comments

Comments
 (0)