diff --git a/packages/app/src/composables/useTokenLibrary.ts b/packages/app/src/composables/useTokenLibrary.ts index e6728405c9..8ec3b116ea 100644 --- a/packages/app/src/composables/useTokenLibrary.ts +++ b/packages/app/src/composables/useTokenLibrary.ts @@ -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( + `${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; }, { diff --git a/packages/app/src/configs/dev.config.json b/packages/app/src/configs/dev.config.json index 5db1f5c485..586b97573d 100644 --- a/packages/app/src/configs/dev.config.json +++ b/packages/app/src/configs/dev.config.json @@ -62,6 +62,7 @@ "published": true, "rpcUrl": "https://mainnet.era.zksync.io", "tokensMinLiquidity": 0, + "zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E", "baseTokenAddress": "0x000000000000000000000000000000000000800a" } ] diff --git a/packages/app/src/configs/index.ts b/packages/app/src/configs/index.ts index 8e9d98fd8f..3574216ac1 100644 --- a/packages/app/src/configs/index.ts +++ b/packages/app/src/configs/index.ts @@ -12,6 +12,7 @@ export type NetworkConfig = { published: boolean; hostnames: string[]; tokensMinLiquidity?: number; + zkTokenAddress?: string; baseTokenAddress: string; }; diff --git a/packages/app/src/configs/production.config.json b/packages/app/src/configs/production.config.json index b4b2f7a9ee..2c38d891e2 100644 --- a/packages/app/src/configs/production.config.json +++ b/packages/app/src/configs/production.config.json @@ -33,6 +33,7 @@ "published": true, "rpcUrl": "https://mainnet.era.zksync.io", "tokensMinLiquidity": 0, + "zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E", "baseTokenAddress": "0x000000000000000000000000000000000000800a" } ] diff --git a/packages/app/src/configs/staging.config.json b/packages/app/src/configs/staging.config.json index 18bf193ac8..093beb0d6f 100644 --- a/packages/app/src/configs/staging.config.json +++ b/packages/app/src/configs/staging.config.json @@ -49,6 +49,7 @@ "published": true, "rpcUrl": "https://mainnet.era.zksync.io", "tokensMinLiquidity": 0, + "zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E", "baseTokenAddress": "0x000000000000000000000000000000000000800a" } ]