Clean up code comments.

This commit is contained in:
Oliver Eggert
2022-11-23 12:09:09 -08:00
parent bc752f213d
commit ed2047c8ab
3 changed files with 12 additions and 10 deletions

View File

@@ -2,22 +2,22 @@ const xrpl = require("xrpl")
async function main() {
// Create client and connect to network.
// Create a client and connect to the network.
const client = new xrpl.Client("wss://xrplcluster.com/")
await client.connect()
// Query ledger data.
// Specify a ledger to query for info.
let ledger = await client.request({
"command": "ledger_data",
"ledger_index": 500000,
})
// Create function to loop through API calls.
// Create a function to run on each API call.
function code(){
console.log(ledger["result"])
}
// Run code at least once before checking for markers.
// Execute function at least once before checking for markers.
do {
code()
@@ -25,6 +25,7 @@ async function main() {
break
}
// Specify the same ledger and add the marker to continue querying.
const ledger_marker = await client.request({
"command": "ledger_data",
"ledger_index": 500000,
@@ -34,6 +35,7 @@ async function main() {
} while (true)
// Disconnect when done. If you omit this, Node.js won't end the process.
client.disconnect()
}

View File

@@ -1,23 +1,23 @@
from xrpl.clients import JsonRpcClient
from xrpl.models.requests import LedgerData
# Create a client to connect to the main network.
# Create a client to connect to the network.
client = JsonRpcClient("https://xrplcluster.com/")
# Specify ledger to query and request data.
# Specify a ledger to query for info.
ledger = LedgerData(ledger_index=500000)
ledger_data = client.request(ledger).result
# Code to run on each call.
# Create a function to run on each API call.
def code():
print(ledger_data)
#Execute code at least once before checking for markers.
# Execute function at least once before checking for markers.
while True:
code()
if "marker" not in ledger_data:
break
# Specify ledger and marker to continue querying.
# Specify the same ledger and add the marker to continue querying.
ledger_marker = LedgerData(ledger_index=500000, marker=ledger_data["marker"])
ledger_data = client.request(ledger_marker).result