mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 06:46:10 +00:00
commit
43d66408e1
3 changed files with 166 additions and 99 deletions
50
.gitignore
vendored
Normal file
50
.gitignore
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# WebStorm settings
|
||||
.idea
|
||||
.idea/*
|
||||
|
||||
# SSL certs
|
||||
*.pem
|
||||
|
||||
# BASH dumps
|
||||
*.stackdump
|
||||
|
||||
# backups
|
||||
*.*~
|
||||
|
||||
# Build folders
|
||||
build
|
||||
dist
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
||||
node_modules
|
||||
|
||||
# Debug log from npm
|
||||
npm-debug.log
|
||||
npm-debug.log.*dashpay/client/bundle.js
|
||||
dashpay/client/node_modules
|
||||
/client/dashpay-spa/node_modules/
|
|
@ -3531,7 +3531,7 @@ inherits(Proposal,GovObject);
|
|||
Proposal.prototype.dataHex = function() {
|
||||
var _govObj = {
|
||||
end_epoch: this.end_epoch,
|
||||
name: this._toASCII(this.name),
|
||||
name: this.name,
|
||||
payment_address: this.payment_address,
|
||||
payment_amount: this.payment_amount,
|
||||
start_epoch: this.start_epoch,
|
||||
|
@ -3539,7 +3539,12 @@ Proposal.prototype.dataHex = function() {
|
|||
url: this.url
|
||||
};
|
||||
|
||||
return '[["'+this._govOp+'", '+JSON.stringify(_govObj)+']]';
|
||||
|
||||
// screwy data shims 'til we can fix this on dashd
|
||||
var inner = [this._govOp, _govObj];
|
||||
var outer = [ inner ];
|
||||
|
||||
return JSON.stringify(outer);
|
||||
};
|
||||
|
||||
Proposal.prototype._newGovObject = function() {
|
||||
|
|
206
index.html
206
index.html
|
@ -2,44 +2,31 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>govobject-proposal</title>
|
||||
<title>Dash Governance Tools</title>
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.0/themes/smoothness/jquery-ui.css">
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.1.0.js" integrity="sha256-slogkvB1K3VOkzAI8QITxV3VzpOnkeNVsKvtkYLMjfk=" crossorigin="anonymous"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
<script src="https://dev-test.dash.org:3001/socket.io/socket.io.js"></script>
|
||||
<script src="bitcore-lib-dash.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var Bitcore = require('bitcore-lib-dash');
|
||||
|
||||
eventToListenTo = 'tx';
|
||||
room = 'inv';
|
||||
|
||||
var socket = io("https://dev-test.dash.org:3001/");
|
||||
socket.on('connect', function() {
|
||||
// Join the room.
|
||||
socket.emit('subscribe', room);
|
||||
console.log("listening for '" + eventToListenTo + "' in '" + room + "'");
|
||||
});
|
||||
|
||||
socket.on(eventToListenTo, function(data) {
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var opts = { dateFormat: "@" }; // unix date format
|
||||
var opts = { dateFormat: $.datepicker.ISO_8601 };
|
||||
|
||||
$('#start_epoch').datepicker(opts);
|
||||
$('#end_epoch').datepicker(opts);
|
||||
$('#start_epoch').datepicker(opts, 'getdate');
|
||||
$('#end_epoch').datepicker(opts, 'getdate');
|
||||
|
||||
/*
|
||||
$('#dataHex').click(function() {
|
||||
copyToClipboard($(this).attr('id'));
|
||||
});
|
||||
*/
|
||||
|
||||
$('#prepareProposal').click(function() {
|
||||
copyToClipboard($(this).attr('id'));
|
||||
|
@ -49,26 +36,38 @@
|
|||
copyToClipboard($(this).attr('id'));
|
||||
});
|
||||
|
||||
$('#formSubmit').click(function() {
|
||||
var gov = '';
|
||||
|
||||
var gov = new Bitcore.GovObject.Proposal();
|
||||
$('#btnPrepare').click(function() {
|
||||
|
||||
gov.end_epoch = document.getElementById('end_epoch').value || null;
|
||||
gov.payment_address = document.getElementById('payment_address').value;
|
||||
gov.payment_amount = parseFloat(document.getElementById('payment_amount').value);
|
||||
gov.name = document.getElementById('name').value;
|
||||
gov.start_epoch = document.getElementById('start_epoch').value || null;
|
||||
gov.type = parseInt(document.getElementById('type').value);
|
||||
gov.url = document.getElementById('url').value;
|
||||
gov = new Bitcore.GovObject.Proposal();
|
||||
|
||||
document.getElementById('dataHex').innerHTML = gov.uncheckedSerialize();
|
||||
// proposal basic fields
|
||||
gov.name = $('#name').val();
|
||||
gov.url = $('#url').val();
|
||||
gov.payment_address = $('#payment_address').val();
|
||||
gov.payment_amount = parseFloat($('#payment_amount').val());
|
||||
|
||||
document.getElementById('prepareProposal').innerHTML = "dash-cli gobject submit "+document.getElementById('parentHash').value+" "+document.getElementById('revision').value+" "+document.getElementById('time').value+" "+gov.uncheckedSerialize();
|
||||
// format dates for gobject serialization
|
||||
gov.start_epoch = (new Date($('#start_epoch').val()) / 1000) || null;
|
||||
gov.end_epoch = (new Date($('#end_epoch').val()) / 1000) || null;
|
||||
|
||||
if (document.getElementById('feeTxid').value) {
|
||||
document.getElementById('submitProposal').innerHTML = "dash-cli gobject submit " + document.getElementById('parentHash').value + " " + document.getElementById('revision').value + " " + document.getElementById('time').value + " " + gov.uncheckedSerialize() + " " + document.getElementById('feeTxid').value;
|
||||
}
|
||||
// hidden elements
|
||||
gov.type = parseInt($('#type').val());
|
||||
|
||||
//document.getElementById('dataHex').innerHTML = gov.uncheckedSerialize();
|
||||
|
||||
var propCommand = "gobject submit "+$('#parentHash').val() + " " + $('#revision').val() +" " + $('#time').val() +" " + gov.uncheckedSerialize();
|
||||
$("textarea#prepareProposal").val(propCommand);
|
||||
|
||||
$('#feeTxid').on('input', function() {
|
||||
if ($('#feeTxid').val().length > 0) {
|
||||
var submitCommand = "gobject submit " + $('#parentHash').val() + " " + $('#revision').val() + " " + $('#time').val() + " " + gov.uncheckedSerialize() + " " + $('#feeTxid').val();
|
||||
$("textarea#submitProposal").val(submitCommand);
|
||||
} else {
|
||||
$("textarea#submitProposal").val('');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -90,80 +89,100 @@
|
|||
<div class="col-xs-10 col-xs-offset-1">
|
||||
|
||||
<div class="row" style="margin-top:2em;">
|
||||
<div class="col-xs-12"><h1>Budget Proposal</h1></div>
|
||||
<div class="col-xs-12"><h1>Dash Budget Proposal Generator</h1></div>
|
||||
<div class="col-xs-12">Generate budget proposal commands you can copy/paste into your Dash wallet to prepare a budget proposal and submit it to the network.</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top:2em;">
|
||||
<div class="col-xs-12"><h2>Create a Proposal</h2></div>
|
||||
<div class="col-xs-12">Enter details for your proposal and click 'Create Proposal'. This will generate a command you can run in your local wallet to prepare the proposal at a cost of 0.33 Dash</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top:1em;">
|
||||
<div class="col-xs-6">
|
||||
|
||||
<form>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">name:</label>
|
||||
<input type="text" class="form-control" id="name" value="我想喝一點點無龍茶" placeholder="我想喝一點點無龍茶">
|
||||
<label for="name">Proposal Name:</label>
|
||||
<input type="text" class="form-control" id="name" value="" placeholder="proposal-name">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="url">url:</label>
|
||||
<input type="text" class="form-control" id="url" value="blah.com" placeholder="blah.com">
|
||||
<label for="url">Proposal Description URL:</label>
|
||||
<input type="text" class="form-control" id="url" value="" placeholder="https://www.dashcentral.org/p/proposal-name">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="payment_address">payment_address:</label>
|
||||
<input type="text" class="form-control" id="payment_address" value="yTC62huR4YQEPn9AJHjnQxxreHSbgAoatV" placeholder="yTC62huR4YQEPn9AJHjnQxxreHSbgAoatV">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="payment_amount">payment_amount:</label>
|
||||
<input type="text" class="form-control" id="payment_amount" value="39.23" placeholder="39.23">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="start_epoch">start date:</label>
|
||||
<label for="start_epoch">Proposal Start Date:</label>
|
||||
<input type="text" class="form-control" id="start_epoch" value="" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="end_epoch">end date:</label>
|
||||
<input type="text" class="form-control" id="end_epoch" value="" placeholder="">
|
||||
</div>
|
||||
<div type="submit" class="btn btn-primary" id="btnPrepare">Create Proposal</div>
|
||||
|
||||
<div class="form-group" style="display:none;">
|
||||
<label for="type">type:</label>
|
||||
<input type="text" class="form-control" id="type" value="1" placeholder="1">
|
||||
</div>
|
||||
|
||||
<div type="submit" class="btn btn-primary" id="formSubmit">Create Proposal</div>
|
||||
<div class="form-group" style="display:none;">
|
||||
<label for="parentHash">parent-hash:</label>
|
||||
<input type="text" class="form-control" id="parentHash" value="0" placeholder="0">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div class="form-group" style="display:none;">
|
||||
<label for="revision">revision:</label>
|
||||
<input type="text" class="form-control" id="revision" value="1" placeholder="1">
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="display:none;">
|
||||
<label for="time">Creation Time:</label>
|
||||
<input type="text" class="form-control" id="time" value="" placeholder="">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="payment_address">Payment Address:</label>
|
||||
<input type="text" class="form-control" id="payment_address" value="" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="payment_amount">Monthly Payment Amount in Dash:</label>
|
||||
<input type="text" class="form-control" id="payment_amount" value="" placeholder="0">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="end_epoch">Proposal End Date:</label>
|
||||
<input type="text" class="form-control" id="end_epoch" value="" placeholder="">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top:2em;">
|
||||
<div class="col-xs-12"><h2>Wallet Commands</h2></div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top:2em;">
|
||||
|
||||
<!--div class="col-xs-12" style="display:none;">
|
||||
<form>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="parentHash">parent-hash:</label>
|
||||
<input type="text" class="form-control" id="parentHash" value="0" placeholder="0">
|
||||
<label for="dataHex">data-hex:</label>
|
||||
<textarea class="form-control" id="dataHex" rows="6" placeholder=""></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="revision">revision:</label>
|
||||
<input type="text" class="form-control" id="revision" value="1" placeholder="1">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="time">time:</label>
|
||||
<input type="text" class="form-control" id="time" value="1474049452" placeholder="1474049452">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="feeTxid">fee-txid:</label>
|
||||
<input type="text" class="form-control" id="feeTxid" value="" placeholder="<fee-txid>">
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div-->
|
||||
|
||||
<div class="col-xs-12">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="prepareProposal">Prepare-Proposal Command:</label>
|
||||
<div>Paste this proposal command into your Dash wallet console to spend a Fee transaction of 0.33 DASH.</div>
|
||||
<textarea readonly class="form-control" id="prepareProposal" rows="4" placeholder=""></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -171,34 +190,27 @@
|
|||
|
||||
<div class="row" style="margin-top:2em;">
|
||||
|
||||
<div class="col-xs-6">
|
||||
<div class="col-xs-12">
|
||||
|
||||
<form>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="dataHex">data-hex:</label>
|
||||
<textarea class="form-control" id="dataHex" rows="6" placeholder=""></textarea>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div class="form-group">
|
||||
<label for="feeTxid">Fee Transaction ID:</label>
|
||||
<div>Paste the transaction ID returned by the wallet below to generate the final submit command.</div>
|
||||
<input type="text" class="form-control" id="feeTxid" value="" placeholder="<fee-txid>">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-xs-6">
|
||||
</div>
|
||||
|
||||
<form>
|
||||
<div class="row" style="margin-top:2em;">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="prepareProposal">prepare proposal:</label>
|
||||
<textarea class="form-control" id="prepareProposal" rows="4" placeholder=""></textarea>
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="submitProposal">submit proposal:</label>
|
||||
<textarea class="form-control" id="submitProposal" rows="4" placeholder=""></textarea>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div class="form-group">
|
||||
<label for="submitProposal">Submit Proposal Command:</label>
|
||||
<div>Paste the Fee TX id to generate the proposal submit command. This is the final step and can be completed after 6 confirmations on the fee tx.</div>
|
||||
<textarea readonly class="form-control" id="submitProposal" rows="4" placeholder=""></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue