govobject-proposal/index.html
2016-09-21 18:26:29 +01:00

222 lines
8.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<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="bitcore-lib-dash.js"></script>
<script type="text/javascript">
var Bitcore = require('bitcore-lib-dash');
$(document).ready(function() {
var opts = { dateFormat: $.datepicker.ISO_8601 };
$('#start_epoch').datepicker(opts, 'getdate');
$('#end_epoch').datepicker(opts, 'getdate');
/*
$('#dataHex').click(function() {
copyToClipboard($(this).attr('id'));
});
*/
$('#prepareProposal').click(function() {
copyToClipboard($(this).attr('id'));
});
$('#submitProposal').click(function() {
copyToClipboard($(this).attr('id'));
});
var gov = '';
$('#btnPrepare').click(function() {
gov = new Bitcore.GovObject.Proposal();
// proposal basic fields
gov.name = $('#name').val();
gov.url = $('#url').val();
gov.payment_address = $('#payment_address').val();
gov.payment_amount = parseFloat($('#payment_amount').val());
// 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;
// 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('');
}
});
});
});
function copyToClipboard(id)
{
document.getElementById(id).select();
document.execCommand('copy');
}
</script>
<style type="text/css">
textarea { background-color:#fafafa !important; }
</style>
</head>
<body>
<div class="col-xs-10 col-xs-offset-1">
<div class="row" style="margin-top:2em;">
<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">
<div class="form-group">
<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">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="start_epoch">Proposal Start Date:</label>
<input type="text" class="form-control" id="start_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 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>
<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="dataHex">data-hex:</label>
<textarea class="form-control" id="dataHex" rows="6" placeholder=""></textarea>
</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>
</div>
<div class="row" style="margin-top:2em;">
<div class="col-xs-12">
<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>
<div class="row" style="margin-top:2em;">
<div class="col-xs-12">
<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>
</div>
</div>
</body>
</html>