Open the HeyElsa Dashboard at: https://dashboard.widget.heyelsa.dev/widgets
2
Create Widget Instance
Create a new widget instance for your dApp.
3
Copy Key ID
Copy the generated Key ID and use it as the keyId prop in your integration.
Note: Dashboard access is currently limited and coming soon for public use.
π Adapter Implementation
What is the Adapter?
The adapter handles communication between the widget and your dApp's wallet functionality. You need to implement the createWalletAdapter function to handle wallet operations.
Implementation Code
Supported Wallet Actions
Action
Description
Parameters
CONNECT_WALLET
Connect user wallet
-
DISCONNECT_WALLET
Disconnect wallet
-
GET_ACCOUNTS
Get connected accounts
-
GET_CHAIN_ID
Get current chain ID
-
GET_BALANCE
Get wallet balance
{ address: string }
SIGN_MESSAGE
Sign a message
{ message: string, address: string }
SIGN_TRANSACTION
Sign transaction
{ transaction: object }
BROADCAST_TRANSACTION
Send transaction
{ transaction: object }
SWITCH_NETWORK
Switch network
{ chainId: string }
NETWORK_SWITCHED_EVENT
Network switched
{ chainId: string }
π Wallet State Synchronisation
Purpose: Use these methods to send connected wallet status from your dApp to the widget.
Connected State
Disconnected State
WalletState Interface
Custom Styles
π Summary
Key Points to Remember:
Install the package with:
Get your Key ID from the HeyElsa Dashboard.
Implement the createWalletAdapter function to handle wallet operations.
Use syncWalletState to keep the widget informed about wallet status from your dApp.
Customize styling with the customStyles prop.
Handle wallet events properly for the best user experience.