@onekeyfe/hwk-adapter-core 1.2.5-alpha.1 → 1.2.5-alpha.3

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 -578
  15. package/dist/index.d.ts +104 -578
  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.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-BgJ4kzRx.js';
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.js';
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.js';
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.js';
1
+ import { HardwareErrorCode } from './errors.js';
2
+ export { HwkError, IHwkErrorPayload, ORPHAN_ELIGIBLE_ERROR_CODES, createHwkError, enrichErrorMessage } from './errors.js';
3
+ import { U as UiResponseEvent, a as UI_REQUEST, Q as QrDisplayData } from './ui-events-Cb7haAeE.js';
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.js';
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,76 +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 SDK has verified this endpoint; the host must persist it before acknowledging. */
1145
- interface SaveDeviceBindingRequest extends UiRequestOperationAttribution {
1146
- requestId: string;
1147
- selectionRequestId: string;
1148
- connection: {
1149
- transport: 'ble';
1150
- connectId: string;
1151
- };
1152
- identity: Extract<WalletIdentity, {
1153
- vendor: 'ledger' | 'trezor';
1154
- }>;
1155
- extra?: HardwareCallExtra;
1156
- }
1157
- type BindBleDeviceParams = Pick<SaveDeviceBindingRequest, 'identity' | 'extra'>;
1158
- interface DeviceBindingStatus {
1159
- selectionRequestId: string;
1160
- status: 'verifying' | 'saved' | 'failed' | 'cancelled';
1161
- }
1162
917
  /**
1163
918
  * Cross-chain / cross-vendor options passed alongside any chain method's
1164
919
  * own params (the optional last argument). Holds operation-level switches
1165
920
  * that aren't specific to one chain. Vendor-specific options can be added
1166
921
  * as typed sub-fields here when a vendor actually needs them.
1167
922
  */
