Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/invoice-dashboard/src/lib/view-requests.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
BigInt(request.expectedAmount),
currencyInfo?.decimals ?? 18
),
currencySymbol: currencyInfo!.symbol,
currencySymbol: currencyInfo?.symbol ?? "-",
paymentCurrencies,
};
}
Expand Down
2 changes: 1 addition & 1 deletion shared/icons/network/network-icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{#if icon}
<div class="network-icon" aria-label={`Network: ${capitalize(network)}`}>
<svelte:component this={icon} />
<span>{capitalize(network)}</span>
<span>{capitalize(network) || "Unknown"}</span>
</div>
{/if}

Expand Down
22 changes: 22 additions & 0 deletions shared/icons/unkown.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<svg
width="24"
height="24"
viewBox="0 0 12 12"
enable-background="new 0 0 12 12"
id="Слой_1"
version="1.1"
xml:space="preserve"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
fill="#000000"
><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g
id="SVGRepo_tracerCarrier"
stroke-linecap="round"
stroke-linejoin="round"
></g><g id="SVGRepo_iconCarrier"
><path
d="M6,0C2.6862793,0,0,2.6862793,0,6s2.6862793,6,6,6s6-2.6862793,6-6S9.3137207,0,6,0z M6.5,9.5h-1v-1h1V9.5z M7.2651367,6.1738281C6.7329102,6.5068359,6.5,6.6845703,6.5,7v0.5h-1V7c0-0.9023438,0.7138672-1.3486328,1.2348633-1.6738281 C7.2670898,4.9931641,7.5,4.8154297,7.5,4.5c0-0.5517578-0.4487305-1-1-1h-1c-0.5512695,0-1,0.4482422-1,1V5h-1V4.5 c0-1.1025391,0.8969727-2,2-2h1c1.1030273,0,2,0.8974609,2,2C8.5,5.4023438,7.7861328,5.8486328,7.2651367,6.1738281z"
fill="#1D1D1B"
></path></g
></svg
>
3 changes: 2 additions & 1 deletion shared/utils/getNetworkIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import OptimismIcon from "../icons/network/optimism.svelte";
import ArbitrumIcon from "../icons/network/arbitrum.svelte";
import MoonbeamIcon from "../icons/network/moonbeam.svelte";
import FantomIcon from "../icons/network/fantom.svelte";
import Unknown from "../icons/unkown.svelte";

export const getNetworkIcon = (network: string) => {
const icons = {
Expand All @@ -35,5 +36,5 @@ export const getNetworkIcon = (network: string) => {
moonbeam: MoonbeamIcon,
};

return icons[network] || EthereumIcon;
return icons[network] || Unknown;
};
32 changes: 6 additions & 26 deletions shared/utils/initCurrencyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,37 +67,17 @@ import { formattedCurrencyConversionPairs } from './currencyConversionPairs'
export function initializeCurrencyManager(
customCurrencies: CurrencyTypes.CurrencyInput[] = []
): CurrencyManager {
let currenciesToUse: any[];

const defaultCurrencies = CurrencyManager.getDefaultList().filter(
(currency) => defaultCurrencyIds.includes(currency.id)
);

currenciesToUse = defaultCurrencies;

// If customCurrencies is provided, use only those
if (customCurrencies?.length > 0) {
currenciesToUse.push(...customCurrencies);
return new CurrencyManager(customCurrencies, {}, formattedCurrencyConversionPairs);
}

// Filter out duplicates based on a unique identifier
currenciesToUse = currenciesToUse.filter(
(currency, index, self) =>
index ===
self.findIndex((t) => {
if (currency.type === Types.RequestLogic.CURRENCY.ETH) {
return t.type === currency.type && t.network === currency.network;
} else if (currency.type === Types.RequestLogic.CURRENCY.ERC20) {
return (
t.network === currency.network &&
t.address?.toLowerCase() === currency.address?.toLowerCase()
);
} else if (currency.type === Types.RequestLogic.CURRENCY.ISO4217) {
return t.type === currency.type && t.symbol === currency.symbol;
}
})
// Otherwise, use default currencies
const defaultCurrencies = CurrencyManager.getDefaultList().filter(
(currency) => defaultCurrencyIds.includes(currency.id)
);

return new CurrencyManager(currenciesToUse, {}, formattedCurrencyConversionPairs);
return new CurrencyManager(defaultCurrencies, {}, formattedCurrencyConversionPairs);
}

export function initializeCurrencyManagerWithCurrencyIDS(
Expand Down
Loading