Skip to content

Commit 4a3864e

Browse files
committed
fix: typing
1 parent 791896d commit 4a3864e

File tree

1 file changed

+37
-22
lines changed

1 file changed

+37
-22
lines changed

packages/liquidation-sdk-viem/src/preLiquidation/positionGetters.ts

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,46 @@ export async function getPreLiquidablePositions(
2929
};
3030

3131
const preLiquidationInstances = await Promise.all(
32-
data.preLiquidationData.map(async (preLiquidation) => {
33-
const {
34-
markets: { items: market },
35-
} = await apiSdk.getMarketAssets({
36-
chainId,
37-
marketId: preLiquidation.marketId,
38-
});
32+
data.preLiquidationData
33+
.map((preLiquidation) => {
34+
return {
35+
...preLiquidation,
36+
price: BigInt(preLiquidation.price),
37+
preLiquidationParams: {
38+
...preLiquidation.preLiquidationParams,
39+
preLCF1: BigInt(preLiquidation.preLiquidationParams.preLCF1),
40+
preLCF2: BigInt(preLiquidation.preLiquidationParams.preLCF2),
41+
preLIF1: BigInt(preLiquidation.preLiquidationParams.preLIF1),
42+
preLIF2: BigInt(preLiquidation.preLiquidationParams.preLIF2),
43+
preLltv: BigInt(preLiquidation.preLiquidationParams.preLltv),
44+
},
45+
};
46+
})
47+
.map(async (preLiquidation) => {
48+
const {
49+
markets: { items: market },
50+
} = await apiSdk.getMarketAssets({
51+
chainId,
52+
marketId: preLiquidation.marketId,
53+
});
3954

40-
const loanAsset = market !== null ? market[0]?.loanAsset : undefined;
41-
const collateralAsset =
42-
market !== null ? market[0]?.collateralAsset : undefined;
55+
const loanAsset = market !== null ? market[0]?.loanAsset : undefined;
56+
const collateralAsset =
57+
market !== null ? market[0]?.collateralAsset : undefined;
4358

44-
if (
45-
loanAsset === undefined ||
46-
collateralAsset === undefined ||
47-
collateralAsset === null
48-
)
49-
return;
59+
if (
60+
loanAsset === undefined ||
61+
collateralAsset === undefined ||
62+
collateralAsset === null
63+
)
64+
return;
5065

51-
return {
52-
...preLiquidation,
53-
loanAsset,
54-
collateralAsset,
55-
};
56-
}),
66+
return {
67+
...preLiquidation,
68+
loanAsset,
69+
collateralAsset,
70+
};
71+
}),
5772
);
5873

5974
const preLiquidablePositions = await Promise.all(

0 commit comments

Comments
 (0)