mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-22 20:55:50 +00:00
[FEATURE] API tools: use real links for commandlist; generate REST commandlist automatically
This commit is contained in:
@@ -49,7 +49,7 @@ h2 {
|
|||||||
margin:0;
|
margin:0;
|
||||||
height:100%;
|
height:100%;
|
||||||
}
|
}
|
||||||
#command_list li {
|
/*#command_list li {
|
||||||
padding:4px 12px;
|
padding:4px 12px;
|
||||||
display:block;
|
display:block;
|
||||||
width:200px;
|
width:200px;
|
||||||
@@ -61,13 +61,32 @@ h2 {
|
|||||||
-moz-user-select:none;
|
-moz-user-select:none;
|
||||||
color:#0088CC;
|
color:#0088CC;
|
||||||
}
|
}
|
||||||
#command_list li:hover {
|
|
||||||
color:#444;
|
|
||||||
}
|
|
||||||
#command_list li.selected {
|
#command_list li.selected {
|
||||||
color:#444;
|
color:#444;
|
||||||
background:#f0f0f0;
|
background:#f0f0f0;
|
||||||
|
cursor: auto;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
#command_list li {
|
||||||
|
width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#command_list li.selected a {
|
||||||
|
cursor: default;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #444;
|
||||||
|
background: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#command_list li.separator {
|
||||||
|
color: #474648;
|
||||||
|
font-family: "Open Sans",sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#command_table {
|
#command_table {
|
||||||
height:100%;
|
height:100%;
|
||||||
}
|
}
|
||||||
@@ -454,3 +473,4 @@ span.cm-atom {
|
|||||||
#rest_url div input {
|
#rest_url div input {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
307
js/apitool-methods-ripplerest.js
Normal file
307
js/apitool-methods-ripplerest.js
Normal file
@@ -0,0 +1,307 @@
|
|||||||
|
//---------- List of requests ------------------------//
|
||||||
|
// Must be loaded after apitool-rest.js //
|
||||||
|
|
||||||
|
var DEFAULT_ADDRESS_1 = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn";
|
||||||
|
var DEFAULT_ADDRESS_2 = "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX";
|
||||||
|
var DEFAULT_ADDRESS_3 = "rJnZ4YHCUsHvQu7R6mZohevKJDHFzVD6Zr";
|
||||||
|
var DEFAULT_HASH = "9D591B18EDDD34F0B6CF4223A2940AEA2C3CC778925BABF289E0011CD8FA056E";
|
||||||
|
var DEFAULT_SECRET = "sn3nxiW7v8KXzPzAqzyHXbSSKNuN9";
|
||||||
|
|
||||||
|
Request('ACCOUNTS');
|
||||||
|
|
||||||
|
Request('Generate Wallet', {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/wallet/new",
|
||||||
|
description: 'Randomly generate keys for a potential new Ripple account.',
|
||||||
|
link: '#generate-wallet'
|
||||||
|
});
|
||||||
|
|
||||||
|
Request('Get Account Balances', {
|
||||||
|
method: GET,
|
||||||
|
path: '/v1/accounts/{:address}/balances?{:query_params}',
|
||||||
|
description: 'Retrieve the current balances for the given Ripple account.',
|
||||||
|
link: '#get-account-balances',
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:query_params}": "currency=USD"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request('Get Account Settings', {
|
||||||
|
method: GET,
|
||||||
|
path: '/v1/accounts/{:address}/settings',
|
||||||
|
description: 'Retrieve the current settings for the given Ripple account.',
|
||||||
|
link: '#get-account-settings',
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request('Update Account Settings', {
|
||||||
|
method: POST,
|
||||||
|
path: '/v1/accounts/{:address}/settings?{:query_params}',
|
||||||
|
description: 'Change the current settings for the given Ripple account.',
|
||||||
|
link: '#update-account-settings',
|
||||||
|
test_only: true,
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:query_params}": "validated=true"
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
secret: DEFAULT_SECRET,
|
||||||
|
settings: {
|
||||||
|
require_destination_tag: false,
|
||||||
|
require_authorization: false,
|
||||||
|
disallow_xrp: false,
|
||||||
|
disable_master: false,
|
||||||
|
email_hash: "98b4375e1d753e5b91627516f6d70977"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("PAYMENTS");
|
||||||
|
|
||||||
|
Request('Prepare Payment', {
|
||||||
|
method: GET,
|
||||||
|
path: '/v1/accounts/{:source_address}/payments/paths/{:destination_address}/{:amount}?{:query_params}',
|
||||||
|
description: 'Retrieve possible payment objects for a desired payment.',
|
||||||
|
link: '#prepare-payment',
|
||||||
|
params: {
|
||||||
|
"{:source_address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:destination_address}": DEFAULT_ADDRESS_2,
|
||||||
|
"{:amount}": "1+USD+rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"{:query_params}": "source_currencies=USD"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request('Submit Payment', {
|
||||||
|
method: POST,
|
||||||
|
path: '/v1/accounts/{:source_address}/payments?{:query_params}',
|
||||||
|
description: 'Send a prepared payment to the network.',
|
||||||
|
link: '#submit-payment',
|
||||||
|
test_only: true,
|
||||||
|
body: {
|
||||||
|
"secret": DEFAULT_SECRET,
|
||||||
|
"client_resource_id": "348170b9-16b9-4927-854d-7f9d4a2a692d",
|
||||||
|
"payment": {
|
||||||
|
"source_account": DEFAULT_ADDRESS_1,
|
||||||
|
"source_tag": "",
|
||||||
|
"source_amount": {
|
||||||
|
"value": "1",
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": ""
|
||||||
|
},
|
||||||
|
"source_slippage": "0",
|
||||||
|
"destination_account": DEFAULT_ADDRESS_2,
|
||||||
|
"destination_tag": "",
|
||||||
|
"destination_amount": {
|
||||||
|
"value": "1",
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": DEFAULT_ADDRESS_1
|
||||||
|
},
|
||||||
|
"invoice_id": "",
|
||||||
|
"paths": "[]",
|
||||||
|
"partial_payment": false,
|
||||||
|
"no_direct_ripple": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
"{:source_address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:query_params}": "validated=true"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Confirm Payment", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/accounts/{:address}/payments/{:id}",
|
||||||
|
description: "Retrieve details of a payment and its status.",
|
||||||
|
link: "#confirm-payment",
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:id}": DEFAULT_HASH
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Get Payment History", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/accounts/{:address}/payments?{:query_params}",
|
||||||
|
description: "Browse through the history of payments sent and received by an account.",
|
||||||
|
link: "#get-payment-history",
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:query_params}": "direction=incoming&exclude_failed=true"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("ORDERS");
|
||||||
|
|
||||||
|
Request("Place Order", {
|
||||||
|
method: POST,
|
||||||
|
path: "/v1/accounts/{:address}/orders?{:query_params}",
|
||||||
|
description: "Place an order on the ripple network.",
|
||||||
|
link: "#place-order",
|
||||||
|
test_only: true,
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:query_params}": "validated=true"
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
"secret": DEFAULT_SECRET,
|
||||||
|
"order": {
|
||||||
|
"type": "sell",
|
||||||
|
"taker_pays": {
|
||||||
|
"currency": "JPY",
|
||||||
|
"value": "4000",
|
||||||
|
"counterparty": "rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6"
|
||||||
|
},
|
||||||
|
"taker_gets": {
|
||||||
|
"currency": "USD",
|
||||||
|
"value": ".25",
|
||||||
|
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
|
||||||
|
},
|
||||||
|
"immediate_or_cancel": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Cancel Order", {
|
||||||
|
method: DELETE,
|
||||||
|
path: "/v1/accounts/{:address}/orders/{:order}/?{:query_params}",
|
||||||
|
description: "Cancel an order on the ripple network.",
|
||||||
|
link: "#cancel-order",
|
||||||
|
test_only: true,
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:query_params}": "validated=true",
|
||||||
|
"{:order}": "23"
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
"secret": DEFAULT_SECRET
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Get Account Orders", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/accounts/{:address}/orders?{:query_params}",
|
||||||
|
description: "Get open currency-exchange orders associated with the Ripple address.",
|
||||||
|
link: "#get-account-orders",
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_3,
|
||||||
|
"{:query_params}": "ledger=10399192&limit=15"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Get Order Transaction", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/accounts/{:address}/orders/{:hash}",
|
||||||
|
description: "Get the details of an order transaction.",
|
||||||
|
link: "#get-order-transaction",
|
||||||
|
params: {
|
||||||
|
"{:address}": "rEQWVz1qN4DWw5J17s3DgXQzUuVYDSpK6M",
|
||||||
|
"{:hash}": "D53A3B99AC0C3CAF35D72178390ACA94CD42479A98CEA438EEAFF338E5FEB76D"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Get Order Book", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/accounts/{:address}/order_book/{:base}/{:counter}?{:query_params}",
|
||||||
|
description: "Get the order book for a currency pair",
|
||||||
|
link: "#get-order-book",
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_3,
|
||||||
|
"{:base}": "BTC+rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"{:counter}": "USD+rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||||
|
"{:query_params}": "limit=10"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("TRUST LINES");
|
||||||
|
|
||||||
|
Request("Get Trustlines", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/accounts/{:address}/trustlines?{:query_params}",
|
||||||
|
description: "Check the status of one or more trustlines attached to an account.",
|
||||||
|
link: "#get-trustlines",
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:query_params}": "currency=USD&counterparty=ra5nK24KXen9AHvsdFTKHSANinZseWnPcX"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Grant Trustline", {
|
||||||
|
method: POST,
|
||||||
|
path: "/v1/accounts/{:address}/trustlines?{:query_params}",
|
||||||
|
description: "Add or modify a trustline from this account.",
|
||||||
|
link: "#grant-trustline",
|
||||||
|
test_only: true,
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:query_params}": "validated=true"
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
"secret": DEFAULT_SECRET,
|
||||||
|
"trustline": {
|
||||||
|
"limit": "110",
|
||||||
|
"currency": "USD",
|
||||||
|
"counterparty": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||||
|
"allows_rippling": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("NOTIFICATIONS");
|
||||||
|
|
||||||
|
Request("Check Notifications", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/accounts/{:address}/notifications/{:id}",
|
||||||
|
description: "Monitor an account for all kinds of transactions.",
|
||||||
|
link: "#check-notifications",
|
||||||
|
params: {
|
||||||
|
"{:address}": DEFAULT_ADDRESS_1,
|
||||||
|
"{:id}": DEFAULT_HASH
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("RIPPLED SERVER STATUS");
|
||||||
|
|
||||||
|
Request("Check Connection", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/server/connected",
|
||||||
|
description: "Check whether the REST server is connected to a rippled server.",
|
||||||
|
link: "#check-connection"
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Get Server Status", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/server",
|
||||||
|
description: "Retrieve information about the current status of the Ripple-REST server and the rippled server it is connected to.",
|
||||||
|
link: "#get-server-status"
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("UTILITIES");
|
||||||
|
|
||||||
|
Request("Retrieve Ripple Transaction", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/transactions/{:id}",
|
||||||
|
description: "Retrieve a raw Ripple transaction",
|
||||||
|
link: "#retrieve-ripple-transaction",
|
||||||
|
params: {
|
||||||
|
"{:id}": DEFAULT_HASH
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Retrieve Transaction Fee", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/transaction-fee",
|
||||||
|
description: "Retrieve the current transaction fee for the connected rippled server(s).",
|
||||||
|
link: "#retrieve-transaction-fee",
|
||||||
|
});
|
||||||
|
|
||||||
|
Request("Generate UUID", {
|
||||||
|
method: GET,
|
||||||
|
path: "/v1/uuid",
|
||||||
|
description: "Create a universally-unique identifier (UUID) to use as the client resource ID for a payment.",
|
||||||
|
link: "#create-client-resource-id"
|
||||||
|
});
|
||||||
|
|
||||||
|
//---------- End req. List ---------------------------//
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
var commands = $("#command_list li");
|
var commandlist = $("#command_list");
|
||||||
var request_body = $("#request_body");
|
var request_body = $("#request_body");
|
||||||
var request_button = $("#request_button");
|
var request_button = $("#request_button");
|
||||||
var response_body = $("#response_body");
|
var response_body = $("#response_body");
|
||||||
@@ -39,14 +39,33 @@ function slugify(str) {
|
|||||||
|
|
||||||
//Build requests
|
//Build requests
|
||||||
var requests = { };
|
var requests = { };
|
||||||
|
var requestlist = [];
|
||||||
function Request(name, obj) {
|
function Request(name, obj) {
|
||||||
|
if (obj === undefined) {
|
||||||
|
requestlist.push({slug: null,name: name});//separator
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
obj.name = name;
|
obj.name = name;
|
||||||
requests[slugify(name)] = obj;
|
obj.slug = slugify(name);
|
||||||
|
requests[obj.slug] = obj;
|
||||||
|
requestlist.push(obj);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
$(commands).click(function() {
|
function generate_table_of_contents() {
|
||||||
|
$.each(requestlist, function(i, req) {
|
||||||
|
if (req.slug === null) {
|
||||||
|
commandlist.append("<li class='separator'>"+req.name+"</li>");
|
||||||
|
} else {
|
||||||
|
commandlist.append("<li><a href='#"+req.slug+"'>"+req.name+"</a></li>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function make_commands_clickable() {
|
||||||
|
commandlist.children("li").click(function() {
|
||||||
var cmd = slugify($(this).text().trim());
|
var cmd = slugify($(this).text().trim());
|
||||||
|
|
||||||
if (!requests[cmd]) return;
|
if (!requests[cmd]) return;
|
||||||
@@ -56,301 +75,8 @@ $(commands).click(function() {
|
|||||||
|
|
||||||
$(this).siblings().removeClass('selected');
|
$(this).siblings().removeClass('selected');
|
||||||
$(this).addClass('selected');
|
$(this).addClass('selected');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//---------- List of requests ------------------------//
|
|
||||||
|
|
||||||
var DEFAULT_ADDRESS_1 = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn";
|
|
||||||
var DEFAULT_ADDRESS_2 = "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX";
|
|
||||||
var DEFAULT_ADDRESS_3 = "rJnZ4YHCUsHvQu7R6mZohevKJDHFzVD6Zr";
|
|
||||||
var DEFAULT_HASH = "9D591B18EDDD34F0B6CF4223A2940AEA2C3CC778925BABF289E0011CD8FA056E";
|
|
||||||
var DEFAULT_SECRET = "sn3nxiW7v8KXzPzAqzyHXbSSKNuN9";
|
|
||||||
|
|
||||||
Request('Generate Wallet', {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/wallet/new",
|
|
||||||
description: 'Randomly generate keys for a potential new Ripple account.',
|
|
||||||
link: '#generate-wallet'
|
|
||||||
});
|
|
||||||
|
|
||||||
Request('Get Account Balances', {
|
|
||||||
method: GET,
|
|
||||||
path: '/v1/accounts/{:address}/balances?{:query_params}',
|
|
||||||
description: 'Retrieve the current balances for the given Ripple account.',
|
|
||||||
link: '#get-account-balances',
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:query_params}": "currency=USD"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request('Get Account Settings', {
|
|
||||||
method: GET,
|
|
||||||
path: '/v1/accounts/{:address}/settings',
|
|
||||||
description: 'Retrieve the current settings for the given Ripple account.',
|
|
||||||
link: '#get-account-settings',
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request('Update Account Settings', {
|
|
||||||
method: POST,
|
|
||||||
path: '/v1/accounts/{:address}/settings?{:query_params}',
|
|
||||||
description: 'Change the current settings for the given Ripple account.',
|
|
||||||
link: '#update-account-settings',
|
|
||||||
test_only: true,
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:query_params}": "validated=true"
|
|
||||||
},
|
|
||||||
body: {
|
|
||||||
secret: DEFAULT_SECRET,
|
|
||||||
settings: {
|
|
||||||
require_destination_tag: false,
|
|
||||||
require_authorization: false,
|
|
||||||
disallow_xrp: false,
|
|
||||||
disable_master: false,
|
|
||||||
email_hash: "98b4375e1d753e5b91627516f6d70977"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request('Prepare Payment', {
|
|
||||||
method: GET,
|
|
||||||
path: '/v1/accounts/{:source_address}/payments/paths/{:destination_address}/{:amount}?{:query_params}',
|
|
||||||
description: 'Retrieve possible payment objects for a desired payment.',
|
|
||||||
link: '#prepare-payment',
|
|
||||||
params: {
|
|
||||||
"{:source_address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:destination_address}": DEFAULT_ADDRESS_2,
|
|
||||||
"{:amount}": "1+USD+rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
|
||||||
"{:query_params}": "source_currencies=USD"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request('Submit Payment', {
|
|
||||||
method: POST,
|
|
||||||
path: '/v1/accounts/{:source_address}/payments?{:query_params}',
|
|
||||||
description: 'Send a prepared payment to the network.',
|
|
||||||
link: '#submit-payment',
|
|
||||||
test_only: true,
|
|
||||||
body: {
|
|
||||||
"secret": DEFAULT_SECRET,
|
|
||||||
"client_resource_id": "348170b9-16b9-4927-854d-7f9d4a2a692d",
|
|
||||||
"payment": {
|
|
||||||
"source_account": DEFAULT_ADDRESS_1,
|
|
||||||
"source_tag": "",
|
|
||||||
"source_amount": {
|
|
||||||
"value": "1",
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": ""
|
|
||||||
},
|
|
||||||
"source_slippage": "0",
|
|
||||||
"destination_account": DEFAULT_ADDRESS_2,
|
|
||||||
"destination_tag": "",
|
|
||||||
"destination_amount": {
|
|
||||||
"value": "1",
|
|
||||||
"currency": "USD",
|
|
||||||
"issuer": DEFAULT_ADDRESS_1
|
|
||||||
},
|
|
||||||
"invoice_id": "",
|
|
||||||
"paths": "[]",
|
|
||||||
"partial_payment": false,
|
|
||||||
"no_direct_ripple": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
params: {
|
|
||||||
"{:source_address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:query_params}": "validated=true"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Confirm Payment", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/accounts/{:address}/payments/{:id}",
|
|
||||||
description: "Retrieve details of a payment and its status.",
|
|
||||||
link: "#confirm-payment",
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:id}": DEFAULT_HASH
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Get Payment History", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/accounts/{:address}/payments?{:query_params}",
|
|
||||||
description: "Browse through the history of payments sent and received by an account.",
|
|
||||||
link: "#get-payment-history",
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:query_params}": "direction=incoming&exclude_failed=true"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Place Order", {
|
|
||||||
method: POST,
|
|
||||||
path: "/v1/accounts/{:address}/orders?{:query_params}",
|
|
||||||
description: "Place an order on the ripple network.",
|
|
||||||
link: "#place-order",
|
|
||||||
test_only: true,
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:query_params}": "validated=true"
|
|
||||||
},
|
|
||||||
body: {
|
|
||||||
"secret": DEFAULT_SECRET,
|
|
||||||
"order": {
|
|
||||||
"type": "sell",
|
|
||||||
"taker_pays": {
|
|
||||||
"currency": "JPY",
|
|
||||||
"value": "4000",
|
|
||||||
"counterparty": "rMAz5ZnK73nyNUL4foAvaxdreczCkG3vA6"
|
|
||||||
},
|
|
||||||
"taker_gets": {
|
|
||||||
"currency": "USD",
|
|
||||||
"value": ".25",
|
|
||||||
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
|
|
||||||
},
|
|
||||||
"immediate_or_cancel": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Cancel Order", {
|
|
||||||
method: DELETE,
|
|
||||||
path: "/v1/accounts/{:address}/orders/{:order}/?{:query_params}",
|
|
||||||
description: "Cancel an order on the ripple network.",
|
|
||||||
link: "#cancel-order",
|
|
||||||
test_only: true,
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:query_params}": "validated=true",
|
|
||||||
"{:order}": "23"
|
|
||||||
},
|
|
||||||
body: {
|
|
||||||
"secret": DEFAULT_SECRET
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Get Account Orders", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/accounts/{:address}/orders?{:query_params}",
|
|
||||||
description: "Get open currency-exchange orders associated with the Ripple address.",
|
|
||||||
link: "#get-account-orders",
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_3,
|
|
||||||
"{:query_params}": "ledger=10399192&limit=15"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Get Order Transaction", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/accounts/{:address}/orders/{:hash}",
|
|
||||||
description: "Get the details of an order transaction.",
|
|
||||||
link: "#get-order-transaction",
|
|
||||||
params: {
|
|
||||||
"{:address}": "rEQWVz1qN4DWw5J17s3DgXQzUuVYDSpK6M",
|
|
||||||
"{:hash}": "D53A3B99AC0C3CAF35D72178390ACA94CD42479A98CEA438EEAFF338E5FEB76D"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Get Order Book", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/accounts/{:address}/order_book/{:base}/{:counter}?{:query_params}",
|
|
||||||
description: "Get the order book for a currency pair",
|
|
||||||
link: "#get-order-book",
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_3,
|
|
||||||
"{:base}": "BTC+rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"{:counter}": "USD+rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
|
||||||
"{:query_params}": "limit=10"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Get Trustlines", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/accounts/{:address}/trustlines?{:query_params}",
|
|
||||||
description: "Check the status of one or more trustlines attached to an account.",
|
|
||||||
link: "#get-trustlines",
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:query_params}": "currency=USD&counterparty=ra5nK24KXen9AHvsdFTKHSANinZseWnPcX"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Grant Trustline", {
|
|
||||||
method: POST,
|
|
||||||
path: "/v1/accounts/{:address}/trustlines?{:query_params}",
|
|
||||||
description: "Add or modify a trustline from this account.",
|
|
||||||
link: "#grant-trustline",
|
|
||||||
test_only: true,
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:query_params}": "validated=true"
|
|
||||||
},
|
|
||||||
body: {
|
|
||||||
"secret": DEFAULT_SECRET,
|
|
||||||
"trustline": {
|
|
||||||
"limit": "110",
|
|
||||||
"currency": "USD",
|
|
||||||
"counterparty": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
|
||||||
"allows_rippling": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Check Notifications", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/accounts/{:address}/notifications/{:id}",
|
|
||||||
description: "Monitor an account for all kinds of transactions.",
|
|
||||||
link: "#check-notifications",
|
|
||||||
params: {
|
|
||||||
"{:address}": DEFAULT_ADDRESS_1,
|
|
||||||
"{:id}": DEFAULT_HASH
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Check Connection", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/server/connected",
|
|
||||||
description: "Check whether the REST server is connected to a rippled server.",
|
|
||||||
link: "#check-connection"
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Get Server Status", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/server",
|
|
||||||
description: "Retrieve information about the current status of the Ripple-REST server and the rippled server it is connected to.",
|
|
||||||
link: "#get-server-status"
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Retrieve Ripple Transaction", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/transactions/{:id}",
|
|
||||||
description: "Retrieve a raw Ripple transaction",
|
|
||||||
link: "#retrieve-ripple-transaction",
|
|
||||||
params: {
|
|
||||||
"{:id}": DEFAULT_HASH
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Retrieve Transaction Fee", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/transaction-fee",
|
|
||||||
description: "Retrieve the current transaction fee for the connected rippled server(s).",
|
|
||||||
link: "#retrieve-transaction-fee",
|
|
||||||
});
|
|
||||||
|
|
||||||
Request("Generate UUID", {
|
|
||||||
method: GET,
|
|
||||||
path: "/v1/uuid",
|
|
||||||
description: "Create a universally-unique identifier (UUID) to use as the client resource ID for a payment.",
|
|
||||||
link: "#create-client-resource-id"
|
|
||||||
});
|
|
||||||
|
|
||||||
//---------- End req. List ---------------------------//
|
|
||||||
|
|
||||||
var cm_request = CodeMirror(request_body.get(0), {
|
var cm_request = CodeMirror(request_body.get(0), {
|
||||||
mode: 'javascript',
|
mode: 'javascript',
|
||||||
@@ -410,6 +136,19 @@ function change_path(command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select_request(request) {
|
function select_request(request) {
|
||||||
|
if (request === undefined) {
|
||||||
|
var el = commandlist.children("li:not(.separator)").eq(0);
|
||||||
|
request = slugify(el.text());
|
||||||
|
|
||||||
|
/* var keys = Object.keys(requests);
|
||||||
|
var index = keys.indexOf(cmd);
|
||||||
|
if (index === -1) return;*/
|
||||||
|
} else {
|
||||||
|
var el = commandlist.find("li a[href='#"+request+"']").parent();
|
||||||
|
}
|
||||||
|
$(el).siblings().removeClass('selected');
|
||||||
|
$(el).addClass('selected');
|
||||||
|
|
||||||
command = requests[request];
|
command = requests[request];
|
||||||
|
|
||||||
if (command.test_only === true) {
|
if (command.test_only === true) {
|
||||||
@@ -422,12 +161,14 @@ function select_request(request) {
|
|||||||
$(description).html(command.description);
|
$(description).html(command.description);
|
||||||
|
|
||||||
if (command.link) {
|
if (command.link) {
|
||||||
$(description).append(" <a class='link_underline' href='"+DOC_BASE+command.link+"'>Read more</a>");
|
$(description).append(" <a class='link_underline' href='" +
|
||||||
|
DOC_BASE+command.link+"'>Read more</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
$(description).show();
|
$(description).show();
|
||||||
} else if (command.link) {
|
} else if (command.link) {
|
||||||
$(description).html("<a class='link_underline' href='"+DOC_BASE+command.link+"'>Read more</a>");
|
$(description).html("<a class='link_underline' href='" + DOC_BASE+
|
||||||
|
command.link+"'>Read more</a>");
|
||||||
} else {
|
} else {
|
||||||
$(description).hide();
|
$(description).hide();
|
||||||
}
|
}
|
||||||
@@ -436,13 +177,8 @@ function select_request(request) {
|
|||||||
.attr('href', DOC_BASE+command.link)
|
.attr('href', DOC_BASE+command.link)
|
||||||
.text(command.name));
|
.text(command.name));
|
||||||
|
|
||||||
//rest_url.val(command.path);
|
|
||||||
//rest_url.text(command.path);
|
|
||||||
change_path(command);
|
change_path(command);
|
||||||
|
|
||||||
|
|
||||||
// rest_method.val(command.method);
|
|
||||||
// rest_method.change();
|
|
||||||
request_button.val(command.method);
|
request_button.val(command.method);
|
||||||
request_button.text(command.method+" request");
|
request_button.text(command.method+" request");
|
||||||
update_method(request_button);
|
update_method(request_button);
|
||||||
@@ -451,7 +187,6 @@ function select_request(request) {
|
|||||||
cm_request.setValue(JSON.stringify(command.body, null, 2));
|
cm_request.setValue(JSON.stringify(command.body, null, 2));
|
||||||
} else {
|
} else {
|
||||||
//No body, so wipe out the current contents.
|
//No body, so wipe out the current contents.
|
||||||
//This prevents confusion if the user toggles the HTTP method dropdown
|
|
||||||
cm_request.setValue("");
|
cm_request.setValue("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,6 +266,10 @@ function reset_response_area() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
//wait for the Requests to be populated by another file
|
||||||
|
generate_table_of_contents();
|
||||||
|
make_commands_clickable();
|
||||||
|
|
||||||
request_button.click(send_request);
|
request_button.click(send_request);
|
||||||
//rest_method.change(update_method);
|
//rest_method.change(update_method);
|
||||||
|
|
||||||
@@ -547,18 +286,8 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
var cmd = window.location.hash.slice(1).toLowerCase();
|
var cmd = window.location.hash.slice(1).toLowerCase();
|
||||||
var keys = Object.keys(requests);
|
|
||||||
var index = keys.indexOf(cmd);
|
|
||||||
|
|
||||||
if (index === -1) return;
|
|
||||||
|
|
||||||
var el = commands.eq(index);
|
|
||||||
|
|
||||||
select_request(cmd);
|
select_request(cmd);
|
||||||
|
|
||||||
$(el).siblings().removeClass('selected');
|
|
||||||
$(el).addClass('selected');
|
|
||||||
} else {
|
} else {
|
||||||
select_request('generate-wallet');
|
select_request();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -86,33 +86,6 @@
|
|||||||
<div style="clear:both;"></div>
|
<div style="clear:both;"></div>
|
||||||
<div id='command_wrapper'>
|
<div id='command_wrapper'>
|
||||||
<ul id='command_list'>
|
<ul id='command_list'>
|
||||||
<li class='selected'>Generate Wallet</li>
|
|
||||||
<li>Get Account Balances</li>
|
|
||||||
<li>Get Account Settings</li>
|
|
||||||
<li>Update Account Settings</li>
|
|
||||||
<br/>
|
|
||||||
<li>Prepare Payment</li>
|
|
||||||
<li>Submit Payment</li>
|
|
||||||
<li>Confirm Payment</li>
|
|
||||||
<li>Get Payment History</li>
|
|
||||||
<br/>
|
|
||||||
<li>Place Order</li>
|
|
||||||
<li>Cancel Order</li>
|
|
||||||
<li>Get Account Orders</li>
|
|
||||||
<li>Get Order Transaction</li>
|
|
||||||
<li>Get Order Book</li>
|
|
||||||
<br/>
|
|
||||||
<li>Get Trustlines</li>
|
|
||||||
<li>Grant Trustline</li>
|
|
||||||
<br/>
|
|
||||||
<li>Check Notifications</li>
|
|
||||||
<br/>
|
|
||||||
<li>Check Connection</li>
|
|
||||||
<li>Get Server Status</li>
|
|
||||||
<br/>
|
|
||||||
<li>Retrieve Ripple Transaction</li>
|
|
||||||
<li>Retrieve Transaction Fee</li>
|
|
||||||
<li>Generate UUID</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div id='command_table'>
|
<div id='command_table'>
|
||||||
<div id='io_wrapper'>
|
<div id='io_wrapper'>
|
||||||
@@ -209,5 +182,7 @@
|
|||||||
<script type='text/javascript' src='js/jquery.autosize.input.min.js'></script>
|
<script type='text/javascript' src='js/jquery.autosize.input.min.js'></script>
|
||||||
<script type='text/javascript' src='js/apitool-rest.js'></script>
|
<script type='text/javascript' src='js/apitool-rest.js'></script>
|
||||||
|
|
||||||
|
<script type='text/javascript' src='js/apitool-methods-ripplerest.js'></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -86,33 +86,33 @@
|
|||||||
<div style="clear:both;"></div>
|
<div style="clear:both;"></div>
|
||||||
<div id='command_wrapper'>
|
<div id='command_wrapper'>
|
||||||
<ul id='command_list'>
|
<ul id='command_list'>
|
||||||
<li class='selected'>server_info</li>
|
<li class='selected'><a href='#server_info'>server_info</a></li>
|
||||||
<li>server_state</li>
|
<li><a href='#server_state'>server_state</a></li>
|
||||||
<li>ping</li>
|
<li><a href='#ping'>ping</a></li>
|
||||||
<br/>
|
<br/>
|
||||||
<li>subscribe</li>
|
<li><a href='#subscribe'>subscribe</a></li>
|
||||||
<li>unsubscribe</li>
|
<li><a href='#unsubscribe'>unsubscribe</a></li>
|
||||||
<br/>
|
<br/>
|
||||||
<li>ledger</li>
|
<li><a href='#ledger'>ledger</a></li>
|
||||||
<li>ledger_closed</li>
|
<li><a href='#ledger_closed'>ledger_closed</a></li>
|
||||||
<li>ledger_current</li>
|
<li><a href='#ledger_current'>ledger_current</a></li>
|
||||||
<li>ledger_entry</li>
|
<li><a href='#ledger_entry'>ledger_entry</a></li>
|
||||||
<br/>
|
<br/>
|
||||||
<li>account_info</li>
|
<li><a href='#account_info'>account_info</a></li>
|
||||||
<li>account_lines</li>
|
<li><a href='#account_lines'>account_lines</a></li>
|
||||||
<li>account_offers</li>
|
<li><a href='#account_offers'>account_offers</a></li>
|
||||||
<li>account_tx</li>
|
<li><a href='#account_tx'>account_tx</a></li>
|
||||||
<br/>
|
<br/>
|
||||||
<li>transaction_entry</li>
|
<li><a href='#transaction_entry'>transaction_entry</a></li>
|
||||||
<li>tx</li>
|
<li><a href='#tx'>tx</a></li>
|
||||||
<li>tx_history</li>
|
<li><a href='#tx_history'>tx_history</a></li>
|
||||||
<br/>
|
<br/>
|
||||||
<li>sign</li>
|
<li><a href='#sign'>sign</a></li>
|
||||||
<li>submit</li>
|
<li><a href='#submit'>submit</a></li>
|
||||||
<br/>
|
<br/>
|
||||||
<li>ripple_path_find</li>
|
<li><a href='#ripple_path_find'>ripple_path_find</a></li>
|
||||||
<li>path_find</li>
|
<li><a href='#path_find'>path_find</a></li>
|
||||||
<li>book_offers</li>
|
<li><a href='#book_offers'>book_offers</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id='command_table'>
|
<div id='command_table'>
|
||||||
<div id='io_wrapper'>
|
<div id='io_wrapper'>
|
||||||
|
|||||||
Reference in New Issue
Block a user