Closed bergeron closed 16 hours ago
@metamaskbot publish-preview
Preview builds have been published. See these instructions for more information about preview builds.
@metamaskbot publish-preview
Preview builds have been published. See these instructions for more information about preview builds.
Explanation
When querying the price API, the native token is usually represented by the zero address. But this is not the case on some chains like polygon, whose native token has a contract
0x0000000000000000000000000000000000001010
.Note: Extension/mobile would also need to use the exported
getNativeTokenAddress
, so they know where to lookup the native prices in state.Draft extension PR: https://github.com/MetaMask/metamask-extension/pull/28584
References
Changelog
@metamask/assets-controllers
chainIdToNativeTokenAddress
to record chains with unique (non-zero) addressesgetNativeTokenAddress()
exported function to return the correct native token address for native assets (either zero addresses, or the unique addresses recorded inchainIdToNativeTokenAddress
)TokenRatesController
market data mapping to usegetNativeTokenAddress
instead of the zero address for native tokens.Checklist