Skip to content
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

feat: create initial @metamask/multichain package #4812

Merged
merged 8 commits into from
Oct 21, 2024

Conversation

jiexi
Copy link
Contributor

@jiexi jiexi commented Oct 17, 2024

Explanation

Creates the initial (empty) @metamask/multichain package to make downstream additions to this package easier to review.

References

Upstream: #4811
Downstream: #4784

Changelog

@metamask/multichain

  • ADDED: Initial skeleton package for @metamask/multichain

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

Looks good 👍 Can approve after the base is merged.

@adonesky1 adonesky1 force-pushed the controller-utils-isEqualCaseInsensitive branch from 109a7bf to 3c43fce Compare October 18, 2024 22:28
@adonesky1 adonesky1 requested a review from a team as a code owner October 18, 2024 22:28
adonesky1 added a commit that referenced this pull request Oct 21, 2024
…4811)

## Explanation

Moves `isEqualCaseInsensitive()` from assets-controllers into
controller-utils because it will be used elsewhere downstream

## References

Upstream: None. This is the start.
Downstream: #4812

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/controller-utils`

- **ADDED**: Export `isEqualCaseInsensitive()` helper which performs
case insensitive comparison against two strings and returns true if they
are equivalent.

## Checklist

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

---------

Co-authored-by: Mark Stacey <[email protected]>
Co-authored-by: Alex Donesky <[email protected]>
Base automatically changed from controller-utils-isEqualCaseInsensitive to main October 21, 2024 14:48
adonesky1
adonesky1 previously approved these changes Oct 21, 2024
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM

@adonesky1 adonesky1 requested a review from Gudahtt October 21, 2024 16:42
README.md Show resolved Hide resolved
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@adonesky1 adonesky1 merged commit 70bd65f into main Oct 21, 2024
119 checks passed
@adonesky1 adonesky1 deleted the initialize-caip-multichain branch October 21, 2024 18:57
adonesky1 added a commit that referenced this pull request Nov 13, 2024
…4784)

## Explanation

This PR updates `@metamask/multichain` to provide types, CAIP-25
permission, and helpers/adapters for the new permission, which can be
shared across the extension & mobile clients.

These tools and utilities will be used in both clients (mobile +
extension)'s multichain API implementations.

### File Overview

* `packages/multichain/src/adapters/`: Helpers that get and set legacy
permission values from and to the new CAIP-25 permission
* `packages/multichain/src/caip25Permission.ts`: Constants, types,
mutators, and a specification builder for a CAIP-25 permission
*  `packages/multichain/src/index.ts`: Barrel export
* `packages/multichain/src/scope/`: Types for [CAIP-217
](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-217.md)
and our internal normalized/flattened version of them. Additionally
contains helpers for validating shape, normalizing/merging, and checking
support (i.e. if the wallet is able to serve the chain with it's
requested methods and notifications)

## References

Upstream: #4812
Downstream: #4813

Key Multichain API Standards implemented here:
-
[CAIP-217](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-217.md)
- `scope` defintion

Open PR that uses this new package for migrating the legacy permissions
to CAIP-25 permission in the extension:
MetaMask/metamask-extension#27847

## Changelog


### `@metamask/multichain`

- **ADDED**: TODO

## Checklist

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

---------

Co-authored-by: Alex <[email protected]>
Co-authored-by: Mark Stacey <[email protected]>
Co-authored-by: Elliot Winkler <[email protected]>
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.

3 participants