Skip to content

tillkolter/aepp-oracles-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

æpp oracles sdk

Javascript library with examples to integrate Æternity oracles.

Read this for an introduction to an oracle's lifecycle read

Installation

The implementation is early stage, so packaging configuration should not be seen as final.

For development purposes the npm publishing configuration assembles only the browser compatible implementation. For the server side NodeJS integration please refer to the example section.

npm install aepp-oracles-sdk

Examples

An example server implementation can be found under src/examples.

Client-side


import OracleConnection from 'aepp-oracles-sdk'

let connection = new OracleConnection(host, port, account)

connection.on('message', (message) => {
    console.log(`Websocket broadcasting: ${message}`)
}

// ...

var globalOracleId;

connection.on('registeredOracle', (oracleId) => {   
    globalOracleId = oracleId
    connection.query(oracleId, 4, 5, 5, 7, 'What is the purpose of life?')
})

// ...

if (globalOracleId) {
    connection.query(oracleId, 4, 5, 5, 7, 'What is the purpose of life?')
}

// ...

connection.on('response', (response) => {
    console.log(`Client's response: ${response}`)
    // "Client's response: 42"
})

About

Javascript library for Æternity orcales

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published