diff --git a/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx b/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx index 18ac8d830e..2670438228 100644 --- a/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx +++ b/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx @@ -26,7 +26,7 @@ type RepayValues = { export function ExternalFinanceForm({ loan }: { loan: LoanType }) { const pool = usePool(loan.poolId) const account = useBorrower(loan.poolId, loan.id) - const balances = useBalances(account.signingAccount.address) + const balances = useBalances(account.actingAddress) const balance = (balances && findBalance(balances.currencies, pool.currency.key)?.balance.toDecimal()) || Dec(0) const { current: availableFinancing } = useAvailableFinancing(loan.poolId, loan.id) const { execute: doFinanceTransaction, isLoading: isFinanceLoading } = useCentrifugeTransaction( @@ -63,7 +63,9 @@ export function ExternalFinanceForm({ loan }: { loan: LoanType }) { const price = CurrencyBalance.fromFloat(values.price, pool.currency.decimals).div(new BN(100)) const quantity = Price.fromFloat((values.faceValue as number) / (values.price as number)) - doFinanceTransaction([loan.poolId, loan.id, quantity, price, account.actingAddress]) + doFinanceTransaction([loan.poolId, loan.id, quantity, price, account.actingAddress], { + account, + }) actions.setSubmitting(false) }, validateOnMount: true, @@ -78,7 +80,9 @@ export function ExternalFinanceForm({ loan }: { loan: LoanType }) { const price = CurrencyBalance.fromFloat(values.price, pool.currency.decimals).div(new BN(100)) const quantity = Price.fromFloat((values.faceValue as number) / (values.price as number)) - doRepayTransaction([loan.poolId, loan.id, quantity, new BN(0), new BN(0), price, account.actingAddress]) + doRepayTransaction([loan.poolId, loan.id, quantity, new BN(0), new BN(0), price, account.actingAddress], { + account, + }) actions.setSubmitting(false) }, validateOnMount: true, diff --git a/centrifuge-js/src/modules/pools.ts b/centrifuge-js/src/modules/pools.ts index 5ff690fe82..06a3ba41c5 100644 --- a/centrifuge-js/src/modules/pools.ts +++ b/centrifuge-js/src/modules/pools.ts @@ -1390,17 +1390,13 @@ export function getPoolsModule(inst: Centrifuge) { args: [poolId: string, loanId: string, quantity: BN, price: BN, aoProxy: string], options?: TransactionOptions ) { - const [poolId, loanId, quantity, price, aoProxy] = args + const [poolId, loanId, quantity, price] = args const $api = inst.getApi() return $api.pipe( switchMap((api) => { - const borrowSubmittable = api.tx.proxy.proxy( - aoProxy, - undefined, - api.tx.loans.borrow(poolId, loanId, { - external: { quantity: quantity.toString(), settlementPrice: price.toString() }, - }) - ) + const borrowSubmittable = api.tx.loans.borrow(poolId, loanId, { + external: { quantity: quantity.toString(), settlementPrice: price.toString() }, + }) return inst.wrapSignAndSend(api, borrowSubmittable, options) }) ) @@ -1440,20 +1436,16 @@ export function getPoolsModule(inst: Centrifuge) { args: [poolId: string, loanId: string, quantity: BN, interest: BN, unscheduled: BN, price: BN, aoProxy: string], options?: TransactionOptions ) { - const [poolId, loanId, quantity, interest, unscheduled, price, aoProxy] = args + const [poolId, loanId, quantity, interest, unscheduled, price] = args const $api = inst.getApi() return $api.pipe( switchMap((api) => { - const repaySubmittable = api.tx.proxy.proxy( - aoProxy, - undefined, - api.tx.loans.repay(poolId, loanId, { - principal: { external: { quantity: quantity.toString(), settlementPrice: price.toString() } }, - interest: interest.toString(), - unscheduled: unscheduled.toString(), - }) - ) + const repaySubmittable = api.tx.loans.repay(poolId, loanId, { + principal: { external: { quantity: quantity.toString(), settlementPrice: price.toString() } }, + interest: interest.toString(), + unscheduled: unscheduled.toString(), + }) return inst.wrapSignAndSend(api, repaySubmittable, options) }) )