Comment on page
NEAR Request Oracle
This page contains an overview on how to interact with the NEAR Request oracle
On the NEAR blockchain, DIA operates an oracle that can fetch any quotation from the DIA API. The oracle follows a request/response pattern, i.e., an on-chain NEAR contract requests data from the DIA API which is then promptly served by the oracle as a callback.
Follow the instructions in its README to learn how to interact with the DIA oracle on the NEAR blockchain. There, the exact steps are described for getting a client up and running that is served quotations using the request oracle.
You can test the oracle by querying a price quotation using code from the example repository. For that, checkout the repository and install dependencies using
npm installAfter that, you can build the oracle consumer with
npm run buildand start the oracle consumer with
An example request and response for the asset DIA (can be configured in the source file) looks like this:
user@host% node dist/test/quote-make-request
near.call quote-test-client.dia-test.testnet make_request
near.view quote-test-client.dia-test.testnet get_callback_response