@onekeyfe/hwk-adapter-core 1.2.5-alpha.4 → 1.2.5

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 (37) hide show
  1. package/dist/{chunk-H7BZ2C6J.js → chunk-BAGEFFFY.js} +13 -45
  2. package/dist/chunk-BAGEFFFY.js.map +1 -0
  3. package/dist/{chunk-T5HIQPNG.js → chunk-SZZF623R.js} +55 -155
  4. package/dist/chunk-SZZF623R.js.map +1 -0
  5. package/dist/{chunk-AYA6FQES.mjs → chunk-U63HTLGJ.mjs} +12 -44
  6. package/dist/chunk-U63HTLGJ.mjs.map +1 -0
  7. package/dist/{chunk-KTRQZ5AJ.mjs → chunk-YA4BWFTZ.mjs} +55 -155
  8. package/dist/chunk-YA4BWFTZ.mjs.map +1 -0
  9. package/dist/errors.d.mts +207 -1
  10. package/dist/errors.d.ts +207 -1
  11. package/dist/errors.js +2 -8
  12. package/dist/errors.js.map +1 -1
  13. package/dist/errors.mjs +3 -9
  14. package/dist/index.d.mts +104 -579
  15. package/dist/index.d.ts +104 -579
  16. package/dist/index.js +85 -635
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +76 -626
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/{ui-events-DdttFKj9.d.ts → ui-events-Cb7haAeE.d.mts} +3 -37
  21. package/dist/{ui-events-DdttFKj9.d.mts → ui-events-Cb7haAeE.d.ts} +3 -37
  22. package/dist/ui-events.d.mts +1 -1
  23. package/dist/ui-events.d.ts +1 -1
  24. package/dist/ui-events.js +2 -3
  25. package/dist/ui-events.js.map +1 -1
  26. package/dist/ui-events.mjs +1 -2
  27. package/package.json +2 -2
  28. package/dist/chunk-AYA6FQES.mjs.map +0 -1
  29. package/dist/chunk-DB4JOPZO.mjs +0 -74
  30. package/dist/chunk-DB4JOPZO.mjs.map +0 -1
  31. package/dist/chunk-H7BZ2C6J.js.map +0 -1
  32. package/dist/chunk-KTRQZ5AJ.mjs.map +0 -1
  33. package/dist/chunk-T5HIQPNG.js.map +0 -1
  34. package/dist/chunk-YLCHSNXO.js +0 -74
  35. package/dist/chunk-YLCHSNXO.js.map +0 -1
  36. package/dist/errors-BgJ4kzRx.d.mts +0 -276
  37. package/dist/errors-BgJ4kzRx.d.ts +0 -276
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-BgJ4kzRx.mjs';
2
- export { c as HwkError, d as HwkRecoveryScope, I as IHwkErrorPayload, e as IOperationMayHaveCompletedParams, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, g as defaultOriginForCode, h as defaultRecoveryForCode, i as enrichErrorMessage, j as isHwkRecoveryHint, o as operationMayHaveCompletedParams } from './errors-BgJ4kzRx.mjs';
3
- import { U as UiResponseEvent, a as UiRequestOperationAttribution, b as UI_REQUEST, Q as QrDisplayData, c as UiRequestRegistry, S as SaveDeviceBindingDeclineReason } from './ui-events-DdttFKj9.mjs';
4
- export { D as DevicePermissionDeniedReason, d as DevicePermissionResponse, e as QrResponseData, f as UI_EVENT, g as UI_REQUEST_CANCELLED_TAG, h as UI_REQUEST_DEFAULT_TIMEOUT_MS, i as UI_REQUEST_PREEMPTED_TAG, j as UI_REQUEST_TIMEOUT_TAG, k as UI_RESPONSE } from './ui-events-DdttFKj9.mjs';
1
+ import { HardwareErrorCode } from './errors.mjs';
2
+ export { HwkError, IHwkErrorPayload, ORPHAN_ELIGIBLE_ERROR_CODES, createHwkError, enrichErrorMessage } from './errors.mjs';
3
+ import { U as UiResponseEvent, a as UI_REQUEST, Q as QrDisplayData } from './ui-events-Cb7haAeE.mjs';
4
+ export { D as DevicePermissionDeniedReason, b as DevicePermissionResponse, c as QrResponseData, d as UI_EVENT, e as UI_REQUEST_CANCELLED_TAG, f as UI_REQUEST_DEFAULT_TIMEOUT_MS, g as UI_REQUEST_PREEMPTED_TAG, h as UI_REQUEST_TIMEOUT_TAG, i as UI_RESPONSE, j as UiRequestRegistry } from './ui-events-Cb7haAeE.mjs';
5
5
 
6
6
  interface Success<T> {
7
7
  success: true;
@@ -12,52 +12,16 @@ interface Failure {
12
12
  payload: {
13
13
  error: string;
14
14
  code: HardwareErrorCode;
15
- /** See HwkErrorOrigin, who the failure came from. Optional so an
16
- * unclassified failure degrades to code-based handling, never a guess. */
17
- origin?: HwkErrorOrigin;
18
- /** Connection-lifecycle recovery semantics. Optional for wire compatibility
19
- * with SDK versions that predate this field. SDK failure helpers populate it. */
20
- recovery?: HwkRecoveryHint;
21
15
  params?: Record<string, unknown>;
22
16
  };
23
17
  }
24
18
  type Response<T> = Success<T> | Failure;
25
19
  declare function success<T>(payload: T): Success<T>;
26
- declare function failure(code: HardwareErrorCode, error: string, params?: Record<string, unknown>, origin?: HwkErrorOrigin, recovery?: HwkRecoveryHint): Failure;
20
+ declare function failure(code: HardwareErrorCode, error: string, params?: Record<string, unknown>): Failure;
27
21
 
28
- /**
29
- * Fixed derivation paths used to generate chain fingerprints.
30
- * Uses standard index 0 — Ledger firmware shows device confirmation for
31
- * non-standard paths (e.g., index=100), which would interrupt wallet creation.
32
- * The address is hashed into a 16-char fingerprint, not exposed directly.
33
- * - EVM: cointype 60 (Ledger ETH App only supports 60)
34
- * - BTC: cointype 1 (testnet)
35
- * - SOL: cointype 501, standard 3-level hardened
36
- */
37
- declare const CHAIN_FINGERPRINT_PATHS: Record<ChainForFingerprint, string>;
38
- type ChainForFingerprint = 'evm' | 'btc' | 'sol' | 'tron' | 'zcash';
39
- /**
40
- * Parses the complete BIP32 master fingerprint wire value: 4 bytes encoded
41
- * as exactly 8 hexadecimal characters. This is protocol metadata, not a
42
- * collision-resistant wallet identity.
43
- */
44
- declare function parseBip32MasterFingerprint(value: unknown): string | undefined;
45
- /**
46
- * 16-char SHA-256 fingerprint for device-identity verification.
47
- * Callers must canonicalize input (e.g. EVM address → lowercase) —
48
- * encoding variations otherwise cause false DeviceMismatch.
49
- */
50
- declare function deriveDeviceFingerprint(value: string): string;
51
- /**
52
- * Domain-separated 256-bit wallet id. Input must be one fixed, vendor-defined public source, never
53
- * a variable subset of exported accounts, or one wallet would get several ids.
54
- */
55
- declare function deriveWalletId(canonicalPublicMaterial: string): string;
56
-
57
- type VendorType = 'trezor' | 'ledger' | 'keystone';
58
- /** 'qr' is a virtual channel: UR payloads travel via app-rendered/scanned QR codes. */
59
- type ConnectionType = 'usb' | 'ble' | 'qr';
60
- type TransportType = 'usb' | 'ble' | 'hid' | 'bridge' | 'qr';
22
+ type VendorType = 'trezor' | 'ledger';
23
+ type ConnectionType = 'usb' | 'ble';
24
+ type TransportType = 'usb' | 'ble' | 'hid' | 'bridge';
61
25
  /**
62
26
  * Device capabilities — describes what a specific device/connection
63
27
  * combination can or cannot do. Varies by vendor, model, and connection type.
@@ -67,8 +31,12 @@ type TransportType = 'usb' | 'ble' | 'hid' | 'bridge' | 'qr';
67
31
  */
68
32
  interface DeviceCapabilities {
69
33
  /**
70
- * Whether the discovery handle can be reused to reconnect; `false` requires rediscovery. Says
71
- * nothing about identity (Trezor BLE is false yet its device_id is stable); verify it separately.
34
+ * Whether connectId/deviceId persist across sessions.
35
+ *
36
+ * - `true`: IDs are stable (e.g., OneKey USB, Trezor USB).
37
+ * Business logic can match devices by stored connectId/deviceId.
38
+ * - `false`: IDs are ephemeral, regenerated each session (e.g., Ledger WebHID).
39
+ * Business logic should NOT rely on stored connectId/deviceId for matching.
72
40
  */
73
41
  persistentDeviceIdentity: boolean;
74
42
  }
@@ -105,52 +73,6 @@ interface DeviceTarget {
105
73
  connectId: string;
106
74
  deviceId: string;
107
75
  }
108
- /**
109
- * How long a discovery handle remains safe to use for a new connection.
110
- * This is deliberately separate from post-connect device identity.
111
- */
112
- type SearchTargetReusePolicy = 'current-discovery' | 'reconnectable' | 'rediscover';
113
- declare function resolveSearchTargetReusePolicy(device: Pick<DeviceInfo, 'connectionType' | 'capabilities'>): SearchTargetReusePolicy;
114
- /**
115
- * A selectable result from hardware discovery. It may represent a physical
116
- * transport endpoint or an interactive entry such as Keystone QR; it is not a
117
- * physical-device or wallet identity.
118
- */
119
- interface DeviceSearchTarget {
120
- /** Opaque handle scoped to the adapter's current discovery state. */
121
- searchTargetId: string;
122
- /** Whether the handle itself may be retried; never inferred from a stored connectId. */
123
- searchTargetReusePolicy?: SearchTargetReusePolicy;
124
- vendor: VendorType;
125
- connectionType: ConnectionType;
126
- kind: 'physical' | 'interactive';
127
- label?: string;
128
- model?: string;
129
- modelName?: string;
130
- serialNumber?: string;
131
- }
132
- /**
133
- * @deprecated Use DeviceSearchTarget. Kept for consumers of the pre-release
134
- * connection-target API.
135
- */
136
- type ConnectionTarget = Omit<DeviceSearchTarget, 'searchTargetId'> & {
137
- targetId: string;
138
- searchTargetId?: string;
139
- };
140
- type WalletIdentity = {
141
- vendor: 'ledger';
142
- type: 'chainFingerprint';
143
- chain: ChainForFingerprint;
144
- value: string;
145
- } | {
146
- vendor: 'trezor';
147
- type: 'deviceId';
148
- value: string;
149
- } | {
150
- vendor: 'keystone';
151
- type: 'walletId';
152
- value: string;
153
- };
154
76
 
155
77
  /**
156
78
  * Mixin for chain-operation params that can be pinned to a specific passphrase
@@ -211,15 +133,6 @@ interface ConnectorSession {
211
133
  sessionId: string;
212
134
  deviceInfo: DeviceInfo;
213
135
  }
214
- type ConnectorConnectTarget = {
215
- type: 'default';
216
- } | {
217
- type: 'search-target';
218
- searchTargetId: string;
219
- } | {
220
- type: 'expected-device-identity';
221
- deviceIdentity: string;
222
- };
223
136
  /**
224
137
  * Vendor-agnostic bag of extra error fields. Known keys are documented for
225
138
  * discoverability; the index signature keeps it open so any connector can
@@ -340,16 +253,12 @@ interface ConnectorEventMap {
340
253
  'ui-event': ConnectorUiEvent;
341
254
  }
342
255
  interface ConnectorSearchDevicesOptions {
343
- /** Select a child transport without waking/scanning the others. */
344
- transportType?: ConnectionType;
345
256
  /**
346
257
  * Wait for every child transport in a fused connector. Default discovery can
347
258
  * return shortly after USB appears so BLE does not slow down USB flows;
348
259
  * binding pickers can opt in when they need BLE candidates too.
349
260
  */
350
261
  waitForAll?: boolean;
351
- /** Availability probes must not invalidate user-selectable discovery targets. */
352
- purpose?: 'selection' | 'availability';
353
262
  }
