This library provides useful functions to interact with the state on Litentry and user identity data related IPFS Storage.
It helps developer to build client side decentralized applications
yarn add litentry-sdk
import {hooks, query, ipfsApi} from 'litentry-sdk';
//Api loading State
hooks.useApi(): boolean
//Get Identities, use updatedIndex to force refresh
hooks.useIdentities(account: string, updateIndex: number): string[]
//Get Identity current owned tokens
hooks.useTokens(identityHash: string): string[]
//Get the owner of the token
hooks.useTokenOwner(tokenHash: string): string
//Get account balance of LTT
hooks.useBalance(account: string): string
//Help async function for query issuer Identity of the token
hooks.getTokenIdentity(tokenHash: string): Promise<string>]
//Help async function for getting the last issued identity
hooks.getLastIdentity(account: string): Promise<string | void>
// react hooks for using native extrinsics on Litentry
hooks.useExtrinsics(): {
registerIdentity: SubmittableExtrinsicFunction<'promise'>;
issueToken: SubmittableExtrinsicFunction<'promise'>;
}Identity data are stored in the IPFS network and cached in Litentry GraphQL data server.
functions to query the latest data on IPFS:
ipfsApi.getAddress(identity: string): Promise<string | null>
ipfsApi.getData(identityId: string): Promise<string[]>
ipfsApi.registerIdentity(identity: string): voidfunctions to construct query http request from GraphQL:
query.getData(identity: string): string
query.setData(identity: string, data: string): string
query.method(methodName: string, identity: string): string yarn lint:fix
yarn build
Apache 2.0