mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 06:46:10 +00:00
Dash Budget Proposal Generator (#18)
* GovObject Proposal Form * update proposal_name --> name * jquery ui date picker * cleanup + copyToClipboard * remove websockets * aesthetic/UX changes * fix start/end epoch times * remove "dash-cli" prefix from gobject commands * bugfix: proposal name double-quote serialization * add .gitignore * Refactor UX * ProposalGenerator / UI Controller * Proposal form is disabled on create * bugfix: prepare command string * add proposal validation * refactor setFormEditable * simplify url regex * first commit with drop down list instead of datepicker for payment start & end dates * first commit with drop down list instead of datepicker for payment start & end dates * automatic default adjustment of end date to one month after start date whenever start date is changed * clean readme * added parameter bufferdays to easily change number of days before next superblock before we automatically select start date of next budget cycle * included dropdown lists to be uneditable/editable with the "Create Proposal"/"Edit Proposal"-buttons * replaced end date dropdown with a time span in month dropdown * adapted default superblock for start date dropdown * fill $("#time").val once again for the time parameter in gobject cmd * first code to check feeTxid of govobject prepare and count confirmations * first code to check feeTxid of govobject prepare and count confirmations * disable/enable fee Transaction input field * checking new block for feeTxid * listener for blocks and 6 confirmations * listener for blocks and 6 confirmations * listener for blocks and 6 confirmations * progress bar while waiting for fee tx confirmations * added error messages * Add epoch time to serialization and relax address validation (#4) - address validation is breaking in Ubuntu Firefox. disabled until future fix * bugfix: convert javascript time to unix time (/1000) * refactor: tx listener and superblock date selection fields (#6) * adds images, css dir, reformats proposal form * adds dash logo, styles header, sync with design * refactor start and end epoch calculation * refactor js dependencies * comment out social links for now, issue #8 * adds favicon * move proposol header and description to right side of form * include Roboto font * refactor js dependencies * refactor transaction listener * implements tabs as step progression * clean up tabs * progress buttons * progress bar * implement transaction listener progress bar * save progress on getting submit proposal command and progressing UI confirmations * confirmations counted, transitions to final step * fee transaction id appends to submit command, step four complete * implement network selector * bugfix: provider * adds css proposalBlock style to rest of steps, raises validation errors on step 2 while inputting txID * adds disconnect event for socket io * enables new and edit buttons, hides steps in progress if new proposal clicked * mainnet/testnet toggle is hidden upon clicking Create Proposal, reappeears upon New Proposal * calculate total proposal amount * bugfix and refactor total amount calculation * adjust payment cycle selectors * various adjustments * moves network toggle buttons, popup on tx errors (#16) * replace dash_logo, sharpen Governance Tools subtitle (#17) * moves network toggle buttons, popup on tx errors * replace dash_logo, sharpen Governance Tools subtitle * include proposal maturity constants * updated proposal validation * update bitcore-lib-dash to latest * adjust start_epoch and end_epoch calculation * various design / label improvements * add api prefix as parameter for socket.io * update DASH fee amount * update default network
This commit is contained in:
parent
b2588253ae
commit
dff6605da4
33 changed files with 63941 additions and 3 deletions
93
js/txListener.js
Executable file
93
js/txListener.js
Executable file
|
@ -0,0 +1,93 @@
|
|||
function TXListener(socket, provider, prefix, transaction) {
|
||||
|
||||
this.socket = socket;
|
||||
this.provider = provider;
|
||||
this.prefix = prefix;
|
||||
this.transaction = transaction;
|
||||
|
||||
this.blockheight = null;
|
||||
this.confirmations = null;
|
||||
|
||||
}
|
||||
|
||||
TXListener.prototype.initSocket = function(cb) {
|
||||
var self = this;
|
||||
var socket = this.socket;
|
||||
var confirmations = 0;
|
||||
|
||||
socket.on('block', function(data) {
|
||||
console.log('block: '+ data);
|
||||
|
||||
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
|
||||
confirmations++;
|
||||
|
||||
if (confirmations >= 6) {
|
||||
cb();
|
||||
};
|
||||
$("#progressbar").progressbar({value: ((100 / 6) * confirmations)});
|
||||
|
||||
console.log('confirmations: ' + confirmations);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
TXListener.prototype.getTx = function(cb) {
|
||||
var txid = this.transaction;
|
||||
|
||||
var opts = {
|
||||
type: "GET",
|
||||
route: "/tx/"+txid,
|
||||
data: {
|
||||
format: "json"
|
||||
}
|
||||
};
|
||||
|
||||
this._fetch(opts, cb);
|
||||
};
|
||||
|
||||
TXListener.prototype.getBlock = function(hash, cb) {
|
||||
|
||||
var opts = {
|
||||
type: "GET",
|
||||
route: "/block/"+hash,
|
||||
data: {
|
||||
format: "json"
|
||||
}
|
||||
};
|
||||
|
||||
this._fetch(opts, cb);
|
||||
};
|
||||
|
||||
TXListener.prototype._fetch = function(opts,cb) {
|
||||
var self = this;
|
||||
var provider = opts.provider || self.provider;
|
||||
var prefix = opts.prefix || self.prefix;
|
||||
|
||||
if(opts.type && opts.route && opts.data) {
|
||||
|
||||
jQuery.ajax({
|
||||
type: opts.type,
|
||||
url: provider + prefix + opts.route,
|
||||
data: JSON.stringify(opts.data),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
crossDomain: true,
|
||||
dataType: "json",
|
||||
success: function (data, status, jqXHR) {
|
||||
cb(null, data);
|
||||
},
|
||||
error: function (jqXHR, status, error) {
|
||||
var err = jqXHR.status;
|
||||
//var err = eval("(" + jqXHR.responseText + ")");
|
||||
cb(err, null);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
cb('missing parameter',null);
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue