Skip to content

Commit

Permalink
Merge branch 'main' of github.com:matter-labs/block-explorer into sho…
Browse files Browse the repository at this point in the history
…w-native-erc20-token-info-squashd
  • Loading branch information
ilitteri committed Jul 18, 2024
2 parents 03b6e42 + eff76f4 commit 3b2fc55
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/app/src/composables/useTokenLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ const retrieveTokens = useMemoize(
hasMore = !!tokensParams.minLiquidity && tokensResponse.meta.totalPages > tokensResponse.meta.currentPage;
}

if (context.currentNetwork.value.zkTokenAddress) {
const fetchedZkTokenIndex = tokens.findIndex(
(token) => token.l2Address === context.currentNetwork.value.zkTokenAddress
);
if (fetchedZkTokenIndex !== -1) {
const fetchedZkToken = tokens[fetchedZkTokenIndex];
tokens.splice(fetchedZkTokenIndex, 1);
tokens.unshift(fetchedZkToken);
} else {
try {
const zkTokenResponse = await $fetch<Api.Response.Token>(
`${context.currentNetwork.value.apiUrl}/tokens/${context.currentNetwork.value.zkTokenAddress}`
);
tokens.unshift(zkTokenResponse);
} catch (err) {
console.error(`Couldn't fetch ZK token by address: ${context.currentNetwork.value.zkTokenAddress}`);
}
}
}

return tokens;
},
{
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/configs/dev.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"published": true,
"rpcUrl": "https://mainnet.era.zksync.io",
"tokensMinLiquidity": 0,
"zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E",
"baseTokenAddress": "0x000000000000000000000000000000000000800a"
}
]
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type NetworkConfig = {
published: boolean;
hostnames: string[];
tokensMinLiquidity?: number;
zkTokenAddress?: string;
baseTokenAddress: string;
};

Expand Down
1 change: 1 addition & 0 deletions packages/app/src/configs/production.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"published": true,
"rpcUrl": "https://mainnet.era.zksync.io",
"tokensMinLiquidity": 0,
"zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E",
"baseTokenAddress": "0x000000000000000000000000000000000000800a"
}
]
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/configs/staging.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"published": true,
"rpcUrl": "https://mainnet.era.zksync.io",
"tokensMinLiquidity": 0,
"zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E",
"baseTokenAddress": "0x000000000000000000000000000000000000800a"
}
]
Expand Down

0 comments on commit 3b2fc55

Please sign in to comment.