ixo API Module

ixo-apiModule API

This NPM module provides APIs that simplify interacts between the ixo-SDK user interfaces and Cell Nodes, Blockchain Nodes and blocksync.
npm install --save ixo-module
To Create a new ixo Object (Without provider)
1
import ixo from 'ixo-module';
2
var ixo = new ixo('ixo_node_url')
Copied!
NOTE

Entity Functions

Functions are called using ixo.project.<functionName> // In future, this will be replaced with the more generic ixo.entity.<functionName>

List Entities

Returns a list of all entities cached in the Explorer Node (ixo-blocksync). Note that each ixo Relayer Portal can configure their instance of ixo-blocksync to only synchronise entities that are associated with the Relayer. Linked entities have the Relayer Node-ID in their blockchain record (Entity Document).
Request:
1
ixo.project.listProjects().then((result) => {
2
console.log('Project List: ' + result)
3
})
Copied!

Get Project

Retrieves public project details by DID
1
let projectDid = 'did:ixo:TknEju4pjyRQvVehivZ82x';
2
ixo.project.getProjectByDid(projectDid).then((result) => {
3
console.log('Project Details: ' + result)
4
})
Copied!

Create Project

1
ixo.project.createProject(projectData, signature, PDSUrl).then((result) => {
2
console.log('Project Details: ' + result)
3
})
Copied!

Upload Public Data

Function to upload into a Cell Node any public content relating to an entity. This returns a unique content identifier (CID) for the data. This allows the data to be content-addressed and retrieved using the identifier dataUrl. The primary use is to upload images and json template files to the Cell Node. But this can accept any arbitrary project-specific public data.
The dataUrl takes the form of data:<mediatype>;<encoding>,<data> // In future this will be replaced by IPLD standard content addresses
1
// Upload an image
2
let dataUrl = 'data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg==';
3
ixo.project.createPublic(dataUrl, PDSUrl) {
4
console.log('Document hash: ' + result)
5
})
Copied!

Retrieve Public Data

Retrieves previously uploaded data from a Cell-Node using the content address (hash)
1
ixo.project.fetchPublic(documentHash, PDSUrl) {
2
console.log('Document hash: ' + result)
3
})
Copied!

Agent Functions

These calls take the form ixo.agent.<functionName>

List Agents

Returns a list of all agents associated with an entity, from the Cell Node.
Request:
1
ixo.agent.listAgentsForProject(data, signature, PDSUrl).then((result) => {
2
console.log('Agent List: ' + result)
3
})
Copied!

Register an Agent for an Entity

Associates the Agent DID with the entity.
Request:
1
ixo.agent.createAgent(agentData, signature, PDSUrl).then((result) => {
2
console.log('Create Agent: ' + result)
3
})
Copied!

Update Agent Status

Update an agent's registration status.
Valid statuses are:
Status
Value
Pending
0
Approved
1
Revoked
2
Request:
1
ixo.agent.createAgent(agentData, signature, PDSUrl).then((result) => {
2
console.log('Update Agent Status: ' + result)
3
})
Copied!

Claim Functions

Calls take the form ixo.claim.<functionName>

List Claims

Returns a list of all claims for an entity, from a Cell Node, together with the claim status.
Request:
1
ixo.claim.listClaimsForProject(data, signature, PDSUrl).then((result) => {
2
console.log('Claim List: ' + result)
3
})
Copied!

List Claims by Template ID

Returns a list of filtered claims for an entity, from a Cell Node, together with the claim status. Claims are filtered by a template ID expected to be included in data as claimTemplateId.
Request:
1
ixo.claim.listClaimsForProjectByTemplateId(data, signature, PDSUrl).then((result) => {
2
console.log('Claim List: ' + result)
3
})
Copied!

Issue Claim

Issues a claim for an entity.
Request:
1
ixo.agent.createClaim(agentData, signature, PDSUrl).then((result) => {
2
console.log('Create Claim: ' + result)
3
})
Copied!

Evaluate a Claim

Sets the evaluation status for a claim.
Valid statuses are:
Status
Value
Pending
0
Approved
1
Rejected
2
Request:
1
ixo.agent.evaluateClaim(evaluationData, signature, PDSUrl).then((result) => {
2
console.log('Create Evaluation: ' + result)
3
})
Copied!

User Functions

Register agent DID and DID Document

Registers a new agent identifier and DID document (DDO) to the ixo blockchain.
Request:
1
ixo.user.registerUserDid().then((result) => {
2
console.log('Register DID: ' + result)
3
})
Copied!

Get a DID Document

Retrieves the DID Doc for a specified agent identifier
Request:
1
Let did = 'did:sov:2p19P17cr6XavfMJ8htYSS';
2
ixo.user.getDidDoc(did).then((result) => {
3
console.log('DID Doc: ' + result)
4
})
Copied!

Metrics

Returns the global statistics for all entities associated with a Relayer node.
Request:
1
ixo.stats.getGlobalStats().then((result) => {
2
console.log('Statistics: ' + result)
3
})
Copied!

Health Check Functions

Blockchain Health Check

Request:
1
ixo.network.pingIxoBlockchain().then((result) => {
2
console.log('Health Check: ' + result)
3
})
Copied!

Explorer node health check

Request:
1
ixo.network.pingIxoExplorer().then((result) => {
2
console.log('Health Check: ' + result)
3
})
Copied!
Response: ixo Explorer: ping

Last modified 2mo ago