@onekeyfe/hwk-adapter-core 1.2.8-alpha.9 → 1.2.9

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.
Files changed (39) hide show
  1. package/dist/chunk-DB4JOPZO.mjs +74 -0
  2. package/dist/chunk-DB4JOPZO.mjs.map +1 -0
  3. package/dist/{chunk-BAGEFFFY.js → chunk-P7RDL34T.js} +49 -13
  4. package/dist/chunk-P7RDL34T.js.map +1 -0
  5. package/dist/{chunk-SZZF623R.js → chunk-UFNTICCX.js} +158 -55
  6. package/dist/chunk-UFNTICCX.js.map +1 -0
  7. package/dist/{chunk-YA4BWFTZ.mjs → chunk-V2OHL2JS.mjs} +158 -55
  8. package/dist/chunk-V2OHL2JS.mjs.map +1 -0
  9. package/dist/chunk-YLCHSNXO.js +74 -0
  10. package/dist/chunk-YLCHSNXO.js.map +1 -0
  11. package/dist/{chunk-U63HTLGJ.mjs → chunk-Z574MVAT.mjs} +48 -12
  12. package/dist/chunk-Z574MVAT.mjs.map +1 -0
  13. package/dist/errors-DednD9bG.d.mts +281 -0
  14. package/dist/errors-DednD9bG.d.ts +281 -0
  15. package/dist/errors.d.mts +1 -207
  16. package/dist/errors.d.ts +1 -207
  17. package/dist/errors.js +8 -2
  18. package/dist/errors.js.map +1 -1
  19. package/dist/errors.mjs +9 -3
  20. package/dist/index.d.mts +971 -401
  21. package/dist/index.d.ts +971 -401
  22. package/dist/index.js +1103 -87
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +1095 -79
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/ui-events-Dvu2Gdu8.d.mts +214 -0
  27. package/dist/ui-events-Dvu2Gdu8.d.ts +214 -0
  28. package/dist/ui-events.d.mts +1 -1
  29. package/dist/ui-events.d.ts +1 -1
  30. package/dist/ui-events.js +3 -2
  31. package/dist/ui-events.js.map +1 -1
  32. package/dist/ui-events.mjs +2 -1
  33. package/package.json +2 -2
  34. package/dist/chunk-BAGEFFFY.js.map +0 -1
  35. package/dist/chunk-SZZF623R.js.map +0 -1
  36. package/dist/chunk-U63HTLGJ.mjs.map +0 -1
  37. package/dist/chunk-YA4BWFTZ.mjs.map +0 -1
  38. package/dist/ui-events-Cb7haAeE.d.mts +0 -128
  39. package/dist/ui-events-Cb7haAeE.d.ts +0 -128
