From 7f89d3734c49299a7b0a2ef102492863dd70e5a9 Mon Sep 17 00:00:00 2001 From: Jackson Mills Date: Mon, 18 Oct 2021 10:01:12 -0700 Subject: [PATCH] Add clarifying comments to individual-freeze --- .../_code-samples/freeze/check-individual-freeze.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/content/_code-samples/freeze/check-individual-freeze.js b/content/_code-samples/freeze/check-individual-freeze.js index b91ff80c0f..773a10bb22 100644 --- a/content/_code-samples/freeze/check-individual-freeze.js +++ b/content/_code-samples/freeze/check-individual-freeze.js @@ -19,20 +19,19 @@ async function main() { const counterparty_address = 'rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v' const frozen_currency = 'USD' - // Look up current state of trust line + // Look up current state of the trust line ---------------------------------- const account_lines = { command: 'account_lines', account: my_address, peer: counterparty_address, } - console.log('looking up all trust lines from', - counterparty_address, 'to', my_address) + console.log(`Looking up all trust lines from + ${counterparty_address} to ${my_address}`) const data = await client.request(account_lines) - // There is only one trust line per currency code per account, - // so we stop after the first match + // Find the trust line for our frozen_currency ------------------------------ let trustline = null for (let i = 0; i < data.result.lines.length; i++) { if(data.result.lines[i].currency === frozen_currency) { @@ -45,12 +44,15 @@ async function main() { throw `There was no ${frozen_currency} trust line` } + // Check if the trust line is frozen ----------------------------------------- console.log('Trust line frozen from our side?', trustline.freeze === true) console.log('Trust line frozen from counterparty\'s side?', trustline.freeze_peer === true) await client.disconnect() + + // End main() } main().catch(console.error)