@onekeyfe/hwk-adapter-core 1.2.8-alpha.118 → 1.2.8-alpha.119
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-T5HIQPNG.js → chunk-UFNTICCX.js} +4 -1
- package/dist/chunk-UFNTICCX.js.map +1 -0
- package/dist/{chunk-KTRQZ5AJ.mjs → chunk-V2OHL2JS.mjs} +4 -1
- package/dist/chunk-V2OHL2JS.mjs.map +1 -0
- package/dist/{chunk-AYS7A7Z3.js → chunk-VVAN3W2C.js} +7 -3
- package/dist/chunk-VVAN3W2C.js.map +1 -0
- package/dist/{chunk-G5EU7VRW.mjs → chunk-VWVDPWNI.mjs} +6 -2
- package/dist/chunk-VWVDPWNI.mjs.map +1 -0
- package/dist/{errors-BgJ4kzRx.d.ts → errors-DednD9bG.d.mts} +5 -0
- package/dist/{errors-BgJ4kzRx.d.mts → errors-DednD9bG.d.ts} +5 -0
- 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 +288 -274
- package/dist/index.d.ts +288 -274
- package/dist/index.js +47 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -6
- package/dist/index.mjs.map +1 -1
- package/dist/{ui-events-C61GTilK.d.ts → ui-events-BCbB6sfo.d.mts} +11 -0
- package/dist/{ui-events-C61GTilK.d.mts → ui-events-BCbB6sfo.d.ts} +11 -0
- 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-AYS7A7Z3.js.map +0 -1
- package/dist/chunk-G5EU7VRW.mjs.map +0 -1
- package/dist/chunk-KTRQZ5AJ.mjs.map +0 -1
- package/dist/chunk-T5HIQPNG.js.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-DednD9bG.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-DednD9bG.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-BCbB6sfo.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-BCbB6sfo.mjs';
|
|
5
5
|
|
|
6
6
|
interface Success<T> {
|
|
7
7
|
success: true;
|
|
@@ -53,116 +53,6 @@ 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
|
-
|
|
166
56
|
/**
|
|
167
57
|
* Minimal device info returned during discovery (searchDevices).
|
|
168
58
|
* At scan time, full DeviceInfo fields like firmwareVersion are not yet available.
|
|
@@ -277,6 +167,8 @@ declare enum EConnectorInteraction {
|
|
|
277
167
|
AppInstallProgress = "app-install-progress"
|
|
278
168
|
}
|
|
279
169
|
type ConnectorUiEvent = {
|
|
170
|
+
operationId?: string;
|
|
171
|
+
} & ({
|
|
280
172
|
type: EConnectorInteraction.Searching;
|
|
281
173
|
payload: {
|
|
282
174
|
sessionId: string;
|
|
@@ -285,6 +177,7 @@ type ConnectorUiEvent = {
|
|
|
285
177
|
type: EConnectorInteraction.ConfirmOpenApp;
|
|
286
178
|
payload: {
|
|
287
179
|
sessionId: string;
|
|
180
|
+
appName?: string;
|
|
288
181
|
};
|
|
289
182
|
} | {
|
|
290
183
|
type: EConnectorInteraction.UnlockDevice;
|
|
@@ -308,7 +201,7 @@ type ConnectorUiEvent = {
|
|
|
308
201
|
appName: string;
|
|
309
202
|
progress: number;
|
|
310
203
|
};
|
|
311
|
-
};
|
|
204
|
+
});
|
|
312
205
|
interface ConnectorEventMap {
|
|
313
206
|
'device-connect': {
|
|
314
207
|
device: ConnectorDevice;
|
|
@@ -493,6 +386,190 @@ declare const DEVICE: {
|
|
|
493
386
|
readonly TREZOR_THP_CREDENTIALS_CHANGED: "device-trezor-thp-credentials-changed";
|
|
494
387
|
};
|
|
495
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
|
+
}
|
|
572
|
+
|
|
496
573
|
interface BtcGetAddressParams extends PassphraseStateAware {
|
|
497
574
|
path: string;
|
|
498
575
|
coin?: string;
|
|
@@ -898,7 +975,7 @@ declare class OperationRegistry {
|
|
|
898
975
|
/** Return active or tombstoned binding data without refreshing its TTL. */
|
|
899
976
|
find(operationId: string): HardwareOperation | undefined;
|
|
900
977
|
findActiveByConnectionKey(connectionKey: string): HardwareOperation | undefined;
|
|
901
|
-
/**
|
|
978
|
+
/** Only an explicitly supplied operation job key owns the call's UI requests. */
|
|
902
979
|
findOperationIdByJobKey(jobKey: string | undefined): string | undefined;
|
|
903
980
|
/**
|
|
904
981
|
* End an operation on the caller's explicit release. Throws for an unknown id; returns undefined
|
|
@@ -1034,6 +1111,7 @@ type HardwareUiEvent = Exclude<ConnectorUiEvent, {
|
|
|
1034
1111
|
type: EConnectorInteraction.AppInstallProgress;
|
|
1035
1112
|
}> | {
|
|
1036
1113
|
type: EConnectorInteraction.AppInstallProgress;
|
|
1114
|
+
operationId?: string;
|
|
1037
1115
|
payload: {
|
|
1038
1116
|
connectId: string;
|
|
1039
1117
|
appName: string;
|
|
@@ -1216,6 +1294,8 @@ interface AllNetworkGetAddressParams extends IHardwareCommonCallParams {
|
|
|
1216
1294
|
}
|
|
1217
1295
|
type AllNetworkDeviceIdentity = WalletIdentity;
|
|
1218
1296
|
type AllNetworkAddressResponsePayload = Record<string, unknown> & {
|
|
1297
|
+
/** This account came from the user's explicit device-export scan. */
|
|
1298
|
+
accountExport?: boolean;
|
|
1219
1299
|
error?: string;
|
|
1220
1300
|
code?: HardwareErrorCode | number;
|
|
1221
1301
|
errorCode?: string | number;
|
|
@@ -1513,6 +1593,12 @@ interface HardwareEventMap {
|
|
|
1513
1593
|
appName: string;
|
|
1514
1594
|
} & UiRequestOperationAttribution;
|
|
1515
1595
|
};
|
|
1596
|
+
[UI_REQUEST.REQUEST_QR_FALLBACK_CONFIRM]: {
|
|
1597
|
+
type: typeof UI_REQUEST.REQUEST_QR_FALLBACK_CONFIRM;
|
|
1598
|
+
payload: {
|
|
1599
|
+
vendor: string;
|
|
1600
|
+
} & UiRequestOperationAttribution;
|
|
1601
|
+
};
|
|
1516
1602
|
[UI_REQUEST.REQUEST_TREZOR_THP_PAIRING]: {
|
|
1517
1603
|
type: typeof UI_REQUEST.REQUEST_TREZOR_THP_PAIRING;
|
|
1518
1604
|
payload: {
|
|
@@ -1666,171 +1752,99 @@ interface SearchDevicesOptions {
|
|
|
1666
1752
|
transportType?: ConnectionType;
|
|
1667
1753
|
}
|
|
1668
1754
|
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
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
|
-
};
|
|
1755
|
+
type VendorType = 'trezor' | 'ledger' | 'keystone';
|
|
1756
|
+
/** 'qr' is a virtual channel: UR payloads travel via app-rendered/scanned QR codes. */
|
|
1757
|
+
type ConnectionType = 'usb' | 'ble' | 'qr';
|
|
1758
|
+
type TransportType = 'usb' | 'ble' | 'hid' | 'bridge' | 'qr';
|
|
1759
|
+
/**
|
|
1760
|
+
* Device capabilities — describes what a specific device/connection
|
|
1761
|
+
* combination can or cannot do. Varies by vendor, model, and connection type.
|
|
1762
|
+
*
|
|
1763
|
+
* This enables business logic to check capabilities instead of hard-coding
|
|
1764
|
+
* vendor-specific conditions (e.g., `if (vendor === 'ledger')`).
|
|
1765
|
+
*/
|
|
1766
|
+
interface DeviceCapabilities {
|
|
1767
|
+
/** Chains usable through this adapter on the connected firmware; absent means not advertised. */
|
|
1768
|
+
supportedChains?: ChainCapability[];
|
|
1792
1769
|
/**
|
|
1793
|
-
*
|
|
1794
|
-
*
|
|
1770
|
+
* Whether the discovery handle can be reused to reconnect; `false` requires rediscovery. Says
|
|
1771
|
+
* nothing about identity (Trezor BLE is false yet its device_id is stable); verify it separately.
|
|
1795
1772
|
*/
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1773
|
+
persistentDeviceIdentity: boolean;
|
|
1774
|
+
}
|
|
1775
|
+
interface DeviceInfo {
|
|
1776
|
+
vendor: VendorType;
|
|
1777
|
+
/** Machine model id (e.g. "nanoX"). */
|
|
1778
|
+
model: string;
|
|
1779
|
+
/** Human-readable model name (e.g. "Ledger Nano X"). */
|
|
1780
|
+
modelName?: string;
|
|
1781
|
+
firmwareVersion: string;
|
|
1782
|
+
deviceId: string;
|
|
1783
|
+
connectId: string;
|
|
1784
|
+
label?: string;
|
|
1785
|
+
connectionType: ConnectionType;
|
|
1786
|
+
battery?: number;
|
|
1787
|
+
/** BLE signal strength (BLE only). */
|
|
1788
|
+
rssi?: number | null;
|
|
1789
|
+
/** BLE connectable flag (BLE only). */
|
|
1790
|
+
isConnectable?: boolean | null;
|
|
1791
|
+
/** USB serial number (USB only). */
|
|
1792
|
+
serialNumber?: string;
|
|
1793
|
+
/** Device capabilities — varies by vendor, model, and connection type */
|
|
1794
|
+
capabilities?: DeviceCapabilities;
|
|
1799
1795
|
/**
|
|
1800
|
-
*
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1796
|
+
* Vendor-specific raw payload from the post-handshake `Features` (Trezor)
|
|
1797
|
+
* or device-info call. Populated by the connector with `{ transport,
|
|
1798
|
+
* descriptor, features }` so the app layer can read fields we haven't
|
|
1799
|
+
* promoted to the typed surface yet. Treat as informational — promote
|
|
1800
|
+
* any consumed field above.
|
|
1803
1801
|
*/
|
|
1804
|
-
|
|
1805
|
-
messageHash?: string;
|
|
1806
|
-
}
|
|
1807
|
-
interface EvmSignTypedDataHash extends PassphraseStateAware {
|
|
1808
|
-
path: string;
|
|
1809
|
-
chainId?: number;
|
|
1810
|
-
mode: 'hash';
|
|
1811
|
-
domainSeparatorHash: string;
|
|
1812
|
-
messageHash: string;
|
|
1813
|
-
ethereumDefinitions?: EvmEthereumDefinitions;
|
|
1814
|
-
}
|
|
1815
|
-
interface EIP712Domain {
|
|
1816
|
-
name?: string;
|
|
1817
|
-
version?: string;
|
|
1818
|
-
chainId?: number;
|
|
1819
|
-
verifyingContract?: string;
|
|
1820
|
-
salt?: string;
|
|
1821
|
-
[key: string]: unknown;
|
|
1802
|
+
raw?: Record<string, unknown>;
|
|
1822
1803
|
}
|
|
1823
|
-
interface
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
address?: string;
|
|
1804
|
+
interface DeviceTarget {
|
|
1805
|
+
connectId: string;
|
|
1806
|
+
deviceId: string;
|
|
1827
1807
|
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1808
|
+
/**
|
|
1809
|
+
* How long a discovery handle remains safe to use for a new connection.
|
|
1810
|
+
* This is deliberately separate from post-connect device identity.
|
|
1811
|
+
*/
|
|
1812
|
+
type SearchTargetReusePolicy = 'current-discovery' | 'reconnectable' | 'rediscover';
|
|
1813
|
+
declare function resolveSearchTargetReusePolicy(device: Pick<DeviceInfo, 'connectionType' | 'capabilities'>): SearchTargetReusePolicy;
|
|
1814
|
+
/** Search target for a physical device whose connectId is the discovery handle. */
|
|
1815
|
+
declare function toPhysicalDeviceSearchTarget(vendor: VendorType, device: DeviceInfo): DeviceSearchTarget;
|
|
1816
|
+
/**
|
|
1817
|
+
* A selectable result from hardware discovery. It may represent a physical
|
|
1818
|
+
* transport endpoint or an interactive entry such as Keystone QR; it is not a
|
|
1819
|
+
* physical-device or wallet identity.
|
|
1820
|
+
*/
|
|
1821
|
+
interface DeviceSearchTarget {
|
|
1822
|
+
/** Opaque handle scoped to the adapter's current discovery state. */
|
|
1823
|
+
searchTargetId: string;
|
|
1824
|
+
/** Whether the handle itself may be retried; never inferred from a stored connectId. */
|
|
1825
|
+
searchTargetReusePolicy?: SearchTargetReusePolicy;
|
|
1826
|
+
vendor: VendorType;
|
|
1827
|
+
connectionType: ConnectionType;
|
|
1828
|
+
kind: 'physical' | 'interactive';
|
|
1829
|
+
label?: string;
|
|
1830
|
+
model?: string;
|
|
1831
|
+
modelName?: string;
|
|
1832
|
+
serialNumber?: string;
|
|
1833
1833
|
}
|
|
1834
|
+
type WalletIdentity = {
|
|
1835
|
+
vendor: 'ledger';
|
|
1836
|
+
type: 'chainFingerprint';
|
|
1837
|
+
chain: ChainForFingerprint;
|
|
1838
|
+
value: string;
|
|
1839
|
+
} | {
|
|
1840
|
+
vendor: 'trezor';
|
|
1841
|
+
type: 'deviceId';
|
|
1842
|
+
value: string;
|
|
1843
|
+
} | {
|
|
1844
|
+
vendor: 'keystone';
|
|
1845
|
+
type: 'walletId';
|
|
1846
|
+
value: string;
|
|
1847
|
+
};
|
|
1834
1848
|
|
|
1835
1849
|
/** Which `GET_VK` encoding the Ledger Zcash app should return. */
|
|
1836
1850
|
type ZcashFullViewingKeyMode = 'ufvk' | 'orchardFvk';
|