1168
- interface ICommonCallParams extends IHardwareConnectionContext {
923
+ interface ICommonCallParams {
1169
924
  /**
1170
925
  * When the required device app is missing, prompt the user (UI request)
1171
926
  * to install it, stream install progress, then retry the operation once.
1172
927
  * Off by default — preserves the plain "app not installed" failure.
1173
928
  */
1174
929
  autoInstallApp?: boolean;
1175
- /** Runtime-only id from connectDevice(); when present, discovery and fallback are disabled. */
1176
- operationId?: string;
1177
930
  }
1178
931
  type NullableCallArg<T> = T | null | undefined;
1179
932
  interface IPassphraseCallParams {
@@ -1182,14 +935,6 @@ interface IPassphraseCallParams {
1182
935
  }
1183
936
  type IHardwareCommonCallParams = ICommonCallParams & IPassphraseCallParams;
1184
937
  type IHardwareCallParams<T> = T & IHardwareCommonCallParams;
1185
- /**
1186
- * Runtime-only device-manager context, never forwarded to firmware. The expected identity lets an
1187
- * adapter fail closed before replaying a read or mutation after a reconnect.
1188
- */
1189
- interface IDeviceManagerOperationContext extends IHardwareConnectionContext {
1190
- operationId?: string;
1191
- expectedDeviceIdentity?: WalletIdentity;
1192
- }
1193
938
  interface AllNetworkAddressParams {
1194
939
  network: string;
1195
940
  path: string;
@@ -1200,7 +945,16 @@ interface AllNetworkAddressParams {
1200
945
  interface AllNetworkGetAddressParams extends IHardwareCommonCallParams {
1201
946
  bundle: AllNetworkAddressParams[];
1202
947
  }
1203
- 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
+ };
1204
958
  type AllNetworkAddressResponsePayload = Record<string, unknown> & {
1205
959
  error?: string;
1206
960
  code?: HardwareErrorCode | number;
@@ -1208,7 +962,6 @@ type AllNetworkAddressResponsePayload = Record<string, unknown> & {
1208
962
  connectId?: string;
1209
963
  deviceId?: string;
1210
964
  deviceIdentity?: AllNetworkDeviceIdentity;
1211
- rootFingerprint?: number;
1212
965
  chainFingerprint?: string;
1213
966
  chainFingerprintChain?: ChainForFingerprint;
1214
967
  params?: Record<string, unknown>;
@@ -1257,50 +1010,46 @@ type UiRequestEvent = {
1257
1010
  device?: DeviceInfo;
1258
1011
  connectId?: string;
1259
1012
  type?: string;
1260
- } & UiRequestOperationAttribution;
1013
+ };
1261
1014
  } | {
1262
1015
  type: typeof UI_REQUEST.REQUEST_PASSPHRASE;
1263
1016
  payload: {
1264
1017
  device: DeviceInfo;
1265
- } & UiRequestOperationAttribution;
1018
+ };
1266
1019
  } | {
1267
1020
  type: typeof UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE;
1268
1021
  payload: {
1269
1022
  device: DeviceInfo;
1270
- } & UiRequestOperationAttribution;
1023
+ };
1271
1024
  } | {
1272
1025
  type: typeof UI_REQUEST.REQUEST_BUTTON;
1273
1026
  payload: {
1274
1027
  device: DeviceInfo;
1275
1028
  code?: string;
1276
- } & UiRequestOperationAttribution;
1029
+ };
1277
1030
  } | {
1278
1031
  type: typeof UI_REQUEST.REQUEST_QR_DISPLAY;
1279
1032
  payload: {
1280
1033
  device: DeviceInfo;
1281
1034
  data: QrDisplayData;
1282
- } & UiRequestOperationAttribution;
1035
+ };
1283
1036
  } | {
1284
1037
  type: typeof UI_REQUEST.REQUEST_QR_SCAN;
1285
1038
  payload: {
1286
1039
  device: DeviceInfo;
1287
- } & UiRequestOperationAttribution;
1040
+ };
1288
1041
  } | {
1289
1042
  type: typeof UI_REQUEST.REQUEST_DEVICE_PERMISSION;
1290
1043
  payload: {
1291
1044
  transportType: TransportType;
1292
1045
  connectId?: string;
1293
1046
  deviceId?: string;
1294
- } & UiRequestOperationAttribution;
1047
+ };
1295
1048
  } | {
1296
1049
  type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
1297
- payload: DeviceSelectionRequest;
1298
- } | {
1299
- type: typeof UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
1300
- payload: SaveDeviceBindingRequest;
1301
- } | {
1302
- type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
1303
- payload: DeviceBindingStatus;
1050
+ payload: {
1051
+ devices: DeviceInfo[];
1052
+ };
1304
1053
  } | {
1305
1054
  type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
1306
1055
  payload: {
@@ -1320,13 +1069,13 @@ type UiRequestEvent = {
1320
1069
  * isn't recognized.
1321
1070
  */
1322
1071
  message: string;
1323
- } & UiRequestOperationAttribution;
1072
+ };
1324
1073
  } | {
1325
1074
  type: typeof UI_REQUEST.REQUEST_INSTALL_APP;
1326
1075
  payload: {
1327
1076
  vendor: string;
1328
1077
  appName: string;
1329
- } & UiRequestOperationAttribution;
1078
+ };
1330
1079
  } | {
1331
1080
  type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
1332
1081
  payload: {
@@ -1334,10 +1083,10 @@ type UiRequestEvent = {
1334
1083
  availableMethods: number[];
1335
1084
  selectedMethod: number;
1336
1085
  nfcData?: string;
1337
- } & UiRequestOperationAttribution;
1086
+ };
1338
1087
  } | {
1339
1088
  type: typeof UI_REQUEST.CLOSE_UI_WINDOW;
1340
- payload: UiRequestOperationAttribution;
1089
+ payload: Record<string, never>;
1341
1090
  };
