Skip to content

Commit

Permalink
Merge branch 'develop' into preview
Browse files Browse the repository at this point in the history
  • Loading branch information
phucledien committed May 22, 2024
2 parents d64186c + 09f843a commit 38f9a0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/commands/balances/index/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ export function formatView(
text,
usdWorth,
usdVal,
...(chain && !native && isDuplicateSymbol(symbol.toUpperCase())
...(chain && isDuplicateSymbol(symbol.toUpperCase())
? { chain }
: {}),
avgCost,
Expand Down Expand Up @@ -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<string, string> = {}
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],
Expand Down
3 changes: 2 additions & 1 deletion src/commands/wallet/view/address/slash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 38f9a0b

Please sign in to comment.