React Hooks
hooks
Useidentity

useIdentity

Hook to get all the information of an identity

Import

import { useIdentity } from '@lawallet/react';

Usage

index.tsx
import { useIdentity } from '@lawallet/react';
import { config } from './config';
 
function App() {
  const identity = useIdentity();
}

Parameters

import { type UseIdentityParameters } from '@lawallet/react';

pubkey

String | undefined

  • Public key of the user you want to initialize
  • If it is not sent, an attempt will be made to load from storage
import { useIdentity } from '@lawallet/react';
 
function App() {
  const identity = useIdentity({
    pubkey: '17efe7a5f1...53936f68b',
  });
}

privateKey

String | undefined

  • Private key of the account you want to initialize
  • If it is not sent, an attempt will be made to load from storage
import { useIdentity } from '@lawallet/react';
 
function App() {
  const identity = useIdentity({
    privateKey: '17efe7a5f1...53936f68b',
  });
}

config

Config | undefined

Config to use instead of retrieving from the from nearest LaWalletConfig.

import { useIdentity } from '@lawallet/react';
import { config } from './config';
 
function App() {
  const identity = useIdentity({
    config,
  });
}

Return Type

import { type UserIdentity } from '@lawallet/react';

identity

UserIdentity

Returns an instance of the UserIdentity