Skip to content

Commit

Permalink
Merge pull request #223 from bnb-chain/feat/tokenApi1216
Browse files Browse the repository at this point in the history
fix: Fix meson token display symbol issue
  • Loading branch information
wenty22 authored Dec 27, 2024
2 parents 4f6e372 + 7caf17e commit 4fa197a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .release/.changeset/itchy-dots-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bnb-chain/canonical-bridge-widget": patch
"@bnb-chain/canonical-bridge-sdk": patch
---

Fix meson token display symbol issue
1 change: 1 addition & 0 deletions .release/.changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"bright-impalas-sniff",
"dull-moose-deliver",
"hungry-doors-lick",
"itchy-dots-enjoy",
"serious-cars-worry"
]
}
6 changes: 6 additions & 0 deletions packages/canonical-bridge-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @bnb-chain/canonical-bridge-sdk

## 0.4.6-alpha.3

### Patch Changes

- Fix meson token display symbol issue

## 0.4.6-alpha.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/canonical-bridge-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bnb-chain/canonical-bridge-sdk",
"version": "0.4.6-alpha.2",
"version": "0.4.6-alpha.3",
"description": "canonical bridge sdk",
"author": "bnb-chain",
"private": false,
Expand Down
6 changes: 6 additions & 0 deletions packages/canonical-bridge-widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @bnb-chain/canonical-bridge-widget

## 0.5.16-alpha.4

### Patch Changes

- Fix meson token display symbol issue

## 0.5.16-alpha.3

### 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.16-alpha.3",
"version": "0.5.16-alpha.4",
"description": "canonical bridge widget",
"author": "bnb-chain",
"private": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,28 @@ export class MesonAdapter extends BaseAdapter<IMesonChain[], IMesonChain, IMeson
chains.forEach((chain) => {
const chainId = chain.chainId === 'tron' ? 728126428 : Number(chain.chainId);

const filteredTokens = chain.tokens.filter((token) => {
const filteredTokens = chain.tokens.filter((token, tokenIndex) => {
const tokenAddress = token.addr ?? '0x0000000000000000000000000000000000000000';

const isExcludedToken = this.checkIsExcludedToken({
excludedList: this.excludedTokens?.[chainId],
tokenSymbol: token?.symbol?.toUpperCase(),
tokenAddress: token.addr ?? '0x0000000000000000000000000000000000000000',
tokenAddress,
});

const anotherTokenIndex = chain.tokens.findIndex(
(e, eIndex) =>
e.symbol.toUpperCase() === token.symbol.toUpperCase() && eIndex !== tokenIndex,
);
const isDuplicatedToken = anotherTokenIndex > -1 && anotherTokenIndex !== tokenIndex;

if (isDuplicatedToken) {
// eslint-disable-next-line no-console
console.log(`Duplicate Meson token ${token.symbol} symbol in ${chain.name}`);
}

// native token transfer requires smart contract deployment. Ignore it for now.
return !isExcludedToken && !isNativeToken(token.addr);
return !isExcludedToken && !isDuplicatedToken && !isNativeToken(tokenAddress);
});

if (filteredTokens.length > 0 && this.chainMap.has(chainId)) {
Expand Down Expand Up @@ -138,7 +152,7 @@ export class MesonAdapter extends BaseAdapter<IMesonChain[], IMesonChain, IMeson
...this.getTokenDisplaySymbolAndIcon({
chainId,
tokenAddress: token.addr ?? '0x0000000000000000000000000000000000000000',
defaultSymbol: token.symbol.toUpperCase(),
defaultSymbol: token.symbol,
}),
};
}
Expand Down

0 comments on commit 4fa197a

Please sign in to comment.