@meshconnect/uwc-types 0.30.1 → 0.32.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/dist/connector.d.ts +17 -0
- package/dist/connector.d.ts.map +1 -1
- package/dist/errors.d.ts +18 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +17 -0
- package/dist/errors.js.map +1 -1
- package/dist/observability.d.ts +7 -1
- package/dist/observability.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/connector.ts +17 -0
- package/src/errors.ts +25 -0
- package/src/observability.ts +6 -0
package/dist/connector.d.ts
CHANGED
|
@@ -76,6 +76,23 @@ export interface ConnectorConnectOptions {
|
|
|
76
76
|
* or omitted list means no constraint.
|
|
77
77
|
*/
|
|
78
78
|
requiredAddresses?: readonly string[];
|
|
79
|
+
/**
|
|
80
|
+
* Connect ONLY if the wallet already trusts this origin — never prompt.
|
|
81
|
+
*
|
|
82
|
+
* When true, a connector must run its non-prompting checks alone (EVM
|
|
83
|
+
* `eth_accounts`, an account a Wallet Standard wallet already exposes to
|
|
84
|
+
* this origin, …) and must not fall through to any call that
|
|
85
|
+
* can open the wallet's approval UI, for the target namespace or for any
|
|
86
|
+
* secondary-namespace gather. When the target namespace is not already
|
|
87
|
+
* authorized it rejects with {@link WalletNotAuthorizedError}.
|
|
88
|
+
*
|
|
89
|
+
* For callers that connect without a user gesture (e.g. restoring a returning
|
|
90
|
+
* user's wallet on page load), where an unprompted popup is worse than not
|
|
91
|
+
* connecting. Honoured by the injected connector only; every other connector
|
|
92
|
+
* rejects it with a plain `Error` (a caller bug, not an expected miss) before
|
|
93
|
+
* reaching the wallet. Omitted or false: unchanged behaviour.
|
|
94
|
+
*/
|
|
95
|
+
silentOnly?: boolean;
|
|
79
96
|
}
|
|
80
97
|
/**
|
|
81
98
|
* Common interface for all wallet connectors
|
package/dist/connector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector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,iBAAiB,CAAC,CAChB,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,EACtC,OAAO,EAAE,sBAAsB,GAC9B,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;IAE3B;;;;;;OAMG;IACH,cAAc,CAAC,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CAC9D"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ export interface WalletError {
|
|
|
9
9
|
* `provider_error`) without inferring anything from the message.
|
|
10
10
|
*/
|
|
11
11
|
code?: number;
|
|
12
|
+
/**
|
|
13
|
+
* The wallet's own rejection text, when a library wrapper (viem) replaced it
|
|
14
|
+
* with a generic message. Trust Wallet Android, for example, rejects with the
|
|
15
|
+
* bare string `"cancelled"`, which viem reports as "An unknown RPC error
|
|
16
|
+
* occurred." with the original kept only in `cause`. Scrubbed before telemetry.
|
|
17
|
+
*/
|
|
18
|
+
providerReason?: string;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* Custom error class that includes wallet error metadata
|
|
@@ -18,6 +25,8 @@ export declare class WalletConnectorError extends Error {
|
|
|
18
25
|
type: ErrorType;
|
|
19
26
|
/** See {@link WalletError.code}. Set only when the source error had a numeric code. */
|
|
20
27
|
code?: number;
|
|
28
|
+
/** See {@link WalletError.providerReason}. */
|
|
29
|
+
providerReason?: string;
|
|
21
30
|
constructor(walletError: WalletError);
|
|
22
31
|
}
|
|
23
32
|
/**
|
|
@@ -35,6 +44,15 @@ export declare class NoCommonNetworkError extends WalletConnectorError {
|
|
|
35
44
|
readonly configuredNetworkIds: string[];
|
|
36
45
|
constructor(walletNetworkIds: string[], configuredNetworkIds: string[]);
|
|
37
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Thrown by a `silentOnly` connect when the wallet does not already trust this
|
|
49
|
+
* origin for the target namespace (locked wallet, site disconnected in the
|
|
50
|
+
* wallet, fresh browser profile, …). Nothing was shown to the user: the caller
|
|
51
|
+
* should fall back to its normal, user-initiated connect UI.
|
|
52
|
+
*/
|
|
53
|
+
export declare class WalletNotAuthorizedError extends WalletConnectorError {
|
|
54
|
+
constructor(message?: string);
|
|
55
|
+
}
|
|
38
56
|
/**
|
|
39
57
|
* Thrown by an EIP-5792 batch send when the wallet reports the batch confirmed
|
|
40
58
|
* (`wallet_getCallsStatus` status 200) without a receipt, so there is
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAA;AAE1D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAA;AAE1D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,IAAI,EAAE,SAAS,CAAA;IACf,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB,YAAY,WAAW,EAAE,WAAW,EAenC;CACF;AAED;;;;;;;GAOG;AACH,qBAAa,oBAAqB,SAAQ,oBAAoB;IAC5D,mDAAmD;IACnD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IACnC,kDAAkD;IAClD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAAA;IAEvC,YAAY,gBAAgB,EAAE,MAAM,EAAE,EAAE,oBAAoB,EAAE,MAAM,EAAE,EASrE;CACF;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,oBAAoB;IAChE,YAAY,OAAO,SAA0C,EAG5D;CACF;AAED;;;;;;;;;GASG;AACH,qBAAa,iCAAkC,SAAQ,oBAAoB;IACzE,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,oGAAoG;IACpG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAQ3C;CACF"}
|
package/dist/errors.js
CHANGED
|
@@ -6,6 +6,8 @@ export class WalletConnectorError extends Error {
|
|
|
6
6
|
type;
|
|
7
7
|
/** See {@link WalletError.code}. Set only when the source error had a numeric code. */
|
|
8
8
|
code;
|
|
9
|
+
/** See {@link WalletError.providerReason}. */
|
|
10
|
+
providerReason;
|
|
9
11
|
constructor(walletError) {
|
|
10
12
|
super(walletError.message);
|
|
11
13
|
this.name = 'WalletConnectorError';
|
|
@@ -16,6 +18,9 @@ export class WalletConnectorError extends Error {
|
|
|
16
18
|
Number.isInteger(walletError.code)) {
|
|
17
19
|
this.code = walletError.code;
|
|
18
20
|
}
|
|
21
|
+
if (walletError.providerReason) {
|
|
22
|
+
this.providerReason = walletError.providerReason;
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
@@ -41,6 +46,18 @@ export class NoCommonNetworkError extends WalletConnectorError {
|
|
|
41
46
|
this.configuredNetworkIds = configuredNetworkIds;
|
|
42
47
|
}
|
|
43
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Thrown by a `silentOnly` connect when the wallet does not already trust this
|
|
51
|
+
* origin for the target namespace (locked wallet, site disconnected in the
|
|
52
|
+
* wallet, fresh browser profile, …). Nothing was shown to the user: the caller
|
|
53
|
+
* should fall back to its normal, user-initiated connect UI.
|
|
54
|
+
*/
|
|
55
|
+
export class WalletNotAuthorizedError extends WalletConnectorError {
|
|
56
|
+
constructor(message = 'Wallet has not authorized this origin') {
|
|
57
|
+
super({ type: 'unknown', message });
|
|
58
|
+
this.name = 'WalletNotAuthorizedError';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
44
61
|
/**
|
|
45
62
|
* Thrown by an EIP-5792 batch send when the wallet reports the batch confirmed
|
|
46
63
|
* (`wallet_getCallsStatus` status 200) without a receipt, so there is
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,IAAI,CAAW;IACf,uFAAuF;IACvF,IAAI,CAAS;IACb,8CAA8C;IAC9C,cAAc,CAAS;IAEvB,YAAY,WAAwB;QAClC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAA;QAC5B,0EAA0E;QAC1E,iEAAiE;QACjE,IACE,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ;YACpC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAClC,CAAC;YACD,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAA;QAC9B,CAAC;QACD,IAAI,WAAW,CAAC,cAAc,EAAE,CAAC;YAC/B,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC,cAAc,CAAA;QAClD,CAAC;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAqB,SAAQ,oBAAoB;IAC5D,mDAAmD;IAC1C,gBAAgB,CAAU;IACnC,kDAAkD;IACzC,oBAAoB,CAAU;IAEvC,YAAY,gBAA0B,EAAE,oBAA8B;QACpE,KAAK,CAAC;YACJ,IAAI,EAAE,SAAS;YACf,OAAO,EACL,0EAA0E;SAC7E,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAA;IAClD,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,oBAAoB;IAChE,YAAY,OAAO,GAAG,uCAAuC;QAC3D,KAAK,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAA;IACxC,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,iCAAkC,SAAQ,oBAAoB;IACzE,wEAAwE;IAC/D,OAAO,CAAQ;IACxB,oGAAoG;IAC3F,OAAO,CAAQ;IAExB,YAAY,OAAe,EAAE,OAAe;QAC1C,KAAK,CAAC;YACJ,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,6DAA6D;SACvE,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,GAAG,mCAAmC,CAAA;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CACF"}
|
package/dist/observability.d.ts
CHANGED
|
@@ -56,7 +56,13 @@ export type FailureKind = 'user_rejected' | 'provider_error' | 'bridge_error' |
|
|
|
56
56
|
/** Wallet and the configured networks share no chain — connect can't proceed. */
|
|
57
57
|
| 'no_common_network' | 'unsupported_method' | 'invalid_params' | 'expired'
|
|
58
58
|
/** `SignClient.init` (WalletConnect) rejected — the connector never came up. */
|
|
59
|
-
| 'client_init_failed'
|
|
59
|
+
| 'client_init_failed'
|
|
60
|
+
/**
|
|
61
|
+
* A `silentOnly` connect found the wallet had not authorized this origin, so
|
|
62
|
+
* it stopped without prompting. Expected, not a fault — exclude from failure
|
|
63
|
+
* rates.
|
|
64
|
+
*/
|
|
65
|
+
| 'not_authorized' | 'unknown';
|
|
60
66
|
/**
|
|
61
67
|
* Where a failure originated, as far as UWC can tell from the error shape. Used
|
|
62
68
|
* to triage whether a problem sits in the wallet/provider, our connector layer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../src/observability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAC/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAC/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;CACjD;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,cAAc,GACtB,wBAAwB,GACxB,+BAA+B,GAC/B,wBAAwB,GACxB,qBAAqB,GACrB,cAAc,GACd,qBAAqB,GACrB,4BAA4B,GAC5B,wBAAwB,GACxB,SAAS,CAAA;AAEb;;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M,WAAW,GACnB,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,eAAe;AACjB,iFAAiF;GAC/E,mBAAmB,GACnB,oBAAoB,GACpB,gBAAgB,GAChB,SAAS;AACX,gFAAgF;GAC9E,oBAAoB;AACtB;;;;GAIG;GACD,gBAAgB,GAChB,SAAS,CAAA;AAEb;;;;GAIG;AACH,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,WAAW,GACX,QAAQ,GACR,KAAK,GACL,SAAS,CAAA;AAEb;;;;GAIG;AACH,MAAM,MAAM,0BAA0B;AACpC,gGAAgG;AAC9F,mCAAmC;AACrC,uFAAuF;GACrF,iCAAiC;AACnC,oEAAoE;GAClE,uBAAuB;AACzB;;;;GAIG;GACD,mBAAmB;AACrB;;;GAGG;GACD,cAAc,CAAA;AAElB;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc;AACxB,2FAA2F;AACzF,mBAAmB;AACrB,wFAAwF;GACtF,yBAAyB;AAC3B,yFAAyF;GACvF,gBAAgB;AAClB,qFAAqF;GACnF,aAAa;AACf;;;;GAIG;GACD,iBAAiB,CAAA;AAErB,gDAAgD;AAChD,MAAM,MAAM,iBAAiB,GACzB,IAAI;AACN,qFAAqF;GACnF,QAAQ;AACV,uFAAuF;GACrF,UAAU;AACZ;;;;;;;;;GASG;GACD,SAAS,CAAA;AAEb;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,iBAAiB,CAAA;IAC1B,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAA;IAClB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IACjC,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B"}
|
package/package.json
CHANGED
package/src/connector.ts
CHANGED
|
@@ -91,6 +91,23 @@ export interface ConnectorConnectOptions {
|
|
|
91
91
|
* or omitted list means no constraint.
|
|
92
92
|
*/
|
|
93
93
|
requiredAddresses?: readonly string[]
|
|
94
|
+
/**
|
|
95
|
+
* Connect ONLY if the wallet already trusts this origin — never prompt.
|
|
96
|
+
*
|
|
97
|
+
* When true, a connector must run its non-prompting checks alone (EVM
|
|
98
|
+
* `eth_accounts`, an account a Wallet Standard wallet already exposes to
|
|
99
|
+
* this origin, …) and must not fall through to any call that
|
|
100
|
+
* can open the wallet's approval UI, for the target namespace or for any
|
|
101
|
+
* secondary-namespace gather. When the target namespace is not already
|
|
102
|
+
* authorized it rejects with {@link WalletNotAuthorizedError}.
|
|
103
|
+
*
|
|
104
|
+
* For callers that connect without a user gesture (e.g. restoring a returning
|
|
105
|
+
* user's wallet on page load), where an unprompted popup is worse than not
|
|
106
|
+
* connecting. Honoured by the injected connector only; every other connector
|
|
107
|
+
* rejects it with a plain `Error` (a caller bug, not an expected miss) before
|
|
108
|
+
* reaching the wallet. Omitted or false: unchanged behaviour.
|
|
109
|
+
*/
|
|
110
|
+
silentOnly?: boolean
|
|
94
111
|
}
|
|
95
112
|
|
|
96
113
|
/**
|
package/src/errors.ts
CHANGED
|
@@ -10,6 +10,13 @@ export interface WalletError {
|
|
|
10
10
|
* `provider_error`) without inferring anything from the message.
|
|
11
11
|
*/
|
|
12
12
|
code?: number
|
|
13
|
+
/**
|
|
14
|
+
* The wallet's own rejection text, when a library wrapper (viem) replaced it
|
|
15
|
+
* with a generic message. Trust Wallet Android, for example, rejects with the
|
|
16
|
+
* bare string `"cancelled"`, which viem reports as "An unknown RPC error
|
|
17
|
+
* occurred." with the original kept only in `cause`. Scrubbed before telemetry.
|
|
18
|
+
*/
|
|
19
|
+
providerReason?: string
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
/**
|
|
@@ -20,6 +27,8 @@ export class WalletConnectorError extends Error {
|
|
|
20
27
|
type: ErrorType
|
|
21
28
|
/** See {@link WalletError.code}. Set only when the source error had a numeric code. */
|
|
22
29
|
code?: number
|
|
30
|
+
/** See {@link WalletError.providerReason}. */
|
|
31
|
+
providerReason?: string
|
|
23
32
|
|
|
24
33
|
constructor(walletError: WalletError) {
|
|
25
34
|
super(walletError.message)
|
|
@@ -33,6 +42,9 @@ export class WalletConnectorError extends Error {
|
|
|
33
42
|
) {
|
|
34
43
|
this.code = walletError.code
|
|
35
44
|
}
|
|
45
|
+
if (walletError.providerReason) {
|
|
46
|
+
this.providerReason = walletError.providerReason
|
|
47
|
+
}
|
|
36
48
|
}
|
|
37
49
|
}
|
|
38
50
|
|
|
@@ -62,6 +74,19 @@ export class NoCommonNetworkError extends WalletConnectorError {
|
|
|
62
74
|
}
|
|
63
75
|
}
|
|
64
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Thrown by a `silentOnly` connect when the wallet does not already trust this
|
|
79
|
+
* origin for the target namespace (locked wallet, site disconnected in the
|
|
80
|
+
* wallet, fresh browser profile, …). Nothing was shown to the user: the caller
|
|
81
|
+
* should fall back to its normal, user-initiated connect UI.
|
|
82
|
+
*/
|
|
83
|
+
export class WalletNotAuthorizedError extends WalletConnectorError {
|
|
84
|
+
constructor(message = 'Wallet has not authorized this origin') {
|
|
85
|
+
super({ type: 'unknown', message })
|
|
86
|
+
this.name = 'WalletNotAuthorizedError'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
65
90
|
/**
|
|
66
91
|
* Thrown by an EIP-5792 batch send when the wallet reports the batch confirmed
|
|
67
92
|
* (`wallet_getCallsStatus` status 200) without a receipt, so there is
|
package/src/observability.ts
CHANGED
|
@@ -79,6 +79,12 @@ export type FailureKind =
|
|
|
79
79
|
| 'expired'
|
|
80
80
|
/** `SignClient.init` (WalletConnect) rejected — the connector never came up. */
|
|
81
81
|
| 'client_init_failed'
|
|
82
|
+
/**
|
|
83
|
+
* A `silentOnly` connect found the wallet had not authorized this origin, so
|
|
84
|
+
* it stopped without prompting. Expected, not a fault — exclude from failure
|
|
85
|
+
* rates.
|
|
86
|
+
*/
|
|
87
|
+
| 'not_authorized'
|
|
82
88
|
| 'unknown'
|
|
83
89
|
|
|
84
90
|
/**
|