Skip to content

Commit

Permalink
Merge pull request #147 from getAlby/fix/decode-signet
Browse files Browse the repository at this point in the history
fix: decode signet
  • Loading branch information
rolznz committed May 1, 2024
2 parents 3d267b7 + 7b6dcde commit 939b5ee
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 937 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getalby/lightning-tools",
"version": "5.0.2",
"version": "5.0.3",
"description": "Collection of helpful building blocks and tools to develop Bitcoin Lightning web apps",
"type": "module",
"source": "src/index.ts",
Expand Down Expand Up @@ -51,13 +51,12 @@
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@webbtc/webln-types": "^2.1.0",
"browserify": "^17.0.0",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"husky": "^8.0.3",
"jest": "^29.5.0",
"jest-fetch-mock": "^3.0.3",
"light-bolt11-decoder": "^3.0.0",
"light-bolt11-decoder": "^3.1.1",
"lint-staged": "^14.0.0",
"microbundle": "^0.15.1",
"nostr-tools": "^1.17.0",
Expand Down
8 changes: 8 additions & 0 deletions src/invoice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const paymentRequestWithoutExpiry =
const paymentRequestWithMemo =
"lnbc10u1pj4t6w0pp54wm83znxp8xly6qzuff2z7u6585rnlcw9uduf2haa42qcz09f5wqdq023jhxapqd4jk6mccqzzsxqyz5vqsp5mlvjs8nktpz98s5dcrhsuelrz94kl2vjukvu789yzkewast6m00q9qyyssqupynqdv7e5y8nlul0trva5t97g7v3gwx7akhu2dvu4pn66eu2pr5zkcnegp8myz3wrpj9ht06pwyfn4dvpmnr96ejq6ygex43ymaffqq3gud4d";

const signetPaymentRequest =
"lntbs758310n1pnryklfpp59hmrqxpmanfm4sh4afnqs80yas294hvscr2lv0scp4hza7gpyf5sdyzgd5xzmnwv4kzqvpwxqcnqvpsxqcrqgr5dusryvpjxsknqdedxvc9gv338g6nyw35xyhrzd3ntgszscfnxdjrgvryvsukzd3n893njvf5x5mnvctzx9nrsv3hv9jrgvty9ycqzzsxqrrsssp5pq5nl5xw9hf4k7xl8d635kd60kgdm0jnwe3tvu7dp8zrfedcyzes9qyyssq8qcl3h6ptahwtc8k7q9qrz8v3r0fhp779wuhykxkmn0x6qegl4x4jga2ykcwf5vu89slhzka0w4n7a9n26qcxgzhg4mdymky8smdvvqpw9t93a";

describe("Invoice", () => {
test("decode invoice without description", () => {
const decodedInvoice = new Invoice({ pr: paymentRequestWithoutMemo });
Expand Down Expand Up @@ -36,4 +39,9 @@ describe("Invoice", () => {
const decodedInvoice = new Invoice({ pr: paymentRequestWithMemo });
expect(decodedInvoice.description).toBe("Test memo");
});

test("decode signet invoice", () => {
const decodedInvoice = new Invoice({ pr: signetPaymentRequest });
expect(decodedInvoice.satoshi).toBe(75831);
});
});
Loading

0 comments on commit 939b5ee

Please sign in to comment.