1342
1091
  type SdkEvent = {
1343
1092
  type: typeof SDK.DEVICE_INTERACTION;
@@ -1360,12 +1109,6 @@ type SdkEvent = {
1360
1109
  payload: {
1361
1110
  connectId: string;
1362
1111
  };
1363
- } | {
1364
- type: typeof SDK.OPERATION_ENDED;
1365
- payload: {
1366
- operationId: string;
1367
- reason: OperationEndReason;
1368
- };
1369
1112
  };
1370
1113
  type HardwareEvent = DeviceEvent | UiRequestEvent | SdkEvent | HardwareUiEvent;
1371
1114
  type DeviceEventListener = (event: HardwareEvent) => void;
@@ -1376,14 +1119,6 @@ type DeviceEventListener = (event: HardwareEvent) => void;
1376
1119
  * and the value is the narrowed event object the listener will receive.
1377
1120
  */
1378
1121
  interface HardwareEventMap {
1379
- [UI_REQUEST.DEVICE_BINDING_STATUS]: {
1380
- type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
1381
- payload: DeviceBindingStatus;
1382
- };
1383
- [UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING]: {
1384
- type: typeof UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
1385
- payload: SaveDeviceBindingRequest;
1386
- };
1387
1122
  'ui-event': HardwareUiEvent;
1388
1123
  [DEVICE.CONNECT]: {
1389
1124
  type: typeof DEVICE.CONNECT;
@@ -1424,7 +1159,7 @@ interface HardwareEventMap {
1424
1159
  device?: DeviceInfo;
1425
1160
  connectId?: string;
1426
1161
  type?: string;
1427
- } & UiRequestOperationAttribution;
1162
+ };
1428
1163
  };
1429
1164
  [UI_REQUEST.REQUEST_PASSPHRASE]: {
1430
1165
  type: typeof UI_REQUEST.REQUEST_PASSPHRASE;
@@ -1433,33 +1168,33 @@ interface HardwareEventMap {
1433
1168
  connectId?: string;
1434
1169
  passphraseState?: string;
1435
1170
  useEmptyPassphrase?: boolean;
1436
- } & UiRequestOperationAttribution;
1171
+ };
1437
1172
  };
1438
1173
  [UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE]: {
1439
1174
  type: typeof UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE;
1440
1175
  payload: {
1441
1176
  device: DeviceInfo;
1442
- } & UiRequestOperationAttribution;
1177
+ };
1443
1178
  };
1444
1179
  [UI_REQUEST.REQUEST_BUTTON]: {
1445
1180
  type: typeof UI_REQUEST.REQUEST_BUTTON;
1446
1181
  payload: {
1447
1182
  device: DeviceInfo;
1448
1183
  code?: string;
1449
- } & UiRequestOperationAttribution;
1184
+ };
1450
1185
  };
1451
1186
  [UI_REQUEST.REQUEST_QR_DISPLAY]: {
1452
1187
  type: typeof UI_REQUEST.REQUEST_QR_DISPLAY;
1453
1188
  payload: {
1454
1189
  device: DeviceInfo;
1455
1190
  data: QrDisplayData;
1456
- } & UiRequestOperationAttribution;
1191
+ };
1457
1192
  };
1458
1193
  [UI_REQUEST.REQUEST_QR_SCAN]: {
1459
1194
  type: typeof UI_REQUEST.REQUEST_QR_SCAN;
1460
1195
  payload: {
1461
1196
  device: DeviceInfo;
1462
- } & UiRequestOperationAttribution;
1197
+ };
1463
1198
  };
1464
1199
  [UI_REQUEST.REQUEST_DEVICE_PERMISSION]: {
1465
1200
  type: typeof UI_REQUEST.REQUEST_DEVICE_PERMISSION;
@@ -1467,11 +1202,13 @@ interface HardwareEventMap {
1467
1202
  transportType: TransportType;
1468
1203
  connectId?: string;
1469
1204
  deviceId?: string;
1470
- } & UiRequestOperationAttribution;
1205
+ };
1471
1206
  };
1472
1207
  [UI_REQUEST.REQUEST_SELECT_DEVICE]: {
1473
1208
  type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
1474
- payload: DeviceSelectionRequest;
1209
+ payload: {
1210
+ devices: DeviceInfo[];
1211
+ };
1475
1212
  };
1476
1213
  [UI_REQUEST.REQUEST_DEVICE_CONNECT]: {
1477
1214
  type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
@@ -1479,7 +1216,7 @@ interface HardwareEventMap {
1479
1216
  vendor: string;
1480
1217
  reason: string;
1481
1218
  message: string;
1482
- } & UiRequestOperationAttribution;
1219
+ };
1483
1220
  };
1484
1221
  [UI_REQUEST.REQUEST_BTC_HIGH_INDEX_CONFIRM]: {
1485
1222
  type: typeof UI_REQUEST.REQUEST_BTC_HIGH_INDEX_CONFIRM;
@@ -1487,14 +1224,14 @@ interface HardwareEventMap {
1487
1224
  vendor: string;
1488
1225
  path: string;
1489
1226
  accountIndex: number;
1490
- } & UiRequestOperationAttribution;
1227
+ };
1491
1228
  };
