Skip to content

Commit

Permalink
added option to provide AppClient when connecting to SimpleHolochain,…
Browse files Browse the repository at this point in the history
… add Weave version of example UI
  • Loading branch information
matthme committed Nov 5, 2024
1 parent 6ca5551 commit 6d6f7a2
Show file tree
Hide file tree
Showing 6 changed files with 1,204 additions and 29 deletions.
17 changes: 13 additions & 4 deletions lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,23 @@ export class SimpleHolochain {
});
}

static async connect(options: AppWebsocketConnectionOptions = {}) {
const client = await AppWebsocket.connect(options);
/**
*
* @param appClient (optional) An AppClient with an already established app websocket connection
* @param options (optional) If no AppClient is provided, this argument allows to specify
* the websocket connection options
* @returns
*/
static async connect(appClient?: AppClient, options: AppWebsocketConnectionOptions = {}) {
if (!appClient) {
appClient = await AppWebsocket.connect(options);
}
const zomeClient = new ZomeClient<GenericZomeSignal>(
client,
appClient,
"generic_dna",
"generic_zome"
);
return new SimpleHolochain(client, zomeClient);
return new SimpleHolochain(appClient, zomeClient);
}

private nodeStore(nodeId: NodeId): NodeStore {
Expand Down
Loading

0 comments on commit 6d6f7a2

Please sign in to comment.