From c9f33c2c4696b7255ae9294358dc10e2593d3298 Mon Sep 17 00:00:00 2001 From: Kobe Leenders Date: Wed, 29 Nov 2023 22:34:32 +0100 Subject: [PATCH] fix: build errors --- packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts b/packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts index 455ef1f03b..fb46d9af09 100644 --- a/packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts +++ b/packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts @@ -163,9 +163,9 @@ export async function makeExtendedBankEmission( extendedBankMetadatas: ExtendedBankMetadata[], tokenMap: TokenPriceMap, apiKey?: string -): Promise<[ExtendedBankInfo[], ExtendedBankMetadata[], TokenPriceMap]> { +): Promise<[ExtendedBankInfo[], ExtendedBankMetadata[], TokenPriceMap | null]> { const emissionsMints = Object.keys(tokenMap).map((key) => new PublicKey(key)); - let birdeyePrices = emissionsMints.map(() => new BigNumber(0)); + let birdeyePrices: null | BigNumber[] = emissionsMints.map(() => new BigNumber(0)); try { birdeyePrices = await fetchBirdeyePrices(emissionsMints, apiKey); @@ -224,7 +224,7 @@ export async function makeExtendedBankEmission( export async function makeEmissionsPriceMap( banks: Bank[], connection: Connection, - emissionTokenMap: TokenPriceMap + emissionTokenMap: TokenPriceMap | null ): Promise { const banksWithEmissions = banks.filter((bank) => !bank.emissionsMint.equals(PublicKey.default)); const emissionsMints = banksWithEmissions.map((bank) => bank.emissionsMint); @@ -234,7 +234,9 @@ export async function makeEmissionsPriceMap( const mint = mintAis.map((ai) => MintLayout.decode(ai!.data)); const emissionsPrices = banksWithEmissions.map((bank, i) => ({ mint: bank.emissionsMint, - price: emissionTokenMap ? emissionTokenMap[bank.emissionsMint]?.price ?? new BigNumber(0) : new BigNumber(0), + price: emissionTokenMap + ? emissionTokenMap[bank.emissionsMint.toBase58()]?.price ?? new BigNumber(0) + : new BigNumber(0), decimals: mint[0].decimals, }));