-
-
Save mbaneshi/6e1853f6694420a92b4ba46d8dc6062d to your computer and use it in GitHub Desktop.
Fetching all issuer trustlines (node, websocket)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { XrplClient } = require('xrpl-client') | |
const account = 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B' // The issuer, Bitstamp USD | |
const currency = 'USD' | |
const client = new XrplClient() | |
const main = async () => { | |
await client.ready() | |
const { account_data } = await client.send({ command: 'account_info', account }) | |
let marker = '' | |
const l = [] | |
while (typeof marker === 'string') { | |
const lines = await client.send({ command: 'account_lines', account, marker: marker === '' ? undefined : marker }) | |
marker = lines?.marker === marker ? null : lines?.marker | |
console.log(`Got ${lines.lines.length} results`) | |
lines.lines.forEach(t => { | |
if (t.currency === currency) { | |
l.push(t.account) | |
} | |
}) | |
} | |
console.log('# Trust Lines:', l.length) | |
client.close() | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment