Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/chain search #175

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .release/.changeset/light-emus-switch.md

This file was deleted.

13 changes: 0 additions & 13 deletions .release/.changeset/pre.json

This file was deleted.

5 changes: 0 additions & 5 deletions .release/.changeset/sharp-dryers-hear.md

This file was deleted.

5 changes: 0 additions & 5 deletions .release/.changeset/slimy-crabs-know.md

This file was deleted.

15 changes: 15 additions & 0 deletions packages/canonical-bridge-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @bnb-chain/canonical-bridge-widget

## 0.5.8

### Patch Changes

- 49e31fc: Update token list sort rules
- f86dcd0: Show token address on `You Receive`
- f86dcd0: Support searching token by address
- f86dcd0: Show token address on `You Receive`

## 0.5.8-alpha.5

### Patch Changes

- Update token list sort rules

## 0.5.8-alpha.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/canonical-bridge-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bnb-chain/canonical-bridge-widget",
"version": "0.5.8-alpha.4",
"version": "0.5.8",
"description": "canonical bridge widget",
"author": "bnb-chain",
"private": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function SourceNetworkModal(props: SourceNetworkModalProps) {
});

const { isNoResult, result, onSearch } = useSearch({
filter: (item, keyword) => item.name.toLowerCase().includes(keyword),
filter: (item, keyword) => item.name.toLowerCase().includes(keyword.toLowerCase()),
sorter: (a) => (fromChain?.id === a.id ? -1 : 0),
data: fromChains,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,11 @@ export function useTokenList(tokens: IBridgeToken[] = [], keyword?: string) {
const sortedTokens = sortTokens({
tokens: tmpTokens,
orders: transferConfig.order?.tokens,
})
.sort((a, b) => {
if (keyword) {
const isA = isChainOrTokenCompatible(a);
const isB = isChainOrTokenCompatible(b);
const findA = a.displaySymbol?.toLowerCase()?.includes(keyword?.toLowerCase());
const findB = b.displaySymbol?.toLowerCase()?.includes(keyword?.toLowerCase());

if (findA && isA) {
return -1;
}
if (findB && isB) {
return 1;
}
}
return 0;
})
.sort((a) => {
return isSameAddress(a.address, selectedToken?.address) && isChainOrTokenCompatible(a)
? -1
: 0;
});
}).sort((a) => {
return isSameAddress(a.address, selectedToken?.address) && isChainOrTokenCompatible(a)
? -1
: 0;
});

return sortedTokens;
}, [
Expand All @@ -68,7 +51,6 @@ export function useTokenList(tokens: IBridgeToken[] = [], keyword?: string) {
getTokenBalance,
getTokenPrice,
selectedToken?.address,
keyword,
]);

return { data: sortedTokens, isLoading: isLoadingTokenBalances || isLoadingTokenPrices };
Expand Down
Loading