Skip to content

Instantly share code, notes, and snippets.

@smiled0g
Created August 29, 2020 10:37
Show Gist options
  • Save smiled0g/b9204019af2fd8334cbeec735e805036 to your computer and use it in GitHub Desktop.
Save smiled0g/b9204019af2fd8334cbeec735e805036 to your computer and use it in GitHub Desktop.
BAND/USD Get Result
async function getLatestRequestResult() {
const bandchain = new BandChain(endpoint)
const oracleScript = await bandchain.getOracleScript(oracleScriptId)
const { result, resolve_time } = await bandchain.getLastMatchingRequestResult(
oracleScript,
params,
validatorCounts,
)
return {
result: parseFloat(result.px) / params.multiplier,
resolve_time: new Date(resolve_time * 1000)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment