@icp-sdk/signer 5.2.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.
Files changed (45) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +165 -0
  3. package/lib/esm/agent/agent.d.ts +112 -0
  4. package/lib/esm/agent/agent.js +288 -0
  5. package/lib/esm/agent/agent.js.map +1 -0
  6. package/lib/esm/agent/index.d.ts +1 -0
  7. package/lib/esm/agent/index.js +2 -0
  8. package/lib/esm/agent/index.js.map +1 -0
  9. package/lib/esm/extension/browserExtensionChannel.d.ts +37 -0
  10. package/lib/esm/extension/browserExtensionChannel.js +80 -0
  11. package/lib/esm/extension/browserExtensionChannel.js.map +1 -0
  12. package/lib/esm/extension/browserExtensionTransport.d.ts +67 -0
  13. package/lib/esm/extension/browserExtensionTransport.js +70 -0
  14. package/lib/esm/extension/browserExtensionTransport.js.map +1 -0
  15. package/lib/esm/extension/index.d.ts +3 -0
  16. package/lib/esm/extension/index.js +3 -0
  17. package/lib/esm/extension/index.js.map +1 -0
  18. package/lib/esm/extension/types.d.ts +32 -0
  19. package/lib/esm/extension/types.js +2 -0
  20. package/lib/esm/extension/types.js.map +1 -0
  21. package/lib/esm/index.d.ts +2 -0
  22. package/lib/esm/index.js +2 -0
  23. package/lib/esm/index.js.map +1 -0
  24. package/lib/esm/signer.d.ts +180 -0
  25. package/lib/esm/signer.js +427 -0
  26. package/lib/esm/signer.js.map +1 -0
  27. package/lib/esm/transport.d.ts +32 -0
  28. package/lib/esm/transport.js +11 -0
  29. package/lib/esm/transport.js.map +1 -0
  30. package/lib/esm/web/heartbeat/client.d.ts +60 -0
  31. package/lib/esm/web/heartbeat/client.js +112 -0
  32. package/lib/esm/web/heartbeat/client.js.map +1 -0
  33. package/lib/esm/web/heartbeat/server.d.ts +43 -0
  34. package/lib/esm/web/heartbeat/server.js +82 -0
  35. package/lib/esm/web/heartbeat/server.js.map +1 -0
  36. package/lib/esm/web/index.d.ts +4 -0
  37. package/lib/esm/web/index.js +5 -0
  38. package/lib/esm/web/index.js.map +1 -0
  39. package/lib/esm/web/postMessageChannel.d.ts +55 -0
  40. package/lib/esm/web/postMessageChannel.js +109 -0
  41. package/lib/esm/web/postMessageChannel.js.map +1 -0
  42. package/lib/esm/web/postMessageTransport.d.ts +96 -0
  43. package/lib/esm/web/postMessageTransport.js +113 -0
  44. package/lib/esm/web/postMessageTransport.js.map +1 -0
  45. package/package.json +122 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works; in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor contributes Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if advised
