Identity (Viem/Wagmi)
Last updated
Was this helpful?
Last updated
Was this helpful?
For a live demo of the identity integration (using development identity contracts), visit:
To integrate identity-sdk
into your project, you can easily install it from npm:
or if you prefer using Yarn:
Available Methods in the Identity SDK:
getWhitelistedRoot(account: Address): Promise<{ isWhitelisted: boolean; root: Address }>
getIdentityExpiryData(account: Address): Promise<IdentityExpiryData>
generateFVLink(popupMode?: boolean, callbackUrl?: string, chainId?: number): Promise<string>
submitAndWait(params: SimulateContractParameters, onHash?: (hash:
0x${string}) => void): Promise<any>
calculateIdentityExpiry(lastAuthenticated: bigint, authPeriod: bigint): IdentityExpiry
The Identity SDK is built on top of Wagmi
and provides a React hook for interacting with the Identity smart contracts. It abstracts the complexity of blockchain interactions, making it easier to integrate identity functionalities into your React applications.
Initialization
First, ensure that you have set up Wagmi
in your React application. Then, import and use the useIdentitySDK
hook as shown below.
The Viem SDK provides a set of utility functions to interact directly with the Identity smart contracts. It is suitable for backend services or environments where React is not used.
Initialization