docs: fix wallet discovery using fixed window.midnight.mnLace key#1080
Open
UtkarshArjariya wants to merge 1 commit into
Open
docs: fix wallet discovery using fixed window.midnight.mnLace key#1080UtkarshArjariya wants to merge 1 commit into
UtkarshArjariya wants to merge 1 commit into
Conversation
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 is attempting to deploy a commit to the Midnight Foundation Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1070.
The DApp Connector API spec (SPECIFICATION.md) has wallets install their
InitialAPIunderwindow.midnightkeyed by a wallet-chosen identifier (typically a freshly-generated UUID), not a fixed property name. The official API reference itself documents discovery viaObject.values(window.midnight ?? {})(seeapi-reference/dapp-connector/README.md), andsdks/community/wallets/integration.mdxdocuments the sameObject.valuesscan as the recommended v4 pattern.Three guides/docs in this repo instead hardcoded
window.midnight.mnLace, which isundefinedagainst current Lace builds and produces exactly the error reported in #1070:docs/guides/react-wallet-connect.mdx— the guide named in the issuedocs/guides/nextjs-wallet-connect.mdx— same anti-pattern, same root causesdks/official/wallet-dev-guide.mdx— DApp integration example with the same bugAll 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
api-reference/dapp-connector/_media/SPECIFICATION.mdandapi-reference/dapp-connector/README.mdthat wallets are keyed by a wallet-chosen id (not a fixed property), and thatObject.values(window.midnight ?? {})is the documented discovery pattern.InitialAPI.nameandInitialAPI.rdnsare documented properties suitable for selecting a specific wallet (api-reference/dapp-connector/type-aliases/InitialAPI.md).