Skip to content

DApp Connector ignores active account selection #2227

Description

@bobblessinghartley

Which Lace surface?

Browser extension (Chrome)

Version

lace-extension@2.0.6

What happened?

When multiple Midnight accounts exist in Lace (e.g., Midnight #0 and Midnight #1), the DApp Connector API always returns Midnight #0's keys regardless of which account is currently active in the Lace UI.

Calling connect('preprod') followed by getShieldedAddresses() returns the same shieldedCoinPublicKey and shieldedEncryptionPublicKey whether Midnight #0 or Midnight #1 is selected in Lace. The getUnshieldedAddress() call also always returns Midnight #0's address.

The InitialAPI object exposes apiVersion, name, icon, and rdns — no mechanism for account selection. The ConnectedAPI has no switchAccount() or similar method.

What did you expect to happen?

connect('preprod') should return the keys and addresses for the currently active account in Lace. If Midnight #1 is selected in the Lace UI, all ConnectedAPI methods should operate on Midnight #1's state.

Alternatively, if per-session account binding is intended, the connect() flow should present an account picker popup (similar to how MetaMask handles multiple accounts) so the user can choose which account to authorize for the DApp.

Steps to reproduce

  1. Create two Midnight accounts in Lace (Midnight #0 and Midnight chore(deps): bump peter-evans/create-pull-request from 4 to 5 #1)
  2. Fund Midnight #0 with tNIGHT (so balances differ between accounts)
  3. Switch to Midnight chore(deps): bump peter-evans/create-pull-request from 4 to 5 #1 in Lace UI — confirm it shows Midnight chore(deps): bump peter-evans/create-pull-request from 4 to 5 #1's balance and address
  4. Open a DApp and run:
    const api = await window.midnight.mnLace.connect('preprod');
    const addrs = await api.getShieldedAddresses();
    console.log(addrs.shieldedCoinPublicKey);
  5. Compare the returned key with Midnight #0's and Midnight chore(deps): bump peter-evans/create-pull-request from 4 to 5 #1's known keys
  6. The returned key always matches Midnight #0

Environment

  • macOS (latest), Chrome (latest stable)
  • Lace browser extension 2.0.6, preprod network
  • DApp: Vite + React on localhost:4001
  • @midnight-ntwrk/dapp-connector-api 4.0.1
  • @midnight-ntwrk/midnight-js-contracts 4.0.4

Logs, screenshots, or additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions