Events
Here are the monitoring events of the provider. There are currently two types of events, account update and chain update.
When user switch account in Auro Wallet,
accountsChanged
will be trigger.window.mina?.on('accountsChanged', handler: (accounts: string[]) => void);
window.mina?.on('accountsChanged', handler: (accounts: string[]) => {
console.log('connected accounts', accounts)
});
When user switch chain in Auro Wallet,
chainChanged
will be trigger. type ChainInfoArgs ={
chainId:string,
name:string,
}
window.mina?.on('chainChanged', handler: (chainInfo: ChainInfoArgs) => void);
window.mina?.on('chainChanged', handler: (chainInfo: ChainInfoArgs) => {
console.log('current chain id', chainInfo.chainId)
console.log('current chain name', chainInfo.name)
});
Last modified 18d ago