working on find_m_n script

This commit is contained in:
Manuel Araoz 2014-05-21 11:10:19 -03:00
commit c8ebf0ce65
4 changed files with 73 additions and 5 deletions

View file

@ -52,8 +52,7 @@ angular.module('copay.send').controller('SendController',
var amount = (form.amount.$modelValue * 100000000).toString(); // satoshi to string
var w = $rootScope.wallet;
w.createTx( address, amount,function() {
w.createTx(address, amount,function() {
$scope.loading = false;
$rootScope.$flashMessage = { message: 'The transaction proposal has been created', type: 'success'};
$rootScope.$digest();

View file

@ -20,7 +20,8 @@ function Wallet(opts) {
'requiredCopayers', 'totalCopayers', 'spendUnconfirmed',
'publicKeyRing', 'txProposals', 'privateKey', 'version'
].forEach(function(k) {
if (typeof opts[k] === 'undefined') throw new Error('missing key:' + k);
if (typeof opts[k] === 'undefined')
throw new Error('missing required option for Wallet: ' + k);
self[k] = opts[k];
});
@ -544,6 +545,8 @@ Wallet.prototype.getUnspent = function(cb) {
Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
var self = this;
alert(amountSatStr);
alert(JSON.stringify(opts));
if (typeof opts === 'function') {
cb = opts;
opts = {};

View file

@ -17,6 +17,8 @@ var Wallet = require('./Wallet');
function WalletFactory(config, version) {
var self = this;
config = config || {};
this.storage = new Storage(config.storage);
this.network = new Network(config.network);
this.blockchain = new Blockchain(config.blockchain);
@ -97,7 +99,6 @@ WalletFactory.prototype.create = function(opts) {
opts.privateKey = opts.privateKey || new PrivateKey({ networkName: this.networkName });
var requiredCopayers = opts.requiredCopayers || this.walletDefaults.requiredCopayers;
var totalCopayers = opts.totalCopayers || this.walletDefaults.totalCopayers;
@ -124,7 +125,7 @@ WalletFactory.prototype.create = function(opts) {
opts.spendUnconfirmed = opts.spendUnconfirmed || this.walletDefaults.spendUnconfirmed;
opts.requiredCopayers = requiredCopayers;
opts.totalCopayers = totalCopayers;
opts.version = this.version;
opts.version = opts.version || this.version;
var w = new Wallet(opts);
w.store();
return w;