Last active
November 11, 2024 12:27
-
-
Save shortthefomo/d28e40829380d5b116d0430321f7cc2e to your computer and use it in GitHub Desktop.
all the money
This file contains hidden or 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 xrpl = new XrplClient() | |
// change this code to a different currency code one of others published, AUD/CAD/CHF/CNY/EUR/GBP/JPY/USD | |
let code = 'AUD' | |
if (code.length > 3) { | |
const characters = Buffer.from(code, 'utf8').toString('hex') | |
let s = '0' | |
for (let index = 1; index < 40 - characters.length; index++) { | |
s = s + '0' | |
} | |
code = (characters + s).toUpperCase() | |
} | |
const command = { | |
'command': 'get_aggregate_price', | |
'ledger_index': 'current', | |
'base_asset': 'ATM', | |
'quote_asset': code, | |
'trim': 20, | |
'oracles': [ | |
{ | |
'account': 'raLLmoneyxGV9FzoWwRtHmb4jmkMiJxwGL', | |
'oracle_document_id': 0 | |
} | |
] | |
} | |
const response = await xrpl.send(command) | |
if ('error' in response) { return } | |
console.log(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment