@holochain/client 0.17.0-dev.8 → 0.18.0-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,12 +15,12 @@ A JavaScript client for the Holochain Conductor API (works with browsers as well
15
15
 
16
16
  ## Installation
17
17
 
18
- **JS client v0.12.x** is compatible with **Holochain v0.1.x**.
19
-
20
- **JS client v0.16.x** is compatible with **Holochain v0.2.x**.
18
+ **JS client v0.18.x** is compatible with **Holochain v0.4.x**.
21
19
 
22
20
  **JS client v0.17.x** is compatible with **Holochain v0.3.x**.
23
21
 
22
+ **JS client v0.16.x** is compatible with **Holochain v0.2.x**.
23
+
24
24
  To install from NPM, run
25
25
  ```bash
26
26
  npm install --save-exact @holochain/client
@@ -1,7 +1,6 @@
1
1
  import { Action, DhtOp, Entry, ZomeCallCapGrant } from "../../hdk/index.js";
2
2
  import { ActionHash, AgentPubKey, CellId, DnaHash, DnaProperties, Duration, HoloHash, HoloHashB64, InstalledAppId, KitsuneAgent, KitsuneSpace, RoleName, Signature, Timestamp, WasmHash } from "../../types.js";
3
3
  import { Requester } from "../common.js";
4
- import { DisableCloneCellRequest } from "../index.js";
5
4
  /**
6
5
  * @public
7
6
  */
@@ -12,6 +11,10 @@ export type AttachAppInterfaceRequest = {
12
11
  * For example: `http://localhost:3000,http://localhost:3001`
13
12
  */
14
13
  allowed_origins: string;
14
+ /**
15
+ * Optionally, bind this app interface to a specific installed app.
16
+ */
17
+ installed_app_id?: InstalledAppId;
15
18
  };
16
19
  /**
17
20
  * @public
@@ -35,11 +38,7 @@ export type EnableAppResponse = {
35
38
  /**
36
39
  * @public
37
40
  */
