Skip to content

Commit

Permalink
Add check for pointer_contract address
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagofilipenunes committed Jun 13, 2024
1 parent 542fefc commit a26c8c4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/config/sei/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,31 @@ type networkDataType = {
svg?: string;
png?: string;
};
pointer_contract?: {
address: string;
type_asset: string;
};
};

export const tokenListParser =
(networkId: string) => (data: Record<string, networkDataType[]>) => {
const networkTokens: Token[] = data[networkId]
.filter((networkData) => {
return networkData.base !== 'usei' && isAddress(networkData.base);
const hasBaseAddress = isAddress(networkData.base);
const hasPointerAddress =
!!networkData.pointer_contract?.address &&
isAddress(networkData.pointer_contract.address);
return (
networkData.base !== 'usei' && (hasBaseAddress || hasPointerAddress)
);
})
.map((networkData) => {
const tokenAddress = isAddress(networkData.base)
? networkData.base
: networkData.pointer_contract!.address;
return {
name: networkData.name,
address: networkData.base,
address: tokenAddress,
symbol: networkData.symbol,
decimals: networkData.denom_units[1].exponent,
logoURI:
Expand Down

0 comments on commit a26c8c4

Please sign in to comment.