@bytezhang/ledger-adapter 0.0.18 → 0.0.20

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/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { IHardwareWallet, IConnector, TransportType, IUiHandler, DeviceInfo, Response, ChainCapability, HardwareEventMap, DeviceEventListener, ChainForFingerprint, EvmGetAddressParams, EvmAddress, ProgressCallback, EvmGetPublicKeyParams, EvmPublicKey, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolGetPublicKeyParams, SolPublicKey, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, ConnectionType, DeviceDescriptor, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, DeviceChangeEvent, HardwareErrorCode } from '@bytezhang/hardware-wallet-core';
1
+ import { IHardwareWallet, IConnector, TransportType, IUiHandler, DeviceInfo, Response, ChainCapability, HardwareEventMap, DeviceEventListener, ChainForFingerprint, EvmGetAddressParams, EvmAddress, ProgressCallback, EvmGetPublicKeyParams, EvmPublicKey, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolGetPublicKeyParams, SolPublicKey, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, ConnectionType, DeviceDescriptor, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, DeviceChangeEvent, HardwareErrorCode } from '@bytezhang/hardware-wallet-core';
2
2
 
3
3
  /**
4
4
  * Ledger hardware wallet adapter that delegates to an IConnector.
@@ -56,15 +56,19 @@ declare class LedgerAdapter implements IHardwareWallet {
56
56
  btcGetAddresses(connectId: string, deviceId: string, params: BtcGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<BtcAddress[]>>;
57
57
  btcGetPublicKey(connectId: string, _deviceId: string, params: BtcGetPublicKeyParams): Promise<Response<BtcPublicKey>>;
58
58
  btcSignTransaction(connectId: string, _deviceId: string, params: BtcSignTxParams): Promise<Response<BtcSignedTx>>;
59
- btcSignMessage(_connectId: string, _deviceId: string, _params: BtcSignMsgParams): Promise<Response<BtcSignature>>;
59
+ btcSignMessage(connectId: string, _deviceId: string, params: BtcSignMsgParams): Promise<Response<BtcSignature>>;
60
60
  btcGetMasterFingerprint(connectId: string, _deviceId: string): Promise<Response<{
61
61
  masterFingerprint: string;
62
62
  }>>;
63
63
  solGetAddress(connectId: string, _deviceId: string, params: SolGetAddressParams): Promise<Response<SolAddress>>;
64
64
  solGetAddresses(connectId: string, deviceId: string, params: SolGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<SolAddress[]>>;
65
65
  solGetPublicKey(connectId: string, _deviceId: string, params: SolGetPublicKeyParams): Promise<Response<SolPublicKey>>;
66
- solSignTransaction(_connectId: string, _deviceId: string, _params: SolSignTxParams): Promise<Response<SolSignedTx>>;
67
- solSignMessage(_connectId: string, _deviceId: string, _params: SolSignMsgParams): Promise<Response<SolSignature>>;
66
+ solSignTransaction(connectId: string, _deviceId: string, params: SolSignTxParams): Promise<Response<SolSignedTx>>;
67
+ solSignMessage(connectId: string, _deviceId: string, params: SolSignMsgParams): Promise<Response<SolSignature>>;
68
+ tronGetAddress(connectId: string, _deviceId: string, params: TronGetAddressParams): Promise<Response<TronAddress>>;
69
+ tronGetAddresses(connectId: string, deviceId: string, params: TronGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<TronAddress[]>>;
70
+ tronSignTransaction(connectId: string, _deviceId: string, params: TronSignTxParams): Promise<Response<TronSignedTx>>;
71
+ tronSignMessage(connectId: string, _deviceId: string, params: TronSignMsgParams): Promise<Response<TronSignature>>;
68
72
  /**
69
73
  * Ensure at least one device is connected and return a valid connectId.
70
74
  *
@@ -173,6 +177,17 @@ interface IDmk {
173
177
  sessionId: string;
174
178
  command: unknown;
175
179
  }): Promise<unknown>;
180
+ /**
181
+ * Send a raw APDU to a connected device.
182
+ * Used for chains without a dedicated DMK signer kit (e.g. TRON).
183
+ */
184
+ sendApdu(params: {
185
+ sessionId: string;
186
+ apdu: Uint8Array;
187
+ }): Promise<{
188
+ statusCode: Uint8Array;
189
+ data: Uint8Array;
190
+ }>;
176
191
  close?(): void;
