-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Data Provider
Blockfrost
DEX
All
Description
I'm implementing pool retrieval and I initially fetch the pools based on specific DEXs and tokens (it takes around 30 minutes with Blockfrost). I save them, and then every 5 minutes, I would retrieve their state using .getLiquidityPoolState(pool) (very fast).
Once I get all the pools with:
.onDexs([dex]).forTokenPairs(tokenPairs).getLiquidityPools()
I store them in the database and then call:
.getLiquidityPoolState(pool)
To call this function later, I fetch the data from the database and reconstruct the pool object like this:
new LiquidityPool(pool.dex, "lovelace", assetB, pool.reserveA, pool.reserveB, pool.address, pool.marketOrderAddress, pool.limitOrderAddress );
The problem is that the LiquidityPool constructor doesn’t accept all parameters of the initial pools (example fields missing: lpToken: Asset; poolNft: Asset; identifier: string; poolFeePercent: number; totalLpTokens: bigint;), so the returned pools from .getLiquidityPoolState(pool) are undefined.
Why the constructor doesn't accept all the fields?
dexter/src/dex/models/liquidity-pool.ts
Line 21 in 78ea53d
| constructor(dex: string, assetA: Token, assetB: Token, reserveA: bigint, reserveB: bigint, address: string, marketOrderAddress: string = '', limitOrderAddress: string = '') { |
Is there a way to work around this issue?