Skip to content

SmartCash/bip21

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A BIP21 compatible URL encoding utility library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%