@@ -1,128 +0,0 @@
1
- interface QrDisplayData {
2
- urType: string;
3
- urData: string;
4
- animated: boolean;
5
- }
6
- interface QrResponseData {
7
- urType: string;
8
- urData: string;
9
- }
10
-
11
- declare const UI_EVENT = "UI_EVENT";
12
- declare const UI_REQUEST: {
13
- readonly REQUEST_PIN: "ui-request-pin";
14
- readonly REQUEST_PASSPHRASE: "ui-request-passphrase";
15
- readonly REQUEST_PASSPHRASE_ON_DEVICE: "ui-request-passphrase-on-device";
16
- readonly REQUEST_BUTTON: "ui-request-button";
17
- readonly REQUEST_QR_DISPLAY: "ui-request-qr-display";
18
- readonly REQUEST_QR_SCAN: "ui-request-qr-scan";
19
- readonly REQUEST_DEVICE_PERMISSION: "ui-request-device-permission";
20
- readonly REQUEST_SELECT_DEVICE: "ui-request-select-device";
21
- readonly REQUEST_DEVICE_CONNECT: "ui-request-device-connect";
22
- readonly REQUEST_BTC_HIGH_INDEX_CONFIRM: "ui-request-btc-high-index-confirm";
23
- readonly REQUEST_INSTALL_APP: "ui-request-install-app";
24
- readonly REQUEST_PREEMPTION: "ui-request-preemption";
25
- readonly REQUEST_TREZOR_THP_PAIRING: "ui-request-trezor-thp-pairing";
26
- readonly CLOSE_UI_WINDOW: "ui-close";
27
- readonly DEVICE_PROGRESS: "ui-device_progress";
28
- readonly FIRMWARE_PROGRESS: "ui-firmware-progress";
29
- readonly FIRMWARE_TIP: "ui-firmware-tip";
30
- };
31
- declare const UI_RESPONSE: {
32
- readonly RECEIVE_PIN: "receive-pin";
33
- readonly RECEIVE_PASSPHRASE: "receive-passphrase";
34
- readonly RECEIVE_QR_RESPONSE: "receive-qr-response";
35
- readonly RECEIVE_SELECT_DEVICE: "receive-select-device";
36
- readonly RECEIVE_DEVICE_CONNECT: "receive-device-connect";
37
- readonly RECEIVE_DEVICE_PERMISSION: "receive-device-permission";
38
- readonly RECEIVE_BTC_HIGH_INDEX_CONFIRM: "receive-btc-high-index-confirm";
39
- readonly RECEIVE_INSTALL_APP: "receive-install-app";
40
- readonly RECEIVE_PREEMPTION: "receive-preemption";
41
- readonly RECEIVE_TREZOR_THP_PAIRING: "receive-trezor-thp-pairing";
42
- readonly CANCEL: "cancel";
43
- };
44
- type DevicePermissionDeniedReason = 'bluetoothTurnedOff' | 'permissionDenied' | (string & Record<never, never>);
45
- type DevicePermissionResponse = {
46
- granted: boolean;
47
- reason?: DevicePermissionDeniedReason;
48
- message?: string;
49
- };
50
- type UiResponseEvent = {
51
- type: typeof UI_RESPONSE.RECEIVE_PIN;
52
- payload: string;
53
- } | {
54
- type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
55
- payload: {
56
- value: string;
57
- passphraseOnDevice?: boolean;
58
- save?: boolean;
59
- };
60
- } | {
61
- type: typeof UI_RESPONSE.RECEIVE_QR_RESPONSE;
62
- payload: QrResponseData;
63
- } | {
64
- type: typeof UI_RESPONSE.RECEIVE_SELECT_DEVICE;
65
- payload: {
66
- sdkConnectId: string;
67
- };
68
- } | {
69
- type: typeof UI_RESPONSE.RECEIVE_DEVICE_CONNECT;
70
- payload: {
71
- confirmed: boolean;
72
- };
73
- } | {
74
- type: typeof UI_RESPONSE.RECEIVE_DEVICE_PERMISSION;
75
- payload: DevicePermissionResponse;
76
- } | {
77
- type: typeof UI_RESPONSE.RECEIVE_BTC_HIGH_INDEX_CONFIRM;
78
- payload: {
79
- confirmed: boolean;
80
- };
81
- } | {
82
- type: typeof UI_RESPONSE.RECEIVE_INSTALL_APP;
83
- payload: {
84
- confirmed: boolean;
85
- };
86
- } | {
87
- type: typeof UI_RESPONSE.RECEIVE_PREEMPTION;
88
- payload: {
89
- confirmed: boolean;
90
- };
91
- } | {
92
- type: typeof UI_RESPONSE.RECEIVE_TREZOR_THP_PAIRING;
93
- payload: {
94
- selectedMethod?: number | string;
95
- tag?: string;
96
- };
97
- } | {
98
- type: typeof UI_RESPONSE.CANCEL;
99
- payload?: undefined;
100
- };
101
-
102
- /** 10 min — every UI request is human-in-the-loop; bias toward "wait long". */
103
- declare const UI_REQUEST_DEFAULT_TIMEOUT_MS = 600000;
104
- declare const UI_REQUEST_PREEMPTED_TAG = "UiRequestPreempted";
105
- declare const UI_REQUEST_CANCELLED_TAG = "UiRequestCancelled";
106
- declare const UI_REQUEST_TIMEOUT_TAG = "UiRequestTimeout";
107
- /**
108
- * Per-type single-slot registry for adapter-level UI requests. A new `wait`
109
- * of the same type supersedes (rejects) the prior pending entry. With the
110
- * job queue running globally serially, cross-type collisions don't occur in
111
- * normal flow — same-type preemption is a defensive measure for callers
112
- * that fire the same request twice without waiting on the first.
113
- *
114
- * Unknown response types are dropped silently so the public `uiResponse`
115
- * entry never throws.
116
- */
117
- declare class UiRequestRegistry {
118
- private pending;
119
- wait<T = unknown>(requestType: string, options?: {
120
- timeoutMs?: number;
121
- }): Promise<T>;
122
- resolve(responseType: string, payload: unknown): void;
123
- cancel(requestType?: string): void;
124
- reset(): void;
125
- hasPending(requestType?: string): boolean;
126
- }
127
-
128
- export { type DevicePermissionDeniedReason as D, type QrDisplayData as Q, type UiResponseEvent as U, UI_REQUEST as a, type DevicePermissionResponse as b, type QrResponseData as c, UI_EVENT as d, UI_REQUEST_CANCELLED_TAG as e, UI_REQUEST_DEFAULT_TIMEOUT_MS as f, UI_REQUEST_PREEMPTED_TAG as g, UI_REQUEST_TIMEOUT_TAG as h, UI_RESPONSE as i, UiRequestRegistry as j };
@@ -1,128 +0,0 @@
1
- interface QrDisplayData {
2
- urType: string;
3
- urData: string;
4
- animated: boolean;
5
- }
6
- interface QrResponseData {
7
- urType: string;
8
- urData: string;
9
- }
10
-
11
- declare const UI_EVENT = "UI_EVENT";
12
- declare const UI_REQUEST: {
13
- readonly REQUEST_PIN: "ui-request-pin";
14
- readonly REQUEST_PASSPHRASE: "ui-request-passphrase";
15
- readonly REQUEST_PASSPHRASE_ON_DEVICE: "ui-request-passphrase-on-device";
16
- readonly REQUEST_BUTTON: "ui-request-button";
17
- readonly REQUEST_QR_DISPLAY: "ui-request-qr-display";
18
- readonly REQUEST_QR_SCAN: "ui-request-qr-scan";
19
- readonly REQUEST_DEVICE_PERMISSION: "ui-request-device-permission";
20
- readonly REQUEST_SELECT_DEVICE: "ui-request-select-device";
21
- readonly REQUEST_DEVICE_CONNECT: "ui-request-device-connect";
22
- readonly REQUEST_BTC_HIGH_INDEX_CONFIRM: "ui-request-btc-high-index-confirm";
23
- readonly REQUEST_INSTALL_APP: "ui-request-install-app";
24
- readonly REQUEST_PREEMPTION: "ui-request-preemption";
25
- readonly REQUEST_TREZOR_THP_PAIRING: "ui-request-trezor-thp-pairing";
26
- readonly CLOSE_UI_WINDOW: "ui-close";
27
- readonly DEVICE_PROGRESS: "ui-device_progress";
28
- readonly FIRMWARE_PROGRESS: "ui-firmware-progress";
29
- readonly FIRMWARE_TIP: "ui-firmware-tip";
30
- };
31
- declare const UI_RESPONSE: {
32
- readonly RECEIVE_PIN: "receive-pin";
33
- readonly RECEIVE_PASSPHRASE: "receive-passphrase";
34
- readonly RECEIVE_QR_RESPONSE: "receive-qr-response";
35
- readonly RECEIVE_SELECT_DEVICE: "receive-select-device";
36
- readonly RECEIVE_DEVICE_CONNECT: "receive-device-connect";
37
- readonly RECEIVE_DEVICE_PERMISSION: "receive-device-permission";
38
- readonly RECEIVE_BTC_HIGH_INDEX_CONFIRM: "receive-btc-high-index-confirm";
39
- readonly RECEIVE_INSTALL_APP: "receive-install-app";
40
- readonly RECEIVE_PREEMPTION: "receive-preemption";
41
- readonly RECEIVE_TREZOR_THP_PAIRING: "receive-trezor-thp-pairing";
42
- readonly CANCEL: "cancel";
43
- };
44
- type DevicePermissionDeniedReason = 'bluetoothTurnedOff' | 'permissionDenied' | (string & Record<never, never>);
45
- type DevicePermissionResponse = {
46
- granted: boolean;
47
- reason?: DevicePermissionDeniedReason;
48
- message?: string;
49
- };
50
- type UiResponseEvent = {
51
- type: typeof UI_RESPONSE.RECEIVE_PIN;
52
- payload: string;
53
- } | {
54
- type: typeof UI_RESPONSE.RECEIVE_PASSPHRASE;
55
- payload: {
56
- value: string;
57
- passphraseOnDevice?: boolean;
58
- save?: boolean;
59
- };
60
- } | {
61
- type: typeof UI_RESPONSE.RECEIVE_QR_RESPONSE;
62
- payload: QrResponseData;
63
- } | {
64
- type: typeof UI_RESPONSE.RECEIVE_SELECT_DEVICE;
65
- payload: {
66
- sdkConnectId: string;
67
- };
68
- } | {
69
- type: typeof UI_RESPONSE.RECEIVE_DEVICE_CONNECT;
70
- payload: {
71
- confirmed: boolean;
72
- };
73
- } | {
74
- type: typeof UI_RESPONSE.RECEIVE_DEVICE_PERMISSION;
75
- payload: DevicePermissionResponse;
76
- } | {
77
- type: typeof UI_RESPONSE.RECEIVE_BTC_HIGH_INDEX_CONFIRM;
78
- payload: {
79
- confirmed: boolean;
80
- };
81
- } | {
82
- type: typeof UI_RESPONSE.RECEIVE_INSTALL_APP;
83
- payload: {
84
- confirmed: boolean;
85
- };
86
- } | {
87
- type: typeof UI_RESPONSE.RECEIVE_PREEMPTION;
88
- payload: {
89
- confirmed: boolean;
90
- };
91
- } | {
92
- type: typeof UI_RESPONSE.RECEIVE_TREZOR_THP_PAIRING;
93
- payload: {
94
- selectedMethod?: number | string;
95
- tag?: string;
96
- };
97
- } | {
98
- type: typeof UI_RESPONSE.CANCEL;
99
- payload?: undefined;
100
- };
101
-
102
- /** 10 min — every UI request is human-in-the-loop; bias toward "wait long". */
103
- declare const UI_REQUEST_DEFAULT_TIMEOUT_MS = 600000;
104
- declare const UI_REQUEST_PREEMPTED_TAG = "UiRequestPreempted";
105
- declare const UI_REQUEST_CANCELLED_TAG = "UiRequestCancelled";
106
- declare const UI_REQUEST_TIMEOUT_TAG = "UiRequestTimeout";
107
- /**
108
- * Per-type single-slot registry for adapter-level UI requests. A new `wait`
109
- * of the same type supersedes (rejects) the prior pending entry. With the
110
- * job queue running globally serially, cross-type collisions don't occur in
111
- * normal flow — same-type preemption is a defensive measure for callers
112
- * that fire the same request twice without waiting on the first.
113
- *
114
- * Unknown response types are dropped silently so the public `uiResponse`
115
- * entry never throws.
116
- */
117
- declare class UiRequestRegistry {
118
- private pending;
119
- wait<T = unknown>(requestType: string, options?: {
120
- timeoutMs?: number;
121
- }): Promise<T>;
122
- resolve(responseType: string, payload: unknown): void;
123
- cancel(requestType?: string): void;
124
- reset(): void;
125
- hasPending(requestType?: string): boolean;
126
- }
127
-
128
- export { type DevicePermissionDeniedReason as D, type QrDisplayData as Q, type UiResponseEvent as U, UI_REQUEST as a, type DevicePermissionResponse as b, type QrResponseData as c, UI_EVENT as d, UI_REQUEST_CANCELLED_TAG as e, UI_REQUEST_DEFAULT_TIMEOUT_MS as f, UI_REQUEST_PREEMPTED_TAG as g, UI_REQUEST_TIMEOUT_TAG as h, UI_RESPONSE as i, UiRequestRegistry as j };