From 05042b7ea4d0dd127b85fa39252997c233587d75 Mon Sep 17 00:00:00 2001 From: romsters Date: Mon, 17 Jun 2024 05:57:33 +0300 Subject: [PATCH] feat: show ZK token --- packages/app/src/composables/useTokenLibrary.ts | 11 +++++++++++ packages/app/src/configs/dev.config.json | 3 ++- packages/app/src/configs/index.ts | 1 + packages/app/src/configs/production.config.json | 3 ++- packages/app/src/configs/staging.config.json | 3 ++- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/app/src/composables/useTokenLibrary.ts b/packages/app/src/composables/useTokenLibrary.ts index d7e3dc12d0..1fde1511e7 100644 --- a/packages/app/src/composables/useTokenLibrary.ts +++ b/packages/app/src/composables/useTokenLibrary.ts @@ -26,6 +26,17 @@ const retrieveTokens = useMemoize( hasMore = !!tokensParams.minLiquidity && tokensResponse.meta.totalPages > tokensResponse.meta.currentPage; } + if (context.currentNetwork.value.zkTokenAddress) { + 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 5985e43d19..bb80451b47 100644 --- a/packages/app/src/configs/dev.config.json +++ b/packages/app/src/configs/dev.config.json @@ -58,7 +58,8 @@ "name": "mainnet", "published": true, "rpcUrl": "https://mainnet.era.zksync.io", - "tokensMinLiquidity": 0 + "tokensMinLiquidity": 0, + "zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E" } ] } diff --git a/packages/app/src/configs/index.ts b/packages/app/src/configs/index.ts index 4bac0d7c54..f14a721f67 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; }; export type EnvironmentConfig = { diff --git a/packages/app/src/configs/production.config.json b/packages/app/src/configs/production.config.json index 3c173160e9..e3ba298770 100644 --- a/packages/app/src/configs/production.config.json +++ b/packages/app/src/configs/production.config.json @@ -31,7 +31,8 @@ "name": "mainnet", "published": true, "rpcUrl": "https://mainnet.era.zksync.io", - "tokensMinLiquidity": 0 + "tokensMinLiquidity": 0, + "zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E" } ] } diff --git a/packages/app/src/configs/staging.config.json b/packages/app/src/configs/staging.config.json index 97afd00076..102f822365 100644 --- a/packages/app/src/configs/staging.config.json +++ b/packages/app/src/configs/staging.config.json @@ -46,7 +46,8 @@ "name": "mainnet", "published": true, "rpcUrl": "https://mainnet.era.zksync.io", - "tokensMinLiquidity": 0 + "tokensMinLiquidity": 0, + "zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E" } ] }