@onekeyfe/hwk-adapter-core 1.2.8-alpha.121 → 1.2.8-alpha.122
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-PY5FNLTS.js → chunk-AYS7A7Z3.js} +3 -7
- package/dist/chunk-AYS7A7Z3.js.map +1 -0
- package/dist/{chunk-Y7NVGPPY.mjs → chunk-G5EU7VRW.mjs} +2 -6
- package/dist/chunk-G5EU7VRW.mjs.map +1 -0
- package/dist/{chunk-V2OHL2JS.mjs → chunk-KTRQZ5AJ.mjs} +1 -4
- package/dist/chunk-KTRQZ5AJ.mjs.map +1 -0
- package/dist/{chunk-UFNTICCX.js → chunk-T5HIQPNG.js} +1 -4
- package/dist/chunk-T5HIQPNG.js.map +1 -0
- package/dist/{errors-DednD9bG.d.ts → errors-BgJ4kzRx.d.mts} +0 -5
- package/dist/{errors-DednD9bG.d.mts → errors-BgJ4kzRx.d.ts} +0 -5
- package/dist/errors.d.mts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +2 -2
- package/dist/errors.mjs +1 -1
- package/dist/index.d.mts +279 -300
- package/dist/index.d.ts +279 -300
- package/dist/index.js +49 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{ui-events-D_lCGgCk.d.mts → ui-events-C61GTilK.d.mts} +0 -13
- package/dist/{ui-events-D_lCGgCk.d.ts → ui-events-C61GTilK.d.ts} +0 -13
- package/dist/ui-events.d.mts +1 -1
- package/dist/ui-events.d.ts +1 -1
- package/dist/ui-events.js +3 -3
- package/dist/ui-events.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunk-PY5FNLTS.js.map +0 -1
- package/dist/chunk-UFNTICCX.js.map +0 -1
- package/dist/chunk-V2OHL2JS.mjs.map +0 -1
- package/dist/chunk-Y7NVGPPY.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-
|
|
2
|
-
export { c as HwkError, d as HwkRecoveryScope, I as IHwkErrorPayload, e as IOperationMayHaveCompletedParams, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, g as defaultOriginForCode, h as defaultRecoveryForCode, i as enrichErrorMessage, j as isHwkRecoveryHint, o as operationMayHaveCompletedParams } from './errors-
|
|
3
|
-
import { U as UiResponseEvent, E as ExportedAccountKey, a as UiRequestOperationAttribution, b as UI_REQUEST, Q as QrDisplayData, c as UiRequestRegistry, S as SaveDeviceBindingDeclineReason } from './ui-events-
|
|
4
|
-
export { D as DevicePermissionDeniedReason, d as DevicePermissionResponse, e as QrResponseData, f as UI_EVENT, g as UI_REQUEST_CANCELLED_TAG, h as UI_REQUEST_DEFAULT_TIMEOUT_MS, i as UI_REQUEST_PREEMPTED_TAG, j as UI_REQUEST_TIMEOUT_TAG, k as UI_RESPONSE } from './ui-events-
|
|
1
|
+
import { H as HardwareErrorCode, a as HwkErrorOrigin, b as HwkRecoveryHint } from './errors-BgJ4kzRx.mjs';
|
|
2
|
+
export { c as HwkError, d as HwkRecoveryScope, I as IHwkErrorPayload, e as IOperationMayHaveCompletedParams, O as ORPHAN_ELIGIBLE_ERROR_CODES, f as createHwkError, g as defaultOriginForCode, h as defaultRecoveryForCode, i as enrichErrorMessage, j as isHwkRecoveryHint, o as operationMayHaveCompletedParams } from './errors-BgJ4kzRx.mjs';
|
|
3
|
+
import { U as UiResponseEvent, E as ExportedAccountKey, a as UiRequestOperationAttribution, b as UI_REQUEST, Q as QrDisplayData, c as UiRequestRegistry, S as SaveDeviceBindingDeclineReason } from './ui-events-C61GTilK.mjs';
|
|
4
|
+
export { D as DevicePermissionDeniedReason, d as DevicePermissionResponse, e as QrResponseData, f as UI_EVENT, g as UI_REQUEST_CANCELLED_TAG, h as UI_REQUEST_DEFAULT_TIMEOUT_MS, i as UI_REQUEST_PREEMPTED_TAG, j as UI_REQUEST_TIMEOUT_TAG, k as UI_RESPONSE } from './ui-events-C61GTilK.mjs';
|
|
5
5
|
|
|
6
6
|
interface Success<T> {
|
|
7
7
|
success: true;
|
|
@@ -53,6 +53,116 @@ declare function parseWalletMasterFingerprint(value: unknown): string | undefine
|
|
|
53
53
|
*/
|
|
54
54
|
declare function deriveDeviceFingerprint(value: string): string;
|
|
55
55
|
|
|
56
|
+
type VendorType = 'trezor' | 'ledger' | 'keystone';
|
|
57
|
+
/** 'qr' is a virtual channel: UR payloads travel via app-rendered/scanned QR codes. */
|
|
58
|
+
type ConnectionType = 'usb' | 'ble' | 'qr';
|
|
59
|
+
type TransportType = 'usb' | 'ble' | 'hid' | 'bridge' | 'qr';
|
|
60
|
+
/**
|
|
61
|
+
* Device capabilities — describes what a specific device/connection
|
|
62
|
+
* combination can or cannot do. Varies by vendor, model, and connection type.
|
|
63
|
+
*
|
|
64
|
+
* This enables business logic to check capabilities instead of hard-coding
|
|
65
|
+
* vendor-specific conditions (e.g., `if (vendor === 'ledger')`).
|
|
66
|
+
*/
|
|
67
|
+
interface DeviceCapabilities {
|
|
68
|
+
/**
|
|
69
|
+
* Whether the discovery handle can be reused to reconnect; `false` requires rediscovery. Says
|
|
70
|
+
* nothing about identity (Trezor BLE is false yet its device_id is stable); verify it separately.
|
|
71
|
+
*/
|
|
72
|
+
persistentDeviceIdentity: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface DeviceInfo {
|
|
75
|
+
vendor: VendorType;
|
|
76
|
+
/** Machine model id (e.g. "nanoX"). */
|
|
77
|
+
model: string;
|
|
78
|
+
/** Human-readable model name (e.g. "Ledger Nano X"). */
|
|
79
|
+
modelName?: string;
|
|
80
|
+
firmwareVersion: string;
|
|
81
|
+
deviceId: string;
|
|
82
|
+
connectId: string;
|
|
83
|
+
label?: string;
|
|
84
|
+
connectionType: ConnectionType;
|
|
85
|
+
battery?: number;
|
|
86
|
+
/** BLE signal strength (BLE only). */
|
|
87
|
+
rssi?: number | null;
|
|
88
|
+
/** BLE connectable flag (BLE only). */
|
|
89
|
+
isConnectable?: boolean | null;
|
|
90
|
+
/** USB serial number (USB only). */
|
|
91
|
+
serialNumber?: string;
|
|
92
|
+
/** Device capabilities — varies by vendor, model, and connection type */
|
|
93
|
+
capabilities?: DeviceCapabilities;
|
|
94
|
+
/**
|
|
95
|
+
* Vendor-specific raw payload from the post-handshake `Features` (Trezor)
|
|
96
|
+
* or device-info call. Populated by the connector with `{ transport,
|
|
97
|
+
* descriptor, features }` so the app layer can read fields we haven't
|
|
98
|
+
* promoted to the typed surface yet. Treat as informational — promote
|
|
99
|
+
* any consumed field above.
|
|
100
|
+
*/
|
|
101
|
+
raw?: Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
interface DeviceTarget {
|
|
104
|
+
connectId: string;
|
|
105
|
+
deviceId: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* How long a discovery handle remains safe to use for a new connection.
|
|
109
|
+
* This is deliberately separate from post-connect device identity.
|
|
110
|
+
*/
|
|
111
|
+
type SearchTargetReusePolicy = 'current-discovery' | 'reconnectable' | 'rediscover';
|
|
112
|
+
declare function resolveSearchTargetReusePolicy(device: Pick<DeviceInfo, 'connectionType' | 'capabilities'>): SearchTargetReusePolicy;
|
|
113
|
+
/** Search target for a physical device whose connectId is the discovery handle. */
|
|
114
|
+
declare function toPhysicalDeviceSearchTarget(vendor: VendorType, device: DeviceInfo): DeviceSearchTarget;
|
|
115
|
+
/**
|
|
116
|
+
* A selectable result from hardware discovery. It may represent a physical
|
|
117
|
+
* transport endpoint or an interactive entry such as Keystone QR; it is not a
|
|
118
|
+
* physical-device or wallet identity.
|
|
119
|
+
*/
|
|
120
|
+
interface DeviceSearchTarget {
|
|
121
|
+
/** Opaque handle scoped to the adapter's current discovery state. */
|
|
122
|
+
searchTargetId: string;
|
|
123
|
+
/** Whether the handle itself may be retried; never inferred from a stored connectId. */
|
|
124
|
+
searchTargetReusePolicy?: SearchTargetReusePolicy;
|
|
125
|
+
vendor: VendorType;
|
|
126
|
+
connectionType: ConnectionType;
|
|
127
|
+
kind: 'physical' | 'interactive';
|
|
128
|
+
label?: string;
|
|
129
|
+
model?: string;
|
|
130
|
+
modelName?: string;
|
|
131
|
+
serialNumber?: string;
|
|
132
|
+
}
|
|
133
|
+
type WalletIdentity = {
|
|
134
|
+
vendor: 'ledger';
|
|
135
|
+
type: 'chainFingerprint';
|
|
136
|
+
chain: ChainForFingerprint;
|
|
137
|
+
value: string;
|
|
138
|
+
} | {
|
|
139
|
+
vendor: 'trezor';
|
|
140
|
+
type: 'deviceId';
|
|
141
|
+
value: string;
|
|
142
|
+
} | {
|
|
143
|
+
vendor: 'keystone';
|
|
144
|
+
type: 'walletId';
|
|
145
|
+
value: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Mixin for chain-operation params that can be pinned to a specific passphrase
|
|
150
|
+
* wallet.
|
|
151
|
+
*
|
|
152
|
+
* Trezor-only. `passphraseState` is the wallet identity returned by
|
|
153
|
+
* `getPassphraseState`: today this is the compressed public key derived at
|
|
154
|
+
* `m/44'/0'/0'`, not the 4-byte master fingerprint. When present, the adapter
|
|
155
|
+
* creates a fresh wallet session (THP application session, or v1 device
|
|
156
|
+
* session) and verifies the derived state before issuing the call, so the
|
|
157
|
+
* address/signature comes from the intended passphrase wallet.
|
|
158
|
+
*
|
|
159
|
+
* Ledger has no equivalent and ignores the field — it never reaches the
|
|
160
|
+
* protobuf layer (the adapter strips it before forwarding to the connector).
|
|
161
|
+
*/
|
|
162
|
+
interface PassphraseStateAware {
|
|
163
|
+
passphraseState?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
56
166
|
/**
|
|
57
167
|
* Minimal device info returned during discovery (searchDevices).
|
|
58
168
|
* At scan time, full DeviceInfo fields like firmwareVersion are not yet available.
|
|
@@ -167,8 +277,6 @@ declare enum EConnectorInteraction {
|
|
|
167
277
|
AppInstallProgress = "app-install-progress"
|
|
168
278
|
}
|
|
169
279
|
type ConnectorUiEvent = {
|
|
170
|
-
operationId?: string;
|
|
171
|
-
} & ({
|
|
172
280
|
type: EConnectorInteraction.Searching;
|
|
173
281
|
payload: {
|
|
174
282
|
sessionId: string;
|
|
@@ -177,7 +285,6 @@ type ConnectorUiEvent = {
|
|
|
177
285
|
type: EConnectorInteraction.ConfirmOpenApp;
|
|
178
286
|
payload: {
|
|
179
287
|
sessionId: string;
|
|
180
|
-
appName?: string;
|
|
181
288
|
};
|
|
182
289
|
} | {
|
|
183
290
|
type: EConnectorInteraction.UnlockDevice;
|
|
@@ -201,7 +308,7 @@ type ConnectorUiEvent = {
|
|
|
201
308
|
appName: string;
|
|
202
309
|
progress: number;
|
|
203
310
|
};
|
|
204
|
-
}
|
|
311
|
+
};
|
|
205
312
|
interface ConnectorEventMap {
|
|
206
313
|
'device-connect': {
|
|
207
314
|
device: ConnectorDevice;
|
|
@@ -380,195 +487,11 @@ declare const DEVICE: {
|
|
|
380
487
|
* connect to skip the CodeEntry/QrCode/NFC pairing UX.
|
|
381
488
|
*
|
|
382
489
|
* The `TREZOR_` prefix mirrors `UI_REQUEST.REQUEST_TREZOR_THP_PAIRING` —
|
|
383
|
-
* vendor-specific events live in the shared event taxonomy but are named
|
|
384
|
-
* so hosts can ignore them when they don't drive Trezor hardware.
|
|
385
|
-
*/
|
|
386
|
-
readonly TREZOR_THP_CREDENTIALS_CHANGED: "device-trezor-thp-credentials-changed";
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Mixin for chain-operation params that can be pinned to a specific passphrase
|
|
391
|
-
* wallet.
|
|
392
|
-
*
|
|
393
|
-
* Trezor-only. `passphraseState` is the wallet identity returned by
|
|
394
|
-
* `getPassphraseState`: today this is the compressed public key derived at
|
|
395
|
-
* `m/44'/0'/0'`, not the 4-byte master fingerprint. When present, the adapter
|
|
396
|
-
* creates a fresh wallet session (THP application session, or v1 device
|
|
397
|
-
* session) and verifies the derived state before issuing the call, so the
|
|
398
|
-
* address/signature comes from the intended passphrase wallet.
|
|
399
|
-
*
|
|
400
|
-
* Ledger has no equivalent and ignores the field — it never reaches the
|
|
401
|
-
* protobuf layer (the adapter strips it before forwarding to the connector).
|
|
402
|
-
*/
|
|
403
|
-
interface PassphraseStateAware {
|
|
404
|
-
passphraseState?: string;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
interface EvmGetAddressParams extends PassphraseStateAware {
|
|
408
|
-
path: string;
|
|
409
|
-
showOnDevice?: boolean;
|
|
410
|
-
chainId?: number;
|
|
411
|
-
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
412
|
-
}
|
|
413
|
-
interface EvmAddress {
|
|
414
|
-
address: string;
|
|
415
|
-
path: string;
|
|
416
|
-
/** Device-reported secp256k1 public key; populated when the transport exposes it. */
|
|
417
|
-
publicKey?: string;
|
|
418
|
-
/** Set by air-gapped wallets (Keystone): the exported key this address derives from. */
|
|
419
|
-
accountKey?: ExportedAccountKey;
|
|
420
|
-
}
|
|
421
|
-
interface EvmSignTxBaseParams extends PassphraseStateAware {
|
|
422
|
-
path: string;
|
|
423
|
-
chainId?: number;
|
|
424
|
-
}
|
|
425
|
-
/** Ledger shape: the whole RLP-serialized tx (0x-prefixed or plain hex); structured fields forbidden. */
|
|
426
|
-
interface EvmSignTxLedgerParams extends EvmSignTxBaseParams {
|
|
427
|
-
serializedTx: string;
|
|
428
|
-
to?: never;
|
|
429
|
-
value?: never;
|
|
430
|
-
nonce?: never;
|
|
431
|
-
gasLimit?: never;
|
|
432
|
-
gasPrice?: never;
|
|
433
|
-
txType?: never;
|
|
434
|
-
maxFeePerGas?: never;
|
|
435
|
-
maxPriorityFeePerGas?: never;
|
|
436
|
-
accessList?: never;
|
|
437
|
-
data?: never;
|
|
438
|
-
paymentRequest?: never;
|
|
439
|
-
ethereumDefinitions?: never;
|
|
440
|
-
}
|
|
441
|
-
/** Trezor shape: structured EthereumSignTx protobuf fields; serializedTx forbidden. */
|
|
442
|
-
interface EvmSignTxTrezorParams extends EvmSignTxBaseParams {
|
|
443
|
-
serializedTx?: never;
|
|
444
|
-
/** Contract address or recipient. Optional for contract deployment transactions. */
|
|
445
|
-
to?: string;
|
|
446
|
-
value?: string;
|
|
447
|
-
nonce?: string;
|
|
448
|
-
gasLimit?: string;
|
|
449
|
-
gasPrice?: string;
|
|
450
|
-
txType?: number;
|
|
451
|
-
maxFeePerGas?: string;
|
|
452
|
-
maxPriorityFeePerGas?: string;
|
|
453
|
-
accessList?: Array<{
|
|
454
|
-
address: string;
|
|
455
|
-
storageKeys: string[];
|
|
456
|
-
}>;
|
|
457
|
-
data?: string;
|
|
458
|
-
paymentRequest?: EvmPaymentRequest;
|
|
459
|
-
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
460
|
-
}
|
|
461
|
-
/** Mutually exclusive vendor shapes; each adapter narrows to its own. */
|
|
462
|
-
type EvmSignTxParams = EvmSignTxLedgerParams | EvmSignTxTrezorParams;
|
|
463
|
-
interface EvmEthereumDefinitions {
|
|
464
|
-
/** Trezor Ethereum network definition bytes as a hex string. */
|
|
465
|
-
encodedNetwork?: string;
|
|
466
|
-
/** Trezor Ethereum token definition bytes as a hex string. */
|
|
467
|
-
encodedToken?: string;
|
|
468
|
-
}
|
|
469
|
-
interface EvmPaymentRequestMemo {
|
|
470
|
-
textMemo?: {
|
|
471
|
-
text: string;
|
|
472
|
-
};
|
|
473
|
-
textDetailsMemo?: {
|
|
474
|
-
title: string;
|
|
475
|
-
text: string;
|
|
476
|
-
};
|
|
477
|
-
refundMemo?: {
|
|
478
|
-
address: string;
|
|
479
|
-
addressN?: number[];
|
|
480
|
-
mac: string;
|
|
481
|
-
};
|
|
482
|
-
coinPurchaseMemo?: {
|
|
483
|
-
coinType: number;
|
|
484
|
-
amount: string;
|
|
485
|
-
address: string;
|
|
486
|
-
addressN?: number[];
|
|
487
|
-
mac: string;
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
interface EvmPaymentRequest {
|
|
491
|
-
nonce?: string;
|
|
492
|
-
recipientName: string;
|
|
493
|
-
memos?: EvmPaymentRequestMemo[];
|
|
494
|
-
/** Decimal string in subunits; SDK encodes it as SLIP-24 uint256 LE hex. */
|
|
495
|
-
amount?: string;
|
|
496
|
-
signature: string;
|
|
497
|
-
}
|
|
498
|
-
interface EvmSignedTx {
|
|
499
|
-
/** Recovery id as `0x`-prefixed hex string. */
|
|
500
|
-
v: string;
|
|
501
|
-
/** ECDSA `r` value as `0x`-prefixed, zero-padded 64-char hex string (32 bytes). */
|
|
502
|
-
r: string;
|
|
503
|
-
/** ECDSA `s` value as `0x`-prefixed, zero-padded 64-char hex string (32 bytes). */
|
|
504
|
-
s: string;
|
|
505
|
-
serializedTx?: string;
|
|
506
|
-
}
|
|
507
|
-
interface EvmSignMsgParams extends PassphraseStateAware {
|
|
508
|
-
path: string;
|
|
509
|
-
message: string;
|
|
510
|
-
chainId?: number;
|
|
511
|
-
hex?: boolean;
|
|
512
|
-
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
513
|
-
}
|
|
514
|
-
type EvmSignTypedDataParams = EvmSignTypedDataFull | EvmSignTypedDataHash;
|
|
515
|
-
interface EvmSignTypedDataFull extends PassphraseStateAware {
|
|
516
|
-
path: string;
|
|
517
|
-
chainId?: number;
|
|
518
|
-
/** Defaults to `'full'` when omitted. */
|
|
519
|
-
mode?: 'full';
|
|
520
|
-
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
521
|
-
data: {
|
|
522
|
-
domain: EIP712Domain;
|
|
523
|
-
types: Record<string, Array<{
|
|
524
|
-
name: string;
|
|
525
|
-
type: string;
|
|
526
|
-
}>>;
|
|
527
|
-
primaryType: string;
|
|
528
|
-
message: Record<string, unknown>;
|
|
529
|
-
};
|
|
530
|
-
/**
|
|
531
|
-
* The dApp's original EIP-712 JSON, byte for byte. Serializing vendors (Keystone) must prefer it:
|
|
532
|
-
* re-stringifying `data` rewrites integers wider than 2^53 and exponent forms.
|
|
533
|
-
*/
|
|
534
|
-
dataJson?: string;
|
|
535
|
-
metamaskV4Compat?: boolean;
|
|
536
|
-
showMessageHash?: boolean;
|
|
537
|
-
/**
|
|
538
|
-
* Optional host-computed hashes. Core Trezor models still use full typed-data
|
|
539
|
-
* signing for display, while Trezor One can fall back to typed-hash signing
|
|
540
|
-
* when firmware cannot compute the hashes itself.
|
|
541
|
-
*/
|
|
542
|
-
domainSeparatorHash?: string;
|
|
543
|
-
messageHash?: string;
|
|
544
|
-
}
|
|
545
|
-
interface EvmSignTypedDataHash extends PassphraseStateAware {
|
|
546
|
-
path: string;
|
|
547
|
-
chainId?: number;
|
|
548
|
-
mode: 'hash';
|
|
549
|
-
domainSeparatorHash: string;
|
|
550
|
-
messageHash: string;
|
|
551
|
-
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
552
|
-
}
|
|
553
|
-
interface EIP712Domain {
|
|
554
|
-
name?: string;
|
|
555
|
-
version?: string;
|
|
556
|
-
chainId?: number;
|
|
557
|
-
verifyingContract?: string;
|
|
558
|
-
salt?: string;
|
|
559
|
-
[key: string]: unknown;
|
|
560
|
-
}
|
|
561
|
-
interface EvmSignature {
|
|
562
|
-
/** `0x`-prefixed hex string (r + s + v). */
|
|
563
|
-
signature: string;
|
|
564
|
-
address?: string;
|
|
565
|
-
}
|
|
566
|
-
interface IEvmMethods {
|
|
567
|
-
evmGetAddress(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmGetAddressParams>>): Promise<Response<EvmAddress>>;
|
|
568
|
-
evmSignTransaction(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignTxParams>>): Promise<Response<EvmSignedTx>>;
|
|
569
|
-
evmSignMessage(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignMsgParams>>): Promise<Response<EvmSignature>>;
|
|
570
|
-
evmSignTypedData(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignTypedDataParams>>): Promise<Response<EvmSignature>>;
|
|
571
|
-
}
|
|
490
|
+
* vendor-specific events live in the shared event taxonomy but are named
|
|
491
|
+
* so hosts can ignore them when they don't drive Trezor hardware.
|
|
492
|
+
*/
|
|
493
|
+
readonly TREZOR_THP_CREDENTIALS_CHANGED: "device-trezor-thp-credentials-changed";
|
|
494
|
+
};
|
|
572
495
|
|
|
573
496
|
interface BtcGetAddressParams extends PassphraseStateAware {
|
|
574
497
|
path: string;
|
|
@@ -975,7 +898,7 @@ declare class OperationRegistry {
|
|
|
975
898
|
/** Return active or tombstoned binding data without refreshing its TTL. */
|
|
976
899
|
find(operationId: string): HardwareOperation | undefined;
|
|
977
900
|
findActiveByConnectionKey(connectionKey: string): HardwareOperation | undefined;
|
|
978
|
-
/**
|
|
901
|
+
/** Map a job queue key (an operation id or a connection key) to its live operation id. */
|
|
979
902
|
findOperationIdByJobKey(jobKey: string | undefined): string | undefined;
|
|
980
903
|
/**
|
|
981
904
|
* End an operation on the caller's explicit release. Throws for an unknown id; returns undefined
|
|
@@ -1111,7 +1034,6 @@ type HardwareUiEvent = Exclude<ConnectorUiEvent, {
|
|
|
1111
1034
|
type: EConnectorInteraction.AppInstallProgress;
|
|
1112
1035
|
}> | {
|
|
1113
1036
|
type: EConnectorInteraction.AppInstallProgress;
|
|
1114
|
-
operationId?: string;
|
|
1115
1037
|
payload: {
|
|
1116
1038
|
connectId: string;
|
|
1117
1039
|
appName: string;
|
|
@@ -1294,8 +1216,6 @@ interface AllNetworkGetAddressParams extends IHardwareCommonCallParams {
|
|
|
1294
1216
|
}
|
|
1295
1217
|
type AllNetworkDeviceIdentity = WalletIdentity;
|
|
1296
1218
|
type AllNetworkAddressResponsePayload = Record<string, unknown> & {
|
|
1297
|
-
/** This account came from the user's explicit device-export scan. */
|
|
1298
|
-
accountExport?: boolean;
|
|
1299
1219
|
error?: string;
|
|
1300
1220
|
code?: HardwareErrorCode | number;
|
|
1301
1221
|
errorCode?: string | number;
|
|
@@ -1422,12 +1342,6 @@ type UiRequestEvent = {
|
|
|
1422
1342
|
vendor: string;
|
|
1423
1343
|
appName: string;
|
|
1424
1344
|
} & UiRequestOperationAttribution;
|
|
1425
|
-
} | {
|
|
1426
|
-
type: typeof UI_REQUEST.REQUEST_QR_FALLBACK_CONFIRM;
|
|
1427
|
-
payload: {
|
|
1428
|
-
vendor: string;
|
|
1429
|
-
requestId: string;
|
|
1430
|
-
} & UiRequestOperationAttribution;
|
|
1431
1345
|
} | {
|
|
1432
1346
|
type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
|
|
1433
1347
|
payload: {
|
|
@@ -1599,13 +1513,6 @@ interface HardwareEventMap {
|
|
|
1599
1513
|
appName: string;
|
|
1600
1514
|
} & UiRequestOperationAttribution;
|
|
1601
1515
|
};
|
|
1602
|
-
[UI_REQUEST.REQUEST_QR_FALLBACK_CONFIRM]: {
|
|
1603
|
-
type: typeof UI_REQUEST.REQUEST_QR_FALLBACK_CONFIRM;
|
|
1604
|
-
payload: {
|
|
1605
|
-
vendor: string;
|
|
1606
|
-
requestId: string;
|
|
1607
|
-
} & UiRequestOperationAttribution;
|
|
1608
|
-
};
|
|
1609
1516
|
[UI_REQUEST.REQUEST_TREZOR_THP_PAIRING]: {
|
|
1610
1517
|
type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
|
|
1611
1518
|
payload: {
|
|
@@ -1759,99 +1666,171 @@ interface SearchDevicesOptions {
|
|
|
1759
1666
|
transportType?: ConnectionType;
|
|
1760
1667
|
}
|
|
1761
1668
|
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1669
|
+
interface EvmGetAddressParams extends PassphraseStateAware {
|
|
1670
|
+
path: string;
|
|
1671
|
+
showOnDevice?: boolean;
|
|
1672
|
+
chainId?: number;
|
|
1673
|
+
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
1674
|
+
}
|
|
1675
|
+
interface EvmAddress {
|
|
1676
|
+
address: string;
|
|
1677
|
+
path: string;
|
|
1678
|
+
/** Device-reported secp256k1 public key; populated when the transport exposes it. */
|
|
1679
|
+
publicKey?: string;
|
|
1680
|
+
/** Set by air-gapped wallets (Keystone): the exported key this address derives from. */
|
|
1681
|
+
accountKey?: ExportedAccountKey;
|
|
1682
|
+
}
|
|
1683
|
+
interface EvmSignTxBaseParams extends PassphraseStateAware {
|
|
1684
|
+
path: string;
|
|
1685
|
+
chainId?: number;
|
|
1686
|
+
}
|
|
1687
|
+
/** Ledger shape: the whole RLP-serialized tx (0x-prefixed or plain hex); structured fields forbidden. */
|
|
1688
|
+
interface EvmSignTxLedgerParams extends EvmSignTxBaseParams {
|
|
1689
|
+
serializedTx: string;
|
|
1690
|
+
to?: never;
|
|
1691
|
+
value?: never;
|
|
1692
|
+
nonce?: never;
|
|
1693
|
+
gasLimit?: never;
|
|
1694
|
+
gasPrice?: never;
|
|
1695
|
+
txType?: never;
|
|
1696
|
+
maxFeePerGas?: never;
|
|
1697
|
+
maxPriorityFeePerGas?: never;
|
|
1698
|
+
accessList?: never;
|
|
1699
|
+
data?: never;
|
|
1700
|
+
paymentRequest?: never;
|
|
1701
|
+
ethereumDefinitions?: never;
|
|
1702
|
+
}
|
|
1703
|
+
/** Trezor shape: structured EthereumSignTx protobuf fields; serializedTx forbidden. */
|
|
1704
|
+
interface EvmSignTxTrezorParams extends EvmSignTxBaseParams {
|
|
1705
|
+
serializedTx?: never;
|
|
1706
|
+
/** Contract address or recipient. Optional for contract deployment transactions. */
|
|
1707
|
+
to?: string;
|
|
1708
|
+
value?: string;
|
|
1709
|
+
nonce?: string;
|
|
1710
|
+
gasLimit?: string;
|
|
1711
|
+
gasPrice?: string;
|
|
1712
|
+
txType?: number;
|
|
1713
|
+
maxFeePerGas?: string;
|
|
1714
|
+
maxPriorityFeePerGas?: string;
|
|
1715
|
+
accessList?: Array<{
|
|
1716
|
+
address: string;
|
|
1717
|
+
storageKeys: string[];
|
|
1718
|
+
}>;
|
|
1719
|
+
data?: string;
|
|
1720
|
+
paymentRequest?: EvmPaymentRequest;
|
|
1721
|
+
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
1722
|
+
}
|
|
1723
|
+
/** Mutually exclusive vendor shapes; each adapter narrows to its own. */
|
|
1724
|
+
type EvmSignTxParams = EvmSignTxLedgerParams | EvmSignTxTrezorParams;
|
|
1725
|
+
interface EvmEthereumDefinitions {
|
|
1726
|
+
/** Trezor Ethereum network definition bytes as a hex string. */
|
|
1727
|
+
encodedNetwork?: string;
|
|
1728
|
+
/** Trezor Ethereum token definition bytes as a hex string. */
|
|
1729
|
+
encodedToken?: string;
|
|
1730
|
+
}
|
|
1731
|
+
interface EvmPaymentRequestMemo {
|
|
1732
|
+
textMemo?: {
|
|
1733
|
+
text: string;
|
|
1734
|
+
};
|
|
1735
|
+
textDetailsMemo?: {
|
|
1736
|
+
title: string;
|
|
1737
|
+
text: string;
|
|
1738
|
+
};
|
|
1739
|
+
refundMemo?: {
|
|
1740
|
+
address: string;
|
|
1741
|
+
addressN?: number[];
|
|
1742
|
+
mac: string;
|
|
1743
|
+
};
|
|
1744
|
+
coinPurchaseMemo?: {
|
|
1745
|
+
coinType: number;
|
|
1746
|
+
amount: string;
|
|
1747
|
+
address: string;
|
|
1748
|
+
addressN?: number[];
|
|
1749
|
+
mac: string;
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
interface EvmPaymentRequest {
|
|
1753
|
+
nonce?: string;
|
|
1754
|
+
recipientName: string;
|
|
1755
|
+
memos?: EvmPaymentRequestMemo[];
|
|
1756
|
+
/** Decimal string in subunits; SDK encodes it as SLIP-24 uint256 LE hex. */
|
|
1757
|
+
amount?: string;
|
|
1758
|
+
signature: string;
|
|
1759
|
+
}
|
|
1760
|
+
interface EvmSignedTx {
|
|
1761
|
+
/** Recovery id as `0x`-prefixed hex string. */
|
|
1762
|
+
v: string;
|
|
1763
|
+
/** ECDSA `r` value as `0x`-prefixed, zero-padded 64-char hex string (32 bytes). */
|
|
1764
|
+
r: string;
|
|
1765
|
+
/** ECDSA `s` value as `0x`-prefixed, zero-padded 64-char hex string (32 bytes). */
|
|
1766
|
+
s: string;
|
|
1767
|
+
serializedTx?: string;
|
|
1768
|
+
}
|
|
1769
|
+
interface EvmSignMsgParams extends PassphraseStateAware {
|
|
1770
|
+
path: string;
|
|
1771
|
+
message: string;
|
|
1772
|
+
chainId?: number;
|
|
1773
|
+
hex?: boolean;
|
|
1774
|
+
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
1775
|
+
}
|
|
1776
|
+
type EvmSignTypedDataParams = EvmSignTypedDataFull | EvmSignTypedDataHash;
|
|
1777
|
+
interface EvmSignTypedDataFull extends PassphraseStateAware {
|
|
1778
|
+
path: string;
|
|
1779
|
+
chainId?: number;
|
|
1780
|
+
/** Defaults to `'full'` when omitted. */
|
|
1781
|
+
mode?: 'full';
|
|
1782
|
+
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
1783
|
+
data: {
|
|
1784
|
+
domain: EIP712Domain;
|
|
1785
|
+
types: Record<string, Array<{
|
|
1786
|
+
name: string;
|
|
1787
|
+
type: string;
|
|
1788
|
+
}>>;
|
|
1789
|
+
primaryType: string;
|
|
1790
|
+
message: Record<string, unknown>;
|
|
1791
|
+
};
|
|
1776
1792
|
/**
|
|
1777
|
-
*
|
|
1778
|
-
*
|
|
1793
|
+
* The dApp's original EIP-712 JSON, byte for byte. Serializing vendors (Keystone) must prefer it:
|
|
1794
|
+
* re-stringifying `data` rewrites integers wider than 2^53 and exponent forms.
|
|
1779
1795
|
*/
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
vendor: VendorType;
|
|
1784
|
-
/** Machine model id (e.g. "nanoX"). */
|
|
1785
|
-
model: string;
|
|
1786
|
-
/** Human-readable model name (e.g. "Ledger Nano X"). */
|
|
1787
|
-
modelName?: string;
|
|
1788
|
-
firmwareVersion: string;
|
|
1789
|
-
deviceId: string;
|
|
1790
|
-
connectId: string;
|
|
1791
|
-
label?: string;
|
|
1792
|
-
connectionType: ConnectionType;
|
|
1793
|
-
battery?: number;
|
|
1794
|
-
/** BLE signal strength (BLE only). */
|
|
1795
|
-
rssi?: number | null;
|
|
1796
|
-
/** BLE connectable flag (BLE only). */
|
|
1797
|
-
isConnectable?: boolean | null;
|
|
1798
|
-
/** USB serial number (USB only). */
|
|
1799
|
-
serialNumber?: string;
|
|
1800
|
-
/** Device capabilities — varies by vendor, model, and connection type */
|
|
1801
|
-
capabilities?: DeviceCapabilities;
|
|
1796
|
+
dataJson?: string;
|
|
1797
|
+
metamaskV4Compat?: boolean;
|
|
1798
|
+
showMessageHash?: boolean;
|
|
1802
1799
|
/**
|
|
1803
|
-
*
|
|
1804
|
-
*
|
|
1805
|
-
*
|
|
1806
|
-
* promoted to the typed surface yet. Treat as informational — promote
|
|
1807
|
-
* any consumed field above.
|
|
1800
|
+
* Optional host-computed hashes. Core Trezor models still use full typed-data
|
|
1801
|
+
* signing for display, while Trezor One can fall back to typed-hash signing
|
|
1802
|
+
* when firmware cannot compute the hashes itself.
|
|
1808
1803
|
*/
|
|
1809
|
-
|
|
1804
|
+
domainSeparatorHash?: string;
|
|
1805
|
+
messageHash?: string;
|
|
1810
1806
|
}
|
|
1811
|
-
interface
|
|
1812
|
-
|
|
1813
|
-
|
|
1807
|
+
interface EvmSignTypedDataHash extends PassphraseStateAware {
|
|
1808
|
+
path: string;
|
|
1809
|
+
chainId?: number;
|
|
1810
|
+
mode: 'hash';
|
|
1811
|
+
domainSeparatorHash: string;
|
|
1812
|
+
messageHash: string;
|
|
1813
|
+
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
1814
1814
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
interface
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
vendor: VendorType;
|
|
1834
|
-
connectionType: ConnectionType;
|
|
1835
|
-
kind: 'physical' | 'interactive';
|
|
1836
|
-
label?: string;
|
|
1837
|
-
model?: string;
|
|
1838
|
-
modelName?: string;
|
|
1839
|
-
serialNumber?: string;
|
|
1815
|
+
interface EIP712Domain {
|
|
1816
|
+
name?: string;
|
|
1817
|
+
version?: string;
|
|
1818
|
+
chainId?: number;
|
|
1819
|
+
verifyingContract?: string;
|
|
1820
|
+
salt?: string;
|
|
1821
|
+
[key: string]: unknown;
|
|
1822
|
+
}
|
|
1823
|
+
interface EvmSignature {
|
|
1824
|
+
/** `0x`-prefixed hex string (r + s + v). */
|
|
1825
|
+
signature: string;
|
|
1826
|
+
address?: string;
|
|
1827
|
+
}
|
|
1828
|
+
interface IEvmMethods {
|
|
1829
|
+
evmGetAddress(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmGetAddressParams>>): Promise<Response<EvmAddress>>;
|
|
1830
|
+
evmSignTransaction(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignTxParams>>): Promise<Response<EvmSignedTx>>;
|
|
1831
|
+
evmSignMessage(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignMsgParams>>): Promise<Response<EvmSignature>>;
|
|
1832
|
+
evmSignTypedData(connectId?: NullableCallArg<string>, deviceId?: NullableCallArg<string>, params?: NullableCallArg<IHardwareCallParams<EvmSignTypedDataParams>>): Promise<Response<EvmSignature>>;
|
|
1840
1833
|
}
|
|
1841
|
-
type WalletIdentity = {
|
|
1842
|
-
vendor: 'ledger';
|
|
1843
|
-
type: 'chainFingerprint';
|
|
1844
|
-
chain: ChainForFingerprint;
|
|
1845
|
-
value: string;
|
|
1846
|
-
} | {
|
|
1847
|
-
vendor: 'trezor';
|
|
1848
|
-
type: 'deviceId';
|
|
1849
|
-
value: string;
|
|
1850
|
-
} | {
|
|
1851
|
-
vendor: 'keystone';
|
|
1852
|
-
type: 'walletId';
|
|
1853
|
-
value: string;
|
|
1854
|
-
};
|
|
1855
1834
|
|
|
1856
1835
|
/** Which `GET_VK` encoding the Ledger Zcash app should return. */
|
|
1857
1836
|
type ZcashFullViewingKeyMode = 'ufvk' | 'orchardFvk';
|