@onekeyfe/hwk-adapter-core 1.2.3-alpha.8 → 1.2.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.
- package/dist/{chunk-WUIWRX56.js → chunk-BAGEFFFY.js} +13 -49
- package/dist/chunk-BAGEFFFY.js.map +1 -0
- package/dist/{chunk-CQM2P5IG.js → chunk-SZZF623R.js} +55 -155
- package/dist/chunk-SZZF623R.js.map +1 -0
- package/dist/{chunk-EQYPRCWU.mjs → chunk-U63HTLGJ.mjs} +12 -48
- package/dist/chunk-U63HTLGJ.mjs.map +1 -0
- package/dist/{chunk-IOFMG7YO.mjs → chunk-YA4BWFTZ.mjs} +55 -155
- package/dist/chunk-YA4BWFTZ.mjs.map +1 -0
- package/dist/errors.d.mts +207 -1
- package/dist/errors.d.ts +207 -1
- package/dist/errors.js +2 -8
- package/dist/errors.js.map +1 -1
- package/dist/errors.mjs +3 -9
- package/dist/index.d.mts +98 -635
- package/dist/index.d.ts +98 -635
- package/dist/index.js +82 -680
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -671
- package/dist/index.mjs.map +1 -1
- package/dist/{ui-events-BGUpXxvP.d.ts → ui-events-Cb7haAeE.d.mts} +3 -44
- package/dist/{ui-events-BGUpXxvP.d.mts → ui-events-Cb7haAeE.d.ts} +3 -44
- package/dist/ui-events.d.mts +1 -1
- package/dist/ui-events.d.ts +1 -1
- package/dist/ui-events.js +2 -3
- package/dist/ui-events.js.map +1 -1
- package/dist/ui-events.mjs +1 -2
- package/package.json +2 -2
- package/dist/chunk-CQM2P5IG.js.map +0 -1
- package/dist/chunk-DB4JOPZO.mjs +0 -74
- package/dist/chunk-DB4JOPZO.mjs.map +0 -1
- package/dist/chunk-EQYPRCWU.mjs.map +0 -1
- package/dist/chunk-IOFMG7YO.mjs.map +0 -1
- package/dist/chunk-WUIWRX56.js.map +0 -1
- package/dist/chunk-YLCHSNXO.js +0 -74
- package/dist/chunk-YLCHSNXO.js.map +0 -1
- package/dist/errors-Cm8XpjmX.d.mts +0 -321
- package/dist/errors-Cm8XpjmX.d.ts +0 -321
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { U as UiResponseEvent, a as
|
|
4
|
-
export { D as DevicePermissionDeniedReason,
|
|
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,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
|
|
20
|
+
declare function failure(code: HardwareErrorCode, error: string, params?: Record<string, unknown>): Failure;
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
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
|
|
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,168 +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
|
-
/**
|
|
874
|
-
* The channel this operation actually runs on. Required on `create` and
|
|
875
|
-
* `rebind` so it comes from whichever adapter picked the channel, rather
|
|
876
|
-
* than being read back off `device`, whose snapshot a combined connector
|
|
877
|
-
* fills with a nominal value.
|
|
878
|
-
*/
|
|
879
|
-
connectionType: ConnectionType;
|
|
880
|
-
connectionKeys: string[];
|
|
881
|
-
createdAt: number;
|
|
882
|
-
lastActiveAt: number;
|
|
883
|
-
};
|
|
884
|
-
type OperationRegistryOptions = {
|
|
885
|
-
vendor: VendorType;
|
|
886
|
-
ttlMs?: number;
|
|
887
|
-
onEnded?: (operation: HardwareOperation, reason: OperationEndReason) => void;
|
|
888
750
|
};
|
|
889
|
-
/** Runtime-only association between a public operation id and one live target. */
|
|
890
|
-
declare class OperationRegistry {
|
|
891
|
-
private readonly _vendor;
|
|
892
|
-
private readonly _ttlMs;
|
|
893
|
-
private readonly _onEnded?;
|
|
894
|
-
private readonly _active;
|
|
895
|
-
private readonly _ended;
|
|
896
|
-
constructor(options: OperationRegistryOptions);
|
|
897
|
-
create(params: {
|
|
898
|
-
searchTargetId: string;
|
|
899
|
-
connectId: string;
|
|
900
|
-
device: DeviceInfo;
|
|
901
|
-
connectionType: ConnectionType;
|
|
902
|
-
connectionKeys?: string[];
|
|
903
|
-
}): HardwareOperation;
|
|
904
|
-
resolve(operationId: string): HardwareOperation;
|
|
905
|
-
/** Keep an operation alive while one device job is actively using it. */
|
|
906
|
-
retain(operationId: string): () => void;
|
|
907
|
-
/** Return active or tombstoned binding data without refreshing its TTL. */
|
|
908
|
-
find(operationId: string): HardwareOperation | undefined;
|
|
909
|
-
findActiveByConnectionKey(connectionKey: string): HardwareOperation | undefined;
|
|
910
|
-
/** Replace the live transport binding after the same target was reconnected. */
|
|
911
|
-
rebind(operationId: string, params: {
|
|
912
|
-
connectId: string;
|
|
913
|
-
device: DeviceInfo;
|
|
914
|
-
connectionType: ConnectionType;
|
|
915
|
-
connectionKeys?: string[];
|
|
916
|
-
}): HardwareOperation;
|
|
917
|
-
end(operationId: string, reason: OperationEndReason): HardwareOperation | undefined;
|
|
918
|
-
endByConnectionKey(connectionKey: string, reason: OperationEndReason, exceptOperationId?: string): void;
|
|
919
|
-
endAll(reason: OperationEndReason, exceptOperationId?: string): void;
|
|
920
|
-
private _createTimer;
|
|
921
|
-
private _rememberEnded;
|
|
922
|
-
}
|
|
923
751
|
|
|
924
752
|
type HardwareMethodMetadata = {
|
|
925
753
|
chain: ChainForFingerprint;
|
|
926
754
|
allNetwork: boolean;
|
|
927
|
-
/** Whether repeating the method after an ambiguous transport failure is safe. */
|
|
928
|
-
replayAfterTransportFailure: 'safe' | 'unsafe';
|
|
929
755
|
};
|
|
930
756
|
declare const HARDWARE_METHOD_CATALOG: {
|
|
931
757
|
readonly evmGetAddress: {
|
|
932
758
|
readonly chain: "evm";
|
|
933
759
|
readonly allNetwork: true;
|
|
934
|
-
readonly replayAfterTransportFailure: "safe";
|
|
935
760
|
};
|
|
936
761
|
readonly evmSignTransaction: {
|
|
937
762
|
readonly chain: "evm";
|
|
938
763
|
readonly allNetwork: false;
|
|
939
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
940
764
|
};
|
|
941
765
|
readonly evmSignMessage: {
|
|
942
766
|
readonly chain: "evm";
|
|
943
767
|
readonly allNetwork: false;
|
|
944
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
945
768
|
};
|
|
946
769
|
readonly evmSignTypedData: {
|
|
947
770
|
readonly chain: "evm";
|
|
948
771
|
readonly allNetwork: false;
|
|
949
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
950
772
|
};
|
|
951
773
|
readonly btcGetAddress: {
|
|
952
774
|
readonly chain: "btc";
|
|
953
775
|
readonly allNetwork: true;
|
|
954
|
-
readonly replayAfterTransportFailure: "safe";
|
|
955
776
|
};
|
|
956
777
|
readonly btcGetPublicKey: {
|
|
957
778
|
readonly chain: "btc";
|
|
958
779
|
readonly allNetwork: true;
|
|
959
|
-
readonly replayAfterTransportFailure: "safe";
|
|
960
780
|
};
|
|
961
781
|
readonly btcSignTransaction: {
|
|
962
782
|
readonly chain: "btc";
|
|
963
783
|
readonly allNetwork: false;
|
|
964
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
965
784
|
};
|
|
966
785
|
readonly btcSignPsbt: {
|
|
967
786
|
readonly chain: "btc";
|
|
968
787
|
readonly allNetwork: false;
|
|
969
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
970
788
|
};
|
|
971
789
|
readonly btcSignMessage: {
|
|
972
790
|
readonly chain: "btc";
|
|
973
791
|
readonly allNetwork: false;
|
|
974
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
975
792
|
};
|
|
976
793
|
readonly btcGetMasterFingerprint: {
|
|
977
794
|
readonly chain: "btc";
|
|
978
795
|
readonly allNetwork: false;
|
|
979
|
-
readonly replayAfterTransportFailure: "safe";
|
|
980
796
|
};
|
|
981
797
|
readonly solGetAddress: {
|
|
982
798
|
readonly chain: "sol";
|
|
983
799
|
readonly allNetwork: true;
|
|
984
|
-
readonly replayAfterTransportFailure: "safe";
|
|
985
800
|
};
|
|
986
801
|
readonly solSignTransaction: {
|
|
987
802
|
readonly chain: "sol";
|
|
988
803
|
readonly allNetwork: false;
|
|
989
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
990
804
|
};
|
|
991
805
|
readonly solSignMessage: {
|
|
992
806
|
readonly chain: "sol";
|
|
993
807
|
readonly allNetwork: false;
|
|
994
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
995
808
|
};
|
|
996
809
|
readonly tronGetAddress: {
|
|
997
810
|
readonly chain: "tron";
|
|
998
811
|
readonly allNetwork: true;
|
|
999
|
-
readonly replayAfterTransportFailure: "safe";
|
|
1000
812
|
};
|
|
1001
813
|
readonly tronSignTransaction: {
|
|
1002
814
|
readonly chain: "tron";
|
|
1003
815
|
readonly allNetwork: false;
|
|
1004
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
1005
816
|
};
|
|
1006
817
|
readonly tronSignMessage: {
|
|
1007
818
|
readonly chain: "tron";
|
|
1008
819
|
readonly allNetwork: false;
|
|
1009
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
1010
|
-
};
|
|
1011
|
-
readonly zcashGetFullViewingKey: {
|
|
1012
|
-
readonly chain: "zcash";
|
|
1013
|
-
readonly allNetwork: false;
|
|
1014
|
-
readonly replayAfterTransportFailure: "safe";
|
|
1015
|
-
};
|
|
1016
|
-
readonly zcashGetShieldedAddress: {
|
|
1017
|
-
readonly chain: "zcash";
|
|
1018
|
-
readonly allNetwork: false;
|
|
1019
|
-
readonly replayAfterTransportFailure: "safe";
|
|
1020
820
|
};
|
|
1021
821
|
};
|
|
1022
822
|
type HardwareMethodName = keyof typeof HARDWARE_METHOD_CATALOG;
|
|
@@ -1025,11 +825,6 @@ type AllNetworkMethodName = {
|
|
|
1025
825
|
}[HardwareMethodName];
|
|
1026
826
|
declare const ALL_NETWORK_METHOD_NAMES: AllNetworkMethodName[];
|
|
1027
827
|
declare function getHardwareMethodMetadata(method: string): HardwareMethodMetadata | undefined;
|
|
1028
|
-
/**
|
|
1029
|
-
* Conservative replay gate used only after a call may have reached hardware.
|
|
1030
|
-
* Unknown methods and device mutations are unsafe by default.
|
|
1031
|
-
*/
|
|
1032
|
-
declare function canReplayHardwareMethodAfterTransportFailure(method: string): boolean;
|
|
1033
828
|
declare function isAllNetworkMethodName(method: string): method is AllNetworkMethodName;
|
|
1034
829
|
declare function getAllNetworkMethodChain(method: AllNetworkMethodName): ChainForFingerprint;
|
|
1035
830
|
|
|
@@ -1048,7 +843,7 @@ type HardwareUiEvent = Exclude<ConnectorUiEvent, {
|
|
|
1048
843
|
progress: number;
|
|
1049
844
|
};
|
|
1050
845
|
};
|
|
1051
|
-
type ChainCapability = 'evm' | 'btc' | 'sol' | 'tron'
|
|
846
|
+
type ChainCapability = 'evm' | 'btc' | 'sol' | 'tron';
|
|
1052
847
|
type TrezorDisplayRotation = 'North' | 'East' | 'South' | 'West';
|
|
1053
848
|
type TrezorSafetyCheckLevel = 'Strict' | 'PromptAlways' | 'PromptTemporarily';
|
|
1054
849
|
type TrezorDeviceSettingsParams = {
|
|
@@ -1125,68 +920,13 @@ type DeviceAuthenticityResult = {
|
|
|
1125
920
|
* that aren't specific to one chain. Vendor-specific options can be added
|
|
1126
921
|
* as typed sub-fields here when a vendor actually needs them.
|
|
1127
922
|
*/
|
|
1128
|
-
|
|
1129
|
-
type KnownDeviceConnection = {
|
|
1130
|
-
transport: 'usb' | 'ble';
|
|
1131
|
-
connectId: string;
|
|
1132
|
-
} | {
|
|
1133
|
-
transport: 'qr';
|
|
1134
|
-
};
|
|
1135
|
-
/** Opaque host lookup identifiers. Never forward these to firmware or logs. */
|
|
1136
|
-
type HardwareCallExtra = Readonly<Record<string, string>>;
|
|
1137
|
-
interface IHardwareConnectionContext {
|
|
1138
|
-
knownConnections?: readonly KnownDeviceConnection[];
|
|
1139
|
-
extra?: HardwareCallExtra;
|
|
1140
|
-
/** False makes discovery fail instead of asking the user to select a new endpoint. */
|
|
1141
|
-
allowDeviceSelection?: boolean;
|
|
1142
|
-
}
|
|
1143
|
-
type DeviceSelectionContext = {
|
|
1144
|
-
kind: 'select-device';
|
|
1145
|
-
transport: 'usb';
|
|
1146
|
-
reason: 'multiple-candidates';
|
|
1147
|
-
} | {
|
|
1148
|
-
kind: 'bind-connection';
|
|
1149
|
-
transport: 'ble';
|
|
1150
|
-
reason: 'missing-binding' | 'known-connection-unavailable' | 'manual-rebind';
|
|
1151
|
-
};
|
|
1152
|
-
interface DeviceSelectionRequest extends UiRequestOperationAttribution {
|
|
1153
|
-
devices: DeviceInfo[];
|
|
1154
|
-
requestId: string;
|
|
1155
|
-
context: DeviceSelectionContext;
|
|
1156
|
-
extra?: HardwareCallExtra;
|
|
1157
|
-
/** Repeated snapshots with this requestId update one SDK-owned binding scan. */
|
|
1158
|
-
scanning?: boolean;
|
|
1159
|
-
bindingSessionId?: string;
|
|
1160
|
-
/** A candidate rejected by SDK identity verification in this binding session. */
|
|
1161
|
-
rejectedConnectId?: string;
|
|
1162
|
-
}
|
|
1163
|
-
/** The SDK has verified this endpoint; the host must persist it before acknowledging. */
|
|
1164
|
-
interface SaveDeviceBindingRequest extends UiRequestOperationAttribution {
|
|
1165
|
-
requestId: string;
|
|
1166
|
-
selectionRequestId: string;
|
|
1167
|
-
connection: {
|
|
1168
|
-
transport: 'ble';
|
|
1169
|
-
connectId: string;
|
|
1170
|
-
};
|
|
1171
|
-
identity: Extract<WalletIdentity, {
|
|
1172
|
-
vendor: 'ledger' | 'trezor';
|
|
1173
|
-
}>;
|
|
1174
|
-
extra?: HardwareCallExtra;
|
|
1175
|
-
}
|
|
1176
|
-
type BindBleDeviceParams = Pick<SaveDeviceBindingRequest, 'identity' | 'extra'>;
|
|
1177
|
-
interface DeviceBindingStatus {
|
|
1178
|
-
selectionRequestId: string;
|
|
1179
|
-
status: 'verifying' | 'saved' | 'failed' | 'cancelled';
|
|
1180
|
-
}
|
|
1181
|
-
interface ICommonCallParams extends IHardwareConnectionContext {
|
|
923
|
+
interface ICommonCallParams {
|
|
1182
924
|
/**
|
|
1183
925
|
* When the required device app is missing, prompt the user (UI request)
|
|
1184
926
|
* to install it, stream install progress, then retry the operation once.
|
|
1185
927
|
* Off by default — preserves the plain "app not installed" failure.
|
|
1186
928
|
*/
|
|
1187
929
|
autoInstallApp?: boolean;
|
|
1188
|
-
/** Runtime-only id returned by connectDevice(). When present, discovery and fallback are disabled. */
|
|
1189
|
-
operationId?: string;
|
|
1190
930
|
}
|
|
1191
931
|
type NullableCallArg<T> = T | null | undefined;
|
|
1192
932
|
interface IPassphraseCallParams {
|
|
@@ -1195,15 +935,6 @@ interface IPassphraseCallParams {
|
|
|
1195
935
|
}
|
|
1196
936
|
type IHardwareCommonCallParams = ICommonCallParams & IPassphraseCallParams;
|
|
1197
937
|
type IHardwareCallParams<T> = T & IHardwareCommonCallParams;
|
|
1198
|
-
/**
|
|
1199
|
-
* Runtime-only context for device-manager operations. The expected identity
|
|
1200
|
-
* lets an adapter fail closed before a read or mutation is replayed after a
|
|
1201
|
-
* reconnect. It must never be forwarded to vendor firmware.
|
|
1202
|
-
*/
|
|
1203
|
-
interface IDeviceManagerOperationContext extends IHardwareConnectionContext {
|
|
1204
|
-
operationId?: string;
|
|
1205
|
-
expectedDeviceIdentity?: WalletIdentity;
|
|
1206
|
-
}
|
|
1207
938
|
interface AllNetworkAddressParams {
|
|
1208
939
|
network: string;
|
|
1209
940
|
path: string;
|
|
@@ -1214,7 +945,16 @@ interface AllNetworkAddressParams {
|
|
|
1214
945
|
interface AllNetworkGetAddressParams extends IHardwareCommonCallParams {
|
|
1215
946
|
bundle: AllNetworkAddressParams[];
|
|
1216
947
|
}
|
|
1217
|
-
type AllNetworkDeviceIdentity =
|
|
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
|
+
};
|
|
1218
958
|
type AllNetworkAddressResponsePayload = Record<string, unknown> & {
|
|
1219
959
|
error?: string;
|
|
1220
960
|
code?: HardwareErrorCode | number;
|
|
@@ -1222,7 +962,6 @@ type AllNetworkAddressResponsePayload = Record<string, unknown> & {
|
|
|
1222
962
|
connectId?: string;
|
|
1223
963
|
deviceId?: string;
|
|
1224
964
|
deviceIdentity?: AllNetworkDeviceIdentity;
|
|
1225
|
-
rootFingerprint?: number;
|
|
1226
965
|
chainFingerprint?: string;
|
|
1227
966
|
chainFingerprintChain?: ChainForFingerprint;
|
|
1228
967
|
params?: Record<string, unknown>;
|
|
@@ -1271,50 +1010,46 @@ type UiRequestEvent = {
|
|
|
1271
1010
|
device?: DeviceInfo;
|
|
1272
1011
|
connectId?: string;
|
|
1273
1012
|
type?: string;
|
|
1274
|
-
}
|
|
1013
|
+
};
|
|
1275
1014
|
} | {
|
|
1276
1015
|
type: typeof UI_REQUEST.REQUEST_PASSPHRASE;
|
|
1277
1016
|
payload: {
|
|
1278
1017
|
device: DeviceInfo;
|
|
1279
|
-
}
|
|
1018
|
+
};
|
|
1280
1019
|
} | {
|
|
1281
1020
|
type: typeof UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE;
|
|
1282
1021
|
payload: {
|
|
1283
1022
|
device: DeviceInfo;
|
|
1284
|
-
}
|
|
1023
|
+
};
|
|
1285
1024
|
} | {
|
|
1286
1025
|
type: typeof UI_REQUEST.REQUEST_BUTTON;
|
|
1287
1026
|
payload: {
|
|
1288
1027
|
device: DeviceInfo;
|
|
1289
1028
|
code?: string;
|
|
1290
|
-
}
|
|
1029
|
+
};
|
|
1291
1030
|
} | {
|
|
1292
1031
|
type: typeof UI_REQUEST.REQUEST_QR_DISPLAY;
|
|
1293
1032
|
payload: {
|
|
1294
1033
|
device: DeviceInfo;
|
|
1295
1034
|
data: QrDisplayData;
|
|
1296
|
-
}
|
|
1035
|
+
};
|
|
1297
1036
|
} | {
|
|
1298
1037
|
type: typeof UI_REQUEST.REQUEST_QR_SCAN;
|
|
1299
1038
|
payload: {
|
|
1300
1039
|
device: DeviceInfo;
|
|
1301
|
-
}
|
|
1040
|
+
};
|
|
1302
1041
|
} | {
|
|
1303
1042
|
type: typeof UI_REQUEST.REQUEST_DEVICE_PERMISSION;
|
|
1304
1043
|
payload: {
|
|
1305
1044
|
transportType: TransportType;
|
|
1306
1045
|
connectId?: string;
|
|
1307
1046
|
deviceId?: string;
|
|
1308
|
-
}
|
|
1047
|
+
};
|
|
1309
1048
|
} | {
|
|
1310
1049
|
type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
|
|
1311
|
-
payload:
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
payload: SaveDeviceBindingRequest;
|
|
1315
|
-
} | {
|
|
1316
|
-
type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
|
|
1317
|
-
payload: DeviceBindingStatus;
|
|
1050
|
+
payload: {
|
|
1051
|
+
devices: DeviceInfo[];
|
|
1052
|
+
};
|
|
1318
1053
|
} | {
|
|
1319
1054
|
type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
|
|
1320
1055
|
payload: {
|
|
@@ -1334,13 +1069,13 @@ type UiRequestEvent = {
|
|
|
1334
1069
|
* isn't recognized.
|
|
1335
1070
|
*/
|
|
1336
1071
|
message: string;
|
|
1337
|
-
}
|
|
1072
|
+
};
|
|
1338
1073
|
} | {
|
|
1339
1074
|
type: typeof UI_REQUEST.REQUEST_INSTALL_APP;
|
|
1340
1075
|
payload: {
|
|
1341
1076
|
vendor: string;
|
|
1342
1077
|
appName: string;
|
|
1343
|
-
}
|
|
1078
|
+
};
|
|
1344
1079
|
} | {
|
|
1345
1080
|
type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
|
|
1346
1081
|
payload: {
|
|
@@ -1348,10 +1083,10 @@ type UiRequestEvent = {
|
|
|
1348
1083
|
availableMethods: number[];
|
|
1349
1084
|
selectedMethod: number;
|
|
1350
1085
|
nfcData?: string;
|
|
1351
|
-
}
|
|
1086
|
+
};
|
|
1352
1087
|
} | {
|
|
1353
1088
|
type: typeof UI_REQUEST.CLOSE_UI_WINDOW;
|
|
1354
|
-
payload:
|
|
1089
|
+
payload: Record<string, never>;
|
|
1355
1090
|
};
|
|
1356
1091
|
type SdkEvent = {
|
|
1357
1092
|
type: typeof SDK.DEVICE_INTERACTION;
|
|
@@ -1374,12 +1109,6 @@ type SdkEvent = {
|
|
|
1374
1109
|
payload: {
|
|
1375
1110
|
connectId: string;
|
|
1376
1111
|
};
|
|
1377
|
-
} | {
|
|
1378
|
-
type: typeof SDK.OPERATION_ENDED;
|
|
1379
|
-
payload: {
|
|
1380
|
-
operationId: string;
|
|
1381
|
-
reason: OperationEndReason;
|
|
1382
|
-
};
|
|
1383
1112
|
};
|
|
1384
1113
|
type HardwareEvent = DeviceEvent | UiRequestEvent | SdkEvent | HardwareUiEvent;
|
|
1385
1114
|
type DeviceEventListener = (event: HardwareEvent) => void;
|
|
@@ -1390,14 +1119,6 @@ type DeviceEventListener = (event: HardwareEvent) => void;
|
|
|
1390
1119
|
* and the value is the narrowed event object the listener will receive.
|
|
1391
1120
|
*/
|
|
1392
1121
|
interface HardwareEventMap {
|
|
1393
|
-
[UI_REQUEST.DEVICE_BINDING_STATUS]: {
|
|
1394
|
-
type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
|
|
1395
|
-
payload: DeviceBindingStatus;
|
|
1396
|
-
};
|
|
1397
|
-
[UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING]: {
|
|
1398
|
-
type: typeof UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
|
|
1399
|
-
payload: SaveDeviceBindingRequest;
|
|
1400
|
-
};
|
|
1401
1122
|
'ui-event': HardwareUiEvent;
|
|
1402
1123
|
[DEVICE.CONNECT]: {
|
|
1403
1124
|
type: typeof DEVICE.CONNECT;
|
|
@@ -1438,7 +1159,7 @@ interface HardwareEventMap {
|
|
|
1438
1159
|
device?: DeviceInfo;
|
|
1439
1160
|
connectId?: string;
|
|
1440
1161
|
type?: string;
|
|
1441
|
-
}
|
|
1162
|
+
};
|
|
1442
1163
|
};
|
|
1443
1164
|
[UI_REQUEST.REQUEST_PASSPHRASE]: {
|
|
1444
1165
|
type: typeof UI_REQUEST.REQUEST_PASSPHRASE;
|
|
@@ -1447,33 +1168,33 @@ interface HardwareEventMap {
|
|
|
1447
1168
|
connectId?: string;
|
|
1448
1169
|
passphraseState?: string;
|
|
1449
1170
|
useEmptyPassphrase?: boolean;
|
|
1450
|
-
}
|
|
1171
|
+
};
|
|
1451
1172
|
};
|
|
1452
1173
|
[UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE]: {
|
|
1453
1174
|
type: typeof UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE;
|
|
1454
1175
|
payload: {
|
|
1455
1176
|
device: DeviceInfo;
|
|
1456
|
-
}
|
|
1177
|
+
};
|
|
1457
1178
|
};
|
|
1458
1179
|
[UI_REQUEST.REQUEST_BUTTON]: {
|
|
1459
1180
|
type: typeof UI_REQUEST.REQUEST_BUTTON;
|
|
1460
1181
|
payload: {
|
|
1461
1182
|
device: DeviceInfo;
|
|
1462
1183
|
code?: string;
|
|
1463
|
-
}
|
|
1184
|
+
};
|
|
1464
1185
|
};
|
|
1465
1186
|
[UI_REQUEST.REQUEST_QR_DISPLAY]: {
|
|
1466
1187
|
type: typeof UI_REQUEST.REQUEST_QR_DISPLAY;
|
|
1467
1188
|
payload: {
|
|
1468
1189
|
device: DeviceInfo;
|
|
1469
1190
|
data: QrDisplayData;
|
|
1470
|
-
}
|
|
1191
|
+
};
|
|
1471
1192
|
};
|
|
1472
1193
|
[UI_REQUEST.REQUEST_QR_SCAN]: {
|
|
1473
1194
|
type: typeof UI_REQUEST.REQUEST_QR_SCAN;
|
|
1474
1195
|
payload: {
|
|
1475
1196
|
device: DeviceInfo;
|
|
1476
|
-
}
|
|
1197
|
+
};
|
|
1477
1198
|
};
|
|
1478
1199
|
[UI_REQUEST.REQUEST_DEVICE_PERMISSION]: {
|
|
1479
1200
|
type: typeof UI_REQUEST.REQUEST_DEVICE_PERMISSION;
|
|
@@ -1481,11 +1202,13 @@ interface HardwareEventMap {
|
|
|
1481
1202
|
transportType: TransportType;
|
|
1482
1203
|
connectId?: string;
|
|
1483
1204
|
deviceId?: string;
|
|
1484
|
-
}
|
|
1205
|
+
};
|
|
1485
1206
|
};
|
|
1486
1207
|
[UI_REQUEST.REQUEST_SELECT_DEVICE]: {
|
|
1487
1208
|
type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
|
|
1488
|
-
payload:
|
|
1209
|
+
payload: {
|
|
1210
|
+
devices: DeviceInfo[];
|
|
1211
|
+
};
|
|
1489
1212
|
};
|
|
1490
1213
|
[UI_REQUEST.REQUEST_DEVICE_CONNECT]: {
|
|
1491
1214
|
type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
|
|
@@ -1493,7 +1216,7 @@ interface HardwareEventMap {
|
|
|
1493
1216
|
vendor: string;
|
|
1494
1217
|
reason: string;
|
|
1495
1218
|
message: string;
|
|
1496
|
-
}
|
|
1219
|
+
};
|
|
1497
1220
|
};
|
|
1498
1221
|
[UI_REQUEST.REQUEST_BTC_HIGH_INDEX_CONFIRM]: {
|
|
1499
1222
|
type: typeof UI_REQUEST.REQUEST_BTC_HIGH_INDEX_CONFIRM;
|
|
@@ -1501,14 +1224,14 @@ interface HardwareEventMap {
|
|
|
1501
1224
|
vendor: string;
|
|
1502
1225
|
path: string;
|
|
1503
1226
|
accountIndex: number;
|
|
1504
|
-
}
|
|
1227
|
+
};
|
|
1505
1228
|
};
|
|
1506
1229
|
[UI_REQUEST.REQUEST_INSTALL_APP]: {
|
|
1507
1230
|
type: typeof UI_REQUEST.REQUEST_INSTALL_APP;
|
|
1508
1231
|
payload: {
|
|
1509
1232
|
vendor: string;
|
|
1510
1233
|
appName: string;
|
|
1511
|
-
}
|
|
1234
|
+
};
|
|
1512
1235
|
};
|
|
1513
1236
|
[UI_REQUEST.REQUEST_TREZOR_THP_PAIRING]: {
|
|
1514
1237
|
type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
|
|
@@ -1517,11 +1240,11 @@ interface HardwareEventMap {
|
|
|
1517
1240
|
availableMethods: number[];
|
|
1518
1241
|
selectedMethod: number;
|
|
1519
1242
|
nfcData?: string;
|
|
1520
|
-
}
|
|
1243
|
+
};
|
|
1521
1244
|
};
|
|
1522
1245
|
[UI_REQUEST.CLOSE_UI_WINDOW]: {
|
|
1523
1246
|
type: typeof UI_REQUEST.CLOSE_UI_WINDOW;
|
|
1524
|
-
payload:
|
|
1247
|
+
payload: Record<string, never>;
|
|
1525
1248
|
};
|
|
1526
1249
|
[SDK.DEVICE_INTERACTION]: {
|
|
1527
1250
|
type: typeof SDK.DEVICE_INTERACTION;
|
|
@@ -1548,23 +1271,16 @@ interface HardwareEventMap {
|
|
|
1548
1271
|
connectId: string;
|
|
1549
1272
|
};
|
|
1550
1273
|
};
|
|
1551
|
-
[SDK.OPERATION_ENDED]: {
|
|
1552
|
-
type: typeof SDK.OPERATION_ENDED;
|
|
1553
|
-
payload: {
|
|
1554
|
-
operationId: string;
|
|
1555
|
-
reason: OperationEndReason;
|
|
1556
|
-
};
|
|
1557
|
-
};
|
|
1558
1274
|
}
|
|
1559
1275
|
interface IDeviceManagerMethods {
|
|
1560
|
-
getFeatures?(connectId: string
|
|
1561
|
-
deviceSettings?(connectId: string, params: TrezorDeviceSettingsParams
|
|
1562
|
-
setBrightness?(connectId: string, params?: TrezorBrightnessParams
|
|
1563
|
-
changePin?(connectId: string, params?: TrezorChangePinParams
|
|
1564
|
-
wipeDevice?(connectId: string
|
|
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>>>;
|
|
1565
1281
|
authenticateDevice?(connectId: string, params: {
|
|
1566
1282
|
challenge: string;
|
|
1567
|
-
}
|
|
1283
|
+
}): Promise<Response<Record<string, unknown>>>;
|
|
1568
1284
|
}
|
|
1569
1285
|
interface IWalletStateMethods {
|
|
1570
1286
|
/**
|
|
@@ -1591,45 +1307,20 @@ interface IWalletStateMethods {
|
|
|
1591
1307
|
* Optional: vendors without host-managed passphrase sessions (Ledger) omit
|
|
1592
1308
|
* it. Implemented by `TrezorAdapter`.
|
|
1593
1309
|
*/
|
|
1594
|
-
getPassphraseState?(connectId: string, passphraseState?: string
|
|
1310
|
+
getPassphraseState?(connectId: string, passphraseState?: string): Promise<Response<string | null>>;
|
|
1595
1311
|
}
|
|
1596
|
-
/**
|
|
1597
|
-
* What a `cancel()` actually reaches on this vendor.
|
|
1598
|
-
*
|
|
1599
|
-
* - `stops-waiting`: the caller stops waiting and the adapter drops the
|
|
1600
|
-
* response, but a confirmation screen already on the device stays up until
|
|
1601
|
-
* the user answers it or the device times out.
|
|
1602
|
-
* - `interrupts-device`: the command on the wire is genuinely withdrawn.
|
|
1603
|
-
*
|
|
1604
|
-
* No vendor here reports `interrupts-device`: none of the three can retract a
|
|
1605
|
-
* prompt the device is already showing. The distinction exists so a host can
|
|
1606
|
-
* say "we stopped waiting, answer or reject on the device" instead of claiming
|
|
1607
|
-
* the operation was cancelled.
|
|
1608
|
-
*/
|
|
1609
|
-
type CancelCapability = 'interrupts-device' | 'stops-waiting';
|
|
1610
1312
|
interface IHardwareWallet<TConfig = unknown> extends IEvmMethods, IBtcMethods, ISolMethods, ITronMethods, IDeviceManagerMethods, IWalletStateMethods {
|
|
1611
1313
|
readonly vendor: string;
|
|
1612
1314
|
readonly activeTransport: TransportType | null;
|
|
1613
|
-
/** What `cancel()` reaches on this vendor. Declared, never inferred. */
|
|
1614
|
-
readonly cancelCapability: CancelCapability;
|
|
1615
1315
|
init(config: TConfig): Promise<void>;
|
|
1616
1316
|
dispose(): Promise<void>;
|
|
1617
1317
|
getAvailableTransports(): TransportType[];
|
|
1618
1318
|
switchTransport(type: TransportType): Promise<void>;
|
|
1619
1319
|
searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
/** @deprecated Use searchDeviceTargets(). */
|
|
1623
|
-
listConnectionTargets(options?: SearchDevicesOptions): Promise<ConnectionTarget[]>;
|
|
1624
|
-
/** Connect or logically bind a selected search result and return a runtime-only operation id. */
|
|
1625
|
-
connectDevice(searchTargetId: string): Promise<Response<string>>;
|
|
1626
|
-
/** Explicit Device Manager binding: verify the existing identity before replacing its BLE locator. */
|
|
1627
|
-
bindBleDevice?(params: BindBleDeviceParams): Promise<Response<string>>;
|
|
1628
|
-
/** Resolve operation-first routing/selection and pin it. The caller must verify wallet identity before business calls. */
|
|
1629
|
-
acquireOperation?(connectId: string, context: IHardwareConnectionContext): Promise<Response<string>>;
|
|
1630
|
-
/** Release an operation owned by the caller. Disconnect events end matching operations automatically. */
|
|
1631
|
-
releaseOperation(operationId: string): Promise<void>;
|
|
1320
|
+
connectDevice(connectId: string): Promise<Response<string>>;
|
|
1321
|
+
disconnectDevice(connectId: string): Promise<void>;
|
|
1632
1322
|
getDeviceInfo(connectId: string, deviceId: string): Promise<Response<DeviceInfo>>;
|
|
1323
|
+
getSupportedChains(): ChainCapability[];
|
|
1633
1324
|
/** Abort the in-flight call. Omit connectId to cancel whatever is active. */
|
|
1634
1325
|
cancel(connectId?: string): void;
|
|
1635
1326
|
allNetworkGetAddress(connectId: string, deviceId: string, params: AllNetworkGetAddressParams): Promise<Response<AllNetworkAddressResponse[]>>;
|
|
@@ -1666,14 +1357,6 @@ interface SearchDevicesOptions {
|
|
|
1666
1357
|
* was discovered first.
|
|
1667
1358
|
*/
|
|
1668
1359
|
waitForAllTransports?: boolean;
|
|
1669
|
-
/**
|
|
1670
|
-
* Restrict discovery to one transport. A non-enumerable channel may return
|
|
1671
|
-
* a virtual connection target (for example Keystone QR), but discovery must
|
|
1672
|
-
* not start a wallet protocol or account-export interaction. The target is
|
|
1673
|
-
* resolved by the following `connectDevice()` call. Omit to scan everything
|
|
1674
|
-
* available.
|
|
1675
|
-
*/
|
|
1676
|
-
transportType?: ConnectionType;
|
|
1677
1360
|
}
|
|
1678
1361
|
|
|
1679
1362
|
interface EvmGetAddressParams extends PassphraseStateAware {
|
|
@@ -1797,14 +1480,6 @@ interface EvmSignTypedDataFull extends PassphraseStateAware {
|
|
|
1797
1480
|
primaryType: string;
|
|
1798
1481
|
message: Record<string, unknown>;
|
|
1799
1482
|
};
|
|
1800
|
-
/**
|
|
1801
|
-
* The dApp's original EIP-712 JSON, byte for byte. Vendors that hand the
|
|
1802
|
-
* device a serialized payload (Keystone) must prefer this over
|
|
1803
|
-
* re-stringifying `data`: a JSON round trip rewrites integer literals wider
|
|
1804
|
-
* than 2^53 and exponent forms, so the device would display and sign
|
|
1805
|
-
* something the dApp never sent.
|
|
1806
|
-
*/
|
|
1807
|
-
dataJson?: string;
|
|
1808
1483
|
metamaskV4Compat?: boolean;
|
|
1809
1484
|
showMessageHash?: boolean;
|
|
1810
1485
|
/**
|
|
@@ -1843,33 +1518,6 @@ interface IEvmMethods {
|
|
|
1843
1518
|
evmSignTypedData(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignTypedDataParams>>): Promise<Response<EvmSignature>>;
|
|
1844
1519
|
}
|
|
1845
1520
|
|
|
1846
|
-
/** Which `GET_VK` encoding the Ledger Zcash app should return. */
|
|
1847
|
-
type ZcashFullViewingKeyMode = 'ufvk' | 'orchardFvk';
|
|
1848
|
-
interface ZcashGetFullViewingKeyParams extends PassphraseStateAware {
|
|
1849
|
-
/** BIP44 account path `m/44'/133'/a'` (any deeper transparent path is accepted; only the account level is used). */
|
|
1850
|
-
path: string;
|
|
1851
|
-
/** Default `ufvk`. */
|
|
1852
|
-
mode?: ZcashFullViewingKeyMode;
|
|
1853
|
-
}
|
|
1854
|
-
interface ZcashFullViewingKey {
|
|
1855
|
-
path: string;
|
|
1856
|
-
mode: ZcashFullViewingKeyMode;
|
|
1857
|
-
/** ZIP-316 bech32m UFVK string (mode `ufvk`). */
|
|
1858
|
-
ufvk?: string;
|
|
1859
|
-
/** 96-byte raw Orchard FVK as hex (mode `orchardFvk`). */
|
|
1860
|
-
orchardFvk?: string;
|
|
1861
|
-
}
|
|
1862
|
-
interface ZcashGetShieldedAddressParams extends PassphraseStateAware {
|
|
1863
|
-
/** Full 5-level transparent path `m/44'/133'/a'/0/i`; the Orchard path is derived from it. */
|
|
1864
|
-
path: string;
|
|
1865
|
-
showOnDevice?: boolean;
|
|
1866
|
-
}
|
|
1867
|
-
interface ZcashShieldedAddress {
|
|
1868
|
-
/** Unified address with a single Orchard receiver. */
|
|
1869
|
-
address: string;
|
|
1870
|
-
path: string;
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
1521
|
/**
|
|
1874
1522
|
* Low-level device descriptor from Transport layer.
|
|
1875
1523
|
* Represents a physical device detected by USB/BLE scanning.
|
|
@@ -1915,18 +1563,14 @@ interface DeviceDisconnectEvent {
|
|
|
1915
1563
|
type DeviceChangeEvent = DeviceConnectEvent | DeviceDisconnectEvent;
|
|
1916
1564
|
|
|
1917
1565
|
/**
|
|
1918
|
-
*
|
|
1919
|
-
*
|
|
1920
|
-
*
|
|
1921
|
-
*
|
|
1922
|
-
*
|
|
1923
|
-
*
|
|
1924
|
-
*
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1927
|
-
* The queue never decides whether to interrupt or ask the user; the caller owns
|
|
1928
|
-
* that. `getActiveJob()` reads synchronously so a UI handler can look, decide,
|
|
1929
|
-
* 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.
|
|
1930
1574
|
*/
|
|
1931
1575
|
interface JobOptions {
|
|
1932
1576
|
label?: string;
|
|
@@ -1938,15 +1582,10 @@ interface ActiveJobInfo {
|
|
|
1938
1582
|
label?: string;
|
|
1939
1583
|
startedAt: number;
|
|
1940
1584
|
}
|
|
1941
|
-
interface CancelScopeHandle {
|
|
1942
|
-
signal: AbortSignal;
|
|
1943
|
-
release: () => void;
|
|
1944
|
-
}
|
|
1945
1585
|
declare class DeviceJobQueue {
|
|
1946
1586
|
private _tail;
|
|
1947
1587
|
private _active;
|
|
1948
1588
|
private readonly _jobs;
|
|
1949
|
-
private readonly _cancelScopes;
|
|
1950
1589
|
/** Incremented on clear() so queued-but-not-yet-running jobs detect invalidation. */
|
|
1951
1590
|
private _generation;
|
|
1952
1591
|
private readonly _generationCancelReasons;
|
|
@@ -1955,77 +1594,21 @@ declare class DeviceJobQueue {
|
|
|
1955
1594
|
* `deviceId` is a label only — used by inspection / cancellation routing.
|
|
1956
1595
|
*/
|
|
1957
1596
|
enqueue<T>(deviceId: string, job: (signal: AbortSignal) => Promise<T>, options?: JobOptions): Promise<T>;
|
|
1958
|
-
/**
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
* signal before each item. Callers must `release()` when the bundle ends.
|
|
1966
|
-
*/
|
|
1967
|
-
createCancelScope(deviceId: string): CancelScopeHandle;
|
|
1968
|
-
/**
|
|
1969
|
-
* Cancel the running job. `reason` becomes signal.reason.
|
|
1970
|
-
*
|
|
1971
|
-
* No caller today: every adapter cancel wants the queued work invalidated
|
|
1972
|
-
* too and uses `cancelActiveAndPending`. Kept for a connector layer that
|
|
1973
|
-
* needs to stop only what is on the wire and leave the queue behind it.
|
|
1974
|
-
*/
|
|
1975
|
-
cancelActive(deviceId?: string, reason?: Error): boolean;
|
|
1976
|
-
/**
|
|
1977
|
-
* Cancel the active job and invalidate queued jobs that have not started.
|
|
1978
|
-
*
|
|
1979
|
-
* Only `undefined` means "everything". An empty string is a queue key that
|
|
1980
|
-
* derived to nothing, so it matches nothing and reports `false` rather than
|
|
1981
|
-
* silently tearing the whole queue down.
|
|
1982
|
-
*
|
|
1983
|
-
* Returns what the cancel actually reached, not whether it was accepted.
|
|
1984
|
-
*/
|
|
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. */
|
|
1985
1604
|
cancelActiveAndPending(deviceId?: string, reason?: Error): boolean;
|
|
1986
1605
|
/** Get info about the currently active job, or null if idle. */
|
|
1987
1606
|
getActiveJob(deviceId?: string): ActiveJobInfo | null;
|
|
1607
|
+
/** True if any job is currently running. */
|
|
1608
|
+
isBusy(): boolean;
|
|
1988
1609
|
clear(reason?: Error): void;
|
|
1989
1610
|
}
|
|
1990
1611
|
|
|
1991
|
-
declare const HARDWARE_RUNTIME_ID_PREFIX = "hwk:runtime";
|
|
1992
|
-
/**
|
|
1993
|
-
* Scopes a runtime id can name. Each is a different lifetime, and none of them
|
|
1994
|
-
* nests cleanly inside another:
|
|
1995
|
-
*
|
|
1996
|
-
* - `search-target` — one device in one discovery snapshot. Dies on the next
|
|
1997
|
-
* search of the same kind, so a stale pick is refused rather than silently
|
|
1998
|
-
* resolved against a different unit.
|
|
1999
|
-
* - `link` — one open transport. Outlives the snapshot that produced it.
|
|
2000
|
-
* - `operation` — one business operation. Outlives the link: `rebind()` swaps
|
|
2001
|
-
* the transport underneath while the id stays the same.
|
|
2002
|
-
*/
|
|
2003
|
-
type HardwareRuntimeIdKind = 'operation' | 'search-target' | 'link';
|
|
2004
|
-
type HardwareRuntimeId = {
|
|
2005
|
-
kind: HardwareRuntimeIdKind;
|
|
2006
|
-
vendor: VendorType;
|
|
2007
|
-
};
|
|
2008
|
-
/** Runtime ids are opaque and must never be persisted as device identity. */
|
|
2009
|
-
declare function createHardwareOperationId(vendor: VendorType): string;
|
|
2010
|
-
/** Search targets are valid only for the adapter's current discovery snapshot. */
|
|
2011
|
-
declare function createHardwareSearchTargetId(vendor: VendorType): string;
|
|
2012
|
-
declare function createHardwareLinkId(vendor: VendorType): string;
|
|
2013
|
-
declare function hasHardwareRuntimeIdPrefix(value: unknown): value is string;
|
|
2014
|
-
declare function parseHardwareRuntimeId(value: unknown): HardwareRuntimeId | undefined;
|
|
2015
|
-
declare function isHardwareOperationId(value: unknown): value is string;
|
|
2016
|
-
|
|
2017
|
-
interface HardwareOperationTarget {
|
|
2018
|
-
/** Effective target accepted by existing adapter/connector call paths. */
|
|
2019
|
-
targetId: string | undefined;
|
|
2020
|
-
/** Present when this operation is pinned to a live operation. */
|
|
2021
|
-
operationId: string | undefined;
|
|
2022
|
-
}
|
|
2023
|
-
/**
|
|
2024
|
-
* Normalizes the transitional positional operation id and the canonical
|
|
2025
|
-
* common-params field. All vendors must reject conflicting bindings.
|
|
2026
|
-
*/
|
|
2027
|
-
declare function resolveHardwareOperationTarget(positionalTargetId: string | null | undefined, commonOperationId: string | null | undefined, expectedVendor?: VendorType): Response<HardwareOperationTarget>;
|
|
2028
|
-
|
|
2029
1612
|
/**
|
|
2030
1613
|
* Minimal typed event emitter using Map<string, Set<listener>>.
|
|
2031
1614
|
* Each adapter uses this for device events (connect, disconnect, pin, etc.).
|
|
@@ -2052,104 +1635,6 @@ declare class TypedEventEmitter<TMap extends Record<string, any> = Record<string
|
|
|
2052
1635
|
listenerCount(event: string): number;
|
|
2053
1636
|
}
|
|
2054
1637
|
|
|
2055
|
-
/** Serializable BLE transport data shared by Electron main and renderer runtimes. */
|
|
2056
|
-
interface ElectronBleDeviceInfo {
|
|
2057
|
-
id: string;
|
|
2058
|
-
name?: string;
|
|
2059
|
-
rssi?: number;
|
|
2060
|
-
advertisedServiceUuids?: string[];
|
|
2061
|
-
}
|
|
2062
|
-
/**
|
|
2063
|
-
* How the main process recognizes one vendor's peripherals. Everything here
|
|
2064
|
-
* crosses IPC, so it is data rather than predicates: the handler owns no
|
|
2065
|
-
* vendor knowledge of its own. A peripheral matches when it advertises one of
|
|
2066
|
-
* `serviceUuids`, or when its local name matches every entry in
|
|
2067
|
-
* `namePatterns` (each is a case-insensitive regular expression source, so a
|
|
2068
|
-
* single entry can carry alternations).
|
|
2069
|
-
*/
|
|
2070
|
-
interface ElectronBleMatch {
|
|
2071
|
-
serviceUuids?: string[];
|
|
2072
|
-
namePatterns?: string[];
|
|
2073
|
-
}
|
|
2074
|
-
interface ElectronBleScanOptions {
|
|
2075
|
-
/** Opaque partition key: results and connected devices never mix across it. */
|
|
2076
|
-
vendor?: string;
|
|
2077
|
-
match?: ElectronBleMatch;
|
|
2078
|
-
/** @deprecated Superseded by `match.serviceUuids`. */
|
|
2079
|
-
serviceUuids?: string[];
|
|
2080
|
-
durationMs?: number;
|
|
2081
|
-
}
|
|
2082
|
-
/** GATT profile plus the write framing this vendor's firmware expects. */
|
|
2083
|
-
interface ElectronBleConnectOptions {
|
|
2084
|
-
vendor: string;
|
|
2085
|
-
serviceUuid: string;
|
|
2086
|
-
writeUuid: string;
|
|
2087
|
-
notifyUuid: string;
|
|
2088
|
-
/**
|
|
2089
|
-
* `padded` splits into fixed `chunkSize` packets, zero-filling the last one
|
|
2090
|
-
* — Trezor firmware silently drops a short packet. `raw` writes the buffer
|
|
2091
|
-
* as given, for framing that carries its own length (Ledger).
|
|
2092
|
-
*/
|
|
2093
|
-
write?: {
|
|
2094
|
-
mode: 'padded' | 'raw';
|
|
2095
|
-
chunkSize?: number;
|
|
2096
|
-
chunkDelayMs?: number;
|
|
2097
|
-
maxLength?: number;
|
|
2098
|
-
};
|
|
2099
|
-
}
|
|
2100
|
-
/** Native code handles GATT only; framing, identity checks and wallet operations stay in the SDK. */
|
|
2101
|
-
interface ElectronBleApi {
|
|
2102
|
-
scan(options?: ElectronBleScanOptions): Promise<ElectronBleDeviceInfo[]>;
|
|
2103
|
-
stopScan(): Promise<void>;
|
|
2104
|
-
connect(id: string, options?: ElectronBleConnectOptions): Promise<{
|
|
2105
|
-
id: string;
|
|
2106
|
-
name?: string;
|
|
2107
|
-
}>;
|
|
2108
|
-
disconnect(id: string): Promise<void>;
|
|
2109
|
-
subscribe(id: string): Promise<void>;
|
|
2110
|
-
unsubscribe(id: string): Promise<void>;
|
|
2111
|
-
write(id: string, hexData: string): Promise<void>;
|
|
2112
|
-
checkAvailability(): Promise<{
|
|
2113
|
-
available: boolean;
|
|
2114
|
-
state: string;
|
|
2115
|
-
initialized: boolean;
|
|
2116
|
-
}>;
|
|
2117
|
-
getDevice(id: string): Promise<ElectronBleDeviceInfo | null>;
|
|
2118
|
-
onNotification(handler: (id: string, hexData: string) => void): () => void;
|
|
2119
|
-
onDeviceDisconnected(handler: (id: string) => void): () => void;
|
|
2120
|
-
}
|
|
2121
|
-
|
|
2122
|
-
/**
|
|
2123
|
-
* The outcome of asking the host to persist a verified binding. A refusal is
|
|
2124
|
-
* reported, never thrown: by this point the SDK has already verified that the
|
|
2125
|
-
* connected wallet is the one the operation expects, so anything the host says
|
|
2126
|
-
* back is about the host's own records. Losing the binding is worth a warning
|
|
2127
|
-
* and a retry next time; it is not a reason to fail work the user asked for.
|
|
2128
|
-
*/
|
|
2129
|
-
type SaveDeviceBindingOutcome = {
|
|
2130
|
-
saved: true;
|
|
2131
|
-
} | {
|
|
2132
|
-
saved: false;
|
|
2133
|
-
reason: SaveDeviceBindingDeclineReason;
|
|
2134
|
-
};
|
|
2135
|
-
/** Persist a verified binding through the host. Only a user abort throws. */
|
|
2136
|
-
declare function requestSaveDeviceBinding(emitter: TypedEventEmitter<HardwareEventMap>, registry: UiRequestRegistry, binding: Omit<SaveDeviceBindingRequest, 'requestId'>, signal?: AbortSignal): Promise<SaveDeviceBindingOutcome>;
|
|
2137
|
-
|
|
2138
|
-
/** Discovery and selection share one owner; never connect until the last scan has drained. */
|
|
2139
|
-
declare function requestBleDeviceSelection({ emitter, registry, request, scan, signal, allowUsbFallback, pollIntervalMs, }: {
|
|
2140
|
-
emitter: TypedEventEmitter<HardwareEventMap>;
|
|
2141
|
-
registry: UiRequestRegistry;
|
|
2142
|
-
request: Omit<DeviceSelectionRequest, 'requestId' | 'scanning'>;
|
|
2143
|
-
scan: () => Promise<DeviceInfo[]>;
|
|
2144
|
-
signal: AbortSignal;
|
|
2145
|
-
/** The adapter must verify a returned USB candidate before dispatching any business call. */
|
|
2146
|
-
allowUsbFallback?: boolean;
|
|
2147
|
-
pollIntervalMs?: number;
|
|
2148
|
-
}): Promise<{
|
|
2149
|
-
device: DeviceInfo;
|
|
2150
|
-
requestId: string;
|
|
2151
|
-
}>;
|
|
2152
|
-
|
|
2153
1638
|
/**
|
|
2154
1639
|
* Compare two semver strings (e.g. "2.1.0" vs "2.3.1").
|
|
2155
1640
|
* Returns -1 if a < b, 0 if equal, 1 if a > b.
|
|
@@ -2170,18 +1655,7 @@ declare function hexToBytes(hex: string): Uint8Array;
|
|
|
2170
1655
|
/** Convert a Uint8Array to a hex string (no 0x prefix). */
|
|
2171
1656
|
declare function bytesToHex(bytes: Uint8Array): string;
|
|
2172
1657
|
|
|
2173
|
-
|
|
2174
|
-
message: Uint8Array;
|
|
2175
|
-
requiredSigners: readonly string[];
|
|
2176
|
-
}
|
|
2177
|
-
interface PreparedSolanaOffchainMessageV1 {
|
|
2178
|
-
messageText: string;
|
|
2179
|
-
requiredSigners: string[];
|
|
2180
|
-
serializedMessage: Uint8Array;
|
|
2181
|
-
}
|
|
2182
|
-
declare function prepareSolanaOffchainMessageV1({ message, requiredSigners, }: PrepareSolanaOffchainMessageV1Params): PreparedSolanaOffchainMessageV1;
|
|
2183
|
-
|
|
2184
|
-
type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger' | 'keystone';
|
|
1658
|
+
type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger';
|
|
2185
1659
|
type HardwareDeviceIdentityInput = {
|
|
2186
1660
|
name?: string | null;
|
|
2187
1661
|
localName?: string | null;
|
|
@@ -2244,19 +1718,8 @@ type RunAllNetworkGetAddressOptions = {
|
|
|
2244
1718
|
buildTopLevelFailure?: (response: AllNetworkAddressResponse, context: AllNetworkResponseContext) => Response<AllNetworkAddressResponse[]>;
|
|
2245
1719
|
};
|
|
2246
1720
|
declare function runAllNetworkGetAddress({ connectId, deviceId, params, getMethodChain, normalizeItem, buildUnsupportedNetworkResponse, callItem, attachIdentity, shouldAbortBundle, buildTopLevelFailure, }: RunAllNetworkGetAddressOptions): Promise<Response<AllNetworkAddressResponse[]>>;
|
|
2247
|
-
/**
|
|
2248
|
-
* User said "no": an SDK-dialog cancel and an on-device reject both end the
|
|
2249
|
-
* bundle. Asking the device for the next chain after a refusal is a prompt the
|
|
2250
|
-
* user already answered.
|
|
2251
|
-
*/
|
|
2252
|
-
declare function isUserRefusal(code: HardwareErrorCode | number | undefined): boolean;
|
|
2253
|
-
/**
|
|
2254
|
-
* The session the bundle runs on is gone, so the remaining items have nothing
|
|
2255
|
-
* to run against.
|
|
2256
|
-
*/
|
|
2257
|
-
declare function isConnectionLost(code: HardwareErrorCode | number | undefined): boolean;
|
|
2258
1721
|
declare function buildUnsupportedMethodResponse(item: AllNetworkAddressParams): AllNetworkAddressResponse;
|
|
2259
1722
|
|
|
2260
1723
|
declare const DEVICE_CONNECT_RETRY_DELAY_MS = 1000;
|
|
2261
1724
|
|
|
2262
|
-
export { ALL_NETWORK_METHOD_NAMES, type ActiveJobInfo, type AllNetworkAddressParams, type AllNetworkAddressResponse, type AllNetworkAddressResponsePayload, type AllNetworkAttachIdentityContext, type AllNetworkCallItemContext, type
|
|
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 };
|