Skip to content

Commit

Permalink
Fix invalid character in purchase form (#2466)
Browse files Browse the repository at this point in the history
* Fix invalid character when quantity is a decimal

* Fix invalid character
  • Loading branch information
sophialittlejohn authored Oct 7, 2024
1 parent ebcfd1b commit 4a88893
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export function ExternalFinanceForm({ loan, source }: { loan: ExternalLoan; sour
if (source === 'reserve') {
financeTx = cent.pools.financeExternalLoan([poolId, loanId, quantity, price], { batch: true })
} else {
const principal = new CurrencyBalance(
price.mul(new BN(quantity.toDecimal().toString())),
const principal = CurrencyBalance.fromFloat(
price.toDecimal().mul(quantity.toDecimal()).toString(),
pool.currency.decimals
)
const repay = { principal, interest: new BN(0), unscheduled: new BN(0) }
Expand Down Expand Up @@ -93,7 +93,7 @@ export function ExternalFinanceForm({ loan, source }: { loan: ExternalLoan; sour
},
onSubmit: (values, actions) => {
const price = CurrencyBalance.fromFloat(values.price.toString(), pool.currency.decimals)
const quantity = Price.fromFloat(values.quantity)
const quantity = Price.fromFloat(values.quantity.toString())
doFinanceTransaction([loan.poolId, loan.id, quantity, price], {
account,
})
Expand Down

0 comments on commit 4a88893

Please sign in to comment.