@meshconnect/uwc-core 1.2.3-snapshot.2b4c3e4 → 1.2.3-snapshot.bfac68b
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/events.d.ts +1 -5
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/observability/lifecycle-bridge.d.ts +13 -31
- package/dist/observability/lifecycle-bridge.d.ts.map +1 -1
- package/dist/observability/lifecycle-bridge.js +92 -167
- package/dist/observability/lifecycle-bridge.js.map +1 -1
- package/dist/services/connection-service.d.ts +0 -43
- package/dist/services/connection-service.d.ts.map +1 -1
- package/dist/services/connection-service.js +9 -163
- package/dist/services/connection-service.js.map +1 -1
- package/dist/services/network-switch-service.d.ts.map +1 -1
- package/dist/services/network-switch-service.js +1 -4
- package/dist/services/network-switch-service.js.map +1 -1
- package/dist/services/signature-service.d.ts +3 -4
- package/dist/services/signature-service.d.ts.map +1 -1
- package/dist/services/signature-service.js +1 -2
- package/dist/services/signature-service.js.map +1 -1
- package/dist/universal-wallet-connector.d.ts +3 -5
- package/dist/universal-wallet-connector.d.ts.map +1 -1
- package/dist/universal-wallet-connector.js +1 -3
- package/dist/universal-wallet-connector.js.map +1 -1
- package/package.json +5 -5
- package/src/events.ts +2 -5
- package/src/observability/lifecycle-bridge.test.ts +0 -197
- package/src/observability/lifecycle-bridge.ts +99 -211
- package/src/services/connection-service.test.ts +0 -272
- package/src/services/connection-service.ts +10 -190
- package/src/services/network-switch-service.test.ts +0 -33
- package/src/services/network-switch-service.ts +1 -4
- package/src/services/signature-service.test.ts +2 -9
- package/src/services/signature-service.ts +3 -4
- package/src/universal-wallet-connector.ts +3 -5
package/dist/events.d.ts
CHANGED
|
@@ -106,13 +106,9 @@ export interface UWCEventMap {
|
|
|
106
106
|
isLoading: boolean;
|
|
107
107
|
isWaitingForUserApproval: boolean;
|
|
108
108
|
};
|
|
109
|
-
/** Network switch succeeded.
|
|
110
|
-
* resolved to (present whenever the connector returned one) — used by
|
|
111
|
-
* the lifecycle bridge to suppress the wallet's own echo of this same
|
|
112
|
-
* change (see attachLifecycle's echo-suppression window). */
|
|
109
|
+
/** Network switch succeeded. */
|
|
113
110
|
networkSwitched: {
|
|
114
111
|
network: Network;
|
|
115
|
-
address?: string;
|
|
116
112
|
};
|
|
117
113
|
/** Wallet capabilities were refreshed. */
|
|
118
114
|
capabilitiesUpdated: {
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACX,0BAA0B,EAC3B,MAAM,wBAAwB,CAAA;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,wKAUjB,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1D;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,KAAK,EAAE,IAAI,CAAA;IACX;;;;;OAKG;IACH,eAAe,EAAE;QACf,OAAO,EAAE,cAAc,EAAE,CAAA;QACzB,SAAS,CAAC,EACN,MAAM,CAAC,MAAM,EAAE;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,GACtD,SAAS,CAAA;KACd,CAAA;IACD;;;;;OAKG;IACH,qBAAqB,EAAE;QACrB,SAAS,EAAE,SAAS,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,KAAK,EAAE,WAAW,CAAA;KACnB,CAAA;IACD;;;;;;OAMG;IACH,WAAW,EAAE;QACX,SAAS,CAAC,EAAE,SAAS,GAAG,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 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS;IACT,YAAY;IACZ,eAAe;IACf,aAAa;IACb,eAAe;IACf,iBAAiB;IACjB,uBAAuB;IACvB,uBAAuB;IACvB,YAAY;CACJ,CAAA;
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS;IACT,YAAY;IACZ,eAAe;IACf,aAAa;IACb,eAAe;IACf,iBAAiB;IACjB,uBAAuB;IACvB,uBAAuB;IACvB,YAAY;CACJ,CAAA;AA2SV;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA8B,IAAI,GAAG,CAAC;IACtE,KAAK;IACL,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;IACd,gBAAgB;IAChB,uBAAuB;IACvB,aAAa;IACb,YAAY;IACZ,wBAAwB;IACxB,sBAAsB;IACtB,oBAAoB;IACpB,oBAAoB;IACpB,sBAAsB;IACtB,+BAA+B;IAC/B,yBAAyB;IACzB,0BAA0B;CAC3B,CAAC,CAAA;AAOF;;;;;GAKG;AACH,MAAM,gBAAgB,GAA+B;IACnD,KAAK,EAAE,IAAI;IACX,eAAe,EAAE,IAAI;IACrB,qBAAqB,EAAE,IAAI;IAC3B,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;IAChB,sBAAsB,EAAE,IAAI;IAC5B,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,IAAI;IACtB,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,IAAI;IACzB,KAAK,EAAE,IAAI;IACX,GAAG,EAAE,IAAI;IACT,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,IAAI;IAClB,cAAc,EAAE,IAAI;IACpB,oBAAoB,EAAE,IAAI;IAC1B,kBAAkB,EAAE,IAAI;IACxB,kBAAkB,EAAE,IAAI;IACxB,oBAAoB,EAAE,IAAI;IAC1B,6BAA6B,EAAE,IAAI;IACnC,uBAAuB,EAAE,IAAI;IAC7B,wBAAwB,EAAE,IAAI;IAC9B,MAAM,EAAE,IAAI;CACb,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAmB,CAAA"}
|
|
@@ -20,19 +20,9 @@ export interface AttachLifecycleOptions {
|
|
|
20
20
|
* The active connector's `onLifecycleEvent` (already bound). `undefined` when the
|
|
21
21
|
* connector can't observe lifecycle at all; the value it returns is `undefined`
|
|
22
22
|
* when THIS session can't be observed (e.g. no live `.on`). Either way the
|
|
23
|
-
* bridge emits `lifecycleTelemetryUnavailable` and becomes a no-op
|
|
24
|
-
* STREAM — `subscribeAccounts` below is attached independently.
|
|
23
|
+
* bridge emits `lifecycleTelemetryUnavailable` and becomes a no-op.
|
|
25
24
|
*/
|
|
26
25
|
subscribe: ((l: (e: WalletLifecycleEvent) => void) => (() => void) | undefined) | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* The active connector's `onAccountsChanged` (already bound), carrying the
|
|
29
|
-
* REAL account list — a separate concern from `subscribe` above (some
|
|
30
|
-
* connectors, e.g. Tron today, implement one without the other). Absent
|
|
31
|
-
* entirely when the connector doesn't support real account-sync.
|
|
32
|
-
*/
|
|
33
|
-
subscribeAccounts?: ((l: (accounts: string[]) => void) => (() => void) | undefined) | undefined;
|
|
34
|
-
/** Invoked with the resolved (post-echo-filter) real account list whenever `subscribeAccounts` delivers one. Required whenever `subscribeAccounts` is provided. */
|
|
35
|
-
onAccountsChanged?: (accounts: string[]) => void;
|
|
36
26
|
/** Resolved per-event so a mid-session account/chain change is reflected. */
|
|
37
27
|
getRouting: () => LifecycleRouting;
|
|
38
28
|
connectionMode: ConnectionMode;
|
|
@@ -41,9 +31,8 @@ export interface AttachLifecycleOptions {
|
|
|
41
31
|
/** Direct page vs production iframe — stamped on `lifecycleTelemetryUnavailable`. */
|
|
42
32
|
runtime?: 'direct' | 'iframe';
|
|
43
33
|
/**
|
|
44
|
-
* Window (ms) within which a wallet `chainChanged
|
|
45
|
-
*
|
|
46
|
-
* Default 3000.
|
|
34
|
+
* Window (ms) within which a wallet `chainChanged` is treated as the echo of a
|
|
35
|
+
* UWC-initiated `switchNetwork` and suppressed. Default 3000.
|
|
47
36
|
*/
|
|
48
37
|
echoWindowMs?: number;
|
|
49
38
|
/**
|
|
@@ -55,7 +44,6 @@ export interface AttachLifecycleOptions {
|
|
|
55
44
|
*/
|
|
56
45
|
initialSwitch?: {
|
|
57
46
|
chainId: NetworkId;
|
|
58
|
-
address?: string;
|
|
59
47
|
at: number;
|
|
60
48
|
} | undefined;
|
|
61
49
|
now?: () => number;
|
|
@@ -63,25 +51,19 @@ export interface AttachLifecycleOptions {
|
|
|
63
51
|
/**
|
|
64
52
|
* Bridge a connector's PII-safe `WalletLifecycleEvent` stream onto the event bus
|
|
65
53
|
* as `walletAccountChanged` / `walletChainChanged` / `walletDisconnected` /
|
|
66
|
-
* `walletSessionExpired
|
|
67
|
-
* account list to `onAccountsChanged` for session-sync.
|
|
54
|
+
* `walletSessionExpired`.
|
|
68
55
|
*
|
|
69
|
-
*
|
|
56
|
+
* Two correctness concerns are handled here:
|
|
70
57
|
* - **Echo suppression.** When UWC drives a `switchNetwork`, the wallet emits its
|
|
71
|
-
* own `chainChanged
|
|
72
|
-
*
|
|
73
|
-
* would double-count. We watch the bus for
|
|
74
|
-
*
|
|
75
|
-
* - **Availability is signal
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* `onLifecycleEvent` but implementing `onAccountsChanged` (e.g. Tron today)
|
|
79
|
-
* still gets real account-sync; the two streams are independently attached.
|
|
80
|
-
* - **Shared emission budget.** Both streams count against the same
|
|
81
|
-
* `MAX_LIFECYCLE_EVENTS_PER_ATTACHMENT` ceiling — a storming provider
|
|
82
|
-
* doesn't get double budget just because two streams exist.
|
|
58
|
+
* own `chainChanged` for the same chain — that's already captured by UWC's
|
|
59
|
+
* `networkSwitched` / the switch handoff, so re-emitting it as a wallet-
|
|
60
|
+
* initiated `walletChainChanged` would double-count. We watch the bus for
|
|
61
|
+
* `networkSwitched` and drop a matching `chainChanged` inside `echoWindowMs`.
|
|
62
|
+
* - **Availability is signal.** If the connector can't observe lifecycle, we emit
|
|
63
|
+
* `lifecycleTelemetryUnavailable` ONCE so a dashboard can tell "silent" from
|
|
64
|
+
* "unwired".
|
|
83
65
|
*
|
|
84
|
-
* @returns a teardown that removes
|
|
66
|
+
* @returns a teardown that removes the connector subscription AND the bus watcher.
|
|
85
67
|
*/
|
|
86
68
|
export declare function attachLifecycle(opts: AttachLifecycleOptions): () => void;
|
|
87
69
|
//# sourceMappingURL=lifecycle-bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-bridge.d.ts","sourceRoot":"","sources":["../../src/observability/lifecycle-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,SAAS,EACT,SAAS,EAEV,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAClC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mCAAmC,MAAM,CAAA;AAEtD,MAAM,WAAW,sBAAsB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;GAgBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,IAAI,CA2IxE"}
|
|
@@ -9,28 +9,22 @@ export const MAX_LIFECYCLE_EVENTS_PER_ATTACHMENT = 100;
|
|
|
9
9
|
/**
|
|
10
10
|
* Bridge a connector's PII-safe `WalletLifecycleEvent` stream onto the event bus
|
|
11
11
|
* as `walletAccountChanged` / `walletChainChanged` / `walletDisconnected` /
|
|
12
|
-
* `walletSessionExpired
|
|
13
|
-
* account list to `onAccountsChanged` for session-sync.
|
|
12
|
+
* `walletSessionExpired`.
|
|
14
13
|
*
|
|
15
|
-
*
|
|
14
|
+
* Two correctness concerns are handled here:
|
|
16
15
|
* - **Echo suppression.** When UWC drives a `switchNetwork`, the wallet emits its
|
|
17
|
-
* own `chainChanged
|
|
18
|
-
*
|
|
19
|
-
* would double-count. We watch the bus for
|
|
20
|
-
*
|
|
21
|
-
* - **Availability is signal
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* `onLifecycleEvent` but implementing `onAccountsChanged` (e.g. Tron today)
|
|
25
|
-
* still gets real account-sync; the two streams are independently attached.
|
|
26
|
-
* - **Shared emission budget.** Both streams count against the same
|
|
27
|
-
* `MAX_LIFECYCLE_EVENTS_PER_ATTACHMENT` ceiling — a storming provider
|
|
28
|
-
* doesn't get double budget just because two streams exist.
|
|
16
|
+
* own `chainChanged` for the same chain — that's already captured by UWC's
|
|
17
|
+
* `networkSwitched` / the switch handoff, so re-emitting it as a wallet-
|
|
18
|
+
* initiated `walletChainChanged` would double-count. We watch the bus for
|
|
19
|
+
* `networkSwitched` and drop a matching `chainChanged` inside `echoWindowMs`.
|
|
20
|
+
* - **Availability is signal.** If the connector can't observe lifecycle, we emit
|
|
21
|
+
* `lifecycleTelemetryUnavailable` ONCE so a dashboard can tell "silent" from
|
|
22
|
+
* "unwired".
|
|
29
23
|
*
|
|
30
|
-
* @returns a teardown that removes
|
|
24
|
+
* @returns a teardown that removes the connector subscription AND the bus watcher.
|
|
31
25
|
*/
|
|
32
26
|
export function attachLifecycle(opts) {
|
|
33
|
-
const { eventManager, subscribe,
|
|
27
|
+
const { eventManager, subscribe, getRouting } = opts;
|
|
34
28
|
const runtime = opts.runtime ?? 'direct';
|
|
35
29
|
const now = opts.now ?? Date.now;
|
|
36
30
|
const echoWindowMs = opts.echoWindowMs ?? 3000;
|
|
@@ -41,190 +35,121 @@ export function attachLifecycle(opts) {
|
|
|
41
35
|
walletId: opts.walletId,
|
|
42
36
|
runtime
|
|
43
37
|
});
|
|
44
|
-
if (!subscribe
|
|
38
|
+
if (!subscribe) {
|
|
45
39
|
// In the production iframe the injected subscription is deliberately not
|
|
46
40
|
// attempted (the provider is a Comlink proxy) — the BRIDGE, not the connector,
|
|
47
|
-
// is why lifecycle is unobservable. On the direct page, a connector with
|
|
48
|
-
//
|
|
41
|
+
// is why lifecycle is unobservable. On the direct page, a connector with no
|
|
42
|
+
// `onLifecycleEvent` simply has no lifecycle support for this namespace yet.
|
|
49
43
|
emitUnavailable(runtime === 'iframe'
|
|
50
44
|
? 'bridge_subscription_unavailable'
|
|
51
45
|
: 'unsupported_namespace');
|
|
52
46
|
return () => { };
|
|
53
47
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
// duplicate, which would otherwise leave a phantom entry behind after only
|
|
64
|
-
// one of the two is consumed by a single wallet echo.
|
|
65
|
-
const armOrRearm = (partial) => {
|
|
66
|
-
pruneExpired();
|
|
67
|
-
if (partial.chainId !== undefined) {
|
|
68
|
-
const idx = pendingSwitches.findIndex(p => p.chainId === partial.chainId);
|
|
69
|
-
if (idx !== -1) {
|
|
70
|
-
pendingSwitches[idx] = {
|
|
71
|
-
...pendingSwitches[idx],
|
|
72
|
-
...partial,
|
|
73
|
-
at: now()
|
|
74
|
-
};
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
pendingSwitches.push({ ...partial, at: now() });
|
|
79
|
-
};
|
|
48
|
+
// Record UWC-initiated switches so the wallet's chainChanged echo can be
|
|
49
|
+
// dropped. Armed from BOTH signals: `awaitingWallet` (operation switchNetwork)
|
|
50
|
+
// arms at the handoff START, because some providers emit their chainChanged
|
|
51
|
+
// BEFORE the switch request resolves — i.e. before `networkSwitched` exists —
|
|
52
|
+
// and `networkSwitched` re-arms at completion for the late-echo case. The
|
|
53
|
+
// re-arm means one extra suppression window can follow an early echo; the
|
|
54
|
+
// only event it could swallow is a sub-window user re-switch to the chain
|
|
55
|
+
// that just became active — accepted over double-counting every early echo.
|
|
56
|
+
let lastSwitch = opts.initialSwitch;
|
|
80
57
|
const offAwaiting = eventManager.on('awaitingWallet', data => {
|
|
81
58
|
if (data.operation === 'switchNetwork' && data.chainId !== undefined) {
|
|
82
|
-
|
|
59
|
+
lastSwitch = { chainId: data.chainId, at: now() };
|
|
83
60
|
}
|
|
84
61
|
});
|
|
85
62
|
const offSwitched = eventManager.on('networkSwitched', data => {
|
|
86
|
-
|
|
63
|
+
lastSwitch = { chainId: data.network.id, at: now() };
|
|
87
64
|
});
|
|
88
65
|
const detachBusWatchers = () => {
|
|
89
66
|
offAwaiting();
|
|
90
67
|
offSwitched();
|
|
91
68
|
};
|
|
92
|
-
// Emission budget for THIS attachment, shared across both streams —
|
|
93
|
-
// suppressed echoes don't spend it.
|
|
94
|
-
let emitted = 0;
|
|
95
|
-
let capNotified = false;
|
|
96
|
-
const overCap = () => {
|
|
97
|
-
if (emitted >= MAX_LIFECYCLE_EVENTS_PER_ATTACHMENT) {
|
|
98
|
-
// Mark the trip ONCE — a silent cap would be indistinguishable from a
|
|
99
|
-
// provider that simply went quiet.
|
|
100
|
-
if (!capNotified) {
|
|
101
|
-
capNotified = true;
|
|
102
|
-
emitUnavailable('emission_cap');
|
|
103
|
-
}
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
return false;
|
|
107
|
-
};
|
|
108
69
|
// Defense-in-depth: a connector whose subscribe THROWS (e.g. a provider whose
|
|
109
70
|
// `.on` rejects an un-proxied handler across the iframe bridge) must degrade to
|
|
110
71
|
// "unavailable", never break the connect path that called us.
|
|
111
72
|
let unsub;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
pruneExpired();
|
|
130
|
-
const idx = e.chainId !== undefined
|
|
131
|
-
? pendingSwitches.findIndex(p => p.chainId !== undefined && p.chainId === e.chainId)
|
|
132
|
-
: -1;
|
|
133
|
-
if (idx !== -1) {
|
|
134
|
-
// Consume the echo: a UWC switch produces exactly one wallet echo, so
|
|
135
|
-
// a LATER chainChanged to the same chain inside the window is a genuine
|
|
136
|
-
// user-initiated switch-back and must not be suppressed. Only the
|
|
137
|
-
// chain half is consumed — a still-pending address echo (if the
|
|
138
|
-
// switch also changed address format) must still be checked; drop the
|
|
139
|
-
// entry entirely once nothing is left pending on it.
|
|
140
|
-
const entry = pendingSwitches[idx];
|
|
141
|
-
if (entry.address !== undefined) {
|
|
142
|
-
pendingSwitches[idx] = { ...entry, chainId: undefined };
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
pendingSwitches.splice(idx, 1);
|
|
146
|
-
}
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
emitted++;
|
|
150
|
-
eventManager.emit('walletChainChanged', {
|
|
151
|
-
...routing,
|
|
152
|
-
...(e.chainId !== undefined ? { chainId: e.chainId } : {})
|
|
153
|
-
});
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
case 'disconnect':
|
|
157
|
-
emitted++;
|
|
158
|
-
eventManager.emit('walletDisconnected', routing);
|
|
159
|
-
return;
|
|
160
|
-
case 'sessionExpired':
|
|
161
|
-
emitted++;
|
|
162
|
-
eventManager.emit('walletSessionExpired', routing);
|
|
163
|
-
return;
|
|
73
|
+
// Emission budget for THIS attachment — suppressed echoes don't spend it.
|
|
74
|
+
let emitted = 0;
|
|
75
|
+
let capNotified = false;
|
|
76
|
+
try {
|
|
77
|
+
unsub = subscribe(e => {
|
|
78
|
+
// The whole body is guarded: wallet SDKs dispatch their listeners
|
|
79
|
+
// unguarded (e.g. TonConnect's bare `forEach`), so a throw here — from
|
|
80
|
+
// `getRouting()` or any future edit — would abort delivery to the
|
|
81
|
+
// wallet's OWN later subscribers, including one resolving a pending
|
|
82
|
+
// connect. Telemetry must never do that.
|
|
83
|
+
try {
|
|
84
|
+
if (emitted >= MAX_LIFECYCLE_EVENTS_PER_ATTACHMENT) {
|
|
85
|
+
// Mark the trip ONCE — a silent cap would be indistinguishable from a
|
|
86
|
+
// provider that simply went quiet.
|
|
87
|
+
if (!capNotified) {
|
|
88
|
+
capNotified = true;
|
|
89
|
+
emitUnavailable('emission_cap');
|
|
164
90
|
}
|
|
91
|
+
return;
|
|
165
92
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
catch {
|
|
173
|
-
unsub = undefined;
|
|
174
|
-
}
|
|
175
|
-
if (!unsub) {
|
|
176
|
-
// The connector accepted the subscribe call but this session has no
|
|
177
|
-
// observable telemetry surface (returned undefined or threw). Over the
|
|
178
|
-
// bridge, that absence is the bridge's doing, not the provider's.
|
|
179
|
-
emitUnavailable(runtime === 'iframe'
|
|
180
|
-
? 'bridge_subscription_unavailable'
|
|
181
|
-
: 'provider_subscription_unavailable');
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
let unsubAccounts;
|
|
185
|
-
if (subscribeAccounts) {
|
|
186
|
-
try {
|
|
187
|
-
unsubAccounts = subscribeAccounts(accounts => {
|
|
188
|
-
try {
|
|
189
|
-
if (overCap())
|
|
93
|
+
const routing = getRouting();
|
|
94
|
+
switch (e.type) {
|
|
95
|
+
case 'accountChanged':
|
|
96
|
+
emitted++;
|
|
97
|
+
eventManager.emit('walletAccountChanged', routing);
|
|
190
98
|
return;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
pendingSwitches.splice(idx, 1);
|
|
99
|
+
case 'chainChanged': {
|
|
100
|
+
const isEcho = !!lastSwitch &&
|
|
101
|
+
e.chainId !== undefined &&
|
|
102
|
+
lastSwitch.chainId === e.chainId &&
|
|
103
|
+
now() - lastSwitch.at <= echoWindowMs;
|
|
104
|
+
if (isEcho) {
|
|
105
|
+
// Consume the echo: a UWC switch produces exactly one wallet echo, so
|
|
106
|
+
// a LATER chainChanged to the same chain inside the window is a genuine
|
|
107
|
+
// user-initiated switch-back and must not be suppressed.
|
|
108
|
+
lastSwitch = undefined;
|
|
109
|
+
return;
|
|
205
110
|
}
|
|
111
|
+
emitted++;
|
|
112
|
+
eventManager.emit('walletChainChanged', {
|
|
113
|
+
...routing,
|
|
114
|
+
...(e.chainId !== undefined ? { chainId: e.chainId } : {})
|
|
115
|
+
});
|
|
206
116
|
return;
|
|
207
117
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
118
|
+
case 'disconnect':
|
|
119
|
+
emitted++;
|
|
120
|
+
eventManager.emit('walletDisconnected', routing);
|
|
121
|
+
return;
|
|
122
|
+
case 'sessionExpired':
|
|
123
|
+
emitted++;
|
|
124
|
+
eventManager.emit('walletSessionExpired', routing);
|
|
125
|
+
return;
|
|
213
126
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
// Swallowed: better to drop one lifecycle record than to break the
|
|
130
|
+
// wallet's event dispatch.
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
unsub = undefined;
|
|
219
136
|
}
|
|
220
|
-
|
|
137
|
+
// The connector accepted the subscribe call but this session has no observable
|
|
138
|
+
// surface (returned undefined) or threw — treat as "unavailable" and don't
|
|
139
|
+
// leave the bus watchers attached.
|
|
140
|
+
if (!unsub) {
|
|
221
141
|
detachBusWatchers();
|
|
142
|
+
// `onLifecycleEvent` ran but exposed no live subscription surface for this
|
|
143
|
+
// session (returned undefined or threw). Over the bridge, that absence is the
|
|
144
|
+
// bridge's doing, not the provider's.
|
|
145
|
+
emitUnavailable(runtime === 'iframe'
|
|
146
|
+
? 'bridge_subscription_unavailable'
|
|
147
|
+
: 'provider_subscription_unavailable');
|
|
222
148
|
return () => { };
|
|
223
149
|
}
|
|
224
150
|
return () => {
|
|
225
151
|
detachBusWatchers();
|
|
226
|
-
unsub
|
|
227
|
-
unsubAccounts?.();
|
|
152
|
+
unsub();
|
|
228
153
|
};
|
|
229
154
|
}
|
|
230
155
|
//# sourceMappingURL=lifecycle-bridge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-bridge.js","sourceRoot":"","sources":["../../src/observability/lifecycle-bridge.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAA;
|
|
1
|
+
{"version":3,"file":"lifecycle-bridge.js","sourceRoot":"","sources":["../../src/observability/lifecycle-bridge.ts"],"names":[],"mappings":"AAgBA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAA;AAoCtD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,IAA4B;IAC1D,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,G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
|
@@ -15,12 +15,6 @@ export declare class ConnectionService {
|
|
|
15
15
|
private activeConnector;
|
|
16
16
|
/** Tears down the post-connect lifecycle subscription; set while connected. */
|
|
17
17
|
private lifecycleTeardown;
|
|
18
|
-
/**
|
|
19
|
-
* Teardowns for the accounts-sync attachments of the session's SECONDARY
|
|
20
|
-
* namespaces (see `attachSecondaryAccountSync`); set while connected,
|
|
21
|
-
* cleared together with `lifecycleTeardown`.
|
|
22
|
-
*/
|
|
23
|
-
private secondaryAccountSyncTeardowns;
|
|
24
18
|
/**
|
|
25
19
|
* Abort handle for the CURRENT in-flight connect attempt. A re-entrant
|
|
26
20
|
* connect() aborts this before starting, so a superseded attempt's URI poll
|
|
@@ -33,14 +27,6 @@ export declare class ConnectionService {
|
|
|
33
27
|
connect(connectionMode: ConnectionMode, walletId: string, networkId?: NetworkId, options?: ServiceOptions): Promise<void>;
|
|
34
28
|
/** Wire the active connector's lifecycle stream onto the bus (or signal absence). */
|
|
35
29
|
private attachLifecycle;
|
|
36
|
-
/**
|
|
37
|
-
* Apply a REAL account-list change (from `Connector.onAccountsChanged`, via
|
|
38
|
-
* the lifecycle bridge's second stream) to the session. `namespace` is the
|
|
39
|
-
* namespace of the provider that reported the change — `activeAddress`
|
|
40
|
-
* only moves when that matches the session's currently active network; an
|
|
41
|
-
* empty list is a full, wallet-initiated disconnect.
|
|
42
|
-
*/
|
|
43
|
-
private handleAccountsChanged;
|
|
44
30
|
/**
|
|
45
31
|
* Remove the active provider-lifecycle subscription (EIP-1193 `.on` / wallet-
|
|
46
32
|
* adapter / SignClient listeners) WITHOUT disconnecting the wallet. Idempotent.
|
|
@@ -58,41 +44,12 @@ export declare class ConnectionService {
|
|
|
58
44
|
* Safe no-op when nothing is connected.
|
|
59
45
|
*/
|
|
60
46
|
reattachLifecycle(): void;
|
|
61
|
-
/**
|
|
62
|
-
* Attach account-sync for every OTHER namespace the session's
|
|
63
|
-
* `availableAddresses` span. `attachLifecycle` observes only the ACTIVE
|
|
64
|
-
* network's namespace, but the cross-namespace gather seeds addresses from
|
|
65
|
-
* other namespaces' live surfaces at connect time — without their own
|
|
66
|
-
* subscription, a wallet-side account switch on such a namespace is never
|
|
67
|
-
* observed and the session serves the connect-time addresses forever (e.g.
|
|
68
|
-
* a Solana-active MetaMask session whose eip155 addresses never follow the
|
|
69
|
-
* extension's account switch).
|
|
70
|
-
*
|
|
71
|
-
* Accounts-sync ONLY, no lifecycle-telemetry stream: the active namespace
|
|
72
|
-
* stays the single source of wallet* telemetry and of the wallet-initiated
|
|
73
|
-
* disconnect signal.
|
|
74
|
-
*/
|
|
75
|
-
private attachSecondaryAccountSync;
|
|
76
47
|
private connectWithURIPoll;
|
|
77
48
|
private getConnector;
|
|
78
49
|
private findWallet;
|
|
79
50
|
private getProviderForMode;
|
|
80
51
|
private validateAndDetermineNetwork;
|
|
81
52
|
disconnect(options?: ServiceOptions): Promise<void>;
|
|
82
|
-
/**
|
|
83
|
-
* Clears core's own local state (session, active connector reference,
|
|
84
|
-
* lifecycle subscription) and emits the disconnect events. Does NOT itself
|
|
85
|
-
* call the connector's `disconnect()` — that happens in each CALLER,
|
|
86
|
-
* because the two callers need different semantics: the public
|
|
87
|
-
* `disconnect()` above awaits it (the caller may care whether the wallet
|
|
88
|
-
* side actually tore down); the wallet-initiated path in
|
|
89
|
-
* `handleAccountsChanged` fires it and swallows the result (the wallet
|
|
90
|
-
* already ended the session on its own side, but the connector's own
|
|
91
|
-
* LOCAL state — e.g. a cached account/uuid — still needs clearing, or a
|
|
92
|
-
* later connect to a different wallet reads it as stale and never
|
|
93
|
-
* rebinds).
|
|
94
|
-
*/
|
|
95
|
-
private finishDisconnect;
|
|
96
53
|
getConnectionURI(): string | undefined;
|
|
97
54
|
getWallets(): WalletMetadata[];
|
|
98
55
|
updateWallets(wallets: WalletMetadata[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-service.d.ts","sourceRoot":"","sources":["../../src/services/connection-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EAET,cAAc,EACd,cAAc,EACd,SAAS,EAMV,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAK7D,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,qBAAa,iBAAiB;
|
|
1
|
+
{"version":3,"file":"connection-service.d.ts","sourceRoot":"","sources":["../../src/services/connection-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EAET,cAAc,EACd,cAAc,EACd,SAAS,EAMV,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAK7D,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,qBAAa,iBAAiB;IAc1B,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,YAAY;IAEpB,OAAO,CAAC,uBAAuB;IApBjC,OAAO,CAAC,eAAe,CAAyB;IAChD,+EAA+E;IAC/E,OAAO,CAAC,iBAAiB,CAA0B;IACnD;;;;;;OAMG;IACH,OAAO,CAAC,aAAa,CAA+B;gBAG1C,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE,cAAc,EAAE,EACzB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,GAAG,CAAC,cAAc,EAAE,SAAS,CAAC,EAC1C,sBAAsB,EAAE,OAAO,EAC/B,YAAY,EAAE,YAAY,EAE1B,uBAAuB,EAAE,MAAM;IAGnC,O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