Skip to content

Commit

Permalink
Merge pull request #283 from bnb-chain/wenty/aggregator
Browse files Browse the repository at this point in the history
feat: Use provider's icon
  • Loading branch information
wenty22 authored Jan 13, 2025
2 parents 718c5f8 + e4a1d6a commit 45ba966
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/canonical-bridge-sdk/src/adapters/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ export abstract class BaseAdapter<G extends object, C = unknown, T = unknown> {
chainId,
defaultSymbol,
tokenAddress,
icon,
}: {
chainId: number;
defaultSymbol: string;
tokenAddress: string;
icon?: string | null;
}) {
const symbolMap = this.displayTokenSymbols[chainId] ?? {};

Expand All @@ -150,11 +152,11 @@ export abstract class BaseAdapter<G extends object, C = unknown, T = unknown> {

const displaySymbol = target?.[1] ?? defaultSymbol;
const iconSymbol = displaySymbol?.toUpperCase();
const icon = `${this.assetPrefix}/images/tokens/${iconSymbol}.png?v=${__APP_VERSION__}`;
const commonTokenIcon = `${this.assetPrefix}/images/tokens/${iconSymbol}.png?v=${__APP_VERSION__}`;

return {
displaySymbol,
icon,
icon: icon || commonTokenIcon,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export class CBridgeAdapter extends BaseAdapter<
chainId,
tokenAddress: token.token.address,
defaultSymbol: token.token.symbol,
icon: token.icon,
}),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export class DeBridgeAdapter extends BaseAdapter<
chainId,
tokenAddress: token.address,
defaultSymbol: token.symbol,
icon: token.logoURI,
}),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class LayerZeroAdapter extends BaseAdapter<
token: ILayerZeroToken;
}) {
return {
name: (token as any).name, // TODO
name: token.name, // TODO
symbol: token.symbol,
address: token.address,
decimals: token.decimals,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface ILayerZeroToken {
symbol: string;
endpointID: number;
version: number; // LayerZero version
name: string;
}

export interface ILayerZeroChain {
Expand Down

0 comments on commit 45ba966

Please sign in to comment.