Ledger Hardware Wallet Klaytn JavaScript bindings.
Klaytn API
transport
. A transport for sending commands to a devicescrambleKey
. A scramble key (optional, default"klaytn_default_scramble_key"
)
import Klaytn from "blooo/hw-app-klaytn";
const klaytn = new Klaytn(transport);
Get application version.
klaytn.getVersion().then((r) => r.version);
Returns Promise<{version: string}> version object
Get Klaytn address (public key) for a BIP32 path.
path
string a BIP32 path without the address indexdisplay
boolean flag to show display (default)accountIndex
number index of account address (optional, default0
)
klaytn.getAddress("44'/8217'/0'/0/", false, 0).then((r) => r.address);
Returns Promise<{address: string, publicKey: string, chainCode: string | undefined}> an object with the address field
To sign a Klaytn transaction use the method: signTransaction .
txn
. A caver transaction.accountIndex
index of account address (optional, default0
)
import Caver from "caver-js";
const caver = new Caver();
const accountIndex = 1;
const txn = caver.transaction.valueTransfer.create({
from: "enter address here",
to: "enter address here",
value: 1,
gasPrice: 50000000000,
gas: 300000,
nonce: 1,
chainId: 1001,
});
klaytn.signTransaction(txn, accountIndex).then((r) => r.signature);
Returns Promise<{signature: [v,r,s], signedTxn: caver transaction.}> an object with the signed transaction and signature