diff --git a/src/commands/balances/index/processor.ts b/src/commands/balances/index/processor.ts index 844fafc75..c8a23f26b 100644 --- a/src/commands/balances/index/processor.ts +++ b/src/commands/balances/index/processor.ts @@ -518,7 +518,7 @@ export function formatView( text, usdWorth, usdVal, - ...(chain && !native && isDuplicateSymbol(symbol.toUpperCase()) + ...(chain && isDuplicateSymbol(symbol.toUpperCase()) ? { chain } : {}), avgCost, @@ -626,11 +626,17 @@ async function switchView( let isOwnWallet = wallets.some((w) => props.address.toLowerCase().includes(w.value.toLowerCase()), ) + + // get list token average cost of user on binance const { data: avg } = await mochiApi.getBinanceAverageCost(profileId) let averageCosts: Record = {} - avg?.forEach((d: { symbol: string; average_cost: string }) => { - averageCosts[d.symbol] = d.average_cost - }) + // just get average cost if rendering cex wallet + if (balanceType === BalanceType.Cex) { + avg?.forEach((d: { symbol: string; average_cost: string }) => { + averageCosts[d.symbol] = d.average_cost + }) + } + isOwnWallet = isOwnWallet && !isViewingOther const embed = composeEmbedMessage(null, { author: [props.title, props.emoji], diff --git a/src/commands/wallet/view/address/slash.ts b/src/commands/wallet/view/address/slash.ts index 4f16bbfa1..7cb283a2b 100644 --- a/src/commands/wallet/view/address/slash.ts +++ b/src/commands/wallet/view/address/slash.ts @@ -35,7 +35,8 @@ const command: SlashCommand = { const focusedValue = i.options.getFocused() // do not fetch amount because // we need to respond within 3 seconds (discord api is amazing ¯\_(ツ)_/¯) - const { wallets } = await profile.getUserWallets(i.user.id) + let userId = i.user.id + const { wallets } = await profile.getUserWallets(userId) const options = await Promise.all( [...wallets]