Skip to main content

init examples

import { useWalletClient } from 'wagmi';
const { data: walletClient } = useWalletClient();
IDENTITY_CLIENT.onSignMessage(async (data: { message: string }) => {
return await signMessageAsync({ message: data.message });
});
IDENTITY_CLIENT.onSendTransaction(async (data: TransactionData) => {
return walletClient.sendTransaction({
account: data.accountAddress,
to: data.to,
data: data.data,
value: data.value ? parseEther(data.value) : parseEther("0"),
});
});
IDENTITY_CLIENT.onSdkReady((data) => {
// this is the polygon did
setDID(data.did);
});
IDENTITY_CLIENT.onVerification((isVerified) => {
setVerified(isVerified);
});
await IDENTITY_CLIENT.init({
accessToken: accessToken,
signature: signature,
signingMessage: signingMessage,
});