0cd9943e0d
* withdrawLiquidity cloud function * update rules * exclude antes from getCpmmLiquidityPoolWeights * update correct lp shares * liquidity panel * don't create bet if less than 1 surplus share * withdrawLiquidity return type * static analysis fix * hook dependency * prettier * renaming * typo * getCpmmLiquidityPoolWeights: always exclude antes * delete unused function * casting
18 lines
540 B
TypeScript
18 lines
540 B
TypeScript
import { collection, query } from 'firebase/firestore'
|
|
|
|
import { db } from './init'
|
|
import { listenForValues } from './utils'
|
|
import { LiquidityProvision } from 'common/liquidity-provision'
|
|
|
|
export function listenForLiquidity(
|
|
contractId: string,
|
|
setLiquidity: (lps: LiquidityProvision[]) => void
|
|
) {
|
|
const lpQuery = query(collection(db, 'contracts', contractId, 'liquidity'))
|
|
|
|
return listenForValues<LiquidityProvision>(lpQuery, (lps) => {
|
|
lps.sort((lp1, lp2) => lp1.createdTime - lp2.createdTime)
|
|
setLiquidity(lps)
|
|
})
|
|
}
|