Add clarifying comments to individual-freeze

This commit is contained in:
Jackson Mills
2021-10-18 10:01:12 -07:00
parent 95a1de45f7
commit 7f89d3734c

View File

@@ -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)