mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
Add clarifying comments to individual-freeze
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user