Connect to XT Wallet
Once the XT wallet is installed, it ramps up an internal message based communication server. Each new tab loads a small script provided by the extension, that acts as a client listening to the messages coming from the wallet.
The wallet stores the keys in an extra protected "backend" area of the extension and never provides any secret. The keys are encrypted by the users secret he provided when installed the extension. Between a DApp and the wallet only public information like accounts public key and current selected node host is transmitted.
The wallet dispatches the following events:
- Connection/Disconnection
- Account Selection
- Node Selection
- Account and/or Permission Removal
- Confirmation Responses, i.e. on signing
The SignumJS Wallets package simplifies the communication as much as possible. The interaction life-cycle of the wallet is like this:
- Connect to wallet
- Add Event Listeners to the connection object
- Interact according to the events
- Disconnect
- Detach the event listeners
The following code is just an excerpt from a working example. More elaborated demos for React (NextJS) and Vanilla HTML, JS are available also and serve as a starting point.