Package Exports
- @secux/app-ltc
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@secux/app-ltc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@secux/app-ltc
SecuX Hardware Wallet LTC API
Usage
import { SecuxLTC, ScriptType } from "@secux/app-ltc";
First, create instance of ITransport
Examples
- Get address by purpose and script type
// native segwit address (default script: P2WPKH)
const address = SecuxLTC.getAddress(
device,
"m/84'/2'/0'/0/0",
// optional object
{
// define specific script
script: ScriptType.P2WPKH
}
);
// segwit address (default script: P2SH_P2WPKH)
const address = SecuxLTC.getAddress(
device,
"m/49'/2'/0'/0/0"
);
// legacy address (default script: P2PKH)
const address = SecuxLTC.getAddress(
device,
"m/44'/2'/0'/0/0"
);
- sign transaction (native segwit has not supported yet)
const inputs = [
{
hash: "7e874e94ae254287ec713b116b7af73067a5e15eb5c19e879d1e465ca53e7d63",
vout: 0,
txHex: "01000000000101871030aba5648209200c4893d8105f072f93f91d7c924bf4bd69b58b963e0daa0000000017160014cdef67d9de4fb8d777e06911e6300adb23da0290ffffffff0113990400000000001976a9149847dcf7841e9c2a0ee5026bb35c883d8b0490ae88ac02483045022100ee68450c3aa3b0d7fbde3459c6be50a88985c407043c3c1a118b977722f83222022026a7d3cb65a4e4b8c9e2888c01064c2841ba9a0ca8d008951a7c44524be2fc3e01210281d5cefc6f5d80529346c26bca8cceced5d1dfdf97349e490cfa2757e114529800000000",
satoshis: 301331,
path: "m/44'/2'/0'/0/0"
},
{
hash: "ebd04672981fa215f130ecdbac56f386e4e76326eaa808e081f67c2de79d949c",
vout: 0,
satoshis: 10000,
path: "m/49'/2'/0'/0/0"
}
];
const out = {
address: "MFkcBAGgM664drwch3G3L4VWByPQVABQ3Q",
satoshis: 310000
};
// or send to another account
// const out = {
// path: "m/44'/2'/1'/0/1",
// satoshis: 310000
// }
const utxo = {
path: "m/44'/2'/0'/0/0",
satoshis: 331
};
const { raw_tx, signature } = await SecuxLTC.signTransaction(
device,
inputs,
{
to: out,
utxo: utxo
}
);
API doc
SecuxLTC
DOGE package for SecuX device
Kind: global class
SecuxLTC.getAddress(trans, path, [option]) ⇒ string
Get address derived by given BIP32 path
Kind: static method of SecuxLTC
Returns: string
- address
Param | Type | Description |
---|---|---|
trans | ITransport |
|
path | string |
BIP32 |
[option] | AddressOption |
SecuxLTC.signTransaction(trans, inputs, outputs) ⇒ object
Create transaction and Sign
Kind: static method of SecuxLTC
Returns: object
- signed
string
- signed.raw_tx
Array<Buffer>
- signed.signature
Param | Type |
---|---|
trans | ITransport |
inputs | Array<txInput> |
outputs | txOutput |