Compare commits
3 Commits
7bcf5d90c2
...
5d70b16619
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d70b16619 | ||
|
|
a3e3f0506c | ||
|
|
976c48ac4b |
@@ -15,7 +15,7 @@ const targetNetwork = ref(DEFAULT_NETWORK);
|
|||||||
const web3Onboard = init({
|
const web3Onboard = init({
|
||||||
wallets: [injected],
|
wallets: [injected],
|
||||||
chains: Object.values(Networks).map((network) => ({
|
chains: Object.values(Networks).map((network) => ({
|
||||||
id: network.id,
|
id: `0x${network.id.toString(16)}`,
|
||||||
token: network.nativeCurrency.symbol,
|
token: network.nativeCurrency.symbol,
|
||||||
label: network.name,
|
label: network.name,
|
||||||
rpcUrl: network.rpcUrls.default.http[0],
|
rpcUrl: network.rpcUrls.default.http[0],
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
76
src/assets/networks/rootstock-testnet.svg
Normal file
|
After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 644 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@@ -1,29 +1,11 @@
|
|||||||
import type { TokenEnum } from "@/model/NetworkEnum";
|
import type { TokenEnum } from "@/model/NetworkEnum";
|
||||||
|
import { Networks } from "@/config/networks";
|
||||||
export const imagesPath = import.meta.glob<string>("@/assets/*.{png,svg}", {
|
|
||||||
eager: true,
|
|
||||||
query: "?url",
|
|
||||||
import: "default",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const getNetworkImage = (networkName: string): string => {
|
export const getNetworkImage = (networkName: string): string => {
|
||||||
const imageName = networkName
|
const normalizedName = networkName.toLowerCase().replace(/[^a-z0-9]/g, '-');
|
||||||
.toLowerCase()
|
return new URL(`../assets/networks/${normalizedName}.svg`, import.meta.url).href;
|
||||||
.replace(/[^a-z0-9]/g, '-');
|
|
||||||
try {
|
|
||||||
const path = Object.keys(imagesPath).find((key) =>
|
|
||||||
key.endsWith(`${imageName}.svg`)
|
|
||||||
);
|
|
||||||
return path ? imagesPath[path] : "";
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error fetching network image");
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getTokenImage = (tokenName: TokenEnum): string => {
|
export const getTokenImage = (tokenName: TokenEnum): string => {
|
||||||
const path = Object.keys(imagesPath).find((key) =>
|
return new URL(`../assets/tokens/${tokenName.toLowerCase()}.svg`, import.meta.url).href;
|
||||||
key.endsWith(`${tokenName.toLowerCase()}.svg`)
|
|
||||||
);
|
|
||||||
return path ? imagesPath[path] : "";
|
|
||||||
};
|
};
|
||||||
|
|||||||