@meshconnect/uwc-types 0.16.0 → 0.16.1-snapshot.8e3fd6b
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/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.d.ts +47 -0
- package/dist/observability.d.ts.map +1 -0
- package/dist/observability.js +14 -0
- package/dist/observability.js.map +1 -0
- package/dist/tron-connector.d.ts +15 -8
- package/dist/tron-connector.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/observability.ts +59 -0
- package/src/tron-connector.ts +15 -8
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor-agnostic observability primitives for the Universal Wallet Connector.
|
|
3
|
+
*
|
|
4
|
+
* These are leaf types — no dependency on the core event bus — so any package
|
|
5
|
+
* (including consumers below UWC in the dep graph, e.g. link-v2) can import them
|
|
6
|
+
* without pulling in `@meshconnect/uwc-core`. The richer `UWCTelemetryEvent` /
|
|
7
|
+
* `UWCObserver` shapes live in `@meshconnect/uwc-core` because they reference the
|
|
8
|
+
* core event names.
|
|
9
|
+
*
|
|
10
|
+
* UWC ships NO third-party telemetry SDK. The consumer implements the sinks and
|
|
11
|
+
* wires them to whatever backend they run (Datadog, Amplitude, Segment, …).
|
|
12
|
+
*/
|
|
13
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
14
|
+
/**
|
|
15
|
+
* Pluggable logger. The default implementation (`createLogger`) is console-backed
|
|
16
|
+
* and level-gated; inject your own to redirect UWC's internal logging into your
|
|
17
|
+
* stack. Kept to the four standard levels so a consumer's existing logger usually
|
|
18
|
+
* satisfies it without an adapter.
|
|
19
|
+
*/
|
|
20
|
+
export interface Logger {
|
|
21
|
+
debug(message: string, ...args: unknown[]): void;
|
|
22
|
+
info(message: string, ...args: unknown[]): void;
|
|
23
|
+
warn(message: string, ...args: unknown[]): void;
|
|
24
|
+
error(message: string, ...args: unknown[]): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Canonical wallet-handoff flow taxonomy.
|
|
28
|
+
*
|
|
29
|
+
* UWC is the single owner of this union so the two consumer layers (link-v2 and
|
|
30
|
+
* v3) don't drift. The string values are deliberately frozen to match link-v2's
|
|
31
|
+
* historical `wallet_flow_type` wire values so existing RUM / Segment facets keep
|
|
32
|
+
* matching after a consumer switches to importing this type — this is a
|
|
33
|
+
* lift-and-canonicalize, not a rename.
|
|
34
|
+
*
|
|
35
|
+
* Note: UWC's own `deriveWalletFlowType` only produces the extension / WC / TON /
|
|
36
|
+
* in-wallet / unknown values. The `dapp_*` members are part of the frozen wire
|
|
37
|
+
* taxonomy but are set only by a consumer with richer context — forward-compat,
|
|
38
|
+
* not dead code.
|
|
39
|
+
*/
|
|
40
|
+
export type WalletFlowType = 'browser_extension_flow' | 'wallet_connect_deep_link_flow' | 'wallet_connect_qr_flow' | 'dapp_deep_link_flow' | 'dapp_qr_flow' | 'ton_connect_qr_flow' | 'ton_connect_deep_link_flow' | 'in_wallet_browser_flow' | 'unknown';
|
|
41
|
+
/**
|
|
42
|
+
* Coarse runtime surface. Intentionally a small enum — never a raw user-agent
|
|
43
|
+
* string, which is PII and high-cardinality. Used to decide whether mobile-only
|
|
44
|
+
* heuristics (e.g. focus bracketing) apply to a handoff.
|
|
45
|
+
*/
|
|
46
|
+
export type Platform = 'mobile' | 'desktop' | 'webview' | 'unknown';
|
|
47
|
+
//# sourceMappingURL=observability.d.ts.map
|
|
@@ -0,0 +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;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAChD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAC/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;IAC/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAA;CACjD;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,cAAc,GACtB,wBAAwB,GACxB,+BAA+B,GAC/B,wBAAwB,GACxB,qBAAqB,GACrB,cAAc,GACd,qBAAqB,GACrB,4BAA4B,GAC5B,wBAAwB,GACxB,SAAS,CAAA;AAEb;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor-agnostic observability primitives for the Universal Wallet Connector.
|
|
3
|
+
*
|
|
4
|
+
* These are leaf types — no dependency on the core event bus — so any package
|
|
5
|
+
* (including consumers below UWC in the dep graph, e.g. link-v2) can import them
|
|
6
|
+
* without pulling in `@meshconnect/uwc-core`. The richer `UWCTelemetryEvent` /
|
|
7
|
+
* `UWCObserver` shapes live in `@meshconnect/uwc-core` because they reference the
|
|
8
|
+
* core event names.
|
|
9
|
+
*
|
|
10
|
+
* UWC ships NO third-party telemetry SDK. The consumer implements the sinks and
|
|
11
|
+
* wires them to whatever backend they run (Datadog, Amplitude, Segment, …).
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=observability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability.js","sourceRoot":"","sources":["../src/observability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
package/dist/tron-connector.d.ts
CHANGED
|
@@ -29,16 +29,23 @@ export interface TronGridConfig {
|
|
|
29
29
|
* `UniversalWalletConnector` once the core wiring lands; until then it is
|
|
30
30
|
* supplied directly when constructing a `TronConnector`.
|
|
31
31
|
*
|
|
32
|
-
* The `enabledWallets` set is
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* The `enabledWallets` set is an OPTIONAL per-wallet feature-flag surface. When
|
|
33
|
+
* omitted, the connector is fully catalog-driven: every wallet whose metadata
|
|
34
|
+
* declares a `namespaceMetaData.tron.injectedId` is enabled — the backend
|
|
35
|
+
* (Retool) is the single source of truth. Provide it only to gate a subset, so a
|
|
36
|
+
* single wallet can be ramped up or disabled in production independently of the
|
|
37
|
+
* others. Passing an empty set/array enables nothing (disables the connector).
|
|
36
38
|
*/
|
|
37
39
|
export interface TronConnectorConfig {
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
40
|
-
* `namespaceMetaData.tron.injectedId`
|
|
41
|
-
* are neither surfaced by
|
|
41
|
+
* Optional allow-list of wallets to enable, matched against each wallet's
|
|
42
|
+
* `WalletMetadata.id` or its `namespaceMetaData.tron.injectedId`
|
|
43
|
+
* (case-insensitive). Wallets not enabled are neither surfaced by
|
|
44
|
+
* `getAvailableWallets` nor connectable.
|
|
45
|
+
*
|
|
46
|
+
* **Omit it** to enable every wallet the passed-in metadata marks Tron-capable
|
|
47
|
+
* (the recommended, catalog-driven default — consumers then need no hardcoded
|
|
48
|
+
* wallet list). An **empty** set/array enables nothing.
|
|
42
49
|
*
|
|
43
50
|
* Matching by `WalletMetadata.id` requires the wallet metadata to be available
|
|
44
51
|
* — i.e. `getAvailableWallets` is called with `expectedWallets` (the standard
|
|
@@ -46,7 +53,7 @@ export interface TronConnectorConfig {
|
|
|
46
53
|
* without `expectedWallets` has only the configured keys to go on, so those
|
|
47
54
|
* keys must be **injectedIds** (e.g. `tronLink`, not `tronlink`).
|
|
48
55
|
*/
|
|
49
|
-
enabledWallets
|
|
56
|
+
enabledWallets?: ReadonlySet<TronWalletId> | readonly TronWalletId[];
|
|
50
57
|
/** Full-node endpoints, API key, and TRC20 fee limit. */
|
|
51
58
|
tronGrid?: TronGridConfig;
|
|
52
59
|
/** Timeout (ms) for the per-wallet injection probe during `connect()`. Default: 3000. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tron-connector.d.ts","sourceRoot":"","sources":["../src/tron-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AAEjC,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9C,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED
|
|
1
|
+
{"version":3,"file":"tron-connector.d.ts","sourceRoot":"","sources":["../src/tron-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AAEjC,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9C,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,SAAS,YAAY,EAAE,CAAA;IAEpE,yDAAyD;IACzD,QAAQ,CAAC,EAAE,cAAc,CAAA;IAEzB,yFAAyF;IACzF,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAE3B,8DAA8D;IAC9D,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor-agnostic observability primitives for the Universal Wallet Connector.
|
|
3
|
+
*
|
|
4
|
+
* These are leaf types — no dependency on the core event bus — so any package
|
|
5
|
+
* (including consumers below UWC in the dep graph, e.g. link-v2) can import them
|
|
6
|
+
* without pulling in `@meshconnect/uwc-core`. The richer `UWCTelemetryEvent` /
|
|
7
|
+
* `UWCObserver` shapes live in `@meshconnect/uwc-core` because they reference the
|
|
8
|
+
* core event names.
|
|
9
|
+
*
|
|
10
|
+
* UWC ships NO third-party telemetry SDK. The consumer implements the sinks and
|
|
11
|
+
* wires them to whatever backend they run (Datadog, Amplitude, Segment, …).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Pluggable logger. The default implementation (`createLogger`) is console-backed
|
|
18
|
+
* and level-gated; inject your own to redirect UWC's internal logging into your
|
|
19
|
+
* stack. Kept to the four standard levels so a consumer's existing logger usually
|
|
20
|
+
* satisfies it without an adapter.
|
|
21
|
+
*/
|
|
22
|
+
export interface Logger {
|
|
23
|
+
debug(message: string, ...args: unknown[]): void
|
|
24
|
+
info(message: string, ...args: unknown[]): void
|
|
25
|
+
warn(message: string, ...args: unknown[]): void
|
|
26
|
+
error(message: string, ...args: unknown[]): void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Canonical wallet-handoff flow taxonomy.
|
|
31
|
+
*
|
|
32
|
+
* UWC is the single owner of this union so the two consumer layers (link-v2 and
|
|
33
|
+
* v3) don't drift. The string values are deliberately frozen to match link-v2's
|
|
34
|
+
* historical `wallet_flow_type` wire values so existing RUM / Segment facets keep
|
|
35
|
+
* matching after a consumer switches to importing this type — this is a
|
|
36
|
+
* lift-and-canonicalize, not a rename.
|
|
37
|
+
*
|
|
38
|
+
* Note: UWC's own `deriveWalletFlowType` only produces the extension / WC / TON /
|
|
39
|
+
* in-wallet / unknown values. The `dapp_*` members are part of the frozen wire
|
|
40
|
+
* taxonomy but are set only by a consumer with richer context — forward-compat,
|
|
41
|
+
* not dead code.
|
|
42
|
+
*/
|
|
43
|
+
export type WalletFlowType =
|
|
44
|
+
| 'browser_extension_flow'
|
|
45
|
+
| 'wallet_connect_deep_link_flow'
|
|
46
|
+
| 'wallet_connect_qr_flow'
|
|
47
|
+
| 'dapp_deep_link_flow'
|
|
48
|
+
| 'dapp_qr_flow'
|
|
49
|
+
| 'ton_connect_qr_flow'
|
|
50
|
+
| 'ton_connect_deep_link_flow'
|
|
51
|
+
| 'in_wallet_browser_flow'
|
|
52
|
+
| 'unknown'
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Coarse runtime surface. Intentionally a small enum — never a raw user-agent
|
|
56
|
+
* string, which is PII and high-cardinality. Used to decide whether mobile-only
|
|
57
|
+
* heuristics (e.g. focus bracketing) apply to a handoff.
|
|
58
|
+
*/
|
|
59
|
+
export type Platform = 'mobile' | 'desktop' | 'webview' | 'unknown'
|
package/src/tron-connector.ts
CHANGED
|
@@ -32,16 +32,23 @@ export interface TronGridConfig {
|
|
|
32
32
|
* `UniversalWalletConnector` once the core wiring lands; until then it is
|
|
33
33
|
* supplied directly when constructing a `TronConnector`.
|
|
34
34
|
*
|
|
35
|
-
* The `enabledWallets` set is
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* The `enabledWallets` set is an OPTIONAL per-wallet feature-flag surface. When
|
|
36
|
+
* omitted, the connector is fully catalog-driven: every wallet whose metadata
|
|
37
|
+
* declares a `namespaceMetaData.tron.injectedId` is enabled — the backend
|
|
38
|
+
* (Retool) is the single source of truth. Provide it only to gate a subset, so a
|
|
39
|
+
* single wallet can be ramped up or disabled in production independently of the
|
|
40
|
+
* others. Passing an empty set/array enables nothing (disables the connector).
|
|
39
41
|
*/
|
|
40
42
|
export interface TronConnectorConfig {
|
|
41
43
|
/**
|
|
42
|
-
*
|
|
43
|
-
* `namespaceMetaData.tron.injectedId`
|
|
44
|
-
* are neither surfaced by
|
|
44
|
+
* Optional allow-list of wallets to enable, matched against each wallet's
|
|
45
|
+
* `WalletMetadata.id` or its `namespaceMetaData.tron.injectedId`
|
|
46
|
+
* (case-insensitive). Wallets not enabled are neither surfaced by
|
|
47
|
+
* `getAvailableWallets` nor connectable.
|
|
48
|
+
*
|
|
49
|
+
* **Omit it** to enable every wallet the passed-in metadata marks Tron-capable
|
|
50
|
+
* (the recommended, catalog-driven default — consumers then need no hardcoded
|
|
51
|
+
* wallet list). An **empty** set/array enables nothing.
|
|
45
52
|
*
|
|
46
53
|
* Matching by `WalletMetadata.id` requires the wallet metadata to be available
|
|
47
54
|
* — i.e. `getAvailableWallets` is called with `expectedWallets` (the standard
|
|
@@ -49,7 +56,7 @@ export interface TronConnectorConfig {
|
|
|
49
56
|
* without `expectedWallets` has only the configured keys to go on, so those
|
|
50
57
|
* keys must be **injectedIds** (e.g. `tronLink`, not `tronlink`).
|
|
51
58
|
*/
|
|
52
|
-
enabledWallets
|
|
59
|
+
enabledWallets?: ReadonlySet<TronWalletId> | readonly TronWalletId[]
|
|
53
60
|
|
|
54
61
|
/** Full-node endpoints, API key, and TRC20 fee limit. */
|
|
55
62
|
tronGrid?: TronGridConfig
|