-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into integration2
- Loading branch information
Showing
23 changed files
with
788 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as LitJsSdk from "@lit-protocol/lit-node-client-nodejs"; | ||
|
||
|
||
class LitNodeClientSingleton { | ||
constructor() { | ||
if (!LitNodeClientSingleton.instance) { | ||
// Inline configuration | ||
const config = { | ||
litNetwork: 'habanero', | ||
debug: true, | ||
}; | ||
|
||
this.client = new LitJsSdk.LitNodeClientNodeJs(config); | ||
this.connect(); | ||
LitNodeClientSingleton.instance = this; | ||
} | ||
return LitNodeClientSingleton.instance.client; | ||
} | ||
|
||
async connect() { | ||
try { | ||
await this.client.connect(); | ||
console.log('LitNodeClient connected successfully.'); | ||
} catch (error) { | ||
console.error('Failed to connect LitNodeClient:', error); | ||
} | ||
} | ||
} | ||
|
||
// Ensuring the object is a singleton | ||
LitNodeClientSingleton.instance = null; | ||
|
||
export function getLitNodeClient() { | ||
if (!LitNodeClientSingleton.instance) { | ||
return new LitNodeClientSingleton(); | ||
} | ||
return LitNodeClientSingleton.instance.client; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.