order display bugfix

This commit is contained in:
Tim Olson
2023-11-18 19:27:54 -04:00
parent 1b670b1398
commit d6dbbc60ec

View File

@@ -70,6 +70,8 @@ function tokenAmount(tokenAddr, amount) {
const t = token(tokenAddr) const t = token(tokenAddr)
if( !t ) if( !t )
return '' return ''
console.log('tokenAmount amount', typeof amount, amount)
console.log('tokenAmount decimals', typeof t.decimals, t.decimals)
const amt = FixedNumber.fromValue(amount, t.decimals, {width:256, decimals:t.decimals, signed:false}) const amt = FixedNumber.fromValue(amount, t.decimals, {width:256, decimals:t.decimals, signed:false})
return `${amt} ${t.symbol}` return `${amt} ${t.symbol}`
} }
@@ -124,18 +126,18 @@ const orders = computed(()=>{
// } // }
if( vaultAddr.value in s.orders ) { if( vaultAddr.value in s.orders ) {
for (const [index, status] of Object.entries(s.orders[vaultAddr.value]).reverse()) { for (const [index, status] of Object.entries(s.orders[vaultAddr.value]).reverse()) {
console.log('order status', status) // console.log('order status', status)
// [index, symbolA, symbolB, amount, amountSymbol, filled] // [index, symbolA, symbolB, amount, amountSymbol, filled]
const inTokenAddr = status[0][0] const inTokenAddr = status[0][0]
const outTokenAddr = status[0][1] const outTokenAddr = status[0][1]
const amountIsInput = !!(status[0][4]) const amountIsInput = !!(status[0][4])
const amountTokenAddr = amountIsInput ? inTokenAddr : outTokenAddr const amountTokenAddr = amountIsInput ? inTokenAddr : outTokenAddr
console.log('getamount', status[0][3]) // console.log('getamount', status[0][3])
const amount = status[0][3] const amount = BigInt(status[0][3])
console.log('amount', amount) // console.log('amount', amount)
console.log('getfilled', amountIsInput ? status[4] : status[5]) // console.log('getfilled', amountIsInput ? status[4] : status[5])
const filled = amountIsInput ? status[4] : status[5] const filled = BigInt(amountIsInput ? status[4] : status[5])
console.log('filled', filled) // console.log('filled', filled)
const amountIn = BigInt(status[4]) const amountIn = BigInt(status[4])
const amountOut = BigInt(status[5]) const amountOut = BigInt(status[5])
const fmtX18 = {decimals: 18, width: 256, signed: false}; const fmtX18 = {decimals: 18, width: 256, signed: false};
@@ -145,7 +147,7 @@ const orders = computed(()=>{
result.push([index, inTokenAddr, outTokenAddr, amount, amountTokenAddr, filled, avg, state]) result.push([index, inTokenAddr, outTokenAddr, amount, amountTokenAddr, filled, avg, state])
} }
} }
console.log('result', result) // console.log('result', result)
return result return result
}) })