Tx sender: mobile improvements, history box

This commit is contained in:
mDuo13
2019-04-24 19:40:38 -07:00
parent 269d889fcf
commit 71ee136cb0
3 changed files with 61 additions and 20 deletions

View File

@@ -1147,6 +1147,31 @@ a.current {
width: 25px;height:25px;
}
#connection-status-item.active {
background-color: #2BCB96;
border-color: #2BCB96;
}
#tx-sender-history ul {
overflow: auto;
height: 220px;
border: 1px solid rgba(0, 0, 0, 0.125)
}
#tx-sender-history .list-group-item {
font-size: small;
color: #6c757d;
}
.page-tx-sender .input-group .form-control {
flex: 1 1 20%;
}
.bootstrap-growl {
max-width: 90vw !important;
overflow: hidden;
}
/* Print styles ------------------------------------------------------------- */
@media print {

View File

@@ -20,6 +20,18 @@ const set_up_tx_sender = async function() {
})
}
function logTx(txtype, hash, result) {
let li = "wtf"
// Future feature: link hash to a testnet txsplainer
if (result === "tesSUCCESS") {
li = '<li class="list-group-item fade-in p-1 text-muted"><i class="fa fa-check-circle"></i> '+txtype+": "+hash+'</li>'
} else {
li = '<li class="list-group-item fade-in p-1 list-group-item-danger"><i class="fa fa-times-circle"></i> '+txtype+": "+hash+'</li>'
}
$("#tx-sender-history ul").prepend(li)
}
//////////////////////////////////////////////////////////////////////////////
// Connection / Setup
//////////////////////////////////////////////////////////////////////////////
@@ -43,7 +55,7 @@ const set_up_tx_sender = async function() {
// so this won't go over JavaScript's
// 64-bit double precision
$("#balance-item").text(xrp_balance) + " drops"
$("#balance-item").text(xrp_balance)
$(".sending-address-item").text(sending_address)
}
@@ -127,6 +139,7 @@ const set_up_tx_sender = async function() {
maxLedgerVersion: prepared.instructions.maxLedgerVersion
}
let sign_response
try {
// Sign, submit
sign_response = api.sign(prepared.txJSON, use_secret)
@@ -147,11 +160,13 @@ const set_up_tx_sender = async function() {
if (final_result === "tesSUCCESS") {
if (!silent) {
successNotif(tx_object.TransactionType+" tx succeeded (hash: "+sign_response.id+")")
logTx(tx_object.TransactionType, sign_response.id, final_result)
}
} else {
if (!silent) {
errorNotif(tx_object.TransactionType+" tx failed w/ code "+final_result+
" (hash: "+sign_response.id+")")
logTx(tx_object.TransactionType, sign_response.id, final_result)
}
}
update_xrp_balance()
@@ -315,9 +330,7 @@ const set_up_tx_sender = async function() {
currency: pp_sending_currency,
issuer: pp_issuer_address
},
Flags: 0x80020000 // tfPartialPayment | tfFullyCanonicalSig
/*,
Paths: use_path*/
Flags: api.txFlags.Payment.PartialPayment | api.txFlags.Universal.FullyCanonicalSig
})
$("#send_partial_payment .loader").hide()
$("#send_partial_payment button").attr("disabled",false)

View File

