diff --git a/src/app/wallets/get-transactions-for-wallet.ts b/src/app/wallets/get-transactions-for-wallet.ts index e8925dd70..447be446f 100644 --- a/src/app/wallets/get-transactions-for-wallet.ts +++ b/src/app/wallets/get-transactions-for-wallet.ts @@ -34,12 +34,13 @@ export const getTransactionsForWallets = async ({ export const toWalletTransactions = (ibexResp: GResponse200): IbexTransaction[] => { return ibexResp.map(trx => { + const displayCurrency = ((trx as { displayCurrency?: string }).displayCurrency || (trx as { settlementDisplayCurrency?: string }).settlementDisplayCurrency || "USD") as DisplayCurrency const currency = (trx.currencyId === 3 ? "USD" : "BTC") as WalletCurrency // WalletCurrency: "USD" | "BTC", const settlementDisplayPrice: WalletMinorUnitDisplayPrice = { - base: trx.exchangeRateCurrencySats ? BigInt(Math.floor(trx.exchangeRateCurrencySats)) : 0n, - offset: 0n, // what is this? - displayCurrency: "USD" as DisplayCurrency, + base: trx.exchangeRateCurrencySats ? BigInt(Math.round(trx.exchangeRateCurrencySats)) : 0n, + offset: 0n, + displayCurrency, walletCurrency: currency } @@ -48,8 +49,8 @@ export const toWalletTransactions = (ibexResp: GResponse200): IbexTransaction[] settlementAmount: toSettlementAmount(trx.amount, trx.transactionTypeId, currency), settlementFee: asCurrency(trx.networkFee, currency), settlementCurrency: currency, - settlementDisplayAmount: `${trx.amount}`, - settlementDisplayFee: `${trx.networkFee}`, + settlementDisplayAmount: `${(trx as { settlementDisplayAmount?: number | string }).settlementDisplayAmount ?? trx.amount}`, + settlementDisplayFee: `${(trx as { settlementDisplayFee?: number | string }).settlementDisplayFee ?? trx.networkFee}`, settlementDisplayPrice: settlementDisplayPrice, createdAt: trx.createdAt ? new Date(trx.createdAt) : new Date(), // should always return id: trx.id || "null", // "LedgerTransactionId" - this is likely unused diff --git a/src/graphql/shared/types/object/btc-wallet.ts b/src/graphql/shared/types/object/btc-wallet.ts index 3a29738e2..c1172af45 100644 --- a/src/graphql/shared/types/object/btc-wallet.ts +++ b/src/graphql/shared/types/object/btc-wallet.ts @@ -56,7 +56,7 @@ const BtcWallet = GT.Object({ if (balanceSats instanceof Error) { throw mapError(balanceSats) } - return balanceSats + return normalizePaymentAmount(balanceSats).amount }, }, pendingIncomingBalance: {