Connect wallet
<kadia-connect-wallet> is a UI-only component. It holds no wallet logic. The app gives it an adapter, shaped like the one in @kadia/dex-sdk.
import "@kadia/ui/elements";
const el = document.querySelector("kadia-connect-wallet");el.adapter = { discoverWallets: () => discoverWallets(globalThis.ergoConnector), connectWallet, disconnectWallet: async (session) => { /* app-specific */ },};el.addEventListener("kadia:wallet-connected", (e) => console.log(e.detail.session));Behaviour
Section titled “Behaviour”- Nothing is discovered until the person clicks Connect wallet.
- Nothing connects until they pick a wallet in the chooser. No wallet is connected automatically.
- Nautilus is listed first when advertised. Other advertised connectors are listed after it.
- An
identityWarningfrom the adapter is shown next to that wallet.
Events
Section titled “Events”| Event | Detail |
|---|---|
kadia:wallet-connected |
{ session } |
kadia:wallet-disconnected |
{ session } |
kadia:wallet-error |
{ message } |
Relationship to EIP-12
Section titled “Relationship to EIP-12”EIP-12 (dApp-Wallet Web Bridge) was never merged. The spec is the open draft ergoplatform/eips#23, checked at commit b70f406. The component itself contains no wallet calls, so it does not depend on the draft; the differences below are in the adapter an app supplies (such as the one in @kadia/dex-sdk).
Matches the draft
- Wallet methods used after connecting:
get_change_address()andsign_tx(), plus the optionalget_used_addresses()andget_utxos(). - Keys stay in the wallet, and the wallet asks the person before signing.
Differs from the draft
- Discovery and connecting. The draft describes one wallet: the page calls
ergo_request_read_access()(andergo_check_read_access()), and the wallet injects a globalergoobject.@kadia/dex-sdkinstead reads anergoConnectorregistry keyed by wallet id and callsconnect({ createErgoObject: false })thengetContext(). This is a connector convention used by Nautilus-style wallets. It is not in the draft, and that is what makes a multi-wallet chooser possible. get_current_height().@kadia/dex-sdkuses it as an optional read-only observation. The draft does not define it.disconnect(). The draft has no disconnect call. It defines a"ergo_wallet_disconnected"event instead.- Wallet-initiated disconnects. The component does not listen for
"ergo_wallet_disconnected". If the wallet disconnects on its own, the button stays in the connected state until the person clicks it, unless the app’s adapter or code calls back. Wiring this up needs a change in the app or the component, and has not been done.
Because the draft is still open, treat all of this as subject to change.