Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@ledgerhq/hw-app-trx

LedgerHQ45.7kApache-2.06.31.8TypeScript support: included

Ledger Hardware Wallet Tron Application API

Ledger, LedgerWallet, Tron, Trx, NanoS, Blue, Hardware Wallet

readme

GitHub, Ledger Devs Discord, Developer Portal

@ledgerhq/hw-app-trx

Ledger Hardware Wallet TRX JavaScript bindings.


Are you adding Ledger support to your software wallet?

You may be using this package to communicate with the TRX Nano App.

For a smooth and quick integration:

  • See the developers’ documentation on the Developer Portal and
  • Go on Discord to chat with developer support and the developer community.

API

Table of Contents

Trx

Tron API

Parameters

  • transport Transport
  • scrambleKey (optional, default "TRX")

Examples

import Trx from "@ledgerhq/hw-app-trx";
const trx = new Trx(transport)

getAddress

get Tron address for a given BIP 32 path.

Parameters
Examples
const address = await tron.getAddress("44'/195'/0'/0/0").then(o => o.address)

Returns Promise<{publicKey: string, address: string}> an object with a publicKey and address

signTransaction

sign a Tron transaction with a given BIP 32 path and Token Names

Parameters
  • path string a path in BIP 32 format
  • rawTxHex string a raw transaction hex string
  • tokenSignatures Array<string> Tokens Signatures array
Examples
const signature = await tron.signTransaction("44'/195'/0'/0/0", "0a02f5942208704dda506d59dceb40f0f4978f802e5a69080112650a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412340a1541978dbd103cfe59c35e753d09dd44ae1ae64621c7121541e2ae49db6a70b9b4757d2137a43b69b24a445780188ef8b5ba0470cbb5948f802e", [], 105);

Returns Promise<string> a signature as hex string

signTransactionHash

sign a Tron transaction hash with a given BIP 32 path

Parameters
  • path string a path in BIP 32 format
  • rawTxHashHex string
  • rawTxHex a raw transaction hex string
Examples
const signature = await tron.signTransactionHash("44'/195'/0'/0/0", "25b18a55f86afb10e7aca38d0073d04c80397c6636069193953fdefaea0b8369");

Returns Promise<string> a signature as hex string

getAppConfiguration

get the version of the Tron app installed on the hardware device

Examples
const result = await tron.getAppConfiguration();
{
  "version": "0.1.5",
  "versionN": "105".
  "allowData": false,
  "allowContract": false,
  "truncateAddress": false,
  "signByHash": false
}

Returns Promise<{allowContract: boolean, truncateAddress: boolean, allowData: boolean, signByHash: boolean, version: string, versionN: number}> an object with a version

signPersonalMessage

sign a Tron Message with a given BIP 32 path

Parameters
  • path string a path in BIP 32 format
  • messageHex string
  • message hex string to sign
Examples
const signature = await tron.signPersonalMessage("44'/195'/0'/0/0", "43727970746f436861696e2d54726f6e5352204c6564676572205472616e73616374696f6e73205465737473");

Returns Promise<string> a signature as hex string

signTIP712HashedMessage

Sign a typed data. The host computes the domain separator and hashStruct(message)

Parameters
Examples
const signature = await tronApp.signTIP712HashedMessage("44'/195'/0'/0/0",Buffer.from( "0101010101010101010101010101010101010101010101010101010101010101").toString("hex"), Buffer.from("0202020202020202020202020202020202020202020202020202020202020202").toString("hex"));

getECDHPairKey

get Tron address for a given BIP 32 path.

Parameters
  • path string a path in BIP 32 format
  • publicKey string address public key to generate pair key
Examples
const signature = await tron.getECDHPairKey("44'/195'/0'/0/0", "04ff21f8e64d3a3c0198edfbb7afdc79be959432e92e2f8a1984bb436a414b8edcec0345aad0c1bf7da04fd036dd7f9f617e30669224283d950fab9dd84831dc83");

Returns Promise<string> shared key hex string,

changelog

@ledgerhq/hw-app-trx

6.31.8

Patch Changes

6.31.8-next.0

Patch Changes

6.31.7

Patch Changes

6.31.7-next.0

Patch Changes

6.31.6

Patch Changes

6.31.6-next.0

Patch Changes

6.31.5

Patch Changes

6.31.5-next.0

Patch Changes

6.31.4

Patch Changes

6.31.4-next.0

Patch Changes

6.31.3

Patch Changes

6.31.3-next.0

Patch Changes

6.31.2

Patch Changes

6.31.2-next.1

Patch Changes

6.31.2-next.0

Patch Changes

6.31.1

Patch Changes

6.31.1-next.0

Patch Changes

6.31.0

Minor Changes

6.31.0-next.0

Minor Changes

6.30.0

Minor Changes

6.30.0-next.0

Minor Changes

6.29.4

Patch Changes

6.29.4-next.0

Patch Changes

6.29.3

Patch Changes

6.29.3-next.0

Patch Changes

6.29.2

Patch Changes

6.29.2-hotfix.0

Patch Changes

6.29.1

Patch Changes

6.29.1-next.0

Patch Changes

6.29.0

Minor Changes

Patch Changes

6.29.0-next.0

Minor Changes

Patch Changes

6.28.6

Patch Changes

6.28.6-next.0

Patch Changes

6.28.5

Patch Changes

6.28.5-next.0

Patch Changes

6.28.4

Patch Changes

6.28.4-next.0

Patch Changes

6.28.3

Patch Changes

6.28.3-next.0

Patch Changes

6.28.2

Patch Changes

6.28.2-next.0

Patch Changes

6.28.1

Patch Changes

6.28.1-next.0

Patch Changes

6.28.0

Minor Changes

Patch Changes

6.28.0-next.0

Minor Changes

Patch Changes

6.27.20

Patch Changes

6.27.20-next.0

Patch Changes

6.27.19

Patch Changes

6.27.19-next.0

Patch Changes

6.27.18

Patch Changes

6.27.18-next.0

Patch Changes

6.27.17

Patch Changes

6.27.17-next.0

Patch Changes

6.27.16

Patch Changes

6.27.16-next.0

Patch Changes

6.27.15

Patch Changes

6.27.15-next.0

Patch Changes

6.27.14

Patch Changes

6.27.14-next.0

Patch Changes

6.27.13

Patch Changes

6.27.13-next.0

Patch Changes

6.27.12

Patch Changes

6.27.12-next.0

Patch Changes

6.27.11

Patch Changes

6.27.11-next.0

Patch Changes

6.27.10

Patch Changes

6.27.10-next.0

Patch Changes

6.27.9

Patch Changes

6.27.9-next.0

Patch Changes

6.27.8

Patch Changes

6.27.8-next.0

Patch Changes

6.27.7

Patch Changes

6.27.7-next.0

Patch Changes

6.27.6

Patch Changes

6.27.6-next.0

Patch Changes

6.27.5

Patch Changes

6.27.5-next.0

Patch Changes

6.27.4

Patch Changes

6.27.4-next.0

Patch Changes

6.27.3

Patch Changes

6.27.3-next.0

Patch Changes

6.27.2

Patch Changes

6.27.2-next.0

Patch Changes