Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
k0beLeenders authored and chambaz committed Nov 29, 2023
1 parent 28488ba commit c9f33c2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -224,7 +224,7 @@ export async function makeExtendedBankEmission(
export async function makeEmissionsPriceMap(
banks: Bank[],
connection: Connection,
emissionTokenMap: TokenPriceMap
emissionTokenMap: TokenPriceMap | null
): Promise<TokenPriceMap> {
const banksWithEmissions = banks.filter((bank) => !bank.emissionsMint.equals(PublicKey.default));
const emissionsMints = banksWithEmissions.map((bank) => bank.emissionsMint);
Expand All @@ -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,
}));

Expand Down

0 comments on commit c9f33c2

Please sign in to comment.