@fairmint/canton-node-sdk 0.0.286 → 0.0.288
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 +42 -7
- package/build/src/clients/ledger-json-api/index.d.ts +1 -1
- package/build/src/clients/ledger-json-api/index.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/index.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/utils/raw-frame-stream.d.ts +21 -1
- package/build/src/clients/ledger-json-api/operations/v2/utils/raw-frame-stream.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/utils/raw-frame-stream.js +13 -3
- package/build/src/clients/ledger-json-api/operations/v2/utils/raw-frame-stream.js.map +1 -1
- package/build/src/clients/scan-api/ScanApiClient.d.ts.map +1 -1
- package/build/src/clients/scan-api/ScanApiClient.js +2 -1
- package/build/src/clients/scan-api/ScanApiClient.js.map +1 -1
- package/build/src/core/http/HttpClient.d.ts.map +1 -1
- package/build/src/core/http/HttpClient.js +2 -1
- package/build/src/core/http/HttpClient.js.map +1 -1
- package/build/src/core/http/abort.d.ts +1 -3
- package/build/src/core/http/abort.d.ts.map +1 -1
- package/build/src/core/http/abort.js +6 -4
- package/build/src/core/http/abort.js.map +1 -1
- package/build/src/utils/external-signing/execute-external-transaction.d.ts +43 -10
- package/build/src/utils/external-signing/execute-external-transaction.d.ts.map +1 -1
- package/build/src/utils/external-signing/execute-external-transaction.js +42 -11
- package/build/src/utils/external-signing/execute-external-transaction.js.map +1 -1
- package/build/src/utils/external-signing/external-signing-client.d.ts +4 -0
- package/build/src/utils/external-signing/external-signing-client.d.ts.map +1 -1
- package/build/src/utils/external-signing/external-signing-client.js.map +1 -1
- package/build/src/wallets/abort.d.ts +17 -0
- package/build/src/wallets/abort.d.ts.map +1 -0
- package/build/src/wallets/abort.js +98 -0
- package/build/src/wallets/abort.js.map +1 -0
- package/build/src/wallets/cip103.d.ts +23 -2
- package/build/src/wallets/cip103.d.ts.map +1 -1
- package/build/src/wallets/cip103.js +107 -4
- package/build/src/wallets/cip103.js.map +1 -1
- package/build/src/wallets/da-utilities/client.d.ts +18 -9
- package/build/src/wallets/da-utilities/client.d.ts.map +1 -1
- package/build/src/wallets/da-utilities/client.js +33 -21
- package/build/src/wallets/da-utilities/client.js.map +1 -1
- package/build/src/wallets/discovery.d.ts +78 -0
- package/build/src/wallets/discovery.d.ts.map +1 -0
- package/build/src/wallets/discovery.js +364 -0
- package/build/src/wallets/discovery.js.map +1 -0
- package/build/src/wallets/errors.d.ts +64 -7
- package/build/src/wallets/errors.d.ts.map +1 -1
- package/build/src/wallets/errors.js +105 -9
- package/build/src/wallets/errors.js.map +1 -1
- package/build/src/wallets/index.d.ts +13 -5
- package/build/src/wallets/index.d.ts.map +1 -1
- package/build/src/wallets/index.js +21 -4
- package/build/src/wallets/index.js.map +1 -1
- package/build/src/wallets/ownership.d.ts +12 -0
- package/build/src/wallets/ownership.d.ts.map +1 -1
- package/build/src/wallets/ownership.js +29 -13
- package/build/src/wallets/ownership.js.map +1 -1
- package/build/src/wallets/session.d.ts +10 -2
- package/build/src/wallets/session.d.ts.map +1 -1
- package/build/src/wallets/session.js +186 -61
- package/build/src/wallets/session.js.map +1 -1
- package/build/src/wallets/store.d.ts +11 -3
- package/build/src/wallets/store.d.ts.map +1 -1
- package/build/src/wallets/store.js +25 -15
- package/build/src/wallets/store.js.map +1 -1
- package/build/src/wallets/wallet.d.ts +23 -12
- package/build/src/wallets/wallet.d.ts.map +1 -1
- package/build/src/wallets/wallet.js +76 -59
- package/build/src/wallets/wallet.js.map +1 -1
- package/package.json +107 -1
|
@@ -1,8 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/** Errors the wallets module throws. Each carries enough to decide whether a retry is safe. */
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.WalletError = exports.RegistryResponseError = exports.RegistryApiError = exports.WalletSignError = exports.WalletReadError = exports.WalletSubmitError = void 0;
|
|
4
|
+
exports.isWalletError = isWalletError;
|
|
5
|
+
exports.isWalletSubmitError = isWalletSubmitError;
|
|
6
|
+
exports.isWalletReadError = isWalletReadError;
|
|
7
|
+
exports.isWalletSignError = isWalletSignError;
|
|
8
|
+
exports.isRegistryApiError = isRegistryApiError;
|
|
9
|
+
exports.isRegistryResponseError = isRegistryResponseError;
|
|
10
|
+
exports.isWalletCancellation = isWalletCancellation;
|
|
5
11
|
exports.describeWalletError = describeWalletError;
|
|
12
|
+
/**
|
|
13
|
+
* Errors the wallets module throws. Each carries enough to decide whether a retry is safe.
|
|
14
|
+
*
|
|
15
|
+
* Match them with the guards (`isWalletError`, `isWalletSubmitError`, …), not `instanceof`: a page can load two copies
|
|
16
|
+
* of this module (two bundles, or two versions of the SDK), and an error thrown by one copy is not an `instanceof` the
|
|
17
|
+
* other copy's class. Every error class here carries a brand under a global symbol, which the guards check.
|
|
18
|
+
*/
|
|
19
|
+
const abort_1 = require("../core/http/abort");
|
|
20
|
+
const abort_2 = require("./abort");
|
|
21
|
+
/** The brand every wallets error carries: a non-enumerable property under a global (`Symbol.for`) symbol. */
|
|
22
|
+
const WALLET_ERROR_BRAND = Symbol.for('@fairmint/canton-node-sdk/wallets.error');
|
|
23
|
+
function brand(error, name) {
|
|
24
|
+
Object.defineProperty(error, WALLET_ERROR_BRAND, { value: name, enumerable: false });
|
|
25
|
+
}
|
|
26
|
+
/** Whether `error` carries the brand `name`; never throws (a hostile proxy or getter answers false). */
|
|
27
|
+
function branded(error, name) {
|
|
28
|
+
if (typeof error !== 'object' || error === null)
|
|
29
|
+
return false;
|
|
30
|
+
try {
|
|
31
|
+
return error[WALLET_ERROR_BRAND] === name;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
6
37
|
const UNKNOWN_HINT = 'The outcome is unknown: do not resubmit blindly; check the wallet for the result first.';
|
|
7
38
|
/** An `unknown` outcome's message: it warns against resubmitting and names the command id to look up, once each. */
|
|
8
39
|
function unknownMessage(message, commandId) {
|
|
@@ -15,7 +46,11 @@ class WalletSubmitError extends Error {
|
|
|
15
46
|
constructor(outcome, message, details = {}) {
|
|
16
47
|
super(outcome === 'unknown' ? unknownMessage(message, details.commandId) : message);
|
|
17
48
|
this.name = 'WalletSubmitError';
|
|
49
|
+
brand(this, 'WalletSubmitError');
|
|
18
50
|
this.outcome = outcome;
|
|
51
|
+
this.category = details.category ?? (outcome === 'rejected-by-user' ? 'user-rejected' : 'unknown');
|
|
52
|
+
if (details.cantonErrorId !== undefined)
|
|
53
|
+
this.cantonErrorId = details.cantonErrorId;
|
|
19
54
|
if (details.code !== undefined)
|
|
20
55
|
this.code = details.code;
|
|
21
56
|
if (details.commandId !== undefined)
|
|
@@ -32,6 +67,7 @@ class WalletReadError extends Error {
|
|
|
32
67
|
constructor(message, code) {
|
|
33
68
|
super(message);
|
|
34
69
|
this.name = 'WalletReadError';
|
|
70
|
+
brand(this, 'WalletReadError');
|
|
35
71
|
if (code !== undefined)
|
|
36
72
|
this.code = code;
|
|
37
73
|
this.rateLimited = code === LIMIT_EXCEEDED;
|
|
@@ -43,6 +79,7 @@ class WalletSignError extends Error {
|
|
|
43
79
|
constructor(reason, message, code) {
|
|
44
80
|
super(message);
|
|
45
81
|
this.name = 'WalletSignError';
|
|
82
|
+
brand(this, 'WalletSignError');
|
|
46
83
|
this.reason = reason;
|
|
47
84
|
if (code !== undefined)
|
|
48
85
|
this.code = code;
|
|
@@ -54,6 +91,7 @@ class RegistryApiError extends Error {
|
|
|
54
91
|
constructor(status, body, url) {
|
|
55
92
|
super(`Registry API ${status} for ${url}: ${body.slice(0, 500)}`);
|
|
56
93
|
this.name = 'RegistryApiError';
|
|
94
|
+
brand(this, 'RegistryApiError');
|
|
57
95
|
this.status = status;
|
|
58
96
|
this.body = body;
|
|
59
97
|
this.url = url;
|
|
@@ -65,6 +103,7 @@ class RegistryResponseError extends Error {
|
|
|
65
103
|
constructor(message) {
|
|
66
104
|
super(message);
|
|
67
105
|
this.name = 'RegistryResponseError';
|
|
106
|
+
brand(this, 'RegistryResponseError');
|
|
68
107
|
}
|
|
69
108
|
}
|
|
70
109
|
exports.RegistryResponseError = RegistryResponseError;
|
|
@@ -73,10 +112,53 @@ class WalletError extends Error {
|
|
|
73
112
|
constructor(code, message) {
|
|
74
113
|
super(message);
|
|
75
114
|
this.name = 'WalletError';
|
|
115
|
+
brand(this, 'WalletError');
|
|
76
116
|
this.code = code;
|
|
77
117
|
}
|
|
78
118
|
}
|
|
79
119
|
exports.WalletError = WalletError;
|
|
120
|
+
/** Whether `error` is a {@link WalletError} of any copy of this module (a brand check, not `instanceof`). */
|
|
121
|
+
function isWalletError(error) {
|
|
122
|
+
return error instanceof WalletError || branded(error, 'WalletError');
|
|
123
|
+
}
|
|
124
|
+
/** Whether `error` is a {@link WalletSubmitError} of any copy of this module (a brand check, not `instanceof`). */
|
|
125
|
+
function isWalletSubmitError(error) {
|
|
126
|
+
return error instanceof WalletSubmitError || branded(error, 'WalletSubmitError');
|
|
127
|
+
}
|
|
128
|
+
/** Whether `error` is a {@link WalletReadError} of any copy of this module (a brand check, not `instanceof`). */
|
|
129
|
+
function isWalletReadError(error) {
|
|
130
|
+
return error instanceof WalletReadError || branded(error, 'WalletReadError');
|
|
131
|
+
}
|
|
132
|
+
/** Whether `error` is a {@link WalletSignError} of any copy of this module (a brand check, not `instanceof`). */
|
|
133
|
+
function isWalletSignError(error) {
|
|
134
|
+
return error instanceof WalletSignError || branded(error, 'WalletSignError');
|
|
135
|
+
}
|
|
136
|
+
/** Whether `error` is a {@link RegistryApiError} of any copy of this module (a brand check, not `instanceof`). */
|
|
137
|
+
function isRegistryApiError(error) {
|
|
138
|
+
return error instanceof RegistryApiError || branded(error, 'RegistryApiError');
|
|
139
|
+
}
|
|
140
|
+
/** Whether `error` is a {@link RegistryResponseError} of any copy of this module (a brand check, not `instanceof`). */
|
|
141
|
+
function isRegistryResponseError(error) {
|
|
142
|
+
return error instanceof RegistryResponseError || branded(error, 'RegistryResponseError');
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Whether `error` is a cancellation: the `AbortError` an aborted `signal` makes a wallets call throw (also a
|
|
146
|
+
* `TimeoutError` from `AbortSignal.timeout`, which `fetch` passes through).
|
|
147
|
+
*/
|
|
148
|
+
function isWalletCancellation(error) {
|
|
149
|
+
if ((0, abort_1.isAbortError)(error))
|
|
150
|
+
return true;
|
|
151
|
+
// A `DOMException` from `AbortController` or `fetch`, possibly of another realm, so not matched by `instanceof`.
|
|
152
|
+
if (typeof error !== 'object' || error === null)
|
|
153
|
+
return false;
|
|
154
|
+
try {
|
|
155
|
+
const { name } = error;
|
|
156
|
+
return name === 'AbortError' || name === 'TimeoutError';
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
80
162
|
/** How many characters of a registry error body {@link describeWalletError} shows. */
|
|
81
163
|
const REGISTRY_BODY_CHARS = 300;
|
|
82
164
|
function described(kind, message, code) {
|
|
@@ -95,38 +177,52 @@ function thrownText(error) {
|
|
|
95
177
|
}
|
|
96
178
|
/** A user-facing sentence and a kind for any error the wallets module throws (or anything else thrown). */
|
|
97
179
|
function describeWalletError(error) {
|
|
98
|
-
if (error
|
|
180
|
+
if (isWalletSubmitError(error)) {
|
|
181
|
+
const submit = {
|
|
182
|
+
category: error.category,
|
|
183
|
+
...(error.cantonErrorId !== undefined && { cantonErrorId: error.cantonErrorId }),
|
|
184
|
+
};
|
|
99
185
|
switch (error.outcome) {
|
|
100
186
|
case 'rejected-by-user':
|
|
101
|
-
return
|
|
187
|
+
return {
|
|
188
|
+
...described('declined', 'You declined in the wallet. Nothing was submitted.', error.code),
|
|
189
|
+
...submit,
|
|
190
|
+
};
|
|
102
191
|
case 'failed':
|
|
103
|
-
return described('not-committed', `Not committed: ${error.message}`, error.code);
|
|
192
|
+
return { ...described('not-committed', `Not committed: ${error.message}`, error.code), ...submit };
|
|
104
193
|
case 'unknown':
|
|
105
194
|
// The message already says not to resubmit blindly, and names the command id.
|
|
106
195
|
return {
|
|
107
196
|
...described('outcome-unknown', error.message, error.code),
|
|
108
197
|
...(error.commandId !== undefined && { commandId: error.commandId }),
|
|
109
198
|
...(error.burnReference !== undefined && { burnReference: error.burnReference }),
|
|
199
|
+
...submit,
|
|
110
200
|
};
|
|
111
201
|
}
|
|
112
202
|
}
|
|
113
|
-
if (error
|
|
203
|
+
if (isWalletReadError(error)) {
|
|
114
204
|
return error.rateLimited
|
|
115
205
|
? described('rate-limited', `The wallet is limiting how often this page reads the ledger (CIP-0103 -32005), and it still refused after a few retries. Wait a moment, then retry. Details: ${error.message}`, error.code)
|
|
116
206
|
: described('read-failed', `The wallet did not answer a read: ${error.message}`, error.code);
|
|
117
207
|
}
|
|
118
|
-
if (error
|
|
208
|
+
if (isWalletSignError(error)) {
|
|
119
209
|
return error.reason === 'rejected-by-user'
|
|
120
210
|
? described('declined', 'You declined to sign in the wallet. Nothing was verified.', error.code)
|
|
121
211
|
: described('sign-failed', `The wallet did not sign: ${error.message}`, error.code);
|
|
122
212
|
}
|
|
123
|
-
if (error
|
|
213
|
+
if (isRegistryApiError(error)) {
|
|
124
214
|
return described('registry', `DA's registry answered ${error.status}: ${error.body.slice(0, REGISTRY_BODY_CHARS)}`, error.status);
|
|
125
215
|
}
|
|
126
|
-
if (error
|
|
216
|
+
if (isRegistryResponseError(error))
|
|
127
217
|
return described('registry', error.message);
|
|
128
|
-
if (error
|
|
218
|
+
if (isWalletError(error))
|
|
129
219
|
return described('refused', error.message, error.code);
|
|
220
|
+
if ((0, abort_2.isCancelledBeforeSubmit)(error))
|
|
221
|
+
return described('cancelled', 'Cancelled. Nothing was submitted.');
|
|
222
|
+
// A foreign `AbortError` or `TimeoutError` (a wallet's, or `fetch`'s) may have been raised after a submission was sent.
|
|
223
|
+
if (isWalletCancellation(error)) {
|
|
224
|
+
return described('cancelled', 'Cancelled; this does not say whether anything was submitted.');
|
|
225
|
+
}
|
|
130
226
|
if (error instanceof Error)
|
|
131
227
|
return described('other', error.message);
|
|
132
228
|
return described('other', thrownText(error));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/wallets/errors.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/wallets/errors.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;GAMG;AACH,8CAAkD;AAClD,mCAAkD;AAElD,6GAA6G;AAC7G,MAAM,kBAAkB,GAAW,MAAM,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AAUzF,SAAS,KAAK,CAAC,KAAY,EAAE,IAA0B;IACrD,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AACvF,CAAC;AAED,wGAAwG;AACxG,SAAS,OAAO,CAAC,KAAc,EAAE,IAA0B;IACzD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,CAAC;QACH,OAAQ,KAAiC,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IACzE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AASD,MAAM,YAAY,GAAG,yFAAyF,CAAC;AAE/G,oHAAoH;AACpH,SAAS,cAAc,CAAC,OAAe,EAAE,SAA6B;IACpE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,YAAY,EAAE,CAAC;IACvF,MAAM,WAAW,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,SAAS,GAAG,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C;QAC9B,OAAO,SAAS,CACd,UAAU,EACV,0BAA0B,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,EAAE,EACrF,KAAK,CAAC,MAAM,CACb,CAAC;IACJ,CAAC;IACD,IAAI,uBAAuB,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAChF,IAAI,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACjF,IAAI,IAAA,+BAAuB,EAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC,WAAW,EAAE,mCAAmC,CAAC,CAAC;IACvG,wHAAwH;IACxH,IAAI,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC,WAAW,EAAE,8DAA8D,CAAC,CAAC;IAChG,CAAC;IACD,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrE,OAAO,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Browser-safe DA Utility Registry holder actions through any CIP-0103 (Canton dApp API) wallet provider. In a browser
|
|
3
|
-
* bundle import `@fairmint/canton-node-sdk/
|
|
4
|
-
*
|
|
3
|
+
* bundle import `@fairmint/canton-node-sdk/wallets`, which loads none of the SDK's Node dependencies (the deep path
|
|
4
|
+
* `@fairmint/canton-node-sdk/build/src/wallets/index.js` still works); the package root also exports it as the
|
|
5
|
+
* `Wallets` namespace (for Node).
|
|
5
6
|
*
|
|
7
|
+
* - `discoverCip103Wallets()`: the CIP-0103 wallet extensions installed in the browser, each with `load(network)` that
|
|
8
|
+
* resolves its provider (the dApp SDK's announce handshake and message channel, no dependency).
|
|
6
9
|
* - `createCip103Session({ network })`: which wallet is connected, as which party (`connect`, `restore`, `disconnect`).
|
|
7
10
|
* - `createWalletStore({ session })`: the page's observable state, typed actions (`act`), notices to show.
|
|
8
11
|
* - `createWallet(...)`: one party's token actions, for code that does not need the store.
|
|
9
12
|
* - The ownership proof's browser half (`requestWalletOwnershipVerdict`); the server half
|
|
10
13
|
* (`createWalletOwnershipChallenger`, `verifyWalletOwnership`) is Node-only and exported from the package root.
|
|
11
|
-
* - The errors, their
|
|
14
|
+
* - The errors, their guards (`isWalletError`, `isWalletSubmitError`, …: they match errors of any copy of this module,
|
|
15
|
+
* where `instanceof` does not), their user-facing descriptions (`describeWalletError`), and the data types.
|
|
16
|
+
* - Cancellation: every call that reads, fetches or acts takes an optional `signal` (`WalletCallOptions`):
|
|
17
|
+
* `WalletStore.act`, `Cip103Session.connect` and `restore`, `DiscoveredWallet.load` included. `WalletStore.dispose()`
|
|
18
|
+
* cancels the store's own work in flight the same way.
|
|
12
19
|
*/
|
|
13
20
|
export { createCip103Session, type Cip103Session, type Cip103SessionOptions, type Cip103SessionState, type ConnectedWallet, } from './session';
|
|
14
21
|
export { canAct, createWalletStore, walletActionKey, type ActionOutcome, type ActionResultOf, type UnknownOutcome, type WalletAction, type WalletActionResults, type WalletNotice, type WalletStore, type WalletStoreOptions, type WalletView, } from './store';
|
|
15
|
-
export { createWallet, type BurnRequestOptions, type BurnRequestResult, type TransferOffers, type TransferPlan, type TransferPreapprovalOptions, type TransferRequest, type TransferResult, type Wallet, type WalletOptions, type WalletState, } from './wallet';
|
|
22
|
+
export { createWallet, type BurnRequestOptions, type BurnRequestResult, type TransferOffers, type TransferPlan, type TransferPreapprovalOptions, type TransferRequest, type TransferResult, type Wallet, type WalletCallOptions, type WalletOptions, type WalletState, } from './wallet';
|
|
16
23
|
export type { Cip103Connection, Cip103EventListener, Cip103Provider, Cip103Request } from './cip103';
|
|
24
|
+
export { discoverCip103Wallets, INJECTED_WALLET_ID, type Cip103DiscoveryHost, type DiscoverCip103WalletsOptions, type DiscoveredWallet, } from './discovery';
|
|
17
25
|
export { buildWalletOwnershipMessage, proveWalletOwnership, requestWalletOwnershipVerdict, type ProveWalletOwnershipOptions, type RequestWalletOwnershipVerdictOptions, type WalletOwnershipChallenge, type WalletOwnershipChallengeFailure, type WalletOwnershipChallengeResponse, type WalletOwnershipFailure, type WalletOwnershipMessageFields, type WalletOwnershipProof, type WalletOwnershipVerdict, } from './ownership';
|
|
18
26
|
export type { DaNetwork, DaRegistryOptions, FetchLike, TransferKind } from './da-utilities/client';
|
|
19
|
-
export { describeWalletError, RegistryApiError, RegistryResponseError, WalletError, WalletReadError, WalletSignError, WalletSubmitError, type WalletErrorCode, type WalletErrorDescription, type WalletSignErrorReason, type WalletSubmitOutcome, } from './errors';
|
|
27
|
+
export { describeWalletError, isRegistryApiError, isRegistryResponseError, isWalletCancellation, isWalletError, isWalletReadError, isWalletSignError, isWalletSubmitError, RegistryApiError, RegistryResponseError, WalletError, WalletReadError, WalletSignError, WalletSubmitError, type WalletErrorCode, type WalletErrorDescription, type WalletSignErrorReason, type WalletSubmitCategory, type WalletSubmitErrorDetails, type WalletSubmitOutcome, } from './errors';
|
|
20
28
|
export type { BurnRequest, MintOffer, TransferOffer, TransferPreapproval } from './contracts';
|
|
21
29
|
export type { Holding, InstrumentBalance, InstrumentMetadata } from './holdings';
|
|
22
30
|
export type { InstrumentId, SubmitResult } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wallets/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wallets/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EACL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,oBAAoB,E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B,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,GACzB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9F,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACjF,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseDecimalUnits = exports.formatDecimalUnits = exports.WalletSubmitError = exports.WalletSignError = exports.WalletReadError = exports.WalletError = exports.RegistryResponseError = exports.RegistryApiError = exports.describeWalletError = exports.requestWalletOwnershipVerdict = exports.proveWalletOwnership = exports.buildWalletOwnershipMessage = exports.createWallet = exports.walletActionKey = exports.createWalletStore = exports.canAct = exports.createCip103Session = void 0;
|
|
3
|
+
exports.parseDecimalUnits = exports.formatDecimalUnits = exports.WalletSubmitError = exports.WalletSignError = exports.WalletReadError = exports.WalletError = exports.RegistryResponseError = exports.RegistryApiError = exports.isWalletSubmitError = exports.isWalletSignError = exports.isWalletReadError = exports.isWalletError = exports.isWalletCancellation = exports.isRegistryResponseError = exports.isRegistryApiError = exports.describeWalletError = exports.requestWalletOwnershipVerdict = exports.proveWalletOwnership = exports.buildWalletOwnershipMessage = exports.INJECTED_WALLET_ID = exports.discoverCip103Wallets = exports.createWallet = exports.walletActionKey = exports.createWalletStore = exports.canAct = exports.createCip103Session = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Browser-safe DA Utility Registry holder actions through any CIP-0103 (Canton dApp API) wallet provider. In a browser
|
|
6
|
-
* bundle import `@fairmint/canton-node-sdk/
|
|
7
|
-
*
|
|
6
|
+
* bundle import `@fairmint/canton-node-sdk/wallets`, which loads none of the SDK's Node dependencies (the deep path
|
|
7
|
+
* `@fairmint/canton-node-sdk/build/src/wallets/index.js` still works); the package root also exports it as the
|
|
8
|
+
* `Wallets` namespace (for Node).
|
|
8
9
|
*
|
|
10
|
+
* - `discoverCip103Wallets()`: the CIP-0103 wallet extensions installed in the browser, each with `load(network)` that
|
|
11
|
+
* resolves its provider (the dApp SDK's announce handshake and message channel, no dependency).
|
|
9
12
|
* - `createCip103Session({ network })`: which wallet is connected, as which party (`connect`, `restore`, `disconnect`).
|
|
10
13
|
* - `createWalletStore({ session })`: the page's observable state, typed actions (`act`), notices to show.
|
|
11
14
|
* - `createWallet(...)`: one party's token actions, for code that does not need the store.
|
|
12
15
|
* - The ownership proof's browser half (`requestWalletOwnershipVerdict`); the server half
|
|
13
16
|
* (`createWalletOwnershipChallenger`, `verifyWalletOwnership`) is Node-only and exported from the package root.
|
|
14
|
-
* - The errors, their
|
|
17
|
+
* - The errors, their guards (`isWalletError`, `isWalletSubmitError`, …: they match errors of any copy of this module,
|
|
18
|
+
* where `instanceof` does not), their user-facing descriptions (`describeWalletError`), and the data types.
|
|
19
|
+
* - Cancellation: every call that reads, fetches or acts takes an optional `signal` (`WalletCallOptions`):
|
|
20
|
+
* `WalletStore.act`, `Cip103Session.connect` and `restore`, `DiscoveredWallet.load` included. `WalletStore.dispose()`
|
|
21
|
+
* cancels the store's own work in flight the same way.
|
|
15
22
|
*/
|
|
16
23
|
var session_1 = require("./session");
|
|
17
24
|
Object.defineProperty(exports, "createCip103Session", { enumerable: true, get: function () { return session_1.createCip103Session; } });
|
|
@@ -21,12 +28,22 @@ Object.defineProperty(exports, "createWalletStore", { enumerable: true, get: fun
|
|
|
21
28
|
Object.defineProperty(exports, "walletActionKey", { enumerable: true, get: function () { return store_1.walletActionKey; } });
|
|
22
29
|
var wallet_1 = require("./wallet");
|
|
23
30
|
Object.defineProperty(exports, "createWallet", { enumerable: true, get: function () { return wallet_1.createWallet; } });
|
|
31
|
+
var discovery_1 = require("./discovery");
|
|
32
|
+
Object.defineProperty(exports, "discoverCip103Wallets", { enumerable: true, get: function () { return discovery_1.discoverCip103Wallets; } });
|
|
33
|
+
Object.defineProperty(exports, "INJECTED_WALLET_ID", { enumerable: true, get: function () { return discovery_1.INJECTED_WALLET_ID; } });
|
|
24
34
|
var ownership_1 = require("./ownership");
|
|
25
35
|
Object.defineProperty(exports, "buildWalletOwnershipMessage", { enumerable: true, get: function () { return ownership_1.buildWalletOwnershipMessage; } });
|
|
26
36
|
Object.defineProperty(exports, "proveWalletOwnership", { enumerable: true, get: function () { return ownership_1.proveWalletOwnership; } });
|
|
27
37
|
Object.defineProperty(exports, "requestWalletOwnershipVerdict", { enumerable: true, get: function () { return ownership_1.requestWalletOwnershipVerdict; } });
|
|
28
38
|
var errors_1 = require("./errors");
|
|
29
39
|
Object.defineProperty(exports, "describeWalletError", { enumerable: true, get: function () { return errors_1.describeWalletError; } });
|
|
40
|
+
Object.defineProperty(exports, "isRegistryApiError", { enumerable: true, get: function () { return errors_1.isRegistryApiError; } });
|
|
41
|
+
Object.defineProperty(exports, "isRegistryResponseError", { enumerable: true, get: function () { return errors_1.isRegistryResponseError; } });
|
|
42
|
+
Object.defineProperty(exports, "isWalletCancellation", { enumerable: true, get: function () { return errors_1.isWalletCancellation; } });
|
|
43
|
+
Object.defineProperty(exports, "isWalletError", { enumerable: true, get: function () { return errors_1.isWalletError; } });
|
|
44
|
+
Object.defineProperty(exports, "isWalletReadError", { enumerable: true, get: function () { return errors_1.isWalletReadError; } });
|
|
45
|
+
Object.defineProperty(exports, "isWalletSignError", { enumerable: true, get: function () { return errors_1.isWalletSignError; } });
|
|
46
|
+
Object.defineProperty(exports, "isWalletSubmitError", { enumerable: true, get: function () { return errors_1.isWalletSubmitError; } });
|
|
30
47
|
Object.defineProperty(exports, "RegistryApiError", { enumerable: true, get: function () { return errors_1.RegistryApiError; } });
|
|
31
48
|
Object.defineProperty(exports, "RegistryResponseError", { enumerable: true, get: function () { return errors_1.RegistryResponseError; } });
|
|
32
49
|
Object.defineProperty(exports, "WalletError", { enumerable: true, get: function () { return errors_1.WalletError; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wallets/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wallets/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,qCAMmB;AALjB,8GAAA,mBAAmB,OAAA;AAMrB,iCAaiB;AAZf,+FAAA,MAAM,OAAA;AACN,0GAAA,iBAAiB,OAAA;AACjB,wGAAA,eAAe,OAAA;AAWjB,mCAakB;AAZhB,sGAAA,YAAY,OAAA;AAcd,yCAMqB;AALnB,kHAAA,qBAAqB,OAAA;AACrB,+GAAA,kBAAkB,OAAA;AAKpB,yCAaqB;AAZnB,wHAAA,2BAA2B,OAAA;AAC3B,iHAAA,oBAAoB,OAAA;AACpB,0HAAA,6BAA6B,OAAA;AAY/B,mCAqBkB;AApBhB,6GAAA,mBAAmB,OAAA;AACnB,4GAAA,kBAAkB,OAAA;AAClB,iHAAA,uBAAuB,OAAA;AACvB,8GAAA,oBAAoB,OAAA;AACpB,uGAAA,aAAa,OAAA;AACb,2GAAA,iBAAiB,OAAA;AACjB,2GAAA,iBAAiB,OAAA;AACjB,6GAAA,mBAAmB,OAAA;AACnB,0GAAA,gBAAgB,OAAA;AAChB,+GAAA,qBAAqB,OAAA;AACrB,qGAAA,WAAW,OAAA;AACX,yGAAA,eAAe,OAAA;AACf,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AAWnB,qCAAkE;AAAzD,6GAAA,kBAAkB,OAAA;AAAE,4GAAA,iBAAiB,OAAA"}
|
|
@@ -70,6 +70,12 @@ export interface ProveWalletOwnershipOptions {
|
|
|
70
70
|
readonly challenge: WalletOwnershipChallenge;
|
|
71
71
|
/** Defaults to the system clock; an expired challenge is refused before anything is signed. */
|
|
72
72
|
readonly now?: () => Date;
|
|
73
|
+
/**
|
|
74
|
+
* Cancels the proof: once aborted, the call rejects with an `AbortError` and the wallet is not asked to sign. A
|
|
75
|
+
* signature request already shown to the user is not withdrawn (CIP-0103 has no cancellation); its answer is
|
|
76
|
+
* ignored.
|
|
77
|
+
*/
|
|
78
|
+
readonly signal?: AbortSignal;
|
|
73
79
|
}
|
|
74
80
|
/**
|
|
75
81
|
* Ask the wallet to sign the ownership message for the challenge, as the connection's party. CIP-0103 wallets sign with
|
|
@@ -138,6 +144,12 @@ export interface RequestWalletOwnershipVerdictOptions {
|
|
|
138
144
|
readonly challengeUrl: string;
|
|
139
145
|
/** Answers `POST { token, proof }` with `{ data: WalletOwnershipVerdict }`. */
|
|
140
146
|
readonly verifyUrl: string;
|
|
147
|
+
/**
|
|
148
|
+
* Cancels the check (for example when the user leaves the page): once aborted, the call rejects with an `AbortError`,
|
|
149
|
+
* the requests in flight get the signal, and nothing more is sent. A signature request already shown to the user is
|
|
150
|
+
* not withdrawn (CIP-0103 has no cancellation); a proof signed after the abort is never sent.
|
|
151
|
+
*/
|
|
152
|
+
readonly signal?: AbortSignal;
|
|
141
153
|
}
|
|
142
154
|
/**
|
|
143
155
|
* The browser half of an ownership check, against a server that uses the SDK's challenger (or the same wire format: a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../../../src/wallets/ownership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAOL,KAAK,gBAAgB,EACtB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ownership.d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,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,uCAAuC;AACvC,MAAM,MAAM,sBAAsB,GAC9B;IACE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oEAAoE;IACpE,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,8FAA8F;IAC9F,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GACD;IACE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,+BAA+B,GAAG,sBAAsB,CAAC;IAC1E,uCAAuC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEN,MAAM,WAAW,oCAAoC;IACnD,iHAAiH;IACjH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAC3B,6FAA6F;IAC7F,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAmDD;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,gBAAgB,EAC5B,OAAO,EAAE,oCAAoC,GAC5C,OAAO,CAAC,sBAAsB,CAAC,CAuBjC"}
|
|
@@ -24,6 +24,8 @@ exports.requestWalletOwnershipVerdict = requestWalletOwnershipVerdict;
|
|
|
24
24
|
* network proven must look the party up on that network (its Scan or ledger party and topology APIs).
|
|
25
25
|
*/
|
|
26
26
|
const cip103_1 = require("./cip103");
|
|
27
|
+
const abort_1 = require("./abort");
|
|
28
|
+
const abort_2 = require("../core/http/abort");
|
|
27
29
|
const client_1 = require("./da-utilities/client");
|
|
28
30
|
const errors_1 = require("./errors");
|
|
29
31
|
const json_1 = require("./json");
|
|
@@ -156,8 +158,9 @@ function readSignature(raw) {
|
|
|
156
158
|
*/
|
|
157
159
|
async function proveWalletOwnership(connection, options) {
|
|
158
160
|
const { provider, partyId, network } = connection;
|
|
159
|
-
const { challenge } = options;
|
|
160
|
-
|
|
161
|
+
const { challenge, signal } = options;
|
|
162
|
+
(0, abort_1.throwIfAborted)(signal);
|
|
163
|
+
const account = await (0, abort_1.awaitWithAbort)(async () => (0, cip103_1.primaryAccount)(provider, { signal }), signal);
|
|
161
164
|
if (account.partyId !== partyId) {
|
|
162
165
|
throw new errors_1.WalletSignError('invalid-challenge', `The wallet's primary account is ${account.partyId}, not ${partyId}; switch accounts in the wallet first`);
|
|
163
166
|
}
|
|
@@ -189,11 +192,14 @@ async function proveWalletOwnership(connection, options) {
|
|
|
189
192
|
if (!(now < Date.parse(challenge.expiresAt))) {
|
|
190
193
|
throw new errors_1.WalletSignError('invalid-challenge', 'The ownership challenge has expired; ask the server for a new one');
|
|
191
194
|
}
|
|
195
|
+
(0, abort_1.throwIfAborted)(signal);
|
|
192
196
|
let raw;
|
|
193
197
|
try {
|
|
194
|
-
raw = await provider.request({ method: 'signMessage', params: { message } });
|
|
198
|
+
raw = await (0, abort_2.awaitWithAbort)(async () => provider.request({ method: 'signMessage', params: { message } }, { signal }), signal);
|
|
195
199
|
}
|
|
196
200
|
catch (error) {
|
|
201
|
+
if (signal?.aborted === true)
|
|
202
|
+
throw error;
|
|
197
203
|
const code = (0, cip103_1.cip103ErrorCode)(error);
|
|
198
204
|
if (code === cip103_1.CIP103_ERROR_CODES.userRejected) {
|
|
199
205
|
throw new errors_1.WalletSignError('rejected-by-user', `The user declined to sign the ownership message: ${(0, cip103_1.describeError)(error)}`, code);
|
|
@@ -226,15 +232,23 @@ function isWalletOwnershipVerdict(value, partyId) {
|
|
|
226
232
|
return value['verified'] === false && typeof value['reason'] === 'string' && typeof value['message'] === 'string';
|
|
227
233
|
}
|
|
228
234
|
/** POST `body` as JSON and return the response's `data`; throws on a non-2xx answer or one without `data`. */
|
|
229
|
-
async function postForData(fetch, url, body
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
})
|
|
235
|
+
async function postForData(fetch, url, body, signal,
|
|
236
|
+
/** Whether the request carries the signed proof: an abort after it is sent is not a cancellation before submit. */
|
|
237
|
+
carriesProof) {
|
|
238
|
+
(0, abort_1.throwIfAborted)(signal);
|
|
239
|
+
const race = carriesProof ? abort_2.awaitWithAbort : abort_1.awaitWithAbort;
|
|
240
|
+
const { response, text } = await race(async () => {
|
|
241
|
+
const answer = await fetch(url, {
|
|
242
|
+
method: 'POST',
|
|
243
|
+
headers: { 'content-type': 'application/json' },
|
|
244
|
+
body: JSON.stringify(body),
|
|
245
|
+
...(signal !== undefined && { signal }),
|
|
246
|
+
});
|
|
247
|
+
return { response: answer, text: await answer.text() };
|
|
248
|
+
}, signal);
|
|
235
249
|
let json;
|
|
236
250
|
try {
|
|
237
|
-
json = JSON.parse(
|
|
251
|
+
json = JSON.parse(text);
|
|
238
252
|
}
|
|
239
253
|
catch {
|
|
240
254
|
json = undefined;
|
|
@@ -256,7 +270,9 @@ async function postForData(fetch, url, body) {
|
|
|
256
270
|
async function requestWalletOwnershipVerdict(connection, options) {
|
|
257
271
|
const { partyId, network } = connection;
|
|
258
272
|
const send = options.fetch ?? (0, client_1.globalFetch)('{ fetch } to requestWalletOwnershipVerdict');
|
|
259
|
-
const
|
|
273
|
+
const { signal } = options;
|
|
274
|
+
(0, abort_1.throwIfAborted)(signal);
|
|
275
|
+
const issued = await postForData(send, options.challengeUrl, { network, partyId }, signal, false);
|
|
260
276
|
if (!(0, json_1.isRecord)(issued) || !(0, json_1.isRecord)(issued['challenge']) || typeof issued['token'] !== 'string') {
|
|
261
277
|
throw new Error('The server answered the ownership challenge request without { challenge, token }');
|
|
262
278
|
}
|
|
@@ -265,8 +281,8 @@ async function requestWalletOwnershipVerdict(connection, options) {
|
|
|
265
281
|
if (challenge.network !== (0, cip103_1.cip103NetworkId)(network)) {
|
|
266
282
|
throw new errors_1.WalletSignError('invalid-challenge', `The server issued a challenge for ${String(challenge.network)}, not ${(0, cip103_1.cip103NetworkId)(network)}`);
|
|
267
283
|
}
|
|
268
|
-
const proof = await proveWalletOwnership(connection, { challenge });
|
|
269
|
-
const verdict = await postForData(send, options.verifyUrl, { token: issued['token'], proof });
|
|
284
|
+
const proof = await proveWalletOwnership(connection, { challenge, ...(signal !== undefined && { signal }) });
|
|
285
|
+
const verdict = await postForData(send, options.verifyUrl, { token: issued['token'], proof }, signal, true);
|
|
270
286
|
if (!isWalletOwnershipVerdict(verdict, partyId)) {
|
|
271
287
|
throw new Error('The server answered the ownership proof without a well-formed verdict for the party');
|
|
272
288
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ownership.js","sourceRoot":"","sources":["../../../src/wallets/ownership.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,qCAQkB;AAClB,kDAAoE;AACpE,qCAA4D;AAC5D,iCAAkD;AAElD,iDAAiD;AACpC,QAAA,sBAAsB,GAAG,+BAA+B,CAAC;AACtE,uDAAuD;AAC1C,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAmC5C,MAAM,cAAc,GAAG,mEAAmE,CAAC;AAC3F,MAAM,aAAa,GAAG,2BAA2B,CAAC;AAClD,sCAAsC;AACtC,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,WAAW,GAAG,+CAA+C,CAAC;AAEpE,sFAAsF;AACtF,iCAAwC,KAAc;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,0GAA0G;AAC1G,kCAAyC,KAAc;IACrD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,aAAa,CA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AC;IACtG,CAAC;IACD,qEAAqE;IACrE,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAwC,CAAC;IAC7E,IAAI,SAAS,CAAC,OAAO,KAAK,IAAA,wBAAe,EAAC,OAAO,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,wBAAe,CACvB,mBAAmB,EACnB,qCAAqC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,IAAA,wBAAe,EAAC,OAAO,CAAC,EAAE,CAClG,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,oBAAoB,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7G,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5G,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAC;IACzG,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Cip103Connection, type Cip103Provider } from './cip103';
|
|
2
2
|
import type { DaNetwork } from './da-utilities/client';
|
|
3
3
|
import { type WalletErrorDescription } from './errors';
|
|
4
|
+
import type { WalletCallOptions } from './wallet';
|
|
4
5
|
/** A connected wallet. Each session is one object: compare by identity to tell a live session from an ended one. */
|
|
5
6
|
export interface ConnectedWallet extends Cip103Connection {
|
|
6
7
|
/**
|
|
@@ -37,16 +38,23 @@ export interface Cip103Session {
|
|
|
37
38
|
* `connecting`, waits for a disconnect of this wallet still in flight, sends CIP-0103 `connect` (the wallet's own
|
|
38
39
|
* sign-in), then reads the primary account (`getPrimaryAccount`). A failure becomes `error` (4001: declined).
|
|
39
40
|
* Resolves when it settled; superseded by a newer `connect()`, `disconnect()`, `fail()` or `dispose()`.
|
|
41
|
+
* `options.signal` cancels it: the call rejects with an `AbortError` and, when it was still the session's pending
|
|
42
|
+
* connect, the session disconnects as `disconnect()` does (the wallet's own prompt cannot be closed from here). When
|
|
43
|
+
* the wallet signed in but its account was refused (another network, no account) and nothing newer changed the
|
|
44
|
+
* session since, the wallet is signed out and kept out of `restore()` all the same, and the session keeps that
|
|
45
|
+
* error.
|
|
40
46
|
*/
|
|
41
|
-
connect(provider: Cip103Provider): Promise<void>;
|
|
47
|
+
connect(provider: Cip103Provider, options?: WalletCallOptions): Promise<void>;
|
|
42
48
|
/**
|
|
43
49
|
* On page load: when the session is disconnected and the wallet answers CIP-0103 `isConnected` with `{ isConnected:
|
|
44
50
|
* true }`, reads the primary account and connects silently. It never publishes an error: any failure (4200 included)
|
|
45
51
|
* leaves the session as it was. Ignored while connecting or connected, and for a wallet the user signed out of
|
|
46
52
|
* (`disconnect()`, or a switch to another wallet) until `connect()` signs in to it again, also when the wallet still
|
|
47
53
|
* reports a session; dropped when anything else changed the session meanwhile, or a newer `restore()` started.
|
|
54
|
+
* `options.signal` cancels it: the call rejects with an `AbortError` and the restore is dropped (the session is not
|
|
55
|
+
* changed).
|
|
48
56
|
*/
|
|
49
|
-
restore(provider: Cip103Provider): Promise<void>;
|
|
57
|
+
restore(provider: Cip103Provider, options?: WalletCallOptions): Promise<void>;
|
|
50
58
|
/**
|
|
51
59
|
* The user disconnected: sends CIP-0103 `disconnect` (best-effort) to the wallets the session is on (the connected
|
|
52
60
|
* one, and the one a pending `connect()` signs in to), then publishes `disconnected`. A later `connect()` to such a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/wallets/session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["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