Skip to content

Commit

Permalink
Filters for consumer provided tokens (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
abtestingalpha authored Dec 12, 2023
1 parent 3d1ba1d commit f2bd015
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/ui/TokenSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ export function TokenSelect({ label, token, onChange }: Props) {
originTokens,
destinationTokens,
balances,
tokens,
}: BridgeState = useBridgeState()

let options

if (label === 'In') {
options = originTokens
} else {
options = destinationTokens
options = filterTokens(destinationTokens, tokens)
}

return (
Expand All @@ -39,3 +40,12 @@ export function TokenSelect({ label, token, onChange }: Props) {
/>
)
}

const filterTokens = (
destinationTokens: BridgeableToken[],
tokens: BridgeableToken[]
) => {
return destinationTokens.filter((destinationToken) =>
tokens.some((token) => token.routeSymbol === destinationToken.routeSymbol)
)
}

0 comments on commit f2bd015

Please sign in to comment.