DIVINER API (api-diviner-nodejs)
Branches
Master
Develop
Description
The main API for accessing a diviner on the XYO network information using GraphQL.
User Mode
Requirements (Step 1)
Install Node 10.x or later from: NodeJs
Install Diviner (Step 2)
sudo npm install @xyo-network/api-diviner-nodejs -g --unsafe-perm=true
Build Diviner (Step 3)
xyo-diviner start
Developer Mode
Requirements (Step 1)
Install Node 10.x or later from: NodeJs
Install Diviner (Step 2)
npm install https://github.com/XYOracleNetwork/api-diviner-nodejs
Build Diviner (Step 3)
npm run build
Start Diviner (Step 4)
npm run start
Docker
Install
Install the Diviner in a Docker and start the server at the end.
Note: There currently are quite a few build errors/warnings generted from dependencies that can safely be ignored, but should addressed in the future.
docker image build -t xyonetwork-api-diviner-nodejs-install:latest https://raw.githubusercontent.com/XYOracleNetwork/api-diviner-nodejs/master/docker/install/Dockerfile
docker run -p 12002:12002 xyonetwork-api-diviner-nodejs-install:latest
Accessing GraphQL
Example Query
GraphQL Query
mutation QuestionHasIntersected($partyOneAddresses: [String]!, $partyTwoAddresses: [String]!) {
questionHasIntersected(partyOneAddresses: $partyOneAddresses, partyTwoAddresses: $partyTwoAddresses)
}
Query Variables (replace the addresses with known addresses)
{
"partyOneAddresses": ["040135DC4E51B3A3AC55F5A88D22DDAD498FDE02273BD0DF6FC63D5138EB8C128CF4268A6ED86A1DC433E0D3EFD24172CD1253EAFEFF71C9B6C133B7D759BFFE7E95"],
"partyTwoAddresses": ["0401FF4FD5F39558F82E53111993D632756FBB9E5FAF85C0316DA8465F6B8B0F0BD1EC61D9C56EBBDF31C14F125964279F1996623995CCC1E30ACDF4A42E002620D4"]
}
Command Line
Usage
xyo-diviner <cmd> [opt]
<cmd>: commands
[opt]: options
Commands
start Start the Api Server
Options
-g, --graphql [n] The http port to listen on for graphql connections
(default = 12001)
-a, --archivist [s] The url of the seed archivists to contact
(default = http://archivists.xyo.network:11001)
Example: Start the Diviner on port 9070 and use port 9079 on your local computer for the archivist
xyo-diviner start -g 9070 -a http://localhost:9079
License
Only for internal XY Company use at this time
Credits
Made with ❤️
by XYO