The library emits several events you may need to handle to update your app accordingly.

Listen to these events calling the on() method with a callback handler. For example:

csprclick.on('csprclick:signed_in', async (evt) => {
  //update your app content for the new session
  console.log("Connected account: " + evt.account.public_key)


This event is emitted when the library initialization is complete. Usually, you shouldn’t call any method in the library (apart from init()) before this event occurs.

Use once() to bind the callback handler instead of on() for this event since it’s triggered only once.


This event is emitted when the library connects to a new account. Previously, either csprclick.connect() or csprclick.signInWithAccount() methods must have been called by the application.

Receives an AccountType object with data about the newly connected account.


This event is emitted when library switches connection from one account to another after the application has called csprclick.switchAccount() method.

Receives an AccountType object with data about the newly connected account.


This event is emitted when there's an account connected to the application and the user changes the active account in his wallet, but the application hasn't requested the change calling connect() or switchAccount() methods.

When UI SDK is being used, the application shows a pop up notice where the user can confirm if he wants to switch the current session to the new account or keep the current one.

If you're not using UI SDK, your application should define a handler for this event and confirm the account change by calling signInWithAccount() method. For example:

csprclick.on('csprclick:unsolicited_account_change', async (evt) => {

When the new account is connected, the SDK will emit the event csprclick:signed_in.


This event is emitted when the library disconnects the active account due to a call to the signOut() SDK method.


This event is emitted when library receives a disconnect request or event from the connected wallet. The app should close the current session as a consequence of this event.

Receives the provider that has been disconnected.


Indicates that the signIn() method has been called. In your app, you should typically respond to these event showing the sign-in options to the user (e.g. list of wallets, list of known accounts, etc.).

Last updated