commit
c44f2977f3
|
@ -174,10 +174,11 @@ Storage.prototype.fetchCopayerLookup = function(copayerId, cb) {
|
||||||
|
|
||||||
// TODO: should be done client-side
|
// TODO: should be done client-side
|
||||||
Storage.prototype._completeTxData = function(walletId, txs, cb) {
|
Storage.prototype._completeTxData = function(walletId, txs, cb) {
|
||||||
var txList = [].concat(txs);
|
var self = this;
|
||||||
this.fetchWallet(walletId, function(err, wallet) {
|
|
||||||
|
self.fetchWallet(walletId, function(err, wallet) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
_.each(txList, function(tx) {
|
_.each([].concat(txs), function(tx) {
|
||||||
tx.derivationStrategy = wallet.derivationStrategy || 'BIP45';
|
tx.derivationStrategy = wallet.derivationStrategy || 'BIP45';
|
||||||
tx.creatorName = wallet.getCopayer(tx.creatorId).name;
|
tx.creatorName = wallet.getCopayer(tx.creatorId).name;
|
||||||
_.each(tx.actions, function(action) {
|
_.each(tx.actions, function(action) {
|
||||||
|
@ -657,22 +658,23 @@ Storage.prototype.fetchFiatRate = function(providerName, code, ts, cb) {
|
||||||
Storage.prototype.fetchTxNote = function(walletId, txid, cb) {
|
Storage.prototype.fetchTxNote = function(walletId, txid, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.db.collection(collections.TX_NOTES).findOne({
|
self.db.collection(collections.TX_NOTES).findOne({
|
||||||
walletId: walletId,
|
walletId: walletId,
|
||||||
txid: txid,
|
txid: txid,
|
||||||
}, function(err, result) {
|
}, function(err, result) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
if (!result || !result.body) return cb();
|
if (!result || !result.body) return cb();
|
||||||
return cb(null, Model.TxNote.fromObj(result));
|
return self._completeTxNotesData(walletId, Model.TxNote.fromObj(result), cb);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: should be done client-side
|
// TODO: should be done client-side
|
||||||
Storage.prototype._completeTxNotesData = function(walletId, notes, cb) {
|
Storage.prototype._completeTxNotesData = function(walletId, notes, cb) {
|
||||||
var notesList = [].concat(notes);
|
var self = this;
|
||||||
this.fetchWallet(walletId, function(err, wallet) {
|
|
||||||
|
self.fetchWallet(walletId, function(err, wallet) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
_.each(notesList, function(note) {
|
_.each([].concat(notes), function(note) {
|
||||||
note.editedByName = wallet.getCopayer(note.editedBy).name;
|
note.editedByName = wallet.getCopayer(note.editedBy).name;
|
||||||
});
|
});
|
||||||
return cb(null, notes);
|
return cb(null, notes);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "bitcore-wallet-service",
|
"name": "bitcore-wallet-service",
|
||||||
"description": "A service for Mutisig HD Bitcoin Wallets",
|
"description": "A service for Mutisig HD Bitcoin Wallets",
|
||||||
"author": "BitPay Inc",
|
"author": "BitPay Inc",
|
||||||
"version": "1.8.1",
|
"version": "1.8.2",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"bitcoin",
|
"bitcoin",
|
||||||
"copay",
|
"copay",
|
||||||
|
|
|
@ -3924,6 +3924,7 @@ describe('Wallet service', function() {
|
||||||
note.walletId.should.equal(wallet.id);
|
note.walletId.should.equal(wallet.id);
|
||||||
note.body.should.equal('note body');
|
note.body.should.equal('note body');
|
||||||
note.editedBy.should.equal(server.copayerId);
|
note.editedBy.should.equal(server.copayerId);
|
||||||
|
note.editedByName.should.equal('copayer 1');
|
||||||
note.createdOn.should.equal(note.editedOn);
|
note.createdOn.should.equal(note.editedOn);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue