Oracle
@aeternity/aepp-sdk/es/ae/oracle
Oracle module - routines to interact with the æternity oracle system
The high-level description of the oracle system is https://github.com/aeternity/protocol/blob/master/ORACLE.md in the protocol repository.
Example
import Oracle from '@aeternity/aepp-sdk/es/ae/oracle'
- @aeternity/aepp-sdk/es/ae/oracle
- Oracle([options]) ⇒
Object
⏏ - instance
- async
- .pollForQueries(oracleId, onQuery, [options]) ⇒
function
⏏ - .getQueryObject(oracleId, queryId) ⇒
Promise.<Object>
⏏ - .exports.pollForQueryResponse(oracleId, queryId, [options]) ⇒
Promise.<Object>
⏏ - .registerOracle(queryFormat, responseFormat, [options]) ⇒
Promise.<Object>
⏏ - .postQueryToOracle(oracleId, query, [options]) ⇒
Promise.<Object>
⏏ - .extendOracleTtl(oracleId, oracleTtl, [options]) ⇒
Promise.<Object>
⏏ - .respondToQuery(oracleId, queryId, response, [options]) ⇒
Promise.<Object>
⏏
- .pollForQueries(oracleId, onQuery, [options]) ⇒
- async
- Oracle([options]) ⇒
Oracle([options]) ⇒ Object
⏏
Oracle Stamp
Oracle provides oracle-system related methods atop Ae clients.
Kind: Exported function
Returns: Object
- Oracle instance
rtype: Stamp
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
{} |
Initializer object |
.pollForQueries(oracleId, onQuery, [options]) ⇒ function
⏏
Poll for oracle queries
Kind: instance method of @aeternity/aepp-sdk/es/ae/oracle
Returns: function
- stopPolling - Stop polling function
Category: async
Param | Type | Description |
---|---|---|
oracleId | String |
Oracle public key |
onQuery | function |
OnQuery callback |
[options] | Object |
Options object |
[options.interval] | Number |
Poll interval(default: 5000) |
.getQueryObject(oracleId, queryId) ⇒ Promise.<Object>
⏏
Constructor for OracleQuery Object (helper object for using OracleQuery)
Kind: instance method of @aeternity/aepp-sdk/es/ae/oracle
Returns: Promise.<Object>
- OracleQuery object
Category: async
Param | Type | Description |
---|---|---|
oracleId | String |
Oracle public key |
queryId | String |
Oracle Query id |
.exports.pollForQueryResponse(oracleId, queryId, [options]) ⇒ Promise.<Object>
⏏
Poll for oracle query response
Kind: instance method of @aeternity/aepp-sdk/es/ae/oracle
Returns: Promise.<Object>
- OracleQuery object
Category: async
Param | Type | Description |
---|---|---|
oracleId | String |
Oracle public key |
queryId | String |
Oracle Query id |
[options] | Object |
Options object |
[options.attempts] | Object |
Poll attempt's(default: 20) |
[options.interval] | Object |
Poll interval(default: 5000) |
.registerOracle(queryFormat, responseFormat, [options]) ⇒ Promise.<Object>
⏏
Register oracle
Kind: instance method of @aeternity/aepp-sdk/es/ae/oracle
Returns: Promise.<Object>
- Oracle object
Category: async
Param | Type | Default | Description |
---|---|---|---|
queryFormat | String |
Format of query | |
responseFormat | String |
Format of query response | |
[options] | Object |
{} |
Options |
[options.queryFee] | String | Number |
queryFee Oracle query Fee | |
[options.oracleTtl] | Object |
oracleTtl OracleTtl object {type: 'delta | |
[options.abiVersion] | Number |
abiVersion Always 0 (do not use virtual machine) | |
[options.fee] | Number |
fee Transaction fee | |
[options.ttl] | Number |
Transaction time to leave |
.postQueryToOracle(oracleId, query, [options]) ⇒ Promise.<Object>
⏏
Post query to oracle
Kind: instance method of @aeternity/aepp-sdk/es/ae/oracle
Returns: Promise.<Object>
- Query object
Category: async
Param | Type | Default | Description |
---|---|---|---|
oracleId | String |
Oracle public key | |
query | String |
Oracle query object | |
[options] | Object |
{} |
|
[options.queryTtl] | String | Number |
queryTtl Oracle query time to leave | |
[options.responseTtl] | String | Number |
queryFee Oracle query response time to leave | |
[options.queryFee] | String | Number |
queryFee Oracle query fee | |
[options.fee] | Number |
fee Transaction fee | |
[options.ttl] | Number |
Transaction time to leave |
.extendOracleTtl(oracleId, oracleTtl, [options]) ⇒ Promise.<Object>
⏏
Extend oracle ttl
Kind: instance method of @aeternity/aepp-sdk/es/ae/oracle
Returns: Promise.<Object>
- Oracle object
Category: async
Param | Type | Default | Description |
---|---|---|---|
oracleId | String |
Oracle public key | |
oracleTtl | String |
Oracle time to leave for extend | |
[options] | Object |
{} |
|
[options.fee] | Number |
fee Transaction fee | |
[options.ttl] | Number |
Transaction time to leave |
.respondToQuery(oracleId, queryId, response, [options]) ⇒ Promise.<Object>
⏏
Extend oracle ttl
Kind: instance method of @aeternity/aepp-sdk/es/ae/oracle
Returns: Promise.<Object>
- Oracle object
Category: async
Param | Type | Default | Description |
---|---|---|---|
oracleId | String |
Oracle public key | |
queryId | String |
Oracle query id | |
response | String |
Oracle query response | |
[options] | Object |
{} |
|
[options.responseTtl] | Number |
responseTtl Query response time to leave | |
[options.fee] | Number |
Transaction fee | |
[options.ttl] | Number |
Transaction time to leave |