177
192
  }
178
193
  interface DeviceActionState$1<T> {
@@ -273,6 +288,9 @@ declare class LedgerConnectorBase implements IConnector {
273
288
  private _solGetAddress;
274
289
  private _solSignTransaction;
275
290
  private _solSignMessage;
291
+ private _tronGetAddress;
292
+ private _tronSignTransaction;
293
+ private _tronSignMessage;
276
294
  /**
277
295
  * Lazily create or return the DMK instance.
278
296
  * If a DMK was provided via constructor, it is used directly.
@@ -284,6 +302,7 @@ declare class LedgerConnectorBase implements IConnector {
284
302
  private _getEthSigner;
285
303
  private _createBtcSigner;
286
304
  private _createSolSigner;
305
+ private _createTronSigner;
287
306
  private _invalidateSession;
288
307
  private _resetManagers;
289
308
  private _emit;
@@ -393,6 +412,9 @@ interface ISdkSignerBtc {
393
412
  getMasterFingerprint(options?: {
394
413
  skipOpenApp?: boolean;
395
414
  }): unknown;
415
+ signPsbt(wallet: unknown, psbt: unknown, options?: unknown): unknown;
416
+ signTransaction(wallet: unknown, psbt: unknown, options?: unknown): unknown;
417
+ signMessage(derivationPath: string, message: string, options?: unknown): unknown;
396
418
  }
397
419
  /**
398
420
  * Wraps Ledger's BTC SDK signer (Observable-based DeviceActions) into
@@ -412,6 +434,26 @@ declare class SignerBtc {
412
434
  getMasterFingerprint(options?: {
413
435
  skipOpenApp?: boolean;
414
436
  }): Promise<Uint8Array>;
437
+ /**
438
+ * Sign a PSBT and return the array of partial signatures.
439
+ * The `wallet` param is a DefaultWallet or WalletPolicy instance.
440
+ * The `psbt` param can be a hex string, base64 string, or Uint8Array.
441
+ */
442
+ signPsbt(wallet: unknown, psbt: unknown, options?: unknown): Promise<unknown[]>;
443
+ /**
444
+ * Sign a PSBT and return the fully extracted raw transaction as a hex string.
445
+ * Like signPsbt, but also finalises the PSBT and extracts the transaction.
446
+ */
447
+ signTransaction(wallet: unknown, psbt: unknown, options?: unknown): Promise<string>;
448
+ /**
449
+ * Sign a message with the BTC app (BIP-137 / "Bitcoin Signed Message").
450
+ * Returns `{ r, s, v }` signature object.
451
+ */
452
+ signMessage(derivationPath: string, message: string, options?: unknown): Promise<{
453
+ r: string;
454
+ s: string;
455
+ v: number;
456
+ }>;
415
457
  }
416
458
 
417
459
  /**
@@ -452,6 +494,81 @@ declare class SignerSol {
452
494
  signMessage(derivationPath: string, message: string | Uint8Array, options?: unknown): Promise<Uint8Array>;
453
495
  }
454
496
 
497
+ /**
498
+ * TRON Ledger signer — sends raw APDUs to the TRON app on the Ledger device.
499
+ *
500
+ * Unlike EVM/BTC/SOL which have dedicated DMK signer kits,
501
+ * TRON requires direct APDU communication. This class builds and sends
502
+ * the APDU packets according to the TRON Ledger app protocol.
503
+ *
504
+ * APDU Protocol Reference (Ledger hw-app-trx / PR #1284):
505
+ * CLA = 0xE0
506
+ * INS_ADDRESS = 0x02
507
+ * INS_SIGN = 0x04
508
+ * INS_VERSION = 0x06
509
+ * INS_SIGN_MESSAGE = 0x08
510
+ * CHUNK_SIZE = 250
511
+ */
512
+ /**
513
+ * Function to send a raw APDU to the Ledger device and receive the response.
514
+ *
515
+ * The raw APDU is `[CLA, INS, P1, P2, Lc, ...data]`.
516
+ * The response is `{ statusCode: Uint8Array (2 bytes), data: Uint8Array }`.
517
+ */
518
+ type SendApduFn = (rawApdu: Uint8Array) => Promise<{
519
+ statusCode: Uint8Array;
520
+ data: Uint8Array;
521
+ }>;
522
+ interface TronAddressResult {
523
+ publicKey: string;
524
+ address: string;
525
+ }
526
+ /**
527
+ * TRON signer that communicates with the Ledger TRON app via raw APDUs.
528
+ *
529
+ * Implements getAddress, signTransaction, and signMessage using the
530
+ * APDU protocol described in the Ledger TRON app documentation.
531
+ */
532
+ declare class SignerTron {
533
+ private readonly _sendApdu;
534
+ constructor(_sendApdu: SendApduFn);
535
+ /**
536
+ * Get the TRON address at the given derivation path.
537
+ *
538
+ * APDU: CLA=0xE0, INS=0x02, P1=(showOnDevice?0x01:0x00), P2=0x00
539
+ * Data: pathCount(1) + paths(4 bytes each, big-endian, hardened bit)
540
+ * Response: pubKeyLen(1) + pubKey(pubKeyLen) + addrLen(1) + addr(addrLen, ASCII base58)
541
+ */
542
+ getAddress(path: string, options?: {
543
+ checkOnDevice?: boolean;
544
+ }): Promise<TronAddressResult>;
545
+ /**
546
+ * Sign a TRON transaction (protobuf-encoded raw transaction).
547
+ *
548
+ * The transaction bytes are split into 250-byte chunks and sent sequentially.
549
+ * First chunk includes the serialized derivation path prefix.
550
+ *
551
+ * P1 flags:
552
+ * 0x10 = single chunk (entire tx fits in one APDU)
553
+ * 0x00 = first chunk of multi-chunk
554
+ * 0x80 = middle chunk (continuation)
555
+ * 0x90 = last chunk (final continuation)
556
+ *
557
+ * Returns: 65-byte signature as hex string (no 0x prefix).
558
+ */
559
+ signTransaction(path: string, rawTxHex: string): Promise<string>;
560
+ /**
561
+ * Sign a personal message with the TRON app.
562
+ *
563
+ * First chunk: pathCount(1) + paths(4 bytes BE) + messageLength(4 bytes BE) + message bytes
564
+ * Subsequent: continuation bytes
565
+ * P1: 0x00 = first, 0x80 = continuation
566
+ *
567
+ * Returns: 65-byte signature as hex string (no 0x prefix).
568
+ */
569
+ signMessage(path: string, messageHex: string): Promise<string>;
570
+ }
571
+
455
572
  /** DeviceAction state emitted by DMK signer operations. */
456
573
  interface DeviceActionState<T> {
457
574
  status: 'pending' | 'completed' | 'error';
@@ -465,6 +582,9 @@ interface DeviceActionState<T> {
465
582
  /**
466
583
  * Convert a DMK DeviceAction (Observable-based) into a Promise.
467
584
  * Handles pending → completed/error state transitions and interaction callbacks.
585
+ *
586
+ * @param timeoutMs Timeout in ms. Resets each time the Observable emits (device is alive).
587
+ * Pass 0 to disable. Default: 30s.
468
588
  */
469
589
  declare function deviceActionToPromise<T>(action: {
470
590
  observable: {
@@ -476,7 +596,7 @@ declare function deviceActionToPromise<T>(action: {
476
596
  unsubscribe: () => void;
477
597
  };
478
598
  };
479
- }, onInteraction?: (interaction: string) => void): Promise<T>;
599
+ }, onInteraction?: (interaction: string) => void, timeoutMs?: number): Promise<T>;
480
600
 
481
601
  declare function registerTransport(type: string, provider: TransportProvider): void;
482
602
  declare function unregisterTransport(type: string): void;
@@ -536,4 +656,4 @@ declare function mapLedgerError(err: unknown): {
536
656
  message: string;
537
657
  };
538
658
 
539
- export { AppManager, type DeviceActionState$1 as DeviceActionState, type DmkDiscoveredDevice, type IDmk, LedgerAdapter, LedgerConnectorBase, type LedgerConnectorBaseOptions, LedgerDeviceManager, SignerBtc, type SignerBtcAddress, SignerEth, type SignerEvmAddress, type SignerEvmSignature, SignerManager, SignerSol, type TransportFactory, type TransportProvider, type TransportProviderInstance, type TransportProviderOptions, clearRegistry, deviceActionToPromise, getTransportProvider, isDeviceLockedError, listRegisteredTransports, mapLedgerError, registerTransport, unregisterTransport };
659
+ export { AppManager, type DeviceActionState$1 as DeviceActionState, type DmkDiscoveredDevice, type IDmk, LedgerAdapter, LedgerConnectorBase, type LedgerConnectorBaseOptions, LedgerDeviceManager, SignerBtc, type SignerBtcAddress, SignerEth, type SignerEvmAddress, type SignerEvmSignature, SignerManager, SignerSol, SignerTron, type TransportFactory, type TransportProvider, type TransportProviderInstance, type TransportProviderOptions, clearRegistry, deviceActionToPromise, getTransportProvider, isDeviceLockedError, listRegisteredTransports, mapLedgerError, registerTransport, unregisterTransport };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IHardwareWallet, IConnector, TransportType, IUiHandler, DeviceInfo, Response, ChainCapability, HardwareEventMap, DeviceEventListener, ChainForFingerprint, EvmGetAddressParams, EvmAddress, ProgressCallback, EvmGetPublicKeyParams, EvmPublicKey, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolGetPublicKeyParams, SolPublicKey, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, ConnectionType, DeviceDescriptor, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, DeviceChangeEvent, HardwareErrorCode } from '@bytezhang/hardware-wallet-core';
1
+ import { IHardwareWallet, IConnector, TransportType, IUiHandler, DeviceInfo, Response, ChainCapability, HardwareEventMap, DeviceEventListener, ChainForFingerprint, EvmGetAddressParams, EvmAddress, ProgressCallback, EvmGetPublicKeyParams, EvmPublicKey, EvmSignTxParams, EvmSignedTx, EvmSignMsgParams, EvmSignature, EvmSignTypedDataParams, BtcGetAddressParams, BtcAddress, BtcGetPublicKeyParams, BtcPublicKey, BtcSignTxParams, BtcSignedTx, BtcSignMsgParams, BtcSignature, SolGetAddressParams, SolAddress, SolGetPublicKeyParams, SolPublicKey, SolSignTxParams, SolSignedTx, SolSignMsgParams, SolSignature, TronGetAddressParams, TronAddress, TronSignTxParams, TronSignedTx, TronSignMsgParams, TronSignature, ConnectionType, DeviceDescriptor, ConnectorDevice, ConnectorSession, ConnectorEventType, ConnectorEventMap, DeviceChangeEvent, HardwareErrorCode } from '@bytezhang/hardware-wallet-core';
2
2
 
3
3
  /**
4
4
  * Ledger hardware wallet adapter that delegates to an IConnector.
@@ -56,15 +56,19 @@ declare class LedgerAdapter implements IHardwareWallet {
56
56
  btcGetAddresses(connectId: string, deviceId: string, params: BtcGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<BtcAddress[]>>;
57
57
  btcGetPublicKey(connectId: string, _deviceId: string, params: BtcGetPublicKeyParams): Promise<Response<BtcPublicKey>>;
58
58
  btcSignTransaction(connectId: string, _deviceId: string, params: BtcSignTxParams): Promise<Response<BtcSignedTx>>;
59
- btcSignMessage(_connectId: string, _deviceId: string, _params: BtcSignMsgParams): Promise<Response<BtcSignature>>;
59
+ btcSignMessage(connectId: string, _deviceId: string, params: BtcSignMsgParams): Promise<Response<BtcSignature>>;
60
60
  btcGetMasterFingerprint(connectId: string, _deviceId: string): Promise<Response<{
61
61
  masterFingerprint: string;
62
62
  }>>;
63
63
  solGetAddress(connectId: string, _deviceId: string, params: SolGetAddressParams): Promise<Response<SolAddress>>;
64
64
  solGetAddresses(connectId: string, deviceId: string, params: SolGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<SolAddress[]>>;
65
65
  solGetPublicKey(connectId: string, _deviceId: string, params: SolGetPublicKeyParams): Promise<Response<SolPublicKey>>;
66
- solSignTransaction(_connectId: string, _deviceId: string, _params: SolSignTxParams): Promise<Response<SolSignedTx>>;
67
- solSignMessage(_connectId: string, _deviceId: string, _params: SolSignMsgParams): Promise<Response<SolSignature>>;
66
+ solSignTransaction(connectId: string, _deviceId: string, params: SolSignTxParams): Promise<Response<SolSignedTx>>;
67
+ solSignMessage(connectId: string, _deviceId: string, params: SolSignMsgParams): Promise<Response<SolSignature>>;
68
+ tronGetAddress(connectId: string, _deviceId: string, params: TronGetAddressParams): Promise<Response<TronAddress>>;
69
+ tronGetAddresses(connectId: string, deviceId: string, params: TronGetAddressParams[], onProgress?: ProgressCallback): Promise<Response<TronAddress[]>>;
70
+ tronSignTransaction(connectId: string, _deviceId: string, params: TronSignTxParams): Promise<Response<TronSignedTx>>;
71
+ tronSignMessage(connectId: string, _deviceId: string, params: TronSignMsgParams): Promise<Response<TronSignature>>;
68
72
  /**
69
73
  * Ensure at least one device is connected and return a valid connectId.
70
74
  *
@@ -173,6 +177,17 @@ interface IDmk {
173
177
  sessionId: string;
174
178
  command: unknown;
175
179
  }): Promise<unknown>;
180
+ /**
181
+ * Send a raw APDU to a connected device.
182
+ * Used for chains without a dedicated DMK signer kit (e.g. TRON).
183
+ */
184
+ sendApdu(params: {
185
+ sessionId: string;
186
+ apdu: Uint8Array;
187
+ }): Promise<{
188
+ statusCode: Uint8Array;
189
+ data: Uint8Array;
190
+ }>;
176
191
  close?(): void;
177
192
  }
