1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Enable token detection for the Aurora network, fix primary token for Aurora, update a URL (#19009)

This commit is contained in:
Daniel 2023-05-16 17:57:04 +02:00 committed by GitHub
parent a017a1bae0
commit 471889e5bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 9 deletions

View File

@ -0,0 +1,38 @@
diff --git a/dist/AssetsContractController.js b/dist/AssetsContractController.js
index 332c87d7cc5687dec4d80ec3c51dcc4bda632c32..1d88cd313efb00c9c9b57f6824ed74bbca6349e3 100644
--- a/dist/AssetsContractController.js
+++ b/dist/AssetsContractController.js
@@ -33,6 +33,7 @@ exports.SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID = {
[assetsUtil_1.SupportedTokenDetectionNetworks.bsc]: '0x2352c63A83f9Fd126af8676146721Fa00924d7e4',
[assetsUtil_1.SupportedTokenDetectionNetworks.polygon]: '0x2352c63A83f9Fd126af8676146721Fa00924d7e4',
[assetsUtil_1.SupportedTokenDetectionNetworks.avax]: '0xD023D153a0DFa485130ECFdE2FAA7e612EF94818',
+ [assetsUtil_1.SupportedTokenDetectionNetworks.aurora]: '0x1286415D333855237f89Df27D388127181448538',
};
exports.MISSING_PROVIDER_ERROR = 'AssetsContractController failed to set the provider correctly. A provider must be set for this method to be available';
/**
diff --git a/dist/assetsUtil.d.ts b/dist/assetsUtil.d.ts
index 1b69903a3f8e19f5a451c94791ea16fb18e94d93..d45fe80652fea24d19b2b30dd9af7e6219939153 100644
--- a/dist/assetsUtil.d.ts
+++ b/dist/assetsUtil.d.ts
@@ -45,7 +45,8 @@ export declare enum SupportedTokenDetectionNetworks {
mainnet = "1",
bsc = "56",
polygon = "137",
- avax = "43114"
+ avax = "43114",
+ aurora = "1313161554"
}
/**
* Check if token detection is enabled for certain networks.
diff --git a/dist/assetsUtil.js b/dist/assetsUtil.js
index 4b54e82504cdfae1d937860b0b89b14860385b8e..232228688454d32df818065119dff104f5b0c16c 100644
--- a/dist/assetsUtil.js
+++ b/dist/assetsUtil.js
@@ -120,6 +120,7 @@ var SupportedTokenDetectionNetworks;
SupportedTokenDetectionNetworks["bsc"] = "56";
SupportedTokenDetectionNetworks["polygon"] = "137";
SupportedTokenDetectionNetworks["avax"] = "43114";
+ SupportedTokenDetectionNetworks["aurora"] = "1313161554";
})(SupportedTokenDetectionNetworks = exports.SupportedTokenDetectionNetworks || (exports.SupportedTokenDetectionNetworks = {}));
/**
* Check if token detection is enabled for certain networks.

View File

@ -221,7 +221,8 @@
"@babel/core@>=7.9.0": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch", "@babel/core@>=7.9.0": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch",
"@babel/core@^7.1.0": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch", "@babel/core@^7.1.0": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch",
"@babel/core@^7.12.3": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch", "@babel/core@^7.12.3": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch",
"@babel/core@7.12.9": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch" "@babel/core@7.12.9": "patch:@babel/core@npm%3A7.21.5#./.yarn/patches/@babel-core-npm-7.21.5-c72c337956.patch",
"@metamask/assets-controllers@^6.0.0": "patch:@metamask/assets-controllers@npm%3A6.0.0#./.yarn/patches/@metamask-assets-controllers-npm-6.0.0-0cb763bd07.patch"
}, },
"dependencies": { "dependencies": {
"@actions/core": "^1.10.0", "@actions/core": "^1.10.0",

View File

@ -203,7 +203,7 @@ export const LOCALHOST_RPC_URL = 'http://localhost:8545';
*/ */
export const CURRENCY_SYMBOLS = { export const CURRENCY_SYMBOLS = {
ARBITRUM: 'ETH', ARBITRUM: 'ETH',
AURORA: 'Aurora ETH', AURORA_ETH: 'AURORA ETH',
AVALANCHE: 'AVAX', AVALANCHE: 'AVAX',
BNB: 'BNB', BNB: 'BNB',
BUSD: 'BUSD', BUSD: 'BUSD',
@ -381,6 +381,7 @@ export const NATIVE_CURRENCY_TOKEN_IMAGE_MAP = {
[CURRENCY_SYMBOLS.AVALANCHE]: AVAX_TOKEN_IMAGE_URL, [CURRENCY_SYMBOLS.AVALANCHE]: AVAX_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.OPTIMISM]: OPTIMISM_TOKEN_IMAGE_URL, [CURRENCY_SYMBOLS.OPTIMISM]: OPTIMISM_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.CELO]: CELO_TOKEN_IMAGE_URL, [CURRENCY_SYMBOLS.CELO]: CELO_TOKEN_IMAGE_URL,
[CURRENCY_SYMBOLS.AURORA_ETH]: ETH_TOKEN_IMAGE_URL,
} as const; } as const;
export const INFURA_BLOCKED_KEY = 'countryBlocked'; export const INFURA_BLOCKED_KEY = 'countryBlocked';
@ -575,7 +576,7 @@ export const FEATURED_RPCS: RPCDefinition[] = [
chainId: CHAIN_IDS.AURORA, chainId: CHAIN_IDS.AURORA,
nickname: AURORA_DISPLAY_NAME, nickname: AURORA_DISPLAY_NAME,
rpcUrl: `https://aurora-mainnet.infura.io/v3/${infuraProjectId}`, rpcUrl: `https://aurora-mainnet.infura.io/v3/${infuraProjectId}`,
ticker: CURRENCY_SYMBOLS.AURORA, ticker: CURRENCY_SYMBOLS.AURORA_ETH,
rpcPrefs: { rpcPrefs: {
blockExplorerUrl: 'https://aurorascan.dev/', blockExplorerUrl: 'https://aurorascan.dev/',
imageUrl: AURORA_TOKEN_IMAGE_URL, imageUrl: AURORA_TOKEN_IMAGE_URL,

View File

@ -130,8 +130,7 @@ export const WETH_ARBITRUM_CONTRACT_ADDRESS =
const SWAPS_TESTNET_CHAIN_ID = '0x539'; const SWAPS_TESTNET_CHAIN_ID = '0x539';
export const SWAPS_API_V2_BASE_URL = 'https://swap.metaswap.codefi.network'; export const SWAPS_API_V2_BASE_URL = 'https://swap.metaswap.codefi.network';
export const SWAPS_DEV_API_V2_BASE_URL = export const SWAPS_DEV_API_V2_BASE_URL = 'https://swap.dev-api.cx.metamask.io';
'https://swap.metaswap-dev.codefi.network';
export const GAS_API_BASE_URL = 'https://gas-api.metaswap.codefi.network'; export const GAS_API_BASE_URL = 'https://gas-api.metaswap.codefi.network';
export const GAS_DEV_API_BASE_URL = export const GAS_DEV_API_BASE_URL =
'https://gas-api.metaswap-dev.codefi.network'; 'https://gas-api.metaswap-dev.codefi.network';

View File

@ -73,6 +73,10 @@ describe('network utils', () => {
expect(isTokenDetectionEnabledForNetwork('0xa86a')).toBe(true); expect(isTokenDetectionEnabledForNetwork('0xa86a')).toBe(true);
}); });
it('returns true given the chain ID for Aurora', () => {
expect(isTokenDetectionEnabledForNetwork('0x4e454152')).toBe(true);
});
it('returns false given a string that is not the chain ID for Mainnet, BSC, Polygon, or Avalanche', () => { it('returns false given a string that is not the chain ID for Mainnet, BSC, Polygon, or Avalanche', () => {
expect(isTokenDetectionEnabledForNetwork('some other chain ID')).toBe( expect(isTokenDetectionEnabledForNetwork('some other chain ID')).toBe(
false, false,

View File

@ -39,6 +39,7 @@ export function isTokenDetectionEnabledForNetwork(chainId: string | undefined) {
case CHAIN_IDS.BSC: case CHAIN_IDS.BSC:
case CHAIN_IDS.POLYGON: case CHAIN_IDS.POLYGON:
case CHAIN_IDS.AVALANCHE: case CHAIN_IDS.AVALANCHE:
case CHAIN_IDS.AURORA:
return true; return true;
default: default:
return false; return false;

View File

@ -68,6 +68,7 @@ export function getRenderableTokenData(
(symbol === CURRENCY_SYMBOLS.AVALANCHE && (symbol === CURRENCY_SYMBOLS.AVALANCHE &&
chainId === CHAIN_IDS.AVALANCHE) || chainId === CHAIN_IDS.AVALANCHE) ||
(symbol === CURRENCY_SYMBOLS.ETH && chainId === CHAIN_IDS.OPTIMISM) || (symbol === CURRENCY_SYMBOLS.ETH && chainId === CHAIN_IDS.OPTIMISM) ||
(symbol === CURRENCY_SYMBOLS.ETH && chainId === CHAIN_IDS.AURORA) ||
(symbol === CURRENCY_SYMBOLS.ETH && chainId === CHAIN_IDS.ARBITRUM) (symbol === CURRENCY_SYMBOLS.ETH && chainId === CHAIN_IDS.ARBITRUM)
? iconUrl ? iconUrl
: formatIconUrlWithProxy({ : formatIconUrlWithProxy({

View File

@ -21,6 +21,7 @@ import {
BSC_DISPLAY_NAME, BSC_DISPLAY_NAME,
POLYGON_DISPLAY_NAME, POLYGON_DISPLAY_NAME,
AVALANCHE_DISPLAY_NAME, AVALANCHE_DISPLAY_NAME,
AURORA_DISPLAY_NAME,
CHAIN_ID_TO_RPC_URL_MAP, CHAIN_ID_TO_RPC_URL_MAP,
CHAIN_IDS, CHAIN_IDS,
NETWORK_TYPES, NETWORK_TYPES,
@ -1274,13 +1275,15 @@ export const getTokenDetectionSupportNetworkByChainId = (state) => {
return POLYGON_DISPLAY_NAME; return POLYGON_DISPLAY_NAME;
case CHAIN_IDS.AVALANCHE: case CHAIN_IDS.AVALANCHE:
return AVALANCHE_DISPLAY_NAME; return AVALANCHE_DISPLAY_NAME;
case CHAIN_IDS.AURORA:
return AURORA_DISPLAY_NAME;
default: default:
return ''; return '';
} }
}; };
/** /**
* To check if teh chainId supports token detection , * To check if the chainId supports token detection,
* currently it returns true for Ethereum Mainnet, Polygon, BSC and Avalanche * currently it returns true for Ethereum Mainnet, Polygon, BSC, Avalanche and Aurora
* *
* @param {*} state * @param {*} state
* @returns Boolean * @returns Boolean
@ -1292,6 +1295,7 @@ export function getIsDynamicTokenListAvailable(state) {
CHAIN_IDS.BSC, CHAIN_IDS.BSC,
CHAIN_IDS.POLYGON, CHAIN_IDS.POLYGON,
CHAIN_IDS.AVALANCHE, CHAIN_IDS.AVALANCHE,
CHAIN_IDS.AURORA,
].includes(chainId); ].includes(chainId);
} }
@ -1334,7 +1338,7 @@ export function getIsTokenDetectionInactiveOnMainnet(state) {
/** /**
* To check for the chainId that supports token detection , * To check for the chainId that supports token detection ,
* currently it returns true for Ethereum Mainnet, Polygon, BSC and Avalanche * currently it returns true for Ethereum Mainnet, Polygon, BSC, Avalanche and Aurora
* *
* @param {*} state * @param {*} state
* @returns Boolean * @returns Boolean

View File

@ -3668,7 +3668,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@metamask/assets-controllers@npm:^6.0.0": "@metamask/assets-controllers@npm:6.0.0":
version: 6.0.0 version: 6.0.0
resolution: "@metamask/assets-controllers@npm:6.0.0" resolution: "@metamask/assets-controllers@npm:6.0.0"
dependencies: dependencies:
@ -3702,6 +3702,40 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@metamask/assets-controllers@patch:@metamask/assets-controllers@npm%3A6.0.0#./.yarn/patches/@metamask-assets-controllers-npm-6.0.0-0cb763bd07.patch::locator=metamask-crx%40workspace%3A.":
version: 6.0.0
resolution: "@metamask/assets-controllers@patch:@metamask/assets-controllers@npm%3A6.0.0#./.yarn/patches/@metamask-assets-controllers-npm-6.0.0-0cb763bd07.patch::version=6.0.0&hash=b3036f&locator=metamask-crx%40workspace%3A."
dependencies:
"@ethersproject/bignumber": ^5.7.0
"@ethersproject/contracts": ^5.7.0
"@ethersproject/providers": ^5.7.0
"@metamask/abi-utils": ^1.1.0
"@metamask/approval-controller": ^2.1.0
"@metamask/base-controller": ^2.0.0
"@metamask/contract-metadata": ^2.3.1
"@metamask/controller-utils": ^3.2.0
"@metamask/metamask-eth-abis": 3.0.0
"@metamask/network-controller": ^7.0.0
"@metamask/preferences-controller": ^3.0.0
"@metamask/utils": ^5.0.1
"@types/uuid": ^8.3.0
abort-controller: ^3.0.0
async-mutex: ^0.2.6
babel-runtime: ^6.26.0
eth-query: ^2.1.2
eth-rpc-errors: ^4.0.2
ethereumjs-util: ^7.0.10
immer: ^9.0.6
multiformats: ^9.5.2
single-call-balance-checker-abi: ^1.0.0
uuid: ^8.3.2
peerDependencies:
"@metamask/approval-controller": ^2.1.0
"@metamask/network-controller": ^7.0.0
checksum: 7fcb7d4b62bca0205d8e4d833d40c5b9f5cc6e80a27a3b1f3f3108e7e643121eb2a6f208672fd537e9b372280163fc9029f7f9c1d99ba252d359654a6493affa
languageName: node
linkType: hard
"@metamask/auto-changelog@npm:^2.1.0": "@metamask/auto-changelog@npm:^2.1.0":
version: 2.6.1 version: 2.6.1
resolution: "@metamask/auto-changelog@npm:2.6.1" resolution: "@metamask/auto-changelog@npm:2.6.1"