Skip to content

Commit

Permalink
chore: self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Jan 21, 2025
1 parent f89f90a commit d20b62e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/external-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@ export const _getUsdPricesFromApi = async (): Promise<IDict<number>> => {
return priceDictByMaxTvl
}

type UserCollateral = {
total_deposit_precise: string | number,
total_deposit_from_user: string | number,
total_deposit_usd_value: string | number,
};
export const _getUserCollateral = memoize(
async (network: INetworkName, controller: string, user: string): Promise<Record<string, BigNumberish>> => {
async (network: INetworkName, controller: string, user: string): Promise<UserCollateral> => {
const url = `https://prices.curve.fi/v1/lending/collateral_events/${network}/${controller}/${user}`;
const response = await fetch(url);
const {total_deposit_precise, total_deposit_from_user, total_deposit_usd_value} = await response.json() as {
total_deposit_precise: string | number,
total_deposit_from_user: string | number,
total_deposit_usd_value: string | number,
};
const {total_deposit_precise, total_deposit_from_user, total_deposit_usd_value} = await response.json() as UserCollateral;
return { total_deposit_precise, total_deposit_from_user, total_deposit_usd_value }
},
{
Expand Down

0 comments on commit d20b62e

Please sign in to comment.