fix contributed srm bug
This commit is contained in:
parent
8b418dbe5f
commit
de620e9a3f
|
@ -4,18 +4,14 @@ import useMangoStore from '../stores/useMangoStore'
|
|||
import useMarketList from './useMarketList'
|
||||
|
||||
const getOrderBookAccounts = (market, accountInfos) => {
|
||||
const bidBuffer = Buffer.from(
|
||||
accountInfos[market._decoded.bids.toString()].data
|
||||
)
|
||||
const askBuffer = Buffer.from(
|
||||
accountInfos[market._decoded.asks.toString()].data
|
||||
)
|
||||
const bidData = accountInfos[market._decoded.bids.toString()]?.data
|
||||
const askData = accountInfos[market._decoded.asks.toString()]?.data
|
||||
|
||||
return {
|
||||
bidOrderBook:
|
||||
market && bidBuffer ? Orderbook.decode(market, bidBuffer) : null,
|
||||
market && bidData ? Orderbook.decode(market, Buffer.from(bidData)) : null,
|
||||
askOrderBook:
|
||||
market && askBuffer ? Orderbook.decode(market, askBuffer) : null,
|
||||
market && askData ? Orderbook.decode(market, Buffer.from(askData)) : null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -196,12 +196,12 @@ const useMangoStore = create<MangoStore>((set, get) => ({
|
|||
)
|
||||
if (usersMangoSrmAccounts.length) {
|
||||
set((state) => {
|
||||
state.selectedMangoGroup.srmAccountsForOwner = usersMangoSrmAccounts
|
||||
state.wallet.srmAccountsForOwner = usersMangoSrmAccounts
|
||||
const totalSrmDeposits = usersMangoSrmAccounts.reduce(
|
||||
(prev, cur) => prev + cur.amount,
|
||||
0
|
||||
)
|
||||
state.selectedMangoGroup.contributedSrm = nativeToUi(
|
||||
state.wallet.contributedSrm = nativeToUi(
|
||||
totalSrmDeposits,
|
||||
SRM_DECIMALS
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue