diff --git a/src/components/Claim/useClaimLink.tsx b/src/components/Claim/useClaimLink.tsx index fdf494a1..8217b5de 100644 --- a/src/components/Claim/useClaimLink.tsx +++ b/src/components/Claim/useClaimLink.tsx @@ -83,9 +83,11 @@ export const useClaimLink = () => { try { await switchNetworkUtil({ chainId, - currentChainId: currentChain?.id, + currentChainId: String(currentChain?.id), setLoadingState, - switchChainAsync, + switchChainAsync: async ({ chainId }) => { + await switchChainAsync({ chainId: chainId as number }); + }, }) console.log(`Switched to chain ${chainId}`) } catch (error) { diff --git a/src/components/Create/useCreateLink.tsx b/src/components/Create/useCreateLink.tsx index f960304f..674be1c4 100644 --- a/src/components/Create/useCreateLink.tsx +++ b/src/components/Create/useCreateLink.tsx @@ -203,9 +203,11 @@ export const useCreateLink = () => { try { await switchNetworkUtil({ chainId, - currentChainId: currentChain?.id, + currentChainId: String(currentChain?.id), setLoadingState, - switchChainAsync, + switchChainAsync: async ({ chainId }) => { + await switchChainAsync({ chainId: chainId as number }); + }, }) console.log(`Switched to chain ${chainId}`) } catch (error) { diff --git a/src/components/Global/TokenSelector/Components/AdvancedButton.tsx b/src/components/Global/TokenSelector/Components/AdvancedButton.tsx index dfe10daf..50fa04dc 100644 --- a/src/components/Global/TokenSelector/Components/AdvancedButton.tsx +++ b/src/components/Global/TokenSelector/Components/AdvancedButton.tsx @@ -126,7 +126,7 @@ export const AdvancedTokenSelectorButton = ({ ))} {tokenAmount && tokenPrice && (

- ${utils.formatTokenAmount(Number(tokenAmount ?? 0) * tokenPrice ?? 0, 4)} + ${utils.formatTokenAmount(Number(tokenAmount) * tokenPrice, 4)}

)} diff --git a/src/components/Request/Pay/Views/Initial.view.tsx b/src/components/Request/Pay/Views/Initial.view.tsx index 7ca127a5..f575053a 100644 --- a/src/components/Request/Pay/Views/Initial.view.tsx +++ b/src/components/Request/Pay/Views/Initial.view.tsx @@ -13,7 +13,7 @@ import { peanut } from '@squirrel-labs/peanut-sdk' import TokenSelector from '@/components/Global/TokenSelector/TokenSelector' import { switchNetwork as switchNetworkUtil } from '@/utils/general.utils' import { ADDRESS_ZERO, EPeanutLinkType } from '../utils' -import { ethers } from 'ethersv5' +import { ethers } from 'ethers' export const InitialView = ({ onNext, @@ -74,9 +74,11 @@ export const InitialView = ({ try { await switchNetworkUtil({ chainId, - currentChainId: currentChain?.id, + currentChainId: String(currentChain?.id), setLoadingState, - switchChainAsync, + switchChainAsync: async ({ chainId }) => { + await switchChainAsync({ chainId: chainId as number }); + }, }) console.log(`Switched to chain ${chainId}`) } catch (error) { @@ -85,7 +87,7 @@ export const InitialView = ({ } const handleOnNext = async () => { - if (selectedChainID !== currentChain) { + if (selectedChainID !== String(currentChain?.id)) { await switchNetwork(selectedChainID) } try { @@ -265,7 +267,7 @@ export const InitialView = ({ requestLinkData.tokenAddress === selectedTokenAddress ? ( 0 + estimatedGasCost && estimatedGasCost > 0 ? `This transaction will cost you $${utils.formatTokenAmount(estimatedGasCost, 3)} in network fees.` : 'This transaction is sponsored by peanut! Enjoy!' }