@meshconnect/uwc-core 2.2.0-snapshot.ec6b95b → 2.3.0
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/README.md +7 -0
- package/dist/events.d.ts +12 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/observability/instrument-handoff.d.ts +2 -0
- package/dist/observability/instrument-handoff.d.ts.map +1 -1
- package/dist/observability/instrument-handoff.js +7 -0
- package/dist/observability/instrument-handoff.js.map +1 -1
- package/dist/observability/telemetry.d.ts +2 -0
- package/dist/observability/telemetry.d.ts.map +1 -1
- package/dist/observability/telemetry.js +15 -2
- package/dist/observability/telemetry.js.map +1 -1
- package/dist/services/connection-service.d.ts.map +1 -1
- package/dist/services/connection-service.js +18 -7
- package/dist/services/connection-service.js.map +1 -1
- package/dist/universal-wallet-connector.d.ts +3 -1
- package/dist/universal-wallet-connector.d.ts.map +1 -1
- package/dist/universal-wallet-connector.js +16 -1
- package/dist/universal-wallet-connector.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
- package/src/events.ts +20 -2
- package/src/observability/instrument-handoff.test.ts +24 -2
- package/src/observability/instrument-handoff.ts +10 -0
- package/src/observability/telemetry.test.ts +89 -0
- package/src/observability/telemetry.ts +21 -2
- package/src/services/connection-service.test.ts +71 -4
- package/src/services/connection-service.ts +22 -7
- package/src/universal-wallet-connector.ts +28 -2
- package/src/version.ts +1 -1
|
@@ -15,6 +15,7 @@ import { NoCommonNetworkError } from '@meshconnect/uwc-types'
|
|
|
15
15
|
import type { SessionManager } from '../managers/session-manager'
|
|
16
16
|
import type { EventManager } from '../managers/event-manager'
|
|
17
17
|
import { raceAbort } from '../utils/abort'
|
|
18
|
+
import { generateId } from '../utils/id'
|
|
18
19
|
import { instrumentHandoff } from '../observability/instrument-handoff'
|
|
19
20
|
import { attachLifecycle } from '../observability/lifecycle-bridge'
|
|
20
21
|
|
|
@@ -95,6 +96,7 @@ export class ConnectionService {
|
|
|
95
96
|
const provider = this.getProviderForMode(wallet, connectionMode)
|
|
96
97
|
const network = this.validateAndDetermineNetwork(networkId, provider)
|
|
97
98
|
const connector = this.getConnector(connectionMode)
|
|
99
|
+
const connectAttemptId = generateId()
|
|
98
100
|
|
|
99
101
|
// Supersede any prior in-flight attempt: abort it so its URI poll and
|
|
100
102
|
// handoff visibility listeners tear down (via the abort paths below) BEFORE
|
|
@@ -122,7 +124,11 @@ export class ConnectionService {
|
|
|
122
124
|
|
|
123
125
|
// Emit AFTER validation so a thrown lookup/validation error doesn't leave
|
|
124
126
|
// listeners seeing a "connecting" state for an attempt that never started.
|
|
125
|
-
this.eventManager.emit('connecting', {
|
|
127
|
+
this.eventManager.emit('connecting', {
|
|
128
|
+
connectionMode,
|
|
129
|
+
walletId,
|
|
130
|
+
connectAttemptId
|
|
131
|
+
})
|
|
126
132
|
|
|
127
133
|
// Store the active connector BEFORE starting connection
|
|
128
134
|
// This allows getConnectionURI to work while connection is in progress
|
|
@@ -145,7 +151,8 @@ export class ConnectionService {
|
|
|
145
151
|
connectionMode,
|
|
146
152
|
walletId,
|
|
147
153
|
namespace: network.namespace,
|
|
148
|
-
chainId: network.id
|
|
154
|
+
chainId: network.id,
|
|
155
|
+
connectAttemptId
|
|
149
156
|
},
|
|
150
157
|
async handoffId => {
|
|
151
158
|
// Publish this attempt's routing for the connector's step sink.
|
|
@@ -156,7 +163,8 @@ export class ConnectionService {
|
|
|
156
163
|
connector,
|
|
157
164
|
network,
|
|
158
165
|
provider,
|
|
159
|
-
signal
|
|
166
|
+
signal,
|
|
167
|
+
connectAttemptId
|
|
160
168
|
)
|
|
161
169
|
} finally {
|
|
162
170
|
// Retract ONLY if we are still the published attempt. An
|
|
@@ -245,7 +253,8 @@ export class ConnectionService {
|
|
|
245
253
|
connector: Connector,
|
|
246
254
|
network: Network,
|
|
247
255
|
provider: SupportedProvider,
|
|
248
|
-
signal: AbortSignal
|
|
256
|
+
signal: AbortSignal,
|
|
257
|
+
connectAttemptId: string
|
|
249
258
|
): Promise<ConnectorResult> {
|
|
250
259
|
// Race the connector call against the AbortSignal so a mid-flight abort
|
|
251
260
|
// (e.g. user cancels the WalletConnect QR while the prompt is open)
|
|
@@ -271,7 +280,8 @@ export class ConnectionService {
|
|
|
271
280
|
network,
|
|
272
281
|
provider,
|
|
273
282
|
connectionMode,
|
|
274
|
-
signal
|
|
283
|
+
signal,
|
|
284
|
+
connectAttemptId
|
|
275
285
|
),
|
|
276
286
|
signal
|
|
277
287
|
)
|
|
@@ -730,7 +740,8 @@ export class ConnectionService {
|
|
|
730
740
|
network: Network,
|
|
731
741
|
provider: SupportedProvider,
|
|
732
742
|
connectionMode: ConnectionMode,
|
|
733
|
-
signal
|
|
743
|
+
signal: AbortSignal | undefined,
|
|
744
|
+
connectAttemptId: string
|
|
734
745
|
): Promise<ConnectorResult> {
|
|
735
746
|
const connectPromise = connector.connect(network, provider)
|
|
736
747
|
|
|
@@ -752,7 +763,11 @@ export class ConnectionService {
|
|
|
752
763
|
}
|
|
753
764
|
if (uri && uri !== emittedUri) {
|
|
754
765
|
emittedUri = uri
|
|
755
|
-
this.eventManager.emit('connectionUri', {
|
|
766
|
+
this.eventManager.emit('connectionUri', {
|
|
767
|
+
uri,
|
|
768
|
+
connectionMode,
|
|
769
|
+
connectAttemptId
|
|
770
|
+
})
|
|
756
771
|
}
|
|
757
772
|
}, 100)
|
|
758
773
|
|
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
DetectedSolanaWalletInfo,
|
|
13
13
|
DetectedTronWalletInfo,
|
|
14
14
|
DetectedTonWalletInfo,
|
|
15
|
+
DetectedBitcoinWalletInfo,
|
|
15
16
|
TransactionRequest,
|
|
16
17
|
TransactionResult,
|
|
17
18
|
NetworkRpcMap,
|
|
@@ -19,7 +20,8 @@ import type {
|
|
|
19
20
|
SignatureResult,
|
|
20
21
|
EIP712TypedData,
|
|
21
22
|
LogLevel,
|
|
22
|
-
Logger
|
|
23
|
+
Logger,
|
|
24
|
+
BitcoinConfig
|
|
23
25
|
} from '@meshconnect/uwc-types'
|
|
24
26
|
import { InjectedConnector } from '@meshconnect/uwc-injected-connector'
|
|
25
27
|
import { WalletConnectConnector } from '@meshconnect/uwc-wallet-connect-connector'
|
|
@@ -63,6 +65,8 @@ export interface UWCConfig {
|
|
|
63
65
|
walletConnectConfig?: WalletConnectConfig
|
|
64
66
|
tonConnectConfig?: TonConnectConfig
|
|
65
67
|
tronConnectorConfig?: TronConnectorConfig
|
|
68
|
+
/** Config for the Bitcoin (bip122) namespace module, threaded into the injected connector. */
|
|
69
|
+
bitcoinConfig?: BitcoinConfig
|
|
66
70
|
// ---- Observability (all optional; defaults preserve current behaviour) -----
|
|
67
71
|
/**
|
|
68
72
|
* Vendor-agnostic telemetry sink. When omitted, UWC emits NOTHING externally —
|
|
@@ -211,7 +215,8 @@ export class UniversalWalletConnector {
|
|
|
211
215
|
usingIntegratedBrowser: configuredUsingIntegratedBrowser = false,
|
|
212
216
|
walletConnectConfig: configuredWalletConnectConfig,
|
|
213
217
|
tonConnectConfig: configuredTonConnectConfig,
|
|
214
|
-
tronConnectorConfig: configuredTronConnectorConfig
|
|
218
|
+
tronConnectorConfig: configuredTronConnectorConfig,
|
|
219
|
+
bitcoinConfig: configuredBitcoinConfig
|
|
215
220
|
} = config
|
|
216
221
|
|
|
217
222
|
// Observability seam — wire the event bus, logger, and (optional) observer
|
|
@@ -299,6 +304,7 @@ export class UniversalWalletConnector {
|
|
|
299
304
|
expectedWallets: this.wallets,
|
|
300
305
|
tonConnectConfig: configuredTonConnectConfig,
|
|
301
306
|
tronConnectorConfig: configuredTronConnectorConfig,
|
|
307
|
+
bitcoinConfig: configuredBitcoinConfig,
|
|
302
308
|
networks,
|
|
303
309
|
// Only forward when the consumer set it, so the connector's own default
|
|
304
310
|
// stays the single source of truth for the value (exactOptionalPropertyTypes).
|
|
@@ -611,6 +617,14 @@ export class UniversalWalletConnector {
|
|
|
611
617
|
pickProvider(w)?.namespaceMetaData?.tvm?.jsBridgeKey ===
|
|
612
618
|
tonDetected.jsBridgeKey
|
|
613
619
|
)
|
|
620
|
+
} else if (namespace === 'bip122') {
|
|
621
|
+
wallet = this.wallets.find(
|
|
622
|
+
w =>
|
|
623
|
+
pickProvider(
|
|
624
|
+
w
|
|
625
|
+
)?.namespaceMetaData?.bip122?.walletStandardName?.toLowerCase() ===
|
|
626
|
+
detected.name.toLowerCase()
|
|
627
|
+
)
|
|
614
628
|
} else {
|
|
615
629
|
wallet = this.wallets.find(
|
|
616
630
|
w => w.name.toLowerCase() === detected.name.toLowerCase()
|
|
@@ -676,6 +690,18 @@ export class UniversalWalletConnector {
|
|
|
676
690
|
icon: d.icon,
|
|
677
691
|
jsBridgeKey: d.jsBridgeKey
|
|
678
692
|
}
|
|
693
|
+
} else if (namespace === 'bip122') {
|
|
694
|
+
const m = nsMetadata as {
|
|
695
|
+
installed?: boolean
|
|
696
|
+
detectedWallet?: DetectedBitcoinWalletInfo
|
|
697
|
+
}
|
|
698
|
+
const d = detected as DetectedBitcoinWalletInfo
|
|
699
|
+
m.installed = true
|
|
700
|
+
m.detectedWallet = {
|
|
701
|
+
uuid: d.uuid,
|
|
702
|
+
name: d.name,
|
|
703
|
+
features: d.features ?? []
|
|
704
|
+
}
|
|
679
705
|
}
|
|
680
706
|
}
|
|
681
707
|
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated from package.json by scripts/generate-version.mjs — do not edit.
|
|
2
|
-
export const UWC_CORE_VERSION = '2.
|
|
2
|
+
export const UWC_CORE_VERSION = '2.3.0'
|