{"name":"invoices","version":"1.0.2","keywords":["bolt11","invoice","lightning","lightning-network","payment-request"],"author":{"name":"Alex Bosworth"},"license":"MIT","_id":"invoices@1.0.2","maintainers":[{"name":"alexbosworth","email":"alex.bosworth+npm@gmail.com"}],"homepage":"https://github.com/alexbosworth/invoices#readme","bugs":{"url":"https://github.com/alexbosworth/invoices/issues"},"dist":{"shasum":"0ba6826ed7ebcb2d55828b71ffbc956c48d2aeea","tarball":"http://registry-npm.ywwl.com/invoices/download/invoices-1.0.2.tgz","fileCount":45,"integrity":"sha512-C7a+IsZmDQUCFvYtk3KhCZaB5pfFD4fNL1K/nsFUQskxjTSBZyiazrmIz5LWcLy1LysqJDZW5XHgIk65KMhiig==","signatures":[{"sig":"MEQCIGXdCizXHKODbyxR/xJGw1FcipIlq1UNebrvo+9RFvoCAiBtNVaAFGtLrWtojck3uC1k1fIrKaN/Fwxe7SDHbWisxA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":78445,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJepb8rCRA9TVsSAnZWagAAD10P/iCGaZ2TC9rftGE4Jux1\n9MJ/9SRrHK+TPw/lGyLjqQvzJdcBRraWpK4IE+Hrzwui48IpGjug6CbTiG4q\nBKPNaoqgI4kP7a6/qF6mpFTvP3ur1Lw7bLlmmCNG86m74RUtnyyyJPkefnWy\nGwExqrjVfzu25cBgZuTbRE0l8dsYTkgce0iqVzNJ6iCkV7WZZwhwRLyRnLve\nCyl8lXgV7rSXBHDOp3BiwrF919DMRoVMn4rB08/QAPU21TX5I4W2/Amn6wiq\ndXIQB+szlFrFl7xRR5cOro45miyhjFp8FNj7uwEwz0c+ZyGjBdO7CAZexLAx\nuaPjE5niinY9+7qZ2n0Uhe005JdsFwPuaYZ1MJJz/tJPMo9MoO5BDQOKUvBi\nsXWaqSU/5z3kiehBf+jutM3u+tXDamosszEOFQVTfUvCLsPyNtLrLe9986yj\nmgBwknl48BLwfxh+jpKhjau+PWR7iYN8LBZrPjIYbU5leKBeCGfGJxzn5KVI\namthByReH9eoJd0GS/fm5PcT+dEy9R2qo8gsl2SHrD6cv9PLQsYfLESpEo2M\np/cG6Xv55YIaqQ2OSuuE/8ItUhC5T6ISYbT5j8smZiTdHh/+BbZHOLakvCgw\njZKhTdZcZxXi7B1aCURv+Tqr0vZkEplipDaZGknB+f//EZ0fktB6i4smX1fm\nOeJO\r\n=m0HY\r\n-----END PGP SIGNATURE-----\r\n","size":20490,"noattachment":false,"key":"/invoices/-/invoices-1.0.2.tgz"},"main":"index.js","engines":{"node":">=10.4.0"},"gitHead":"73e1ed4e45cf982b38c7c2e0e77a08ddea990083","scripts":{"test":"tap test/bolt11/*.js"},"_npmUser":{"name":"alexbosworth","email":"alex.bosworth+npm@gmail.com"},"repository":{"url":"git+https://github.com/alexbosworth/invoices.git","type":"git"},"_npmVersion":"6.14.4","description":"Interaction helper for your Lightning Network daemon","directories":{},"_nodeVersion":"12.16.1","dependencies":{"bn.js":"5.1.1","bech32":"1.1.4","bolt07":"1.5.0","bolt09":"0.0.2","secp256k1":"4.0.0","bitcoinjs-lib":"5.1.7"},"_hasShrinkwrap":false,"devDependencies":{"tap":"14.10.7"},"_npmOperationalInternal":{"tmp":"tmp/invoices_1.0.2_1587920682798_0.19960130431034395","host":"s3://npm-registry-packages"},"readme":"# Invoices\n\nUtility methods for Lightning Network invoices: creating, signing and parsing\nBOLT 11 payment requests and BOLT 12 offers, invoice requests and invoices.\n\n## Methods\n\n### byteDecodeRequest\n\nDerive a payment request from request data.\n\n    {\n      encoded: <Payment Request Details Hex String>\n      [mtokens]: <Millitokens Number String>\n      network: <Network Name String>\n      words: <Words Count Number>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      request: <BOLT 11 Encoded Payment Request String>\n    }\n\nExample:\n\n```node\nconst {byteDecodeRequest} = require('invoices');\n\n// Get a BOLT 11 payment request for this invoice data\nconst {request} = byteDecodeRequest({\n  encoded: paymentRequestDetailsHexString,\n  mtokens: '0',\n  network: 'bitcoin',\n  words: paymentRequestWordsCount,\n});\n```\n\n### byteEncodeRequest\n\nDerive bytes for payment request details\n\n    {\n      request: <BOLT 11 Encoded Payment Request String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <Payment Request Details Hex String>\n      mtokens: <Millitokens Number String>\n      network: <Network Name String>\n      words: <Word Length Number>\n    }\n\nExample:\n\n```node\nconst {byteEncodeRequest} = require('invoices');\n\n// Get the bytes for a payment request\nconst {encoded, mtokens, network, words} = byteEncodeRequest({\n  request: bolt11EncodedPaymentRequestString,\n});\n```\n\n### createInvoiceError\n\nCreate a BOLT 12 invoice error\n\n`suggested_value` requires `erroneous_field`\n\n    {\n      [erroneous_field]: <Erroneous Record Type Number String>\n      message: <Error Message String>\n      [suggested_value]: <Suggested Record Value Hex String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <Invoice Error TLV Stream Hex String>\n    }\n\nExample:\n\n```node\nconst {createInvoiceError} = require('invoices');\n\n// Explain that the requested amount was too low, suggesting an amount\nconst {encoded} = createInvoiceError({\n  erroneous_field: '82',\n  message: 'Amount too low',\n  suggested_value: '2710',\n});\n```\n\n### createOffer\n\nCreate a BOLT 12 offer\n\nEither `issuer_id` or `paths` is required, `description` is required with an\namount, and `amount` requires `currency`\n\n    {\n      [amount]: <Amount in Currency Minor Units String>\n      [currency]: <ISO 4217 Currency Code String>\n      [description]: <Description String>\n      [expires_at]: <Offer Expires At ISO 8601 Date String>\n      [features]: [{\n        bit: <BOLT 09 Feature Bit Number>\n      }]\n      [issuer]: <Issuer Identifier String>\n      [issuer_id]: <Issuer Node Public Key Hex String>\n      [max_quantity]: <Maximum Quantity Number> (zero for unlimited)\n      [metadata]: <Metadata Hex String>\n      [mtokens]: <Amount Millitokens String>\n      [networks]: [<Network Name String>]\n      [paths]: [{\n        hops: [{\n          encrypted_data: <Encrypted Recipient Data Hex String>\n          relay_key: <Blinded Relaying Node Public Key Hex String>\n        }]\n        [introduction_edge]: <Introduction Node Edge Format Channel Id String>\n        [introduction_node]: <Introduction Node Public Key Hex String>\n        key: <First Hop Path Key Public Key Hex String>\n      }]\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      offer: <BOLT 12 Offer String>\n    }\n\nExample:\n\n```node\nconst {createOffer} = require('invoices');\n\n// Offer to sell a coffee for 250 sats to anyone who requests an invoice\nconst {offer} = createOffer({\n  description: 'A cup of coffee',\n  issuer_id: nodePublicKey,\n  mtokens: '250000',\n});\n```\n\n### createSignedInvoice\n\nAssemble a signed BOLT 12 invoice\n\nEither a `secret` key to sign with or a `signature` over the unsigned invoice\n`hash` is required\n\n    {\n      encoded: <Unsigned Invoice TLV Stream Hex String>\n      [secret]: <Node Id Private Key Hex String>\n      [signature]: <Node Id BIP 340 Signature Hex String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <Signed Invoice TLV Stream Hex String>\n      invoice: <BOLT 12 Invoice String>\n    }\n\nExample:\n\n```node\nconst {createSignedInvoice} = require('invoices');\n\n// Get encoded, root and tag from createUnsignedInvoice\n// Get signature via LND signBytes with type schnorr, or sign hash directly\nconst {encoded, invoice} = createSignedInvoice({\n  encoded: unsignedInvoiceHex,\n  signature: nodeIdSchnorrSignature,\n});\n```\n\n### createSignedInvoiceRequest\n\nAssemble a signed BOLT 12 invoice request for an offer\n\nEither a `secret` key to sign with or a `signature` over the unsigned request\n`hash` is required\n\nA request that is not for an offer is not signed\n\n    {\n      encoded: <Unsigned Invoice Request TLV Stream Hex String>\n      [secret]: <Payer Id Private Key Hex String>\n      [signature]: <Payer Id BIP 340 Signature Hex String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <Signed Invoice Request TLV Stream Hex String>\n      request: <BOLT 12 Invoice Request String>\n    }\n\nExample:\n\n```node\nconst {createSignedInvoiceRequest} = require('invoices');\n\n// Get encoded from createUnsignedInvoiceRequest, sign with the payer key\nconst {encoded, request} = createSignedInvoiceRequest({\n  encoded: unsignedRequestHex,\n  secret: payerPrivateKey,\n});\n```\n\n### createSignedRequest\n\nAssemble a signed payment request\n\n`signature` is not required when using blinded paths in the request\n\n    {\n      [destination]: <Destination Public Key Hex String>\n      hrp: <Request Human Readable Part String>\n      [signature]: <Request Hash Signature Hex String>\n      tags: [<Request Tag Word Number>]\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      request: <BOLT 11 Encoded Payment Request String>\n    }\n\nExample:\n\n```node\nconst {createSignedRequest} = require('invoices');\n\n// Get hrp and signature from createUnsignedRequest\n// Get signature via standard private key signing, or LND signBytes\nconst {request} = createSignedRequest({\n  destination: nodePublicKey,\n  hrp: amountAndNetworkHrp,\n  signature: signedPreimageHash,\n  tags: paymentRequestTags,\n});\n```\n\n### createUnsignedInvoice\n\nCreate an unsigned BOLT 12 invoice for an invoice request\n\nEither `encoded` or `request` is required\n\n`mtokens` defaults to the requested or offer amount\n\n`node_id` is required when the request offer has no `issuer_id`, otherwise it\ndefaults to the offer `issuer_id`\n\n`records` are experimental invoice records, with types from 3000000000 to\n3999999999\n\n    {\n      [chain_addresses]: [<Fallback Chain Address String>]\n      [created_at]: <Invoice Creation Date ISO 8601 String>\n      [encoded]: <Invoice Request TLV Stream Hex String>\n      [expires_at]: <Invoice Expires At ISO 8601 Date String>\n      [features]: [{\n        bit: <BOLT 09 Feature Bit Number>\n      }]\n      id: <Payment Hash Hex String>\n      [mtokens]: <Invoice Amount Millitokens String>\n      [node_id]: <Invoice Node Public Key Hex String>\n      paths: [{\n        base_fee_mtokens: <Accumulated Base Fee Millitokens String>\n        cltv_delta: <Accumulated CLTV Expiry Delta Number>\n        [features]: [{\n          bit: <BOLT 09 Feature Bit Number>\n        }]\n        fee_rate: <Accumulated Fee Rate Millitokens Per Million Number>\n        hops: [{\n          encrypted_data: <Encrypted Recipient Data Hex String>\n          relay_key: <Blinded Relaying Node Public Key Hex String>\n        }]\n        [introduction_edge]: <Introduction Node Edge Format Channel Id String>\n        [introduction_node]: <Introduction Node Public Key Hex String>\n        key: <First Hop Path Key Public Key Hex String>\n        max_htlc_mtokens: <Maximum HTLC Millitokens String>\n        min_htlc_mtokens: <Minimum HTLC Millitokens String>\n      }]\n      [records]: [{\n        type: <Experimental Invoice Record Type Number String>\n        value: <Experimental Invoice Record Value Hex String>\n      }]\n      [request]: <BOLT 12 Invoice Request String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <Unsigned Invoice TLV Stream Hex String>\n      hash: <Tagged Merkle Root Hash To Sign Hex String>\n      root: <Merkle Root Hash Hex String>\n      tag: <Signature Tag String>\n    }\n\nExample:\n\n```node\nconst {createUnsignedInvoice} = require('invoices');\n\n// Get a blinded payment path from bolt04 paymentPathFromChannels\nconst {encoded, hash, root, tag} = createUnsignedInvoice({\n  encoded: receivedInvoiceRequestHex,\n  id: paymentHash,\n  paths: [blindedPaymentPath],\n});\n// Use createSignedInvoice with a signature over hash to complete the invoice\n```\n\n### createUnsignedInvoiceRequest\n\nCreate an unsigned BOLT 12 invoice request\n\nWithout an `offer`, `description` and `mtokens` are required and `request` is\ncomplete without a signature\n\n`description`, `expires_at`, `issuer` and `paths` cannot be set with an `offer`\n\n    {\n      [bip353_name]: <BIP 353 Human Readable Name String>\n      [description]: <Description String>\n      [expires_at]: <Request Expires At ISO 8601 Date String>\n      [features]: [{\n        bit: <BOLT 09 Feature Bit Number>\n      }]\n      [issuer]: <Issuer Identifier String>\n      [metadata]: <Payer Metadata Hex String>\n      [mtokens]: <Requested Amount Millitokens String>\n      [network]: <Network Name String>\n      [offer]: <BOLT 12 Offer String>\n      payer_id: <Payer Public Key Hex String>\n      [payer_note]: <Payer Note String>\n      [paths]: [{\n        hops: [{\n          encrypted_data: <Encrypted Recipient Data Hex String>\n          relay_key: <Blinded Relaying Node Public Key Hex String>\n        }]\n        [introduction_edge]: <Introduction Node Edge Format Channel Id String>\n        [introduction_node]: <Introduction Node Public Key Hex String>\n        key: <First Hop Path Key Public Key Hex String>\n      }]\n      [quantity]: <Requested Quantity Number>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <Unsigned Invoice Request TLV Stream Hex String>\n      [hash]: <Tagged Merkle Root Hash To Sign Hex String>\n      [request]: <BOLT 12 Invoice Request Without Offer String>\n      [root]: <Merkle Root Hash Hex String>\n      [tag]: <Signature Tag String>\n    }\n\nExample:\n\n```node\nconst {createUnsignedInvoiceRequest} = require('invoices');\n\n// Request an invoice for an offer with a transient payer key\nconst {encoded, hash, root, tag} = createUnsignedInvoiceRequest({\n  offer: bolt12OfferString,\n  payer_id: payerPublicKey,\n});\n// Use createSignedInvoiceRequest with a signature to complete the request\n```\n\n### createUnsignedRequest\n\nCreate an unsigned payment request\n\n`paths` are bLIP 39 blinded paths. If using, omit `destination`, `payment`, and\n`routes`\n\nOmit `cltv_delta` to use the BOLT 11 default of 18 blocks.\n\n    {\n      [chain_addresses]: [<Chain Address String>]\n      [cltv_delta]: <Positive CLTV Delta Number>\n      [created_at]: <Invoice Creation Date ISO 8601 String>\n      [description]: <Description String>\n      [description_hash]: <Description Hash Hex String>\n      [destination]: <Public Key String>\n      [expires_at]: <ISO 8601 Date String>\n      features: [{\n        bit: <BOLT 09 Feature Bit Number>\n      }]\n      id: <Preimage SHA256 Hash Hex String>\n      [mtokens]: <Requested Milli-Tokens Value String> (can exceed Number limit)\n      network: <Network Name String>\n      [paths]: [{\n        base_fee_mtokens: <Accumulated Base Fee Millitokens String>\n        cltv_delta: <Accumulated CLTV Expiry Delta Number>\n        [features]: [{\n          bit: <BOLT 09 Feature Bit Number>\n        }]\n        fee_rate: <Accumulated Fee Rate Millitokens Per Million Number>\n        hops: [{\n          encrypted_data: <Encrypted Recipient Data Hex String>\n          relay_key: <Relaying Node Public Key Hex String>\n        }]\n        [introduction_node]: <Introduction Node Public Key Hex String>\n        key: <First Hop Path Key Public Key Hex String>\n        max_htlc_mtokens: <Maximum HTLC Millitokens String>\n        min_htlc_mtokens: <Minimum HTLC Millitokens String>\n      }]\n      [payment]: <Payment Identifier Hex String>\n      [routes]: [[{\n        [base_fee_mtokens]: <Base Fee Millitokens String>\n        [channel]: <Standard Format Channel Id String>\n        [cltv_delta]: <Final CLTV Expiration Blocks Delta Number>\n        [fee_rate]: <Fee Rate Millitokens Per Million Number>\n        public_key: <Forward Edge Public Key Hex String>\n      }]]\n      [tokens]: <Requested Chain Tokens Number> (note: can differ from mtokens)\n    }\n\n    @returns\n    {\n      hash: <Payment Request Signature Hash Hex String>\n      hrp: <Human Readable Part of Payment Request String>\n      preimage: <Signature Hash Preimage Hex String>\n      tags: [<Data Tag Number>]\n    }\n\nExample:\n\n```node\nconst {createUnsignedRequest} = require('invoices');\n\nconst unsignedComponents = createUnsignedRequest({\n  destination: nodePublicKey,\n  id: rHashHexString,\n  network: 'bitcoin',\n});\n// Use createSignedRequest and a signature to create a complete request\n```\n\n### parseInvoice\n\nParse a BOLT 12 invoice into its component data\n\nEither `encoded` or `invoice` is required\n\n`request` checks that the invoice is for the invoice request that was sent\n\n    {\n      [encoded]: <Invoice TLV Stream Hex String>\n      [invoice]: <BOLT 12 Invoice String>\n      [request]: <Sent BOLT 12 Invoice Request String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      [bip353_name]: <BIP 353 Human Readable Name String>\n      [chain_addresses]: [<Fallback Chain Address String>]\n      created_at: <Invoice Creation Date ISO 8601 String>\n      [description]: <Request Description String>\n      encoded: <Invoice TLV Stream Hex String>\n      expires_at: <Invoice Expires At ISO 8601 Date String>\n      features: [{\n        bit: <BOLT 09 Feature Bit Number>\n        is_required: <Feature Support is Required To Pay Bool>\n        type: <Feature Type String>\n      }]\n      id: <Payment Hash Hex String>\n      invoice: <BOLT 12 Invoice String>\n      is_expired: <Invoice is Expired Bool>\n      [issuer]: <Request Issuer Identifier String>\n      metadata: <Payer Metadata Hex String>\n      mtokens: <Invoice Amount Millitokens String>\n      network: <Network Name String>\n      node_id: <Invoice Node Public Key Hex String>\n      [offer]: <BOLT 12 Offer String>\n      paths: [{\n        base_fee_mtokens: <Accumulated Base Fee Millitokens String>\n        cltv_delta: <Accumulated CLTV Expiry Delta Number>\n        features: [{\n          bit: <BOLT 09 Feature Bit Number>\n          is_required: <Feature Support is Required To Pay Bool>\n          type: <Feature Type String>\n        }]\n        fee_rate: <Accumulated Fee Rate Millitokens Per Million Number>\n        hops: [{\n          encrypted_data: <Encrypted Recipient Data Hex String>\n          relay_key: <Blinded Relaying Node Public Key Hex String>\n        }]\n        [introduction_edge]: <Introduction Node Edge Format Channel Id String>\n        [introduction_node]: <Introduction Node Public Key Hex String>\n        key: <First Hop Path Key Public Key Hex String>\n        max_htlc_mtokens: <Maximum HTLC Millitokens String>\n        min_htlc_mtokens: <Minimum HTLC Millitokens String>\n      }]\n      payer_id: <Payer Public Key Hex String>\n      [payer_note]: <Payer Note String>\n      [quantity]: <Requested Quantity Number>\n      safe_tokens: <Invoice Amount Tokens Rounded Up Number>\n      signature: <Node Id BIP 340 Signature Hex String>\n      tokens: <Invoice Amount Tokens Rounded Down Number>\n    }\n\nExample:\n\n```node\nconst {parseInvoice} = require('invoices');\n\n// Decoded details of the invoice for the invoice request that was sent\nconst invoiceDetails = parseInvoice({\n  encoded: receivedInvoiceHex,\n  request: sentInvoiceRequestString,\n});\n```\n\n### parseInvoiceError\n\nParse a BOLT 12 invoice error into its component data\n\n    {\n      encoded: <Invoice Error TLV Stream Hex String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      [erroneous_field]: <Erroneous Record Type Number String>\n      message: <Error Message String>\n      [suggested_value]: <Suggested Record Value Hex String>\n    }\n\nExample:\n\n```node\nconst {parseInvoiceError} = require('invoices');\n\n// Decoded details of the invoice error\nconst {message} = parseInvoiceError({encoded: receivedInvoiceErrorHex});\n```\n\n### parseInvoiceRequest\n\nParse a BOLT 12 invoice request into its component data\n\nEither `encoded` or `request` is required\n\n`paths` are blinded paths to send the invoice to\n\n    {\n      [encoded]: <Invoice Request TLV Stream Hex String>\n      [request]: <BOLT 12 Invoice Request String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      [bip353_name]: <BIP 353 Human Readable Name String>\n      [description]: <Request Description String>\n      encoded: <Invoice Request TLV Stream Hex String>\n      [expires_at]: <Request Expires At ISO 8601 Date String>\n      features: [{\n        bit: <BOLT 09 Feature Bit Number>\n        is_required: <Feature Support is Required Bool>\n        type: <Feature Type String>\n      }]\n      [issuer]: <Request Issuer Identifier String>\n      metadata: <Payer Metadata Hex String>\n      [mtokens]: <Requested Amount Millitokens String>\n      network: <Network Name String>\n      [offer]: <BOLT 12 Offer String>\n      payer_id: <Payer Public Key Hex String>\n      [payer_note]: <Payer Note String>\n      [paths]: [{\n        hops: [{\n          encrypted_data: <Encrypted Recipient Data Hex String>\n          relay_key: <Blinded Relaying Node Public Key Hex String>\n        }]\n        [introduction_edge]: <Introduction Node Edge Format Channel Id String>\n        [introduction_node]: <Introduction Node Public Key Hex String>\n        key: <First Hop Path Key Public Key Hex String>\n      }]\n      [quantity]: <Requested Quantity Number>\n      request: <BOLT 12 Invoice Request String>\n      [signature]: <Payer Id BIP 340 Signature Hex String>\n    }\n\nExample:\n\n```node\nconst {parseInvoiceRequest} = require('invoices');\n\n// Decoded details of the invoice request\nconst requestDetails = parseInvoiceRequest({encoded: receivedRequestHex});\n```\n\n### parseOffer\n\nParse a BOLT 12 offer into its component data\n\nEither `encoded` or `offer` is required\n\n`paths` are blinded paths to send invoice requests to\n\n    {\n      [encoded]: <Offer TLV Stream Hex String>\n      [offer]: <BOLT 12 Offer String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      [amount]: <Amount in Currency Minor Units String>\n      [currency]: <ISO 4217 Currency Code String>\n      [description]: <Description String>\n      encoded: <Offer TLV Stream Hex String>\n      [expires_at]: <Offer Expires At ISO 8601 Date String>\n      features: [{\n        bit: <BOLT 09 Feature Bit Number>\n        is_required: <Feature Support is Required Bool>\n        type: <Feature Type String>\n      }]\n      is_expired: <Offer is Expired Bool>\n      [issuer]: <Issuer Identifier String>\n      [issuer_id]: <Issuer Node Public Key Hex String>\n      [max_quantity]: <Maximum Quantity Number> (zero for unlimited)\n      [metadata]: <Metadata Hex String>\n      [mtokens]: <Amount Millitokens String>\n      networks: [<Known Network Name String>]\n      offer: <BOLT 12 Offer String>\n      [paths]: [{\n        hops: [{\n          encrypted_data: <Encrypted Recipient Data Hex String>\n          relay_key: <Blinded Relaying Node Public Key Hex String>\n        }]\n        [introduction_edge]: <Introduction Node Edge Format Channel Id String>\n        [introduction_node]: <Introduction Node Public Key Hex String>\n        key: <First Hop Path Key Public Key Hex String>\n      }]\n    }\n\nExample:\n\n```node\nconst {parseOffer} = require('invoices');\n\n// Decoded details of the offer\nconst offerDetails = parseOffer({offer: 'lno1...'});\n```\n\n### parsePaymentRequest\n\nParse a BOLT 11 payment request into its component data\n\nNote: either description or description_hash will be returned\n\n`paths` are bLIP 39 blinded paths.\n\nBOLT 11 payer checks are deliberately left to payment flows. For example,\nparsing can succeed when a request omits a `payment` identifier required for\npayment.\n\n    {\n      request: <BOLT 11 Payment Request String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      [chain_addresses]: [<Chain Address String>]\n      cltv_delta: <CLTV Delta Number>\n      created_at: <Invoice Creation Date ISO 8601 String>\n      [description]: <Description String>\n      [description_hash]: <Description Hash Hex String>\n      destination: <Public Key String>\n      expires_at: <ISO 8601 Date String>\n      features: [{\n        bit: <BOLT 09 Feature Bit Number>\n        is_required: <Feature Support is Required To Pay Bool>\n        type: <Feature Type String>\n      }]\n      id: <Payment Request Hash String>\n      is_expired: <Invoice is Expired Bool>\n      [mtokens]: <Requested Milli-Tokens Value String> (can exceed Number limit)\n      network: <Network Name String>\n      [paths]: [{\n        base_fee_mtokens: <Accumulated Base Fee Millitokens String>\n        cltv_delta: <Accumulated CLTV Expiry Delta Number>\n        features: [{\n          bit: <BOLT 09 Feature Bit Number>\n          is_required: <Feature Support is Required To Pay Bool>\n          type: <Feature Type String>\n        }]\n        fee_rate: <Accumulated Fee Rate Millitokens Per Million Number>\n        hops: [{\n          encrypted_data: <Encrypted Recipient Data Hex String>\n          relay_key: <Relaying Node Public Key Hex String>\n        }]\n        introduction_node: <Introduction Node Public Key Hex String>\n        key: <First Hop Path Key Public Key Hex String>\n        max_htlc_mtokens: <Maximum HTLC Millitokens String>\n        min_htlc_mtokens: <Minimum HTLC Millitokens String>\n      }]\n      [payment]: <Payment Identifier Hex Encoded String>\n      [routes]: [[{\n        [base_fee_mtokens]: <Base Fee Millitokens String>\n        [channel]: <Standard Format Channel Id String>\n        [cltv_delta]: <Final CLTV Expiration Blocks Delta Number>\n        [fee_rate]: <Fee Rate Millitokens Per Million Number>\n        public_key: <Forward Edge Public Key Hex String>\n      }]]\n      [safe_tokens]: <Requested Chain Tokens Rounded Up Number>\n      [tokens]: <Requested Chain Tokens Number> (note: can differ from mtokens)\n    }\n\n```node\nconst {parsePaymentRequest} = require('invoices');\n\n// Decoded details of the payment request\nconst requestDetails = parsePaymentRequest({request: 'paymentRequestString'});\n```\n","publish_time":1587920682935,"_cnpm_publish_time":1587920682935,"dist-tags":{"latest":"6.3.6"}}