Skip to content

Commit

Permalink
fix: remove unused symbol prop from SendFundsIconButton
Browse files Browse the repository at this point in the history
  • Loading branch information
alecdwm committed Dec 24, 2024

Verified

This commit was signed with the committer’s verified signature.
mike182uk Michael Barrett
1 parent b0bddc4 commit 00cc67c
Showing 3 changed files with 9 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ const TokenBalances: FC<{ tokenId: TokenId; balances: Balances }> = ({ tokenId,
<span className="mr-2">{chainOrNetwork.name}</span>
<CopyAddressButton networkId={chainOrNetwork.id} />
<Suspense fallback={<SuspenseTracker name="ChainTokenBalances.Buttons" />}>
<SendFundsButton tokenId={token.id} networkId={chainOrNetwork.id} />
<SendFundsButton tokenId={token.id} />
{tokenId && (
<TokenContextMenu
tokenId={tokenId}
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ const TokenBalances: FC<{ tokenId: TokenId; balances: Balances }> = ({ tokenId,
<span className="mr-2 truncate">{chainOrNetwork.name}</span>
<CopyAddressButton networkId={chainOrNetwork.id} />
<Suspense fallback={<SuspenseTracker name="ChainTokenBalances.Buttons" />}>
<SendFundsButton tokenId={token.id} networkId={chainOrNetwork.id} shouldClose />
<SendFundsButton tokenId={token.id} shouldClose />
</Suspense>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,42 +1,25 @@
import { ChainId, EvmNetworkId } from "@talismn/chaindata-provider"
import { TokenId } from "@talismn/chaindata-provider"
import { SendIcon } from "@talismn/icons"
import { useCallback } from "react"
import { Tooltip, TooltipContent, TooltipTrigger } from "talisman-ui"

import { useSendFundsPopup } from "@ui/hooks/useSendFundsPopup"
import { useSetting, useTokens } from "@ui/state"
import { useSetting, useTokensMap } from "@ui/state"
import { isTransferableToken } from "@ui/util/isTransferableToken"

import { usePortfolioNavigation } from "../usePortfolioNavigation"

export const SendFundsButton = ({
networkId,
tokenId,
shouldClose,
...tokenLookup
}: {
networkId: ChainId | EvmNetworkId
tokenId: TokenId
shouldClose?: boolean
} & ({ tokenId: string } | { symbol: string })) => {
const tokenId = "tokenId" in tokenLookup ? tokenLookup.tokenId : undefined
const symbol = "symbol" in tokenLookup ? tokenLookup.symbol : undefined

}) => {
const { selectedAccount } = usePortfolioNavigation()
const [includeTestnets] = useSetting("useTestnets")
const tokens = useTokens({ activeOnly: true, includeTestnets })

const token = tokens?.find(
typeof tokenId === "string"
? // search by tokenId
(t) =>
t.id === tokenId &&
isTransferableToken(t) &&
(("evmNetwork" in t && t.evmNetwork?.id === networkId) || t.chain?.id === networkId)
: // search by token symbol
(t) =>
t.symbol === symbol &&
isTransferableToken(t) &&
(("evmNetwork" in t && t.evmNetwork?.id === networkId) || t.chain?.id === networkId),
)
const tokensMap = useTokensMap({ activeOnly: true, includeTestnets })
const token = isTransferableToken(tokensMap[tokenId]) ? tokensMap[tokenId] : undefined

const { canSendFunds, cannotSendFundsReason, openSendFundsPopup } = useSendFundsPopup(
selectedAccount,

0 comments on commit 00cc67c

Please sign in to comment.