@meshconnect/uwc-types 0.19.0 → 0.20.0-snapshot.078bc5c

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.
@@ -53,6 +53,21 @@ export interface SwitchNetworkResult {
53
53
  address: string;
54
54
  availableAddresses?: AvailableAddress[];
55
55
  }
56
+ /**
57
+ * Optional per-call hints for connect(). Additive and connector-agnostic —
58
+ * connectors that do not use a field simply ignore it.
59
+ */
60
+ export interface ConnectOptions {
61
+ /**
62
+ * Display name of the wallet the user selected (from the catalog). The
63
+ * WalletConnect connector keys its session-reuse record on this trusted name:
64
+ * it only ever re-adopts a session it previously recorded for the same selected
65
+ * wallet, never one established by another (possibly rogue) peer. Ignored by
66
+ * connectors without session reuse; absence disables reuse (fresh pairing is
67
+ * always safe).
68
+ */
69
+ walletName?: string;
70
+ }
56
71
  /**
57
72
  * Common interface for all wallet connectors
58
73
  */
@@ -63,7 +78,7 @@ export interface Connector {
63
78
  * @param args Additional arguments specific to the connector type
64
79
  * @returns A promise that resolves to a ConnectorResult containing the network ID, wallet address, and available addresses
65
80
  */
66
- connect(network: Network, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider | TonConnectWalletProvider): Promise<ConnectorResult>;
81
+ connect(network: Network, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider | TonConnectWalletProvider, options?: ConnectOptions): Promise<ConnectorResult>;
67
82
  /**
68
83
  * Get the connection URI for the wallet, if applicable
69
84
  * This is typically used for WalletConnect or similar protocols
@@ -73,6 +88,18 @@ export interface Connector {
73
88
  * @remarks This method is optional and may not be implemented by all connectors.
74
89
  */
75
90
  getConnectionURI?(): string;
91
+ /**
92
+ * Pre-generate a connection pairing (URI) ahead of wallet selection, WITHOUT
93
+ * waiting for approval. Warms the transport (e.g. opens the WalletConnect relay
94
+ * socket on a cold client) and returns a URI the caller can deep-link inside a
95
+ * user gesture; a subsequent `connect()` adopts the same pairing so the URI the
96
+ * user approves matches the one opened. Optional — only connectors with a
97
+ * pairing step (WalletConnect) implement it.
98
+ * @param provider Only `supportedNetworkIds` is required (pass the UNION of the
99
+ * session's WalletConnect wallets' networks so one pairing serves any wallet).
100
+ * @returns The pairing URI.
101
+ */
102
+ beginPairing?(provider: Pick<WalletConnectProvider, 'supportedNetworkIds'>): Promise<string>;
76
103
  /**
77
104
  * Disconnect from the wallet
78
105
  * This method is optional and may not be implemented by all connectors.
@@ -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,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEjE;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAA;AAE9B;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,+CAA+C;IAC/C,cAAc,EAAE,cAAc,C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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;CAC5B"}
@@ -9,5 +9,30 @@ export interface WalletConnectConfig {
9
9
  url: string;
10
10
  icons: string[];
11
11
  };
12
+ /**
13
+ * Opt-in: reuse a live WalletConnect session persisted in storage instead of
14
+ * forcing a fresh pairing approval on every connect(). WC v2 keeps approved
15
+ * sessions in the SignClient's storage (IndexedDB) for their full ~7-day TTL;
16
+ * with this off (the default) UWC ignores them and always re-pairs — the
17
+ * historical behaviour (MFS-642). When on, connect() first looks for a stored
18
+ * session whose namespaces cover the requested network and reuses it, skipping
19
+ * the QR/deep-link round-trip; it falls back to a fresh pairing when none is
20
+ * usable. Default false so existing consumers are byte-for-byte unaffected and
21
+ * the blast radius is opt-in per consumer.
22
+ *
23
+ * The SignClient (and its storage) lives in the SAME context that runs this
24
+ * connector — for Mesh Link that is the web.meshconnect.com iframe, whose
25
+ * per-origin IndexedDB survives the iframe being torn down and re-created — so
26
+ * reuse works in the production iframe without any bridge round-trip.
27
+ */
28
+ enableSessionReuse?: boolean;
29
+ /**
30
+ * Fired once when connect() resolves from a reused stored session instead of a
31
+ * fresh pairing handshake. Intended for a single telemetry tag (e.g.
32
+ * restored: true). Optional — omitting it keeps reuse working, only the signal
33
+ * is dropped. No-op unless enableSessionReuse is on. Mirrors
34
+ * TonConnectConfig.onSessionRestored.
35
+ */
36
+ onSessionRestored?: () => void;
12
37
  }
