Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add inEVM Mainnet (chain 2525) and ICB Network (chain 73115) to `SPOT_PRICES_SUPPORT_INFO` ([#8887](https://github.com/MetaMask/core/pull/8887))

### Changed

- Bump `@metamask/transaction-controller` from `^65.3.0` to `^66.0.0` ([#8796](https://github.com/MetaMask/core/pull/8796), [#8848](https://github.com/MetaMask/core/pull/8848))
Expand All @@ -15,6 +19,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump `@metamask/network-enablement-controller` from `^5.1.1` to `^5.2.0` ([#8834](https://github.com/MetaMask/core/pull/8834))
- Bump `@metamask/polling-controller` from `^16.0.5` to `^16.0.6` ([#8834](https://github.com/MetaMask/core/pull/8834))

### Fixed

- Fix incorrect hex key for Blast Mainnet in `SPOT_PRICES_SUPPORT_INFO` (`0x13c31` → `0x13e31`), which previously caused native-token price fetching to silently fail for that chain ([#8887](https://github.com/MetaMask/core/pull/8887))
- Remove Forma (chain 984122) from `SPOT_PRICES_SUPPORT_INFO` as it is not supported by the price API ([#8887](https://github.com/MetaMask/core/pull/8887))

## [108.1.0]

### Added
Expand Down
26 changes: 15 additions & 11 deletions packages/assets-controllers/src/token-prices-service/codefi-v2.ts
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reordered the object keys, added a couple of missing chains for which we have support and removed one that had no prices (other than Tempo, which is a valid exception as there's no native asset).

Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ export const ZERO_ADDRESS: Hex =
*/
const chainIdToNativeTokenAddress: Record<Hex, Hex> = {
'0x89': '0x0000000000000000000000000000000000001010', // Polygon
'0x440': '0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000', // Metis Andromeda
'0x1388': '0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000', // Mantle
'0x64': '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d', // Gnosis
'0x1e': '0x542fda317318ebf1d3deaf76e0b632741a7e677d', // Rootstock Mainnet - Native symbol: RBTC
'0x64': '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d', // Gnosis
'0x3dc': '0x779ded0c9e1022225f8e0630b35a9b54be713736', // Stable - Native symbol: USDT0
'0x440': '0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000', // Metis Andromeda
'0x1388': '0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000', // Mantle
};

/**
Expand All @@ -247,7 +247,10 @@ export const getNativeTokenAddress = (chainId: Hex): Hex =>
chainIdToNativeTokenAddress[chainId] ?? ZERO_ADDRESS;

// Source: https://github.com/consensys-vertical-apps/va-mmcx-price-api/blob/main/src/constants/slip44.ts
// We can only support PricesAPI V3 for EVM chains that have a CAIP-19 native asset mapping.
// This list is ONLY for chains that are supported by the Price API v3/spot-prices endpoint.
// Please check that endpoint returns a price for the given assetId before including it in this list.
// Please include a comment with the name of the chain and the native symbol.
// Please keep the list sorted by chain ID.
export const SPOT_PRICES_SUPPORT_INFO = {
'0x1': 'eip155:1/slip44:60', // Ethereum Mainnet - Native symbol: ETH
'0xa': 'eip155:10/slip44:60', // OP Mainnet - Native symbol: ETH
Expand All @@ -270,13 +273,13 @@ export const SPOT_PRICES_SUPPORT_INFO = {
'0xe8': 'eip155:232/erc20:0x0000000000000000000000000000000000000000', // Lens Mainnet - Native symbol: GHO
'0xfa': 'eip155:250/slip44:1007', // Fantom Opera - Native symbol: FTM
'0xfc': 'eip155:252/erc20:0x0000000000000000000000000000000000000000', // Fraxtal - native symbol: FRAX
'0x10b3e': 'eip155:68414/erc20:0x0000000000000000000000000000000000000000', // MapleStory Universe - no slip44
'0x120': 'eip155:288/slip44:60', // Boba Network (Ethereum L2) - Native symbol: ETH
'0x141': 'eip155:321/slip44:641', // KCC Mainnet - Native symbol: KCS
'0x144': 'eip155:324/slip44:60', // zkSync Era Mainnet (Ethereum L2) - Native symbol: ETH
'0x150': 'eip155:336/slip44:809', // Shiden - Native symbol: SDN
'0x169': 'eip155:361/slip44:589', // Theta Mainnet - Native symbol: TFUEL
'0x2eb': 'eip155:747/slip44:539', // Flow evm - Native symbol: Flow
'0x3dc': 'eip155:988/erc20:0x779ded0c9e1022225f8e0630b35a9b54be713736', // Stable - Native symbol: USDT0
'0x3e7': 'eip155:999/slip44:2457', // HyperEVM - Native symbol: HYPE
'0x440': 'eip155:1088/erc20:0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000', // Metis Andromeda Mainnet (Ethereum L2) - Native symbol: METIS
'0x44d': 'eip155:1101/slip44:60', // Polygon zkEVM mainnet - Native symbol: ETH
Expand All @@ -285,11 +288,12 @@ export const SPOT_PRICES_SUPPORT_INFO = {
'0x531': 'eip155:1329/slip44:19000118', // Sei Mainnet - Native symbol: SEI
'0x6f0': 'eip155:1776/slip44:22000119', // Injective Mainnet - Native symbol: INJ
'0x74c': 'eip155:1868/erc20:0x0000000000000000000000000000000000000000', // Soneium - Native symbol: ETH
'0xa729': 'eip155:42793/erc20:0x0000000000000000000000000000000000000000', // Etherlink - Native symbol: XTZ (Tezos L2)
'0x9dd': 'eip155:2525/erc20:0x0000000000000000000000000000000000000000', // inEVM Mainnet - Native symbol: INV
'0xab5': 'eip155:2741/erc20:0x0000000000000000000000000000000000000000', // Abstract - Native symbol: ETH
'0x1079': 'eip155:4217/slip44:60', // Tempo Mainnet - No native asset
'0x10e6': 'eip155:4326/erc20:0x0000000000000000000000000000000000000000', // MegaETH Mainnet - Native symbol: ETH
'0x1388': 'eip155:5000/erc20:0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000', // Mantle - Native symbol: MNT
'0x1b58': 'eip155:7000/slip44:7000', // ZetaChain - Native symbol: ZETA
'0x2105': 'eip155:8453/slip44:60', // Base - Native symbol: ETH
'0x2611': 'eip155:9745/erc20:0x0000000000000000000000000000000000000000', // Plasma mainnet - native symbol: XPL
'0x2710': 'eip155:10000/slip44:145', // Smart Bitcoin Cash - Native symbol: BCH
Expand All @@ -298,13 +302,17 @@ export const SPOT_PRICES_SUPPORT_INFO = {
'0xa4b1': 'eip155:42161/slip44:60', // Arbitrum One - Native symbol: ETH
'0xa4ec': 'eip155:42220/slip44:52752', // Celo Mainnet - Native symbol: CELO
'0xa516': 'eip155:42262/slip44:474', // Oasis Emerald - Native symbol: ROSE
'0xa729': 'eip155:42793/erc20:0x0000000000000000000000000000000000000000', // Etherlink - Native symbol: XTZ (Tezos L2)
'0xa867': 'eip155:43111/erc20:0x0000000000000000000000000000000000000000', // Hemi - Native symbol: ETH
'0xa86a': 'eip155:43114/slip44:9005', // Avalanche C-Chain - Native symbol: AVAX
'0xa5bf': 'eip155:42431/slip44:60', // Tempo Testnet Moderato - No native asset
'0xdef1': 'eip155:57073/slip44:60', // Ink Mainnet - Native symbol: ETH
'0xe708': 'eip155:59144/slip44:60', // Linea Mainnet - Native symbol: ETH
'0xed88': 'eip155:60808/erc20:0x0000000000000000000000000000000000000000', // BOB - Native symbol: ETH
'0x10b3e': 'eip155:68414/erc20:0x0000000000000000000000000000000000000000', // MapleStory Universe - no slip44
'0x11d9b': 'eip155:73115/erc20:0x0000000000000000000000000000000000000000', // ICB Network - Native symbol: ICBX,
'0x138de': 'eip155:80094/erc20:0x0000000000000000000000000000000000000000', // Berachain - Native symbol: Bera',
'0x13c31': 'eip155:81457/slip44:60', // Blast Mainnet - Native symbol: ETH
'0x13e31': 'eip155:81457/slip44:60', // Blast Mainnet - Native symbol: ETH
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This one had a typo in the key.

'0x15b38': 'eip155:88888/erc20:0x0000000000000000000000000000000000000000', // Chiliz Chain - Native symbol: CHZ
'0x17dcd': 'eip155:97741/erc20:0x0000000000000000000000000000000000000000', // Pepe Unchained Mainnet - Native symbol: PEPU
'0x18232': 'eip155:98866/erc20:0x0000000000000000000000000000000000000000', // Plume Mainnet - Narive symbol: Plume
Expand All @@ -315,10 +323,6 @@ export const SPOT_PRICES_SUPPORT_INFO = {
'0x15f900': 'eip155:1440000/erc20:0x0000000000000000000000000000000000000000', // xrpl-evm - native symbol: XRP
'0x4e454152': 'eip155:1313161554/slip44:60', // Aurora Mainnet (Ethereum L2 on NEAR) - Native symbol: ETH
'0x63564c40': 'eip155:1666600000/slip44:1023', // Harmony Mainnet Shard 0 - Native symbol: ONE
'0xdef1': 'eip155:57073/slip44:60', // Ink Mainnet - Native symbol: ETH
'0x3dc': 'eip155:988/erc20:0x779ded0c9e1022225f8e0630b35a9b54be713736', // Stable - Native symbol: USDT0
'0xf043a': 'eip155:984122/slip44:984122', // Forma - Native symbol: TIA (Celestia)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed Forma as it is not supported by price api.

Reordered the other keys.

'0x1b58': 'eip155:7000/slip44:7000', // ZetaChain - Native symbol: ZETA
} as const;

// MISSING CHAINS WITH NO NATIVE ASSET PRICES
Expand Down
Loading