1492
1229
  [UI_REQUEST.REQUEST_INSTALL_APP]: {
1493
1230
  type: typeof UI_REQUEST.REQUEST_INSTALL_APP;
1494
1231
  payload: {
1495
1232
  vendor: string;
1496
1233
  appName: string;
1497
- } & UiRequestOperationAttribution;
1234
+ };
1498
1235
  };
1499
1236
  [UI_REQUEST.REQUEST_TREZOR_THP_PAIRING]: {
1500
1237
  type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
@@ -1503,11 +1240,11 @@ interface HardwareEventMap {
1503
1240
  availableMethods: number[];
1504
1241
  selectedMethod: number;
1505
1242
  nfcData?: string;
1506
- } & UiRequestOperationAttribution;
1243
+ };
1507
1244
  };
1508
1245
  [UI_REQUEST.CLOSE_UI_WINDOW]: {
1509
1246
  type: typeof UI_REQUEST.CLOSE_UI_WINDOW;
1510
- payload: UiRequestOperationAttribution;
1247
+ payload: Record<string, never>;
1511
1248
  };
1512
1249
  [SDK.DEVICE_INTERACTION]: {
1513
1250
  type: typeof SDK.DEVICE_INTERACTION;
@@ -1534,23 +1271,16 @@ interface HardwareEventMap {
1534
1271
  connectId: string;
1535
1272
  };
1536
1273
  };
1537
- [SDK.OPERATION_ENDED]: {
1538
- type: typeof SDK.OPERATION_ENDED;
1539
- payload: {
1540
- operationId: string;
1541
- reason: OperationEndReason;
1542
- };
1543
- };
1544
1274
  }
