Prettified

This commit is contained in:
mbhandary
2020-04-03 18:35:34 -04:00
parent 0f7bab354f
commit bca8cb9d4b

View File

@@ -24,7 +24,7 @@ function makeLogEntry(text, raw) {
.text(text + " ")
.appendTo("#log");
}
log.resolve = function(text) {
log.resolve = function (text) {
return $("<span></span>")
.html(text)
.appendTo(log);
@@ -100,8 +100,8 @@ async function parse_xrpl_toml(data, public_key_hex, public_key, message) {
function display_manifest(man) {
for (x in man){
log = makeLogEntry(x + ": " +man[x]);
for (x in man) {
log = makeLogEntry(x + ": " + man[x]);
}
}
@@ -122,11 +122,7 @@ function parse_manifest() {
return;
}
let seq = man ["Sequence"];
let seq = man["Sequence"];
let public_key_hex = man["PublicKey"];
let buff_pub = new Buffer(public_key_hex, "hex").toJSON().data;
@@ -136,25 +132,26 @@ function parse_manifest() {
let buff_eph_pub = new Buffer(ephemeral_public_key_hex, "hex").toJSON().data;
let ephemeral_public_key = addressCodec.encodeNodePublic(buff_eph_pub);
try {
var domain = hex_to_ascii(man["Domain"]);
} catch {
makeLogEntry("Domain not found in manifest").addClass(CLASS_BAD);
display_manifest({"Sequence":seq,
display_manifest({
"Sequence": seq,
"Master Public Key": public_key,
"Ephemeral Public Key":ephemeral_public_key});
"Ephemeral Public Key": ephemeral_public_key
});
return;
}
display_manifest({"Sequence":seq,
"Domain":domain,
display_manifest({
"Sequence": seq,
"Domain": domain,
"Master Public Key": public_key,
"Ephemeral Public Key":ephemeral_public_key})
"Ephemeral Public Key": ephemeral_public_key
})
@@ -167,11 +164,11 @@ function parse_manifest() {
$.ajax({
url: url,
dataType: "text",
success: function(data) {
success: function (data) {
log.resolve("FOUND").addClass(CLASS_GOOD);
parse_xrpl_toml(data, public_key_hex, public_key, message);
},
error: function(jqxhr, status, error) {
error: function (jqxhr, status, error) {
switch (status) {
case "timeout":
err = "TIMEOUT";
@@ -229,4 +226,3 @@ function handle_submit(event) {
$(document).ready(() => {
$("#manifest-entry").submit(handle_submit);
});