From 6866ce295bf66550930fa0a24b7c7bc457216d7e Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Wed, 17 Apr 2019 18:43:39 -0700 Subject: [PATCH] Tx Sender: UI, connectivity --- assets/js/tx-sender.js | 55 +++++++++++++++ dactyl-config.yml | 7 ++ tool/template-tx-sender.html | 127 +++++++++++++++++++++++++++++++++++ 3 files changed, 189 insertions(+) create mode 100644 assets/js/tx-sender.js create mode 100644 tool/template-tx-sender.html diff --git a/assets/js/tx-sender.js b/assets/js/tx-sender.js new file mode 100644 index 0000000000..87af2b8c49 --- /dev/null +++ b/assets/js/tx-sender.js @@ -0,0 +1,55 @@ +const set_up_tx_sender = async function() { + FAUCET_URL = "https://faucet.altnet.rippletest.net/accounts" + TESTNET_URL = "wss://s.altnet.rippletest.net:51233" + + let sending_address = "" + let sending_secret = "" + let xrp_balance = 0 + + console.debug("Getting a sending address from the faucet...") + + faucet_response = function(data) { + sending_address = data.account.address + sending_secret = data.account.secret + xrp_balance = Number(data.balance) // Faucet only delivers ~10,000 XRP, + // so this won't go over JavaScript's + // 64-bit double precision + + $("#balance-item").text(xrp_balance) + " drops" + $(".sending-address-item").text(sending_address) + } + + // TEMP: reuse same address for testing + faucet_response({account:{address:"r6f2viHtMjNSfERbZmXXkJnMmkBAN6d9X", secret:"spyTc4y4GAQwBfQHCxiJ1Xd2mmnM2"},balance:10000}) + + // POST-TEMP: Version that actually uses the faucet on every run: + // $.ajax({ + // url: FAUCET_URL, + // type: 'POST', + // dataType: 'json', + // success: faucet_response, + // error: function() { + // alert("There was an error with the XRP Ledger Test Net Faucet. Reload this page to try again."); + // } + // }) + // + + api = new ripple.RippleAPI({server: TESTNET_URL}) + api.on('connected', () => { + $("#connection-status-item").text("Connected") + $("#connection-status-item").removeClass("disabled").addClass("active") + }) + api.on('disconnected', (code) => { + $("#connection-status-item").text("Not connected") + $("#connection-status-item").removeClass("active").addClass("disabled") + }) + console.log("Connecting to Test Net WebSocket...") + api.connect() + + +} + +$(document).ready( function() { + console.log("doc ready!") + set_up_tx_sender() +} ) diff --git a/dactyl-config.yml b/dactyl-config.yml index f9110a1e8a..db9b98b630 100644 --- a/dactyl-config.yml +++ b/dactyl-config.yml @@ -2915,6 +2915,13 @@ pages: - local template: template-test-net.html + - name: Transaction Sender + funnel: Dev Tools + html: tx-sender.html + targets: + - local + template: template-tx-sender.html + # News ------------------------------------------------------------------------- - md: news/news.md diff --git a/tool/template-tx-sender.html b/tool/template-tx-sender.html new file mode 100644 index 0000000000..15f7b199b0 --- /dev/null +++ b/tool/template-tx-sender.html @@ -0,0 +1,127 @@ +{% extends "template-base.html" %} + +{% block bodyclasses %}page-tx-sender{% endblock %} + +{% block right_sidebar %} +
+
+

Status

+
+
+
    +
  • XRP Test Net:
  • +
  • Not Connected
  • +
  • Sending Address:
  • +
  • (None)
  • +
  • Test XRP Available:
  • +
  • (None)
  • +
+
+
+{% endblock %} + +{% block main %} +
+

Transaction Sender

+ +
+

This tool sends transactions to the XRP Test Net address of your choice so you can test how you monitor and respond to incoming transactions.

+ +
+
+ + + Send transactions to this XRP Test Net address +
+ +

Send Transaction

+ +
+
+ +
+ + drops of XRP +
+
+ Send a simple XRP-to-XRP payment. +
+ +
+ +
+
+ +
+ Delivers a small amount of XRP with a large Amount value, to test your handling of partial payments. +
+ +
+ +
+
+ +
+ for + + seconds + + ( + + ) + +
+
+ Create a time-based escrow of 1 XRP. +
+ +
+ +
+
+ +
+ funded with + + drops of XRP +
+
+ Create a payment channel. +
+ +
+ +
+
+ +
+ + FOO +
+
+ Your destination address should trust (sending address) for the currency in question. +
+ +
+ +
+
+ +
+ + FOO +
+
+ The test sender creates a trust line to your account for the given currency. +
+ +
+
+
+{% endblock %} + +{% block endbody %} + + + +{% endblock %}