add network to txproposal model

This commit is contained in:
Ivan Socolsky 2015-04-23 12:33:01 -03:00
parent d8524fed2a
commit 4b53947ae6
4 changed files with 5 additions and 0 deletions

View File

@ -36,6 +36,7 @@ TxProposal.create = function(opts) {
x.actions = [];
x.outputOrder = _.shuffle(_.range(2));
x.fee = null;
x.network = Bitcore.Address(x.toAddress).toObject().network;
return x;
};
@ -66,6 +67,7 @@ TxProposal.fromObj = function(obj) {
});
x.outputOrder = obj.outputOrder;
x.fee = obj.fee;
x.network = obj.network;
return x;
};

View File

@ -882,6 +882,7 @@ describe('Wallet service', function() {
should.not.exist(err);
should.exist(tx);
tx.walletId.should.equal(wallet.id);
tx.network.should.equal('livenet');
tx.creatorId.should.equal(wallet.copayers[0].id);
tx.message.should.equal('some message');
tx.isAccepted().should.equal.false;

View File

@ -94,6 +94,7 @@ var aTXP = function() {
"walletId": "1",
"creatorId": "1",
"toAddress": "18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7",
"network": "livenet",
"amount": 50000000,
"message": 'some message',
"proposalSignature": '7035022100896aeb8db75fec22fddb5facf791927a996eb3aee23ee6deaa15471ea46047de02204c0c33f42a9d3ff93d62738712a8c8a5ecd21b45393fdd144e7b01b5a186f1f9',

View File

@ -133,6 +133,7 @@ describe('Storage', function() {
proposals = _.map(_.range(4), function(i) {
var tx = Model.TxProposal.create({
walletId: '123',
toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7',
creatorId: wallet.copayers[0].id,
amount: i + 100,
});