merge
This commit is contained in:
commit
3e0c1ad17c
6 changed files with 105 additions and 13 deletions
|
|
@ -52,8 +52,7 @@ angular.module('copay.send').controller('SendController',
|
|||
var amount = (form.amount.$modelValue * 100000000).toString(); // satoshi to string
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
w.createTx( address, amount,function() {
|
||||
|
||||
w.createTx(address, amount,function() {
|
||||
$scope.loading = false;
|
||||
$rootScope.$flashMessage = { message: 'The transaction proposal has been created', type: 'success'};
|
||||
$rootScope.$digest();
|
||||
|
|
@ -97,7 +96,7 @@ angular.module('copay.send').controller('SendController',
|
|||
//alert(JSON.stringify(qrcode.process(context)));
|
||||
qrcode.decode();
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
console.log('error decoding QR: '+e);
|
||||
}
|
||||
}, 1500);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
var imports = require('soop').imports();
|
||||
|
||||
var bitcore = require('bitcore');
|
||||
var bignum = bitcore.Bignum;
|
||||
var coinUtil = bitcore.util;
|
||||
var buffertools = bitcore.buffertools;
|
||||
var Builder = bitcore.TransactionBuilder;
|
||||
|
|
@ -20,7 +21,8 @@ function Wallet(opts) {
|
|||
'requiredCopayers', 'totalCopayers', 'spendUnconfirmed',
|
||||
'publicKeyRing', 'txProposals', 'privateKey', 'version'
|
||||
].forEach(function(k) {
|
||||
if (typeof opts[k] === 'undefined') throw new Error('missing key:' + k);
|
||||
if (typeof opts[k] === 'undefined')
|
||||
throw new Error('missing required option for Wallet: ' + k);
|
||||
self[k] = opts[k];
|
||||
});
|
||||
|
||||
|
|
@ -439,9 +441,8 @@ Wallet.prototype.sendTx = function(ntxid, cb) {
|
|||
this.log('[Wallet.js.261:txHex:]', txHex); //TODO
|
||||
|
||||
var self = this;
|
||||
|
||||
this.blockchain.sendRawTransaction(txHex, function(txid) {
|
||||
self.log('BITCOND txid:', txid); //TODO
|
||||
self.log('BITCOIND txid:', txid); //TODO
|
||||
if (txid) {
|
||||
self.txProposals.setSent(ntxid, txid);
|
||||
self.sendTxProposals(null, ntxid);
|
||||
|
|
@ -572,7 +573,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
|||
self.store();
|
||||
self.emit('txProposalsUpdated');
|
||||
}
|
||||
return cb();
|
||||
return cb(ntxid);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -581,7 +582,7 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
|
|||
var priv = this.privateKey;
|
||||
opts = opts || {};
|
||||
|
||||
var amountSat = bitcore.bignum(amountSatStr);
|
||||
var amountSat = bignum(amountSatStr);
|
||||
|
||||
if (!pkr.isComplete()) {
|
||||
throw new Error('publicKeyRing is not complete');
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ var Wallet = require('./Wallet');
|
|||
|
||||
function WalletFactory(config, version) {
|
||||
var self = this;
|
||||
config = config || {};
|
||||
|
||||
this.storage = new Storage(config.storage);
|
||||
this.network = new Network(config.network);
|
||||
this.blockchain = new Blockchain(config.blockchain);
|
||||
|
|
@ -97,7 +99,6 @@ WalletFactory.prototype.create = function(opts) {
|
|||
|
||||
opts.privateKey = opts.privateKey || new PrivateKey({ networkName: this.networkName });
|
||||
|
||||
|
||||
var requiredCopayers = opts.requiredCopayers || this.walletDefaults.requiredCopayers;
|
||||
var totalCopayers = opts.totalCopayers || this.walletDefaults.totalCopayers;
|
||||
|
||||
|
|
@ -124,7 +125,7 @@ WalletFactory.prototype.create = function(opts) {
|
|||
opts.spendUnconfirmed = opts.spendUnconfirmed || this.walletDefaults.spendUnconfirmed;
|
||||
opts.requiredCopayers = requiredCopayers;
|
||||
opts.totalCopayers = totalCopayers;
|
||||
opts.version = this.version;
|
||||
opts.version = opts.version || this.version;
|
||||
var w = new Wallet(opts);
|
||||
w.store();
|
||||
return w;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue