{"name":"invoices","version":"2.2.3","keywords":["bolt11","invoice","lightning","lightning-network","payment-request"],"author":{"name":"Alex Bosworth"},"license":"MIT","_id":"invoices@2.2.3","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":"055ada5fd81889d4b3823c4adc51349ecaada64a","tarball":"http://registry-npm.ywwl.com/invoices/download/invoices-2.2.3.tgz","fileCount":54,"integrity":"sha512-tYOmXKPsz8/jxtPDmy7HS7Z4VqQ9VK2Y3J37hhHEhU337AoL1CUlEqccTEb4nZQ36HHnFhlcKLoDz7C8W5lNdg==","signatures":[{"sig":"MEYCIQCxdkL2FAynyvfzIAGjRlGweuIufgqlC6YX+nOKDW9EmQIhAIzakeIl5LjFvRCIAl0YzNy4oOf9wvtKPCo5reBbaA7u","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":100823,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjt4uEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo62g//abLYBGKUq2ZO7vBMkpcVet96NrLQcrfknGibXE9B5shlJok3\r\nFwIt0S3dBxgvm433sorNXhL2aALtyVv6q4+yub+UePeQXTyNq68lCtjrfgju\r\nGKDgHiKaOi94dEVYruJ63HfRRZPSxObPPeMN09haxC5xHBrBFLoPT7WL3aNb\r\nu6JZvIk13tprHMfZQif3p5Fw0JCyL0c0MI37E3E7vn+OxP+8mndzf0Z1de36\r\nfZErQgtFc8IjCMgD6P25EiOifHKTe9sONSavy48/4stCafOPTRrarp2y4zrO\r\nupKDHrRd1dHK1wF8MYiZXW0dUuFF5wh197CUCOGhcaOv7Lqv9egghyus9lhW\r\nilZuzDLK23tnQlcxPqo0kYF+upY1tt0POKjumg8DWu+sTekQ/WncwOfEfyLB\r\n5PX2JpQyV5hN8Oy0s2ZK6sldve+XAjAg4T69rDLbdFLLuLWdWdsEzCZc1ANC\r\nnPw87ygXzUleP8ywK+C/j7MDBOccnGRdFxj1NS2DhGDeYEtmzO06piIbbU7x\r\neWKrm2uu2QW+4WVPgwd+haQB5P1PqbaZcPyPdEIZuxEc6ED2NNFX2ldWAP+3\r\nrpwgHB5B8XlIJV7Ck+ZhhSeQDAoz/vRsVHVFI+bYnGJ8QnszfRgYZwof3jpK\r\nsk29whuhf2NdMWbzSnQNMN0nlzBaA1A9x6Q=\r\n=vUap\r\n-----END PGP SIGNATURE-----\r\n","size":24787,"noattachment":false,"key":"/invoices/-/invoices-2.2.3.tgz"},"main":"index.js","engines":{"node":">=12.20.0"},"gitHead":"37f6635fada0de5071a703f92afe7381d3464e3c","scripts":{"test":"tap --branches=1 --functions=1 --lines=1 --statements=1 test/bolt11/*.js"},"_npmUser":{"name":"alexbosworth","email":"alex.bosworth+npm@gmail.com"},"repository":{"url":"git+https://github.com/alexbosworth/invoices.git","type":"git"},"_npmVersion":"8.13.1","description":"Methods for working with BOLT 11 payment requests","directories":{},"_nodeVersion":"18.12.1","dependencies":{"bn.js":"5.2.1","bech32":"2.0.0","bolt07":"1.8.3","bolt09":"0.2.5","bitcoinjs-lib":"6.1.0","tiny-secp256k1":"2.2.1"},"_hasShrinkwrap":false,"devDependencies":{"@alexbosworth/tap":"15.0.12"},"_npmOperationalInternal":{"tmp":"tmp/invoices_2.2.3_1672973188694_0.7351465785085687","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":1672973188897,"_cnpm_publish_time":1672973188897,"dist-tags":{"latest":"6.3.6"}}