Oracle Sources Description
When making a request to the GoraNetwork, an application must specify a sourceId
to fetch the data from. In addition, it must also specify the arguments that sourceId
requires, the valuePath
to extract the required value from, and the valueType
which defines the type of the return value. To summarize, the following three arguments required to encode a request spec are obtained from the Oracle Sources List.
sourceArg: byte[]
- an argument for a parameterized Oracle sourcesourceArgList: SourceArg[]
- a list of the abovesourceId: uint32
- numeric ID of an oracle source
Example
Let's say you would like to get the current spot price of Bitcoin. After looking through the Oracle Source list, you find the endpoint that will get you what you need.
With the above source definition, you can construct a sourceArgList
for Bitcoin as follows
The above example uses a source that predefines the valueType
and the valuePath
. In the example below, an Oracle Source List that request a defined valueType
and valuePath
is shown.
This source gets a weather feed. However, rather than a predefined value (i.e price
, as in the previous example), a user may define which value they would like, such as temperature
, windspeed
, feelsLike
or any other value in the JSON response.
Note: you will notice the above source requires a value for endpoint.
Endpoints can be found on the GoraNetwork App under the relevant feed. The urlParams
format may also be found there.
Last updated