Skip to content

docs: fix wallet discovery using fixed window.midnight.mnLace key#1080

Open
UtkarshArjariya wants to merge 1 commit into
midnightntwrk:mainfrom
UtkarshArjariya:docs/fix-wallet-connector-mnlace-1070
Open

docs: fix wallet discovery using fixed window.midnight.mnLace key#1080
UtkarshArjariya wants to merge 1 commit into
midnightntwrk:mainfrom
UtkarshArjariya:docs/fix-wallet-connector-mnlace-1070

Conversation

@UtkarshArjariya

@UtkarshArjariya UtkarshArjariya commented Jun 22, 2026

Copy link
Copy Markdown

Summary

Fixes #1070.

The DApp Connector API spec (SPECIFICATION.md) has wallets install their InitialAPI under window.midnight keyed by a wallet-chosen identifier (typically a freshly-generated UUID), not a fixed property name. The official API reference itself documents discovery via Object.values(window.midnight ?? {}) (see api-reference/dapp-connector/README.md), and sdks/community/wallets/integration.mdx documents the same Object.values scan as the recommended v4 pattern.

Three guides/docs in this repo instead hardcoded window.midnight.mnLace, which is undefined against current Lace builds and produces exactly the error reported in #1070:

TypeError: Cannot read properties of undefined (reading 'connect')
  • docs/guides/react-wallet-connect.mdx — the guide named in the issue
  • docs/guides/nextjs-wallet-connect.mdx — same anti-pattern, same root cause
  • sdks/official/wallet-dev-guide.mdx — DApp integration example with the same bug

All three now discover the wallet via Object.values(window.midnight ?? {}).find((w) => w.name === 'Lace'), consistent with the discovery pattern already documented elsewhere in this repo.

Test plan

  • Confirmed against api-reference/dapp-connector/_media/SPECIFICATION.md and api-reference/dapp-connector/README.md that wallets are keyed by a wallet-chosen id (not a fixed property), and that Object.values(window.midnight ?? {}) is the documented discovery pattern.
  • Confirmed InitialAPI.name and InitialAPI.rdns are documented properties suitable for selecting a specific wallet (api-reference/dapp-connector/type-aliases/InitialAPI.md).
  • Maintainers/reporter to confirm the fix resolves the "Connect Wallet" button against a real Lace install (I don't have the extension installed in this environment to do a live click-through).

The DApp Connector spec installs each wallet's Initial API under a
wallet-chosen key on window.midnight (commonly a UUID), not a fixed
"mnLace" property, so window.midnight.mnLace is undefined for users
running current Lace builds and the Connect Wallet button throws
"Cannot read properties of undefined (reading 'connect')".

Look up the wallet by its name property instead, matching the
discovery pattern already documented in api-reference/dapp-connector
and sdks/community/wallets/integration.mdx.

Fixes midnightntwrk#1070
@UtkarshArjariya UtkarshArjariya requested review from a team as code owners June 22, 2026 08:58
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

@UtkarshArjariya is attempting to deploy a commit to the Midnight Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

CLAassistant commented Jun 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Connect Wallet" button does not work in "React wallet connector" Guide

2 participants