@@ -16,6 +16,11 @@
<li class="list-group-item" id="balance-label">Test XRP Available:</li>
<li class="list-group-item disabled" id="balance-item">(None)</li>
</ul>
<div id="tx-sender-history">
<h5 class="m-3">Transaction History</h5>
<ul class="list-group list-group-flush">
</ul>
</div>
</div>
</div>
{% endblock %}
@@ -42,8 +47,8 @@
<span class="input-group-text loader" style="display: none"><img class="throbber" src="assets/img/rippleThrobber.png" /></span>
</div>
<button class="btn btn-primary form-control" type="button" id="send_xrp_payment_btn">Send XRP Payment</button>
<input id="send_xrp_payment_amount" class="form-control" type="number" aria-describedby="send_xrp_payment_amount_help" value="100000" min="1" max="10000000000" />
<div class="input-group-append">
<input id="send_xrp_payment_amount" class="form-control" type="number" aria-describedby="send_xrp_payment_amount_help" value="100000" min="1" max="10000000000" />
<span class="input-group-text" id="send_xrp_payment_amount_help">drops of XRP</span>
</div>
<!-- Future feature: Optional custom destination tag -->
@@ -75,18 +80,17 @@
<span class="input-group-text loader" style="display: none"><img class="throbber" src="assets/img/rippleThrobber.png" /></span>
</div>
<button class="btn btn-primary form-control" type="button" id="create_escrow_btn">Create Escrow</button>
<input class="form-control" type="number" value="60" min="5" max="10000" id="create_escrow_duration_seconds" />
<div class="input-group-append">
<span class="input-group-text">for</span>
<input class="form-control" type="number" value="60" min="5" max="10000" id="create_escrow_duration_seconds" />
<span class="input-group-text">seconds</span>
<span class="input-group-text">
(
<input type="checkbox" id="create_escrow_release_automatically" value="1" />
<label class="form-check-label" for="create_escrow_release_automatically">Release automatically</label>)
</span>
</div>
<span class="input-group-text">
(
<input type="checkbox" id="create_escrow_release_automatically" value="1" />
<label class="form-check-label" for="create_escrow_release_automatically">Finish automatically</label>)
</span>
</div>
<small class="form-text text-muted">Create a time-based escrow of 1 XRP.</small>
<small class="form-text text-muted">Create a <a href="escrow.html">time-based escrow</a> of 1 XRP for the specified number of seconds.</small>
<div class="progress mb-1" style="display:none" id="escrow_progress">
<div class="progress-bar progress-bar-striped w-0">&nbsp;</div>
<small class="justify-content-center d-flex position-absolute w-100">(Waiting to release Escrow when it's ready)</small>
@@ -101,13 +105,12 @@
<span class="input-group-text loader" style="display: none"><img class="throbber" src="assets/img/rippleThrobber.png" /></span>
</div>
<button class="btn btn-primary form-control" type="button" id="create_payment_channel_btn">Create Payment Channel</button>
<input id="create_payment_channel_amount" class="form-control" type="number" aria-describedby="create_payment_channel_amount_help" value="100000" min="1" max="10000000000" />
<div class="input-group-append">
<span class="input-group-text">funded with</span>
<input id="create_payment_channel_amount" class="form-control" type="number" aria-describedby="create_payment_channel_amount_help" value="100000" min="1" max="10000000000" />
<span class="input-group-text" id="create_payment_channel_amount_help">drops of XRP</span>
</div>
</div>
<small class="form-text text-muted">Create a payment channel.</small>
<small class="form-text text-muted">Create a <a href="payment-channels.html">payment channel</a> and fund it with the specified amount of XRP.</small>
</div><!-- /.form group for create paychan -->
<hr />
@@ -118,12 +121,12 @@
<span class="input-group-text loader" style="display: none"><img class="throbber" src="assets/img/rippleThrobber.png" /></span>
</div>
<button class="btn btn-primary form-control" type="button" id="send_issued_currency_btn">Send Issued Currency</button>
<input id="send_issued_currency_amount" class="form-control" type="text" value="100" /><!-- Note: HTML limits "number" inputs to IEEE 764 double precision, which isn't enough for the full range of issued currency amounts -->
<div class="input-group-append">
<input id="send_issued_currency_amount" class="form-control" type="text" value="100" /><!-- Note: HTML limits "number" inputs to IEEE 764 double precision, which isn't enough for the full range of issued currency amounts -->
<span class="input-group-text" id="send_issued_currency_code">FOO</span><!-- TODO: custom currency codes -->
</div>
</div>
<small class="form-text text-muted">Your destination address needs a trust line to <span class="sending-address-item">(the test sender)</span> for the currency in question. Otherwise, you'll get tecPATH_DRY.</small>
<small class="form-text text-muted">Your destination address needs a <a href="trust-lines-and-issuing.html">trust line</a> to <span class="sending-address-item">(the test sender)</span> for the currency in question. Otherwise, you'll get tecPATH_DRY.</small>
</div><!-- /.form group for issued currency payment -->
<hr />
@@ -134,12 +137,12 @@
<span class="input-group-text loader" style="display: none"><img class="throbber" src="assets/img/rippleThrobber.png" /></span>
</div>
<button class="btn btn-primary form-control" type="button" id="trust_for_btn">Trust for</button>
<input id="trust_for_amount" class="form-control disabled" type="number" value="100000" />
<div class="input-group-append">
<input id="trust_for_amount" class="form-control disabled" type="number" value="100000" />
<span class="input-group-text" id="trust_for_currency_code">FOO</span>
</div>
</div>
<small class="form-text text-muted">The test sender creates a trust line to your account for the given currency.</small>
<small class="form-text text-muted">The test sender creates a <a href="trust-lines-and-issuing.html">trust line</a> to your account for the given currency.</small>
</div><!-- /.form group for create trust line -->
</form>