@meshconnect/uwc-types 0.20.0-snapshot.078bc5c → 0.20.0-snapshot.3bf4b70
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 +6 -0
- package/dist/connector.d.ts.map +1 -1
- package/dist/observability.d.ts +32 -0
- package/dist/observability.d.ts.map +1 -1
- package/dist/session.d.ts +9 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/wallet-connect-connector.d.ts +23 -0
- package/dist/wallet-connect-connector.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/connector.ts +6 -0
- package/src/observability.ts +40 -0
- package/src/session.ts +9 -0
- package/src/wallet-connect-connector.ts +24 -0
package/dist/connector.d.ts
CHANGED
|
@@ -44,6 +44,12 @@ export interface ConnectorResult {
|
|
|
44
44
|
address: string;
|
|
45
45
|
availableAddresses: AvailableAddress[];
|
|
46
46
|
publicKey?: string;
|
|
47
|
+
/**
|
|
48
|
+
* True when the connector satisfied this connect() by adopting a live stored
|
|
49
|
+
* session instead of a fresh pairing (WalletConnect session reuse, MFS-642).
|
|
50
|
+
* Propagated onto the Session for observability. Absent = fresh connect.
|
|
51
|
+
*/
|
|
52
|
+
reused?: boolean;
|
|
47
53
|
}
|
|
48
54
|
/**
|
|
49
55
|
* Result interface for network switch operations
|
package/dist/connector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB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,CAAC,iBAAiB,CAAC,CAAA;IAE7B,qBAAqB,CAAC,CACpB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EAAE,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAA;IAE3C;;;;OAIG;IACH,0BAA0B,CAAC,CAAC,YAAY,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAE1E;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,CACf,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,EAC/C,OAAO,EAAE,sBAAsB,GAC9B,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;CAC5B"}
|
package/dist/observability.d.ts
CHANGED
|
@@ -11,6 +11,38 @@
|
|
|
11
11
|
* wires them to whatever backend they run (Datadog, Amplitude, Segment, …).
|
|
12
12
|
*/
|
|
13
13
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
14
|
+
/**
|
|
15
|
+
* Why an opt-in WalletConnect session-reuse attempt fell back to a fresh pairing
|
|
16
|
+
* instead of adopting a stored session (MFS-642). Small, stable enum so it can
|
|
17
|
+
* drive a reuse-outcome dashboard without high cardinality. Emitted via
|
|
18
|
+
* `WalletConnectConfig.onSessionReuseSkipped`.
|
|
19
|
+
*
|
|
20
|
+
* - `no_record` — no topic recorded for the selected wallet (e.g. first connect),
|
|
21
|
+
* or the recorded session is no longer in storage.
|
|
22
|
+
* - `expired` — the recorded session exists but is past its expiry.
|
|
23
|
+
* - `no_address` — the session carries no account for the requested network.
|
|
24
|
+
* - `ping_timeout`— the liveness ping got NO ack within the bounded window (peer
|
|
25
|
+
* slow/suspended or the relay socket is dead — CARE-263). Split
|
|
26
|
+
* from `ping_error` so a slow-but-alive mobile wallet (which
|
|
27
|
+
* would defeat reuse if the window is too tight) is measurable
|
|
28
|
+
* separately from a hard failure.
|
|
29
|
+
* - `ping_error` — the ping REJECTED (offline / relay / protocol error), i.e. an
|
|
30
|
+
* unknown liveness state rather than a confirmed no-ack.
|
|
31
|
+
* - `superseded` — a disconnect()/newer connect() invalidated the attempt mid-ping.
|
|
32
|
+
*/
|
|
33
|
+
export type WalletConnectSessionReuseSkipReason = 'no_record' | 'expired' | 'no_address' | 'ping_timeout' | 'ping_error' | 'superseded';
|
|
34
|
+
/**
|
|
35
|
+
* Payload for `WalletConnectConfig.onSessionReuseSkipped`. Carries the coarse
|
|
36
|
+
* reason plus, for the two ping outcomes, the ping round-trip in ms — so a
|
|
37
|
+
* consumer can chart the ping-latency distribution and decide whether the bound
|
|
38
|
+
* is clipping live-but-slow wallets. (The healthy-ping latency is separately
|
|
39
|
+
* observable as the reused connect's own handoff duration.)
|
|
40
|
+
*/
|
|
41
|
+
export interface WalletConnectSessionReuseSkip {
|
|
42
|
+
reason: WalletConnectSessionReuseSkipReason;
|
|
43
|
+
/** Ping round-trip in ms; present only for `ping_timeout` / `ping_error`. */
|
|
44
|
+
pingMs?: number;
|
|
45
|
+
}
|
|
14
46
|
/**
|
|
15
47
|
* Pluggable logger. The default implementation (`createLogger`) is console-backed
|
|
16
48
|
* and level-gated; inject your own to redirect UWC's internal logging into your
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../src/observability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,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;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAA;AAEnE;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GACnB,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,eAAe;AACjB,iFAAiF;GAC/E,mBAAmB,GACnB,oBAAoB,GACpB,gBAAgB,GAChB,SAAS;AACX,gFAAgF;GAC9E,oBAAoB,GACpB,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"}
|
|
1
|
+
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../src/observability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,mCAAmC,GAC3C,WAAW,GACX,SAAS,GACT,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,YAAY,CAAA;AAEhB;;;;;;GAMG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uBAAuB;AACzB;;;;GAIG;GACD,mBAAmB;AACrB;;;GAGG;GACD,cAAc,CAAA"}
|
package/dist/session.d.ts
CHANGED
|
@@ -16,5 +16,14 @@ export interface Session {
|
|
|
16
16
|
availableNetworks: Network[];
|
|
17
17
|
activeWallet: WalletMetadata | null;
|
|
18
18
|
availableAddresses: AvailableAddress[];
|
|
19
|
+
/**
|
|
20
|
+
* Connection provenance: true when this session was adopted from a live stored
|
|
21
|
+
* WalletConnect session (MFS-642 reuse) rather than established by a fresh
|
|
22
|
+
* pairing handshake. Drives observability — it rides the `connected` telemetry
|
|
23
|
+
* and every subsequent operation handoff so success/error/timeout of reused
|
|
24
|
+
* sessions can be evaluated and triaged separately from fresh ones. Absent/false
|
|
25
|
+
* for fresh pairings and all non-WalletConnect connections.
|
|
26
|
+
*/
|
|
27
|
+
reused?: boolean;
|
|
19
28
|
}
|
|
20
29
|
//# sourceMappingURL=session.d.ts.map
|
package/dist/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,SAAS,CAAA;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,aAAa,EAAE,OAAO,GAAG,IAAI,CAAA;IAC7B,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,IAAI,CAAA;IAChE,+BAA+B,EAAE,eAAe,GAAG,IAAI,CAAA;IACvD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iBAAiB,EAAE,OAAO,EAAE,CAAA;IAC5B,YAAY,EAAE,cAAc,GAAG,IAAI,CAAA;IACnC,kBAAkB,EAAE,gBAAgB,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,SAAS,CAAA;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,aAAa,EAAE,OAAO,GAAG,IAAI,CAAA;IAC7B,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,IAAI,CAAA;IAChE,+BAA+B,EAAE,eAAe,GAAG,IAAI,CAAA;IACvD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iBAAiB,EAAE,OAAO,EAAE,CAAA;IAC5B,YAAY,EAAE,cAAc,GAAG,IAAI,CAAA;IACnC,kBAAkB,EAAE,gBAAgB,EAAE,CAAA;IACtC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WalletConnectSessionReuseSkip } from './observability';
|
|
1
2
|
/**
|
|
2
3
|
* Configuration for WalletConnect connector
|
|
3
4
|
*/
|
|
@@ -34,5 +35,27 @@ export interface WalletConnectConfig {
|
|
|
34
35
|
* TonConnectConfig.onSessionRestored.
|
|
35
36
|
*/
|
|
36
37
|
onSessionRestored?: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Fired when reuse was attempted (enableSessionReuse on + wallet known) but fell
|
|
40
|
+
* back to a fresh pairing. Carries the coarse `reason` plus, for the ping
|
|
41
|
+
* outcomes, the ping round-trip (`pingMs`). The counterpart to onSessionRestored:
|
|
42
|
+
* together they give a reuse-outcome funnel (reused vs the reason it wasn't) for
|
|
43
|
+
* monitoring. Telemetry-only; never affects behaviour. No-op unless
|
|
44
|
+
* enableSessionReuse is on.
|
|
45
|
+
*/
|
|
46
|
+
onSessionReuseSkipped?: (skip: WalletConnectSessionReuseSkip) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Opt-in liveness-ping window (ms) for session reuse. Reuse is OPTIMISTIC by
|
|
49
|
+
* default: when this is unset (or ≤ 0) connect() adopts a stored session with no
|
|
50
|
+
* blocking probe — matching WC's own restore and every mainstream dApp connector
|
|
51
|
+
* — and a dead peer surfaces at the first sign (bounded by the app's signing
|
|
52
|
+
* escape hatch), not by making every relaunch wait. Set a positive number only if
|
|
53
|
+
* you would rather pay an up-front ping and re-pair immediately than risk a late
|
|
54
|
+
* failure; a too-tight bound will discard live-but-slow mobile peers (they often
|
|
55
|
+
* need > 4s to ack over the relay), so calibrate against the `pingMs` carried by
|
|
56
|
+
* onSessionReuseSkipped. Exposed as config so this bound can be tuned per consumer
|
|
57
|
+
* without a new UWC release. No-op unless enableSessionReuse is on.
|
|
58
|
+
*/
|
|
59
|
+
sessionReusePingTimeoutMs?: number;
|
|
37
60
|
}
|
|
38
61
|
//# sourceMappingURL=wallet-connect-connector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-connect-connector.d.ts","sourceRoot":"","sources":["../src/wallet-connect-connector.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,EAAE,CAAA;KAChB,CAAA;IACD;;;;;;;;;;;;;;;OAeG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"wallet-connect-connector.d.ts","sourceRoot":"","sources":["../src/wallet-connect-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAA;AAEpE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,EAAE,CAAA;KAChB,CAAA;IACD;;;;;;;;;;;;;;;OAeG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC9B;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,6BAA6B,KAAK,IAAI,CAAA;IACrE;;;;;;;;;;;OAWG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAA;CACnC"}
|
package/package.json
CHANGED
package/src/connector.ts
CHANGED
|
@@ -56,6 +56,12 @@ export interface ConnectorResult {
|
|
|
56
56
|
address: string
|
|
57
57
|
availableAddresses: AvailableAddress[]
|
|
58
58
|
publicKey?: string
|
|
59
|
+
/**
|
|
60
|
+
* True when the connector satisfied this connect() by adopting a live stored
|
|
61
|
+
* session instead of a fresh pairing (WalletConnect session reuse, MFS-642).
|
|
62
|
+
* Propagated onto the Session for observability. Absent = fresh connect.
|
|
63
|
+
*/
|
|
64
|
+
reused?: boolean
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
/**
|
package/src/observability.ts
CHANGED
|
@@ -13,6 +13,46 @@
|
|
|
13
13
|
|
|
14
14
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Why an opt-in WalletConnect session-reuse attempt fell back to a fresh pairing
|
|
18
|
+
* instead of adopting a stored session (MFS-642). Small, stable enum so it can
|
|
19
|
+
* drive a reuse-outcome dashboard without high cardinality. Emitted via
|
|
20
|
+
* `WalletConnectConfig.onSessionReuseSkipped`.
|
|
21
|
+
*
|
|
22
|
+
* - `no_record` — no topic recorded for the selected wallet (e.g. first connect),
|
|
23
|
+
* or the recorded session is no longer in storage.
|
|
24
|
+
* - `expired` — the recorded session exists but is past its expiry.
|
|
25
|
+
* - `no_address` — the session carries no account for the requested network.
|
|
26
|
+
* - `ping_timeout`— the liveness ping got NO ack within the bounded window (peer
|
|
27
|
+
* slow/suspended or the relay socket is dead — CARE-263). Split
|
|
28
|
+
* from `ping_error` so a slow-but-alive mobile wallet (which
|
|
29
|
+
* would defeat reuse if the window is too tight) is measurable
|
|
30
|
+
* separately from a hard failure.
|
|
31
|
+
* - `ping_error` — the ping REJECTED (offline / relay / protocol error), i.e. an
|
|
32
|
+
* unknown liveness state rather than a confirmed no-ack.
|
|
33
|
+
* - `superseded` — a disconnect()/newer connect() invalidated the attempt mid-ping.
|
|
34
|
+
*/
|
|
35
|
+
export type WalletConnectSessionReuseSkipReason =
|
|
36
|
+
| 'no_record'
|
|
37
|
+
| 'expired'
|
|
38
|
+
| 'no_address'
|
|
39
|
+
| 'ping_timeout'
|
|
40
|
+
| 'ping_error'
|
|
41
|
+
| 'superseded'
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Payload for `WalletConnectConfig.onSessionReuseSkipped`. Carries the coarse
|
|
45
|
+
* reason plus, for the two ping outcomes, the ping round-trip in ms — so a
|
|
46
|
+
* consumer can chart the ping-latency distribution and decide whether the bound
|
|
47
|
+
* is clipping live-but-slow wallets. (The healthy-ping latency is separately
|
|
48
|
+
* observable as the reused connect's own handoff duration.)
|
|
49
|
+
*/
|
|
50
|
+
export interface WalletConnectSessionReuseSkip {
|
|
51
|
+
reason: WalletConnectSessionReuseSkipReason
|
|
52
|
+
/** Ping round-trip in ms; present only for `ping_timeout` / `ping_error`. */
|
|
53
|
+
pingMs?: number
|
|
54
|
+
}
|
|
55
|
+
|
|
16
56
|
/**
|
|
17
57
|
* Pluggable logger. The default implementation (`createLogger`) is console-backed
|
|
18
58
|
* and level-gated; inject your own to redirect UWC's internal logging into your
|
package/src/session.ts
CHANGED
|
@@ -18,4 +18,13 @@ export interface Session {
|
|
|
18
18
|
availableNetworks: Network[]
|
|
19
19
|
activeWallet: WalletMetadata | null
|
|
20
20
|
availableAddresses: AvailableAddress[]
|
|
21
|
+
/**
|
|
22
|
+
* Connection provenance: true when this session was adopted from a live stored
|
|
23
|
+
* WalletConnect session (MFS-642 reuse) rather than established by a fresh
|
|
24
|
+
* pairing handshake. Drives observability — it rides the `connected` telemetry
|
|
25
|
+
* and every subsequent operation handoff so success/error/timeout of reused
|
|
26
|
+
* sessions can be evaluated and triaged separately from fresh ones. Absent/false
|
|
27
|
+
* for fresh pairings and all non-WalletConnect connections.
|
|
28
|
+
*/
|
|
29
|
+
reused?: boolean
|
|
21
30
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { WalletConnectSessionReuseSkip } from './observability'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Configuration for WalletConnect connector
|
|
3
5
|
*/
|
|
@@ -34,4 +36,26 @@ export interface WalletConnectConfig {
|
|
|
34
36
|
* TonConnectConfig.onSessionRestored.
|
|
35
37
|
*/
|
|
36
38
|
onSessionRestored?: () => void
|
|
39
|
+
/**
|
|
40
|
+
* Fired when reuse was attempted (enableSessionReuse on + wallet known) but fell
|
|
41
|
+
* back to a fresh pairing. Carries the coarse `reason` plus, for the ping
|
|
42
|
+
* outcomes, the ping round-trip (`pingMs`). The counterpart to onSessionRestored:
|
|
43
|
+
* together they give a reuse-outcome funnel (reused vs the reason it wasn't) for
|
|
44
|
+
* monitoring. Telemetry-only; never affects behaviour. No-op unless
|
|
45
|
+
* enableSessionReuse is on.
|
|
46
|
+
*/
|
|
47
|
+
onSessionReuseSkipped?: (skip: WalletConnectSessionReuseSkip) => void
|
|
48
|
+
/**
|
|
49
|
+
* Opt-in liveness-ping window (ms) for session reuse. Reuse is OPTIMISTIC by
|
|
50
|
+
* default: when this is unset (or ≤ 0) connect() adopts a stored session with no
|
|
51
|
+
* blocking probe — matching WC's own restore and every mainstream dApp connector
|
|
52
|
+
* — and a dead peer surfaces at the first sign (bounded by the app's signing
|
|
53
|
+
* escape hatch), not by making every relaunch wait. Set a positive number only if
|
|
54
|
+
* you would rather pay an up-front ping and re-pair immediately than risk a late
|
|
55
|
+
* failure; a too-tight bound will discard live-but-slow mobile peers (they often
|
|
56
|
+
* need > 4s to ack over the relay), so calibrate against the `pingMs` carried by
|
|
57
|
+
* onSessionReuseSkipped. Exposed as config so this bound can be tuned per consumer
|
|
58
|
+
* without a new UWC release. No-op unless enableSessionReuse is on.
|
|
59
|
+
*/
|
|
60
|
+
sessionReusePingTimeoutMs?: number
|
|
37
61
|
}
|