38
- export type DeactivationReason = {
39
- never_activated: null;
40
- } | {
41
- normal: null;
42
- } | {
41
+ export type DeactivationReason = "never_activated" | "normal" | {
43
42
  quarantined: {
44
43
  error: string;
45
44
  };
@@ -53,11 +52,7 @@ export type PausedAppReason = {
53
52
  /**
54
53
  * @public
55
54
  */
56
- export type DisabledAppReason = {
57
- never_started: null;
58
- } | {
59
- user: null;
60
- } | {
55
+ export type DisabledAppReason = "never_started" | "user" | {
61
56
  error: string;
62
57
  };
63
58
  /**
@@ -71,9 +66,7 @@ export type InstalledAppInfoStatus = {
71
66
  disabled: {
72
67
  reason: DisabledAppReason;
73
68
  };
74
- } | {
75
- running: null;
76
- };
69
+ } | "running";
77
70
  /**
78
71
  * @public
79
72
  */
@@ -447,11 +440,11 @@ export type ListActiveAppsResponse = Array<InstalledAppId>;
447
440
  * @public
448
441
  */
449
442
  export declare enum AppStatusFilter {
450
- Enabled = "enabled",
451
- Disabled = "disabled",
452
- Running = "running",
453
- Stopped = "stopped",
454
- Paused = "paused"
443
+ Enabled = "Enabled",
444
+ Disabled = "Disabled",
445
+ Running = "Running",
446
+ Stopped = "Stopped",
447
+ Paused = "Paused"
455
448
  }
456
449
  /**
457
450
  * @public
@@ -470,7 +463,15 @@ export type ListAppInterfacesRequest = void;
470
463
  /**
471
464
  * @public
472
465
  */
473
- export type ListAppInterfacesResponse = Array<number>;
466
+ export type ListAppInterfacesResponse = Array<AppInterfaceInfo>;
467
+ /**
468
+ * @public
469
+ */
470
+ export interface AppInterfaceInfo {
471
+ port: number;
472
+ allowed_origins: string;
473
+ installed_app_id?: InstalledAppId;
474
+ }
474
475
  /**
475
476
  * This type is meant to be opaque
476
477
  *
@@ -496,11 +497,20 @@ export type AddAgentInfoRequest = {
496
497
  /**
497
498
  * @public
498
499
  */
499
- export type AddAgentInfoResponse = any;
500
+ export type AddAgentInfoResponse = unknown;
500
501
  /**
501
502
  * @public
502
503
  */
503
- export type DeleteCloneCellRequest = DisableCloneCellRequest;
504
+ export interface DeleteCloneCellRequest {
505
+ /**
506
+ * The app id that the clone cell belongs to
507
+ */
508
+ app_id: InstalledAppId;
509
+ /**
510
+ * The clone id or cell id of the clone cell
511
+ */
512
+ clone_cell_id: RoleName | CellId;
513
+ }
504
514
  /**
505
515
  * @public
506
516
  */
@@ -719,6 +729,25 @@ export type StorageInfoRequest = void;
719
729
  * @public
720
730
  */
721
731
  export type StorageInfoResponse = StorageInfo;
732
+ /**
733
+ * @public
734
+ */
735
+ export interface IssueAppAuthenticationTokenRequest {
736
+ installed_app_id: InstalledAppId;
737
+ expiry_seconds?: number;
738
+ single_use?: boolean;
739
+ }
740
+ /**
741
+ * @public
742
+ */
743
+ export type AppAuthenticationToken = number[];
744
+ /**
745
+ * @public
746
+ */
747
+ export interface IssueAppAuthenticationTokenResponse {
748
+ token: AppAuthenticationToken;
749
+ expires_at?: Timestamp;
750
+ }
722
751
  /**
723
752
  * @public
724
753
  */
@@ -750,5 +779,6 @@ export interface AdminApi {
750
779
  deleteCloneCell: Requester<DeleteCloneCellRequest, DeleteCloneCellResponse>;
751
780
  grantZomeCallCapability: Requester<GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse>;
752
781
  storageInfo: Requester<StorageInfoRequest, StorageInfoResponse>;
782
+ issueAppAuthenticationToken: Requester<IssueAppAuthenticationTokenRequest, IssueAppAuthenticationTokenResponse>;
753
783
  dumpNetworkStats: Requester<DumpNetworkStatsRequest, DumpNetworkStatsResponse>;
754
784
  }
@@ -46,9 +46,9 @@ export var CellProvisioningStrategy;
46
46
  */
47
47
  export var AppStatusFilter;
48
48
  (function (AppStatusFilter) {
49
- AppStatusFilter["Enabled"] = "enabled";
50
- AppStatusFilter["Disabled"] = "disabled";
51
- AppStatusFilter["Running"] = "running";
52
- AppStatusFilter["Stopped"] = "stopped";
53
- AppStatusFilter["Paused"] = "paused";
49
+ AppStatusFilter["Enabled"] = "Enabled";
50
+ AppStatusFilter["Disabled"] = "Disabled";
51
+ AppStatusFilter["Running"] = "Running";
52
+ AppStatusFilter["Stopped"] = "Stopped";
53
+ AppStatusFilter["Paused"] = "Paused";
54
54
  })(AppStatusFilter || (AppStatusFilter = {}));
@@ -1,8 +1,8 @@
1
- import { CapSecret, GrantedFunctions } from "../../hdk/capabilities.js";
1
+ import { CapSecret, GrantedFunctions } from "../../hdk/index.js";
2
2
  import type { AgentPubKey, CellId } from "../../types.js";
3
3
  import { WsClient } from "../client.js";
4
- import { WebsocketConnectionOptions, Requester, Transformer } from "../common.js";
5
- import { AddAgentInfoRequest, AddAgentInfoResponse, AdminApi, AgentInfoRequest, AgentInfoResponse, AttachAppInterfaceRequest, AttachAppInterfaceResponse, DeleteCloneCellRequest, DeleteCloneCellResponse, DisableAppRequest, DisableAppResponse, DumpFullStateRequest, DumpFullStateResponse, DumpNetworkStatsRequest, DumpNetworkStatsResponse, DumpStateRequest, DumpStateResponse, EnableAppRequest, EnableAppResponse, GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse, GetDnaDefinitionRequest, GetDnaDefinitionResponse, GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse, InstallAppRequest, InstallAppResponse, ListAppInterfacesRequest, ListAppInterfacesResponse, ListAppsRequest, ListAppsResponse, ListCellIdsRequest, ListCellIdsResponse, ListDnasRequest, ListDnasResponse, RegisterDnaRequest, RegisterDnaResponse, StorageInfoRequest, StorageInfoResponse, UninstallAppRequest, UninstallAppResponse, UpdateCoordinatorsRequest, UpdateCoordinatorsResponse } from "./types.js";
4
+ import { Requester, Transformer, WebsocketConnectionOptions } from "../common.js";
5
+ import { AddAgentInfoRequest, AddAgentInfoResponse, AdminApi, AgentInfoRequest, AgentInfoResponse, AttachAppInterfaceRequest, AttachAppInterfaceResponse, DeleteCloneCellRequest, DeleteCloneCellResponse, DisableAppRequest, DisableAppResponse, DumpFullStateRequest, DumpFullStateResponse, DumpNetworkStatsRequest, DumpNetworkStatsResponse, DumpStateRequest, DumpStateResponse, EnableAppRequest, EnableAppResponse, GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse, GetDnaDefinitionRequest, GetDnaDefinitionResponse, GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse, InstallAppRequest, InstallAppResponse, IssueAppAuthenticationTokenRequest, IssueAppAuthenticationTokenResponse, ListAppInterfacesRequest, ListAppInterfacesResponse, ListAppsRequest, ListAppsResponse, ListCellIdsRequest, ListCellIdsResponse, ListDnasRequest, ListDnasResponse, RegisterDnaRequest, RegisterDnaResponse, StorageInfoRequest, StorageInfoResponse, UninstallAppRequest, UninstallAppResponse, UpdateCoordinatorsRequest, UpdateCoordinatorsResponse } from "./types.js";
6
6
  /**
7
7
  * A class for interacting with a conductor's Admin API.
8
8
  *
@@ -107,6 +107,7 @@ export declare class AdminWebsocket implements AdminApi {
107
107
  */
108
108
  grantZomeCallCapability: Requester<GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse>;
109
109
  storageInfo: Requester<StorageInfoRequest, StorageInfoResponse>;
110
+ issueAppAuthenticationToken: Requester<IssueAppAuthenticationTokenRequest, IssueAppAuthenticationTokenResponse>;
110
111
  dumpNetworkStats: Requester<DumpNetworkStatsRequest, DumpNetworkStatsResponse>;
111
112
  /**
112
113
  * Grant a capability for signing zome calls.
@@ -1,9 +1,8 @@
1
1
  import { getLauncherEnvironment } from "../../environments/launcher.js";
2
- import { GrantedFunctionsType, } from "../../hdk/capabilities.js";
2
+ import { GrantedFunctionsType, } from "../../hdk/index.js";
3
3
  import { WsClient } from "../client.js";
4
- import { catchError, DEFAULT_TIMEOUT, promiseTimeout, requesterTransformer, HolochainError, } from "../common.js";
4
+ import { DEFAULT_TIMEOUT, HolochainError, catchError, promiseTimeout, requesterTransformer, } from "../common.js";
5
5
  import { generateSigningKeyPair, randomCapSecret, setSigningCredentials, } from "../zome-call-signing.js";
6
- import { AppStatusFilter, } from "./types.js";
7
6
  /**
8
7
  * A class for interacting with a conductor's Admin API.
9
8
  *
@@ -33,7 +32,7 @@ export class AdminWebsocket {
33
32
  // Check if we are in the launcher's environment, and if so, redirect the url to connect to
34
33
  const env = getLauncherEnvironment();
35
34
  if (env?.ADMIN_INTERFACE_PORT) {
36
- options.url = new URL(`ws://127.0.0.1:${env.ADMIN_INTERFACE_PORT}`);
35
+ options.url = new URL(`ws://localhost:${env.ADMIN_INTERFACE_PORT}`);
37
36
  }
38
37
  if (!options.url) {
39
38
  throw new HolochainError("ConnectionUrlMissing", `unable to connect to Conductor API - no url provided and not in a launcher environment.`);
@@ -102,7 +101,7 @@ export class AdminWebsocket {
102
101
  /**
103
102
  * List all installed apps.
104
103
  */
105
- listApps = this._requester("list_apps", listAppsTransform);
104
+ listApps = this._requester("list_apps");
106
105
  /**
107
106
  * List all attached app interfaces.
108
107
  */
@@ -125,6 +124,7 @@ export class AdminWebsocket {
125
124
  */
126
125
  grantZomeCallCapability = this._requester("grant_zome_call_capability");
127
126
  storageInfo = this._requester("storage_info");
127
+ issueAppAuthenticationToken = this._requester("issue_app_authentication_token");
128
128
  dumpNetworkStats = this._requester("dump_network_stats");
129
129
  // zome call signing related methods
130
130
  /**
@@ -162,47 +162,13 @@ export class AdminWebsocket {
162
162
  */
163
163
  authorizeSigningCredentials = async (cellId, functions) => {
164
164
  const [keyPair, signingKey] = await generateSigningKeyPair();
165
- const capSecret = await this.grantSigningKey(cellId, functions || { [GrantedFunctionsType.All]: null }, signingKey);
165
+ const capSecret = await this.grantSigningKey(cellId, functions || GrantedFunctionsType.All, signingKey);
166
166
  setSigningCredentials(cellId, { capSecret, keyPair, signingKey });
167
167
  };
168
168
  }
169
- const listAppsTransform = {
170
- input: (req) => {
171
- const args = {};
172
- if (req.status_filter) {
173
- args.status_filter = getAppStatusInApiForm(req.status_filter);
174
- }
175
- return args;
176
- },
177
- output: (res) => res,
178
- };
179
169
  const dumpStateTransform = {
180
170
  input: (req) => req,
181
171
  output: (res) => {
182
172
  return JSON.parse(res);
183
173
  },
184
174
  };
185
- function getAppStatusInApiForm(status_filter) {
186
- switch (status_filter) {
187
- case AppStatusFilter.Running:
188
- return {
189
- Running: null,
190
- };
191
- case AppStatusFilter.Enabled:
192
- return {
193
- Enabled: null,
194
- };
195
- case AppStatusFilter.Paused:
196
- return {
197
- Paused: null,
198
- };
199
- case AppStatusFilter.Disabled:
200
- return {
201
- Disabled: null,
202
- };
203
- case AppStatusFilter.Stopped:
204
- return {
205
- Stopped: null,
206
- };
207
- }
208
- }
@@ -1,6 +1,61 @@
1
- import { AgentPubKey, CellId, DnaHash, DnaProperties, InstalledAppId, NetworkInfo, RoleName, Timestamp } from "../../types.js";
2
- import { AppInfo, ClonedCell, FunctionName, MembraneProof, NetworkSeed, ZomeName } from "../admin/types.js";
3
- import { Requester } from "../common.js";
1
+ import { UnsubscribeFunction } from "emittery";
2
+ import { AgentPubKey, AppAuthenticationToken, AppInfo, CapSecret, CellId, ClonedCell, DnaHash, DnaProperties, FunctionName, MembraneProof, NetworkInfo, NetworkSeed, Nonce256Bit, RoleName, Timestamp, WebsocketConnectionOptions, ZomeName } from "../../index.js";
3
+ /**
4
+ * @public
5
+ */
6
+ export type NonProvenanceCallZomeRequest = Omit<CallZomeRequest, "provenance">;
7
+ /**
8
+ * @public
9
+ */
10
+ export type RoleNameCallZomeRequest = Omit<NonProvenanceCallZomeRequest, "cell_id"> & {
11
+ role_name: RoleName;
12
+ };
13
+ /**
14
+ * @public
15
+ */
16
+ export type RoleNameCallZomeRequestSigned = Omit<CallZomeRequestSigned, "cell_id"> & {
17
+ role_name: RoleName;
18
+ };
19
+ /**
20
+ * @public
21
+ */
22
+ export type AppCallZomeRequest = NonProvenanceCallZomeRequest | RoleNameCallZomeRequest | CallZomeRequestSigned | RoleNameCallZomeRequestSigned;
23
+ /**
24
+ * @public
25
+ */
26
+ export type AppCreateCloneCellRequest = Omit<CreateCloneCellRequest, "app_id">;
27
+ /**
28
+ * @public
29
+ */
30
+ export type AppEnableCloneCellRequest = Omit<EnableCloneCellRequest, "app_id">;
31
+ /**
32
+ * @public
33
+ */
34
+ export type AppDisableCloneCellRequest = Omit<DisableCloneCellRequest, "app_id">;
35
+ /**
36
+ * @public
37
+ */
38
+ export type AppNetworkInfoRequest = Omit<NetworkInfoRequest, "agent_pub_key">;
39
+ /**
40
+ * @public
41
+ */
42
+ export interface AppEvents {
43
+ signal: AppSignal;
44
+ }
45
+ /**
46
+ * @public
47
+ */
48
+ export interface CallZomeRequestUnsigned extends CallZomeRequest {
49
+ cap_secret: CapSecret | null;
50
+ nonce: Nonce256Bit;
51
+ expires_at: number;
52
+ }
53
+ /**
54
+ * @public
55
+ */
56
+ export interface CallZomeRequestSigned extends CallZomeRequestUnsigned {
57
+ signature: Uint8Array;
58
+ }
4
59
  /**
5
60
  * @public
6
61
  */
@@ -23,12 +78,6 @@ export type CallZomeResponseGeneric<Payload> = Payload;
23
78
  * @public
24
79
  */
25
80
  export type CallZomeResponse = CallZomeResponseGeneric<any>;
26
- /**
27
- * @public
28
- */
29
- export type AppInfoRequest = {
30
- installed_app_id: InstalledAppId;
31
- };
32
81
  /**
33
82
  * @public
34
83
  */
@@ -37,10 +86,6 @@ export type AppInfoResponse = AppInfo | null;
37
86
  * @public
38
87
  */
39
88
  export interface CreateCloneCellRequest {
40
- /**
41
- * The app id that the DNA to clone belongs to
42
- */
43
- app_id: InstalledAppId;
44
89
  /**
45
90
  * The DNA's role id to clone.
46
91
  */
@@ -88,10 +133,6 @@ export type CreateCloneCellResponse = ClonedCell;
88
133
  * @public
89
134
  */
90
135
  export interface DisableCloneCellRequest {
91
- /**
92
- * The app id that the clone cell belongs to
93
- */
94
- app_id: InstalledAppId;
95
136
  /**
96
137
  * The clone id or cell id of the clone cell
97
138
  */
@@ -168,9 +209,19 @@ export type NetworkInfoResponse = NetworkInfo[];
168
209
  /**
169
210
  * @public
170
211
  */
171
- export interface AppApi {
172
- appInfo: Requester<AppInfoRequest, AppInfoResponse>;
173
- callZome: Requester<CallZomeRequest, CallZomeResponse>;
174
- enableCloneCell: Requester<EnableCloneCellRequest, EnableCloneCellResponse>;
175
- disableCloneCell: Requester<DisableCloneCellRequest, DisableCloneCellResponse>;
212
+ export interface AppClient {
213
+ callZome(args: AppCallZomeRequest, timeout?: number): Promise<any>;
214
+ on<Name extends keyof AppEvents>(eventName: Name | readonly Name[], listener: AppSignalCb): UnsubscribeFunction;
215
+ appInfo(): Promise<AppInfoResponse>;
216
+ myPubKey: AgentPubKey;
217
+ createCloneCell(args: AppCreateCloneCellRequest): Promise<CreateCloneCellResponse>;
218
+ enableCloneCell(args: AppEnableCloneCellRequest): Promise<EnableCloneCellResponse>;
219
+ disableCloneCell(args: AppDisableCloneCellRequest): Promise<DisableCloneCellResponse>;
220
+ networkInfo(args: AppNetworkInfoRequest): Promise<NetworkInfoResponse>;
221
+ }
222
+ /**
223
+ * @public
224
+ */
225
+ export interface AppWebsocketConnectionOptions extends WebsocketConnectionOptions {
226
+ token?: AppAuthenticationToken;
176
227
  }
@@ -1,35 +1,50 @@
1
- import Emittery from "emittery";
2
- import { CapSecret } from "../../hdk/capabilities.js";
3
- import { InstalledAppId } from "../../types.js";
1
+ import { UnsubscribeFunction } from "emittery";
2
+ import { AgentPubKey, CellId, RoleName } from "../../types.js";
3
+ import { AppInfo } from "../admin/index.js";
4
+ import { AppCallZomeRequest, AppClient, AppEvents, AppNetworkInfoRequest, AppCreateCloneCellRequest, AppDisableCloneCellRequest, AppEnableCloneCellRequest, AppSignalCb, CallZomeRequest, CallZomeRequestSigned, CallZomeResponse, CreateCloneCellResponse, DisableCloneCellResponse, EnableCloneCellResponse, NetworkInfoResponse, AppWebsocketConnectionOptions } from "./types.js";
4
5
  import { WsClient } from "../client.js";
5
- import { WebsocketConnectionOptions, Requester, Transformer } from "../common.js";
6
- import { Nonce256Bit } from "../zome-call-signing.js";
7
- import { AppApi, AppInfoRequest, AppInfoResponse, CallZomeRequest, CallZomeResponse, CreateCloneCellRequest, CreateCloneCellResponse, DisableCloneCellRequest, DisableCloneCellResponse, EnableCloneCellRequest, EnableCloneCellResponse, NetworkInfoRequest, NetworkInfoResponse } from "./types.js";
8
6
  /**
9
- * A class to establish a websocket connection to an App interface of a
10
- * Holochain conductor.
7
+ * A class to establish a websocket connection to an App interface, for a
8
+ * specific agent and app.
11
9
  *
12
10
  * @public
13
11
  */
14
- export declare class AppWebsocket extends Emittery implements AppApi {
12
+ export declare class AppWebsocket implements AppClient {
15
13
  readonly client: WsClient;
16
- defaultTimeout: number;
17
- overrideInstalledAppId?: InstalledAppId;
14
+ readonly myPubKey: AgentPubKey;
15
+ private readonly defaultTimeout;
16
+ private readonly emitter;
17
+ cachedAppInfo?: AppInfo | null;
18
+ private readonly appInfoRequester;
19
+ private readonly callZomeRequester;
20
+ private readonly createCloneCellRequester;
21
+ private readonly enableCloneCellRequester;
22
+ private readonly disableCloneCellRequester;
23
+ private readonly networkInfoRequester;
18
24
  private constructor();
19
25
  /**
20
- * Instance factory for creating AppWebsockets.
26
+ * Instance factory for creating an {@link AppWebsocket}.
21
27
  *
28
+ * @param token - A token to authenticate the websocket connection. Get a token using AdminWebsocket#issueAppAuthenticationToken.
22
29
  * @param options - {@link (WebsocketConnectionOptions:interface)}
23
30
  * @returns A new instance of an AppWebsocket.
24
31
  */
25
- static connect(options?: WebsocketConnectionOptions): Promise<AppWebsocket>;
26
- _requester<ReqI, ReqO, ResI, ResO>(tag: string, transformer?: Transformer<ReqI, ReqO, ResI, ResO>): (req: ReqI, timeout?: number | undefined) => Promise<ResO>;
32
+ static connect(options?: AppWebsocketConnectionOptions): Promise<AppWebsocket>;
27
33
  /**
28
34
  * Request the app's info, including all cell infos.
29
35
  *
36
+ * @param timeout - A timeout to override the default.
30
37
  * @returns The app's {@link AppInfo}.
31
38
  */
32
- appInfo: Requester<AppInfoRequest, AppInfoResponse>;
39
+ appInfo(timeout?: number): Promise<AppInfo>;
40
+ /**
41
+ * Get a cell id by its role name or clone id.
42
+ *
43
+ * @param roleName - The role name or clone id of the cell.
44
+ * @param appInfo - The app info containing all cell infos.
45
+ * @returns The cell id or throws an error if not found.
46
+ */
47
+ getCellIdFromRoleName(roleName: RoleName, appInfo: AppInfo): CellId;
33
48
  /**
34
49
  * Call a zome.
35
50
  *
@@ -37,45 +52,43 @@ export declare class AppWebsocket extends Emittery implements AppApi {
37
52
  * @param timeout - A timeout to override the default.
38
53
  * @returns The zome call's response.
39
54
  */
40
- callZome: Requester<CallZomeRequest | CallZomeRequestSigned, CallZomeResponse>;
55
+ callZome(request: AppCallZomeRequest, timeout?: number): Promise<CallZomeResponse>;
41
56
  /**
42
57
  * Clone an existing provisioned cell.
43
58
  *
44
59
  * @param args - Specify the cell to clone.
45
60
  * @returns The created clone cell.
46
61
  */
47
- createCloneCell: Requester<CreateCloneCellRequest, CreateCloneCellResponse>;
62
+ createCloneCell(args: AppCreateCloneCellRequest): Promise<CreateCloneCellResponse>;
48
63
  /**
49
64
  * Enable a disabled clone cell.
50
65
  *
51
66
  * @param args - Specify the clone cell to enable.
52
67
  * @returns The enabled clone cell.
53
68
  */
54
- enableCloneCell: Requester<EnableCloneCellRequest, EnableCloneCellResponse>;
69
+ enableCloneCell(args: AppEnableCloneCellRequest): Promise<EnableCloneCellResponse>;
55
70
  /**
56
71
  * Disable an enabled clone cell.
57
72
  *
58
73
  * @param args - Specify the clone cell to disable.
59
74
  */
60
- disableCloneCell: Requester<DisableCloneCellRequest, DisableCloneCellResponse>;
75
+ disableCloneCell(args: AppDisableCloneCellRequest): Promise<DisableCloneCellResponse>;
61
76
  /**
62
77
  * Request network info about gossip status.
78
+ * @param args - Specify the DNAs for which you want network info
79
+ * @returns Network info for the specified DNAs
63
80
  */
64
- networkInfo: Requester<NetworkInfoRequest, NetworkInfoResponse>;
65
- }
66
- /**
67
- * @public
68
- */
69
- export interface CallZomeRequestUnsigned extends CallZomeRequest {
70
- cap_secret: CapSecret | null;
71
- nonce: Nonce256Bit;
72
- expires_at: number;
73
- }
74
- /**
75
- * @public
76
- */
77
- export interface CallZomeRequestSigned extends CallZomeRequestUnsigned {
78
- signature: Uint8Array;
81
+ networkInfo(args: AppNetworkInfoRequest): Promise<NetworkInfoResponse>;
82
+ /**
83
+ * Register an event listener for signals.
84
+ *
85
+ * @param eventName - Event name to listen to (currently only "signal").
86
+ * @param listener - The function to call when event is triggered.
87
+ * @returns A function to unsubscribe the event listener.
88
+ */
89
+ on<Name extends keyof AppEvents>(eventName: Name | readonly Name[], listener: AppSignalCb): UnsubscribeFunction;
90
+ private static requester;
91
+ private containsCell;
79
92
  }
80
93
  /**
81
94
  * @public