BOLT 09 helper methods
npm install bolt09


Utility methods for working with BOLT 09
Feature flag details for feature flag bit
{
bit:
}
@throws
@returns
{
[type]:
}
Example:
``node
const {featureFlagDetails} = require('bolt09');
const {type} = featureFlagDetails({bit: 0});
// Type is string descriptor of feature bit
`
Encode feature flags into hex serialized bytes
{
features: [
}
@throws
@returns
{
encoded:
}
Example:
`node
const {featureFlagsAsHex} = require('bolt09');
const {encoded} = featureFlagsAsHex({features: [0]});
// Encoded is hex encoded string with a length uint16 prefix
`
Encode feature flags into a serialized data buffer
{
features: [
}
@throws
@returns
{
words: [
}
Example:
`node
const {featureFlagsAsWords} = require('bolt09');
const {words} = featureFlagsAsWords({features: [0]});
// Words are word numbers that can be used for encoding in a bolt11 payment req
`
Feature flags from hex serialized feature flags
{
[hex]:
}
@throws
@returns
{
features: [{
bit:
is_required:
type:
}]
}
Example:
`node
const {featureFlagsFromHex} = require('bolt09');
const {features} = featureFlagsFromHex({hex: '00018C'});
// Features is an array of supported features
`
Feature flags from BOLT 11 tag words
{
words: [
}
@throws
@returns
{
features: [{
bit:
is_required:
type:
}]
}
Example:
`node
const {featureFlagsFromWords} = require('bolt09');
const {features} = featureFlagsFromWords({words: [16, 0]});
// Features is an array of supported features
``