Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bip21-smart

SmartCash8MIT0.0.1

A BIP21 compatible URL encoding utility library

bip21, smartcash

readme

bip21-smart

Version

A BIP21 compatible URL encoding library.

Example

var bip21 = require('bip21-smart')

var decoded = bip21.decode('smartcash:Sfra8YaJ5UL7R6ZMg3ZH2pZLcDQP71vFQ5?amount=20.3&label=Foobar')

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

console.log(bip21.encode('Sfra8YaJ5UL7R6ZMg3ZH2pZLcDQP71vFQ5'))
// => smartcash:Sfra8YaJ5UL7R6ZMg3ZH2pZLcDQP71vFQ5

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

License MIT