@ledgerhq/hw-app-trx
Version:
Ledger Hardware Wallet Tron Application API
99 lines • 4.33 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import type Transport from "@ledgerhq/hw-transport";
/**
* Tron API
*
* @example
* import Trx from "@ledgerhq/hw-app-trx";
* const trx = new Trx(transport)
*/
export default class Trx {
transport: Transport;
constructor(transport: Transport, scrambleKey?: string);
/**
* get Tron address for a given BIP 32 path.
* @param path a path in BIP 32 format
* @option boolDisplay optionally enable or not the display
* @return an object with a publicKey and address
* @example
* const address = await tron.getAddress("44'/195'/0'/0/0").then(o => o.address)
*/
getAddress(path: string, boolDisplay?: boolean): Promise<{
publicKey: string;
address: string;
}>;
getNextLength(tx: Buffer): number;
/**
* sign a Tron transaction with a given BIP 32 path and Token Names
*
* @param path a path in BIP 32 format
* @param rawTxHex a raw transaction hex string
* @param tokenSignatures Tokens Signatures array
* @option version pack message based on ledger firmware version
* @option smartContract boolean hack to set limit buffer on ledger device
* @return a signature as hex string
* @example
* const signature = await tron.signTransaction("44'/195'/0'/0/0", "0a02f5942208704dda506d59dceb40f0f4978f802e5a69080112650a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412340a1541978dbd103cfe59c35e753d09dd44ae1ae64621c7121541e2ae49db6a70b9b4757d2137a43b69b24a445780188ef8b5ba0470cbb5948f802e", [], 105);
*/
signTransaction(path: string, rawTxHex: string, tokenSignatures: string[]): Promise<string>;
/**
* sign a Tron transaction hash with a given BIP 32 path
*
* @param path a path in BIP 32 format
* @param rawTxHex a raw transaction hex string
* @return a signature as hex string
* @example
* const signature = await tron.signTransactionHash("44'/195'/0'/0/0", "25b18a55f86afb10e7aca38d0073d04c80397c6636069193953fdefaea0b8369");
*/
signTransactionHash(path: string, rawTxHashHex: string): Promise<string>;
/**
* get the version of the Tron app installed on the hardware device
*
* @return an object with a version
* @example
* const result = await tron.getAppConfiguration();
* {
* "version": "0.1.5",
* "versionN": "105".
* "allowData": false,
* "allowContract": false,
* "truncateAddress": false,
* "signByHash": false
* }
*/
getAppConfiguration(): Promise<{
allowContract: boolean;
truncateAddress: boolean;
allowData: boolean;
signByHash: boolean;
version: string;
versionN: number;
}>;
/**
* sign a Tron Message with a given BIP 32 path
*
* @param path a path in BIP 32 format
* @param message hex string to sign
* @return a signature as hex string
* @example
* const signature = await tron.signPersonalMessage("44'/195'/0'/0/0", "43727970746f436861696e2d54726f6e5352204c6564676572205472616e73616374696f6e73205465737473");
*/
signPersonalMessage(path: string, messageHex: string): Promise<string>;
/**
* Sign a typed data. The host computes the domain separator and hashStruct(message)
* @example
const signature = await tronApp.signTIP712HashedMessage("44'/195'/0'/0/0",Buffer.from( "0101010101010101010101010101010101010101010101010101010101010101").toString("hex"), Buffer.from("0202020202020202020202020202020202020202020202020202020202020202").toString("hex"));
*/
signTIP712HashedMessage(path: string, domainSeparatorHex: string, hashStructMessageHex: string): Promise<string>;
/**
* get Tron address for a given BIP 32 path.
* @param path a path in BIP 32 format
* @param publicKey address public key to generate pair key
* @return shared key hex string,
* @example
* const signature = await tron.getECDHPairKey("44'/195'/0'/0/0", "04ff21f8e64d3a3c0198edfbb7afdc79be959432e92e2f8a1984bb436a414b8edcec0345aad0c1bf7da04fd036dd7f9f617e30669224283d950fab9dd84831dc83");
*/
getECDHPairKey(path: string, publicKey: string): Promise<string>;
}
//# sourceMappingURL=Trx.d.ts.map