add test and adv opts to create
This commit is contained in:
parent
dd724a6135
commit
291ed73916
5 changed files with 49 additions and 7 deletions
|
|
@ -116,7 +116,7 @@ angular.module('copayApp.controllers').controller('JoinController',
|
|||
walletFactory.network.on('badSecret', function() {});
|
||||
|
||||
Passphrase.getBase64Async($scope.joinPassword, function(passphrase) {
|
||||
walletFactory.joinCreateSession($scope.connectionId, $scope.nickname, passphrase, $scope.enterPrivate ? $scope.private : null, function(err, w) {
|
||||
walletFactory.joinCreateSession($scope.connectionId, $scope.nickname, passphrase, $scope.private, function(err, w) {
|
||||
$scope.loading = false;
|
||||
if (err || !w) {
|
||||
if (err === 'joinError')
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ angular.module('copayApp.controllers').controller('SetupController',
|
|||
$scope.loading = false;
|
||||
$scope.walletPassword = $rootScope.walletPassword;
|
||||
$scope.isMobile = !!window.cordova;
|
||||
$scope.hideAdv = true;
|
||||
|
||||
// ng-repeat defined number of times instead of repeating over array?
|
||||
$scope.getNumber = function(num) {
|
||||
|
|
@ -82,6 +83,7 @@ angular.module('copayApp.controllers').controller('SetupController',
|
|||
name: $scope.walletName,
|
||||
nickname: $scope.myNickname,
|
||||
passphrase: passphrase,
|
||||
privateKeyHex: $scope.private,
|
||||
};
|
||||
var w = walletFactory.create(opts);
|
||||
controllerUtils.startNetwork(w, $scope);
|
||||
|
|
|
|||
|
|
@ -113,9 +113,15 @@ WalletFactory.prototype.create = function(opts) {
|
|||
opts = opts || {};
|
||||
this.log('### CREATING NEW WALLET.' + (opts.id ? ' USING ID: ' + opts.id : ' NEW ID') + (opts.privateKey ? ' USING PrivateKey: ' + opts.privateKey.getId() : ' NEW PrivateKey'));
|
||||
|
||||
opts.privateKey = opts.privateKey || new PrivateKey({
|
||||
networkName: this.networkName
|
||||
});
|
||||
var privOpts = {
|
||||
networkName: this.networkName,
|
||||
};
|
||||
|
||||
if (opts.privateKeyHex && opts.privateKeyHex.length>1) {
|
||||
privOpts.extendedPrivateKeyString = opts.privateKeyHex;
|
||||
}
|
||||
|
||||
opts.privateKey = opts.privateKey || new PrivateKey(privOpts);
|
||||
|
||||
var requiredCopayers = opts.requiredCopayers || this.walletDefaults.requiredCopayers;
|
||||
var totalCopayers = opts.totalCopayers || this.walletDefaults.totalCopayers;
|
||||
|
|
@ -216,7 +222,6 @@ WalletFactory.prototype.decodeSecret = function(secret) {
|
|||
|
||||
|
||||
WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphrase, privateHex, cb) {
|
||||
console.log('[WalletFactory.js.218:privateHex:]',privateHex); //TODO
|
||||
var self = this;
|
||||
var s = self.decodeSecret(secret);
|
||||
if (!s) return cb('badSecret');
|
||||
|
|
@ -229,7 +234,6 @@ console.log('[WalletFactory.js.218:privateHex:]',privateHex); //TODO
|
|||
privOpts.extendedPrivateKeyString = privateHex;
|
||||
}
|
||||
|
||||
console.log('[WalletFactory.js.229:privOpts:]',privOpts); //TODO
|
||||
//Create our PrivateK
|
||||
var privateKey = new PrivateKey(privOpts);
|
||||
this.log('\t### PrivateKey Initialized');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue