use uiToNative
This commit is contained in:
parent
fe5172803a
commit
567e38cbcc
|
@ -389,12 +389,9 @@ export async function borrowAndWithdraw(
|
|||
const tokenBalance = marginAccount.getUiDeposit(mangoGroup, tokenIndex)
|
||||
const borrowQuantity = withdrawQuantity - tokenBalance
|
||||
|
||||
// uiToNative() uses Math.round causing
|
||||
// errors so we use Math.floor here instead
|
||||
const nativeBorrowQuantity = new BN(
|
||||
Math.floor(
|
||||
borrowQuantity * Math.pow(10, mangoGroup.mintDecimals[tokenIndex])
|
||||
)
|
||||
const nativeBorrowQuantity = uiToNative(
|
||||
borrowQuantity,
|
||||
mangoGroup.mintDecimals[tokenIndex]
|
||||
)
|
||||
|
||||
const borrowInstruction = makeBorrowInstruction(
|
||||
|
|
Loading…
Reference in New Issue