mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 06:46:10 +00:00
Merge pull request #14 from hunterlester/development
step 4, generate submit command
This commit is contained in:
commit
7d3132d450
2 changed files with 17 additions and 5 deletions
|
@ -100,6 +100,8 @@
|
|||
|
||||
$('#feeTxid').on('input', function() {
|
||||
|
||||
var proposal = new ProposalGenerator(gov);
|
||||
|
||||
var transaction = $(this).val();
|
||||
var txListener = new TXListener(socket, provider, transaction);
|
||||
|
||||
|
@ -121,9 +123,14 @@
|
|||
txListener.confirmations = res.confirmations;
|
||||
|
||||
txListener.initSocket(function() {
|
||||
$('#walletCommandsSubmit').removeClass('hidden');
|
||||
document.getElementById('step_four').click();
|
||||
document.getElementsByClassName('progress-bar')[0].style.width = "100%";
|
||||
document.getElementsByClassName('progress-bar')[0].innerText = "Proposal ready for submission";
|
||||
console.log($('#feeTxid').val());
|
||||
var submitCommand = "gobject submit " + $('#parentHash').val() + " " + $('#revision').val() + " " + $('#time').val() + " " + proposal.gov.serialize() + " " + $('#feeTxid').val();
|
||||
console.log(submitCommand);
|
||||
$('textarea#submitProposal').val(submitCommand);
|
||||
}); // callback issued after tx confirmations >= 6
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ function TXListener(socket, provider, transaction) {
|
|||
TXListener.prototype.initSocket = function(cb) {
|
||||
var self = this;
|
||||
var socket = this.socket;
|
||||
var confirmations = 0;
|
||||
|
||||
socket.on('block', function(data) {
|
||||
console.log('block: '+ data);
|
||||
|
@ -19,12 +20,15 @@ TXListener.prototype.initSocket = function(cb) {
|
|||
self.getBlock(data, function(err, res) {
|
||||
|
||||
if (err) console.log("error fetching block: " + data);
|
||||
self.confirmations = (res.height - self.blockheight) + 1; // compare blockHeight against transaction blockHeight
|
||||
//self.confirmations = (res.height - self.blockheight) + 1; // compare blockHeight against transaction blockHeight
|
||||
confirmations++;
|
||||
|
||||
if (self.confirmations >= 6) cb();
|
||||
$("#progressbar").progressbar({value: ((100 / 6) * self.confirmations)});
|
||||
if (confirmations >= 6) {
|
||||
cb();
|
||||
};
|
||||
$("#progressbar").progressbar({value: ((100 / 6) * confirmations)});
|
||||
|
||||
console.log('confirmations: ' + self.confirmations);
|
||||
console.log('confirmations: ' + confirmations);
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -41,6 +45,7 @@ TXListener.prototype.getTx = function(cb) {
|
|||
format: "json"
|
||||
}
|
||||
};
|
||||
console.log(opts);
|
||||
|
||||
this._fetch(opts, cb);
|
||||
};
|
||||
|
@ -83,4 +88,4 @@ TXListener.prototype._fetch = function(opts,cb) {
|
|||
} else {
|
||||
cb('missing parameter',null);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue