You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
809 B

10 years ago
'use strict';
function TxProposal(opts) {
opts = opts || {};
10 years ago
this.createdOn = Math.floor(Date.now() / 1000);
10 years ago
this.id = opts.id;
10 years ago
this.creatorId = opts.creatorId;
this.toAddress = opts.toAddress;
this.amount = opts.amount;
this.changeAddress = opts.changeAddress;
this.inputs = opts.inputs;
10 years ago
this.actions = [];
10 years ago
};
TxProposal.fromObj = function (obj) {
var x = new TxProposal();
10 years ago
x.createdOn = obj.createdOn;
10 years ago
x.id = obj.id;
10 years ago
x.creatorId = obj.creatorId;
x.toAddress = obj.toAddress;
x.amount = obj.amount;
x.changeAddress = obj.changeAddress;
x.inputs = obj.inputs;
x.raw = obj.raw;
10 years ago
x.actions = _.map(obj.actions, function(a) {
return {
createdOn: a.createdOn,
copayerId: a.copayerId,
type: a.type,
signature: a.signature,
};
});
10 years ago
return x;
};
module.exports = TxProposal;