Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

allostasis-js-sdk

rayandev1996326ISC1.3.21TypeScript support: included

Allostasis data management

Allostasis, DAO, JS-SDK

readme

Allostasis JS SDK

This SDK is for Allostasis community profile management.

Usage

Initialize

First step is to create an instance of the SDK.

import Allostasis from 'allostasis-js-sdk';

const allostasis = new Allostasis(community, options)
Property Required Values
community Yes greenia
embodia
centeria
wearia
incarnia
avatia
options Yes ConstructionOptions
ConstructionOptions = {
    nodeURL: URL of the node,
    provider?: Like MetaMask,
    chain?: {
        name: Name of the chain,
        id: ID of the chain
    },
    infura: {
        url: infura URL,
        projectId: infura project ID,
        apiKey: Infura API key
    }
}

Connect to Ceramic and Lit

Using the connect method of the SDK, you can connect the user to specified network.

allostasis.connect().then({ did, address } => {
    // connected successfully
}).catch(error => {
    // error happened
})

Check Connection

Use isConnected to check the status of connection to ceramic.

allostasis.isConnected().then({ did, address } => {
    // is connected
}).catch(error => {
    // is not connected or error happened
})

Disconnect

To log the user out of the network, use disconnect method.

allostasis.disconnect().then(response => {
    // disconnected
}).catch(error => {
    // error happened
})

Create / Update Profile

To update existing user profile or create new one, use as below:

allostasis.createOrUpdateProfile(RequestParams).then(response => {
    // created or updated
}).catch(error => {
    // error happened
})

RequestParams is an object:

Property Required Type
displayNameNoString
emailNoString
avatarNoString
coverNoString
bioNoString
accountTypeNoPERSONNAL or ENTERPRISE
ageNoNumber
skillsNoString[] max 10 items
genderNoMALE or FEMALE or OTHER
phoneNumberNoString
addressNoString
socialLinksNoString[] max 20 items

Get Profile

To get user's profile, use getProfile method.

allostasis.getProfile().then(response => {
    // profile data
}).catch(error => {
    // error happened
})

Get Specific User's Profile

To get user's profile by ID, use getUserProfile method.

allostasis.getUserProfile(profileID).then(response => {
    // profile data
}).catch(error => {
    // error happened
})

Get Specific User's Community Profile

To get user's community profile by ID, use getCommunityUserProfile method.

allostasis.getCommunityUserProfile(communityProfileID).then(response => {
    // community profile data
}).catch(error => {
    // error happened
})

Development

This is an NPM package, after each commit, change the version number inside package.json and then run the following commands:

  • npm run build
  • npm publish

Note: You need to be logged in to your NPM account using npm cli.