13
38
  //# 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;CACF"}
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;CAC/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshconnect/uwc-types",
3
- "version": "0.19.0",
3
+ "version": "0.20.0-snapshot.078bc5c",
4
4
  "description": "TypeScript types for Universal Wallet Connector",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/connector.ts CHANGED
@@ -67,6 +67,22 @@ export interface SwitchNetworkResult {
67
67
  availableAddresses?: AvailableAddress[]
68
68
  }
69
69
 
70
+ /**
71
+ * Optional per-call hints for connect(). Additive and connector-agnostic —
72
+ * connectors that do not use a field simply ignore it.
73
+ */
74
+ export interface ConnectOptions {
75
+ /**
76
+ * Display name of the wallet the user selected (from the catalog). The
77
+ * WalletConnect connector keys its session-reuse record on this trusted name:
78
+ * it only ever re-adopts a session it previously recorded for the same selected
79
+ * wallet, never one established by another (possibly rogue) peer. Ignored by
80
+ * connectors without session reuse; absence disables reuse (fresh pairing is
81
+ * always safe).
82
+ */
83
+ walletName?: string
84
+ }
85
+
70
86
  /**
71
87
  * Common interface for all wallet connectors
72
88
  */
@@ -84,7 +100,8 @@ export interface Connector {
84
100
  | ExtensionInjectedProvider
85
101
  | IntegratedBrowserInjectedProvider
86
102
  | WalletConnectProvider
87
- | TonConnectWalletProvider
103
+ | TonConnectWalletProvider,
104
+ options?: ConnectOptions
88
105
  ): Promise<ConnectorResult>
89
106
 
90
107
  /**
@@ -97,6 +114,21 @@ export interface Connector {
97
114
  */
98
115
  getConnectionURI?(): string
99
116
 
117
+ /**
118
+ * Pre-generate a connection pairing (URI) ahead of wallet selection, WITHOUT
119
+ * waiting for approval. Warms the transport (e.g. opens the WalletConnect relay
120
+ * socket on a cold client) and returns a URI the caller can deep-link inside a
121
+ * user gesture; a subsequent `connect()` adopts the same pairing so the URI the
122
+ * user approves matches the one opened. Optional — only connectors with a
123
+ * pairing step (WalletConnect) implement it.
124
+ * @param provider Only `supportedNetworkIds` is required (pass the UNION of the
125
+ * session's WalletConnect wallets' networks so one pairing serves any wallet).
126
+ * @returns The pairing URI.
127
+ */
128
+ beginPairing?(
129
+ provider: Pick<WalletConnectProvider, 'supportedNetworkIds'>
130
+ ): Promise<string>
131
+
100
132
  /**
101
133
  * Disconnect from the wallet
102
134
  * This method is optional and may not be implemented by all connectors.
@@ -9,4 +9,29 @@ export interface WalletConnectConfig {
9
9
  url: string
10
10
  icons: string[]
11
11
  }
12
+ /**
13
+ * Opt-in: reuse a live WalletConnect session persisted in storage instead of
14
+ * forcing a fresh pairing approval on every connect(). WC v2 keeps approved
15
+ * sessions in the SignClient's storage (IndexedDB) for their full ~7-day TTL;
16
+ * with this off (the default) UWC ignores them and always re-pairs — the
17
+ * historical behaviour (MFS-642). When on, connect() first looks for a stored
18
+ * session whose namespaces cover the requested network and reuses it, skipping
19
+ * the QR/deep-link round-trip; it falls back to a fresh pairing when none is
20
+ * usable. Default false so existing consumers are byte-for-byte unaffected and
21
+ * the blast radius is opt-in per consumer.
22
+ *
23
+ * The SignClient (and its storage) lives in the SAME context that runs this
24
+ * connector — for Mesh Link that is the web.meshconnect.com iframe, whose
25
+ * per-origin IndexedDB survives the iframe being torn down and re-created — so
26
+ * reuse works in the production iframe without any bridge round-trip.
27
+ */
28
+ enableSessionReuse?: boolean
29
+ /**
30
+ * Fired once when connect() resolves from a reused stored session instead of a
31
+ * fresh pairing handshake. Intended for a single telemetry tag (e.g.
32
+ * restored: true). Optional — omitting it keeps reuse working, only the signal
33
+ * is dropped. No-op unless enableSessionReuse is on. Mirrors
34
+ * TonConnectConfig.onSessionRestored.
35
+ */
36
+ onSessionRestored?: () => void
12
37
  }