Allostasis data management
npm install allostasis-js-sdkThis SDK is for Allostasis community profile management.
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
}
}
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
})
to check the status of connection to ceramic.`
allostasis.isConnected().then({ did, address } => {
// is connected
}).catch(error => {
// is not connected or error happened
})
`$3
To log the user out of the network, use disconnect method.`
allostasis.disconnect().then(response => {
// disconnected
}).catch(error => {
// error happened
})
`$3
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
displayName No String
email No String
avatar No String
cover No String
bio No String
accountType No PERSONNAL or ENTERPRISE
age No Number
skills No String[] max 10 items
gender No MALE or FEMALE or OTHER
phoneNumber No String
address No String
socialLinks No String[] max 20 items
$3
To get user's profile, use
getProfile method.`
allostasis.getProfile().then(response => {
// profile data
}).catch(error => {
// error happened
})
`$3
To get user's profile by ID, use
getUserProfile method.`
allostasis.getUserProfile(profileID).then(response => {
// profile data
}).catch(error => {
// error happened
})
`$3
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.