Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions bin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env node

// Call bolt11 decode from the command line.

const decode = require('./payreq').decode

const [,, command, invoice] = process.argv

if (command !== 'decode') {
throw new Error('Invalid command, expected "bolt11 decode <invoice>"')
}

const results = decode(invoice)

console.log(JSON.stringify(results, null, 2))

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"test": "npm run standard && npm run coverage",
"unit": "tape test/*.js"
},
"bin": {
"bolt11": "./bin.js"
},
"devDependencies": {
"nyc": "^15.0.0",
"standard": "*",
Expand Down