From 2997333122ef3ee97474222543edcab51f6671b6 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 13 May 2017 20:54:34 -0700 Subject: [PATCH] btc: update uri for bech32 addresses. --- lib/btc/uri.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/btc/uri.js b/lib/btc/uri.js index 263905a4..5918b2f1 100644 --- a/lib/btc/uri.js +++ b/lib/btc/uri.js @@ -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));