@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
21 lines • 758 B
JavaScript
// Returns null if getBitcoinLikeInfo is not supported. there are breaking changes in the version after firmware 1.2
const getBitcoinLikeInfo = (transport) => transport.send(0xe0, 0x16, 0x00, 0x00).then(res => {
const P2PKH = res.readUInt16BE(0);
const P2SH = res.readUInt16BE(2);
try {
const message = res.slice(5, res.readUInt8(4));
const short = res.slice(5 + message.length + 1, res.readUInt8(5 + message.length));
return {
P2PKH,
P2SH,
message,
short,
};
}
catch (e) {
// in such case, we are in an old firmware we no longer support
return null;
}
});
export default getBitcoinLikeInfo;
//# sourceMappingURL=getBitcoinLikeInfo.js.map