-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- 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** Bump Snaps packages and handle any required changes. Summary of Snaps changes: - Add support for onAssetsLookup and onAssetsConversion handlers + the `endowment:assets` permission - Add `Intl` as a default global - Add `Skeleton` component - Add border radius prop to `Image` [](https://codespaces.new/MetaMask/metamask-extension/pull/29920?quickstart=1) ## **Related issues** Closes MetaMask/snaps#3027 Closes MetaMask/snaps#2940 --------- Co-authored-by: David Drazic <[email protected]>
- Loading branch information
1 parent
735e43f
commit 56ec93d
Showing
18 changed files
with
136 additions
and
47 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1841,6 +1841,7 @@ | |
}, | ||
"@metamask/snaps-sdk": { | ||
"globals": { | ||
"URL": true, | ||
"fetch": true | ||
}, | ||
"packages": { | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1854,6 +1854,7 @@ | |
}, | ||
"@metamask/snaps-sdk": { | ||
"globals": { | ||
"URL": true, | ||
"fetch": true | ||
}, | ||
"packages": { | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1841,6 +1841,7 @@ | |
}, | ||
"@metamask/snaps-sdk": { | ||
"globals": { | ||
"URL": true, | ||
"fetch": true | ||
}, | ||
"packages": { | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1933,6 +1933,7 @@ | |
}, | ||
"@metamask/snaps-sdk": { | ||
"globals": { | ||
"URL": true, | ||
"fetch": true | ||
}, | ||
"packages": { | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,7 +216,7 @@ | |
"@trezor/schema-utils@npm:1.0.2": "patch:@trezor/schema-utils@npm%3A1.0.2#~/.yarn/patches/@trezor-schema-utils-npm-1.0.2-7dd48689b2.patch", | ||
"lavamoat-core@npm:^15.1.1": "patch:lavamoat-core@npm%3A15.1.1#~/.yarn/patches/lavamoat-core-npm-15.1.1-51fbe39988.patch", | ||
"lavamoat-core@npm:^16.2.2": "patch:lavamoat-core@npm%3A16.2.2#~/.yarn/patches/lavamoat-core-npm-16.2.2-e361ff1f8a.patch", | ||
"@metamask/snaps-sdk": "^6.15.0", | ||
"@metamask/snaps-sdk": "^6.16.0", | ||
"@swc/[email protected]": "^0.1.6", | ||
"@babel/core": "patch:@babel/core@npm%3A7.25.9#~/.yarn/patches/@babel-core-npm-7.25.9-4ae3bff7f3.patch", | ||
"@babel/runtime": "patch:@babel/runtime@npm%3A7.25.9#~/.yarn/patches/@babel-runtime-npm-7.25.9-fe8c62510a.patch", | ||
|
@@ -345,11 +345,11 @@ | |
"@metamask/selected-network-controller": "^19.0.0", | ||
"@metamask/signature-controller": "^23.1.0", | ||
"@metamask/smart-transactions-controller": "^16.0.1", | ||
"@metamask/snaps-controllers": "^9.17.0", | ||
"@metamask/snaps-execution-environments": "^6.12.0", | ||
"@metamask/snaps-rpc-methods": "^11.9.1", | ||
"@metamask/snaps-sdk": "^6.15.0", | ||
"@metamask/snaps-utils": "^8.8.0", | ||
"@metamask/snaps-controllers": "^9.18.0", | ||
"@metamask/snaps-execution-environments": "^6.13.0", | ||
"@metamask/snaps-rpc-methods": "^11.10.0", | ||
"@metamask/snaps-sdk": "^6.16.0", | ||
"@metamask/snaps-utils": "^8.9.1", | ||
"@metamask/solana-wallet-snap": "^1.1.0", | ||
"@metamask/transaction-controller": "^43.0.0", | ||
"@metamask/user-operation-controller": "^22.0.0", | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
TEST_SNAPS_WEBSITE_URL: 'https://metamask.github.io/snaps/test-snaps/2.18.0', | ||
TEST_SNAPS_WEBSITE_URL: 'https://metamask.github.io/snaps/test-snaps/2.18.1', | ||
}; |
This file contains 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
This file contains 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
17 changes: 17 additions & 0 deletions
17
ui/components/app/snaps/snap-ui-renderer/components/image.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
import { ImageElement } from '@metamask/snaps-sdk/jsx'; | ||
import { UIComponentFactory } from './types'; | ||
|
||
function generateBorderRadius( | ||
borderRadius?: ImageElement['props']['borderRadius'], | ||
) { | ||
switch (borderRadius) { | ||
default: | ||
case 'none': | ||
return '0'; | ||
|
||
case 'medium': | ||
return '6px'; | ||
|
||
case 'full': | ||
return '50%'; | ||
} | ||
} | ||
|
||
export const image: UIComponentFactory<ImageElement> = ({ element }) => ({ | ||
element: 'SnapUIImage', | ||
props: { | ||
value: element.props.src, | ||
borderRadius: generateBorderRadius(element.props.borderRadius), | ||
}, | ||
}); |
This file contains 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
21 changes: 21 additions & 0 deletions
21
ui/components/app/snaps/snap-ui-renderer/components/skeleton.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { SkeletonElement } from '@metamask/snaps-sdk/jsx'; | ||
import { BorderRadius } from '../../../../../helpers/constants/design-system'; | ||
import { mapSnapBorderRadiusToExtensionBorderRadius } from '../utils'; | ||
import { UIComponentFactory } from './types'; | ||
|
||
const DEFAULT_SKELETON_WIDTH = '100%'; | ||
const DEFAULT_SKELETON_HEIGHT = 22; | ||
const DEFAULT_SKELETON_BORDER_RADIUS = BorderRadius.MD; | ||
|
||
export const skeleton: UIComponentFactory<SkeletonElement> = ({ element }) => { | ||
return { | ||
element: 'Skeleton', | ||
props: { | ||
width: element.props.width ?? DEFAULT_SKELETON_WIDTH, | ||
height: element.props.height ?? DEFAULT_SKELETON_HEIGHT, | ||
borderRadius: element.props.borderRadius | ||
? mapSnapBorderRadiusToExtensionBorderRadius(element.props.borderRadius) | ||
: DEFAULT_SKELETON_BORDER_RADIUS, | ||
}, | ||
}; | ||
}; |
This file contains 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
This file contains 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
Oops, something went wrong.