Created
August 29, 2020 10:37
-
-
Save smiled0g/b9204019af2fd8334cbeec735e805036 to your computer and use it in GitHub Desktop.
BAND/USD Get Result
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
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