4.14.0
ICON API
(Transport<any>)
import Icx from "@ledgerhq/hw-app-icx";
const icx = new Icx(transport)
Returns public key and ICON address for a given BIP 32 path.
Promise<{publicKey: string, address: string, chainCode: string?}>
:
an object with a publickey(hexa string), address(string) and
(optionally) chaincode(hexa string)
icx.getAddress("44'/4801368'/0'", true, true).then(o => o.address)
Signs a transaction and returns signed message given the raw transaction and the BIP 32 path of the account to sign
(string)
a path in BIP 32 format
(string)
raw transaction data to sign in ASCII string format
Promise<{signedRawTxBase64: string, hashHex: string}>
:
an object with a base64 encoded signature and hash in hexa string
icx.signTransaction("44'/4801368'/0'",
"icx_sendTransaction.fee.0x2386f26fc10000." +
"from.hxc9ecad30b05a0650a337452fce031e0c60eacc3a.nonce.0x3." +
"to.hx4c5101add2caa6a920420cf951f7dd7c7df6ca24.value.0xde0b6b3a7640000")
.then(result => ...)
Sets the given key as the test purpose private key corresponding to "\0'" of BIP 32 path just for test purpose. After calling this function, all functions with "\0'" path works based on this private key. REMARK: Test purpose only such as verifying signTransaction function.
(string)
private key in hexadecimal string format
icx.setTestPrivateKey("23498dc21b9ee52e63e8d6566e0911ac255a38d3fcbc68a51e6b298520b72d6e")
.then(result => ...)
icx.getAddress("0'", false, false).then(o => o.address)