178
193
  interface DeviceActionState$1<T> {
@@ -273,6 +288,9 @@ declare class LedgerConnectorBase implements IConnector {
273
288
  private _solGetAddress;
274
289
  private _solSignTransaction;
275
290
  private _solSignMessage;
291
+ private _tronGetAddress;
292
+ private _tronSignTransaction;
293
+ private _tronSignMessage;
276
294
  /**
277
295
  * Lazily create or return the DMK instance.
278
296
  * If a DMK was provided via constructor, it is used directly.
@@ -284,6 +302,7 @@ declare class LedgerConnectorBase implements IConnector {
284
302
  private _getEthSigner;
285
303
  private _createBtcSigner;
286
304
  private _createSolSigner;
305
+ private _createTronSigner;
287
306
  private _invalidateSession;
288
307
  private _resetManagers;
289
308
  private _emit;
@@ -393,6 +412,9 @@ interface ISdkSignerBtc {
393
412
  getMasterFingerprint(options?: {
394
413
  skipOpenApp?: boolean;
395
414
  }): unknown;
415
+ signPsbt(wallet: unknown, psbt: unknown, options?: unknown): unknown;
416
+ signTransaction(wallet: unknown, psbt: unknown, options?: unknown): unknown;
417
+ signMessage(derivationPath: string, message: string, options?: unknown): unknown;
396
418
  }
397
419
  /**
398
420
  * Wraps Ledger's BTC SDK signer (Observable-based DeviceActions) into
@@ -412,6 +434,26 @@ declare class SignerBtc {
412
434
  getMasterFingerprint(options?: {
413
435
  skipOpenApp?: boolean;
414
436
  }): Promise<Uint8Array>;
437
+ /**
438
+ * Sign a PSBT and return the array of partial signatures.
439
+ * The `wallet` param is a DefaultWallet or WalletPolicy instance.
440
+ * The `psbt` param can be a hex string, base64 string, or Uint8Array.
441
+ */
442
+ signPsbt(wallet: unknown, psbt: unknown, options?: unknown): Promise<unknown[]>;
443
+ /**
444
+ * Sign a PSBT and return the fully extracted raw transaction as a hex string.
445
+ * Like signPsbt, but also finalises the PSBT and extracts the transaction.
446
+ */
447
+ signTransaction(wallet: unknown, psbt: unknown, options?: unknown): Promise<string>;
448
+ /**
449
+ * Sign a message with the BTC app (BIP-137 / "Bitcoin Signed Message").
450
+ * Returns `{ r, s, v }` signature object.
451
+ */
452
+ signMessage(derivationPath: string, message: string, options?: unknown): Promise<{
453
+ r: string;
454
+ s: string;
455
+ v: number;
456
+ }>;
415
457
  }
416
458
 
417
459
  /**
@@ -452,6 +494,81 @@ declare class SignerSol {
452
494
  signMessage(derivationPath: string, message: string | Uint8Array, options?: unknown): Promise<Uint8Array>;
453
495
  }
454
496
 
497
+ /**
498
+ * TRON Ledger signer — sends raw APDUs to the TRON app on the Ledger device.
499
+ *
500
+ * Unlike EVM/BTC/SOL which have dedicated DMK signer kits,
501
+ * TRON requires direct APDU communication. This class builds and sends
502
+ * the APDU packets according to the TRON Ledger app protocol.
503
+ *
504
+ * APDU Protocol Reference (Ledger hw-app-trx / PR #1284):
505
+ * CLA = 0xE0
506
+ * INS_ADDRESS = 0x02
507
+ * INS_SIGN = 0x04
508
+ * INS_VERSION = 0x06
509
+ * INS_SIGN_MESSAGE = 0x08
510
+ * CHUNK_SIZE = 250
511
+ */
512
+ /**
513
+ * Function to send a raw APDU to the Ledger device and receive the response.
514
+ *
515
+ * The raw APDU is `[CLA, INS, P1, P2, Lc, ...data]`.
516
+ * The response is `{ statusCode: Uint8Array (2 bytes), data: Uint8Array }`.
517
+ */
518
+ type SendApduFn = (rawApdu: Uint8Array) => Promise<{
519
+ statusCode: Uint8Array;
520
+ data: Uint8Array;
521
+ }>;
522
+ interface TronAddressResult {
523
+ publicKey: string;
524
+ address: string;
525
+ }
526
+ /**
527
+ * TRON signer that communicates with the Ledger TRON app via raw APDUs.
528
+ *
529
+ * Implements getAddress, signTransaction, and signMessage using the
530
+ * APDU protocol described in the Ledger TRON app documentation.
531
+ */
532
+ declare class SignerTron {
533
+ private readonly _sendApdu;
534
+ constructor(_sendApdu: SendApduFn);
535
+ /**
536
+ * Get the TRON address at the given derivation path.
537
+ *
538
+ * APDU: CLA=0xE0, INS=0x02, P1=(showOnDevice?0x01:0x00), P2=0x00
539
+ * Data: pathCount(1) + paths(4 bytes each, big-endian, hardened bit)
540
+ * Response: pubKeyLen(1) + pubKey(pubKeyLen) + addrLen(1) + addr(addrLen, ASCII base58)
541
+ */
542
+ getAddress(path: string, options?: {
543
+ checkOnDevice?: boolean;
544
+ }): Promise<TronAddressResult>;
545
+ /**
546
+ * Sign a TRON transaction (protobuf-encoded raw transaction).
547
+ *
548
+ * The transaction bytes are split into 250-byte chunks and sent sequentially.
549
+ * First chunk includes the serialized derivation path prefix.
550
+ *
551
+ * P1 flags:
552
+ * 0x10 = single chunk (entire tx fits in one APDU)
553
+ * 0x00 = first chunk of multi-chunk
554
+ * 0x80 = middle chunk (continuation)
555
+ * 0x90 = last chunk (final continuation)
556
+ *
557
+ * Returns: 65-byte signature as hex string (no 0x prefix).
558
+ */
559
+ signTransaction(path: string, rawTxHex: string): Promise<string>;
560
+ /**
561
+ * Sign a personal message with the TRON app.
562
+ *
563
+ * First chunk: pathCount(1) + paths(4 bytes BE) + messageLength(4 bytes BE) + message bytes
564
+ * Subsequent: continuation bytes
565
+ * P1: 0x00 = first, 0x80 = continuation
566
+ *
567
+ * Returns: 65-byte signature as hex string (no 0x prefix).
568
+ */
569
+ signMessage(path: string, messageHex: string): Promise<string>;
570
+ }
571
+
455
572
  /** DeviceAction state emitted by DMK signer operations. */
456
573
  interface DeviceActionState<T> {
457
574
  status: 'pending' | 'completed' | 'error';
@@ -465,6 +582,9 @@ interface DeviceActionState<T> {
465
582
  /**
466
583
  * Convert a DMK DeviceAction (Observable-based) into a Promise.
467
584
  * Handles pending → completed/error state transitions and interaction callbacks.
585
+ *
586
+ * @param timeoutMs Timeout in ms. Resets each time the Observable emits (device is alive).
587
+ * Pass 0 to disable. Default: 30s.
468
588
  */
469
589
  declare function deviceActionToPromise<T>(action: {
470
590
  observable: {
@@ -476,7 +596,7 @@ declare function deviceActionToPromise<T>(action: {
476
596
  unsubscribe: () => void;
477
597
  };
478
598
  };
479
- }, onInteraction?: (interaction: string) => void): Promise<T>;
599
+ }, onInteraction?: (interaction: string) => void, timeoutMs?: number): Promise<T>;
480
600
 
481
601
  declare function registerTransport(type: string, provider: TransportProvider): void;
482
602
  declare function unregisterTransport(type: string): void;
@@ -536,4 +656,4 @@ declare function mapLedgerError(err: unknown): {
536
656
  message: string;
537
657
  };
538
658
 
539
- export { AppManager, type DeviceActionState$1 as DeviceActionState, type DmkDiscoveredDevice, type IDmk, LedgerAdapter, LedgerConnectorBase, type LedgerConnectorBaseOptions, LedgerDeviceManager, SignerBtc, type SignerBtcAddress, SignerEth, type SignerEvmAddress, type SignerEvmSignature, SignerManager, SignerSol, type TransportFactory, type TransportProvider, type TransportProviderInstance, type TransportProviderOptions, clearRegistry, deviceActionToPromise, getTransportProvider, isDeviceLockedError, listRegisteredTransports, mapLedgerError, registerTransport, unregisterTransport };
659
+ export { AppManager, type DeviceActionState$1 as DeviceActionState, type DmkDiscoveredDevice, type IDmk, LedgerAdapter, LedgerConnectorBase, type LedgerConnectorBaseOptions, LedgerDeviceManager, SignerBtc, type SignerBtcAddress, SignerEth, type SignerEvmAddress, type SignerEvmSignature, SignerManager, SignerSol, SignerTron, type TransportFactory, type TransportProvider, type TransportProviderInstance, type TransportProviderOptions, clearRegistry, deviceActionToPromise, getTransportProvider, isDeviceLockedError, listRegisteredTransports, mapLedgerError, registerTransport, unregisterTransport };