diff --git a/packages/create-invoice-form/src/lib/create-invoice-form.svelte b/packages/create-invoice-form/src/lib/create-invoice-form.svelte index 906aa629..ab75aec0 100644 --- a/packages/create-invoice-form/src/lib/create-invoice-form.svelte +++ b/packages/create-invoice-form/src/lib/create-invoice-form.svelte @@ -115,7 +115,7 @@ totalAmount: 0, }; - $: cipherProvider = undefined; + $: cipherProvider = requestNetwork?.getCipherProvider(); $: { if (wagmiConfig) { diff --git a/packages/invoice-dashboard/src/lib/view-requests.svelte b/packages/invoice-dashboard/src/lib/view-requests.svelte index 90110586..36137d04 100644 --- a/packages/invoice-dashboard/src/lib/view-requests.svelte +++ b/packages/invoice-dashboard/src/lib/view-requests.svelte @@ -152,7 +152,13 @@ if (typeof unwatchAccount === "function") unwatchAccount(); }); - $: cipherProvider = undefined; + $: cipherProvider = + requestNetwork?.getCipherProvider() as CipherProviderTypes.ICipherProvider & { + getSessionSignatures: ( + signer: ethers.Signer, + walletAddress: `0x${string}` + ) => Promise; + }; $: { signer = account?.address; @@ -355,7 +361,7 @@ BigInt(request.expectedAmount), currencyInfo?.decimals ?? 18 ), - currencySymbol: currencyInfo?.symbol, + currencySymbol: currencyInfo?.symbol ?? "-", paymentCurrencies, }; } diff --git a/shared/icons/unkown.svelte b/shared/icons/unkown.svelte new file mode 100644 index 00000000..04d8d09e --- /dev/null +++ b/shared/icons/unkown.svelte @@ -0,0 +1,22 @@ + diff --git a/shared/utils/getNetworkIcon.ts b/shared/utils/getNetworkIcon.ts index c7548a25..a1c86560 100644 --- a/shared/utils/getNetworkIcon.ts +++ b/shared/utils/getNetworkIcon.ts @@ -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 = { @@ -35,5 +36,5 @@ export const getNetworkIcon = (network: string) => { moonbeam: MoonbeamIcon, }; - return icons[network] || EthereumIcon; + return icons[network] || Unknown; }; diff --git a/shared/utils/initCurrencyManager.ts b/shared/utils/initCurrencyManager.ts index 7a11f226..e11048a6 100644 --- a/shared/utils/initCurrencyManager.ts +++ b/shared/utils/initCurrencyManager.ts @@ -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(