This example shows how to work with the overlay through the new Core Login API.
As an example let's connect and disconnect an Ethereum network account using a button in the overlay.
Here is the initial code for this example: ex17-overlay-login-exercise.
More details about the useState and onAction methods can be found in Shared State section.
Add the method to overlay initialization. The state will transfer the account address from the dapplet to the overlay.
dapplet/src/api.ts contains the functions that will be available in the overlay.
You can learn more about Core Login API here.
More details about the declare method can be found in Overlays section.
Core.onAction method. The callback will open the overlay and update the data about the session when the home button is clicked.
To implement the overlay part, we use React functional components.
The Dapplet and the overlay are connected using Bridge and IDappStateProps which are imported from
Add functions to
Use sharedState to render the component and display the account address.
Here is the result code of the example: ex17-overlay-login-solution.
Run the dapplet: