0.0.1 • Published 6 years ago
bip21-max v0.0.1
bip21-max
A BIP21 compatible URL encoding library.
Example
var bip21 = require('bip21-max')
var decoded = bip21.decode('maxcoin:mNpmPa1UAh8VdK8nDy8GAhHrefmmrMJfmF?amount=20.3&label=Foobar')
console.log(decoded)
// { address: 'mNpmPa1UAh8VdK8nDy8GAhHrefmmrMJfmF',
// options: {
// amount: 20.3,
// label: 'Foobar' }
// }
//
// WARNING: Remember to error check the `.address`!
console.log(bip21.encode('mNpmPa1UAh8VdK8nDy8GAhHrefmmrMJfmF'))
// => smartcash:Sfra8YaJ5UL7R6ZMg3ZH2pZLcDQP71vFQ5
console.log(bip21.encode('mNpmPa1UAh8VdK8nDy8GAhHrefmmrMJfmF', {
amount: 20.3,
label: 'Foobar'
}))
// => smartcash:Sfra8YaJ5UL7R6ZMg3ZH2pZLcDQP71vFQ5?amount=20.3&label=Foobar
License MIT
0.0.1
6 years ago