ixo-client SDK
A complete package of client software for developing client
applications which connect to the ixo software stack and build on
the Internet of Impact.
Usage Example
const {makeWallet, makeClient} = require('@ixo/client-sdk')
const
wallet = await makeWallet(),
client = makeClient(wallet)
await client.register()
await client.sendTokens('<target address>', 10)
const someEntity = await client.getEntity('<a valid entity DID>')
const someClaims = await client.listClaims(someEntity)
console.log('Here are the claims', someClaims)
Client API
makeClient(signer, blockchainURL, blocksyncURL)
: Create a new
ixo client
-
signer
: Either a wallet object created by makeWallet
or a
custom signer object with the following properties:
See the wallet API for more info on secp
and agent
keywords.
-
blockchainURL
: The URL of the target ixo chain. Optional,
defaults to the current mainnet URL.
-
blocksyncURL
: The URL of the target ixo blocksync service.
Optional, defaults to the current main blocksync service URL.
makeClient
returns an object with the following properties:
-
register(verifyKey)
: Register the current user
verifyKey
: Only required if the client is configured to use
a custom signer. No need to provide this if the client is
initialized with wallet created with makeWallet
, as the
value can be obtained from it.
-
getSecpAccount()
: Get account info for the SECP subwallet
-
getAgentAccount()
: Get account info for the agent subwallet
-
sendTokens(targetAddress, amount, denom)
-
targetAddress
: A wallet address to send coins to
-
amount
: Any positive number
-
denom
: Coin type. Optional, defaults to "uixo"
.
-
getDidDoc(did)
: Return the full DID document for the given DID
-
listEntities()
: Lists all available entities
-
getEntity(entityDid)
: Get complete entity record for the given
DID
-
createEntity(entityData, cellnodeURL)
: Create a new entity
-
entityData
: To be documented; for now please see
here
for an example
-
cellnodeURL
: URL of the cell node where various project
data will be kept. Optional, defaults to ixo's shared cell
node
-
createEntityFile(target, dataUrl)
: Upload a file to project's
cell node
-
target
: Either a project record, a project DID, or a cell
node URL
-
dataUrl
: Any valid data URL
-
getEntityFile(target, key)
-
target
: Either a project record, a project DID, or a cell
node URL
-
key
: Key of the target file, as returned from
createEntityFile
.
-
listAgents(entityRecordOrDid)
: List agents belonging to a given entity
-
createAgent(entityRecordOrDid, agentRecord)
: Create an agent for the
given entity
-
updateAgentStatus(entityRecordOrDid, agentDid, updates)
-
listClaims(entityRecordOrDid, entityTemplateId)
entityTemplateId
: Optional, provide a value to filter claims
by template id
-
createClaim(entityRecordOrDid, claimData)
claimData
: Any object is accepted
-
evaluateClaim(entityRecordOrDid, claimId, status)
-
custom(walletType, msg)
: Send a custom message to the blockchain
Wallet API
makeWallet(mnemonicOrSerialization, serializationPwd)
: Create a
new wallet
-
mnemonicOrSerialization
: Either a mnemonic string or a
serialized wallet string. Optional.
If empty, a brand new wallet is generated. If a mnemonic string,
recovers a wallet based on the mnemonic. If serialized wallet,
deserializes it.
-
serializationPwd
: Serializations involve encryption so a
password is required if the first parameter is an encryption
string.
makeWallet
returns a wallet object with the following
properties:
Debugging
Put the ixo-client-sdk
string into your DEBUG
environment
variable to log network requests and responses. See the debug
package for more info.