@ixo/client-sdk

One ixo client to rule them all


License
ISC
Install
npm install @ixo/client-sdk@1.0.12

Documentation

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 someProject = await client.getProject('<a valid project DID>')

const someClaims = await client.listClaims(someProject)
console.log('Here are the claims', someClaims)

See wallet API and client API for details.

Wallet API

makeWallet(source, didPrefix = 'did:ixo:'): Create a new wallet

  • source: Either a mnemonic string or a plain object representing a wallet state (possibly obtained via toJSON() -see below for details). Optional.

    If empty, a brand new wallet is generated. If a mnemonic string, recovers a wallet based on the mnemonic. If a state object, revives the wallet using that state.

  • didPrefix: A DID prefix. Optional, defaults to did:ixo:.

    If the source is a mnemonic which means that you are importing a wallet from elsewhere, you may need to provide the didPrefix as well to obtain the exact same wallet. If the DID prefix of the wallet is different from did:ixo: then it must be provided here.

makeWallet returns a wallet object with the following properties:

  • secp: An instance of CosmJS' Secp256k1HdWallet

  • agent: A custom wallet instance implementing OfflineAminoSigner

  • toJSON(): Standard toJSON method for JSON.stringify integration. One can also use this to get a representation of the wallet's internal state as a plain object and use it in a context where a class instance is not supported. (e.g. Global application state of a client app)

Client API

Client methods:

Create a new client

  • 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.

      Optional. If empty, client methods that require a signer won't work.

    • 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.

Client methods

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.