-
-
Notifications
You must be signed in to change notification settings - Fork 130
feat: Add CAIP-294 targets to wallet_announce event data. Announce CAIP-348 target in initializeProvider
#413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| const extensionId = providerState?.extensionId; | ||
| if (extensionId) { | ||
| targets.push({ | ||
| type: 'caip-348', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've gone back and forth on whether this belongs in a constant, and I don't think it's necessary because we don't do this for other standards numbers. The value itself is already effectively a symbol and moving it to a constant doesn't really buy us additional value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a link to the CAIP PR?
| * @returns Whether the {@link CAIP294Target} is valid. | ||
| */ | ||
| function isValidWalletTarget(data: unknown): data is CAIP294Target { | ||
| return isObject(data) && typeof data.type === 'string' && Boolean(data.type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is Boolean(data.type) just to check that its not an empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah.... it's what Erik had before i think, so i just kept the pattern
| * @property type - The type of the target. SHOULD reference a CAIP number in the `caip-x` format. | ||
| * @property value - The value specifying how to connect to the target as specified by the specification in the `type` property. | ||
| */ | ||
| export type CAIP294Target = { type: string; value?: unknown }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also should we add some links to CAIP-294 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to the PR? it hasn't been merged yet so the link isn't going to be great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meh ok
Co-authored-by: ffmcgee <51971598+ffmcgee725@users.noreply.github.com>
…Multichain API externally_connectable protocol (#32070) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [](https://codespaces.new/MetaMask/metamask-extension/pull/32070?quickstart=1) ## **Related issues** See: MetaMask/test-dapp-multichain#53 See: MetaMask/providers#413 See: MetaMask/multichain-api-client#40 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
targetstowallet_announceevent datacaip-348and extensionId for chromium metamask extensionSee: pedrouid/CAIPs#9
See: ChainAgnostic/CAIPs#348
See: MetaMask/metamask-extension#32070