More ledger_entry and ws tool updates

This commit is contained in:
mDuo13
2021-01-25 17:08:22 -08:00
parent 314523974a
commit c20715bfff
3 changed files with 241 additions and 138 deletions

View File

@@ -1,3 +1,5 @@
DEFAULT_ADDRESS_1 = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
Request("Account Methods")
Request('account_channels', {
@@ -6,8 +8,8 @@ Request('account_channels', {
body: {
"id": 1,
"command": "account_channels",
"account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH",
"destination_account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"account": "rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH", //TODO: different address
"destination_account": DEFAULT_ADDRESS_1,
"ledger_index": "validated"
}
})
@@ -17,7 +19,7 @@ Request('account_currencies', {
link: "account_currencies.html",
body: {
"command": "account_currencies",
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"account": DEFAULT_ADDRESS_1,
"strict": true,
"ledger_index": "validated"
}
@@ -29,7 +31,7 @@ Request('account_info', {
body: {
"id": 2,
"command": "account_info",
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"account": DEFAULT_ADDRESS_1,
"strict": true,
"ledger_index": "current",
"queue": true
@@ -42,7 +44,7 @@ Request('account_lines', {
body: {
"id": 2,
"command": "account_lines",
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"account": DEFAULT_ADDRESS_1,
"ledger_index": "validated"
}
})
@@ -53,7 +55,7 @@ Request('account_objects', {
body: {
"id": 1,
"command": "account_objects",
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"account": DEFAULT_ADDRESS_1,
"ledger_index": "validated",
"type": "state",
"limit": 10
@@ -66,7 +68,7 @@ Request('account_offers', {
body: {
"id": 2,
"command": "account_offers",
"account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM"
"account": DEFAULT_ADDRESS_1
}
})
@@ -76,7 +78,7 @@ Request('account_tx', {
body: {
"id": 2,
"command": "account_tx",
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"account": DEFAULT_ADDRESS_1,
"ledger_index_min": -1,
"ledger_index_max": -1,
"binary": false,
@@ -91,9 +93,12 @@ Request('gateway_balances', {
body: {
"id": "example_gateway_balances_1",
"command": "gateway_balances",
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q", // btc2ripple
"strict": true,
"hotwallet": ["rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ","ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt"],
"hotwallet": [
"rKm4uWpg9tfwbVSeATv4KxDe6mpE9yPkgJ",
"ra7JkEzrgeKHdzKgo4EUUVBnxggY4z37kt"
],
"ledger_index": "validated"
}
})
@@ -104,7 +109,7 @@ Request('noripple_check', {
body: {
"id": 0,
"command": "noripple_check",
"account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"account": DEFAULT_ADDRESS_1,
"role": "gateway",
"ledger_index": "current",
"limit": 2,
@@ -159,22 +164,133 @@ Request('ledger_data', {
}
})
Request('ledger_entry', {
description: "Returns a single ledger object in its raw format.",
link: "ledger_entry.html",
Request('ledger_entry - by object ID', {
description: "Returns an object by its unique ID.",
link: "ledger_entry.html#TODO",
body: {
"id": 3,
"command": "ledger_entry",
"type": "account_root",
"account_root": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"index": "7DB0788C020F02780A673DC74757F23823FA3014C1866E72CC4CD8B226CD6EF4",
"ledger_index": "validated"
}
})
Request('ledger_entry - AccountRoot', {
description: "Returns a single account in its raw ledger format.",
link: "ledger_entry.html#TODO",
body: {
"id": 3,
"command": "ledger_entry",
"account_root": DEFAULT_ADDRESS_1,
"ledger_index": "validated"
}
})
Request('ledger_entry - DirectoryNode', {
description: "Returns a directory object in its raw ledger format.",
link: "ledger_entry.html#get-directorynode-object",
body: {
"id": 3,
"command": "ledger_entry",
"directory": {
"owner": DEFAULT_ADDRESS_1,
"sub_index": 1
},
"ledger_index": "validated"
}
})
Request('ledger_entry - Offer', {
description: "Returns an Offer object in its raw ledger format.",
link: "ledger_entry.html#get-offer-object",
body: {
"id": 3,
"command": "ledger_entry",
"offer": {
"account": DEFAULT_ADDRESS_1,
"seq": 359
},
"ledger_index": "validated"
}
})
Request('ledger_entry - RippleState', {
description: "Returns a RippleState object in its raw ledger format.",
link: "ledger_entry.html#get-ripplestate-object",
body: {
"id": 3,
"command": "ledger_entry",
"ripple_state": {
"accounts": [
DEFAULT_ADDRESS_1,
"rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW"
],
"currency": "USD"
},
"ledger_index": "validated"
}
})
Request('ledger_entry - Check', {
description: "Returns a Check object in its raw ledger format.",
link: "ledger_entry.html#get-check-object",
body: {
"id": 3,
"command": "ledger_entry",
"check": "838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334",
"ledger_index": "validated"
}
})
Request('ledger_entry - Escrow', {
description: "Returns an Escrow object in its raw ledger format.",
link: "ledger_entry.html#get-escrow-object",
body: {
"id": 3,
"command": "ledger_entry",
"escrow": ""//todo: make an escrow
"ledger_index": "validated"
}
})
Request('ledger_entry - PayChannel', {
description: "Returns a PayChannel object in its raw ledger format.",
link: "ledger_entry.html#get-paychannel-object",
body: {
"id": 3,
"command": "ledger_entry",
"channel": ""//todo: make a paychannel
"ledger_index": "validated"
}
})
Request('ledger_entry - DepositPreauth', {
description: "Returns a DepositPreauth object in its raw ledger format.",
link: "ledger_entry.html#get-depositpreauth-object",
body: {
"id": 3,
"command": "ledger_entry",
"deposit_preauth": ""//todo: find a real example
"ledger_index": "validated"
}
})
// Waiting for TicketBatch amendment
// Request('ledger_entry - Ticket', {
// description: "Returns a Ticket object in its raw ledger format.",
// link: "ledger_entry.html#get-ticket-object",
// body: {
// "id": 3,
// "command": "ledger_entry",
// "ticket": ""//TODO
// "ledger_index": "validated"
// }
// })
Request("Transaction Methods")
// Future feature: special case sign/sign_for so you can use those if you're
// connected to a local server (with big warning)
// Signing methods are not provided here because it's a terrible idea to send
// your secret to another server over the internet.
Request('submit', {
description: "Submits a transaction to the network to be confirmed and included in future ledgers.",
@@ -244,16 +360,6 @@ Request('tx', {
}
})
Request('tx_history', {
description: "Retrieves some of the most recent transactions made. (DEPRECATED)",
link: "tx_history.html",
body: {
"id": 5,
"command": "tx_history",
"start": 0
}
})
Request("Path and Order Book Methods")
Request('book_offers', {
@@ -262,7 +368,7 @@ Request('book_offers', {
body: {
"id": 4,
"command": "book_offers",
"taker": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"taker": DEFAULT_ADDRESS_1,
"taker_gets": {
"currency": "XRP"
},
@@ -294,8 +400,8 @@ Request('path_find', {
"id": 8,
"command": "path_find",
"subcommand": "create",
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"source_account": DEFAULT_ADDRESS_1,
"destination_account": DEFAULT_ADDRESS_1,
"destination_amount": {
"value": "0.001",
"currency": "USD",
@@ -310,7 +416,7 @@ Request('ripple_path_find', {
body: {
"id": 8,
"command": "ripple_path_find",
"source_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"source_account": DEFAULT_ADDRESS_1,
"source_currencies": [
{
"currency": "XRP"
@@ -319,7 +425,7 @@ Request('ripple_path_find', {
"currency": "USD"
}
],
"destination_account": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"destination_account": DEFAULT_ADDRESS_1,
"destination_amount": {
"value": "0.001",
"currency": "USD",

View File

@@ -86,12 +86,13 @@ function select_request(request) {
} else {
el = commandlist.find("li a[href='#"+request+"']").parent()
}
$(el).siblings().removeClass('active');
$(el).addClass('active');
$(el).siblings().removeClass('active')
$(el).addClass('active')
const command = requests[request];
if (command === undefined) {
console.log("request:", request, "requests:", requests)
console.warning("Unknown request identifier from # anchor.")
return false
}
if (command.description) {
@@ -121,6 +122,7 @@ function select_request(request) {
cm_request.setValue("")
}
cm_request.refresh()
return true
};
function send_request() {
@@ -329,7 +331,11 @@ $(document).ready(function() {
if (window.location.hash) {
var cmd = window.location.hash.slice(1).toLowerCase();
select_request(cmd);
if (!select_request(cmd)) {
// Didn't find a definition for the request from the hash. Use the
// default instead.
select_request()
}
} else if (search_params.has("server") || search_params.has("req")) {
load_from_permalink(search_params)
} else {