Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuditi committed Apr 29, 2024
1 parent 7ebe148 commit 92cac88
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,21 @@
$: $selectedAccountTokens, searchValue, selectedTab, setFilteredTokenList()
let tokenError: string = ''
let tokenError = ''
$: selectedToken, $sendFlowParameters, void setTokenError()
async function setTokenError(): Promise<void> {
let hasEnoughFunds = false
if (selectedToken && isEvmNetwork(selectedToken.networkId)) {
const hasEnoughFunds = await canAccountMakeEvmTransaction(
hasEnoughFunds = await canAccountMakeEvmTransaction(
$selectedAccountIndex,
selectedToken.networkId,
$sendFlowParameters?.type
)
tokenError = hasEnoughFunds ? '' : localize('error.send.insufficientFundsTransaction')
} else if (selectedToken && isStardustNetwork(selectedToken.networkId)) {
const hasEnoughFunds = canAccountMakeStardustTransaction($selectedAccountIndex, $sendFlowParameters?.type)
tokenError = hasEnoughFunds ? '' : localize('error.send.insufficientFundsTransaction')
} else {
tokenError = ''
hasEnoughFunds = canAccountMakeStardustTransaction($selectedAccountIndex, $sendFlowParameters?.type)
}
tokenError = hasEnoughFunds ? '' : localize('error.send.insufficientFundsTransaction')
}
const tabs = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SendFlowType } from '@core/wallet/enums'
export function canAccountMakeStardustTransaction(
accountIndex: number,
sendFlowType: SendFlowType | undefined
): boolean | undefined {
): boolean {
switch (sendFlowType) {
case SendFlowType.BaseCoinTransfer:
default: {
Expand All @@ -14,7 +14,7 @@ export function canAccountMakeStardustTransaction(
const baseTokenBalance = account?.balances.baseCoin
return BigInt(baseTokenBalance?.available ?? 0) > BigInt(0)
} else {
return undefined
return false
}
}
}
Expand Down

0 comments on commit 92cac88

Please sign in to comment.