354
263
  interface ConnectorConfig {
355
264
  /**
@@ -364,16 +273,8 @@ interface ConnectorConfig {
364
273
  interface IConnector {
365
274
  /** Physical connection type this connector uses. Fixed at construction. */
366
275
  readonly connectionType: ConnectionType;
367
- readonly availableTransports?: readonly ConnectionType[];
368
276
  searchDevices(options?: ConnectorSearchDevicesOptions): Promise<ConnectorDevice[]>;
369
- connect(deviceId?: string, options?: {
370
- transportType: ConnectionType;
371
- }): Promise<ConnectorSession>;
372
- /**
373
- * Structured form for connectors where a discovery handle and a stable device identity are
374
- * different concepts. The string form remains for bridge and legacy compatibility.
375
- */
376
- connectTarget?(target: ConnectorConnectTarget): Promise<ConnectorSession>;
277
+ connect(deviceId?: string): Promise<ConnectorSession>;
377
278
  disconnect(sessionId: string): Promise<void>;
378
279
  call(sessionId: string, method: string, params: unknown): Promise<ConnectorCallResult>;
379
280
  cancel(sessionId: string): Promise<void>;
@@ -398,9 +299,6 @@ interface IHardwareBridge {
398
299
  connect(params: {
399
300
  vendor: VendorType;
400
301
  deviceId?: string;
401
- options?: {
402
- transportType: ConnectionType;
403
- };
404
302
  }): Promise<ConnectorSession>;
405
303
  disconnect(params: {
406
304
  vendor: VendorType;
@@ -683,21 +581,11 @@ interface SolSignedTx {
683
581
  /** Hex-encoded Ed25519 signature (no 0x prefix) */
684
582
  signature: string;
685
583
  }
686
- interface SolSignMessageBaseParams extends PassphraseStateAware {
584
+ interface SolSignMsgParams extends PassphraseStateAware {
687
585
  path: string;
688
586
  /** Message bytes as hex string (no 0x prefix) */
689
587
  message: string;
690
588
  }
691
- interface SolOffchainMessageV1Params {
692
- /** Finalized Solana off-chain message format. */
693
- messageVersion: 1;
694
- /** Complete signer set as 32-byte hex public keys. */
695
- requiredSigners: string[];
696
- }
697
- type SolSignMsgParams = SolSignMessageBaseParams & ({
698
- messageVersion?: undefined;
699
- requiredSigners?: undefined;
700
- } | SolOffchainMessageV1Params);
701
589
  interface SolSignature {
702
590
  /** Hex-encoded Ed25519 signature (no 0x prefix) */
703
591
  signature: string;
@@ -824,12 +712,6 @@ interface TronSignMsgParams extends PassphraseStateAware {
824
712
  path: string;
825
713
  /** Message hex (no 0x prefix) */
826
714
  messageHex: string;
827
- /**
828
- * TRON message scheme: 'V1' = legacy signMessage (prefix + 32-byte hash),
829
- * 'V2' = TIP-191 signMessageV2 (prefix + byte length + message). Adapters
830
- * that only implement one scheme reject the other with MethodNotSupported.
831
- */
832
- messageType?: 'V1' | 'V2';
833
715
  }
834
716
  interface TronSignature {
835
717
  /** 65-byte hex-encoded signature (no 0x prefix) */
@@ -841,167 +723,100 @@ interface ITronMethods {
841
723
  tronSignMessage(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<TronSignMsgParams>>): Promise<Response<TronSignature>>;
842
724
  }
843
725
 
726
+ /**
727
+ * Fixed derivation paths used to generate chain fingerprints.
728
+ * Uses standard index 0 — Ledger firmware shows device confirmation for
729
+ * non-standard paths (e.g., index=100), which would interrupt wallet creation.
730
+ * The address is hashed into a 16-char fingerprint, not exposed directly.
731
+ * - EVM: cointype 60 (Ledger ETH App only supports 60)
732
+ * - BTC: cointype 1 (testnet)
733
+ * - SOL: cointype 501, standard 3-level hardened
734
+ */
735
+ declare const CHAIN_FINGERPRINT_PATHS: Record<ChainForFingerprint, string>;
736
+ type ChainForFingerprint = 'evm' | 'btc' | 'sol' | 'tron';
737
+ /**
738
+ * 16-char SHA-256 fingerprint for device-identity verification.
739
+ * Callers must canonicalize input (e.g. EVM address → lowercase) —
740
+ * encoding variations otherwise cause false DeviceMismatch.
741
+ */
742
+ declare function deriveDeviceFingerprint(value: string): string;
743
+
844
744
  /** Events generated by SDK internal detection (not from hardware directly). */
845
745
  declare const SDK: {
846
746
  readonly DEVICE_STUCK: "device-stuck";
847
747
  readonly DEVICE_UNRESPONSIVE: "device-unresponsive";
848
748
  readonly DEVICE_RECOVERED: "device-recovered";
849
749
  readonly DEVICE_INTERACTION: "device-interaction";
850
- readonly OPERATION_ENDED: "operation-ended";
851
750
  };
852
751
 
853
- declare const OPERATION_DEFAULT_TTL_MS = 600000;
854
- type OperationEndReason = 'explicit' | 'disconnect' | 'timeout' | 'runtime-reset';
855
- type HardwareOperation = {
856
- operationId: string;
857
- connectId: string;
858
- device: DeviceInfo;
859
- /**
860
- * The channel this operation runs on, set by the adapter that picked it. Never read it off
861
- * `device`: a combined connector fills that snapshot with a nominal value.
862
- */
863
- connectionType: ConnectionType;
864
- connectionKeys: string[];
865
- createdAt: number;
866
- lastActiveAt: number;
867
- };
868
- type OperationRegistryOptions = {
869
- vendor: VendorType;
870
- ttlMs?: number;
871
- onEnded?: (operation: HardwareOperation, reason: OperationEndReason) => void;
872
- };
873
- /** Runtime-only association between a public operation id and one live target. */
874
- declare class OperationRegistry {
875
- private readonly _vendor;
876
- private readonly _ttlMs;
877
- private readonly _onEnded?;
878
- private readonly _active;
879
- private readonly _ended;
880
- constructor(options: OperationRegistryOptions);
881
- create(params: {
882
- searchTargetId: string;
883
- connectId: string;
884
- device: DeviceInfo;
885
- connectionType: ConnectionType;
886
- connectionKeys?: string[];
887
- }): HardwareOperation;
888
- resolve(operationId: string): HardwareOperation;
889
- /** Keep an operation alive while one device job is actively using it. */
890
- retain(operationId: string): () => void;
891
- /** Return active or tombstoned binding data without refreshing its TTL. */
892
- find(operationId: string): HardwareOperation | undefined;
893
- findActiveByConnectionKey(connectionKey: string): HardwareOperation | undefined;
894
- /** Replace the live transport binding after the same target was reconnected. */
895
- rebind(operationId: string, params: {
896
- connectId: string;
897
- device: DeviceInfo;
898
- connectionType: ConnectionType;
899
- connectionKeys?: string[];
900
- }): HardwareOperation;
901
- end(operationId: string, reason: OperationEndReason): HardwareOperation | undefined;
902
- endByConnectionKey(connectionKey: string, reason: OperationEndReason, exceptOperationId?: string): void;
903
- endAll(reason: OperationEndReason, exceptOperationId?: string): void;
904
- private _touch;
905
- private _createTimer;
906
- private _rememberEnded;
907
- }
908
-
909
752
  type HardwareMethodMetadata = {
910
753
  chain: ChainForFingerprint;
911
754
  allNetwork: boolean;
912
- /** Whether repeating the method after an ambiguous transport failure is safe. */
913
- replayAfterTransportFailure: 'safe' | 'unsafe';
914
755
  };
915
756
  declare const HARDWARE_METHOD_CATALOG: {
916
757
  readonly evmGetAddress: {
917
758
  readonly chain: "evm";
918
759
  readonly allNetwork: true;
919
- readonly replayAfterTransportFailure: "safe";
920
760
  };
921
761
  readonly evmSignTransaction: {
922
762
  readonly chain: "evm";
923
763
  readonly allNetwork: false;
924
- readonly replayAfterTransportFailure: "unsafe";
925
764
  };
926
765
  readonly evmSignMessage: {
927
766
  readonly chain: "evm";
928
767
  readonly allNetwork: false;
929
- readonly replayAfterTransportFailure: "unsafe";
930
768
  };
931
769
  readonly evmSignTypedData: {
932
770
  readonly chain: "evm";
933
771
  readonly allNetwork: false;
934
- readonly replayAfterTransportFailure: "unsafe";
935
772
  };
936
773
  readonly btcGetAddress: {
937
774
  readonly chain: "btc";
938
775
  readonly allNetwork: true;
939
- readonly replayAfterTransportFailure: "safe";
940
776
  };
941
777
  readonly btcGetPublicKey: {
942
778
  readonly chain: "btc";
943
779
  readonly allNetwork: true;
944
- readonly replayAfterTransportFailure: "safe";
945
780
  };
946
781
  readonly btcSignTransaction: {
947
782
  readonly chain: "btc";
948
783
  readonly allNetwork: false;
949
- readonly replayAfterTransportFailure: "unsafe";
950
784
  };
951
785
  readonly btcSignPsbt: {
952
786
  readonly chain: "btc";
953
787
  readonly allNetwork: false;
954
- readonly replayAfterTransportFailure: "unsafe";
955
788
  };
956
789
  readonly btcSignMessage: {
957
790
  readonly chain: "btc";
958
791
  readonly allNetwork: false;
959
- readonly replayAfterTransportFailure: "unsafe";
960
792
  };
961
793
  readonly btcGetMasterFingerprint: {
962
794
  readonly chain: "btc";
963
795
  readonly allNetwork: false;
964
- readonly replayAfterTransportFailure: "safe";
965
796
  };
966
797
  readonly solGetAddress: {
967
798
  readonly chain: "sol";
968
799
  readonly allNetwork: true;
969
- readonly replayAfterTransportFailure: "safe";
970
800
  };
971
801
  readonly solSignTransaction: {
972
802
  readonly chain: "sol";
973
803
  readonly allNetwork: false;
974
- readonly replayAfterTransportFailure: "unsafe";
975
804
  };
976
805
  readonly solSignMessage: {
977
806
  readonly chain: "sol";
978
807
  readonly allNetwork: false;
979
- readonly replayAfterTransportFailure: "unsafe";
980
808
  };
981
809
  readonly tronGetAddress: {
982
810
  readonly chain: "tron";
983
811
  readonly allNetwork: true;
984
- readonly replayAfterTransportFailure: "safe";
985
812
  };
986
813
  readonly tronSignTransaction: {
987
814
  readonly chain: "tron";
988
815
  readonly allNetwork: false;
989
- readonly replayAfterTransportFailure: "unsafe";
990
816
  };
991
817
  readonly tronSignMessage: {
992
818
  readonly chain: "tron";
993
819
  readonly allNetwork: false;
994
- readonly replayAfterTransportFailure: "unsafe";
995
- };
996
- readonly zcashGetFullViewingKey: {
997
- readonly chain: "zcash";
998
- readonly allNetwork: false;
999
- readonly replayAfterTransportFailure: "safe";
1000
- };
1001
- readonly zcashGetShieldedAddress: {
1002
- readonly chain: "zcash";
1003
- readonly allNetwork: false;
1004
- readonly replayAfterTransportFailure: "safe";
1005
820
  };
1006
821
  };
1007
822
  type HardwareMethodName = keyof typeof HARDWARE_METHOD_CATALOG;
@@ -1010,11 +825,6 @@ type AllNetworkMethodName = {
1010
825
  }[HardwareMethodName];
1011
826
  declare const ALL_NETWORK_METHOD_NAMES: AllNetworkMethodName[];
1012
827
  declare function getHardwareMethodMetadata(method: string): HardwareMethodMetadata | undefined;
1013
- /**
1014
- * Conservative replay gate used only after a call may have reached hardware.
1015
- * Unknown methods and device mutations are unsafe by default.
1016
- */
1017
- declare function canReplayHardwareMethodAfterTransportFailure(method: string): boolean;
1018
828
  declare function isAllNetworkMethodName(method: string): method is AllNetworkMethodName;
1019
829
  declare function getAllNetworkMethodChain(method: AllNetworkMethodName): ChainForFingerprint;
1020
830
 
@@ -1033,7 +843,7 @@ type HardwareUiEvent = Exclude<ConnectorUiEvent, {
1033
843
  progress: number;
1034
844
  };
1035
845
  };
1036
- type ChainCapability = 'evm' | 'btc' | 'sol' | 'tron' | 'zcash';
846
+ type ChainCapability = 'evm' | 'btc' | 'sol' | 'tron';
1037
847
  type TrezorDisplayRotation = 'North' | 'East' | 'South' | 'West';
1038
848
  type TrezorSafetyCheckLevel = 'Strict' | 'PromptAlways' | 'PromptTemporarily';
1039
849
  type TrezorDeviceSettingsParams = {
@@ -1104,77 +914,19 @@ type DeviceAuthenticityResult = {
1104
914
  };
1105
915
  };
1106
916
  };
1107
- /** Persisted connection hints, never proof of device or wallet identity. */
1108
- type KnownDeviceConnection = {
1109
- transport: 'usb' | 'ble';
1110
- connectId: string;
1111
- } | {
1112
- transport: 'qr';
1113
- };
1114
- /** Opaque host lookup identifiers. Never forward these to firmware or logs. */
1115
- type HardwareCallExtra = Readonly<Record<string, string>>;
1116
- interface IHardwareConnectionContext {
1117
- knownConnections?: readonly KnownDeviceConnection[];
1118
- extra?: HardwareCallExtra;
1119
- /** False makes discovery fail instead of asking the user to select a new endpoint. */
1120
- allowDeviceSelection?: boolean;
1121
- /** Transports the host's model table allows; discovery never opens others. Omitted = any. */
1122
- supportedTransports?: readonly ('usb' | 'ble')[];
1123
- }
1124
- type DeviceSelectionContext = {
1125
- kind: 'select-device';
1126
- transport: 'usb';
1127
- reason: 'multiple-candidates';
1128
- } | {
1129
- kind: 'bind-connection';
1130
- transport: 'ble';
1131
- reason: 'missing-binding' | 'known-connection-unavailable' | 'manual-rebind';
1132
- };
1133
- interface DeviceSelectionRequest extends UiRequestOperationAttribution {
1134
- devices: DeviceInfo[];
1135
- requestId: string;
1136
- context: DeviceSelectionContext;
1137
- extra?: HardwareCallExtra;
1138
- /** Repeated snapshots with this requestId update one SDK-owned binding scan. */
1139
- scanning?: boolean;
1140
- bindingSessionId?: string;
1141
- /** A candidate rejected by SDK identity verification in this binding session. */
1142
- rejectedConnectId?: string;
1143
- }
1144
- /** The host must persist this endpoint before acknowledging. */
1145
- interface SaveDeviceBindingRequest extends UiRequestOperationAttribution {
1146
- requestId: string;
1147
- selectionRequestId: string;
1148
- connection: {
1149
- transport: 'ble';
1150
- connectId: string;
1151
- };
1152
- /** Omitted when the vendor binds the selected BLE endpoint without checking its wallet (Ledger). */
1153
- identity?: Extract<WalletIdentity, {
1154
- vendor: 'ledger' | 'trezor';
1155
- }>;
1156
- extra?: HardwareCallExtra;
1157
- }
1158
- type BindBleDeviceParams = Pick<SaveDeviceBindingRequest, 'identity' | 'extra'>;
1159
- interface DeviceBindingStatus {
1160
- selectionRequestId: string;
1161
- status: 'verifying' | 'saved' | 'failed' | 'cancelled';
1162
- }
1163
917
  /**
1164
918
  * Cross-chain / cross-vendor options passed alongside any chain method's
1165
919
  * own params (the optional last argument). Holds operation-level switches
1166
920
  * that aren't specific to one chain. Vendor-specific options can be added
1167
921
  * as typed sub-fields here when a vendor actually needs them.
1168
922
  */
1169
- interface ICommonCallParams extends IHardwareConnectionContext {
923
+ interface ICommonCallParams {
1170
924
  /**
1171
925
  * When the required device app is missing, prompt the user (UI request)
1172
926
  * to install it, stream install progress, then retry the operation once.
1173
927
  * Off by default — preserves the plain "app not installed" failure.
1174
928
  */
1175
929
  autoInstallApp?: boolean;
1176
- /** Runtime-only id from connectDevice(); when present, discovery and fallback are disabled. */
1177
- operationId?: string;
1178
930
  }
1179
931
  type NullableCallArg<T> = T | null | undefined;
1180
932
  interface IPassphraseCallParams {
@@ -1183,14 +935,6 @@ interface IPassphraseCallParams {
1183
935
  }
1184
936
  type IHardwareCommonCallParams = ICommonCallParams & IPassphraseCallParams;
1185
937
  type IHardwareCallParams<T> = T & IHardwareCommonCallParams;
1186
- /**
1187
- * Runtime-only device-manager context, never forwarded to firmware. The expected identity lets an
1188
- * adapter fail closed before replaying a read or mutation after a reconnect.
1189
- */
1190
- interface IDeviceManagerOperationContext extends IHardwareConnectionContext {
1191
- operationId?: string;
1192
- expectedDeviceIdentity?: WalletIdentity;
1193
- }
1194
938
  interface AllNetworkAddressParams {
1195
939
  network: string;
1196
940
  path: string;
@@ -1201,7 +945,16 @@ interface AllNetworkAddressParams {
1201
945
  interface AllNetworkGetAddressParams extends IHardwareCommonCallParams {
1202
946
  bundle: AllNetworkAddressParams[];
1203
947
  }
1204
- type AllNetworkDeviceIdentity = WalletIdentity;
948
+ type AllNetworkDeviceIdentity = {
949
+ vendor: 'ledger';
950
+ type: 'chainFingerprint';
951
+ chain: ChainForFingerprint;
952
+ value: string;
953
+ } | {
954
+ vendor: 'trezor';
955
+ type: 'deviceId';
956
+ value: string;
957
+ };
1205
958
  type AllNetworkAddressResponsePayload = Record<string, unknown> & {
1206
959
  error?: string;
1207
960
  code?: HardwareErrorCode | number;
@@ -1209,7 +962,6 @@ type AllNetworkAddressResponsePayload = Record<string, unknown> & {
1209
962
  connectId?: string;
1210
963
  deviceId?: string;
1211
964
  deviceIdentity?: AllNetworkDeviceIdentity;
1212
- rootFingerprint?: number;
1213
965
  chainFingerprint?: string;
1214
966
  chainFingerprintChain?: ChainForFingerprint;
1215
967
  params?: Record<string, unknown>;
@@ -1258,50 +1010,46 @@ type UiRequestEvent = {
1258
1010
  device?: DeviceInfo;
1259
1011
  connectId?: string;
1260
1012
  type?: string;
1261
- } & UiRequestOperationAttribution;
1013
+ };
1262
1014
  } | {
1263
1015
  type: typeof UI_REQUEST.REQUEST_PASSPHRASE;
1264
1016
  payload: {
1265
1017
  device: DeviceInfo;
1266
- } & UiRequestOperationAttribution;
1018
+ };
1267
1019
  } | {
1268
1020
  type: typeof UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE;
1269
1021
  payload: {
1270
1022
  device: DeviceInfo;
1271
- } & UiRequestOperationAttribution;
1023
+ };
1272
1024
  } | {
1273
1025
  type: typeof UI_REQUEST.REQUEST_BUTTON;
1274
1026
  payload: {
1275
1027
  device: DeviceInfo;
1276
1028
  code?: string;
1277
- } & UiRequestOperationAttribution;
1029
+ };
1278
1030
  } | {
1279
1031
  type: typeof UI_REQUEST.REQUEST_QR_DISPLAY;
1280
1032
  payload: {
1281
1033
  device: DeviceInfo;
1282
1034
  data: QrDisplayData;
1283
- } & UiRequestOperationAttribution;
1035
+ };
1284
1036
  } | {
1285
1037
  type: typeof UI_REQUEST.REQUEST_QR_SCAN;
1286
1038
  payload: {
1287
1039
  device: DeviceInfo;
1288
- } & UiRequestOperationAttribution;
1040
+ };
1289
1041
  } | {
1290
1042
  type: typeof UI_REQUEST.REQUEST_DEVICE_PERMISSION;
1291
1043
  payload: {
1292
1044
  transportType: TransportType;
1293
1045
  connectId?: string;
1294
1046
  deviceId?: string;
1295
- } & UiRequestOperationAttribution;
1047
+ };
1296
1048
  } | {
1297
1049
  type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
1298
- payload: DeviceSelectionRequest;
1299
- } | {
1300
- type: typeof UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
1301
- payload: SaveDeviceBindingRequest;
1302
- } | {
1303
- type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
1304
- payload: DeviceBindingStatus;
1050
+ payload: {
1051
+ devices: DeviceInfo[];
1052
+ };
1305
1053
  } | {
1306
1054
  type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
1307
1055
  payload: {
@@ -1321,13 +1069,13 @@ type UiRequestEvent = {
1321
1069
  * isn't recognized.
1322
1070
  */
1323
1071
  message: string;
1324
- } & UiRequestOperationAttribution;
1072
+ };
1325
1073
  } | {
1326
1074
  type: typeof UI_REQUEST.REQUEST_INSTALL_APP;
1327
1075
  payload: {
1328
1076
  vendor: string;
1329
1077
  appName: string;
1330
- } & UiRequestOperationAttribution;
1078
+ };
1331
1079
  } | {
1332
1080
  type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
1333
1081
  payload: {
@@ -1335,10 +1083,10 @@ type UiRequestEvent = {
1335
1083
  availableMethods: number[];
1336
1084
  selectedMethod: number;
1337
1085
  nfcData?: string;
1338
- } & UiRequestOperationAttribution;
1086
+ };
1339
1087
  } | {
1340
1088
  type: typeof UI_REQUEST.CLOSE_UI_WINDOW;
1341
- payload: UiRequestOperationAttribution;
1089
+ payload: Record<string, never>;
1342
1090
  };
1343
1091
  type SdkEvent = {
1344
1092
  type: typeof SDK.DEVICE_INTERACTION;
@@ -1361,12 +1109,6 @@ type SdkEvent = {
1361
1109
  payload: {
1362
1110
  connectId: string;
1363
1111
  };
1364
- } | {
1365
- type: typeof SDK.OPERATION_ENDED;
1366
- payload: {
1367
- operationId: string;
1368
- reason: OperationEndReason;
1369
- };
1370
1112
  };
1371
1113
  type HardwareEvent = DeviceEvent | UiRequestEvent | SdkEvent | HardwareUiEvent;
1372
1114
  type DeviceEventListener = (event: HardwareEvent) => void;
@@ -1377,14 +1119,6 @@ type DeviceEventListener = (event: HardwareEvent) => void;
1377
1119
  * and the value is the narrowed event object the listener will receive.
1378
1120
  */
1379
1121
  interface HardwareEventMap {
1380
- [UI_REQUEST.DEVICE_BINDING_STATUS]: {
1381
- type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
1382
- payload: DeviceBindingStatus;
1383
- };
1384
- [UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING]: {
1385
- type: typeof UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
1386
- payload: SaveDeviceBindingRequest;
1387
- };
1388
1122
  'ui-event': HardwareUiEvent;
1389
1123
  [DEVICE.CONNECT]: {
1390
1124
  type: typeof DEVICE.CONNECT;
@@ -1425,7 +1159,7 @@ interface HardwareEventMap {
1425
1159
  device?: DeviceInfo;
1426
1160
  connectId?: string;
1427
1161
  type?: string;
1428
- } & UiRequestOperationAttribution;
1162
+ };
1429
1163
  };
1430
1164
  [UI_REQUEST.REQUEST_PASSPHRASE]: {
1431
1165
  type: typeof UI_REQUEST.REQUEST_PASSPHRASE;
@@ -1434,33 +1168,33 @@ interface HardwareEventMap {
1434
1168
  connectId?: string;
1435
1169
  passphraseState?: string;
1436
1170
  useEmptyPassphrase?: boolean;
1437
- } & UiRequestOperationAttribution;
1171
+ };
1438
1172
  };
1439
1173
  [UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE]: {
1440
1174
  type: typeof UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE;
1441
1175
  payload: {
1442
1176
  device: DeviceInfo;
1443
- } & UiRequestOperationAttribution;
1177
+ };
1444
1178
  };
1445
1179
  [UI_REQUEST.REQUEST_BUTTON]: {
1446
1180
  type: typeof UI_REQUEST.REQUEST_BUTTON;
1447
1181
  payload: {
1448
1182
  device: DeviceInfo;
1449
1183
  code?: string;
1450
- } & UiRequestOperationAttribution;
1184
+ };
1451
1185
  };
