mirror of https://github.com/BTCPrivate/copay.git
commit
6c52da3ddb
|
@ -41,7 +41,6 @@ angular.module('copay.header').controller('HeaderController',
|
||||||
w.disconnect();
|
w.disconnect();
|
||||||
delete $rootScope['wallet'];
|
delete $rootScope['wallet'];
|
||||||
$location.path('signin');
|
$location.path('signin');
|
||||||
$rootScope.$digest();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,14 @@ console.log('[signin.js.42:create:]'); //TODO
|
||||||
$scope.join = function(cid) {
|
$scope.join = function(cid) {
|
||||||
console.log('[signin.js.42:join:]'); //TODO
|
console.log('[signin.js.42:join:]'); //TODO
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
|
walletFactory.connectTo(cid, function(w) {
|
||||||
|
console.log('[signin.js.50]'); //TODO
|
||||||
|
_setupUxHandlers(w);
|
||||||
|
w.netStart();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// if (cid) {
|
// if (cid) {
|
||||||
// var w = walletFactory.(walletId);
|
// var w = walletFactory.(walletId);
|
||||||
|
@ -62,7 +70,6 @@ console.log('[signin.js.42:join:]'); //TODO
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
};
|
|
||||||
|
|
||||||
// if (peerData && peerData.peerId && peerData.connectedPeers.length > 0) {
|
// if (peerData && peerData.peerId && peerData.connectedPeers.length > 0) {
|
||||||
// $rootScope.peerId = peerData.peerId;
|
// $rootScope.peerId = peerData.peerId;
|
||||||
|
|
|
@ -39,7 +39,6 @@ Wallet.getRandomId = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
|
Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
|
||||||
this.openWalletId(data.walletId);
|
|
||||||
this.log('RECV PUBLICKEYRING:',data);
|
this.log('RECV PUBLICKEYRING:',data);
|
||||||
|
|
||||||
var shouldSend = false;
|
var shouldSend = false;
|
||||||
|
@ -66,7 +65,6 @@ Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
|
||||||
|
|
||||||
|
|
||||||
Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
|
Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
|
||||||
this.openWalletId(data.walletId);
|
|
||||||
this.log('RECV TXPROPOSAL:',data); //TODO
|
this.log('RECV TXPROPOSAL:',data); //TODO
|
||||||
|
|
||||||
var shouldSend = false;
|
var shouldSend = false;
|
||||||
|
@ -94,6 +92,11 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype._handleData = function(senderId, data, isInbound) {
|
Wallet.prototype._handleData = function(senderId, data, isInbound) {
|
||||||
|
|
||||||
|
if (this.id !== data.walletId)
|
||||||
|
throw new Error('wrong message received: Bad wallet ID');
|
||||||
|
|
||||||
|
|
||||||
switch(data.type) {
|
switch(data.type) {
|
||||||
case 'publicKeyRing':
|
case 'publicKeyRing':
|
||||||
this._handlePublicKeyRing(senderId, data, isInbound);
|
this._handlePublicKeyRing(senderId, data, isInbound);
|
||||||
|
@ -108,9 +111,13 @@ Wallet.prototype._handleData = function(senderId, data, isInbound) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype._handleNetworkChange = function(newPeer) {
|
Wallet.prototype._handleNetworkChange = function(newPeer) {
|
||||||
|
|
||||||
|
console.log('[Wallet.js.112:newPeer:]',newPeer); //TODO
|
||||||
if (!newPeer) return;
|
if (!newPeer) return;
|
||||||
|
|
||||||
|
console.log('[Wallet.js.112:newPeer:]',newPeer); //TODO
|
||||||
this.log('#### Setting new PEER:', newPeer);
|
this.log('#### Setting new PEER:', newPeer);
|
||||||
|
this.sendWalletId(newPeer);
|
||||||
this.sendPublicKeyRing(newPeer);
|
this.sendPublicKeyRing(newPeer);
|
||||||
this.sendTxProposals(newPeer);
|
this.sendTxProposals(newPeer);
|
||||||
};
|
};
|
||||||
|
@ -118,8 +125,8 @@ Wallet.prototype._handleNetworkChange = function(newPeer) {
|
||||||
Wallet.prototype.netStart = function() {
|
Wallet.prototype.netStart = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var net = this.network;
|
var net = this.network;
|
||||||
net.on('networkChange', function() { self._handleNetworkChange(); } );
|
net.on('networkChange', self._handleNetworkChange.bind(self) );
|
||||||
net.on('data', function() { self._handleData();});
|
net.on('data', self._handleData.bind(self) );
|
||||||
net.on('open', function() {}); // TODO
|
net.on('open', function() {}); // TODO
|
||||||
net.on('close', function() {}); // TODO
|
net.on('close', function() {}); // TODO
|
||||||
net.start(function(peerId) {
|
net.start(function(peerId) {
|
||||||
|
@ -151,6 +158,17 @@ Wallet.prototype.sendTxProposals = function(recipients) {
|
||||||
this.emit('txProposalsUpdated', this.txProposals);
|
this.emit('txProposalsUpdated', this.txProposals);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Wallet.prototype.sendWalletId = function(recipients) {
|
||||||
|
this.log('### SENDING walletId TO:', recipients||'All', this.walletId);
|
||||||
|
|
||||||
|
this.network.send(recipients, {
|
||||||
|
type: 'walletId',
|
||||||
|
walletId: this.id,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
Wallet.prototype.sendPublicKeyRing = function(recipients) {
|
Wallet.prototype.sendPublicKeyRing = function(recipients) {
|
||||||
this.log('### SENDING publicKeyRing TO:', recipients||'All', this.publicKeyRing.toObj());
|
this.log('### SENDING publicKeyRing TO:', recipients||'All', this.publicKeyRing.toObj());
|
||||||
|
|
||||||
|
@ -308,8 +326,13 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype.connectTo = function(peerId) {
|
Wallet.prototype.connectTo = function(peerId) {
|
||||||
this.network.connectTo(peerId);
|
throw new Error('Wallet.connectTo.. not yet implemented!');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Wallet.prototype.disconnect = function() {
|
||||||
|
this.network.disconnect();
|
||||||
|
};
|
||||||
|
|
||||||
// // HERE? not sure
|
// // HERE? not sure
|
||||||
// Wallet.prototype.cleanPeers = function() {
|
// Wallet.prototype.cleanPeers = function() {
|
||||||
// this.storage.remove('peerData');
|
// this.storage.remove('peerData');
|
||||||
|
|
|
@ -60,6 +60,7 @@ WalletFactory.prototype.read = function(walletId) {
|
||||||
opts.storage = this.storage;
|
opts.storage = this.storage;
|
||||||
opts.network = this.network;
|
opts.network = this.network;
|
||||||
opts.blockchain = this.blockchain;
|
opts.blockchain = this.blockchain;
|
||||||
|
opts.verbose = this.verbose;
|
||||||
|
|
||||||
var w = new Wallet(opts);
|
var w = new Wallet(opts);
|
||||||
|
|
||||||
|
@ -102,6 +103,8 @@ WalletFactory.prototype.create = function(opts) {
|
||||||
opts.storage = this.storage;
|
opts.storage = this.storage;
|
||||||
opts.network = this.network;
|
opts.network = this.network;
|
||||||
opts.blockchain = this.blockchain;
|
opts.blockchain = this.blockchain;
|
||||||
|
opts.verbose = this.verbose;
|
||||||
|
|
||||||
opts.spendUnconfirmed = opts.spendUnconfirmed || this.walletDefaults.spendUnconfirmed;
|
opts.spendUnconfirmed = opts.spendUnconfirmed || this.walletDefaults.spendUnconfirmed;
|
||||||
opts.requiredCopayers = requiredCopayers;
|
opts.requiredCopayers = requiredCopayers;
|
||||||
opts.totalCopayers = totalCopayers;
|
opts.totalCopayers = totalCopayers;
|
||||||
|
@ -112,9 +115,44 @@ WalletFactory.prototype.create = function(opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
WalletFactory.prototype.open = function(walletId) {
|
WalletFactory.prototype.open = function(walletId) {
|
||||||
if(!WalletFactory.read(walletId)) {
|
var w = this.read(walletId) || this.create({id: walletId});
|
||||||
WalletFactory.create({id: walletId});
|
return w;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
WalletFactory.prototype.openRemote = function(peedId) {
|
||||||
|
var s = WalletFactory.storage;
|
||||||
|
opts = opts || {};
|
||||||
|
this.log('### CREATING NEW WALLET.' + (opts.id ? ' USING ID: ' + opts.id : ' NEW ID'));
|
||||||
|
|
||||||
|
opts.privateKey = opts.privateKey || new PrivateKey({ networkName: this.networkName });
|
||||||
|
this.log('\t### PrivateKey Initialized');
|
||||||
|
|
||||||
|
var requiredCopayers = opts.requiredCopayers || this.walletDefaults.requiredCopayers;
|
||||||
|
var totalCopayers = opts.totalCopayers || this.walletDefaults.totalCopayers;
|
||||||
|
|
||||||
|
opts.publicKeyRing = opts.publicKeyRing || new PublicKeyRing({
|
||||||
|
networkName: this.networkName,
|
||||||
|
requiredCopayers: requiredCopayers,
|
||||||
|
totalCopayers: totalCopayers,
|
||||||
|
});
|
||||||
|
opts.publicKeyRing.addCopayer(opts.privateKey.getBIP32().extendedPublicKeyString());
|
||||||
|
this.log('\t### PublicKeyRing Initialized');
|
||||||
|
|
||||||
|
opts.txProposals = opts.txProposals || new TxProposals({
|
||||||
|
networkName: this.networkName,
|
||||||
|
});
|
||||||
|
this.log('\t### TxProposals Initialized');
|
||||||
|
|
||||||
|
opts.storage = this.storage;
|
||||||
|
opts.network = this.network;
|
||||||
|
opts.blockchain = this.blockchain;
|
||||||
|
opts.spendUnconfirmed = opts.spendUnconfirmed || this.walletDefaults.spendUnconfirmed;
|
||||||
|
opts.requiredCopayers = requiredCopayers;
|
||||||
|
opts.totalCopayers = totalCopayers;
|
||||||
|
var w = new Wallet(opts);
|
||||||
|
w.store();
|
||||||
|
this.addWalletId(w.id);
|
||||||
|
return w;
|
||||||
};
|
};
|
||||||
|
|
||||||
WalletFactory.prototype.getWalletIds = function() {
|
WalletFactory.prototype.getWalletIds = function() {
|
||||||
|
@ -142,4 +180,16 @@ WalletFactory.prototype.addWalletId = function(walletId) {
|
||||||
this.storage.setGlobal('walletIds', ids);
|
this.storage.setGlobal('walletIds', ids);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
WalletFactory.prototype.connectTo = function(peerId, cb) {
|
||||||
|
var self=this;
|
||||||
|
self.network.start(function() {
|
||||||
|
self.network.connectTo(peerId)
|
||||||
|
self.network.on('walletId', function(walletId) {
|
||||||
|
console.log('[WalletFactory.js.187]'); //TODO
|
||||||
|
return cb(self.open(walletId));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = require('soop')(WalletFactory);
|
module.exports = require('soop')(WalletFactory);
|
||||||
|
|
|
@ -103,6 +103,9 @@ Network.prototype._onData = function(data, isInbound) {
|
||||||
case 'disconnect':
|
case 'disconnect':
|
||||||
this._onClose(obj.sender);
|
this._onClose(obj.sender);
|
||||||
break;
|
break;
|
||||||
|
case 'walletId':
|
||||||
|
this.emit('walletId', obj.data.walletId);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
this.emit('data', obj.sender, obj.data, isInbound);
|
this.emit('data', obj.sender, obj.data, isInbound);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +161,6 @@ Network.prototype._setupConnectionHandlers = function(dataConn, isInbound) {
|
||||||
dataConn.on('close', function() {
|
dataConn.on('close', function() {
|
||||||
if (self.closing) return;
|
if (self.closing) return;
|
||||||
console.log('### CLOSE RECV FROM:', dataConn.peer);
|
console.log('### CLOSE RECV FROM:', dataConn.peer);
|
||||||
|
|
||||||
self._onClose(dataConn.peer);
|
self._onClose(dataConn.peer);
|
||||||
this.emit('close');
|
this.emit('close');
|
||||||
});
|
});
|
||||||
|
@ -166,6 +168,8 @@ Network.prototype._setupConnectionHandlers = function(dataConn, isInbound) {
|
||||||
|
|
||||||
Network.prototype._notify = function(newPeer) {
|
Network.prototype._notify = function(newPeer) {
|
||||||
this._showConnectedPeers();
|
this._showConnectedPeers();
|
||||||
|
|
||||||
|
console.log('[WebRTC.js.172]', newPeer); //TODO
|
||||||
this.emit('networkChange', newPeer);
|
this.emit('networkChange', newPeer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -269,7 +273,7 @@ Network.prototype.connectTo = function(peerId) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Network.prototype.disconnect = function(peerId, cb) {
|
Network.prototype.disconnect = function(cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.closing = 1;
|
self.closing = 1;
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,10 @@
|
||||||
var chai = chai || require('chai');
|
var chai = chai || require('chai');
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
var copay = copay || require('../copay');
|
var copay = copay || require('../copay');
|
||||||
var Wallet = require('soop').load('../js/models/core/Wallet', {
|
var Wallet = require('../js/models/core/Wallet');
|
||||||
Storage: require('./mocks/FakeStorage'),
|
var Storage= require('./mocks/FakeStorage');
|
||||||
Network: copay.WebRTC,
|
var Network= copay.WebRTC;
|
||||||
Blockchain: copay.Insight
|
var Blockchain= copay.Insight;
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
var addCopayers = function (w) {
|
var addCopayers = function (w) {
|
||||||
for(var i=0; i<4; i++) {
|
for(var i=0; i<4; i++) {
|
||||||
|
@ -17,73 +15,65 @@ var addCopayers = function (w) {
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Wallet model', function() {
|
describe('Wallet model', function() {
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
wallet: {
|
requiredCopayers: 3,
|
||||||
requiredCopayers: 3,
|
totalCopayers: 5,
|
||||||
totalCopayers: 5,
|
spendUnconfirmed: 1,
|
||||||
},
|
|
||||||
blockchain: {
|
blockchain: {
|
||||||
host: 'test.insight.is',
|
host: 'test.insight.is',
|
||||||
port: 80
|
port: 80
|
||||||
},
|
},
|
||||||
|
networkName: 'testnet',
|
||||||
};
|
};
|
||||||
var opts = {};
|
|
||||||
|
|
||||||
|
it('should fail to create an instance', function () {
|
||||||
|
(function(){new Wallet(config)}).should.throw();
|
||||||
|
});
|
||||||
|
|
||||||
|
var createW = function () {
|
||||||
|
var c = JSON.parse(JSON.stringify(config));
|
||||||
|
|
||||||
|
c.privateKey = new copay.PrivateKey({ networkName: c.networkName });
|
||||||
|
|
||||||
|
c.publicKeyRing = new copay.PublicKeyRing({
|
||||||
|
networkName: c.networkName,
|
||||||
|
requiredCopayers: c.requiredCopayers,
|
||||||
|
totalCopayers: c.totalCopayers,
|
||||||
|
});
|
||||||
|
c.publicKeyRing.addCopayer(c.privateKey.getBIP32().extendedPublicKeyString());
|
||||||
|
|
||||||
|
c.txProposals = new copay.TxProposals({
|
||||||
|
networkName: c.networkName,
|
||||||
|
});
|
||||||
|
c.storage = new Storage(config.storage);
|
||||||
|
c.network = new Network(config.network);
|
||||||
|
c.blockchain = new Blockchain(config.blockchain);
|
||||||
|
|
||||||
|
c.networkName = config.networkName;
|
||||||
|
c.verbose = config.verbose;
|
||||||
|
|
||||||
|
return new Wallet(c);
|
||||||
|
}
|
||||||
|
|
||||||
it('should create an instance', function () {
|
it('should create an instance', function () {
|
||||||
var opts = {};
|
var w = createW();
|
||||||
var w = new Wallet(config);
|
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
});
|
w.publicKeyRing.walletId.should.equal(w.id);
|
||||||
|
w.txProposals.walletId.should.equal(w.id);
|
||||||
|
w.requiredCopayers.should.equal(3);
|
||||||
it('should fail to load', function () {
|
|
||||||
var opts = {};
|
|
||||||
var w = new Wallet(config);
|
|
||||||
w.load(123);
|
|
||||||
should.not.exist(w.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
it('should create', function () {
|
|
||||||
var opts = {};
|
|
||||||
var w = new Wallet(config);
|
|
||||||
w.create();
|
|
||||||
should.exist(w.id);
|
should.exist(w.id);
|
||||||
should.exist(w.publicKeyRing);
|
should.exist(w.publicKeyRing);
|
||||||
should.exist(w.privateKey);
|
should.exist(w.privateKey);
|
||||||
should.exist(w.txProposals);
|
should.exist(w.txProposals);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should list unspent', function (done) {
|
it('should provide some basic features', function () {
|
||||||
var opts = {};
|
var opts = {};
|
||||||
var w = new Wallet(config);
|
var w = createW();
|
||||||
w.create();
|
|
||||||
addCopayers(w);
|
addCopayers(w);
|
||||||
w.publicKeyRing.generateAddress(false);
|
w.publicKeyRing.generateAddress(false);
|
||||||
|
|
||||||
should.exist(w.id);
|
|
||||||
w.publicKeyRing.isComplete().should.equal(true);
|
w.publicKeyRing.isComplete().should.equal(true);
|
||||||
|
|
||||||
w.listUnspent(function(utxos) {
|
|
||||||
utxos.length.should.equal(0);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('factory', function() {
|
|
||||||
it('should create the factory', function() {
|
|
||||||
should.exist(Wallet.factory);
|
|
||||||
});
|
|
||||||
it('should be able to create wallets', function() {
|
|
||||||
var w = Wallet.factory.create(config, opts);
|
|
||||||
should.exist(w);
|
|
||||||
});
|
|
||||||
it.skip('should be able to get wallets', function() {
|
|
||||||
var w = Wallet.factory.create(config, opts);
|
|
||||||
var v = Wallet.factory.get(config, w.id);
|
|
||||||
should.exist(w);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var unspentTest = [
|
var unspentTest = [
|
||||||
|
@ -97,9 +87,8 @@ describe('Wallet model', function() {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
var createWallet = function (bip32s) {
|
var createW2 = function (bip32s) {
|
||||||
var w = new Wallet(config);
|
var w = createW();
|
||||||
w.create();
|
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
|
|
||||||
var pkr = w.publicKeyRing;
|
var pkr = w.publicKeyRing;
|
||||||
|
@ -125,12 +114,12 @@ describe('Wallet model', function() {
|
||||||
|
|
||||||
it('#create, 1 sign', function () {
|
it('#create, 1 sign', function () {
|
||||||
|
|
||||||
var w = createWallet();
|
var w = createW2();
|
||||||
|
|
||||||
unspentTest[0].address = w.publicKeyRing.getAddress(1, true).toString();
|
unspentTest[0].address = w.publicKeyRing.getAddress(1, true).toString();
|
||||||
unspentTest[0].scriptPubKey = w.publicKeyRing.getScriptPubKeyHex(1, true);
|
unspentTest[0].scriptPubKey = w.publicKeyRing.getScriptPubKeyHex(1, true);
|
||||||
|
|
||||||
w.createTx(
|
w.createTxSync(
|
||||||
'15q6HKjWHAksHcH91JW23BJEuzZgFwydBt',
|
'15q6HKjWHAksHcH91JW23BJEuzZgFwydBt',
|
||||||
'123456789',
|
'123456789',
|
||||||
unspentTest
|
unspentTest
|
||||||
|
@ -148,14 +137,14 @@ describe('Wallet model', function() {
|
||||||
|
|
||||||
it('#create. Signing with derivate keys', function () {
|
it('#create. Signing with derivate keys', function () {
|
||||||
|
|
||||||
var w = createWallet();
|
var w = createW2();
|
||||||
|
|
||||||
var ts = Date.now();
|
var ts = Date.now();
|
||||||
for (var isChange=0; isChange<2; isChange++) {
|
for (var isChange=0; isChange<2; isChange++) {
|
||||||
for (var index=0; index<3; index++) {
|
for (var index=0; index<3; index++) {
|
||||||
unspentTest[0].address = w.publicKeyRing.getAddress(index, isChange).toString();
|
unspentTest[0].address = w.publicKeyRing.getAddress(index, isChange).toString();
|
||||||
unspentTest[0].scriptPubKey = w.publicKeyRing.getScriptPubKeyHex(index, isChange);
|
unspentTest[0].scriptPubKey = w.publicKeyRing.getScriptPubKeyHex(index, isChange);
|
||||||
w.createTx(
|
w.createTxSync(
|
||||||
'15q6HKjWHAksHcH91JW23BJEuzZgFwydBt',
|
'15q6HKjWHAksHcH91JW23BJEuzZgFwydBt',
|
||||||
'123456789',
|
'123456789',
|
||||||
unspentTest
|
unspentTest
|
||||||
|
@ -172,25 +161,4 @@ describe('Wallet model', function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: when sign is implemented
|
|
||||||
it.skip('#create, signing with wrong key', function () {
|
|
||||||
var w1 = createWallet();
|
|
||||||
|
|
||||||
unspentTest[0].address = w.publicKeyRing.getAddress(1, true).toString();
|
|
||||||
unspentTest[0].scriptPubKey = w.publicKeyRing.getScriptPubKeyHex(1, true);
|
|
||||||
|
|
||||||
var priv = new PrivateKey(config);
|
|
||||||
w.create(
|
|
||||||
'15q6HKjWHAksHcH91JW23BJEuzZgFwydBt',
|
|
||||||
'123456789',
|
|
||||||
unspentTest
|
|
||||||
);
|
|
||||||
var tx = w.txps[0].builder.build();
|
|
||||||
should.exist(tx);
|
|
||||||
tx.isComplete().should.equal(false);
|
|
||||||
Object.keys(w.txps[0].signedBy).length.should.equal(0);
|
|
||||||
Object.keys(w.txps[0].seenBy).length.should.equal(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@ var should = chai.should();
|
||||||
|
|
||||||
var WebRTC = require('../js/models/network/WebRTC');
|
var WebRTC = require('../js/models/network/WebRTC');
|
||||||
var Insight = require('../js/models/blockchain/Insight');
|
var Insight = require('../js/models/blockchain/Insight');
|
||||||
var FakeStorage = require('./FakeStorage');
|
var FakeStorage = require('./mocks/FakeStorage');
|
||||||
|
|
||||||
var WalletFactory = typeof copay === 'undefined' ? require('soop').load('../js/models/core/WalletFactory',{
|
var WalletFactory = typeof copay === 'undefined' ? require('soop').load('../js/models/core/WalletFactory',{
|
||||||
Network: WebRTC,
|
Network: WebRTC,
|
||||||
|
|
Loading…
Reference in New Issue