@onekeyfe/hwk-adapter-core 1.2.3-alpha.4 → 1.2.3-alpha.6

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-S7X2HM7P.js → chunk-BAGEFFFY.js} +3 -32
  2. package/dist/chunk-BAGEFFFY.js.map +1 -0
  3. package/dist/{chunk-Z3IH25KV.js → chunk-SZZF623R.js} +55 -146
  4. package/dist/chunk-SZZF623R.js.map +1 -0
  5. package/dist/{chunk-ELC6PLKH.mjs → chunk-U63HTLGJ.mjs} +2 -31
  6. package/dist/chunk-U63HTLGJ.mjs.map +1 -0
  7. package/dist/{chunk-E3UPXUN5.mjs → chunk-YA4BWFTZ.mjs} +55 -146
  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 +74 -561
  15. package/dist/index.d.ts +74 -561
  16. package/dist/index.js +80 -645
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +71 -636
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/{ui-events-CbZdnS8a.d.ts → ui-events-Cb7haAeE.d.mts} +3 -28
  21. package/dist/{ui-events-CbZdnS8a.d.mts → ui-events-Cb7haAeE.d.ts} +3 -28
  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-3M3GMF64.mjs +0 -68
  29. package/dist/chunk-3M3GMF64.mjs.map +0 -1
  30. package/dist/chunk-7SFFS2NL.js +0 -68
  31. package/dist/chunk-7SFFS2NL.js.map +0 -1
  32. package/dist/chunk-E3UPXUN5.mjs.map +0 -1
  33. package/dist/chunk-ELC6PLKH.mjs.map +0 -1
  34. package/dist/chunk-S7X2HM7P.js.map +0 -1
  35. package/dist/chunk-Z3IH25KV.js.map +0 -1
  36. package/dist/errors-C5GWtyVN.d.mts +0 -304
  37. package/dist/errors-C5GWtyVN.d.ts +0 -304
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-C5GWtyVN.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-C5GWtyVN.mjs';
3
- import { U as UiResponseEvent, a as UI_REQUEST, Q as QrDisplayData, b as UiRequestRegistry, S as SaveDeviceBindingDeclineReason } from './ui-events-CbZdnS8a.mjs';
4
- export { D as DevicePermissionDeniedReason, c as DevicePermissionResponse, d as QrResponseData, e as UI_EVENT, f as UI_REQUEST_CANCELLED_TAG, g as UI_REQUEST_DEFAULT_TIMEOUT_MS, h as UI_REQUEST_PREEMPTED_TAG, i as UI_REQUEST_TIMEOUT_TAG, j as UI_RESPONSE } from './ui-events-CbZdnS8a.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,57 +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
- * Stable 256-bit wallet identity derived from canonical public wallet
53
- * material. The domain separator prevents the same input from being confused
54
- * with hashes used by other SDK features.
55
- *
56
- * Callers must provide one fixed, vendor-defined identity source. Do not hash
57
- * a variable subset of exported accounts: the same wallet would then receive
58
- * different ids depending on which accounts happened to be returned.
59
- */
60
- declare function deriveWalletId(canonicalPublicMaterial: string): string;
61
-
62
- type VendorType = 'trezor' | 'ledger' | 'keystone';
63
- /** 'qr' is a virtual channel: UR payloads travel via app-rendered/scanned QR codes. */
64
- type ConnectionType = 'usb' | 'ble' | 'qr';
65
- type TransportType = 'usb' | 'ble' | 'hid' | 'bridge' | 'qr';
22
+ type VendorType = 'trezor' | 'ledger';
23
+ type ConnectionType = 'usb' | 'ble';
24
+ type TransportType = 'usb' | 'ble' | 'hid' | 'bridge';
66
25
  /**
67
26
  * Device capabilities — describes what a specific device/connection
68
27
  * combination can or cannot do. Varies by vendor, model, and connection type.
@@ -114,56 +73,6 @@ interface DeviceTarget {
114
73
  connectId: string;
115
74
  deviceId: string;
116
75
  }
117
- /**
118
- * How long a discovery handle remains safe to use for a new connection.
119
- * This is deliberately separate from post-connect device identity.
120
- */
121
- type SearchTargetReusePolicy = 'current-discovery' | 'reconnectable' | 'rediscover';
122
- declare function resolveSearchTargetReusePolicy(device: Pick<DeviceInfo, 'connectionType' | 'capabilities'>): SearchTargetReusePolicy;
123
- /**
124
- * A selectable result from hardware discovery. It may represent a physical
125
- * transport endpoint or an interactive entry such as Keystone QR; it is not a
126
- * physical-device or wallet identity.
127
- */
128
- interface DeviceSearchTarget {
129
- /** Opaque handle scoped to the adapter's current discovery state. */
130
- searchTargetId: string;
131
- /**
132
- * Whether the handle itself may be retried. This says nothing about the
133
- * identity learned after connect and must not be inferred from a stored
134
- * connectId.
135
- */
136
- searchTargetReusePolicy?: SearchTargetReusePolicy;
137
- vendor: VendorType;
138
- connectionType: ConnectionType;
139
- kind: 'physical' | 'interactive';
140
- label?: string;
141
- model?: string;
142
- modelName?: string;
143
- serialNumber?: string;
144
- }
145
- /**
146
- * @deprecated Use DeviceSearchTarget. Kept for consumers of the pre-release
147
- * connection-target API.
148
- */
149
- type ConnectionTarget = Omit<DeviceSearchTarget, 'searchTargetId'> & {
150
- targetId: string;
151
- searchTargetId?: string;
152
- };
153
- type WalletIdentity = {
154
- vendor: 'ledger';
155
- type: 'chainFingerprint';
156
- chain: ChainForFingerprint;
157
- value: string;
158
- } | {
159
- vendor: 'trezor';
160
- type: 'deviceId';
161
- value: string;
162
- } | {
163
- vendor: 'keystone';
164
- type: 'walletId';
165
- value: string;
166
- };
167
76
 
