Skip to content

Conversation

@jiexi
Copy link
Contributor

@jiexi jiexi commented Apr 15, 2025

  • Adds targets to wallet_announce event data
  • Announces a target with caip-348 and extensionId for chromium metamask extension

See: pedrouid/CAIPs#9
See: ChainAgnostic/CAIPs#348
See: MetaMask/metamask-extension#32070

@jiexi jiexi requested a review from a team April 15, 2025 18:23
const extensionId = providerState?.extensionId;
if (extensionId) {
targets.push({
type: 'caip-348',
Copy link
Contributor Author

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

Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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 };
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh ok

adonesky1
adonesky1 previously approved these changes Apr 16, 2025
Co-authored-by: ffmcgee <51971598+ffmcgee725@users.noreply.github.com>
@jiexi jiexi merged commit c237ed7 into main Apr 17, 2025
17 checks passed
@jiexi jiexi deleted the jl/caip-294-targets branch April 17, 2025 17:33
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Apr 18, 2025
…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?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](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.
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.

4 participants