{"name":"bolt09","version":"2.2.0","keywords":["bolt","feature-bits","lightning","lightning-network"],"author":{"url":"https://twitter.com/alexbosworth","name":"Alex Bosworth"},"license":"MIT","_id":"bolt09@2.2.0","maintainers":[{"name":"alexbosworth","email":"alex.bosworth+npm@gmail.com"}],"homepage":"https://github.com/alexbosworth/bolt09#readme","bugs":{"url":"https://github.com/alexbosworth/bolt09/issues"},"dist":{"shasum":"22ed4de48587679d93c22c04a0f34f22979c69c0","tarball":"http://registry-npm.ywwl.com/bolt09/download/bolt09-2.2.0.tgz","fileCount":21,"integrity":"sha512-MzpiDQE4QavQTh5EqNv+Tmv+yoZMHys3j4OU3iiGO50IAu7FbVWmj1sipHIT+lvCKG6ROBFIJezND2vE3io75Q==","signatures":[{"sig":"MEQCIBPzXZ9/bpY0JrLhx8eFX6r8VIxF8QAZGWWnL2r5e5KiAiA7oomzYSBZLOUjGqvC8vknSywo6wAtjeyUsE6WvUpOBQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18262,"size":4972,"noattachment":false,"key":"/bolt09/-/bolt09-2.2.0.tgz"},"main":"index.js","engines":{"node":">=18"},"gitHead":"378b55f7be995b30e2a72388e34a00f265dfe38b","scripts":{"test":"npx nyc@17.1 node --experimental-test-coverage --test"},"_npmUser":{"name":"alexbosworth","email":"alex.bosworth+npm@gmail.com"},"repository":{"url":"git+https://github.com/alexbosworth/bolt09.git","type":"git"},"_npmVersion":"8.13.1","description":"BOLT 09 helper methods","directories":{},"_nodeVersion":"20.11.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/bolt09_2.2.0_1752938173427_0.09282521054480819","host":"s3://npm-registry-packages-npm-production"},"readme":"# Bolt 09\n\n[![npm version](https://badge.fury.io/js/bolt09.svg)](https://badge.fury.io/js/bolt09)\n[![Coverage Status](https://coveralls.io/repos/github/alexbosworth/bolt09/badge.svg?branch=master)](https://coveralls.io/github/alexbosworth/bolt09?branch=master)\n[![Build Status](https://travis-ci.org/alexbosworth/bolt09.svg?branch=master)](https://travis-ci.org/alexbosworth/bolt09)\n\nUtility methods for working with [BOLT 09](https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md)\n\n## Methods\n\n### featureFlagDetails\n\nFeature flag details for feature flag bit\n\n    {\n      bit: <Feature Flag Bit Number>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      [type]: <Feature Flag Type String>\n    }\n\nExample:\n\n```node\nconst {featureFlagDetails} = require('bolt09');\n\nconst {type} = featureFlagDetails({bit: 0});\n// Type is string descriptor of feature bit\n```\n\n### featureFlagsAsHex\n\nEncode feature flags into hex serialized bytes\n\n    {\n      features: [<Feature Bit Number>]\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <Serialized Feature Bits Hex Encoded String>\n    }\n\nExample:\n\n```node\nconst {featureFlagsAsHex} = require('bolt09');\n\nconst {encoded} = featureFlagsAsHex({features: [0]});\n// Encoded is hex encoded string with a length uint16 prefix\n```\n\n### featureFlagsAsWords\n\nEncode feature flags into a serialized data buffer\n\n    {\n      features: [<Feature Bit Number>]\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      words: [<Bech32 Word Number>]\n    }\n\nExample:\n\n```node\nconst {featureFlagsAsWords} = require('bolt09');\n\nconst {words} = featureFlagsAsWords({features: [0]});\n// Words are word numbers that can be used for encoding in a bolt11 payment req\n```\n\n### featureFlagsFromHex\n\nFeature flags from hex serialized feature flags\n\n    {\n      [hex]: <Data Length Prefixed Hex Encoded String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      features: [{\n        bit: <Feature Bit Number>\n        is_required: <Feature Bit is Required Bool>\n        type: <Feature Bit Type String>\n      }]\n    }\n\nExample:\n\n```node\nconst {featureFlagsFromHex} = require('bolt09');\n\nconst {features} = featureFlagsFromHex({hex: '00018C'});\n// Features is an array of supported features\n```\n\n### featureFlagsFromWords\n\nFeature flags from BOLT 11 tag words\n\n    {\n      words: [<BOLT11 Tag Word Number>]\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      features: [{\n        bit: <Feature Bit Number>\n        is_required: <Feature Bit is Required Bool>\n        type: <Feature Bit Type String>\n      }]\n    }\n\nExample:\n\n```node\nconst {featureFlagsFromWords} = require('bolt09');\n\nconst {features} = featureFlagsFromWords({words: [16, 0]});\n// Features is an array of supported features\n```\n","publish_time":1752938173633,"_cnpm_publish_time":1752938173633,"dist-tags":{"latest":"3.0.0"}}