@meshconnect/uwc-core 2.6.0 → 2.7.0-snapshot.c392d3d
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 +11 -2
- package/dist/events.d.ts +10 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/observability/instrument-handoff.d.ts +3 -0
- package/dist/observability/instrument-handoff.d.ts.map +1 -1
- package/dist/observability/instrument-handoff.js +6 -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 +26 -10
- package/dist/observability/telemetry.js.map +1 -1
- package/dist/services/connection-service.d.ts +6 -2
- package/dist/services/connection-service.d.ts.map +1 -1
- package/dist/services/connection-service.js +19 -9
- package/dist/services/connection-service.js.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/network-selection.d.ts +34 -0
- package/dist/services/network-selection.d.ts.map +1 -0
- package/dist/services/network-selection.js +54 -0
- package/dist/services/network-selection.js.map +1 -0
- package/dist/universal-wallet-connector.d.ts +8 -1
- package/dist/universal-wallet-connector.d.ts.map +1 -1
- package/dist/universal-wallet-connector.js +2 -1
- package/dist/universal-wallet-connector.js.map +1 -1
- package/dist/utils/to-wallet-error.d.ts.map +1 -1
- package/dist/utils/to-wallet-error.js +7 -1
- package/dist/utils/to-wallet-error.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 +10 -0
- package/src/index.ts +4 -0
- package/src/observability/instrument-handoff.ts +9 -0
- package/src/observability/telemetry.test.ts +83 -0
- package/src/observability/telemetry.ts +29 -10
- package/src/services/connection-service.test.ts +46 -6
- package/src/services/connection-service.ts +28 -11
- package/src/services/index.ts +1 -0
- package/src/services/network-selection.test.ts +152 -0
- package/src/services/network-selection.ts +86 -0
- package/src/services/transaction-service.test.ts +25 -0
- package/src/universal-wallet-connector.ts +10 -1
- package/src/utils/to-wallet-error.test.ts +18 -0
- package/src/utils/to-wallet-error.ts +7 -1
- package/src/version.ts +1 -1
|
@@ -30,6 +30,7 @@ import type { TronConnectorConfig } from '@meshconnect/uwc-tron-connector'
|
|
|
30
30
|
import { SessionManager } from './managers/session-manager'
|
|
31
31
|
import { EventManager } from './managers/event-manager'
|
|
32
32
|
import { ConnectionService } from './services/connection-service'
|
|
33
|
+
import { DEFAULT_NAMESPACE_PRIORITY } from './services/network-selection'
|
|
33
34
|
import { NetworkSwitchService } from './services/network-switch-service'
|
|
34
35
|
import { SignatureService } from './services/signature-service'
|
|
35
36
|
import { TransactionService } from './services/transaction-service'
|
|
@@ -109,6 +110,13 @@ export interface UWCConfig {
|
|
|
109
110
|
* Default 15_000.
|
|
110
111
|
*/
|
|
111
112
|
secondaryGatherTimeoutMs?: number
|
|
113
|
+
/**
|
|
114
|
+
* Namespace preference for a connect that names no `networkId`. Injected mode
|
|
115
|
+
* only, and only among namespaces whose provider detection found installed —
|
|
116
|
+
* an undetected namespace is never auto-picked. Catalog order breaks ties.
|
|
117
|
+
* Default `DEFAULT_NAMESPACE_PRIORITY` (eip155, solana, tron, tvm, bip122).
|
|
118
|
+
*/
|
|
119
|
+
preferredNamespaces?: readonly Namespace[]
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
/** Common options for user-initiated async operations. */
|
|
@@ -443,7 +451,8 @@ export class UniversalWalletConnector {
|
|
|
443
451
|
this.connectors,
|
|
444
452
|
configuredUsingIntegratedBrowser,
|
|
445
453
|
this.eventManager,
|
|
446
|
-
this.walletResponseTimeoutMs
|
|
454
|
+
this.walletResponseTimeoutMs,
|
|
455
|
+
config.preferredNamespaces ?? DEFAULT_NAMESPACE_PRIORITY
|
|
447
456
|
)
|
|
448
457
|
this.networkSwitchService = new NetworkSwitchService(
|
|
449
458
|
networks,
|
|
@@ -213,6 +213,24 @@ describe('toWalletError', () => {
|
|
|
213
213
|
})
|
|
214
214
|
})
|
|
215
215
|
|
|
216
|
+
it('carries the provider reason of a connector error', () => {
|
|
217
|
+
const err = new WalletConnectorError({
|
|
218
|
+
type: 'unknown',
|
|
219
|
+
message: 'An unknown RPC error occurred.',
|
|
220
|
+
providerReason: 'cancelled'
|
|
221
|
+
})
|
|
222
|
+
expect(toWalletError(err)).toEqual({
|
|
223
|
+
type: 'unknown',
|
|
224
|
+
message: 'An unknown RPC error occurred.',
|
|
225
|
+
providerReason: 'cancelled'
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
it('omits providerReason when the connector error has none', () => {
|
|
230
|
+
const err = new WalletConnectorError({ type: 'unknown', message: 'x' })
|
|
231
|
+
expect(toWalletError(err)).not.toHaveProperty('providerReason')
|
|
232
|
+
})
|
|
233
|
+
|
|
216
234
|
it('bounds an over-long non-connector message (shared safeErrorMessage cap)', () => {
|
|
217
235
|
const err = new Error('x'.repeat(10_000))
|
|
218
236
|
expect(toWalletError(err).message).toHaveLength(500)
|
|
@@ -27,7 +27,13 @@ const MAX_ERROR_CODE_LENGTH = 64
|
|
|
27
27
|
export function toWalletError(error: unknown): WalletError {
|
|
28
28
|
try {
|
|
29
29
|
if (error instanceof WalletConnectorError) {
|
|
30
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
type: error.type,
|
|
32
|
+
message: error.message,
|
|
33
|
+
...(error.providerReason
|
|
34
|
+
? { providerReason: error.providerReason }
|
|
35
|
+
: {})
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
return { type: 'unknown', message: safeErrorMessage(error) }
|
|
33
39
|
} catch {
|
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.7.0'
|