@onekeyfe/hwk-adapter-core 1.2.3-alpha.1 → 1.2.3-alpha.10
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-RRCFH7X6.js → chunk-BAGEFFFY.js} +3 -32
- package/dist/chunk-BAGEFFFY.js.map +1 -0
- package/dist/{chunk-IZEVYMJK.js → chunk-SZZF623R.js} +55 -142
- package/dist/chunk-SZZF623R.js.map +1 -0
- package/dist/{chunk-KCIK56B5.mjs → chunk-U63HTLGJ.mjs} +2 -31
- package/dist/chunk-U63HTLGJ.mjs.map +1 -0
- package/dist/{chunk-72KOSYTH.mjs → chunk-YA4BWFTZ.mjs} +55 -142
- 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 +57 -530
- package/dist/index.d.ts +57 -530
- package/dist/index.js +58 -600
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -591
- package/dist/index.mjs.map +1 -1
- package/dist/{ui-events-BXI9BBpx.d.ts → ui-events-Cb7haAeE.d.mts} +3 -19
- package/dist/{ui-events-BXI9BBpx.d.mts → ui-events-Cb7haAeE.d.ts} +3 -19
- 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-3M3GMF64.mjs +0 -68
- package/dist/chunk-3M3GMF64.mjs.map +0 -1
- package/dist/chunk-72KOSYTH.mjs.map +0 -1
- package/dist/chunk-7SFFS2NL.js +0 -68
- package/dist/chunk-7SFFS2NL.js.map +0 -1
- package/dist/chunk-IZEVYMJK.js.map +0 -1
- package/dist/chunk-KCIK56B5.mjs.map +0 -1
- package/dist/chunk-RRCFH7X6.js.map +0 -1
- package/dist/errors-ChA_YEZY.d.mts +0 -296
- package/dist/errors-ChA_YEZY.d.ts +0 -296
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { U as UiResponseEvent, a as UI_REQUEST, Q as QrDisplayData
|
|
4
|
-
export { D as DevicePermissionDeniedReason,
|
|
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
|
|
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;
|
|
@@ -499,10 +383,6 @@ declare const DEVICE: {
|
|
|
499
383
|
readonly DISCONNECT: "device-disconnect";
|
|
500
384
|
readonly CHANGED: "device-changed";
|
|
501
385
|
readonly FEATURES: "features";
|
|
502
|
-
/** Trezor transport binding, emitted only after matching the expected firmware device_id. */
|
|
503
|
-
readonly TREZOR_CONNECTION_VERIFIED: "device-trezor-connection-verified";
|
|
504
|
-
/** Ledger BLE address repair, emitted only after matching the stored chain fingerprint. */
|
|
505
|
-
readonly LEDGER_CONNECTION_VERIFIED: "device-ledger-connection-verified";
|
|
506
386
|
/**
|
|
507
387
|
* Trezor-only. Emitted after a successful THP handshake that minted or
|
|
508
388
|
* refreshed pairing credentials. The host should persist `credentials`
|
|
@@ -701,21 +581,11 @@ interface SolSignedTx {
|
|
|
701
581
|
/** Hex-encoded Ed25519 signature (no 0x prefix) */
|
|
702
582
|
signature: string;
|
|
703
583
|
}
|
|
704
|
-
interface
|
|
584
|
+
interface SolSignMsgParams extends PassphraseStateAware {
|
|
705
585
|
path: string;
|
|
706
586
|
/** Message bytes as hex string (no 0x prefix) */
|
|
707
587
|
message: string;
|
|
708
588
|
}
|
|
709
|
-
interface SolOffchainMessageV1Params {
|
|
710
|
-
/** Finalized Solana off-chain message format. */
|
|
711
|
-
messageVersion: 1;
|
|
712
|
-
/** Complete signer set as 32-byte hex public keys. */
|
|
713
|
-
requiredSigners: string[];
|
|
714
|
-
}
|
|
715
|
-
type SolSignMsgParams = SolSignMessageBaseParams & ({
|
|
716
|
-
messageVersion?: undefined;
|
|
717
|
-
requiredSigners?: undefined;
|
|
718
|
-
} | SolOffchainMessageV1Params);
|
|
719
589
|
interface SolSignature {
|
|
720
590
|
/** Hex-encoded Ed25519 signature (no 0x prefix) */
|
|
721
591
|
signature: string;
|
|
@@ -842,12 +712,6 @@ interface TronSignMsgParams extends PassphraseStateAware {
|
|
|
842
712
|
path: string;
|
|
843
713
|
/** Message hex (no 0x prefix) */
|
|
844
714
|
messageHex: string;
|
|
845
|
-
/**
|
|
846
|
-
* TRON message scheme: 'V1' = legacy signMessage (prefix + 32-byte hash),
|
|
847
|
-
* 'V2' = TIP-191 signMessageV2 (prefix + byte length + message). Adapters
|
|
848
|
-
* that only implement one scheme reject the other with MethodNotSupported.
|
|
849
|
-
*/
|
|
850
|
-
messageType?: 'V1' | 'V2';
|
|
851
715
|
}
|
|
852
716
|
interface TronSignature {
|
|
853
717
|
/** 65-byte hex-encoded signature (no 0x prefix) */
|
|
@@ -859,160 +723,100 @@ interface ITronMethods {
|
|
|
859
723
|
tronSignMessage(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<TronSignMsgParams>>): Promise<Response<TronSignature>>;
|
|
860
724
|
}
|
|
861
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
|
+
|
|
862
744
|
/** Events generated by SDK internal detection (not from hardware directly). */
|
|
863
745
|
declare const SDK: {
|
|
864
746
|
readonly DEVICE_STUCK: "device-stuck";
|
|
865
747
|
readonly DEVICE_UNRESPONSIVE: "device-unresponsive";
|
|
866
748
|
readonly DEVICE_RECOVERED: "device-recovered";
|
|
867
749
|
readonly DEVICE_INTERACTION: "device-interaction";
|
|
868
|
-
readonly INTERACTION_ENDED: "interaction-ended";
|
|
869
750
|
};
|
|
870
751
|
|
|
871
|
-
declare const INTERACTION_DEFAULT_TTL_MS = 600000;
|
|
872
|
-
type InteractionEndReason = 'explicit' | 'disconnect' | 'timeout' | 'runtime-reset';
|
|
873
|
-
type HardwareInteraction = {
|
|
874
|
-
interactionId: string;
|
|
875
|
-
searchTargetId: string;
|
|
876
|
-
connectId: string;
|
|
877
|
-
device: DeviceInfo;
|
|
878
|
-
connectionKeys: string[];
|
|
879
|
-
createdAt: number;
|
|
880
|
-
lastActiveAt: number;
|
|
881
|
-
};
|
|
882
|
-
type InteractionRegistryOptions = {
|
|
883
|
-
vendor: VendorType;
|
|
884
|
-
ttlMs?: number;
|
|
885
|
-
onEnded?: (interaction: HardwareInteraction, reason: InteractionEndReason) => void;
|
|
886
|
-
};
|
|
887
|
-
/** Runtime-only association between a public interaction id and one live target. */
|
|
888
|
-
declare class InteractionRegistry {
|
|
889
|
-
private readonly _vendor;
|
|
890
|
-
private readonly _ttlMs;
|
|
891
|
-
private readonly _onEnded?;
|
|
892
|
-
private readonly _active;
|
|
893
|
-
private readonly _ended;
|
|
894
|
-
constructor(options: InteractionRegistryOptions);
|
|
895
|
-
create(params: {
|
|
896
|
-
searchTargetId: string;
|
|
897
|
-
connectId: string;
|
|
898
|
-
device: DeviceInfo;
|
|
899
|
-
connectionKeys?: string[];
|
|
900
|
-
}): HardwareInteraction;
|
|
901
|
-
resolve(interactionId: string): HardwareInteraction;
|
|
902
|
-
/** Keep an interaction alive while one device job is actively using it. */
|
|
903
|
-
retain(interactionId: string): () => void;
|
|
904
|
-
/** Return active or tombstoned binding data without refreshing its TTL. */
|
|
905
|
-
find(interactionId: string): HardwareInteraction | undefined;
|
|
906
|
-
findActiveByConnectionKey(connectionKey: string): HardwareInteraction | undefined;
|
|
907
|
-
/** Replace the live transport binding after the same target was reconnected. */
|
|
908
|
-
rebind(interactionId: string, params: {
|
|
909
|
-
connectId: string;
|
|
910
|
-
device: DeviceInfo;
|
|
911
|
-
connectionKeys?: string[];
|
|
912
|
-
}): HardwareInteraction;
|
|
913
|
-
end(interactionId: string, reason: InteractionEndReason): HardwareInteraction | undefined;
|
|
914
|
-
endByConnectionKey(connectionKey: string, reason: InteractionEndReason, exceptInteractionId?: string): void;
|
|
915
|
-
endAll(reason: InteractionEndReason, exceptInteractionId?: string): void;
|
|
916
|
-
private _createTimer;
|
|
917
|
-
private _rememberEnded;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
752
|
type HardwareMethodMetadata = {
|
|
921
753
|
chain: ChainForFingerprint;
|
|
922
754
|
allNetwork: boolean;
|
|
923
|
-
/** Whether repeating the method after an ambiguous transport failure is safe. */
|
|
924
|
-
replayAfterTransportFailure: 'safe' | 'unsafe';
|
|
925
755
|
};
|
|
926
756
|
declare const HARDWARE_METHOD_CATALOG: {
|
|
927
757
|
readonly evmGetAddress: {
|
|
928
758
|
readonly chain: "evm";
|
|
929
759
|
readonly allNetwork: true;
|
|
930
|
-
readonly replayAfterTransportFailure: "safe";
|
|
931
760
|
};
|
|
932
761
|
readonly evmSignTransaction: {
|
|
933
762
|
readonly chain: "evm";
|
|
934
763
|
readonly allNetwork: false;
|
|
935
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
936
764
|
};
|
|
937
765
|
readonly evmSignMessage: {
|
|
938
766
|
readonly chain: "evm";
|
|
939
767
|
readonly allNetwork: false;
|
|
940
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
941
768
|
};
|
|
942
769
|
readonly evmSignTypedData: {
|
|
943
770
|
readonly chain: "evm";
|
|
944
771
|
readonly allNetwork: false;
|
|
945
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
946
772
|
};
|
|
947
773
|
readonly btcGetAddress: {
|
|
948
774
|
readonly chain: "btc";
|
|
949
775
|
readonly allNetwork: true;
|
|
950
|
-
readonly replayAfterTransportFailure: "safe";
|
|
951
776
|
};
|
|
952
777
|
readonly btcGetPublicKey: {
|
|
953
778
|
readonly chain: "btc";
|
|
954
779
|
readonly allNetwork: true;
|
|
955
|
-
readonly replayAfterTransportFailure: "safe";
|
|
956
780
|
};
|
|
957
781
|
readonly btcSignTransaction: {
|
|
958
782
|
readonly chain: "btc";
|
|
959
783
|
readonly allNetwork: false;
|
|
960
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
961
784
|
};
|
|
962
785
|
readonly btcSignPsbt: {
|
|
963
786
|
readonly chain: "btc";
|
|
964
787
|
readonly allNetwork: false;
|
|
965
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
966
788
|
};
|
|
967
789
|
readonly btcSignMessage: {
|
|
968
790
|
readonly chain: "btc";
|
|
969
791
|
readonly allNetwork: false;
|
|
970
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
971
792
|
};
|
|
972
793
|
readonly btcGetMasterFingerprint: {
|
|
973
794
|
readonly chain: "btc";
|
|
974
795
|
readonly allNetwork: false;
|
|
975
|
-
readonly replayAfterTransportFailure: "safe";
|
|
976
796
|
};
|
|
977
797
|
readonly solGetAddress: {
|
|
978
798
|
readonly chain: "sol";
|
|
979
799
|
readonly allNetwork: true;
|
|
980
|
-
readonly replayAfterTransportFailure: "safe";
|
|
981
800
|
};
|
|
982
801
|
readonly solSignTransaction: {
|
|
983
802
|
readonly chain: "sol";
|
|
984
803
|
readonly allNetwork: false;
|
|
985
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
986
804
|
};
|
|
987
805
|
readonly solSignMessage: {
|
|
988
806
|
readonly chain: "sol";
|
|
989
807
|
readonly allNetwork: false;
|
|
990
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
991
808
|
};
|
|
992
809
|
readonly tronGetAddress: {
|
|
993
810
|
readonly chain: "tron";
|
|
994
811
|
readonly allNetwork: true;
|
|
995
|
-
readonly replayAfterTransportFailure: "safe";
|
|
996
812
|
};
|
|
997
813
|
readonly tronSignTransaction: {
|
|
998
814
|
readonly chain: "tron";
|
|
999
815
|
readonly allNetwork: false;
|
|
1000
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
1001
816
|
};
|
|
1002
817
|
readonly tronSignMessage: {
|
|
1003
818
|
readonly chain: "tron";
|
|
1004
819
|
readonly allNetwork: false;
|
|
1005
|
-
readonly replayAfterTransportFailure: "unsafe";
|
|
1006
|
-
};
|
|
1007
|
-
readonly zcashGetFullViewingKey: {
|
|
1008
|
-
readonly chain: "zcash";
|
|
1009
|
-
readonly allNetwork: false;
|
|
1010
|
-
readonly replayAfterTransportFailure: "safe";
|
|
1011
|
-
};
|
|
1012
|
-
readonly zcashGetShieldedAddress: {
|
|
1013
|
-
readonly chain: "zcash";
|
|
1014
|
-
readonly allNetwork: false;
|
|
1015
|
-
readonly replayAfterTransportFailure: "safe";
|
|
1016
820
|
};
|
|
1017
821
|
};
|
|
1018
822
|
type HardwareMethodName = keyof typeof HARDWARE_METHOD_CATALOG;
|
|
@@ -1021,11 +825,6 @@ type AllNetworkMethodName = {
|
|
|
1021
825
|
}[HardwareMethodName];
|
|
1022
826
|
declare const ALL_NETWORK_METHOD_NAMES: AllNetworkMethodName[];
|
|
1023
827
|
declare function getHardwareMethodMetadata(method: string): HardwareMethodMetadata | undefined;
|
|
1024
|
-
/**
|
|
1025
|
-
* Conservative replay gate used only after a call may have reached hardware.
|
|
1026
|
-
* Unknown methods and device mutations are unsafe by default.
|
|
1027
|
-
*/
|
|
1028
|
-
declare function canReplayHardwareMethodAfterTransportFailure(method: string): boolean;
|
|
1029
828
|
declare function isAllNetworkMethodName(method: string): method is AllNetworkMethodName;
|
|
1030
829
|
declare function getAllNetworkMethodChain(method: AllNetworkMethodName): ChainForFingerprint;
|
|
1031
830
|
|
|
@@ -1044,7 +843,7 @@ type HardwareUiEvent = Exclude<ConnectorUiEvent, {
|
|
|
1044
843
|
progress: number;
|
|
1045
844
|
};
|
|
1046
845
|
};
|
|
1047
|
-
type ChainCapability = 'evm' | 'btc' | 'sol' | 'tron'
|
|
846
|
+
type ChainCapability = 'evm' | 'btc' | 'sol' | 'tron';
|
|
1048
847
|
type TrezorDisplayRotation = 'North' | 'East' | 'South' | 'West';
|
|
1049
848
|
type TrezorSafetyCheckLevel = 'Strict' | 'PromptAlways' | 'PromptTemporarily';
|
|
1050
849
|
type TrezorDeviceSettingsParams = {
|
|
@@ -1121,67 +920,13 @@ type DeviceAuthenticityResult = {
|
|
|
1121
920
|
* that aren't specific to one chain. Vendor-specific options can be added
|
|
1122
921
|
* as typed sub-fields here when a vendor actually needs them.
|
|
1123
922
|
*/
|
|
1124
|
-
|
|
1125
|
-
type KnownDeviceConnection = {
|
|
1126
|
-
transport: 'usb' | 'ble';
|
|
1127
|
-
connectId: string;
|
|
1128
|
-
} | {
|
|
1129
|
-
transport: 'qr';
|
|
1130
|
-
};
|
|
1131
|
-
/** Opaque host lookup identifiers. Never forward these to firmware or logs. */
|
|
1132
|
-
type HardwareCallExtra = Readonly<Record<string, string>>;
|
|
1133
|
-
interface IHardwareConnectionContext {
|
|
1134
|
-
knownConnections?: readonly KnownDeviceConnection[];
|
|
1135
|
-
extra?: HardwareCallExtra;
|
|
1136
|
-
/** False makes discovery fail instead of asking the user to select a new endpoint. */
|
|
1137
|
-
allowDeviceSelection?: boolean;
|
|
1138
|
-
}
|
|
1139
|
-
type DeviceSelectionContext = {
|
|
1140
|
-
kind: 'select-device';
|
|
1141
|
-
transport: 'usb';
|
|
1142
|
-
reason: 'multiple-candidates';
|
|
1143
|
-
} | {
|
|
1144
|
-
kind: 'bind-connection';
|
|
1145
|
-
transport: 'ble';
|
|
1146
|
-
reason: 'missing-binding' | 'known-connection-unavailable';
|
|
1147
|
-
};
|
|
1148
|
-
interface DeviceSelectionRequest {
|
|
1149
|
-
devices: DeviceInfo[];
|
|
1150
|
-
requestId: string;
|
|
1151
|
-
context: DeviceSelectionContext;
|
|
1152
|
-
extra?: HardwareCallExtra;
|
|
1153
|
-
/** Repeated snapshots with this requestId update one SDK-owned binding scan. */
|
|
1154
|
-
scanning?: boolean;
|
|
1155
|
-
bindingSessionId?: string;
|
|
1156
|
-
/** A candidate rejected by SDK identity verification in this binding session. */
|
|
1157
|
-
rejectedConnectId?: string;
|
|
1158
|
-
}
|
|
1159
|
-
/** The SDK has verified this endpoint; the host must persist it before acknowledging. */
|
|
1160
|
-
interface SaveDeviceBindingRequest {
|
|
1161
|
-
requestId: string;
|
|
1162
|
-
selectionRequestId: string;
|
|
1163
|
-
connection: {
|
|
1164
|
-
transport: 'ble';
|
|
1165
|
-
connectId: string;
|
|
1166
|
-
};
|
|
1167
|
-
identity: Extract<WalletIdentity, {
|
|
1168
|
-
vendor: 'ledger' | 'trezor';
|
|
1169
|
-
}>;
|
|
1170
|
-
extra?: HardwareCallExtra;
|
|
1171
|
-
}
|
|
1172
|
-
interface DeviceBindingStatus {
|
|
1173
|
-
selectionRequestId: string;
|
|
1174
|
-
status: 'verifying' | 'saved' | 'failed' | 'cancelled';
|
|
1175
|
-
}
|
|
1176
|
-
interface ICommonCallParams extends IHardwareConnectionContext {
|
|
923
|
+
interface ICommonCallParams {
|
|
1177
924
|
/**
|
|
1178
925
|
* When the required device app is missing, prompt the user (UI request)
|
|
1179
926
|
* to install it, stream install progress, then retry the operation once.
|
|
1180
927
|
* Off by default — preserves the plain "app not installed" failure.
|
|
1181
928
|
*/
|
|
1182
929
|
autoInstallApp?: boolean;
|
|
1183
|
-
/** Runtime-only id returned by connectDevice(). When present, discovery and fallback are disabled. */
|
|
1184
|
-
interactionId?: string;
|
|
1185
930
|
}
|
|
1186
931
|
type NullableCallArg<T> = T | null | undefined;
|
|
1187
932
|
interface IPassphraseCallParams {
|
|
@@ -1190,15 +935,6 @@ interface IPassphraseCallParams {
|
|
|
1190
935
|
}
|
|
1191
936
|
type IHardwareCommonCallParams = ICommonCallParams & IPassphraseCallParams;
|
|
1192
937
|
type IHardwareCallParams<T> = T & IHardwareCommonCallParams;
|
|
1193
|
-
/**
|
|
1194
|
-
* Runtime-only context for device-manager operations. The expected identity
|
|
1195
|
-
* lets an adapter fail closed before a read or mutation is replayed after a
|
|
1196
|
-
* reconnect. It must never be forwarded to vendor firmware.
|
|
1197
|
-
*/
|
|
1198
|
-
interface IDeviceManagerOperationContext extends IHardwareConnectionContext {
|
|
1199
|
-
interactionId?: string;
|
|
1200
|
-
expectedDeviceIdentity?: WalletIdentity;
|
|
1201
|
-
}
|
|
1202
938
|
interface AllNetworkAddressParams {
|
|
1203
939
|
network: string;
|
|
1204
940
|
path: string;
|
|
@@ -1209,7 +945,16 @@ interface AllNetworkAddressParams {
|
|
|
1209
945
|
interface AllNetworkGetAddressParams extends IHardwareCommonCallParams {
|
|
1210
946
|
bundle: AllNetworkAddressParams[];
|
|
1211
947
|
}
|
|
1212
|
-
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
|
+
};
|
|
1213
958
|
type AllNetworkAddressResponsePayload = Record<string, unknown> & {
|
|
1214
959
|
error?: string;
|
|
1215
960
|
code?: HardwareErrorCode | number;
|
|
@@ -1217,7 +962,6 @@ type AllNetworkAddressResponsePayload = Record<string, unknown> & {
|
|
|
1217
962
|
connectId?: string;
|
|
1218
963
|
deviceId?: string;
|
|
1219
964
|
deviceIdentity?: AllNetworkDeviceIdentity;
|
|
1220
|
-
rootFingerprint?: number;
|
|
1221
965
|
chainFingerprint?: string;
|
|
1222
966
|
chainFingerprintChain?: ChainForFingerprint;
|
|
1223
967
|
params?: Record<string, unknown>;
|
|
@@ -1242,25 +986,6 @@ type DeviceEvent = {
|
|
|
1242
986
|
} | {
|
|
1243
987
|
type: typeof DEVICE.CHANGED;
|
|
1244
988
|
payload: DeviceInfo;
|
|
1245
|
-
} | {
|
|
1246
|
-
type: typeof DEVICE.LEDGER_CONNECTION_VERIFIED;
|
|
1247
|
-
payload: {
|
|
1248
|
-
previousConnectId: string;
|
|
1249
|
-
connectId: string;
|
|
1250
|
-
chain: ChainForFingerprint;
|
|
1251
|
-
fingerprint: string;
|
|
1252
|
-
extra?: HardwareCallExtra;
|
|
1253
|
-
selectionRequestId?: string;
|
|
1254
|
-
};
|
|
1255
|
-
} | {
|
|
1256
|
-
type: typeof DEVICE.TREZOR_CONNECTION_VERIFIED;
|
|
1257
|
-
payload: {
|
|
1258
|
-
deviceId: string;
|
|
1259
|
-
connectId: string;
|
|
1260
|
-
connectionType: TransportType;
|
|
1261
|
-
extra?: HardwareCallExtra;
|
|
1262
|
-
selectionRequestId?: string;
|
|
1263
|
-
};
|
|
1264
989
|
} | {
|
|
1265
990
|
type: typeof DEVICE.FEATURES;
|
|
1266
991
|
device: DeviceInfo & {
|
|
@@ -1322,13 +1047,9 @@ type UiRequestEvent = {
|
|
|
1322
1047
|
};
|
|
1323
1048
|
} | {
|
|
1324
1049
|
type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
|
|
1325
|
-
payload:
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
payload: SaveDeviceBindingRequest;
|
|
1329
|
-
} | {
|
|
1330
|
-
type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
|
|
1331
|
-
payload: DeviceBindingStatus;
|
|
1050
|
+
payload: {
|
|
1051
|
+
devices: DeviceInfo[];
|
|
1052
|
+
};
|
|
1332
1053
|
} | {
|
|
1333
1054
|
type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
|
|
1334
1055
|
payload: {
|
|
@@ -1388,12 +1109,6 @@ type SdkEvent = {
|
|
|
1388
1109
|
payload: {
|
|
1389
1110
|
connectId: string;
|
|
1390
1111
|
};
|
|
1391
|
-
} | {
|
|
1392
|
-
type: typeof SDK.INTERACTION_ENDED;
|
|
1393
|
-
payload: {
|
|
1394
|
-
interactionId: string;
|
|
1395
|
-
reason: InteractionEndReason;
|
|
1396
|
-
};
|
|
1397
1112
|
};
|
|
1398
1113
|
type HardwareEvent = DeviceEvent | UiRequestEvent | SdkEvent | HardwareUiEvent;
|
|
1399
1114
|
type DeviceEventListener = (event: HardwareEvent) => void;
|
|
@@ -1404,14 +1119,6 @@ type DeviceEventListener = (event: HardwareEvent) => void;
|
|
|
1404
1119
|
* and the value is the narrowed event object the listener will receive.
|
|
1405
1120
|
*/
|
|
1406
1121
|
interface HardwareEventMap {
|
|
1407
|
-
[UI_REQUEST.DEVICE_BINDING_STATUS]: {
|
|
1408
|
-
type: typeof UI_REQUEST.DEVICE_BINDING_STATUS;
|
|
1409
|
-
payload: DeviceBindingStatus;
|
|
1410
|
-
};
|
|
1411
|
-
[UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING]: {
|
|
1412
|
-
type: typeof UI_REQUEST.REQUEST_SAVE_DEVICE_BINDING;
|
|
1413
|
-
payload: SaveDeviceBindingRequest;
|
|
1414
|
-
};
|
|
1415
1122
|
'ui-event': HardwareUiEvent;
|
|
1416
1123
|
[DEVICE.CONNECT]: {
|
|
1417
1124
|
type: typeof DEVICE.CONNECT;
|
|
@@ -1427,27 +1134,6 @@ interface HardwareEventMap {
|
|
|
1427
1134
|
type: typeof DEVICE.CHANGED;
|
|
1428
1135
|
payload: DeviceInfo;
|
|
1429
1136
|
};
|
|
1430
|
-
[DEVICE.LEDGER_CONNECTION_VERIFIED]: {
|
|
1431
|
-
type: typeof DEVICE.LEDGER_CONNECTION_VERIFIED;
|
|
1432
|
-
payload: {
|
|
1433
|
-
previousConnectId: string;
|
|
1434
|
-
connectId: string;
|
|
1435
|
-
chain: ChainForFingerprint;
|
|
1436
|
-
fingerprint: string;
|
|
1437
|
-
extra?: HardwareCallExtra;
|
|
1438
|
-
selectionRequestId?: string;
|
|
1439
|
-
};
|
|
1440
|
-
};
|
|
1441
|
-
[DEVICE.TREZOR_CONNECTION_VERIFIED]: {
|
|
1442
|
-
type: typeof DEVICE.TREZOR_CONNECTION_VERIFIED;
|
|
1443
|
-
payload: {
|
|
1444
|
-
deviceId: string;
|
|
1445
|
-
connectId: string;
|
|
1446
|
-
connectionType: TransportType;
|
|
1447
|
-
extra?: HardwareCallExtra;
|
|
1448
|
-
selectionRequestId?: string;
|
|
1449
|
-
};
|
|
1450
|
-
};
|
|
1451
1137
|
[DEVICE.FEATURES]: {
|
|
1452
1138
|
type: typeof DEVICE.FEATURES;
|
|
1453
1139
|
device: DeviceInfo & {
|
|
@@ -1520,7 +1206,9 @@ interface HardwareEventMap {
|
|
|
1520
1206
|
};
|
|
1521
1207
|
[UI_REQUEST.REQUEST_SELECT_DEVICE]: {
|
|
1522
1208
|
type: typeof UI_REQUEST.REQUEST_SELECT_DEVICE;
|
|
1523
|
-
payload:
|
|
1209
|
+
payload: {
|
|
1210
|
+
devices: DeviceInfo[];
|
|
1211
|
+
};
|
|
1524
1212
|
};
|
|
1525
1213
|
[UI_REQUEST.REQUEST_DEVICE_CONNECT]: {
|
|
1526
1214
|
type: typeof UI_REQUEST.REQUEST_DEVICE_CONNECT;
|
|
@@ -1583,23 +1271,16 @@ interface HardwareEventMap {
|
|
|
1583
1271
|
connectId: string;
|
|
1584
1272
|
};
|
|
1585
1273
|
};
|
|
1586
|
-
[SDK.INTERACTION_ENDED]: {
|
|
1587
|
-
type: typeof SDK.INTERACTION_ENDED;
|
|
1588
|
-
payload: {
|
|
1589
|
-
interactionId: string;
|
|
1590
|
-
reason: InteractionEndReason;
|
|
1591
|
-
};
|
|
1592
|
-
};
|
|
1593
1274
|
}
|
|
1594
1275
|
interface IDeviceManagerMethods {
|
|
1595
|
-
getFeatures?(connectId: string
|
|
1596
|
-
deviceSettings?(connectId: string, params: TrezorDeviceSettingsParams
|
|
1597
|
-
setBrightness?(connectId: string, params?: TrezorBrightnessParams
|
|
1598
|
-
changePin?(connectId: string, params?: TrezorChangePinParams
|
|
1599
|
-
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>>>;
|
|
1600
1281
|
authenticateDevice?(connectId: string, params: {
|
|
1601
1282
|
challenge: string;
|
|
1602
|
-
}
|
|
1283
|
+
}): Promise<Response<Record<string, unknown>>>;
|
|
1603
1284
|
}
|
|
1604
1285
|
interface IWalletStateMethods {
|
|
1605
1286
|
/**
|
|
@@ -1626,7 +1307,7 @@ interface IWalletStateMethods {
|
|
|
1626
1307
|
* Optional: vendors without host-managed passphrase sessions (Ledger) omit
|
|
1627
1308
|
* it. Implemented by `TrezorAdapter`.
|
|
1628
1309
|
*/
|
|
1629
|
-
getPassphraseState?(connectId: string, passphraseState?: string
|
|
1310
|
+
getPassphraseState?(connectId: string, passphraseState?: string): Promise<Response<string | null>>;
|
|
1630
1311
|
}
|
|
1631
1312
|
interface IHardwareWallet<TConfig = unknown> extends IEvmMethods, IBtcMethods, ISolMethods, ITronMethods, IDeviceManagerMethods, IWalletStateMethods {
|
|
1632
1313
|
readonly vendor: string;
|
|
@@ -1636,16 +1317,8 @@ interface IHardwareWallet<TConfig = unknown> extends IEvmMethods, IBtcMethods, I
|
|
|
1636
1317
|
getAvailableTransports(): TransportType[];
|
|
1637
1318
|
switchTransport(type: TransportType): Promise<void>;
|
|
1638
1319
|
searchDevices(options?: SearchDevicesOptions): Promise<DeviceInfo[]>;
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
/** @deprecated Use searchDeviceTargets(). */
|
|
1642
|
-
listConnectionTargets(options?: SearchDevicesOptions): Promise<ConnectionTarget[]>;
|
|
1643
|
-
/** Connect or logically bind a selected search result and return a runtime-only interaction id. */
|
|
1644
|
-
connectDevice(searchTargetId: string): Promise<Response<string>>;
|
|
1645
|
-
/** Resolve operation-first routing/selection and pin it. The caller must verify wallet identity before business calls. */
|
|
1646
|
-
acquireInteraction?(connectId: string, context: IHardwareConnectionContext): Promise<Response<string>>;
|
|
1647
|
-
/** Release an interaction owned by the caller. Disconnect events end matching interactions automatically. */
|
|
1648
|
-
releaseInteraction(interactionId: string): Promise<void>;
|
|
1320
|
+
connectDevice(connectId: string): Promise<Response<string>>;
|
|
1321
|
+
disconnectDevice(connectId: string): Promise<void>;
|
|
1649
1322
|
getDeviceInfo(connectId: string, deviceId: string): Promise<Response<DeviceInfo>>;
|
|
1650
1323
|
getSupportedChains(): ChainCapability[];
|
|
1651
1324
|
/** Abort the in-flight call. Omit connectId to cancel whatever is active. */
|
|
@@ -1684,14 +1357,6 @@ interface SearchDevicesOptions {
|
|
|
1684
1357
|
* was discovered first.
|
|
1685
1358
|
*/
|
|
1686
1359
|
waitForAllTransports?: boolean;
|
|
1687
|
-
/**
|
|
1688
|
-
* Restrict discovery to one transport. A non-enumerable channel may return
|
|
1689
|
-
* a virtual connection target (for example Keystone QR), but discovery must
|
|
1690
|
-
* not start a wallet protocol or account-export interaction. The target is
|
|
1691
|
-
* resolved by the following `connectDevice()` call. Omit to scan everything
|
|
1692
|
-
* available.
|
|
1693
|
-
*/
|
|
1694
|
-
transportType?: ConnectionType;
|
|
1695
1360
|
}
|
|
1696
1361
|
|
|
1697
1362
|
interface EvmGetAddressParams extends PassphraseStateAware {
|
|
@@ -1853,33 +1518,6 @@ interface IEvmMethods {
|
|
|
1853
1518
|
evmSignTypedData(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignTypedDataParams>>): Promise<Response<EvmSignature>>;
|
|
1854
1519
|
}
|
|
1855
1520
|
|
|
1856
|
-
/** Which `GET_VK` encoding the Ledger Zcash app should return. */
|
|
1857
|
-
type ZcashFullViewingKeyMode = 'ufvk' | 'orchardFvk';
|
|
1858
|
-
interface ZcashGetFullViewingKeyParams extends PassphraseStateAware {
|
|
1859
|
-
/** BIP44 account path `m/44'/133'/a'` (any deeper transparent path is accepted; only the account level is used). */
|
|
1860
|
-
path: string;
|
|
1861
|
-
/** Default `ufvk`. */
|
|
1862
|
-
mode?: ZcashFullViewingKeyMode;
|
|
1863
|
-
}
|
|
1864
|
-
interface ZcashFullViewingKey {
|
|
1865
|
-
path: string;
|
|
1866
|
-
mode: ZcashFullViewingKeyMode;
|
|
1867
|
-
/** ZIP-316 bech32m UFVK string (mode `ufvk`). */
|
|
1868
|
-
ufvk?: string;
|
|
1869
|
-
/** 96-byte raw Orchard FVK as hex (mode `orchardFvk`). */
|
|
1870
|
-
orchardFvk?: string;
|
|
1871
|
-
}
|
|
1872
|
-
interface ZcashGetShieldedAddressParams extends PassphraseStateAware {
|
|
1873
|
-
/** Full 5-level transparent path `m/44'/133'/a'/0/i`; the Orchard path is derived from it. */
|
|
1874
|
-
path: string;
|
|
1875
|
-
showOnDevice?: boolean;
|
|
1876
|
-
}
|
|
1877
|
-
interface ZcashShieldedAddress {
|
|
1878
|
-
/** Unified address with a single Orchard receiver. */
|
|
1879
|
-
address: string;
|
|
1880
|
-
path: string;
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
1521
|
/**
|
|
1884
1522
|
* Low-level device descriptor from Transport layer.
|
|
1885
1523
|
* Represents a physical device detected by USB/BLE scanning.
|
|
@@ -1971,50 +1609,6 @@ declare class DeviceJobQueue {
|
|
|
1971
1609
|
clear(reason?: Error): void;
|
|
1972
1610
|
}
|
|
1973
1611
|
|
|
1974
|
-
declare const HARDWARE_RUNTIME_ID_PREFIX = "hwk:runtime:v1";
|
|
1975
|
-
type HardwareRuntimeId = {
|
|
1976
|
-
kind: 'interaction';
|
|
1977
|
-
vendor: VendorType;
|
|
1978
|
-
nonce: string;
|
|
1979
|
-
} | {
|
|
1980
|
-
kind: 'search-target';
|
|
1981
|
-
vendor: VendorType;
|
|
1982
|
-
connectionType: ConnectionType;
|
|
1983
|
-
nonce: string;
|
|
1984
|
-
} | {
|
|
1985
|
-
kind: 'connector-session';
|
|
1986
|
-
vendor: VendorType;
|
|
1987
|
-
connectionType: ConnectionType;
|
|
1988
|
-
nonce: string;
|
|
1989
|
-
};
|
|
1990
|
-
/** Runtime ids are opaque and must never be persisted as device identity. */
|
|
1991
|
-
declare function createHardwareInteractionId(vendor: VendorType): string;
|
|
1992
|
-
/** Search targets are valid only for the adapter's current discovery snapshot. */
|
|
1993
|
-
declare function createHardwareSearchTargetId(params: {
|
|
1994
|
-
vendor: VendorType;
|
|
1995
|
-
connectionType: ConnectionType;
|
|
1996
|
-
}): string;
|
|
1997
|
-
declare function createHardwareConnectorSessionId(params: {
|
|
1998
|
-
vendor: VendorType;
|
|
1999
|
-
connectionType: ConnectionType;
|
|
2000
|
-
}): string;
|
|
2001
|
-
declare function hasHardwareRuntimeIdPrefix(value: unknown): value is string;
|
|
2002
|
-
declare function parseHardwareRuntimeId(value: unknown): HardwareRuntimeId | undefined;
|
|
2003
|
-
declare function isHardwareInteractionId(value: unknown): value is string;
|
|
2004
|
-
declare function isHardwareSearchTargetId(value: unknown): value is string;
|
|
2005
|
-
|
|
2006
|
-
interface HardwareOperationTarget {
|
|
2007
|
-
/** Effective target accepted by existing adapter/connector call paths. */
|
|
2008
|
-
targetId: string | undefined;
|
|
2009
|
-
/** Present when this operation is pinned to a live interaction. */
|
|
2010
|
-
interactionId: string | undefined;
|
|
2011
|
-
}
|
|
2012
|
-
/**
|
|
2013
|
-
* Normalizes the transitional positional interaction id and the canonical
|
|
2014
|
-
* common-params field. All vendors must reject conflicting bindings.
|
|
2015
|
-
*/
|
|
2016
|
-
declare function resolveHardwareOperationTarget(positionalTargetId: string | null | undefined, commonInteractionId: string | null | undefined, expectedVendor?: VendorType): Response<HardwareOperationTarget>;
|
|
2017
|
-
|
|
2018
1612
|
/**
|
|
2019
1613
|
* Minimal typed event emitter using Map<string, Set<listener>>.
|
|
2020
1614
|
* Each adapter uses this for device events (connect, disconnect, pin, etc.).
|
|
@@ -2041,62 +1635,6 @@ declare class TypedEventEmitter<TMap extends Record<string, any> = Record<string
|
|
|
2041
1635
|
listenerCount(event: string): number;
|
|
2042
1636
|
}
|
|
2043
1637
|
|
|
2044
|
-
/** Serializable BLE transport data shared by Electron main and renderer runtimes. */
|
|
2045
|
-
interface ElectronBleDeviceInfo {
|
|
2046
|
-
id: string;
|
|
2047
|
-
name?: string;
|
|
2048
|
-
rssi?: number;
|
|
2049
|
-
advertisedServiceUuids?: string[];
|
|
2050
|
-
}
|
|
2051
|
-
interface ElectronBleScanOptions {
|
|
2052
|
-
vendor?: 'trezor' | 'ledger';
|
|
2053
|
-
serviceUuids?: string[];
|
|
2054
|
-
durationMs?: number;
|
|
2055
|
-
}
|
|
2056
|
-
interface ElectronBleConnectOptions {
|
|
2057
|
-
vendor: 'ledger';
|
|
2058
|
-
serviceUuid: string;
|
|
2059
|
-
writeUuid: string;
|
|
2060
|
-
notifyUuid: string;
|
|
2061
|
-
}
|
|
2062
|
-
/** Native code handles GATT only; framing, identity checks and wallet operations stay in the SDK. */
|
|
2063
|
-
interface ElectronBleApi {
|
|
2064
|
-
scan(options?: ElectronBleScanOptions): Promise<ElectronBleDeviceInfo[]>;
|
|
2065
|
-
stopScan(): Promise<void>;
|
|
2066
|
-
connect(id: string, options?: ElectronBleConnectOptions): Promise<{
|
|
2067
|
-
id: string;
|
|
2068
|
-
name?: string;
|
|
2069
|
-
}>;
|
|
2070
|
-
disconnect(id: string): Promise<void>;
|
|
2071
|
-
subscribe(id: string): Promise<void>;
|
|
2072
|
-
unsubscribe(id: string): Promise<void>;
|
|
2073
|
-
write(id: string, hexData: string): Promise<void>;
|
|
2074
|
-
checkAvailability(): Promise<{
|
|
2075
|
-
available: boolean;
|
|
2076
|
-
state: string;
|
|
2077
|
-
initialized: boolean;
|
|
2078
|
-
}>;
|
|
2079
|
-
getDevice(id: string): Promise<ElectronBleDeviceInfo | null>;
|
|
2080
|
-
onNotification(handler: (id: string, hexData: string) => void): () => void;
|
|
2081
|
-
onDeviceDisconnected(handler: (id: string) => void): () => void;
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
/** Legacy hosts keep their notification path until they subscribe to the acknowledged contract. */
|
|
2085
|
-
declare function requestSaveDeviceBinding(emitter: TypedEventEmitter<HardwareEventMap>, registry: UiRequestRegistry, binding: Omit<SaveDeviceBindingRequest, 'requestId'>, signal?: AbortSignal): Promise<boolean>;
|
|
2086
|
-
|
|
2087
|
-
/** Discovery and selection share one owner; never connect until the last scan has drained. */
|
|
2088
|
-
declare function requestBleDeviceSelection({ emitter, registry, request, scan, signal, pollIntervalMs, }: {
|
|
2089
|
-
emitter: TypedEventEmitter<HardwareEventMap>;
|
|
2090
|
-
registry: UiRequestRegistry;
|
|
2091
|
-
request: Omit<DeviceSelectionRequest, 'requestId' | 'scanning'>;
|
|
2092
|
-
scan: () => Promise<DeviceInfo[]>;
|
|
2093
|
-
signal: AbortSignal;
|
|
2094
|
-
pollIntervalMs?: number;
|
|
2095
|
-
}): Promise<{
|
|
2096
|
-
device: DeviceInfo;
|
|
2097
|
-
requestId: string;
|
|
2098
|
-
}>;
|
|
2099
|
-
|
|
2100
1638
|
/**
|
|
2101
1639
|
* Compare two semver strings (e.g. "2.1.0" vs "2.3.1").
|
|
2102
1640
|
* Returns -1 if a < b, 0 if equal, 1 if a > b.
|
|
@@ -2117,18 +1655,7 @@ declare function hexToBytes(hex: string): Uint8Array;
|
|
|
2117
1655
|
/** Convert a Uint8Array to a hex string (no 0x prefix). */
|
|
2118
1656
|
declare function bytesToHex(bytes: Uint8Array): string;
|
|
2119
1657
|
|
|
2120
|
-
|
|
2121
|
-
message: Uint8Array;
|
|
2122
|
-
requiredSigners: readonly string[];
|
|
2123
|
-
}
|
|
2124
|
-
interface PreparedSolanaOffchainMessageV1 {
|
|
2125
|
-
messageText: string;
|
|
2126
|
-
requiredSigners: string[];
|
|
2127
|
-
serializedMessage: Uint8Array;
|
|
2128
|
-
}
|
|
2129
|
-
declare function prepareSolanaOffchainMessageV1({ message, requiredSigners, }: PrepareSolanaOffchainMessageV1Params): PreparedSolanaOffchainMessageV1;
|
|
2130
|
-
|
|
2131
|
-
type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger' | 'keystone';
|
|
1658
|
+
type DetectableHardwareVendor = 'onekey' | 'trezor' | 'ledger';
|
|
2132
1659
|
type HardwareDeviceIdentityInput = {
|
|
2133
1660
|
name?: string | null;
|
|
2134
1661
|
localName?: string | null;
|
|
@@ -2195,4 +1722,4 @@ declare function buildUnsupportedMethodResponse(item: AllNetworkAddressParams):
|
|
|
2195
1722
|
|
|
2196
1723
|
declare const DEVICE_CONNECT_RETRY_DELAY_MS = 1000;
|
|
2197
1724
|
|
|
2198
|
-
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 };
|