Skip to content

Commit

Permalink
fix(app): fetch metadatas
Browse files Browse the repository at this point in the history
  • Loading branch information
cor committed Feb 7, 2025
1 parent ec8fcf9 commit ef4b199
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/lib/stores/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
queryCosmosC20TokenMetadata,
type CosmosChainId
} from "@unionlabs/client"
import { toast } from "svelte-sonner"

export type TokenInfos = Record<ChainId, Record<Denom, TokenInfo>>

Expand Down Expand Up @@ -111,6 +112,7 @@ export async function fetchTokenInfo(chain: Chain, denom: Denom): Promise<TokenI
if (chain.rpc_type === "cosmos") {
const maybeBechAddr = isHex(denom) ? fromHex(denom, "string") : ""
if (isValidBech32ContractAddress(maybeBechAddr)) {
toast.info("gonna await")
const result = await queryCosmosC20TokenMetadata({
contractAddress: maybeBechAddr,
chainId: chain.chain_id as CosmosChainId
Expand All @@ -123,6 +125,10 @@ export async function fetchTokenInfo(chain: Chain, denom: Denom): Promise<TokenI
symbol: result.value.symbol
}
}

if (result.isErr()) {
toast.error(`error getting metadata for asset, ${denom}`)
}
}
}

Expand Down

0 comments on commit ef4b199

Please sign in to comment.