0.0.2 • Published 4 years ago

hw-app-ttc v0.0.2

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
4 years ago

hw-app-ttc

Ledger Hardware Wallet TTC JavaScript bindings.

API

Table of Contents

TTC

TTC API

Parameters

  • transport Transport<any>
  • scrambleKey string (optional, default "TTC")

Examples

import TTC from "hw-app-ttc";
const ttc = new TTC(transport)

getAddress

get TTC address for a given BIP 32 path.

Parameters
Examples
ttc.getAddress("44'/718'/0'/0/0").then(o => o.address)

Returns Promise<{publicKey: string, address: string, chainCode: string?}> an object with a publicKey, address and (optionally) chainCode

signTransaction

You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign

Parameters
Examples
ttc.signTransaction("44'/718'/0'/0/0", "e8018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a2487400080").then(result => ...)

Returns Promise<{s: string, v: string, r: string}>

getAppConfiguration

Returns Promise< {version: string}>

signPersonalMessage

You can sign a message according to eth_sign RPC call and retrieve v, r, s given the message and the BIP 32 path of the account to sign.

Parameters
Examples
ttc.signPersonalMessage("44'/718'/0'/0/0", Buffer.from("test").toString("hex")).then(result => {
var v = result['v'] - 27;
v = v.toString(16);
if (v.length < 2) {
v = "0" + v;
}
console.log("Signature 0x" + result['r'] + result['s'] + v);
})

Returns Promise<{v: number, s: string, r: string}>