diff --git a/packages/extension/src/providers/solana/types/sol-network.ts b/packages/extension/src/providers/solana/types/sol-network.ts index 8b732d2dc..6c4300f5f 100644 --- a/packages/extension/src/providers/solana/types/sol-network.ts +++ b/packages/extension/src/providers/solana/types/sol-network.ts @@ -116,10 +116,11 @@ export class SolanaNetwork extends BaseNetwork { const market = new MarketData(); marketData = await market.getMarketData([this.coingeckoID]); } + const currentPrice = marketData.length + ? marketData[0]!.current_price || 0 + : 0; const userBalance = fromBase(balance, this.decimals); - const usdBalance = new BigNumber(userBalance).times( - marketData.length ? marketData[0]!.current_price : 0 - ); + const usdBalance = new BigNumber(userBalance).times(currentPrice); const nativeAsset: AssetsType = { balance: balance, balancef: formatFloatingPointValue(userBalance).value, @@ -128,11 +129,9 @@ export class SolanaNetwork extends BaseNetwork { icon: this.icon, name: this.name_long, symbol: this.currencyName, - value: marketData.length - ? marketData[0]!.current_price.toString() - : "0", + value: marketData.length ? currentPrice.toString() : "0", valuef: formatFiatValue( - marketData.length ? marketData[0]!.current_price.toString() : "0" + marketData.length ? currentPrice.toString() : "0" ).value, contract: "", decimals: this.decimals, diff --git a/packages/extension/src/providers/solana/ui/libs/decode-tx.ts b/packages/extension/src/providers/solana/ui/libs/decode-tx.ts index 03b0d4051..8c8c8f513 100644 --- a/packages/extension/src/providers/solana/ui/libs/decode-tx.ts +++ b/packages/extension/src/providers/solana/ui/libs/decode-tx.ts @@ -130,10 +130,10 @@ const decodeTransaction = async ( res.isNegative = false; if (token.cgId) { const val = await marketData.getMarketData([token.cgId]); - res.USDval = new BigNumber(val[0]!.current_price) + res.USDval = new BigNumber(val[0]!.current_price ?? 0) .times(fromBase(res.change.toString(), res.decimals)) .toString(); - res.price = val[0]!.current_price.toString(); + res.price = (val[0]!.current_price ?? 0).toString(); } } if (token.decimals === 0) {