Skip to content

Commit

Permalink
Merge branch 'main' into caip-multichain-api
Browse files Browse the repository at this point in the history
  • Loading branch information
jiexi committed Jan 21, 2025
2 parents ab3ce47 + 1a79b53 commit 7b09a5c
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 14 deletions.
2 changes: 1 addition & 1 deletion eslint-warning-thresholds.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"n/no-unsupported-features/node-builtins": 18,
"n/prefer-global/text-encoder": 4,
"n/prefer-global/text-decoder": 4,
"prettier/prettier": 118,
"prettier/prettier": 115,
"promise/always-return": 3,
"promise/catch-or-return": 2,
"promise/param-names": 8,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/core-monorepo",
"version": "285.0.0",
"version": "286.0.0",
"private": true,
"description": "Monorepo for packages shared between MetaMask clients",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,4 +538,126 @@ describe('ERC721Standard', () => {
);
expect(details).toMatchObject(expectedResult);
});

it('should get correct details including tokenURI and image for a given contract (that supports the ERC721 metadata interface) with a tokenID provided when the tokenURI content is hosted on IPFS & image starts with "ipfs://"', async () => {
nock('https://mainnet.infura.io:443', { encodedQueryParams: true })
.post('/v3/341eacb578dd44a1a049cbc5f6fd4035', {
jsonrpc: '2.0',
id: 25,
method: 'eth_call',
params: [
{
to: '0xbd3531da5cf5857e7cfaa92426877b022e612cf8',
data: '0x01ffc9a780ac58cd00000000000000000000000000000000000000000000000000000000',
},
'latest',
],
})
.reply(200, {
jsonrpc: '2.0',
id: 25,
result:
'0x0000000000000000000000000000000000000000000000000000000000000001',
})
.post('/v3/341eacb578dd44a1a049cbc5f6fd4035', {
jsonrpc: '2.0',
id: 26,
method: 'eth_call',
params: [
{
to: '0xbd3531da5cf5857e7cfaa92426877b022e612cf8',
data: '0x95d89b41',
},
'latest',
],
})
.reply(200, {
jsonrpc: '2.0',
id: 26,
result:
'0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000035050470000000000000000000000000000000000000000000000000000000000',
})
.post('/v3/341eacb578dd44a1a049cbc5f6fd4035', {
jsonrpc: '2.0',
id: 27,
method: 'eth_call',
params: [
{
to: '0xbd3531da5cf5857e7cfaa92426877b022e612cf8',
data: '0x06fdde03',
},
'latest',
],
})
.reply(200, {
jsonrpc: '2.0',
id: 27,
result:
'0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d507564677950656e6775696e7300000000000000000000000000000000000000',
})
.post('/v3/341eacb578dd44a1a049cbc5f6fd4035', {
jsonrpc: '2.0',
id: 28,
method: 'eth_call',
params: [
{
to: '0xbd3531da5cf5857e7cfaa92426877b022e612cf8',
data: '0x01ffc9a75b5e139f00000000000000000000000000000000000000000000000000000000',
},
'latest',
],
})
.reply(200, {
jsonrpc: '2.0',
id: 28,
result:
'0x0000000000000000000000000000000000000000000000000000000000000001',
})
.post('/v3/341eacb578dd44a1a049cbc5f6fd4035', {
jsonrpc: '2.0',
id: 29,
method: 'eth_call',
params: [
{
to: '0xbd3531da5cf5857e7cfaa92426877b022e612cf8',
data: '0xc87b56dd000000000000000000000000000000000000000000000000000000000000065b',
},
'latest',
],
})
.reply(200, {
jsonrpc: '2.0',
id: 29,
result:
'0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000047697066733a2f2f6261667962656962633573676f32706c6d6a6b7132747a6d68726e3534626b336372686e6332337a64326d73673465613761347078726b67666e612f3136323700000000000000000000000000000000000000000000000000',
});

nock(
'https://bafybeibc5sgo2plmjkq2tzmhrn54bk3crhnc23zd2msg4ea7a4pxrkgfna.ipfs.dweb.link',
)
.get('/1627')
.reply(200, () => {
return {
image:
'ipfs://QmNf1UsmdGaMbpatQ6toXSkzDpizaGmC9zfunCyoz1enD5/penguin/1627.png',
};
});

const expectedResult = {
standard: 'ERC721',
tokenURI:
'https://bafybeibc5sgo2plmjkq2tzmhrn54bk3crhnc23zd2msg4ea7a4pxrkgfna.ipfs.dweb.link/1627',
symbol: 'PPG',
name: 'PudgyPenguins',
image:
'https://bafybeiaewpyqaytvogprfiv563tfkjhepkkz5mn57pr5z3kyag62kfuc7a.ipfs.dweb.link/penguin/1627.png',
};

const details = await erc721Standard.getDetails(
'0xBd3531dA5CF5857e7CfAA92426877b022e612cf8',
'dweb.link',
'1627',
);
expect(details).toMatchObject(expectedResult);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class ERC721Standard {
const object = await response.json();
image = object?.image;
if (image?.startsWith('ipfs://')) {
image = getFormattedIpfsUrl(ipfsGateway, image, true);
image = await getFormattedIpfsUrl(ipfsGateway, image, true);
}
} catch {
// ignore
Expand Down
18 changes: 16 additions & 2 deletions packages/queued-request-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [9.0.0]

### Added

- **BREAKING:** `createQueuedRequestMiddleware` now expects a `useRequestQueue` option ([#5065](https://github.com/MetaMask/core/pull/5065))
- This was previously removed in 20.0.0, but has been re-added for compatibility with Mobile.

### Changed

- Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.0` ([#5079](https://github.com/MetaMask/core/pull/5079))
- **BREAKING:** Bump peer dependency `@metamask/selected-network-controller` from `^20.0.2` to `^21.0.0` ([#5178](https://github.com/MetaMask/core/pull/5178))
- Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.1` ([#5079](https://github.com/MetaMask/core/pull/5079)), [#5135](https://github.com/MetaMask/core/pull/5135))
- Bump `@metamask/controller-utils` from `^11.4.4` to `^11.4.5` ([#5135](https://github.com/MetaMask/core/pull/5135))
- Bump `@metamask/json-rpc-engine` from `^10.0.1` to `^10.0.2` ([#5082](https://github.com/MetaMask/core/pull/5082))
- Bump `@metamask/rpc-errors` from `^7.0.1` to `^7.0.2` ([#5080](https://github.com/MetaMask/core/pull/5080))
- Bump `@metamask/utils` from `^10.0.0` to `^11.0.1` ([#5080](https://github.com/MetaMask/core/pull/5080))
- This upgrade is not a breaking change because this package does not use `generateRandomMnemonic`.

## [8.0.2]

Expand Down Expand Up @@ -324,7 +337,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial release

[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[9.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[8.0.2]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[8.0.1]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[8.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
Expand Down
6 changes: 3 additions & 3 deletions packages/queued-request-controller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/queued-request-controller",
"version": "8.0.2",
"version": "9.0.0",
"description": "Includes a controller and middleware that implements a request queue",
"keywords": [
"MetaMask",
Expand Down Expand Up @@ -57,7 +57,7 @@
"devDependencies": {
"@metamask/auto-changelog": "^3.4.4",
"@metamask/network-controller": "^22.1.1",
"@metamask/selected-network-controller": "^20.0.2",
"@metamask/selected-network-controller": "^21.0.0",
"@types/jest": "^27.4.1",
"deepmerge": "^4.2.2",
"immer": "^9.0.6",
Expand All @@ -72,7 +72,7 @@
},
"peerDependencies": {
"@metamask/network-controller": "^22.0.0",
"@metamask/selected-network-controller": "^20.0.0"
"@metamask/selected-network-controller": "^21.0.0"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
15 changes: 13 additions & 2 deletions packages/selected-network-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [21.0.0]

### Added

- **BREAKING:** The `SelectedNetworkController` constructor now expects both `useRequestQueuePreference` and `onPreferencesStateChange` options ([#5065](https://github.com/MetaMask/core/pull/5065))
- These were previously removed in 20.0.0, but have been re-added for compatibility with Mobile.

### Changed

- Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.0` ([#5079](https://github.com/MetaMask/core/pull/5079))
- Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.1` ([#5079](https://github.com/MetaMask/core/pull/5079)), [#5135](https://github.com/MetaMask/core/pull/5135))
- Bump `@metamask/json-rpc-engine` from `^10.0.1` to `^10.0.2` ([#5082](https://github.com/MetaMask/core/pull/5082))
- Bump `@metamask/utils` from `^10.0.0` to `^11.0.1` ([#5080](https://github.com/MetaMask/core/pull/5080))
- This upgrade is not a breaking change because this package does not use `generateRandomMnemonic`.

## [20.0.2]

Expand Down Expand Up @@ -327,7 +337,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial Release ([#1643](https://github.com/MetaMask/core/pull/1643))

[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/[email protected]
[21.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[20.0.2]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[20.0.1]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
[20.0.0]: https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion packages/selected-network-controller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/selected-network-controller",
"version": "20.0.2",
"version": "21.0.0",
"description": "Provides an interface to the currently selected networkClientId for a given domain",
"keywords": [
"MetaMask",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3719,7 +3719,7 @@ __metadata:
"@metamask/json-rpc-engine": "npm:^10.0.2"
"@metamask/network-controller": "npm:^22.1.1"
"@metamask/rpc-errors": "npm:^7.0.2"
"@metamask/selected-network-controller": "npm:^20.0.2"
"@metamask/selected-network-controller": "npm:^21.0.0"
"@metamask/swappable-obj-proxy": "npm:^2.3.0"
"@metamask/utils": "npm:^11.0.1"
"@types/jest": "npm:^27.4.1"
Expand All @@ -3735,7 +3735,7 @@ __metadata:
typescript: "npm:~5.2.2"
peerDependencies:
"@metamask/network-controller": ^22.0.0
"@metamask/selected-network-controller": ^20.0.0
"@metamask/selected-network-controller": ^21.0.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -3806,7 +3806,7 @@ __metadata:
languageName: node
linkType: hard

"@metamask/selected-network-controller@npm:^20.0.2, @metamask/selected-network-controller@workspace:packages/selected-network-controller":
"@metamask/selected-network-controller@npm:^21.0.0, @metamask/selected-network-controller@workspace:packages/selected-network-controller":
version: 0.0.0-use.local
resolution: "@metamask/selected-network-controller@workspace:packages/selected-network-controller"
dependencies:
Expand Down

0 comments on commit 7b09a5c

Please sign in to comment.