@meshconnect/uwc-types 0.20.0-snapshot.cd7b163 → 0.20.0-snapshot.fad656f
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 +29 -25
- package/dist/connector.d.ts.map +1 -1
- package/dist/observability.d.ts +0 -32
- package/dist/observability.d.ts.map +1 -1
- package/dist/react-hooks.d.ts +9 -7
- package/dist/react-hooks.d.ts.map +1 -1
- package/dist/session.d.ts +0 -9
- package/dist/session.d.ts.map +1 -1
- package/dist/wallet-connect-connector.d.ts +0 -35
- package/dist/wallet-connect-connector.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/connector.ts +34 -27
- package/src/observability.ts +0 -40
- package/src/react-hooks.ts +9 -6
- package/src/session.ts +0 -9
- package/src/wallet-connect-connector.ts +0 -36
package/dist/connector.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ConnectionMode } from './connection-mode';
|
|
|
3
3
|
import type { AvailableAddress } from './session';
|
|
4
4
|
import type { DetectedEIP6963WalletInfo, DetectedSolanaWalletInfo, DetectedTronWalletInfo, DetectedTonWalletInfo, ExtensionInjectedProvider, IntegratedBrowserInjectedProvider, WalletConnectProvider, TonConnectWalletProvider, WalletMetadata } from './UWC-state';
|
|
5
5
|
import type { EVMCapabilities, TransactionRequest, TransactionResult } from './transactions';
|
|
6
|
-
import type {
|
|
6
|
+
import type { SignatureResult, EIP712TypedData } from './signature';
|
|
7
7
|
/**
|
|
8
8
|
* A post-connect wallet lifecycle change observed from the live provider.
|
|
9
9
|
*
|
|
@@ -44,12 +44,6 @@ 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;
|
|
53
47
|
}
|
|
54
48
|
/**
|
|
55
49
|
* Result interface for network switch operations
|
|
@@ -59,21 +53,6 @@ export interface SwitchNetworkResult {
|
|
|
59
53
|
address: string;
|
|
60
54
|
availableAddresses?: AvailableAddress[];
|
|
61
55
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Optional per-call hints for connect(). Additive and connector-agnostic —
|
|
64
|
-
* connectors that do not use a field simply ignore it.
|
|
65
|
-
*/
|
|
66
|
-
export interface ConnectOptions {
|
|
67
|
-
/**
|
|
68
|
-
* Display name of the wallet the user selected (from the catalog). The
|
|
69
|
-
* WalletConnect connector keys its session-reuse record on this trusted name:
|
|
70
|
-
* it only ever re-adopts a session it previously recorded for the same selected
|
|
71
|
-
* wallet, never one established by another (possibly rogue) peer. Ignored by
|
|
72
|
-
* connectors without session reuse; absence disables reuse (fresh pairing is
|
|
73
|
-
* always safe).
|
|
74
|
-
*/
|
|
75
|
-
walletName?: string;
|
|
76
|
-
}
|
|
77
56
|
/**
|
|
78
57
|
* Common interface for all wallet connectors
|
|
79
58
|
*/
|
|
@@ -84,7 +63,7 @@ export interface Connector {
|
|
|
84
63
|
* @param args Additional arguments specific to the connector type
|
|
85
64
|
* @returns A promise that resolves to a ConnectorResult containing the network ID, wallet address, and available addresses
|
|
86
65
|
*/
|
|
87
|
-
connect(network: Network, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider | TonConnectWalletProvider
|
|
66
|
+
connect(network: Network, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider | TonConnectWalletProvider): Promise<ConnectorResult>;
|
|
88
67
|
/**
|
|
89
68
|
* Get the connection URI for the wallet, if applicable
|
|
90
69
|
* This is typically used for WalletConnect or similar protocols
|
|
@@ -131,9 +110,12 @@ export interface Connector {
|
|
|
131
110
|
* Sign a message with the connected wallet
|
|
132
111
|
* @param message The message to sign
|
|
133
112
|
* @param provider The wallet provider (required for injected connector)
|
|
134
|
-
* @returns A promise that resolves to
|
|
113
|
+
* @returns A promise that resolves to a {@link SignatureResult} carrying both
|
|
114
|
+
* the signature and the EXACT address it was signed with. Consumers verifying
|
|
115
|
+
* ownership MUST claim `result.address` (the live signer) rather than a
|
|
116
|
+
* possibly-stale session address, which can diverge after an account switch.
|
|
135
117
|
*/
|
|
136
|
-
signMessage?(message: string, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider | TonConnectWalletProvider): Promise<
|
|
118
|
+
signMessage?(message: string, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider | TonConnectWalletProvider): Promise<SignatureResult>;
|
|
137
119
|
/**
|
|
138
120
|
* Sign EIP-712 typed structured data (eth_signTypedData_v4).
|
|
139
121
|
* Required for ERC-3009 (Transfer With Authorization) and EIP-2612 (Permit) relay flows.
|
|
@@ -170,5 +152,27 @@ export interface Connector {
|
|
|
170
152
|
* observes lifecycle leaves it undefined entirely.
|
|
171
153
|
*/
|
|
172
154
|
onLifecycleEvent?(listener: (event: WalletLifecycleEvent) => void, context: WalletLifecycleContext): (() => void) | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* Subscribe to the live provider's REAL account list for the active
|
|
157
|
+
* session — used only to keep UWC's own session state (activeAddress /
|
|
158
|
+
* availableAddresses) in sync with the wallet. This is a distinct concern
|
|
159
|
+
* from `onLifecycleEvent`: that stream is PII-safe telemetry and must
|
|
160
|
+
* never carry an address; this one exists specifically to carry it.
|
|
161
|
+
*
|
|
162
|
+
* An empty array signals the wallet-side logout/lock condition — the
|
|
163
|
+
* caller (core) treats it as a full disconnect. Returns an unsubscribe
|
|
164
|
+
* function, or `undefined` when this connector/session can't be observed
|
|
165
|
+
* (no live `.on`, unsupported namespace). Optional: a connector that
|
|
166
|
+
* never observes real account changes leaves it undefined entirely.
|
|
167
|
+
*/
|
|
168
|
+
onAccountsChanged?(listener: (accounts: string[]) => void, context: WalletLifecycleContext): (() => void) | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Read the wallet's LIVE current address for a given namespace, re-read at
|
|
171
|
+
* call time (not the connect-time cache), so it reflects an in-wallet account
|
|
172
|
+
* switch. Optional: only connectors backed by a live provider/adapter per
|
|
173
|
+
* namespace implement it (injected, tron). Returns null when the namespace
|
|
174
|
+
* isn't connected or no address is available. Must never throw.
|
|
175
|
+
*/
|
|
176
|
+
getLiveAccount?(namespace: Namespace): Promise<string | null>;
|
|
173
177
|
}
|
|
174
178
|
//# sourceMappingURL=connector.d.ts.map
|
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,iCAAiC,EACjC,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACf,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,
|
|
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,EAC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Z,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;IAE3B;;;;;;;;;;;;OAYG;IACH,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/observability.d.ts
CHANGED
|
@@ -11,38 +11,6 @@
|
|
|
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
|
-
}
|
|
46
14
|
/**
|
|
47
15
|
* Pluggable logger. The default implementation (`createLogger`) is console-backed
|
|
48
16
|
* 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
|
|
1
|
+
{"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../src/observability.ts"],"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BAAuB;AACzB;;;;GAIG;GACD,mBAAmB;AACrB;;;GAGG;GACD,cAAc,CAAA"}
|
package/dist/react-hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NetworkId, Network, ConnectionMode, Session, AvailableAddress, TransactionRequest, TransactionResult, WalletError, EVMCapabilities, SignatureType, EIP712TypedData, WalletMetadata } from './index';
|
|
1
|
+
import type { NetworkId, Network, ConnectionMode, Session, AvailableAddress, TransactionRequest, TransactionResult, WalletError, EVMCapabilities, SignatureType, SignatureResult, EIP712TypedData, WalletMetadata } from './index';
|
|
2
2
|
/**
|
|
3
3
|
* WalletConnect connection interface for the useConnection hook
|
|
4
4
|
*/
|
|
@@ -203,20 +203,22 @@ export interface UseSwitchNetworkReturn {
|
|
|
203
203
|
* const { signMessage, isLoading, signature } = useSignMessage()
|
|
204
204
|
*
|
|
205
205
|
* const handleSign = async () => {
|
|
206
|
-
* const
|
|
207
|
-
* console.log('Signature:',
|
|
208
|
-
* // The signature state
|
|
206
|
+
* const { signature, address } = await signMessage('Hello World')
|
|
207
|
+
* console.log('Signature:', signature, 'signed by', address)
|
|
208
|
+
* // The `signature` state also holds the last result.signature.
|
|
209
209
|
* }
|
|
210
210
|
* ```
|
|
211
211
|
*/
|
|
212
212
|
export interface UseSignMessageReturn {
|
|
213
213
|
/**
|
|
214
|
-
* Signs a message with the connected wallet
|
|
214
|
+
* Signs a message with the connected wallet.
|
|
215
215
|
* @param message - The message to sign
|
|
216
|
-
* @returns Promise
|
|
216
|
+
* @returns Promise resolving to a {@link SignatureResult} with both the
|
|
217
|
+
* signature and the EXACT address it was signed with. Claim
|
|
218
|
+
* `result.address` when verifying ownership — never a stale session address.
|
|
217
219
|
* @throws Error if no wallet is connected or signing fails
|
|
218
220
|
*/
|
|
219
|
-
signMessage: (message: string) => Promise<
|
|
221
|
+
signMessage: (message: string) => Promise<SignatureResult>;
|
|
220
222
|
/**
|
|
221
223
|
* Indicates if a message signing operation is currently in progress
|
|
222
224
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-hooks.d.ts","sourceRoot":"","sources":["../src/react-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EACP,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,EACf,MAAM,SAAS,CAAA;AAIhB;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD;;;OAGG;IACH,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,KAAK,EAAE,WAAW,GAAG,SAAS,CAAA;IAC9B;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,KAAK,EAAE,WAAW,GAAG,SAAS,CAAA;IAC9B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD;;;OAGG;IACH,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,WAAW,GAAG,SAAS,CAAA;IAC9B,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAA;CAC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AE,WAAW,GAAG,SAAS,CAAA;CAC/B;AAID;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,eAAe,EAAE,cAAc,EAAE,CAAA;IACjC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;CACjB"}
|
package/dist/session.d.ts
CHANGED
|
@@ -16,14 +16,5 @@ 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;
|
|
28
19
|
}
|
|
29
20
|
//# 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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ionReuseSkip } from './observability';
|
|
2
1
|
/**
|
|
3
2
|
* Configuration for WalletConnect connector
|
|
4
3
|
*/
|
|
@@ -10,39 +9,5 @@ export interface WalletConnectConfig {
|
|
|
10
9
|
url: string;
|
|
11
10
|
icons: string[];
|
|
12
11
|
};
|
|
13
|
-
/**
|
|
14
|
-
* Opt-in: reuse a live WalletConnect session persisted in storage instead of
|
|
15
|
-
* forcing a fresh pairing approval on every connect(). WC v2 keeps approved
|
|
16
|
-
* sessions in the SignClient's storage (IndexedDB) for their full ~7-day TTL;
|
|
17
|
-
* with this off (the default) UWC ignores them and always re-pairs — the
|
|
18
|
-
* historical behaviour (MFS-642). When on, connect() first looks for a stored
|
|
19
|
-
* session whose namespaces cover the requested network and reuses it, skipping
|
|
20
|
-
* the QR/deep-link round-trip; it falls back to a fresh pairing when none is
|
|
21
|
-
* usable. Default false so existing consumers are byte-for-byte unaffected and
|
|
22
|
-
* the blast radius is opt-in per consumer.
|
|
23
|
-
*
|
|
24
|
-
* The SignClient (and its storage) lives in the SAME context that runs this
|
|
25
|
-
* connector — for Mesh Link that is the web.meshconnect.com iframe, whose
|
|
26
|
-
* per-origin IndexedDB survives the iframe being torn down and re-created — so
|
|
27
|
-
* reuse works in the production iframe without any bridge round-trip.
|
|
28
|
-
*/
|
|
29
|
-
enableSessionReuse?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Fired once when connect() resolves from a reused stored session instead of a
|
|
32
|
-
* fresh pairing handshake. Intended for a single telemetry tag (e.g.
|
|
33
|
-
* restored: true). Optional — omitting it keeps reuse working, only the signal
|
|
34
|
-
* is dropped. No-op unless enableSessionReuse is on. Mirrors
|
|
35
|
-
* TonConnectConfig.onSessionRestored.
|
|
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
12
|
}
|
|
48
13
|
//# 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
|
|
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;CACF"}
|
package/package.json
CHANGED
package/src/connector.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
TransactionRequest,
|
|
18
18
|
TransactionResult
|
|
19
19
|
} from './transactions'
|
|
20
|
-
import type {
|
|
20
|
+
import type { SignatureResult, EIP712TypedData } from './signature'
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* A post-connect wallet lifecycle change observed from the live provider.
|
|
@@ -56,12 +56,6 @@ 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
|
|
65
59
|
}
|
|
66
60
|
|
|
67
61
|
/**
|
|
@@ -73,22 +67,6 @@ export interface SwitchNetworkResult {
|
|
|
73
67
|
availableAddresses?: AvailableAddress[]
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
/**
|
|
77
|
-
* Optional per-call hints for connect(). Additive and connector-agnostic —
|
|
78
|
-
* connectors that do not use a field simply ignore it.
|
|
79
|
-
*/
|
|
80
|
-
export interface ConnectOptions {
|
|
81
|
-
/**
|
|
82
|
-
* Display name of the wallet the user selected (from the catalog). The
|
|
83
|
-
* WalletConnect connector keys its session-reuse record on this trusted name:
|
|
84
|
-
* it only ever re-adopts a session it previously recorded for the same selected
|
|
85
|
-
* wallet, never one established by another (possibly rogue) peer. Ignored by
|
|
86
|
-
* connectors without session reuse; absence disables reuse (fresh pairing is
|
|
87
|
-
* always safe).
|
|
88
|
-
*/
|
|
89
|
-
walletName?: string
|
|
90
|
-
}
|
|
91
|
-
|
|
92
70
|
/**
|
|
93
71
|
* Common interface for all wallet connectors
|
|
94
72
|
*/
|
|
@@ -106,8 +84,7 @@ export interface Connector {
|
|
|
106
84
|
| ExtensionInjectedProvider
|
|
107
85
|
| IntegratedBrowserInjectedProvider
|
|
108
86
|
| WalletConnectProvider
|
|
109
|
-
| TonConnectWalletProvider
|
|
110
|
-
options?: ConnectOptions
|
|
87
|
+
| TonConnectWalletProvider
|
|
111
88
|
): Promise<ConnectorResult>
|
|
112
89
|
|
|
113
90
|
/**
|
|
@@ -179,7 +156,10 @@ export interface Connector {
|
|
|
179
156
|
* Sign a message with the connected wallet
|
|
180
157
|
* @param message The message to sign
|
|
181
158
|
* @param provider The wallet provider (required for injected connector)
|
|
182
|
-
* @returns A promise that resolves to
|
|
159
|
+
* @returns A promise that resolves to a {@link SignatureResult} carrying both
|
|
160
|
+
* the signature and the EXACT address it was signed with. Consumers verifying
|
|
161
|
+
* ownership MUST claim `result.address` (the live signer) rather than a
|
|
162
|
+
* possibly-stale session address, which can diverge after an account switch.
|
|
183
163
|
*/
|
|
184
164
|
signMessage?(
|
|
185
165
|
message: string,
|
|
@@ -188,7 +168,7 @@ export interface Connector {
|
|
|
188
168
|
| IntegratedBrowserInjectedProvider
|
|
189
169
|
| WalletConnectProvider
|
|
190
170
|
| TonConnectWalletProvider
|
|
191
|
-
): Promise<
|
|
171
|
+
): Promise<SignatureResult>
|
|
192
172
|
|
|
193
173
|
/**
|
|
194
174
|
* Sign EIP-712 typed structured data (eth_signTypedData_v4).
|
|
@@ -249,4 +229,31 @@ export interface Connector {
|
|
|
249
229
|
listener: (event: WalletLifecycleEvent) => void,
|
|
250
230
|
context: WalletLifecycleContext
|
|
251
231
|
): (() => void) | undefined
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Subscribe to the live provider's REAL account list for the active
|
|
235
|
+
* session — used only to keep UWC's own session state (activeAddress /
|
|
236
|
+
* availableAddresses) in sync with the wallet. This is a distinct concern
|
|
237
|
+
* from `onLifecycleEvent`: that stream is PII-safe telemetry and must
|
|
238
|
+
* never carry an address; this one exists specifically to carry it.
|
|
239
|
+
*
|
|
240
|
+
* An empty array signals the wallet-side logout/lock condition — the
|
|
241
|
+
* caller (core) treats it as a full disconnect. Returns an unsubscribe
|
|
242
|
+
* function, or `undefined` when this connector/session can't be observed
|
|
243
|
+
* (no live `.on`, unsupported namespace). Optional: a connector that
|
|
244
|
+
* never observes real account changes leaves it undefined entirely.
|
|
245
|
+
*/
|
|
246
|
+
onAccountsChanged?(
|
|
247
|
+
listener: (accounts: string[]) => void,
|
|
248
|
+
context: WalletLifecycleContext
|
|
249
|
+
): (() => void) | undefined
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Read the wallet's LIVE current address for a given namespace, re-read at
|
|
253
|
+
* call time (not the connect-time cache), so it reflects an in-wallet account
|
|
254
|
+
* switch. Optional: only connectors backed by a live provider/adapter per
|
|
255
|
+
* namespace implement it (injected, tron). Returns null when the namespace
|
|
256
|
+
* isn't connected or no address is available. Must never throw.
|
|
257
|
+
*/
|
|
258
|
+
getLiveAccount?(namespace: Namespace): Promise<string | null>
|
|
252
259
|
}
|
package/src/observability.ts
CHANGED
|
@@ -13,46 +13,6 @@
|
|
|
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
|
-
|
|
56
16
|
/**
|
|
57
17
|
* Pluggable logger. The default implementation (`createLogger`) is console-backed
|
|
58
18
|
* and level-gated; inject your own to redirect UWC's internal logging into your
|
package/src/react-hooks.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
WalletError,
|
|
10
10
|
EVMCapabilities,
|
|
11
11
|
SignatureType,
|
|
12
|
+
SignatureResult,
|
|
12
13
|
EIP712TypedData,
|
|
13
14
|
WalletMetadata
|
|
14
15
|
} from './index'
|
|
@@ -231,20 +232,22 @@ export interface UseSwitchNetworkReturn {
|
|
|
231
232
|
* const { signMessage, isLoading, signature } = useSignMessage()
|
|
232
233
|
*
|
|
233
234
|
* const handleSign = async () => {
|
|
234
|
-
* const
|
|
235
|
-
* console.log('Signature:',
|
|
236
|
-
* // The signature state
|
|
235
|
+
* const { signature, address } = await signMessage('Hello World')
|
|
236
|
+
* console.log('Signature:', signature, 'signed by', address)
|
|
237
|
+
* // The `signature` state also holds the last result.signature.
|
|
237
238
|
* }
|
|
238
239
|
* ```
|
|
239
240
|
*/
|
|
240
241
|
export interface UseSignMessageReturn {
|
|
241
242
|
/**
|
|
242
|
-
* Signs a message with the connected wallet
|
|
243
|
+
* Signs a message with the connected wallet.
|
|
243
244
|
* @param message - The message to sign
|
|
244
|
-
* @returns Promise
|
|
245
|
+
* @returns Promise resolving to a {@link SignatureResult} with both the
|
|
246
|
+
* signature and the EXACT address it was signed with. Claim
|
|
247
|
+
* `result.address` when verifying ownership — never a stale session address.
|
|
245
248
|
* @throws Error if no wallet is connected or signing fails
|
|
246
249
|
*/
|
|
247
|
-
signMessage: (message: string) => Promise<
|
|
250
|
+
signMessage: (message: string) => Promise<SignatureResult>
|
|
248
251
|
/**
|
|
249
252
|
* Indicates if a message signing operation is currently in progress
|
|
250
253
|
*/
|
package/src/session.ts
CHANGED
|
@@ -18,13 +18,4 @@ 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
|
|
30
21
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { WalletConnectSessionReuseSkip } from './observability'
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Configuration for WalletConnect connector
|
|
5
3
|
*/
|
|
@@ -11,38 +9,4 @@ export interface WalletConnectConfig {
|
|
|
11
9
|
url: string
|
|
12
10
|
icons: string[]
|
|
13
11
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Opt-in: reuse a live WalletConnect session persisted in storage instead of
|
|
16
|
-
* forcing a fresh pairing approval on every connect(). WC v2 keeps approved
|
|
17
|
-
* sessions in the SignClient's storage (IndexedDB) for their full ~7-day TTL;
|
|
18
|
-
* with this off (the default) UWC ignores them and always re-pairs — the
|
|
19
|
-
* historical behaviour (MFS-642). When on, connect() first looks for a stored
|
|
20
|
-
* session whose namespaces cover the requested network and reuses it, skipping
|
|
21
|
-
* the QR/deep-link round-trip; it falls back to a fresh pairing when none is
|
|
22
|
-
* usable. Default false so existing consumers are byte-for-byte unaffected and
|
|
23
|
-
* the blast radius is opt-in per consumer.
|
|
24
|
-
*
|
|
25
|
-
* The SignClient (and its storage) lives in the SAME context that runs this
|
|
26
|
-
* connector — for Mesh Link that is the web.meshconnect.com iframe, whose
|
|
27
|
-
* per-origin IndexedDB survives the iframe being torn down and re-created — so
|
|
28
|
-
* reuse works in the production iframe without any bridge round-trip.
|
|
29
|
-
*/
|
|
30
|
-
enableSessionReuse?: boolean
|
|
31
|
-
/**
|
|
32
|
-
* Fired once when connect() resolves from a reused stored session instead of a
|
|
33
|
-
* fresh pairing handshake. Intended for a single telemetry tag (e.g.
|
|
34
|
-
* restored: true). Optional — omitting it keeps reuse working, only the signal
|
|
35
|
-
* is dropped. No-op unless enableSessionReuse is on. Mirrors
|
|
36
|
-
* TonConnectConfig.onSessionRestored.
|
|
37
|
-
*/
|
|
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
12
|
}
|