1452
1186
  [UI_REQUEST.REQUEST_QR_DISPLAY]: {
1453
1187
  type: typeof UI_REQUEST.REQUEST_QR_DISPLAY;
1454
1188
  payload: {
1455
1189
  device: DeviceInfo;
1456
1190
  data: QrDisplayData;
1457
- } & UiRequestOperationAttribution;
1191
+ };
1458
1192
  };
1459
1193
  [UI_REQUEST.REQUEST_QR_SCAN]: {
1460
1194
  type: typeof UI_REQUEST.REQUEST_QR_SCAN;
1461
1195
  payload: {
1462
1196
  device: DeviceInfo;
1463
- } & UiRequestOperationAttribution;
1197
+ };
1464
1198
  };
1465
1199
  [UI_REQUEST.REQUEST_DEVICE_PERMISSION]: {
1466
1200
  type: typeof UI_REQUEST.REQUEST_DEVICE_PERMISSION;
@@ -1468,11 +1202,13 @@ interface HardwareEventMap {
1468
1202
  transportType: TransportType;
1469
1203
  connectId?: string;
1470
1204
  deviceId?: string;
1471
- } & UiRequestOperationAttribution;
1205
+ };
1472
1206
  };
1473
1207
  [UI_REQUEST.REQUEST_SELECT_DEVICE]: {
1474
1208
  type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
1475
- payload: DeviceSelectionRequest;
1209
+ payload: {
1210
+ devices: DeviceInfo[];
1211
+ };
1476
1212
  };
