Skip to content

Commit

Permalink
fix: allow withdrawal of any token, fix search
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 committed Oct 6, 2023
1 parent 40490e0 commit aa7e9c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 11 additions & 4 deletions components/token/TokenSelectDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
<template v-else-if="!hasBalances">
<div class="category">
<CommonCardWithLineButtons>
<TokenLine v-for="item in tokens" :key="item.address" v-bind="item" @click="selectedToken = item" />
<TokenLine
v-for="item in displayedTokens"
:key="item.address"
v-bind="item"
@click="selectedToken = item"
/>
</CommonCardWithLineButtons>
</div>
</template>
Expand Down Expand Up @@ -99,14 +104,16 @@ const emit = defineEmits<{
const search = ref("");
const hasBalances = computed(() => props.balances.length > 0);
const displayedBalances = computed(() => {
const filterTokens = (tokens: Token[]) => {
const lowercaseSearch = search.value.toLowerCase();
return props.balances.filter(({ address, symbol }) =>
return tokens.filter(({ address, symbol }) =>
Object.values({ address, symbol })
.filter((e) => typeof e === "string")
.some((value) => value.toLowerCase().includes(lowercaseSearch))
);
});
};
const displayedTokens = computed(() => filterTokens(props.tokens));
const displayedBalances = computed(() => filterTokens(props.balances) as TokenAmount[]);
const balanceGroups = groupBalancesByAmount(displayedBalances);
const selectedTokenAddress = computed({
Expand Down
3 changes: 1 addition & 2 deletions views/zksync/era/transactions/Transfer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ const availableTokens = computed(() => {
const availableBalances = computed(() => {
if (props.type === "withdrawal") {
if (!tokens.value) return [];
// return balance.value.filter((e) => e.l1Address); <-- Uncomment once Era Withdrawal Finalizer is live on mainnet
return balance.value.filter((e) => e.l1Address && tokens.value![e.address]);
return balance.value.filter((e) => e.l1Address);
}
return balance.value;
});
Expand Down

0 comments on commit aa7e9c4

Please sign in to comment.