bolt09
BOLT 09 helper methods
Last updated 3 months ago by alexbosworth .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install bolt09 
SYNC missed versions from official npm registry.

Bolt 09

npm version Coverage Status Build Status

Utility methods for working with BOLT 09

Methods

featureFlagDetails

Feature flag details for feature flag bit

{
  bit: <Feature Flag Bit Number>
}

@throws
<Error>

@returns
{
  [type]: <Feature Flag Type String>
}

Example:

const {featureFlagDetails} = require('bolt09');

const {type} = featureFlagDetails({bit: 0});
// Type is string descriptor of feature bit

featureFlagsAsHex

Encode feature flags into hex serialized bytes

{
  features: [<Feature Bit Number>]
}

@throws
<Error>

@returns
{
  encoded: <Serialized Feature Bits Hex Encoded String>
}

Example:

const {featureFlagsAsHex} = require('bolt09');

const {encoded} = featureFlagsAsHex({features: [0]});
// Encoded is hex encoded string with a length uint16 prefix

featureFlagsAsWords

Encode feature flags into a serialized data buffer

{
  features: [<Feature Bit Number>]
}

@throws
<Error>

@returns
{
  words: [<Bech32 Word Number>]
}

Example:

const {featureFlagsAsWords} = require('bolt09');

const {words} = featureFlagsAsWords({features: [0]});
// Words are word numbers that can be used for encoding in a bolt11 payment req

featureFlagsFromHex

Feature flags from hex serialized feature flags

{
  [hex]: <Data Length Prefixed Hex Encoded String>
}

@throws
<Error>

@returns
{
  features: [{
    bit: <Feature Bit Number>
    is_required: <Feature Bit is Required Bool>
    type: <Feature Bit Type String>
  }]
}

Example:

const {featureFlagsFromHex} = require('bolt09');

const {features} = featureFlagsFromHex({hex: '00018C'});
// Features is an array of supported features

featureFlagsFromWords

Feature flags from BOLT 11 tag words

{
  words: [<BOLT11 Tag Word Number>]
}

@throws
<Error>

@returns
{
  features: [{
    bit: <Feature Bit Number>
    is_required: <Feature Bit is Required Bool>
    type: <Feature Bit Type String>
  }]
}

Example:

const {featureFlagsFromWords} = require('bolt09');

const {features} = featureFlagsFromWords({words: [16, 0]});
// Features is an array of supported features

Current Tags

  • 3.0.0                                ...           latest (3 months ago)

19 Versions

  • 3.0.0                                ...           3 months ago
  • 2.2.0                                ...           a year ago
  • 2.1.0                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.2.5                                ...           4 years ago
  • 0.2.4                                ...           4 years ago
  • 0.2.3                                ...           5 years ago
  • 0.2.2                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.5                                ...           6 years ago
  • 0.1.4                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE