bitcore-wallet-service/lib/model/wallet.js

33 lines
587 B
JavaScript
Raw Normal View History

2015-01-27 05:18:45 -08:00
'use strict';
var _ = require('lodash');
function Wallet(opts) {
opts = opts || {};
2015-01-28 05:36:49 -08:00
this.createdOn = Math.floor(Date.now() / 1000);
2015-01-27 05:18:45 -08:00
this.id = opts.id;
this.name = opts.name;
this.m = opts.m;
this.n = opts.n;
this.status = 'pending';
this.publicKeyRing = [];
2015-01-27 11:40:21 -08:00
this.addressIndex = 0;
2015-01-27 05:18:45 -08:00
};
Wallet.fromObj = function (obj) {
var x = new Wallet();
2015-01-28 05:36:49 -08:00
x.createdOn = obj.createdOn;
2015-01-27 05:18:45 -08:00
x.id = obj.id;
x.name = obj.name;
x.m = obj.m;
x.n = obj.n;
x.status = obj.status;
x.publicKeyRing = obj.publicKeyRing;
2015-01-27 11:40:21 -08:00
x.addressIndex = obj.addressIndex;
2015-01-27 05:18:45 -08:00
return x;
};
module.exports = Wallet;