Skip to content

Commit

Permalink
Merge branch 'develop' into caip25-permission-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jiexi committed Oct 22, 2024
2 parents 155293d + 6b94992 commit 77c7a66
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions shared/constants/network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('NetworkConstants', () => {
'Polygon Mainnet': CHAIN_IDS.POLYGON,
'zkSync Era Mainnet': CHAIN_IDS.ZKSYNC_ERA,
'Base Mainnet': CHAIN_IDS.BASE,
'Linea Mainnet': CHAIN_IDS.LINEA_MAINNET,
};

FEATURED_RPCS.forEach((rpc) => {
Expand Down
14 changes: 14 additions & 0 deletions shared/constants/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,20 @@ export const UNSUPPORTED_RPC_METHODS = new Set([
export const IPFS_DEFAULT_GATEWAY_URL = 'dweb.link';

export const FEATURED_RPCS: AddNetworkFields[] = [
{
chainId: CHAIN_IDS.LINEA_MAINNET,
name: LINEA_MAINNET_DISPLAY_NAME,
nativeCurrency: CURRENCY_SYMBOLS.ETH,
rpcEndpoints: [
{
url: `https://linea-mainnet.infura.io/v3/${infuraProjectId}`,
type: RpcEndpointType.Custom,
},
],
defaultRpcEndpointIndex: 0,
blockExplorerUrls: ['https://lineascan.build/'],
defaultBlockExplorerUrlIndex: 0,
},
{
chainId: CHAIN_IDS.ARBITRUM,
name: ARBITRUM_DISPLAY_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,7 @@ export const NetworkListMenu = ({ onClose }: { onClose: () => void }) => {
const generateNetworkListItem = (network: NetworkConfiguration) => {
const isCurrentNetwork = network.chainId === currentChainId;
const canDeleteNetwork =
isUnlocked &&
!isCurrentNetwork &&
network.chainId !== CHAIN_IDS.MAINNET &&
network.chainId !== CHAIN_IDS.LINEA_MAINNET;
isUnlocked && !isCurrentNetwork && network.chainId !== CHAIN_IDS.MAINNET;

return (
<NetworkListItem
Expand Down
18 changes: 9 additions & 9 deletions ui/ducks/bridge/selectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Bridge selectors', () => {
{ srcNetworkAllowlist: [CHAIN_IDS.ARBITRUM] },
{ toChainId: '0xe708' },
{},
{ ...mockNetworkState(FEATURED_RPCS[0]) },
{ ...mockNetworkState(FEATURED_RPCS[1]) },
);

const result = getFromChain(state as never);
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('Bridge selectors', () => {
);
const result = getAllBridgeableNetworks(state as never);

expect(result).toHaveLength(7);
expect(result).toHaveLength(8);
expect(result[0]).toStrictEqual(
expect.objectContaining({ chainId: FEATURED_RPCS[0].chainId }),
);
Expand Down Expand Up @@ -190,21 +190,19 @@ describe('Bridge selectors', () => {
},
{},
{},
mockNetworkState(...FEATURED_RPCS, {
chainId: CHAIN_IDS.LINEA_MAINNET,
}),
mockNetworkState(...FEATURED_RPCS),
);
const result = getToChains(state as never);

expect(result).toHaveLength(3);
expect(result[0]).toStrictEqual(
expect.objectContaining({ chainId: CHAIN_IDS.OPTIMISM }),
expect.objectContaining({ chainId: CHAIN_IDS.ARBITRUM }),
);
expect(result[1]).toStrictEqual(
expect.objectContaining({ chainId: CHAIN_IDS.POLYGON }),
expect.objectContaining({ chainId: CHAIN_IDS.OPTIMISM }),
);
expect(result[2]).toStrictEqual(
expect.objectContaining({ chainId: CHAIN_IDS.LINEA_MAINNET }),
expect.objectContaining({ chainId: CHAIN_IDS.POLYGON }),
);
});

Expand Down Expand Up @@ -297,7 +295,9 @@ describe('Bridge selectors', () => {
{
...mockNetworkState(
...Object.values(BUILT_IN_NETWORKS),
...FEATURED_RPCS,
...FEATURED_RPCS.filter(
(network) => network.chainId !== CHAIN_IDS.LINEA_MAINNET, // Linea mainnet is both a built in network, as well as featured RPC
),
),
useExternalServices: true,
},
Expand Down

0 comments on commit 77c7a66

Please sign in to comment.