Skip to content

Commit 563da59

Browse files
committed
Merge pull request #1105 from chjj/paypro_uri
WIP: paypro: use BIP21 object in latest bitcore. fixes #1104. see #1083.
2 parents 7b28837 + d7ab195 commit 563da59

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

js/controllers/send.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ angular.module('copayApp.controllers').controller('SendController',
112112

113113
var uri;
114114
if (address.indexOf('bitcoin:') === 0) {
115-
uri = copay.HDPath.parseBitcoinURI(address);
115+
uri = new bitcore.BIP21(address).data;
116116
} else if (address.indexOf('Merchant: ') === 0) {
117117
uri = {
118118
merchant: address.split(/\s+/)[1]
@@ -411,7 +411,7 @@ angular.module('copayApp.controllers').controller('SendController',
411411
merchant: value
412412
};
413413
} else {
414-
uri = copay.HDPath.parseBitcoinURI(value);
414+
uri = new bitcore.BIP21(value).data;
415415
}
416416
if (!uri || !uri.merchant) {
417417
return;
@@ -476,7 +476,7 @@ angular.module('copayApp.controllers').controller('SendController',
476476
// delete the `merchant` property from the scope.
477477
var unregister = scope.$watch('address', function() {
478478
var val = scope.sendForm.address.$viewValue || '';
479-
var uri = copay.HDPath.parseBitcoinURI(val);
479+
var uri = new bitcore.BIP21(val).data;
480480
if (!uri || !uri.merchant) {
481481
delete $rootScope.merchant;
482482
scope.sendForm.amount.$setViewValue('');

js/models/core/Wallet.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
'use strict';
22

3-
var http = require('http');
43
var EventEmitter = require('events').EventEmitter;
54
var async = require('async');
65
var preconditions = require('preconditions').singleton();
7-
var parseBitcoinURI = require('./HDPath').parseBitcoinURI;
86
var util = require('util');
97

108
var bitcore = require('bitcore');
@@ -46,7 +44,7 @@ function Wallet(opts) {
4644
this.log('creating ' + opts.requiredCopayers + ' of ' + opts.totalCopayers + ' wallet');
4745

4846
this.id = opts.id || Wallet.getRandomId();
49-
this.lock = new WalletLock(this.storage, this.id, opts.lockTimeOutMin);
47+
this.lock = new WalletLock(this.storage, this.id, opts.lockTimeOutMin);
5048

5149

5250
this.name = opts.name;
@@ -777,7 +775,7 @@ Wallet.prototype.createPaymentTx = function(options, cb) {
777775
options.uri = options.uri || options.url;
778776

779777
if (options.uri.indexOf('bitcoin:') === 0) {
780-
options.uri = parseBitcoinURI(options.uri).merchant;
778+
options.uri = new bitcore.BIP21(options.uri).data.merchant;
781779
if (!options.uri) {
782780
return cb(new Error('No URI.'));
783781
}

0 commit comments

Comments
 (0)