Skip to content

Commit

Permalink
feat: show ZK token
Browse files Browse the repository at this point in the history
  • Loading branch information
Romsters committed Jun 17, 2024
1 parent 02e2224 commit 05042b7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
11 changes: 11 additions & 0 deletions packages/app/src/composables/useTokenLibrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<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
3 changes: 2 additions & 1 deletion packages/app/src/configs/dev.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"name": "mainnet",
"published": true,
"rpcUrl": "https://mainnet.era.zksync.io",
"tokensMinLiquidity": 0
"tokensMinLiquidity": 0,
"zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E"
}
]
}
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;
};

export type EnvironmentConfig = {
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/configs/production.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"name": "mainnet",
"published": true,
"rpcUrl": "https://mainnet.era.zksync.io",
"tokensMinLiquidity": 0
"tokensMinLiquidity": 0,
"zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E"
}
]
}
3 changes: 2 additions & 1 deletion packages/app/src/configs/staging.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"name": "mainnet",
"published": true,
"rpcUrl": "https://mainnet.era.zksync.io",
"tokensMinLiquidity": 0
"tokensMinLiquidity": 0,
"zkTokenAddress": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E"
}
]
}

0 comments on commit 05042b7

Please sign in to comment.