@axiaglobal/hd-wallet
v2.0.0
Published
Ledger Hardware Wallet Axia API
Downloads
4
Readme
@axia-systems/hd-wallet
Ledger Hardware Wallet JavaScript bindings for Axia, based on LedgerJS.
Using LedgerJS for Axia
Here is a sample app for Node:
const Transport = require("@ledgerhq/hw-transport-node-hid").default;
const Axia = require("@axia-systems/hd-wallet").default;
const getWalletId = async () => {
const axia = new Axia(await Transport.create());
return await axia.getWalletId();
};
const signHash = async () => {
const transport = await Transport.create();
const axia = new Axia(await Transport.create());
return await axia.signHash(
"44'/9000'/0'/0/0",
"0000000000000000000000000000000000000000000000000000000000000000"
);
};
const getVersion = async () => {
const axia = new Axia(await Transport.create());
return await axia.getAppConfiguration();
};
const getAddress = async () => {
const axia = new Axia(await Transport.create());
return await axia.getWalletPublicKey("44'/9000'/0'/1/0");
};
const doAll = async () => {
console.log(await getWalletId());
console.log(await getVersion());
console.log(await getAddress());
console.log(await signHash());
};
doAll().catch(err => console.log(err));
API
Table of Contents
Axia
Axia API for Ledger
Parameters
transport
Transport<any>
scrambleKey
string (optional, default"Axia"
)
Examples
import Axia from "@zee-ava/hd-wallet-axia";
const axia = new Axia(transport);
getWalletPublicKey
Get Axia address for a given BIP-32 path.
Parameters
path
string a path in BIP-32 format
Examples
const publicKey = await axia.getWalletPublicKey("44'/9000'/0'/0/0");
Returns Promise<string> an object with a public key.
signHash
Sign a 32-byte hash of transaction with a given BIP-32 path
Parameters
Examples
const signature = await axia.signHash("44'/9000'/0'/0/0", "0000000000000000000000000000000000000000000000000000000000000000");
Returns Promise<string> a signature as hex string.
getAppConfiguration
Get the version of the application installed on the hardware device.
Examples
console.log(await axia.getAppConfiguration());
produces something like
{
"version": "1.0.3",
"commit": "1234567",
"name": "Axc"
}
Returns Promise<{version: string, commit: string, name: string}> an object with a version.
getWalletId
Get the wallet identifier for the Ledger wallet. This value distinguishes different Ledger hardware devices which have different seeds.
Examples
console.log(await axia.getWalletId());
produces something like
abcdefgh