168
77
  /**
169
78
  * Mixin for chain-operation params that can be pinned to a specific passphrase
@@ -224,15 +133,6 @@ interface ConnectorSession {
224
133
  sessionId: string;
225
134
  deviceInfo: DeviceInfo;
226
135
  }
227
- type ConnectorConnectTarget = {
228
- type: 'default';
229
- } | {
230
- type: 'search-target';
231
- searchTargetId: string;
232
- } | {
233
- type: 'expected-device-identity';
234
- deviceIdentity: string;
235
- };
236
136
  /**
237
137
  * Vendor-agnostic bag of extra error fields. Known keys are documented for
238
138
  * discoverability; the index signature keeps it open so any connector can
@@ -353,16 +253,12 @@ interface ConnectorEventMap {
353
253
  'ui-event': ConnectorUiEvent;
354
254
  }
355
255
  interface ConnectorSearchDevicesOptions {
356
- /** Select a child transport without waking/scanning the others. */
357
- transportType?: ConnectionType;
358
256
  /**
359
257
  * Wait for every child transport in a fused connector. Default discovery can
360
258
  * return shortly after USB appears so BLE does not slow down USB flows;
361
259
  * binding pickers can opt in when they need BLE candidates too.
362
260
  */
363
261
  waitForAll?: boolean;
364
- /** Availability probes must not invalidate user-selectable discovery targets. */
365
- purpose?: 'selection' | 'availability';
366
262
  }
