A BIP21 compatible URL encoding utility library
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore gitignore: add nyc Oct 27, 2016
.travis.yml travis: no before_install Oct 14, 2016
CHANGELOG.md stop address error checking, fix option overwrite Dec 18, 2016
LICENSE Initial commit Oct 29, 2014
README.md
index.js
package.json 2.0.1 Dec 18, 2016

README.md

bip21

build status Version

A BIP21 compatible URL encoding utility library.

Example

var bip21 = require('bip21')

var decoded = bip21.decode('bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH?amount=20.3&label=Foobar')

console.log(decoded)
// { address: '1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH',
//   options: {
//     amount: 20.3,
//     label: 'Foobar' }
// }
//
// WARNING: Remember to error check the `.address`!

console.log(bip21.encode('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH'))
// => bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH

console.log(bip21.encode('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH', {
    amount: 20.3,
    label: 'Foobar'
}))
// => bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH?amount=20.3&label=Foobar

License MIT