WebSocket Tool: NFT methods & related support

- Add example syntax for the 3 NFT methods.
- Add the ability to specify the network without the rest of a
  permalink. NFT method "try it!" links can use this to have the tool
  use the NFT-Devnet by default.
- Add the ability to mark methods as not enabled on the production
  network.
This commit is contained in:
mDuo13
2022-03-28 15:36:31 -07:00
parent b3bfde46ef
commit 78343b2c31
2 changed files with 50 additions and 5 deletions

View File

@@ -51,7 +51,11 @@ function generate_table_of_contents() {
if (req.slug === null) {
commandlist.append("<li class='separator'>"+req.name+"</li>");
} else {
commandlist.append("<li class='method'><a href='#"+req.slug+"'>"+req.name+"</a></li>");
let status_label = ""
if (req.status == "not_enabled") {
status_label = '<span class="status not_enabled" title="This feature is not currently enabled on the production XRP Ledger."><i class="fa fa-flask"></i></span> '
}
commandlist.append("<li class='method'><a href='#"+req.slug+"'>"+status_label+req.name+"</a></li>");
}
});
}
@@ -284,7 +288,7 @@ const update_curl = function(event) {
$("#curl-box-1").text(curl_syntax)
}
function load_from_permalink(params) {
function server_from_params(params) {
const server = params.get("server")
if (server) {
const server_checkbox = $("input[value='"+server+"']")
@@ -293,7 +297,9 @@ function load_from_permalink(params) {
// relies on connect_socket() being run shortly thereafter
}
}
}
function req_from_params(params) {
let req_body = params.get("req")
let cmd_name = ""
if (req_body) {
@@ -336,10 +342,14 @@ $(document).ready(function() {
// default instead.
select_request()
}
} else if (search_params.has("server") || search_params.has("req")) {
load_from_permalink(search_params)
} else if (search_params.has("req")) {
req_from_params(search_params)
} else {
select_request();
select_request()
}
if (search_params.has("server")) {
server_from_params(search_params)
}
connect_socket()