btc: update uri for bech32 addresses.
This commit is contained in:
parent
5ff46dd36d
commit
2997333122
@ -88,10 +88,11 @@ URI.fromOptions = function fromOptions(options) {
|
||||
* Parse and inject properties from string.
|
||||
* @private
|
||||
* @param {String} str
|
||||
* @param {Network?} network
|
||||
* @returns {URI}
|
||||
*/
|
||||
|
||||
URI.prototype.fromString = function fromString(str) {
|
||||
URI.prototype.fromString = function fromString(str, network) {
|
||||
var prefix, index, query, address;
|
||||
|
||||
assert(typeof str === 'string');
|
||||
@ -112,7 +113,7 @@ URI.prototype.fromString = function fromString(str) {
|
||||
query = str.substring(index + 1);
|
||||
}
|
||||
|
||||
this.address.fromBase58(address);
|
||||
this.address.fromString(address, network);
|
||||
|
||||
if (!query)
|
||||
return this;
|
||||
@ -140,11 +141,12 @@ URI.prototype.fromString = function fromString(str) {
|
||||
/**
|
||||
* Instantiate uri from string.
|
||||
* @param {String} str
|
||||
* @param {Network?} network
|
||||
* @returns {URI}
|
||||
*/
|
||||
|
||||
URI.fromString = function fromString(str) {
|
||||
return new URI().fromString(str);
|
||||
URI.fromString = function fromString(str, network) {
|
||||
return new URI().fromString(str, network);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -156,7 +158,7 @@ URI.prototype.toString = function toString() {
|
||||
var str = 'bitcoin:';
|
||||
var query = [];
|
||||
|
||||
str += this.address.toBase58();
|
||||
str += this.address.toString();
|
||||
|
||||
if (this.amount !== -1)
|
||||
query.push('amount=' + Amount.btc(this.amount));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user