1545
1275
  interface IDeviceManagerMethods {
1546
- getFeatures?(connectId: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1547
- deviceSettings?(connectId: string, params: TrezorDeviceSettingsParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1548
- setBrightness?(connectId: string, params?: TrezorBrightnessParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1549
- changePin?(connectId: string, params?: TrezorChangePinParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1550
- 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>>>;
1551
1281
  authenticateDevice?(connectId: string, params: {
1552
1282
  challenge: string;
1553
- }, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1283
+ }): Promise<Response<Record<string, unknown>>>;
1554
1284
  }
1555
1285
  interface IWalletStateMethods {
1556
1286
  /**
@@ -1577,37 +1307,20 @@ interface IWalletStateMethods {
1577
1307
  * Optional: vendors without host-managed passphrase sessions (Ledger) omit
1578
1308
  * it. Implemented by `TrezorAdapter`.
1579
1309
  */
1580
- getPassphraseState?(connectId: string, passphraseState?: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<string | null>>;
1310
+ getPassphraseState?(connectId: string, passphraseState?: string): Promise<Response<string | null>>;
1581
1311
  }
1582
- /**
1583
- * `stops-waiting`: an on-device confirmation stays up until answered or timed out.
1584
- * `interrupts-device`: the command on the wire is withdrawn. No vendor reports it, so hosts
1585
- * should say "stopped waiting, answer on the device", not "cancelled".
1586
- */
1587
- type CancelCapability = 'interrupts-device' | 'stops-waiting';
1588
1312
  interface IHardwareWallet<TConfig = unknown> extends IEvmMethods, IBtcMethods, ISolMethods, ITronMethods, IDeviceManagerMethods, IWalletStateMethods {
1589
1313
  readonly vendor: string;
1590
1314
  readonly activeTransport: TransportType | null;
1591
- /** What `cancel()` reaches on this vendor. Declared, never inferred. */
1592
- readonly cancelCapability: CancelCapability;
1593
1315
  init(config: TConfig): Promise<void>;
1594
1316
  dispose(): Promise<void>;
1595
1317
  getAvailableTransports(): TransportType[];
1596
1318
  switchTransport(type: TransportType): Promise<void>;
1597
1319
  searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
1598
- /** Discover selectable hardware entries without claiming identified devices or wallets. */
1599
- searchDeviceTargets(options?: SearchDevicesOptions): Promise<DeviceSearchTarget[]>;
1600
- /** @deprecated Use searchDeviceTargets(). */
1601
- listConnectionTargets(options?: SearchDevicesOptions): Promise<ConnectionTarget[]>;
1602
- /** Connect or logically bind a selected search result and return a runtime-only operation id. */
1603
- connectDevice(searchTargetId: string): Promise<Response<string>>;
1604
- /** Device Manager rebind: verify the existing identity before replacing its BLE locator. */
1605
- bindBleDevice?(params: BindBleDeviceParams): Promise<Response<string>>;
1606
- /** Resolve and pin operation routing; the caller verifies wallet identity before business calls. */
1607
- acquireOperation?(connectId: string, context: IHardwareConnectionContext): Promise<Response<string>>;
1608
- /** Release a caller-owned operation. Disconnect events end matching operations automatically. */
1609
- releaseOperation(operationId: string): Promise<void>;
1320
+ connectDevice(connectId: string): Promise<Response<string>>;
1321
+ disconnectDevice(connectId: string): Promise<void>;
1610
1322
  getDeviceInfo(connectId: string, deviceId: string): Promise<Response<DeviceInfo>>;
1323
+ getSupportedChains(): ChainCapability[];
1611
1324
  /** Abort the in-flight call. Omit connectId to cancel whatever is active. */
1612
1325
  cancel(connectId?: string): void;
1613
1326
  allNetworkGetAddress(connectId: string, deviceId: string, params: AllNetworkGetAddressParams): Promise<Response<AllNetworkAddressResponse[]>>;
@@ -1644,11 +1357,6 @@ interface SearchDevicesOptions {
1644
1357
  * was discovered first.
1645
1358
  */
1646
1359
  waitForAllTransports?: boolean;
1647
- /**
1648
- * Restrict discovery to one transport. A virtual target (Keystone QR) must not start any wallet
1649
- * interaction during discovery; `connectDevice()` resolves it.
1650
- */
1651
- transportType?: ConnectionType;
1652
1360
  }
1653
1361
 
1654
1362
  interface EvmGetAddressParams extends PassphraseStateAware {
@@ -1772,11 +1480,6 @@ interface EvmSignTypedDataFull extends PassphraseStateAware {
1772
1480
  primaryType: string;
1773
1481
  message: Record<string, unknown>;
1774
1482
  };
1775
- /**
1776
- * The dApp's original EIP-712 JSON, byte for byte. Serializing vendors (Keystone) must prefer it:
1777
- * re-stringifying `data` rewrites integers wider than 2^53 and exponent forms.
1778
- */
1779
- dataJson?: string;
1780
1483
  metamaskV4Compat?: boolean;
1781
1484
  showMessageHash?: boolean;
1782
1485
  /**
@@ -1815,33 +1518,6 @@ interface IEvmMethods {
1815
1518
  evmSignTypedData(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignTypedDataParams>>): Promise<Response<EvmSignature>>;
1816
1519
  }
1817
1520
 
1818
- /** Which `GET_VK` encoding the Ledger Zcash app should return. */
1819
- type ZcashFullViewingKeyMode = 'ufvk' | 'orchardFvk';
1820
- interface ZcashGetFullViewingKeyParams extends PassphraseStateAware {
1821
- /** BIP44 account path `m/44'/133'/a'`; a deeper transparent path is accepted, only `a'` is used. */
1822
- path: string;
1823
- /** Default `ufvk`. */
1824
- mode?: ZcashFullViewingKeyMode;
1825
- }
1826
- interface ZcashFullViewingKey {
1827
- path: string;
1828
- mode: ZcashFullViewingKeyMode;
1829
- /** ZIP-316 bech32m UFVK string (mode `ufvk`). */
1830
- ufvk?: string;
1831
- /** 96-byte raw Orchard FVK as hex (mode `orchardFvk`). */
1832
- orchardFvk?: string;
1833
- }
1834
- interface ZcashGetShieldedAddressParams extends PassphraseStateAware {
1835
- /** Full 5-level transparent path `m/44'/133'/a'/0/i`; the Orchard path is derived from it. */
1836
- path: string;
1837
- showOnDevice?: boolean;
1838
- }
1839
- interface ZcashShieldedAddress {
1840
- /** Unified address with a single Orchard receiver. */
1841
- address: string;
1842
- path: string;
1843
- }
1844
-
1845
1521
  /**
1846
1522
  * Low-level device descriptor from Transport layer.
1847
1523
  * Represents a physical device detected by USB/BLE scanning.
@@ -1887,13 +1563,14 @@ interface DeviceDisconnectEvent {
1887
1563
  type DeviceChangeEvent = DeviceConnectEvent | DeviceDisconnectEvent;
1888
1564
 
1889
1565
  /**
1890
- * Serializes every device call and gives callers one handle to cancel them. Ordering is already
1891
- * guaranteed by awaiting callers, so what this adds is an AbortController per job, a busy check
1892
- * that rejects double-submits, and generation tracking so a job queued before a teardown doesn't
1893
- * start after it; these races exist even for a sequential caller because cleanup is async.
1894
- *
1895
- * Interrupt-or-ask policy belongs to the caller; `getActiveJob()` is synchronous so a UI handler
1896
- * 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.
1897
1574
  */
1898
1575
  interface JobOptions {
1899
1576
  label?: string;
@@ -1905,15 +1582,10 @@ interface ActiveJobInfo {
1905
1582
  label?: string;
1906
1583
  startedAt: number;
1907
1584
  }
1908
- interface CancelScopeHandle {
1909
- signal: AbortSignal;
1910
- release: () => void;
1911
- }
1912
1585
  declare class DeviceJobQueue {
1913
1586
  private _tail;
1914
1587
  private _active;
1915
1588
  private readonly _jobs;
1916
- private readonly _cancelScopes;
1917
1589
  /** Incremented on clear() so queued-but-not-yet-running jobs detect invalidation. */
1918
1590
  private _generation;
1919
1591
  private readonly _generationCancelReasons;
@@ -1922,57 +1594,21 @@ declare class DeviceJobQueue {
1922
1594
  * `deviceId` is a label only — used by inspection / cancellation routing.
1923
1595
  */
1924
1596
  enqueue<T>(deviceId: string, job: (signal: AbortSignal) => Promise<T>, options?: JobOptions): Promise<T>;
1925
- /**
1926
- * Holds a cancel across the gaps between a bundle's per-item jobs, when the queue is empty.
1927
- * Callers must `release()` when the bundle ends.
1928
- */
1929
- createCancelScope(deviceId: string): CancelScopeHandle;
1930
- /**
1931
- * Cancels the running job only; `reason` becomes signal.reason. Adapters use
1932
- * `cancelActiveAndPending`; this stays for a connector layer that stops only what is on the wire.
1933
- */
1934
- cancelActive(deviceId?: string, reason?: Error): boolean;
1935
- /**
1936
- * Cancels the active job and unstarted queued jobs; returns whether anything was reached. Only
1937
- * `undefined` means everything: an empty key matches nothing instead of tearing the queue down.
1938
- */
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. */
1939
1604
  cancelActiveAndPending(deviceId?: string, reason?: Error): boolean;
1940
1605
  /** Get info about the currently active job, or null if idle. */
1941
1606
  getActiveJob(deviceId?: string): ActiveJobInfo | null;
1607
+ /** True if any job is currently running. */
1608
+ isBusy(): boolean;
1942
1609
  clear(reason?: Error): void;
1943
1610
  }
1944
1611
 
1945
- declare const HARDWARE_RUNTIME_ID_PREFIX = "hwk:runtime";
1946
- /**
1947
- * `search-target`: one device in one discovery snapshot, dead on the next search of that kind.
1948
- * `link`: one open transport. `operation`: one business operation, outliving links via `rebind()`.
1949
- */
1950
- type HardwareRuntimeIdKind = 'operation' | 'search-target' | 'link';
1951
- type HardwareRuntimeId = {
1952
- kind: HardwareRuntimeIdKind;
1953
- vendor: VendorType;
1954
- };
1955
- /** Runtime ids are opaque and must never be persisted as device identity. */
1956
- declare function createHardwareOperationId(vendor: VendorType): string;
1957
- /** Search targets are valid only for the adapter's current discovery snapshot. */
1958
- declare function createHardwareSearchTargetId(vendor: VendorType): string;
1959
- declare function createHardwareLinkId(vendor: VendorType): string;
1960
- declare function hasHardwareRuntimeIdPrefix(value: unknown): value is string;
1961
- declare function parseHardwareRuntimeId(value: unknown): HardwareRuntimeId | undefined;
1962
- declare function isHardwareOperationId(value: unknown): value is string;
1963
-
1964
- interface HardwareOperationTarget {
1965
- /** Effective target accepted by existing adapter/connector call paths. */
1966
- targetId: string | undefined;
1967
- /** Present when this operation is pinned to a live operation. */
1968
- operationId: string | undefined;
1969
- }
1970
- /**
1971
- * Normalizes the transitional positional operation id and the canonical
1972
- * common-params field. All vendors must reject conflicting bindings.
1973
- */
1974
- declare function resolveHardwareOperationTarget(positionalTargetId: string | null | undefined, commonOperationId: string | null | undefined, expectedVendor?: VendorType): Response<HardwareOperationTarget>;
1975
-
1976
1612
  /**
1977
1613
  * Minimal typed event emitter using Map<string, Set<listener>>.
1978
1614
  * Each adapter uses this for device events (connect, disconnect, pin, etc.).
@@ -1999,101 +1635,6 @@ declare class TypedEventEmitter<TMap extends Record<string, any> = Record<string
1999
1635
  listenerCount(event: string): number;
2000
1636
  }
2001
1637
 
2002
- /** Serializable BLE transport data shared by Electron main and renderer runtimes. */
2003
- interface ElectronBleDeviceInfo {
2004
- id: string;
2005
- name?: string;
2006
- rssi?: number;
2007
- advertisedServiceUuids?: string[];
2008
- }
2009
- /**
2010
- * IPC-safe peripheral match: advertises one of `serviceUuids`, or its local name matches every
2011
- * `namePatterns` entry (case-insensitive regex sources).
2012
- */
2013
- interface ElectronBleMatch {
2014
- serviceUuids?: string[];
2015
- namePatterns?: string[];
2016
- }
2017
- interface ElectronBleScanOptions {
2018
- /** Opaque partition key: results and connected devices never mix across it. */
2019
- vendor?: string;
2020
- match?: ElectronBleMatch;
2021
- /** @deprecated Superseded by `match.serviceUuids`. */
2022
- serviceUuids?: string[];
2023
- durationMs?: number;
2024
- }
2025
- /** GATT profile plus the write framing this vendor's firmware expects. */
2026
- interface ElectronBleConnectOptions {
2027
- vendor: string;
2028
- serviceUuid: string;
2029
- writeUuid: string;
2030
- notifyUuid: string;
2031
- /**
2032
- * `padded`: fixed `chunkSize` packets, last zero-filled (Trezor firmware drops short packets).
2033
- * `raw`: the buffer as given, for self-length-framed protocols (Ledger).
2034
- */
2035
- write?: {
2036
- mode: 'padded' | 'raw';
2037
- chunkSize?: number;
2038
- chunkDelayMs?: number;
2039
- maxLength?: number;
2040
- };
2041
- }
2042
- /** Native code handles GATT only; framing, identity checks and wallet calls stay in the SDK. */
2043
- interface ElectronBleApi {
2044
- scan(options?: ElectronBleScanOptions): Promise<ElectronBleDeviceInfo[]>;
2045
- stopScan(vendor?: string): Promise<void>;
2046
- connect(id: string, options?: ElectronBleConnectOptions): Promise<{
2047
- id: string;
2048
- name?: string;
2049
- }>;
2050
- disconnect(id: string): Promise<void>;
2051
- subscribe(id: string): Promise<void>;
2052
- unsubscribe(id: string): Promise<void>;
2053
- write(id: string, hexData: string): Promise<void>;
2054
- checkAvailability(): Promise<{
2055
- available: boolean;
2056
- state: string;
2057
- initialized: boolean;
2058
- }>;
2059
- getDevice(id: string): Promise<ElectronBleDeviceInfo | null>;
2060
- onNotification(handler: (id: string, hexData: string) => void): () => void;
2061
- onDeviceDisconnected(handler: (id: string) => void): () => void;
2062
- /** Abandon an in-flight connect in the main process. Optional for hosts that cannot cancel. */
2063
- cancelPairing?(options?: {
2064
- vendor: string;
2065
- id?: string;
2066
- }): Promise<void>;
2067
- }
2068
-
2069
- /**
2070
- * A host refusal is reported, never thrown: wallet identity is already verified, so a lost binding
2071
- * is worth a warning and a retry, not failing the user's work.
2072
- */
2073
- type SaveDeviceBindingOutcome = {
2074
- saved: true;
2075
- } | {
2076
- saved: false;
2077
- reason: SaveDeviceBindingDeclineReason;
2078
- };
2079
- /** Persist a verified binding through the host. Only a user abort throws. */
2080
- declare function requestSaveDeviceBinding(emitter: TypedEventEmitter<HardwareEventMap>, registry: UiRequestRegistry, binding: Omit<SaveDeviceBindingRequest, 'requestId'>, signal?: AbortSignal): Promise<SaveDeviceBindingOutcome>;
2081
-
2082
- /** Discovery and selection share one owner; never connect until the last scan has drained. */
2083
- declare function requestBleDeviceSelection({ emitter, registry, request, scan, signal, allowUsbFallback, pollIntervalMs, }: {
2084
- emitter: TypedEventEmitter<HardwareEventMap>;
2085
- registry: UiRequestRegistry;
2086
- request: Omit<DeviceSelectionRequest, 'requestId' | 'scanning'>;
2087
- scan: () => Promise<DeviceInfo[]>;
2088
- signal: AbortSignal;
2089
- /** The adapter must verify a returned USB candidate before dispatching any business call. */
2090
- allowUsbFallback?: boolean;
2091
- pollIntervalMs?: number;
2092
- }): Promise<{
2093
- device: DeviceInfo;
2094
- requestId: string;
2095
- }>;
2096
-
2097
1638
  /**
2098
1639
  * Compare two semver strings (e.g. "2.1.0" vs "2.3.1").
2099
1640
  * Returns -1 if a < b, 0 if equal, 1 if a > b.
@@ -2114,18 +1655,7 @@ declare function hexToBytes(hex: string): Uint8Array;
2114
1655
  /** Convert a Uint8Array to a hex string (no 0x prefix). */
2115
1656
  declare function bytesToHex(bytes: Uint8Array): string;
2116
1657
 
2117
- interface PrepareSolanaOffchainMessageV1Params {
2118
- message: Uint8Array;
2119
- requiredSigners: readonly string[];
2120
- }
2121
- interface PreparedSolanaOffchainMessageV1 {
2122
- messageText: string;
2123
- requiredSigners: string[];
2124
- serializedMessage: Uint8Array;
2125
- }
2126
- declare function prepareSolanaOffchainMessageV1({ message, requiredSigners, }: PrepareSolanaOffchainMessageV1Params): PreparedSolanaOffchainMessageV1;
2127
-
2128
- type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger' | 'keystone';
1658
+ type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger';
2129
1659
  type HardwareDeviceIdentityInput = {
2130
1660
  name?: string | null;
2131
1661
  localName?: string | null;
@@ -2188,12 +1718,8 @@ type RunAllNetworkGetAddressOptions = {
2188
1718
  buildTopLevelFailure?: (response: AllNetworkAddressResponse, context: AllNetworkResponseContext) => Response<AllNetworkAddressResponse[]>;
2189
1719
  };
2190
1720
  declare function runAllNetworkGetAddress({ connectId, deviceId, params, getMethodChain, normalizeItem, buildUnsupportedNetworkResponse, callItem, attachIdentity, shouldAbortBundle, buildTopLevelFailure, }: RunAllNetworkGetAddressOptions): Promise<Response<AllNetworkAddressResponse[]>>;
2191
- /** An SDK-dialog cancel or on-device reject ends the bundle; the user already answered "no". */
2192
- declare function isUserRefusal(code: HardwareErrorCode | number | undefined): boolean;
2193
- /** The bundle's session is gone, so the remaining items have nothing to run against. */
2194
- declare function isConnectionLost(code: HardwareErrorCode | number | undefined): boolean;
2195
1721
  declare function buildUnsupportedMethodResponse(item: AllNetworkAddressParams): AllNetworkAddressResponse;
2196
1722
 
2197
1723
  declare const DEVICE_CONNECT_RETRY_DELAY_MS = 1000;
2198
1724
 
2199
- 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 };