1477
1213
  [UI_REQUEST.REQUEST_DEVICE_CONNECT]: {
1478
1214
  type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
@@ -1480,7 +1216,7 @@ interface HardwareEventMap {
1480
1216
  vendor: string;
1481
1217
  reason: string;
1482
1218
  message: string;
1483
- } & UiRequestOperationAttribution;
1219
+ };
1484
1220
  };
1485
1221
  [UI_REQUEST.REQUEST_BTC_HIGH_INDEX_CONFIRM]: {
1486
1222
  type: typeof UI_REQUEST.REQUEST_BTC_HIGH_INDEX_CONFIRM;
@@ -1488,14 +1224,14 @@ interface HardwareEventMap {
1488
1224
  vendor: string;
1489
1225
  path: string;
1490
1226
  accountIndex: number;
1491
- } & UiRequestOperationAttribution;
1227
+ };
1492
1228
  };
1493
1229
  [UI_REQUEST.REQUEST_INSTALL_APP]: {
1494
1230
  type: typeof UI_REQUEST.REQUEST_INSTALL_APP;
1495
1231
  payload: {
1496
1232
  vendor: string;
1497
1233
  appName: string;
1498
- } & UiRequestOperationAttribution;
1234
+ };
1499
1235
  };
1500
1236
  [UI_REQUEST.REQUEST_TREZOR_THP_PAIRING]: {
1501
1237
  type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
@@ -1504,11 +1240,11 @@ interface HardwareEventMap {
1504
1240
  availableMethods: number[];
1505
1241
  selectedMethod: number;
1506
1242
  nfcData?: string;
1507
- } & UiRequestOperationAttribution;
1243
+ };
1508
1244
  };
