diff --git a/centrifuge-app/src/pages/Loan/FinanceForm.tsx b/centrifuge-app/src/pages/Loan/FinanceForm.tsx index c954625742..5535281c7b 100644 --- a/centrifuge-app/src/pages/Loan/FinanceForm.tsx +++ b/centrifuge-app/src/pages/Loan/FinanceForm.tsx @@ -1,4 +1,4 @@ -import { ActiveLoan, CurrencyBalance, findBalance, Loan as LoanType } from '@centrifuge/centrifuge-js' +import { ActiveLoan, CurrencyBalance, ExternalLoan, findBalance, Loan as LoanType } from '@centrifuge/centrifuge-js' import { useBalances, useCentrifugeTransaction } from '@centrifuge/centrifuge-react' import { Button, Card, CurrencyInput, IconInfo, InlineFeedback, Shelf, Stack, Text } from '@centrifuge/fabric' import BN from 'bn.js' @@ -24,7 +24,7 @@ type RepayValues = { export const FinanceForm = ({ loan }: { loan: LoanType }) => { const isExternalAsset = 'valuationMethod' in loan.pricing && loan.pricing.valuationMethod === 'oracle' - return isExternalAsset ? : + return isExternalAsset ? : } function InternalFinanceForm({ loan }: { loan: LoanType }) { diff --git a/centrifuge-app/src/utils/tinlake/useTinlakePools.ts b/centrifuge-app/src/utils/tinlake/useTinlakePools.ts index a79d6a64bf..fbf9d499cd 100644 --- a/centrifuge-app/src/utils/tinlake/useTinlakePools.ts +++ b/centrifuge-app/src/utils/tinlake/useTinlakePools.ts @@ -192,6 +192,7 @@ export function useTinlakeLoans(poolId: string) { id: loan.index.toString(), originationDate: loan.financingDate ? new Date(Number(loan.financingDate) * 1000).toISOString() : null, outstandingDebt: new CurrencyBalance(loan.debt, 18), + presentValue: new CurrencyBalance(loan.debt, 18), poolId: loan.pool.id, pricing: { maturityDate: Number(loan.maturityDate) ? new Date(Number(loan.maturityDate) * 1000).toISOString() : null, diff --git a/centrifuge-app/src/utils/usePools.ts b/centrifuge-app/src/utils/usePools.ts index 9f202b312a..4ad8882b95 100644 --- a/centrifuge-app/src/utils/usePools.ts +++ b/centrifuge-app/src/utils/usePools.ts @@ -1,4 +1,4 @@ -import Centrifuge, { ActiveLoan, BorrowerTransaction, Pool, PoolMetadata } from '@centrifuge/centrifuge-js' +import Centrifuge, { BorrowerTransaction, Loan, Pool, PoolMetadata } from '@centrifuge/centrifuge-js' import { useCentrifuge, useCentrifugeQuery, useWallet } from '@centrifuge/centrifuge-react' import BN from 'bn.js' import { useEffect } from 'react' @@ -95,10 +95,10 @@ export function useAverageAmount(poolId: string) { if (!loans?.length || !pool) return new BN(0) - return loans + return (loans as Loan[]) .reduce((sum, loan) => { if (loan.status !== 'Active') return sum - return sum.add((loan as ActiveLoan).presentValue.toDecimal()) + return sum.add(loan.presentValue.toDecimal()) }, Dec(0)) .div(loans.filter((loan) => loan.status === 'Active').length) }