invoices
Version:
Methods for working with BOLT 11 payment requests
24 lines (18 loc) • 334 B
JavaScript
const {bech32} = require('bech32');
const encoding = 'hex';
const {toWords} = bech32;
/** Hex data as bech32 words
{
[hex]: <Data Hex String>
}
@returns
{
words: [<Bech32 Word Number>]
}
*/
module.exports = ({hex}) => {
if (!hex) {
return {};
}
return {words: toWords(Buffer.from(hex, encoding))};
};