1509
1245
  [UI_REQUEST.CLOSE_UI_WINDOW]: {
1510
1246
  type: typeof UI_REQUEST.CLOSE_UI_WINDOW;
1511
- payload: UiRequestOperationAttribution;
1247
+ payload: Record<string, never>;
1512
1248
  };
1513
1249
  [SDK.DEVICE_INTERACTION]: {
1514
1250
  type: typeof SDK.DEVICE_INTERACTION;
@@ -1535,23 +1271,16 @@ interface HardwareEventMap {
1535
1271
  connectId: string;
1536
1272
  };
1537
1273
  };
1538
- [SDK.OPERATION_ENDED]: {
1539
- type: typeof SDK.OPERATION_ENDED;
1540
- payload: {
1541
- operationId: string;
1542
- reason: OperationEndReason;
1543
- };
1544
- };
1545
1274
  }
1546
1275
  interface IDeviceManagerMethods {
1547
- getFeatures?(connectId: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1548
- deviceSettings?(connectId: string, params: TrezorDeviceSettingsParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1549
- setBrightness?(connectId: string, params?: TrezorBrightnessParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1550
- changePin?(connectId: string, params?: TrezorChangePinParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1551
- wipeDevice?(connectId: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1276
+ getFeatures?(connectId: string): Promise<Response<Record<string, unknown>>>;
1277
+ deviceSettings?(connectId: string, params: TrezorDeviceSettingsParams): Promise<Response<Record<string, unknown>>>;
1278
+ setBrightness?(connectId: string, params?: TrezorBrightnessParams): Promise<Response<Record<string, unknown>>>;
1279
+ changePin?(connectId: string, params?: TrezorChangePinParams): Promise<Response<Record<string, unknown>>>;
1280
+ wipeDevice?(connectId: string): Promise<Response<Record<string, unknown>>>;
1552
1281
  authenticateDevice?(connectId: string, params: {
1553
1282
  challenge: string;
1554
- }, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1283
+ }): Promise<Response<Record<string, unknown>>>;
1555
1284
  }
1556
1285
  interface IWalletStateMethods {
1557
1286
  /**
@@ -1578,37 +1307,20 @@ interface IWalletStateMethods {
1578
1307
  * Optional: vendors without host-managed passphrase sessions (Ledger) omit
1579
1308
  * it. Implemented by `TrezorAdapter`.
1580
1309
  */
1581
- getPassphraseState?(connectId: string, passphraseState?: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<string | null>>;
1310
+ getPassphraseState?(connectId: string, passphraseState?: string): Promise<Response<string | null>>;
1582
1311
  }
1583
- /**
1584
- * `stops-waiting`: an on-device confirmation stays up until answered or timed out.
1585
- * `interrupts-device`: the command on the wire is withdrawn. No vendor reports it, so hosts
1586
- * should say "stopped waiting, answer on the device", not "cancelled".
1587
- */
1588
- type CancelCapability = 'interrupts-device' | 'stops-waiting';
1589
1312
  interface IHardwareWallet<TConfig = unknown> extends IEvmMethods, IBtcMethods, ISolMethods, ITronMethods, IDeviceManagerMethods, IWalletStateMethods {
1590
1313
  readonly vendor: string;
1591
1314
  readonly activeTransport: TransportType | null;
1592
- /** What `cancel()` reaches on this vendor. Declared, never inferred. */
1593
- readonly cancelCapability: CancelCapability;
1594
1315
  init(config: TConfig): Promise<void>;
1595
1316
  dispose(): Promise<void>;
1596
1317
  getAvailableTransports(): TransportType[];
1597
1318
  switchTransport(type: TransportType): Promise<void>;
1598
1319
  searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
1599
- /** Discover selectable hardware entries without claiming identified devices or wallets. */
1600
- searchDeviceTargets(options?: SearchDevicesOptions): Promise<DeviceSearchTarget[]>;
1601
- /** @deprecated Use searchDeviceTargets(). */
1602
- listConnectionTargets(options?: SearchDevicesOptions): Promise<ConnectionTarget[]>;
1603
- /** Connect or logically bind a selected search result and return a runtime-only operation id. */
1604
- connectDevice(searchTargetId: string): Promise<Response<string>>;
1605
- /** Device Manager rebind: verify the existing identity before replacing its BLE locator. */
1606
- bindBleDevice?(params: BindBleDeviceParams): Promise<Response<string>>;
1607
- /** Resolve and pin operation routing; the caller verifies wallet identity before business calls. */
1608
- acquireOperation?(connectId: string, context: IHardwareConnectionContext): Promise<Response<string>>;
1609
- /** Release a caller-owned operation. Disconnect events end matching operations automatically. */
1610
- releaseOperation(operationId: string): Promise<void>;
1320
+ connectDevice(connectId: string): Promise<Response<string>>;
1321
+ disconnectDevice(connectId: string): Promise<void>;
1611
1322
  getDeviceInfo(connectId: string, deviceId: string): Promise<Response<DeviceInfo>>;
1323
+ getSupportedChains(): ChainCapability[];
1612
1324
  /** Abort the in-flight call. Omit connectId to cancel whatever is active. */
1613
1325
  cancel(connectId?: string): void;
1614
1326
  allNetworkGetAddress(connectId: string, deviceId: string, params: AllNetworkGetAddressParams): Promise<Response<AllNetworkAddressResponse[]>>;
@@ -1645,11 +1357,6 @@ interface SearchDevicesOptions {
1645
1357
  * was discovered first.
1646
1358
  */
1647
1359
  waitForAllTransports?: boolean;
1648
- /**
1649
- * Restrict discovery to one transport. A virtual target (Keystone QR) must not start any wallet
1650
- * interaction during discovery; `connectDevice()` resolves it.
1651
- */
1652
- transportType?: ConnectionType;
1653
1360
  }
1654
1361
 
1655
1362
  interface EvmGetAddressParams extends PassphraseStateAware {
@@ -1773,11 +1480,6 @@ interface EvmSignTypedDataFull extends PassphraseStateAware {
1773
1480
  primaryType: string;
1774
1481
  message: Record<string, unknown>;
1775
1482
  };
1776
- /**
1777
- * The dApp's original EIP-712 JSON, byte for byte. Serializing vendors (Keystone) must prefer it:
1778
- * re-stringifying `data` rewrites integers wider than 2^53 and exponent forms.
1779
- */
1780
- dataJson?: string;
1781
1483
  metamaskV4Compat?: boolean;
1782
1484
  showMessageHash?: boolean;
1783
1485
  /**
@@ -1816,33 +1518,6 @@ interface IEvmMethods {
1816
1518
  evmSignTypedData(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignTypedDataParams>>): Promise<Response<EvmSignature>>;
1817
1519
  }
1818
1520
 
1819
- /** Which `GET_VK` encoding the Ledger Zcash app should return. */
1820
- type ZcashFullViewingKeyMode = 'ufvk' | 'orchardFvk';
1821
- interface ZcashGetFullViewingKeyParams extends PassphraseStateAware {
1822
- /** BIP44 account path `m/44'/133'/a'`; a deeper transparent path is accepted, only `a'` is used. */
1823
- path: string;
1824
- /** Default `ufvk`. */
1825
- mode?: ZcashFullViewingKeyMode;
1826
- }
1827
- interface ZcashFullViewingKey {
1828
- path: string;
1829
- mode: ZcashFullViewingKeyMode;
1830
- /** ZIP-316 bech32m UFVK string (mode `ufvk`). */
1831
- ufvk?: string;
1832
- /** 96-byte raw Orchard FVK as hex (mode `orchardFvk`). */
1833
- orchardFvk?: string;
1834
- }
1835
- interface ZcashGetShieldedAddressParams extends PassphraseStateAware {
1836
- /** Full 5-level transparent path `m/44'/133'/a'/0/i`; the Orchard path is derived from it. */
1837
- path: string;
1838
- showOnDevice?: boolean;
1839
- }
1840
- interface ZcashShieldedAddress {
1841
- /** Unified address with a single Orchard receiver. */
1842
- address: string;
1843
- path: string;
1844
- }
1845
-
1846
1521
  /**
1847
1522
  * Low-level device descriptor from Transport layer.
1848
1523
  * Represents a physical device detected by USB/BLE scanning.
@@ -1888,13 +1563,14 @@ interface DeviceDisconnectEvent {
1888
1563
  type DeviceChangeEvent = DeviceConnectEvent | DeviceDisconnectEvent;
1889
1564
 
1890
1565
  /**
1891
- * Serializes every device call and gives callers one handle to cancel them. Ordering is already
1892
- * guaranteed by awaiting callers, so what this adds is an AbortController per job, a busy check
1893
- * that rejects double-submits, and generation tracking so a job queued before a teardown doesn't
1894
- * start after it; these races exist even for a sequential caller because cleanup is async.
1895
- *
1896
- * Interrupt-or-ask policy belongs to the caller; `getActiveJob()` is synchronous so a UI handler
1897
- * can look, decide, and submit in one turn without racing an in-flight enqueue.
1566
+ * Pure FIFO job queue. Every enqueue chains onto the tail; jobs run one at
1567
+ * a time across all devices. The queue is intentionally passive — it does
1568
+ * NOT decide whether to interrupt or ask the user. Those are application-
1569
+ * layer concerns owned by the caller (e.g. a UI button handler that wants
1570
+ * to ask "device is busy, interrupt current?" before submitting). The
1571
+ * queue exposes inspection (`getActiveJob`) and explicit cancellation
1572
+ * (`cancelActive` / `cancelAll`) so callers can implement those policies
1573
+ * synchronously, without racing against in-flight enqueues.
1898
1574
  */
1899
1575
  interface JobOptions {
1900
1576
  label?: string;
@@ -1906,15 +1582,10 @@ interface ActiveJobInfo {
1906
1582
  label?: string;
1907
1583
  startedAt: number;
1908
1584
  }
1909
- interface CancelScopeHandle {
1910
- signal: AbortSignal;
1911
- release: () => void;
1912
- }
1913
1585
  declare class DeviceJobQueue {
1914
1586
  private _tail;
1915
1587
  private _active;
1916
1588
  private readonly _jobs;
1917
- private readonly _cancelScopes;
1918
1589
  /** Incremented on clear() so queued-but-not-yet-running jobs detect invalidation. */
1919
1590
  private _generation;
1920
1591
  private readonly _generationCancelReasons;
@@ -1923,57 +1594,21 @@ declare class DeviceJobQueue {
1923
1594
  * `deviceId` is a label only — used by inspection / cancellation routing.
1924
1595
  */
1925
1596
  enqueue<T>(deviceId: string, job: (signal: AbortSignal) => Promise<T>, options?: JobOptions): Promise<T>;
1926
- /**
1927
- * Holds a cancel across the gaps between a bundle's per-item jobs, when the queue is empty.
1928
- * Callers must `release()` when the bundle ends.
1929
- */
1930
- createCancelScope(deviceId: string): CancelScopeHandle;
1931
- /**
1932
- * Cancels the running job only; `reason` becomes signal.reason. Adapters use
1933
- * `cancelActiveAndPending`; this stays for a connector layer that stops only what is on the wire.
1934
- */
1935
- cancelActive(deviceId?: string, reason?: Error): boolean;
1936
- /**
1937
- * Cancels the active job and unstarted queued jobs; returns whether anything was reached. Only
1938
- * `undefined` means everything: an empty key matches nothing instead of tearing the queue down.
1939
- */
1597
+ /** Cancel the active job. If `deviceId` is given, only cancels when it matches. */
1598
+ cancelActive(deviceId?: string): boolean;
1599
+ /** Force cancel the active job. `reason` becomes signal.reason. */
1600
+ forceCancelActive(deviceId?: string, reason?: Error): boolean;
1601
+ /** Cancel the active job (alias for callers that previously needed multi-device cancel). */
1602
+ cancelAllActive(reason?: Error): void;
1603
+ /** Cancel the active job and invalidate queued jobs that have not started. */
1940
1604
  cancelActiveAndPending(deviceId?: string, reason?: Error): boolean;
1941
1605
  /** Get info about the currently active job, or null if idle. */
1942
1606
  getActiveJob(deviceId?: string): ActiveJobInfo | null;
1607
+ /** True if any job is currently running. */
1608
+ isBusy(): boolean;
1943
1609
  clear(reason?: Error): void;
1944
1610
  }
1945
1611
 
1946
- declare const HARDWARE_RUNTIME_ID_PREFIX = "hwk:runtime";
1947
- /**
1948
- * `search-target`: one device in one discovery snapshot, dead on the next search of that kind.
1949
- * `link`: one open transport. `operation`: one business operation, outliving links via `rebind()`.
1950
- */
1951
- type HardwareRuntimeIdKind = 'operation' | 'search-target' | 'link';
1952
- type HardwareRuntimeId = {
1953
- kind: HardwareRuntimeIdKind;
1954
- vendor: VendorType;
1955
- };
1956
- /** Runtime ids are opaque and must never be persisted as device identity. */
1957
- declare function createHardwareOperationId(vendor: VendorType): string;
1958
- /** Search targets are valid only for the adapter's current discovery snapshot. */
1959
- declare function createHardwareSearchTargetId(vendor: VendorType): string;
1960
- declare function createHardwareLinkId(vendor: VendorType): string;
1961
- declare function hasHardwareRuntimeIdPrefix(value: unknown): value is string;
1962
- declare function parseHardwareRuntimeId(value: unknown): HardwareRuntimeId | undefined;
1963
- declare function isHardwareOperationId(value: unknown): value is string;
1964
-
1965
- interface HardwareOperationTarget {
1966
- /** Effective target accepted by existing adapter/connector call paths. */
1967
- targetId: string | undefined;
1968
- /** Present when this operation is pinned to a live operation. */
1969
- operationId: string | undefined;
1970
- }
1971
- /**
1972
- * Normalizes the transitional positional operation id and the canonical
1973
- * common-params field. All vendors must reject conflicting bindings.
1974
- */
1975
- declare function resolveHardwareOperationTarget(positionalTargetId: string | null | undefined, commonOperationId: string | null | undefined, expectedVendor?: VendorType): Response<HardwareOperationTarget>;
1976
-
1977
1612
  /**
1978
1613
  * Minimal typed event emitter using Map<string, Set<listener>>.
1979
1614
  * Each adapter uses this for device events (connect, disconnect, pin, etc.).
@@ -2000,101 +1635,6 @@ declare class TypedEventEmitter<TMap extends Record<string, any> = Record<string
2000
1635
  listenerCount(event: string): number;
2001
1636
  }
2002
1637
 
2003
- /** Serializable BLE transport data shared by Electron main and renderer runtimes. */
2004
- interface ElectronBleDeviceInfo {
2005
- id: string;
2006
- name?: string;
2007
- rssi?: number;
2008
- advertisedServiceUuids?: string[];
2009
- }
2010
- /**
2011
- * IPC-safe peripheral match: advertises one of `serviceUuids`, or its local name matches every
2012
- * `namePatterns` entry (case-insensitive regex sources).
2013
- */
2014
- interface ElectronBleMatch {
2015
- serviceUuids?: string[];
2016
- namePatterns?: string[];
2017
- }
2018
- interface ElectronBleScanOptions {
2019
- /** Opaque partition key: results and connected devices never mix across it. */
2020
- vendor?: string;
2021
- match?: ElectronBleMatch;
2022
- /** @deprecated Superseded by `match.serviceUuids`. */
2023
- serviceUuids?: string[];
2024
- durationMs?: number;
2025
- }
2026
- /** GATT profile plus the write framing this vendor's firmware expects. */
2027
- interface ElectronBleConnectOptions {
2028
- vendor: string;
2029
- serviceUuid: string;
2030
- writeUuid: string;
2031
- notifyUuid: string;
2032
- /**
2033
- * `padded`: fixed `chunkSize` packets, last zero-filled (Trezor firmware drops short packets).
2034
- * `raw`: the buffer as given, for self-length-framed protocols (Ledger).
2035
- */
2036
- write?: {
2037
- mode: 'padded' | 'raw';
2038
- chunkSize?: number;
2039
- chunkDelayMs?: number;
2040
- maxLength?: number;
2041
- };
2042
- }
2043
- /** Native code handles GATT only; framing, identity checks and wallet calls stay in the SDK. */
2044
- interface ElectronBleApi {
2045
- scan(options?: ElectronBleScanOptions): Promise<ElectronBleDeviceInfo[]>;
2046
- stopScan(vendor?: string): Promise<void>;
2047
- connect(id: string, options?: ElectronBleConnectOptions): Promise<{
2048
- id: string;
2049
- name?: string;
2050
- }>;
2051
- disconnect(id: string): Promise<void>;
2052
- subscribe(id: string): Promise<void>;
2053
- unsubscribe(id: string): Promise<void>;
2054
- write(id: string, hexData: string): Promise<void>;
2055
- checkAvailability(): Promise<{
2056
- available: boolean;
2057
- state: string;
2058
- initialized: boolean;
2059
- }>;
2060
- getDevice(id: string): Promise<ElectronBleDeviceInfo | null>;
2061
- onNotification(handler: (id: string, hexData: string) => void): () => void;
2062
- onDeviceDisconnected(handler: (id: string) => void): () => void;
2063
- /** Abandon an in-flight connect in the main process. Optional for hosts that cannot cancel. */
2064
- cancelPairing?(options?: {
2065
- vendor: string;
2066
- id?: string;
2067
- }): Promise<void>;
2068
- }
2069
-
2070
- /**
2071
- * A host refusal is reported, never thrown: the device is already connected, so a lost binding
2072
- * is worth a warning and a retry, not failing the user's work.
2073
- */
2074
- type SaveDeviceBindingOutcome = {
2075
- saved: true;
2076
- } | {
2077
- saved: false;
2078
- reason: SaveDeviceBindingDeclineReason;
2079
- };
2080
- /** Persist a binding through the host. Only a user abort throws. */
2081
- declare function requestSaveDeviceBinding(emitter: TypedEventEmitter<HardwareEventMap>, registry: UiRequestRegistry, binding: Omit<SaveDeviceBindingRequest, 'requestId'>, signal?: AbortSignal): Promise<SaveDeviceBindingOutcome>;
2082
-
2083
- /** Discovery and selection share one owner; never connect until the last scan has drained. */
2084
- declare function requestBleDeviceSelection({ emitter, registry, request, scan, signal, allowUsbFallback, pollIntervalMs, }: {
2085
- emitter: TypedEventEmitter<HardwareEventMap>;
2086
- registry: UiRequestRegistry;
2087
- request: Omit<DeviceSelectionRequest, 'requestId' | 'scanning'>;
2088
- scan: () => Promise<DeviceInfo[]>;
2089
- signal: AbortSignal;
2090
- /** The adapter must verify a returned USB candidate before dispatching any business call. */
2091
- allowUsbFallback?: boolean;
2092
- pollIntervalMs?: number;
2093
- }): Promise<{
2094
- device: DeviceInfo;
2095
- requestId: string;
2096
- }>;
2097
-
2098
1638
  /**
2099
1639
  * Compare two semver strings (e.g. "2.1.0" vs "2.3.1").
2100
1640
  * Returns -1 if a < b, 0 if equal, 1 if a > b.
@@ -2115,18 +1655,7 @@ declare function hexToBytes(hex: string): Uint8Array;
2115
1655
  /** Convert a Uint8Array to a hex string (no 0x prefix). */
2116
1656
  declare function bytesToHex(bytes: Uint8Array): string;
2117
1657
 
2118
- interface PrepareSolanaOffchainMessageV1Params {
2119
- message: Uint8Array;
2120
- requiredSigners: readonly string[];
2121
- }
2122
- interface PreparedSolanaOffchainMessageV1 {
2123
- messageText: string;
2124
- requiredSigners: string[];
2125
- serializedMessage: Uint8Array;
2126
- }
2127
- declare function prepareSolanaOffchainMessageV1({ message, requiredSigners, }: PrepareSolanaOffchainMessageV1Params): PreparedSolanaOffchainMessageV1;
2128
-
2129
- type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger' | 'keystone';
1658
+ type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger';
2130
1659
  type HardwareDeviceIdentityInput = {
2131
1660
  name?: string | null;
2132
1661
  localName?: string | null;
@@ -2189,12 +1718,8 @@ type RunAllNetworkGetAddressOptions = {
2189
1718
  buildTopLevelFailure?: (response: AllNetworkAddressResponse, context: AllNetworkResponseContext) => Response<AllNetworkAddressResponse[]>;
2190
1719
  };
2191
1720
  declare function runAllNetworkGetAddress({ connectId, deviceId, params, getMethodChain, normalizeItem, buildUnsupportedNetworkResponse, callItem, attachIdentity, shouldAbortBundle, buildTopLevelFailure, }: RunAllNetworkGetAddressOptions): Promise<Response<AllNetworkAddressResponse[]>>;
2192
- /** An SDK-dialog cancel or on-device reject ends the bundle; the user already answered "no". */
2193
- declare function isUserRefusal(code: HardwareErrorCode | number | undefined): boolean;
2194
- /** The bundle's session is gone, so the remaining items have nothing to run against. */
2195
- declare function isConnectionLost(code: HardwareErrorCode | number | undefined): boolean;
2196
1721
  declare function buildUnsupportedMethodResponse(item: AllNetworkAddressParams): AllNetworkAddressResponse;
2197
1722
 
2198
1723
  declare const DEVICE_CONNECT_RETRY_DELAY_MS = 1000;
2199
1724
 
2200
- export { ALL_NETWORK_METHOD_NAMES, type ActiveJobInfo, type AllNetworkAddressParams, type AllNetworkAddressResponse, type AllNetworkAddressResponsePayload, type AllNetworkAttachIdentityContext, type AllNetworkCallItemContext, type AllNetworkDeviceIdentity, type AllNetworkGetAddressParams, type AllNetworkMethodName, type AllNetworkResponseContext, type BindBleDeviceParams, type BtcAddress, type BtcGetAddressParams, type BtcGetPublicKeyParams, type BtcPaymentRequest, type BtcPaymentRequestMemo, type BtcPublicKey, type BtcRefTransaction, type BtcSignMsgParams, type BtcSignPsbtParams, type BtcSignTxParams, type BtcSignature, type BtcSignedPsbt, type BtcSignedTx, type BtcTxInput, type BtcTxOutput, CHAIN_FINGERPRINT_PATHS, type CancelCapability, type CancelScopeHandle, type ChainCapability, type ChainForFingerprint, type ConnectionTarget, type ConnectionType, type ConnectorCallResult, type ConnectorConfig, type ConnectorConnectTarget, type ConnectorDevice, type ConnectorErrorParams, type ConnectorEventMap, type ConnectorEventType, type ConnectorSearchDevicesOptions, type ConnectorSerializedError, type ConnectorSession, type ConnectorUiEvent, DEVICE, DEVICE_CONNECT_RETRY_DELAY_MS, DEVICE_EVENT, type DetectableHardwareVendor, type DeviceAuthenticityParams, type DeviceAuthenticityResult, type DeviceBindingStatus, type DeviceCapabilities, type DeviceChangeEvent, type DeviceConnectEvent, type DeviceDescriptor, type DeviceDisconnectEvent, type DeviceEvent, type DeviceEventListener, type DeviceInfo, DeviceJobQueue, type DeviceSearchTarget, type DeviceSelectionContext, type DeviceSelectionRequest, type DeviceTarget, EConnectorInteraction, type EIP712Domain, type ElectronBleApi, type ElectronBleConnectOptions, type ElectronBleDeviceInfo, type ElectronBleMatch, type ElectronBleScanOptions, type EvmAddress, type EvmEthereumDefinitions, type EvmGetAddressParams, type EvmPaymentRequest, type EvmPaymentRequestMemo, type EvmSignMsgParams, type EvmSignTxLedgerParams, type EvmSignTxParams, type EvmSignTxTrezorParams, type EvmSignTypedDataFull, type EvmSignTypedDataHash, type EvmSignTypedDataParams, type EvmSignature, type EvmSignedTx, type Failure, HARDWARE_METHOD_CATALOG, HARDWARE_RUNTIME_ID_PREFIX, type HardwareCallExtra, type HardwareDeviceIdentityInput, HardwareErrorCode, type HardwareEvent, type HardwareEventMap, type HardwareMethodMetadata, type HardwareMethodName, type HardwareOperation, type HardwareOperationTarget, type HardwareRuntimeId, type HardwareRuntimeIdKind, type HardwareUiEvent, HwkErrorOrigin, HwkRecoveryHint, type IBtcMethods, type ICommonCallParams, type IConnector, type IDeviceManagerMethods, type IDeviceManagerOperationContext, type IEvmMethods, type IHardwareBridge, type IHardwareCallParams, type IHardwareCommonCallParams, type IHardwareConnectionContext, type IHardwareWallet, type IPassphraseCallParams, type ISolMethods, type ITronMethods, type IWalletStateMethods, type JobOptions, type KnownDeviceConnection, type NullableCallArg, OPERATION_DEFAULT_TTL_MS, type OperationEndReason, OperationRegistry, type PassphraseResponse, type PassphraseStateAware, type PrepareSolanaOffchainMessageV1Params, type PreparedSolanaOffchainMessageV1, QrDisplayData, type Response, type RunAllNetworkGetAddressOptions, SDK, SaveDeviceBindingDeclineReason, type SaveDeviceBindingRequest, type SdkEvent, type SearchDevicesOptions, type SearchTargetReusePolicy, type SolAddress, type SolGetAddressParams, type SolOffchainMessageV1Params, type SolSignMsgParams, type SolSignTxParams, type SolSignature, type SolSignedTx, type Success, type TransportType, type TrezorBrightnessParams, type TrezorChangePinParams, type TrezorDeviceSettingsParams, type TrezorDisplayRotation, type TrezorSafetyCheckLevel, type TronAddress, type TronContract, type TronFreezeBalanceV2Contract, type TronGetAddressParams, type TronResource, type TronSignMsgParams, type TronSignTxParams, type TronSignature, type TronSignedTx, type TronTransferContract, type TronTriggerSmartContract, type TronUnfreezeBalanceV2Contract, type TronVote, type TronVoteWitnessContract, type TronWithdrawExpireUnfreezeContract, TypedEventEmitter, UI_REQUEST, type UiRequestEvent, UiRequestOperationAttribution, UiRequestRegistry, UiResponseEvent, type VendorType, type WalletIdentity, type ZcashFullViewingKey, type ZcashFullViewingKeyMode, type ZcashGetFullViewingKeyParams, type ZcashGetShieldedAddressParams, type ZcashShieldedAddress, batchCall, buildUnsupportedMethodResponse, bytesToHex, canReplayHardwareMethodAfterTransportFailure, compareSemver, createBridgedConnector, createCombinedConnector, createHardwareLinkId, createHardwareOperationId, createHardwareSearchTargetId, deriveDeviceFingerprint, deriveWalletId, detectHardwareVendorFromDescriptor, ensure0x, failure, getAllNetworkMethodChain, getHardwareMethodMetadata, hasHardwareRuntimeIdPrefix, hexToBytes, isAllNetworkMethodName, isConnectionLost, isHardwareOperationId, isKnownNonTargetHardwareVendor, isUserRefusal, padHex64, parseBip32MasterFingerprint, parseHardwareRuntimeId, prepareSolanaOffchainMessageV1, rehydrateConnectorError, requestBleDeviceSelection, requestSaveDeviceBinding, resolveHardwareOperationTarget, resolveSearchTargetReusePolicy, runAllNetworkGetAddress, serializeConnectorError, stripHex, success };
1725
+ export { ALL_NETWORK_METHOD_NAMES, type ActiveJobInfo, type AllNetworkAddressParams, type AllNetworkAddressResponse, type AllNetworkAddressResponsePayload, type AllNetworkAttachIdentityContext, type AllNetworkCallItemContext, type AllNetworkGetAddressParams, type AllNetworkMethodName, type AllNetworkResponseContext, type BtcAddress, type BtcGetAddressParams, type BtcGetPublicKeyParams, type BtcPaymentRequest, type BtcPaymentRequestMemo, type BtcPublicKey, type BtcRefTransaction, type BtcSignMsgParams, type BtcSignPsbtParams, type BtcSignTxParams, type BtcSignature, type BtcSignedPsbt, type BtcSignedTx, type BtcTxInput, type BtcTxOutput, CHAIN_FINGERPRINT_PATHS, type ChainCapability, type ChainForFingerprint, type ConnectionType, type ConnectorCallResult, type ConnectorConfig, type ConnectorDevice, type ConnectorErrorParams, type ConnectorEventMap, type ConnectorEventType, type ConnectorSerializedError, type ConnectorSession, type ConnectorUiEvent, DEVICE, DEVICE_CONNECT_RETRY_DELAY_MS, DEVICE_EVENT, type DetectableHardwareVendor, type DeviceAuthenticityParams, type DeviceAuthenticityResult, type DeviceCapabilities, type DeviceChangeEvent, type DeviceConnectEvent, type DeviceDescriptor, type DeviceDisconnectEvent, type DeviceEvent, type DeviceEventListener, type DeviceInfo, DeviceJobQueue, type DeviceTarget, EConnectorInteraction, type EIP712Domain, type EvmAddress, type EvmEthereumDefinitions, type EvmGetAddressParams, type EvmPaymentRequest, type EvmPaymentRequestMemo, type EvmSignMsgParams, type EvmSignTxLedgerParams, type EvmSignTxParams, type EvmSignTxTrezorParams, type EvmSignTypedDataFull, type EvmSignTypedDataHash, type EvmSignTypedDataParams, type EvmSignature, type EvmSignedTx, type Failure, HARDWARE_METHOD_CATALOG, type HardwareDeviceIdentityInput, HardwareErrorCode, type HardwareEvent, type HardwareEventMap, type HardwareMethodMetadata, type HardwareMethodName, type HardwareUiEvent, type IBtcMethods, type ICommonCallParams, type IConnector, type IDeviceManagerMethods, type IEvmMethods, type IHardwareBridge, type IHardwareCallParams, type IHardwareCommonCallParams, type IHardwareWallet, type IPassphraseCallParams, type ISolMethods, type ITronMethods, type IWalletStateMethods, type JobOptions, type NullableCallArg, type PassphraseResponse, type PassphraseStateAware, QrDisplayData, type Response, type RunAllNetworkGetAddressOptions, SDK, type SdkEvent, type SearchDevicesOptions, type SolAddress, type SolGetAddressParams, type SolSignMsgParams, type SolSignTxParams, type SolSignature, type SolSignedTx, type Success, type TransportType, type TrezorBrightnessParams, type TrezorChangePinParams, type TrezorDeviceSettingsParams, type TrezorDisplayRotation, type TrezorSafetyCheckLevel, type TronAddress, type TronContract, type TronFreezeBalanceV2Contract, type TronGetAddressParams, type TronResource, type TronSignMsgParams, type TronSignTxParams, type TronSignature, type TronSignedTx, type TronTransferContract, type TronTriggerSmartContract, type TronUnfreezeBalanceV2Contract, type TronVote, type TronVoteWitnessContract, type TronWithdrawExpireUnfreezeContract, TypedEventEmitter, UI_REQUEST, type UiRequestEvent, UiResponseEvent, type VendorType, batchCall, buildUnsupportedMethodResponse, bytesToHex, compareSemver, createBridgedConnector, createCombinedConnector, deriveDeviceFingerprint, detectHardwareVendorFromDescriptor, ensure0x, failure, getAllNetworkMethodChain, getHardwareMethodMetadata, hexToBytes, isAllNetworkMethodName, isKnownNonTargetHardwareVendor, padHex64, rehydrateConnectorError, runAllNetworkGetAddress, serializeConnectorError, stripHex, success };