All the wallet management & Chain Interactions executing on the client side is managed by this class.
Create an instance
constkeyring=newKeyringController({ baseUrl:'http://localhost:8000', walletType: { embedded:true,// for external wallet it should be false supportAa:true,// false if dapp only wants EOA wallets }, sentryDns,// string environment,// ENV sessionSignatures,//[OPTIONAL] SESSION SIG FROM litController.initSession currentAccount,//[OPTIONAL] fetch PKPs FROM litController.fetchPKPs customAuthMethod, accessToken, aa, selectedWallet,} asTriaArgs);exporttypeTriaArgs= { baseUrl:string; sentryDns?:string; walletType?:WalletType; selectedChainName?:ChainName; environment?:ENV; currentAccount?:IRelayPKP; sessionSignatures?:string; customAuthMethod?:LitCustomAuthMethod; accessToken?:string; aa?:AaDetails; selectedWallet?:"EOA"|"AA";};exporttypeENV='testnet'|'mainnet-staging'|'mainnet';
To maintain the integrity of the keyring object that stores decrypted vaults in memory, it is crucial to preserve its context. This implies that the keyring object should not be recreated, but rather instantiated only once.
Recreating the keyring object would lead to the loss of critical in-memory data, consequently preventing the user from performing any transaction signing. Therefore, it is imperative to avoid the recreation of this object at all costs.
Functions
Reconstruction of Vault
The ideal moment to invoke this method is immediately after a successful user login. This timing ensures that we have access to the user's password and pin, which are essential for decrypting and reconstructing the vault.
To ensure smooth functioning and optimal performance of the KeyringController, it is essential to call the following method as the first step before invoking any other methods. This method initializes the persist storage and in-memory data, laying the foundation for subsequent operations.
Additionally, it should be called only once during the application startup process. Repeated invocations of this method may result in unnecessary overhead, affecting efficiency.
Add this in auth.tria.so/detect and open this as a invisible iframe in the onboarding SDK to send events to the SDK, and read events with const {account} = useDetectAccount();