Added different types of tokens.

This commit is contained in:
Filipe Soccol
2024-08-07 14:09:23 -03:00
parent 0a51a80e0c
commit f15361599f
19 changed files with 244 additions and 76 deletions

17
src/utils/imagesPath.ts Normal file
View File

@@ -0,0 +1,17 @@
import type { NetworkEnum, TokenEnum } from "@/model/NetworkEnum";
export const imagesPath = import.meta.glob<string>('@/assets/*.{png,svg}', { eager: true, query: '?url', import: 'default' });
export const getNetworkImage = (networkName: NetworkEnum): string => {
const path = Object.keys(imagesPath).find((key) =>
key.endsWith(`${networkName.toLowerCase()}.svg`)
);
return path ? imagesPath[path] : "";
};
export const getTokenImage = (tokenName: TokenEnum): string => {
const path = Object.keys(imagesPath).find((key) =>
key.endsWith(`${tokenName.toLowerCase()}.svg`)
);
return path ? imagesPath[path] : "";
};