Fetch XRPUSD price from the XRPL using JSON RPC

node v10.24.1
version: 2.0.0
endpointsharetweet
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) })()
Loading…

no comments

    sign in to comment