@meshconnect/uwc-types 0.23.0-snapshot.913d8f5 → 0.23.0-snapshot.e5bb500
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 +3 -28
- package/dist/connector.d.ts.map +1 -1
- package/dist/react-hooks.d.ts +7 -9
- package/dist/react-hooks.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/connector.ts +3 -33
- package/src/react-hooks.ts +6 -9
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 { SignatureType, EIP712TypedData } from './signature';
|
|
7
7
|
/**
|
|
8
8
|
* A post-connect wallet lifecycle change observed from the live provider.
|
|
9
9
|
*
|
|
@@ -110,12 +110,9 @@ export interface Connector {
|
|
|
110
110
|
* Sign a message with the connected wallet
|
|
111
111
|
* @param message The message to sign
|
|
112
112
|
* @param provider The wallet provider (required for injected connector)
|
|
113
|
-
* @returns A promise that resolves to
|
|
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.
|
|
113
|
+
* @returns A promise that resolves to the signature
|
|
117
114
|
*/
|
|
118
|
-
signMessage?(message: string, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider | TonConnectWalletProvider): Promise<
|
|
115
|
+
signMessage?(message: string, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider | TonConnectWalletProvider): Promise<SignatureType>;
|
|
119
116
|
/**
|
|
120
117
|
* Sign EIP-712 typed structured data (eth_signTypedData_v4).
|
|
121
118
|
* Required for ERC-3009 (Transfer With Authorization) and EIP-2612 (Permit) relay flows.
|
|
@@ -152,27 +149,5 @@ export interface Connector {
|
|
|
152
149
|
* observes lifecycle leaves it undefined entirely.
|
|
153
150
|
*/
|
|
154
151
|
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>;
|
|
177
152
|
}
|
|
178
153
|
//# 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,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,GAC1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.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NetworkId, Network, ConnectionMode, Session, AvailableAddress, TransactionRequest, TransactionResult, WalletError, EVMCapabilities, SignatureType,
|
|
1
|
+
import type { NetworkId, Network, ConnectionMode, Session, AvailableAddress, TransactionRequest, TransactionResult, WalletError, EVMCapabilities, SignatureType, EIP712TypedData, WalletMetadata } from './index';
|
|
2
2
|
/**
|
|
3
3
|
* WalletConnect connection interface for the useConnection hook
|
|
4
4
|
*/
|
|
@@ -203,22 +203,20 @@ 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
|
|
206
|
+
* const sig = await signMessage('Hello World')
|
|
207
|
+
* console.log('Signature:', sig)
|
|
208
|
+
* // The signature state will also contain the result
|
|
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
|
|
217
|
-
* signature and the EXACT address it was signed with. Claim
|
|
218
|
-
* `result.address` when verifying ownership — never a stale session address.
|
|
216
|
+
* @returns Promise that resolves to the signature string
|
|
219
217
|
* @throws Error if no wallet is connected or signing fails
|
|
220
218
|
*/
|
|
221
|
-
signMessage: (message: string) => Promise<
|
|
219
|
+
signMessage: (message: string) => Promise<SignatureType>;
|
|
222
220
|
/**
|
|
223
221
|
* Indicates if a message signing operation is currently in progress
|
|
224
222
|
*/
|
|
@@ -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,
|
|
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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;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,2BAA2B;IAC1C,iBAAiB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,KAAK,EAAE,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/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 { SignatureType, EIP712TypedData } from './signature'
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* A post-connect wallet lifecycle change observed from the live provider.
|
|
@@ -156,10 +156,7 @@ export interface Connector {
|
|
|
156
156
|
* Sign a message with the connected wallet
|
|
157
157
|
* @param message The message to sign
|
|
158
158
|
* @param provider The wallet provider (required for injected connector)
|
|
159
|
-
* @returns A promise that resolves to
|
|
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.
|
|
159
|
+
* @returns A promise that resolves to the signature
|
|
163
160
|
*/
|
|
164
161
|
signMessage?(
|
|
165
162
|
message: string,
|
|
@@ -168,7 +165,7 @@ export interface Connector {
|
|
|
168
165
|
| IntegratedBrowserInjectedProvider
|
|
169
166
|
| WalletConnectProvider
|
|
170
167
|
| TonConnectWalletProvider
|
|
171
|
-
): Promise<
|
|
168
|
+
): Promise<SignatureType>
|
|
172
169
|
|
|
173
170
|
/**
|
|
174
171
|
* Sign EIP-712 typed structured data (eth_signTypedData_v4).
|
|
@@ -229,31 +226,4 @@ export interface Connector {
|
|
|
229
226
|
listener: (event: WalletLifecycleEvent) => void,
|
|
230
227
|
context: WalletLifecycleContext
|
|
231
228
|
): (() => 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>
|
|
259
229
|
}
|
package/src/react-hooks.ts
CHANGED
|
@@ -9,7 +9,6 @@ import type {
|
|
|
9
9
|
WalletError,
|
|
10
10
|
EVMCapabilities,
|
|
11
11
|
SignatureType,
|
|
12
|
-
SignatureResult,
|
|
13
12
|
EIP712TypedData,
|
|
14
13
|
WalletMetadata
|
|
15
14
|
} from './index'
|
|
@@ -232,22 +231,20 @@ export interface UseSwitchNetworkReturn {
|
|
|
232
231
|
* const { signMessage, isLoading, signature } = useSignMessage()
|
|
233
232
|
*
|
|
234
233
|
* const handleSign = async () => {
|
|
235
|
-
* const
|
|
236
|
-
* console.log('Signature:',
|
|
237
|
-
* // The
|
|
234
|
+
* const sig = await signMessage('Hello World')
|
|
235
|
+
* console.log('Signature:', sig)
|
|
236
|
+
* // The signature state will also contain the result
|
|
238
237
|
* }
|
|
239
238
|
* ```
|
|
240
239
|
*/
|
|
241
240
|
export interface UseSignMessageReturn {
|
|
242
241
|
/**
|
|
243
|
-
* Signs a message with the connected wallet
|
|
242
|
+
* Signs a message with the connected wallet
|
|
244
243
|
* @param message - The message to sign
|
|
245
|
-
* @returns Promise
|
|
246
|
-
* signature and the EXACT address it was signed with. Claim
|
|
247
|
-
* `result.address` when verifying ownership — never a stale session address.
|
|
244
|
+
* @returns Promise that resolves to the signature string
|
|
248
245
|
* @throws Error if no wallet is connected or signing fails
|
|
249
246
|
*/
|
|
250
|
-
signMessage: (message: string) => Promise<
|
|
247
|
+
signMessage: (message: string) => Promise<SignatureType>
|
|
251
248
|
/**
|
|
252
249
|
* Indicates if a message signing operation is currently in progress
|
|
253
250
|
*/
|