multiple ux fixes
This commit is contained in:
parent
a50f4cc638
commit
dcd903904e
6 changed files with 53 additions and 54 deletions
|
|
@ -14,11 +14,7 @@ console.log('[transactions.js.10:_updateTxs:]'); //TODO
|
|||
var txs = [];
|
||||
|
||||
inT.forEach(function(i){
|
||||
var b = i.txp.builder;
|
||||
var tx = b.build();
|
||||
var one = {
|
||||
feeSat: b.feeSat,
|
||||
};
|
||||
var tx = i.builder.build();
|
||||
var outs = [];
|
||||
|
||||
tx.outs.forEach(function(o) {
|
||||
|
|
@ -30,19 +26,13 @@ console.log('[transactions.js.10:_updateTxs:]'); //TODO
|
|||
});
|
||||
}
|
||||
});
|
||||
one.outs = outs;
|
||||
|
||||
// TOD: check missingSignatures === in al inputs?
|
||||
one.missingSignatures = tx.countInputMissingSignatures(0);
|
||||
one.signedByUs = i.signedByUs;
|
||||
one.ntxid = i.ntxid;
|
||||
one.creator = i.txp.creator;
|
||||
one.createdTs = i.txp.createdTs;
|
||||
one.sentTs = i.txp.sentTs;
|
||||
txs.push(one);
|
||||
// extra fields
|
||||
i.outs = outs;
|
||||
i.fee = i.feeSat/bitcore.util.COIN;
|
||||
i.missingSignatures = tx.countInputMissingSignatures(0);
|
||||
txs.push(i);
|
||||
});
|
||||
$scope.txs = txs;
|
||||
console.log('[transactions.js.55] SET HANDL+'); //TODO
|
||||
w.removeListener('txProposalsUpdated',_updateTxs)
|
||||
w.once('txProposalsUpdated',_updateTxs);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ function TxProposal(opts) {
|
|||
this.signedBy = opts.signedBy || {};
|
||||
this.builder = opts.builder;
|
||||
this.sentTs = opts.sentTs || null;
|
||||
this.sentTxid = opts.sentTxid || null;
|
||||
}
|
||||
|
||||
TxProposal.prototype.toObj = function() {
|
||||
|
|
@ -30,7 +31,8 @@ TxProposal.prototype.toObj = function() {
|
|||
};
|
||||
|
||||
|
||||
TxProposal.prototype.setSent = function() {
|
||||
TxProposal.prototype.setSent = function(sentTxid) {
|
||||
this.sentTxid = txid;
|
||||
this.sentTs = Date.now();;
|
||||
};
|
||||
|
||||
|
|
@ -143,8 +145,9 @@ console.log('[TxProposals.js.127:v0:]',v0, v1); //TODO
|
|||
}
|
||||
});
|
||||
|
||||
if (!v0.sentTs && v1.sentTs) {
|
||||
v0.sentTs = v1.sentTs;
|
||||
if (!v0.sentTxid && v1.sentTxid) {
|
||||
v0.sentTs = v1.sentTs;
|
||||
v0.sentTxid = v1.sentTxid;
|
||||
hasChanged++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,12 +77,7 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
|
|||
var recipients;
|
||||
var inTxp = copay.TxProposals.fromObj(data.txProposals);
|
||||
var mergeInfo = this.txProposals.merge(inTxp, true);
|
||||
console.log('[Wallet.js.79:inTxp:]',inTxp); //TODO
|
||||
|
||||
var addSeen = this.addSeenToTxProposals();
|
||||
|
||||
console.log('[Wallet.js.81]', addSeen, mergeInfo); //TODO
|
||||
// if ((mergeInfo.merged && !data.isBroadcast) || addSeen) {
|
||||
if (mergeInfo.hasChanged || addSeen) {
|
||||
this.log('### BROADCASTING txProposals. ' );
|
||||
recipients = null;
|
||||
|
|
@ -168,7 +163,6 @@ Wallet.prototype.getMyPeerId = function() {
|
|||
};
|
||||
|
||||
Wallet.prototype.netStart = function() {
|
||||
console.log('[Wallet.js.159:netStart:]'); //TODO
|
||||
var self = this;
|
||||
var net = this.network;
|
||||
net.removeAllListeners();
|
||||
|
|
@ -188,7 +182,6 @@ console.log('[Wallet.js.159:netStart:]'); //TODO
|
|||
peerId: myPeerId
|
||||
};
|
||||
net.start(function() {
|
||||
console.log('[Wallet.js.177] NET START: emit CREATED'); //TODO
|
||||
self.emit('created');
|
||||
for (var i=0; i<self.publicKeyRing.registeredCopayers(); i++) {
|
||||
var otherPeerId = self.getPeerId(i);
|
||||
|
|
@ -296,9 +289,24 @@ Wallet.prototype.getTxProposals = function() {
|
|||
var ret = [];
|
||||
for(var k in this.txProposals.txps) {
|
||||
var txp = this.txProposals.txps[k];
|
||||
var i = {txp:txp};
|
||||
var i = JSON.parse(JSON.stringify(txp));
|
||||
i.builder = txp.builder;
|
||||
i.ntxid = k;
|
||||
i.signedByUs = txp.signedBy[this.getMyPeerId()]?true:false;
|
||||
|
||||
i.peerActions = {};
|
||||
for(var p in txp.seenBy){
|
||||
i.peerActions[p]={seen: txp.seenBy[p]};
|
||||
}
|
||||
for(var p in txp.signedBy){
|
||||
i.peerActions[p]= i.peerActions[p] || {};
|
||||
i.peerActions[p].sign = txp.signedBy[p];
|
||||
}
|
||||
var c = txp.creator;
|
||||
i.peerActions[c] = i.peerActions[c] || {};
|
||||
i.peerActions[c].create = txp.createdTs;
|
||||
|
||||
|
||||
ret.push(i);
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -363,10 +371,8 @@ Wallet.prototype.addSeenToTxProposals = function() {
|
|||
|
||||
for(var k in this.txProposals.txps) {
|
||||
var txp = this.txProposals.txps[k];
|
||||
console.log('[Wallet.js.364:txp:] ADD SEEN',txp); //TODO
|
||||
if (!txp.seenBy[myId]) {
|
||||
|
||||
console.log('[Wallet.js.367] ADDING'); //TODO
|
||||
txp.seenBy[myId] = Date.now();
|
||||
ret = true;
|
||||
}
|
||||
|
|
@ -446,12 +452,9 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
|||
}
|
||||
self.getUnspent(function(unspentList) {
|
||||
// TODO check enough funds, etc.
|
||||
console.log('[Wallet.js.452]', self); //TODO
|
||||
self.createTxSync(toAddress, amountSatStr, unspentList, opts);
|
||||
self.sendPublicKeyRing(); // Change Address
|
||||
self.sendTxProposals();
|
||||
|
||||
console.log('[Wallet.js.452]', self); //TODO
|
||||
self.store();
|
||||
return cb();
|
||||
});
|
||||
|
|
@ -488,8 +491,6 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
|
|||
|
||||
if (priv) me[myId] = now;
|
||||
|
||||
console.log('[Wallet.js.485:me:]',myId, me); //TODO
|
||||
|
||||
var data = {
|
||||
signedBy: (priv && b.signaturesAdded ? me : {}),
|
||||
seenBy: (priv ? me : {}),
|
||||
|
|
@ -498,8 +499,6 @@ console.log('[Wallet.js.485:me:]',myId, me); //TODO
|
|||
builder: b,
|
||||
};
|
||||
|
||||
console.log('[Wallet.js.499:data:]',data); //TODO
|
||||
|
||||
this.txProposals.add(data);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ WalletFactory.prototype.getWalletIds = function() {
|
|||
|
||||
WalletFactory.prototype.remove = function(walletId) {
|
||||
// TODO remove wallet contents
|
||||
console.log('TODO: remove wallet contents');
|
||||
this.log('TODO: remove wallet contents');
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue