Fetch XRPUSD price from the XRPL using JSON RPC
const fetch = require('node-fetch')
const account = 'rXUMMaPpZqPutoRszR29jtC8amWq3APkx'
;(async () => {
const call = await fetch('https://xrpl.ws', {
method: 'POST',
body: JSON.stringify({
method: 'account_lines',
params: [ { account } ]
})
})
const lines = (await call.json()).result.lines
console.log('XRPUSD = ' + lines.filter(l => l.currency === 'USD')[0].limit)
})()
no comments