367
263
  interface ConnectorConfig {
368
264
  /**
@@ -377,17 +273,8 @@ interface ConnectorConfig {
377
273
  interface IConnector {
378
274
  /** Physical connection type this connector uses. Fixed at construction. */
379
275
  readonly connectionType: ConnectionType;
380
- readonly availableTransports?: readonly ConnectionType[];
381
276
  searchDevices(options?: ConnectorSearchDevicesOptions): Promise<ConnectorDevice[]>;
382
- connect(deviceId?: string, options?: {
383
- transportType: ConnectionType;
384
- }): Promise<ConnectorSession>;
385
- /**
386
- * Structured form for connectors where a discovery handle and a stable
387
- * device identity are different concepts. The string form remains for
388
- * bridge and legacy compatibility.
389
- */
390
- connectTarget?(target: ConnectorConnectTarget): Promise<ConnectorSession>;
277
+ connect(deviceId?: string): Promise<ConnectorSession>;
391
278
  disconnect(sessionId: string): Promise<void>;
392
279
  call(sessionId: string, method: string, params: unknown): Promise<ConnectorCallResult>;
393
280
  cancel(sessionId: string): Promise<void>;
@@ -412,9 +299,6 @@ interface IHardwareBridge {
412
299
  connect(params: {
413
300
  vendor: VendorType;
414
301
  deviceId?: string;
415
- options?: {
416
- transportType: ConnectionType;
417
- };
418
302
  }): Promise<ConnectorSession>;
419
303
  disconnect(params: {
420
304
  vendor: VendorType;
@@ -697,21 +581,11 @@ interface SolSignedTx {
697
581
  /** Hex-encoded Ed25519 signature (no 0x prefix) */
698
582
  signature: string;
699
583
  }
700
- interface SolSignMessageBaseParams extends PassphraseStateAware {
584
+ interface SolSignMsgParams extends PassphraseStateAware {
701
585
  path: string;
702
586
  /** Message bytes as hex string (no 0x prefix) */
703
587
  message: string;
704
588
  }
705
- interface SolOffchainMessageV1Params {
706
- /** Finalized Solana off-chain message format. */
707
- messageVersion: 1;
708
- /** Complete signer set as 32-byte hex public keys. */
709
- requiredSigners: string[];
710
- }
711
- type SolSignMsgParams = SolSignMessageBaseParams & ({
712
- messageVersion?: undefined;
713
- requiredSigners?: undefined;
714
- } | SolOffchainMessageV1Params);
715
589
  interface SolSignature {
716
590
  /** Hex-encoded Ed25519 signature (no 0x prefix) */
717
591
  signature: string;
@@ -838,12 +712,6 @@ interface TronSignMsgParams extends PassphraseStateAware {
838
712
  path: string;
839
713
  /** Message hex (no 0x prefix) */
840
714
  messageHex: string;
841
- /**
842
- * TRON message scheme: 'V1' = legacy signMessage (prefix + 32-byte hash),
843
- * 'V2' = TIP-191 signMessageV2 (prefix + byte length + message). Adapters
844
- * that only implement one scheme reject the other with MethodNotSupported.
845
- */
846
- messageType?: 'V1' | 'V2';
847
715
  }
848
716
  interface TronSignature {
849
717
  /** 65-byte hex-encoded signature (no 0x prefix) */
@@ -855,159 +723,100 @@ interface ITronMethods {
855
723
  tronSignMessage(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<TronSignMsgParams>>): Promise<Response<TronSignature>>;
856
724
  }
857
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
+
858
744
  /** Events generated by SDK internal detection (not from hardware directly). */
859
745
  declare const SDK: {
860
746
  readonly DEVICE_STUCK: "device-stuck";
861
747
  readonly DEVICE_UNRESPONSIVE: "device-unresponsive";
862
748
  readonly DEVICE_RECOVERED: "device-recovered";
863
749
  readonly DEVICE_INTERACTION: "device-interaction";
864
- readonly OPERATION_ENDED: "operation-ended";
865
- };
866
-
867
- declare const OPERATION_DEFAULT_TTL_MS = 600000;
868
- type OperationEndReason = 'explicit' | 'disconnect' | 'timeout' | 'runtime-reset';
869
- type HardwareOperation = {
870
- operationId: string;
871
- connectId: string;
872
- device: DeviceInfo;
873
- connectionKeys: string[];
874
- createdAt: number;
875
- lastActiveAt: number;
876
- };
877
- type OperationRegistryOptions = {
878
- vendor: VendorType;
879
- ttlMs?: number;
880
- onEnded?: (operation: HardwareOperation, reason: OperationEndReason) => void;
881
750
  };
882
- /** Runtime-only association between a public operation id and one live target. */
883
- declare class OperationRegistry {
884
- private readonly _vendor;
885
- private readonly _ttlMs;
886
- private readonly _onEnded?;
887
- private readonly _active;
888
- private readonly _ended;
889
- constructor(options: OperationRegistryOptions);
890
- create(params: {
891
- searchTargetId: string;
892
- connectId: string;
893
- device: DeviceInfo;
894
- connectionKeys?: string[];
895
- }): HardwareOperation;
896
- resolve(operationId: string): HardwareOperation;
897
- /** Keep an operation alive while one device job is actively using it. */
898
- retain(operationId: string): () => void;
899
- /** Return active or tombstoned binding data without refreshing its TTL. */
900
- find(operationId: string): HardwareOperation | undefined;
901
- findActiveByConnectionKey(connectionKey: string): HardwareOperation | undefined;
902
- /** Replace the live transport binding after the same target was reconnected. */
903
- rebind(operationId: string, params: {
904
- connectId: string;
905
- device: DeviceInfo;
906
- connectionKeys?: string[];
907
- }): HardwareOperation;
908
- end(operationId: string, reason: OperationEndReason): HardwareOperation | undefined;
909
- endByConnectionKey(connectionKey: string, reason: OperationEndReason, exceptOperationId?: string): void;
910
- endAll(reason: OperationEndReason, exceptOperationId?: string): void;
911
- private _createTimer;
912
- private _rememberEnded;
913
- }
914
751
 
915
752
  type HardwareMethodMetadata = {
916
753
  chain: ChainForFingerprint;
917
754
  allNetwork: boolean;
918
- /** Whether repeating the method after an ambiguous transport failure is safe. */
919
- replayAfterTransportFailure: 'safe' | 'unsafe';
920
755
  };
921
756
  declare const HARDWARE_METHOD_CATALOG: {
922
757
  readonly evmGetAddress: {
923
758
  readonly chain: "evm";
924
759
  readonly allNetwork: true;
925
- readonly replayAfterTransportFailure: "safe";
926
760
  };
927
761
  readonly evmSignTransaction: {
928
762
  readonly chain: "evm";
929
763
  readonly allNetwork: false;
930
- readonly replayAfterTransportFailure: "unsafe";
931
764
  };
932
765
  readonly evmSignMessage: {
933
766
  readonly chain: "evm";
934
767
  readonly allNetwork: false;
935
- readonly replayAfterTransportFailure: "unsafe";
936
768
  };
937
769
  readonly evmSignTypedData: {
938
770
  readonly chain: "evm";
939
771
  readonly allNetwork: false;
940
- readonly replayAfterTransportFailure: "unsafe";
941
772
  };
942
773
  readonly btcGetAddress: {
943
774
  readonly chain: "btc";
944
775
  readonly allNetwork: true;
945
- readonly replayAfterTransportFailure: "safe";
946
776
  };
947
777
  readonly btcGetPublicKey: {
948
778
  readonly chain: "btc";
949
779
  readonly allNetwork: true;
950
- readonly replayAfterTransportFailure: "safe";
951
780
  };
952
781
  readonly btcSignTransaction: {
953
782
  readonly chain: "btc";
954
783
  readonly allNetwork: false;
955
- readonly replayAfterTransportFailure: "unsafe";
956
784
  };
957
785
  readonly btcSignPsbt: {
958
786
  readonly chain: "btc";
959
787
  readonly allNetwork: false;
960
- readonly replayAfterTransportFailure: "unsafe";
961
788
  };
962
789
  readonly btcSignMessage: {
963
790
  readonly chain: "btc";
964
791
  readonly allNetwork: false;
965
- readonly replayAfterTransportFailure: "unsafe";
966
792
  };
967
793
  readonly btcGetMasterFingerprint: {
968
794
  readonly chain: "btc";
969
795
  readonly allNetwork: false;
970
- readonly replayAfterTransportFailure: "safe";
971
796
  };
972
797
  readonly solGetAddress: {
973
798
  readonly chain: "sol";
974
799
  readonly allNetwork: true;
975
- readonly replayAfterTransportFailure: "safe";
976
800
  };
977
801
  readonly solSignTransaction: {
978
802
  readonly chain: "sol";
979
803
  readonly allNetwork: false;
980
- readonly replayAfterTransportFailure: "unsafe";
981
804
  };
982
805
  readonly solSignMessage: {
983
806
  readonly chain: "sol";
984
807
  readonly allNetwork: false;
985
- readonly replayAfterTransportFailure: "unsafe";
986
808
  };
987
809
  readonly tronGetAddress: {
988
810
  readonly chain: "tron";
989
811
  readonly allNetwork: true;
990
- readonly replayAfterTransportFailure: "safe";
991
812
  };
992
813
  readonly tronSignTransaction: {
993
814
  readonly chain: "tron";
994
815
  readonly allNetwork: false;
995
- readonly replayAfterTransportFailure: "unsafe";
996
816
  };
997
817
  readonly tronSignMessage: {
998
818
  readonly chain: "tron";
999
819
  readonly allNetwork: false;
1000
- readonly replayAfterTransportFailure: "unsafe";
1001
- };
1002
- readonly zcashGetFullViewingKey: {
1003
- readonly chain: "zcash";
1004
- readonly allNetwork: false;
1005
- readonly replayAfterTransportFailure: "safe";
1006
- };
1007
- readonly zcashGetShieldedAddress: {
1008
- readonly chain: "zcash";
1009
- readonly allNetwork: false;
1010
- readonly replayAfterTransportFailure: "safe";
1011
820
  };
1012
821
  };
1013
822
  type HardwareMethodName = keyof typeof HARDWARE_METHOD_CATALOG;
@@ -1016,11 +825,6 @@ type AllNetworkMethodName = {
1016
825
  }[HardwareMethodName];
1017
826
  declare const ALL_NETWORK_METHOD_NAMES: AllNetworkMethodName[];
1018
827
  declare function getHardwareMethodMetadata(method: string): HardwareMethodMetadata | undefined;
1019
- /**
1020
- * Conservative replay gate used only after a call may have reached hardware.
1021
- * Unknown methods and device mutations are unsafe by default.
1022
- */
1023
- declare function canReplayHardwareMethodAfterTransportFailure(method: string): boolean;
1024
828
  declare function isAllNetworkMethodName(method: string): method is AllNetworkMethodName;
1025
829
  declare function getAllNetworkMethodChain(method: AllNetworkMethodName): ChainForFingerprint;
1026
830
 
@@ -1039,7 +843,7 @@ type HardwareUiEvent = Exclude<ConnectorUiEvent, {
1039
843
  progress: number;
1040
844
  };
1041
845
  };
1042
- type ChainCapability = 'evm' | 'btc' | 'sol' | 'tron' | 'zcash';
846
+ type ChainCapability = 'evm' | 'btc' | 'sol' | 'tron';
1043
847
  type TrezorDisplayRotation = 'North' | 'East' | 'South' | 'West';
1044
848
  type TrezorSafetyCheckLevel = 'Strict' | 'PromptAlways' | 'PromptTemporarily';
1045
849
  type TrezorDeviceSettingsParams = {
@@ -1116,68 +920,13 @@ type DeviceAuthenticityResult = {
1116
920
  * that aren't specific to one chain. Vendor-specific options can be added
1117
921
  * as typed sub-fields here when a vendor actually needs them.
1118
922
  */
1119
- /** Persisted connection hints, never proof of device or wallet identity. */
1120
- type KnownDeviceConnection = {
1121
- transport: 'usb' | 'ble';
1122
- connectId: string;
1123
- } | {
1124
- transport: 'qr';
1125
- };
1126
- /** Opaque host lookup identifiers. Never forward these to firmware or logs. */
1127
- type HardwareCallExtra = Readonly<Record<string, string>>;
1128
- interface IHardwareConnectionContext {
1129
- knownConnections?: readonly KnownDeviceConnection[];
1130
- extra?: HardwareCallExtra;
1131
- /** False makes discovery fail instead of asking the user to select a new endpoint. */
1132
- allowDeviceSelection?: boolean;
1133
- }
1134
- type DeviceSelectionContext = {
1135
- kind: 'select-device';
1136
- transport: 'usb';
1137
- reason: 'multiple-candidates';
1138
- } | {
1139
- kind: 'bind-connection';
1140
- transport: 'ble';
1141
- reason: 'missing-binding' | 'known-connection-unavailable' | 'manual-rebind';
1142
- };
1143
- interface DeviceSelectionRequest {
1144
- devices: DeviceInfo[];
1145
- requestId: string;
1146
- context: DeviceSelectionContext;
1147
- extra?: HardwareCallExtra;
1148
- /** Repeated snapshots with this requestId update one SDK-owned binding scan. */
1149
- scanning?: boolean;
1150
- bindingSessionId?: string;
1151
- /** A candidate rejected by SDK identity verification in this binding session. */
1152
- rejectedConnectId?: string;
1153
- }
1154
- /** The SDK has verified this endpoint; the host must persist it before acknowledging. */
1155
- interface SaveDeviceBindingRequest {
1156
- requestId: string;
1157
- selectionRequestId: string;
1158
- connection: {
1159
- transport: 'ble';
1160
- connectId: string;
1161
- };
1162
- identity: Extract<WalletIdentity, {
1163
- vendor: 'ledger' | 'trezor';
1164
- }>;
1165
- extra?: HardwareCallExtra;
1166
- }
1167
- type BindBleDeviceParams = Pick<SaveDeviceBindingRequest, 'identity' | 'extra'>;
1168
- interface DeviceBindingStatus {
1169
- selectionRequestId: string;
1170
- status: 'verifying' | 'saved' | 'failed' | 'cancelled';
1171
- }
1172
- interface ICommonCallParams extends IHardwareConnectionContext {
923
+ interface ICommonCallParams {
1173
924
  /**
1174
925
  * When the required device app is missing, prompt the user (UI request)
1175
926
  * to install it, stream install progress, then retry the operation once.
1176
927
  * Off by default — preserves the plain "app not installed" failure.
1177
928
  */
1178
929
  autoInstallApp?: boolean;
1179
- /** Runtime-only id returned by connectDevice(). When present, discovery and fallback are disabled. */
1180
- operationId?: string;
1181
930
  }
1182
931
  type NullableCallArg<T> = T | null | undefined;
1183
932
  interface IPassphraseCallParams {
@@ -1186,15 +935,6 @@ interface IPassphraseCallParams {
1186
935
  }
1187
936
  type IHardwareCommonCallParams = ICommonCallParams & IPassphraseCallParams;
1188
937
  type IHardwareCallParams<T> = T & IHardwareCommonCallParams;
1189
- /**
1190
- * Runtime-only context for device-manager operations. The expected identity
1191
- * lets an adapter fail closed before a read or mutation is replayed after a
1192
- * reconnect. It must never be forwarded to vendor firmware.
1193
- */
1194
- interface IDeviceManagerOperationContext extends IHardwareConnectionContext {
1195
- operationId?: string;
1196
- expectedDeviceIdentity?: WalletIdentity;
1197
- }
1198
938
  interface AllNetworkAddressParams {
1199
939
  network: string;
1200
940
  path: string;
@@ -1205,7 +945,16 @@ interface AllNetworkAddressParams {
1205
945
  interface AllNetworkGetAddressParams extends IHardwareCommonCallParams {
1206
946
  bundle: AllNetworkAddressParams[];
1207
947
  }
1208
- 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
+ };
1209
958
  type AllNetworkAddressResponsePayload = Record<string, unknown> & {
1210
959
  error?: string;
1211
960
  code?: HardwareErrorCode | number;
@@ -1213,7 +962,6 @@ type AllNetworkAddressResponsePayload = Record<string, unknown> & {
1213
962
  connectId?: string;
1214
963
  deviceId?: string;
1215
964
  deviceIdentity?: AllNetworkDeviceIdentity;
1216
- rootFingerprint?: number;
1217
965
  chainFingerprint?: string;
1218
966
  chainFingerprintChain?: ChainForFingerprint;
1219
967
  params?: Record<string, unknown>;
@@ -1299,13 +1047,9 @@ type UiRequestEvent = {
1299
1047
  };
1300
1048
  } | {
1301
1049
  type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
1302
- payload: DeviceSelectionRequest;
1303
- } | {
1304
- type: typeof UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
1305
- payload: SaveDeviceBindingRequest;
1306
- } | {
1307
- type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
1308
- payload: DeviceBindingStatus;
1050
+ payload: {
1051
+ devices: DeviceInfo[];
1052
+ };
1309
1053
  } | {
1310
1054
  type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
1311
1055
  payload: {
@@ -1365,12 +1109,6 @@ type SdkEvent = {
1365
1109
  payload: {
1366
1110
  connectId: string;
1367
1111
  };
1368
- } | {
1369
- type: typeof SDK.OPERATION_ENDED;
1370
- payload: {
1371
- operationId: string;
1372
- reason: OperationEndReason;
1373
- };
1374
1112
  };
1375
1113
  type HardwareEvent = DeviceEvent | UiRequestEvent | SdkEvent | HardwareUiEvent;
1376
1114
  type DeviceEventListener = (event: HardwareEvent) => void;
@@ -1381,14 +1119,6 @@ type DeviceEventListener = (event: HardwareEvent) => void;
1381
1119
  * and the value is the narrowed event object the listener will receive.
1382
1120
  */
1383
1121
  interface HardwareEventMap {
1384
- [UI_REQUEST.DEVICE_BINDING_STATUS]: {
1385
- type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
1386
- payload: DeviceBindingStatus;
1387
- };
1388
- [UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING]: {
1389
- type: typeof UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
1390
- payload: SaveDeviceBindingRequest;
1391
- };
1392
1122
  'ui-event': HardwareUiEvent;
1393
1123
  [DEVICE.CONNECT]: {
1394
1124
  type: typeof DEVICE.CONNECT;
@@ -1476,7 +1206,9 @@ interface HardwareEventMap {
1476
1206
  };
1477
1207
  [UI_REQUEST.REQUEST_SELECT_DEVICE]: {
1478
1208
  type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
1479
- payload: DeviceSelectionRequest;
1209
+ payload: {
1210
+ devices: DeviceInfo[];
1211
+ };
1480
1212
  };
1481
1213
  [UI_REQUEST.REQUEST_DEVICE_CONNECT]: {
1482
1214
  type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
@@ -1539,23 +1271,16 @@ interface HardwareEventMap {
1539
1271
  connectId: string;
1540
1272
  };
1541
1273
  };
1542
- [SDK.OPERATION_ENDED]: {
1543
- type: typeof SDK.OPERATION_ENDED;
1544
- payload: {
1545
- operationId: string;
1546
- reason: OperationEndReason;
1547
- };
1548
- };
1549
1274
  }
1550
1275
  interface IDeviceManagerMethods {
1551
- getFeatures?(connectId: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1552
- deviceSettings?(connectId: string, params: TrezorDeviceSettingsParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1553
- setBrightness?(connectId: string, params?: TrezorBrightnessParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1554
- changePin?(connectId: string, params?: TrezorChangePinParams, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1555
- 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>>>;
1556
1281
  authenticateDevice?(connectId: string, params: {
1557
1282
  challenge: string;
1558
- }, operationContext?: IDeviceManagerOperationContext): Promise<Response<Record<string, unknown>>>;
1283
+ }): Promise<Response<Record<string, unknown>>>;
1559
1284
  }
1560
1285
  interface IWalletStateMethods {
1561
1286
  /**
@@ -1582,7 +1307,7 @@ interface IWalletStateMethods {
1582
1307
  * Optional: vendors without host-managed passphrase sessions (Ledger) omit
1583
1308
  * it. Implemented by `TrezorAdapter`.
1584
1309
  */
1585
- getPassphraseState?(connectId: string, passphraseState?: string, operationContext?: IDeviceManagerOperationContext): Promise<Response<string | null>>;
1310
+ getPassphraseState?(connectId: string, passphraseState?: string): Promise<Response<string | null>>;
1586
1311
  }
1587
1312
  interface IHardwareWallet<TConfig = unknown> extends IEvmMethods, IBtcMethods, ISolMethods, ITronMethods, IDeviceManagerMethods, IWalletStateMethods {
1588
1313
  readonly vendor: string;
@@ -1592,19 +1317,10 @@ interface IHardwareWallet<TConfig = unknown> extends IEvmMethods, IBtcMethods, I
1592
1317
  getAvailableTransports(): TransportType[];
1593
1318
  switchTransport(type: TransportType): Promise<void>;
1594
1319
  searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
1595
- /** Discover selectable hardware entries without claiming identified devices or wallets. */
1596
- searchDeviceTargets(options?: SearchDevicesOptions): Promise<DeviceSearchTarget[]>;
1597
- /** @deprecated Use searchDeviceTargets(). */
1598
- listConnectionTargets(options?: SearchDevicesOptions): Promise<ConnectionTarget[]>;
1599
- /** Connect or logically bind a selected search result and return a runtime-only operation id. */
1600
- connectDevice(searchTargetId: string): Promise<Response<string>>;
1601
- /** Explicit Device Manager binding: verify the existing identity before replacing its BLE locator. */
1602
- bindBleDevice?(params: BindBleDeviceParams): Promise<Response<string>>;
1603
- /** Resolve operation-first routing/selection and pin it. The caller must verify wallet identity before business calls. */
1604
- acquireOperation?(connectId: string, context: IHardwareConnectionContext): Promise<Response<string>>;
1605
- /** Release an operation owned by the caller. Disconnect events end matching operations automatically. */
1606
- releaseOperation(operationId: string): Promise<void>;
1320
+ connectDevice(connectId: string): Promise<Response<string>>;
1321
+ disconnectDevice(connectId: string): Promise<void>;
1607
1322
  getDeviceInfo(connectId: string, deviceId: string): Promise<Response<DeviceInfo>>;
1323
+ getSupportedChains(): ChainCapability[];
1608
1324
  /** Abort the in-flight call. Omit connectId to cancel whatever is active. */
1609
1325
  cancel(connectId?: string): void;
1610
1326
  allNetworkGetAddress(connectId: string, deviceId: string, params: AllNetworkGetAddressParams): Promise<Response<AllNetworkAddressResponse[]>>;
@@ -1641,14 +1357,6 @@ interface SearchDevicesOptions {
1641
1357
  * was discovered first.
1642
1358
  */
1643
1359
  waitForAllTransports?: boolean;
1644
- /**
1645
- * Restrict discovery to one transport. A non-enumerable channel may return
1646
- * a virtual connection target (for example Keystone QR), but discovery must
1647
- * not start a wallet protocol or account-export interaction. The target is
1648
- * resolved by the following `connectDevice()` call. Omit to scan everything
1649
- * available.
1650
- */
1651
- transportType?: ConnectionType;
1652
1360
  }
1653
1361
 
1654
1362
  interface EvmGetAddressParams extends PassphraseStateAware {
@@ -1772,14 +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. Vendors that hand the
1777
- * device a serialized payload (Keystone) must prefer this over
1778
- * re-stringifying `data`: a JSON round trip rewrites integer literals wider
1779
- * than 2^53 and exponent forms, so the device would display and sign
1780
- * something the dApp never sent.
1781
- */
1782
- dataJson?: string;
1783
1483
  metamaskV4Compat?: boolean;
1784
1484
  showMessageHash?: boolean;
1785
1485
  /**
@@ -1818,33 +1518,6 @@ interface IEvmMethods {
1818
1518
  evmSignTypedData(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignTypedDataParams>>): Promise<Response<EvmSignature>>;
1819
1519
  }
1820
1520
 
1821
- /** Which `GET_VK` encoding the Ledger Zcash app should return. */
1822
- type ZcashFullViewingKeyMode = 'ufvk' | 'orchardFvk';
1823
- interface ZcashGetFullViewingKeyParams extends PassphraseStateAware {
1824
- /** BIP44 account path `m/44'/133'/a'` (any deeper transparent path is accepted; only the account level is used). */
1825
- path: string;
1826
- /** Default `ufvk`. */
1827
- mode?: ZcashFullViewingKeyMode;
1828
- }
1829
- interface ZcashFullViewingKey {
1830
- path: string;
1831
- mode: ZcashFullViewingKeyMode;
1832
- /** ZIP-316 bech32m UFVK string (mode `ufvk`). */
1833
- ufvk?: string;
1834
- /** 96-byte raw Orchard FVK as hex (mode `orchardFvk`). */
1835
- orchardFvk?: string;
1836
- }
1837
- interface ZcashGetShieldedAddressParams extends PassphraseStateAware {
1838
- /** Full 5-level transparent path `m/44'/133'/a'/0/i`; the Orchard path is derived from it. */
1839
- path: string;
1840
- showOnDevice?: boolean;
1841
- }
1842
- interface ZcashShieldedAddress {
1843
- /** Unified address with a single Orchard receiver. */
1844
- address: string;
1845
- path: string;
1846
- }
1847
-
1848
1521
  /**
1849
1522
  * Low-level device descriptor from Transport layer.
1850
1523
  * Represents a physical device detected by USB/BLE scanning.
@@ -1890,18 +1563,14 @@ interface DeviceDisconnectEvent {
1890
1563
  type DeviceChangeEvent = DeviceConnectEvent | DeviceDisconnectEvent;
1891
1564
 
1892
1565
  /**
1893
- * Serializes every device call and gives callers one handle to cancel them.
1894
- *
1895
- * Ordering is the lesser half of the job: calls already await each other, and
1896
- * nothing in the app issues two device operations at once. What this buys is
1897
- * the rest — an AbortController per job so a cancel has something to pull, a
1898
- * busy check so a double-submit is refused rather than queued, and generation
1899
- * tracking so a job that was queued before a teardown does not start after it.
1900
- * Those races exist in a perfectly sequential caller, because cleanup is async.
1901
- *
1902
- * The queue never decides whether to interrupt or ask the user; the caller owns
1903
- * that. `getActiveJob()` reads synchronously so a UI handler can look, decide,
1904
- * 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.
1905
1574
  */
1906
1575
  interface JobOptions {
1907
1576
  label?: string;
@@ -1913,15 +1582,10 @@ interface ActiveJobInfo {
1913
1582
  label?: string;
1914
1583
  startedAt: number;
1915
1584
  }
1916
- interface CancelScopeHandle {
1917
- signal: AbortSignal;
1918
- release: () => void;
1919
- }
1920
1585
  declare class DeviceJobQueue {
1921
1586
  private _tail;
1922
1587
  private _active;
1923
1588
  private readonly _jobs;
1924
- private readonly _cancelScopes;
1925
1589
  /** Incremented on clear() so queued-but-not-yet-running jobs detect invalidation. */
1926
1590
  private _generation;
1927
1591
  private readonly _generationCancelReasons;
@@ -1930,63 +1594,21 @@ declare class DeviceJobQueue {
1930
1594
  * `deviceId` is a label only — used by inspection / cancellation routing.
1931
1595
  */
1932
1596
  enqueue<T>(deviceId: string, job: (signal: AbortSignal) => Promise<T>, options?: JobOptions): Promise<T>;
1933
- /**
1934
- * Open a cancellation scope that outlives the individual jobs under it.
1935
- *
1936
- * A bundle (all-network) does not enqueue itself — it enqueues one job per
1937
- * item. Between two items the queue is empty, so a cancel landing in that
1938
- * gap finds nothing to abort and the next item goes to the device anyway.
1939
- * The scope holds the cancel across those gaps; the bundle checks its
1940
- * signal before each item. Callers must `release()` when the bundle ends.
1941
- */
1942
- createCancelScope(deviceId: string): CancelScopeHandle;
1943
- /** Cancel the running job. `reason` becomes signal.reason. */
1944
- cancelActive(deviceId?: string, reason?: Error): boolean;
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;
1945
1603
  /** Cancel the active job and invalidate queued jobs that have not started. */
1946
1604
  cancelActiveAndPending(deviceId?: string, reason?: Error): boolean;
1947
1605
  /** Get info about the currently active job, or null if idle. */
1948
1606
  getActiveJob(deviceId?: string): ActiveJobInfo | null;
1607
+ /** True if any job is currently running. */
1608
+ isBusy(): boolean;
1949
1609
  clear(reason?: Error): void;
1950
1610
  }
1951
1611
 
1952
- declare const HARDWARE_RUNTIME_ID_PREFIX = "hwk:runtime";
1953
- /**
1954
- * Scopes a runtime id can name. Each is a different lifetime, and none of them
1955
- * nests cleanly inside another:
1956
- *
1957
- * - `search-target` — one device in one discovery snapshot. Dies on the next
1958
- * search of the same kind, so a stale pick is refused rather than silently
1959
- * resolved against a different unit.
1960
- * - `link` — one open transport. Outlives the snapshot that produced it.
1961
- * - `operation` — one business operation. Outlives the link: `rebind()` swaps
1962
- * the transport underneath while the id stays the same.
1963
- */
1964
- type HardwareRuntimeIdKind = 'operation' | 'search-target' | 'link';
1965
- type HardwareRuntimeId = {
1966
- kind: HardwareRuntimeIdKind;
1967
- vendor: VendorType;
1968
- };
1969
- /** Runtime ids are opaque and must never be persisted as device identity. */
1970
- declare function createHardwareOperationId(vendor: VendorType): string;
1971
- /** Search targets are valid only for the adapter's current discovery snapshot. */
1972
- declare function createHardwareSearchTargetId(vendor: VendorType): string;
1973
- declare function createHardwareLinkId(vendor: VendorType): string;
1974
- declare function hasHardwareRuntimeIdPrefix(value: unknown): value is string;
1975
- declare function parseHardwareRuntimeId(value: unknown): HardwareRuntimeId | undefined;
1976
- declare function isHardwareOperationId(value: unknown): value is string;
1977
-
1978
- interface HardwareOperationTarget {
1979
- /** Effective target accepted by existing adapter/connector call paths. */
1980
- targetId: string | undefined;
1981
- /** Present when this operation is pinned to a live operation. */
1982
- operationId: string | undefined;
1983
- }
1984
- /**
1985
- * Normalizes the transitional positional operation id and the canonical
1986
- * common-params field. All vendors must reject conflicting bindings.
1987
- */
1988
- declare function resolveHardwareOperationTarget(positionalTargetId: string | null | undefined, commonOperationId: string | null | undefined, expectedVendor?: VendorType): Response<HardwareOperationTarget>;
1989
-
1990
1612
  /**
1991
1613
  * Minimal typed event emitter using Map<string, Set<listener>>.
1992
1614
  * Each adapter uses this for device events (connect, disconnect, pin, etc.).
@@ -2013,104 +1635,6 @@ declare class TypedEventEmitter<TMap extends Record<string, any> = Record<string
2013
1635
  listenerCount(event: string): number;
2014
1636
  }
2015
1637
 
2016
- /** Serializable BLE transport data shared by Electron main and renderer runtimes. */
2017
- interface ElectronBleDeviceInfo {
2018
- id: string;
2019
- name?: string;
2020
- rssi?: number;
2021
- advertisedServiceUuids?: string[];
2022
- }
2023
- /**
2024
- * How the main process recognizes one vendor's peripherals. Everything here
2025
- * crosses IPC, so it is data rather than predicates: the handler owns no
2026
- * vendor knowledge of its own. A peripheral matches when it advertises one of
2027
- * `serviceUuids`, or when its local name matches every entry in
2028
- * `namePatterns` (each is a case-insensitive regular expression source, so a
2029
- * single entry can carry alternations).
2030
- */
2031
- interface ElectronBleMatch {
2032
- serviceUuids?: string[];
2033
- namePatterns?: string[];
2034
- }
2035
- interface ElectronBleScanOptions {
2036
- /** Opaque partition key: results and connected devices never mix across it. */
2037
- vendor?: string;
2038
- match?: ElectronBleMatch;
2039
- /** @deprecated Superseded by `match.serviceUuids`. */
2040
- serviceUuids?: string[];
2041
- durationMs?: number;
2042
- }
2043
- /** GATT profile plus the write framing this vendor's firmware expects. */
2044
- interface ElectronBleConnectOptions {
2045
- vendor: string;
2046
- serviceUuid: string;
2047
- writeUuid: string;
2048
- notifyUuid: string;
2049
- /**
2050
- * `padded` splits into fixed `chunkSize` packets, zero-filling the last one
2051
- * — Trezor firmware silently drops a short packet. `raw` writes the buffer
2052
- * as given, for framing that carries its own length (Ledger).
2053
- */
2054
- write?: {
2055
- mode: 'padded' | 'raw';
2056
- chunkSize?: number;
2057
- chunkDelayMs?: number;
2058
- maxLength?: number;
2059
- };
2060
- }
2061
- /** Native code handles GATT only; framing, identity checks and wallet operations stay in the SDK. */
2062
- interface ElectronBleApi {
2063
- scan(options?: ElectronBleScanOptions): Promise<ElectronBleDeviceInfo[]>;
2064
- stopScan(): Promise<void>;
2065
- connect(id: string, options?: ElectronBleConnectOptions): Promise<{
2066
- id: string;
2067
- name?: string;
2068
- }>;
2069
- disconnect(id: string): Promise<void>;
2070
- subscribe(id: string): Promise<void>;
2071
- unsubscribe(id: string): Promise<void>;
2072
- write(id: string, hexData: string): Promise<void>;
2073
- checkAvailability(): Promise<{
2074
- available: boolean;
2075
- state: string;
2076
- initialized: boolean;
2077
- }>;
2078
- getDevice(id: string): Promise<ElectronBleDeviceInfo | null>;
2079
- onNotification(handler: (id: string, hexData: string) => void): () => void;
2080
- onDeviceDisconnected(handler: (id: string) => void): () => void;
2081
- }
2082
-
2083
- /**
2084
- * The outcome of asking the host to persist a verified binding. A refusal is
2085
- * reported, never thrown: by this point the SDK has already verified that the
2086
- * connected wallet is the one the operation expects, so anything the host says
2087
- * back is about the host's own records. Losing the binding is worth a warning
2088
- * and a retry next time; it is not a reason to fail work the user asked for.
2089
- */
2090
- type SaveDeviceBindingOutcome = {
2091
- saved: true;
2092
- } | {
2093
- saved: false;
2094
- reason: SaveDeviceBindingDeclineReason;
2095
- };
2096
- /** Persist a verified binding through the host. Only a user abort throws. */
2097
- declare function requestSaveDeviceBinding(emitter: TypedEventEmitter<HardwareEventMap>, registry: UiRequestRegistry, binding: Omit<SaveDeviceBindingRequest, 'requestId'>, signal?: AbortSignal): Promise<SaveDeviceBindingOutcome>;
2098
-
2099
- /** Discovery and selection share one owner; never connect until the last scan has drained. */
2100
- declare function requestBleDeviceSelection({ emitter, registry, request, scan, signal, allowUsbFallback, pollIntervalMs, }: {
2101
- emitter: TypedEventEmitter<HardwareEventMap>;
2102
- registry: UiRequestRegistry;
2103
- request: Omit<DeviceSelectionRequest, 'requestId' | 'scanning'>;
2104
- scan: () => Promise<DeviceInfo[]>;
2105
- signal: AbortSignal;
2106
- /** The adapter must verify a returned USB candidate before dispatching any business call. */
2107
- allowUsbFallback?: boolean;
2108
- pollIntervalMs?: number;
2109
- }): Promise<{
2110
- device: DeviceInfo;
2111
- requestId: string;
2112
- }>;
2113
-
2114
1638
  /**
2115
1639
  * Compare two semver strings (e.g. "2.1.0" vs "2.3.1").
2116
1640
  * Returns -1 if a < b, 0 if equal, 1 if a > b.
@@ -2131,18 +1655,7 @@ declare function hexToBytes(hex: string): Uint8Array;
2131
1655
  /** Convert a Uint8Array to a hex string (no 0x prefix). */
2132
1656
  declare function bytesToHex(bytes: Uint8Array): string;
2133
1657
 
2134
- interface PrepareSolanaOffchainMessageV1Params {
2135
- message: Uint8Array;
2136
- requiredSigners: readonly string[];
2137
- }
2138
- interface PreparedSolanaOffchainMessageV1 {
2139
- messageText: string;
2140
- requiredSigners: string[];
2141
- serializedMessage: Uint8Array;
2142
- }
2143
- declare function prepareSolanaOffchainMessageV1({ message, requiredSigners, }: PrepareSolanaOffchainMessageV1Params): PreparedSolanaOffchainMessageV1;
2144
-
2145
- type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger' | 'keystone';
1658
+ type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger';
2146
1659
  type HardwareDeviceIdentityInput = {
2147
1660
  name?: string | null;
2148
1661
  localName?: string | null;
@@ -2209,4 +1722,4 @@ declare function buildUnsupportedMethodResponse(item: AllNetworkAddressParams):
2209
1722
 
2210
1723
  declare const DEVICE_CONNECT_RETRY_DELAY_MS = 1000;
2211
1724
 
2212
- 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 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, 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, isHardwareOperationId, isKnownNonTargetHardwareVendor, 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 };