@haneullabs/ledgerjs-hw-app-haneul
v0.1.0
Published
Ledger Hardware Wallet Haneul Application API
Maintainers
Readme
Ledger Github, Ledger Developer Portal, Ledger Developer Discord
ledgerjs-hw-app-haneul
Ledger Hardware Wallet JavaScript bindings for Haneul, based on LedgerJS.
Using LedgerJS for Haneul
Here is a sample app for Node:
const Transport = require('@ledgerhq/hw-transport').default;
const Haneul = require('@haneullabs/ledgerjs-hw-app-haneul').default;
const getPublicKey = async () => {
const haneul = new Haneul(await Transport.create());
return await haneul.getPublicKey("44'/784'/0'/0'/0'");
};
const signTransaction = async () => {
const haneul = new Haneul(await Transport.create());
return await haneul.signTransaction("44'/784'/0'/0'/0'", '<transaction contents>');
};
const getVersion = async () => {
const haneul = new Haneul(await Transport.create());
return await haneul.getVersion();
};
const doAll = async () => {
console.log(await getPublicKey());
console.log(await signTransaction());
console.log(await getVersion());
};
doAll().catch((err) => console.log(err));API
Table of Contents
Parameters
transportTransport<any>scrambleKeystring (optional, default"Haneul")
Examples
import Haneul from '@haneullabs/ledgerjs-hw-app-haneul';
const transport = await Transport.create();
const haneul = new Haneul(transport);getPublicKey
Gets the Haneul address for a given BIP-32 path.
Parameters
pathstring a path in BIP-32 formatdisplayOnDeviceboolean whether or not to display the address on the Ledger device.
Examples
const publicKey = await haneul.getPublicKey("44'/784'/0'/0'/0'");Returns Promise<string> an object with a public key.
signTransaction
Sign a transaction with a given BIP-32 path.
Parameters
pathstring a path in BIP-32 format
Examples
const publicKey = await haneul.signTransaction("44'/784'/0'/0'/0'", '<transaction contents>');Returns Promise<object> an object with text field containing a signature.
getVersion
Get the version of the application installed on the hardware device.
Examples
console.log(await haneul.getVersion());for version 0.1.0, it produces something like
{
major: 0
minor: 1
patch: 0
}Returns Promise<{object}> an object with major, minor, and patch of the version.