163
+ of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, by accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 DFINITY Stiftung.
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,165 @@
1
+ # @icp-sdk/signer
2
+
3
+ Library to interact with [ICRC-25](https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_25_signer_interaction_standard.md) compliant signers on the Internet Computer.
4
+
5
+ ## What are signers?
6
+
7
+ A signer is an application that holds private keys and can sign messages on behalf of a user. Each signer chooses which standards to implement, but they typically fall into two categories:
8
+
9
+ - **Asset wallets** support accounts and canister calls — users approve transactions directly through the signer (e.g. [OISY](https://oisy.com), [Plug](https://plugwallet.ooo), [PrimeVault](https://primevault.com)).
10
+ - **Authentication providers** support delegations — users grant a session key that can sign on their behalf for a limited time (e.g. [Internet Identity](https://id.ai)).
11
+
12
+ Some signers support both (e.g. [NFID](https://nfid.one)). This library provides a unified interface to interact with all of them.
13
+
14
+ ## Installation
15
+
16
+ ```shell
17
+ npm install @icp-sdk/signer
18
+ ```
19
+
20
+ ## Import Paths
21
+
22
+ - `@icp-sdk/signer` — `Signer` for standardized signer interaction
23
+ - `@icp-sdk/signer/agent` — `SignerAgent` as a drop-in replacement for `HttpAgent`
24
+ - `@icp-sdk/signer/web` — `PostMessageTransport` for web-based signers
25
+ - `@icp-sdk/signer/extension` — `BrowserExtensionTransport` for browser extension signers
26
+
27
+ ## Connecting to a Signer
28
+
29
+ Two transport types are supported. Web-based signers (like OISY, NFID, Internet Identity) use a window opened to the signer's URL. Browser extensions (like Plug, PrimeVault) are discovered automatically.
30
+
31
+ ### Web
32
+
33
+ The [ICRC-29](https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_29_window_post_message_transport.md) post message transport communicates with signers that run as web applications. A window is opened to the signer's URL, and messages are exchanged via `postMessage`.
34
+
35
+ ```ts
36
+ import { Signer } from "@icp-sdk/signer";
37
+ import { PostMessageTransport } from "@icp-sdk/signer/web";
38
+
39
+ const transport = new PostMessageTransport({ url: SIGNER_URL });
40
+ const signer = new Signer({ transport });
41
+ ```
42
+
43
+ ### Extension
44
+
45
+ The [ICRC-94](https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_94_multi_injected_provider_discovery.md) transport communicates with signers installed as browser extensions. Extensions announce themselves and are discovered automatically.
46
+
47
+ ```ts
48
+ import { Signer } from "@icp-sdk/signer";
49
+ import { BrowserExtensionTransport } from "@icp-sdk/signer/extension";
50
+
51
+ // Discover all installed extension signers
52
+ const providerDetails = await BrowserExtensionTransport.discover();
53
+
54
+ // Let the user choose, then create a transport
55
+ const transport = new BrowserExtensionTransport({
56
+ providerDetail: providerDetails[0],
57
+ });
58
+ const signer = new Signer({ transport });
59
+ ```
60
+
61
+ Or connect directly by UUID if you know which extension to use:
62
+
63
+ ```ts
64
+ const transport = await BrowserExtensionTransport.findTransport({
65
+ uuid: EXTENSION_UUID,
66
+ });
67
+ ```
68
+
69
+ ## Checking Capabilities
70
+
71
+ Signers vary in what they support. Query the supported standards before making calls so you can handle unsupported features gracefully:
72
+
73
+ ```ts
74
+ const standards = await signer.getSupportedStandards();
75
+
76
+ // signer.getAccounts() requires ICRC-27
77
+ const canGetAccounts = standards.some((s) => s.name === "ICRC-27");
78
+
79
+ // signer.callCanister() requires ICRC-49
80
+ const canCallCanisters = standards.some((s) => s.name === "ICRC-49");
81
+
82
+ // signer.requestDelegation() requires ICRC-34
83
+ const canDelegate = standards.some((s) => s.name === "ICRC-34");
84
+
85
+ // Asset wallets need both accounts and canister calls
86
+ const isAssetWallet = canGetAccounts && canCallCanisters;
87
+
88
+ // The returned standards also include token standards (e.g. ICRC-1 for
89
+ // fungible tokens, ICRC-7 for NFTs), so you can check whether the
90
+ // signer can manage a particular asset type.
91
+ const supportsFungibleTokens = standards.some((s) => s.name === "ICRC-1");
92
+ ```
93
+
94
+ ## Transactions
95
+
96
+ Asset wallets allow users to approve transactions. Use `SignerAgent` as a drop-in replacement for `HttpAgent` — it routes canister calls through the signer for user approval.
97
+
98
+ ```ts
99
+ import { Signer } from "@icp-sdk/signer";
100
+ import { PostMessageTransport } from "@icp-sdk/signer/web";
101
+ import { SignerAgent } from "@icp-sdk/signer/agent";
102
+
103
+ // Connect to an asset wallet
104
+ const transport = new PostMessageTransport({ url: "https://oisy.com/sign" });
105
+ const signer = new Signer({ transport });
106
+
107
+ // Get the user's accounts — some asset wallets return multiple (e.g. NFID),
108
+ // others only one (e.g. OISY).
109
+ // Each account has an `owner` (Principal) and an optional `subaccount`.
110
+ const accounts = await signer.getAccounts();
111
+ const account = accounts[0]; // Let the user choose if there are multiple
112
+
113
+ // Create an agent for the chosen account's principal.
114
+ // The agent only needs the owner — the principal that controls the account
115
+ // and on whose behalf canister calls are signed.
116
+ const agent = await SignerAgent.create({
117
+ signer,
118
+ account: account.owner,
119
+ });
120
+
121
+ // Use the agent with any canister library
122
+ import { IcrcLedgerCanister } from "@icp-sdk/canisters/ledger/icrc";
123
+
124
+ const icpLedger = IcrcLedgerCanister.create({
125
+ agent,
126
+ canisterId: ICP_LEDGER_CANISTER_ID,
127
+ });
128
+ await icpLedger.transfer({
129
+ to: TARGET_ACCOUNT,
130
+ amount: 100_000_000n,
131
+ });
132
+ ```
133
+
134
+ ## Authentication
135
+
136
+ Authentication providers issue delegations — temporary keys that can sign on behalf of the user. This is useful for session-based authentication where individual transaction approval is not needed.
137
+
138
+ ```ts
139
+ import { Signer } from "@icp-sdk/signer";
140
+ import { PostMessageTransport } from "@icp-sdk/signer/web";
141
+ import { ECDSAKeyIdentity, DelegationIdentity } from "@icp-sdk/core/identity";
142
+ import { HttpAgent } from "@icp-sdk/core/agent";
143
+
144
+ // Connect to an authentication provider
145
+ const transport = new PostMessageTransport({ url: "https://id.ai/authorize" });
146
+ const signer = new Signer({ transport });
147
+
148
+ // Create a session key and request a delegation
149
+ const sessionKey = await ECDSAKeyIdentity.generate();
150
+ const delegationChain = await signer.requestDelegation({
151
+ publicKey: sessionKey.getPublicKey().toDer(),
152
+ });
153
+
154
+ // Create a DelegationIdentity that can sign without further user interaction
155
+ const identity = DelegationIdentity.fromDelegation(sessionKey, delegationChain);
156
+ const agent = await HttpAgent.create({ identity });
157
+ ```
158
+
159
+ ## TypeScript
160
+
161
+ This package requires the `node16` (or later) [`moduleResolution`](https://www.typescriptlang.org/tsconfig#moduleResolution) strategy.
162
+
163
+ ## License
164
+
165
+ This project is licensed under the Apache-2.0 license.
@@ -0,0 +1,112 @@
1
+ import { type Agent, type ApiQueryResponse, type CallOptions, HttpAgent, type Identity, type QueryFields, type ReadStateOptions, type ReadStateResponse, type SubmitResponse, type UpdateResult } from '@icp-sdk/core/agent';
2
+ import { type JsonObject } from '@icp-sdk/core/candid';
3
+ import { Principal } from '@icp-sdk/core/principal';
4
+ import type { Signer, Transport } from '../index.js';
5
+ /** Options for creating a {@link SignerAgent}. */
6
+ export interface SignerAgentOptions<T extends Transport = Transport> {
7
+ /** The {@link Signer} used to send ICRC-49 canister call requests. */
8
+ signer: Signer<T>;
9
+ /** The principal of the account on whose behalf canister calls are made. */
10
+ account: Principal;
11
+ /**
12
+ * An {@link HttpAgent} used for fetching the root key and status.
13
+ * @default A new HttpAgent connected to the IC mainnet.
14
+ */
15
+ agent?: HttpAgent;
16
+ }
17
+ /**
18
+ * Error thrown by {@link SignerAgent} when a signer returns an invalid
19
+ * response or certificate validation fails.
20
+ */
21
+ export declare class SignerAgentError extends Error {
22
+ }
23
+ /**
24
+ * An {@link Agent} implementation that routes canister calls through a
25
+ * {@link Signer} for user approval. Drop-in replacement for {@link HttpAgent}
26
+ * when canister calls need to be signed by an external signer.
27
+ *
28
+ * Calls are sent to the signer via ICRC-49, and the returned content map
29
+ * and certificate are validated before being returned to the caller.
30
+ *
31
+ * Use {@link SignerAgent.create} or {@link SignerAgent.createSync} to
32
+ * construct an instance — the constructor is private.
33
+ * @example
34
+ * ```ts
35
+ * const agent = await SignerAgent.create({ signer, account });
36
+ * const result = await agent.update(canisterId, { methodName: "transfer", arg, effectiveCanisterId: canisterId });
37
+ * ```
38
+ */
39
+ export declare class SignerAgent<T extends Transport = Transport> implements Agent {
40
+ #private;
41
+ private constructor();
42
+ /** The root key used for certificate verification. */
43
+ get rootKey(): Uint8Array<ArrayBufferLike>;
44
+ /** The signer this agent routes calls through. */
45
+ get signer(): Signer<T>;
46
+ /**
47
+ * Creates a new SignerAgent, asynchronously initializing the
48
+ * underlying HttpAgent if one is not provided.
49
+ * @param options - The signer agent options.
50
+ */
51
+ static create<T extends Transport>(options: SignerAgentOptions<T>): Promise<SignerAgent<T>>;
52
+ /**
53
+ * Creates a new SignerAgent synchronously.
54
+ * Use this when you already have an HttpAgent or don't need async initialization.
55
+ * @param options - The signer agent options.
56
+ */
57
+ static createSync<T extends Transport>(options: SignerAgentOptions<T>): SignerAgent<T>;
58
+ /**
59
+ * Sends a canister call through the signer.
60
+ * Returns the request ID and a synthetic HTTP response.
61
+ * @param canisterId - The target canister principal or its text representation.
62
+ * @param fields - The call options including method name and arguments.
63
+ */
64
+ call(canisterId: Principal | string, fields: CallOptions): Promise<SubmitResponse>;
65
+ /**
66
+ * Executes a canister update call and returns the certified result.
67
+ * Combines {@link call} with certificate validation and reply extraction.
68
+ * @param canisterId - The target canister principal or its text representation.
69
+ * @param fields - The call options including method name and arguments.
70
+ * @param _pollingOptions - Ignored. The signer already returns the
71
+ * certificate with the reply in a single round-trip.
72
+ */
73
+ update(canisterId: Principal | string, fields: CallOptions, _pollingOptions?: unknown): Promise<UpdateResult>;
74
+ /**
75
+ * Executes a query by upgrading it to a canister call through the signer.
76
+ * The signer signs and submits the call, and the reply is extracted
77
+ * from the certified response.
78
+ * @param canisterId - The target canister principal or its text representation.
79
+ * @param options - The query fields including method name and arguments.
80
+ * @param _identity - Ignored. The signer manages identity internally.
81
+ */
82
+ query(canisterId: Principal | string, options: QueryFields, _identity?: Identity | Promise<Identity>): Promise<ApiQueryResponse>;
83
+ /** Fetches the IC root key via the underlying HttpAgent. */
84
+ fetchRootKey(): Promise<Uint8Array>;
85
+ /** Returns the account principal this agent makes calls on behalf of. */
86
+ getPrincipal(): Promise<Principal>;
87
+ /**
88
+ * @internal
89
+ * @param _options - The read state options.
90
+ * @param _identity - The identity to use for the request.
91
+ */
92
+ createReadStateRequest(_options: ReadStateOptions, _identity?: Identity): Promise<unknown>;
93
+ /**
94
+ * Returns the raw certificate for a previously completed call.
95
+ * The certificate is deleted after being read (single-use).
96
+ *
97
+ * Only supports `request_status` paths for request IDs that were
98
+ * returned by a prior {@link call}, {@link update}, or {@link query}.
99
+ * @param _canisterId - The target canister principal (unused).
100
+ * @param options - The read state options containing paths to look up.
101
+ * @param _identity - The identity to use (unused).
102
+ * @param _request - The request object (unused).
103
+ */
104
+ readState(_canisterId: Principal | string, options: ReadStateOptions, _identity?: Identity | Promise<Identity>, _request?: unknown): Promise<ReadStateResponse>;
105
+ /** Queries the IC replica status via the underlying HttpAgent. */
106
+ status(): Promise<JsonObject>;
107
+ /**
108
+ * Replaces the account principal used for subsequent calls.
109
+ * @param account - The new account principal to use for subsequent calls.
110
+ */
111
+ replaceAccount(account: Principal): void;
112
+ }