Skip to content

Commit

Permalink
update type, export
Browse files Browse the repository at this point in the history
  • Loading branch information
brendan-defi committed Jan 17, 2025
1 parent 2f65eb9 commit b29af0b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/core/api/getPortfolioTokenBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CDP_GET_PORTFOLIO_TOKEN_BALANCES } from '../network/definitions/wallet'
import { sendRequest } from '../network/request';
import type {
GetPortfolioTokenBalancesParams,
GetPortfoliosAPIResponse,
GetPortfolioTokenBalancesResponse,
} from './types';

export async function getPortfolioTokenBalances({
Expand All @@ -11,7 +11,7 @@ export async function getPortfolioTokenBalances({
try {
const res = await sendRequest<
GetPortfolioTokenBalancesParams,
GetPortfoliosAPIResponse
GetPortfolioTokenBalancesResponse
>(CDP_GET_PORTFOLIO_TOKEN_BALANCES, [{ addresses }]);
if (res.error) {
return {
Expand Down
3 changes: 3 additions & 0 deletions src/core/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export { buildPayTransaction } from './buildPayTransaction';
export { getMintDetails } from './getMintDetails';
export { getSwapQuote } from './getSwapQuote';
export { getTokenDetails } from './getTokenDetails';
export { getPortfolioTokenBalances } from './getPortfolioTokenBalances';
export { getTokens } from './getTokens';
export type {
APIError,
Expand All @@ -23,4 +24,6 @@ export type {
GetTokenDetailsResponse,
GetTokensOptions,
GetTokensResponse,
GetPortfolioTokenBalancesParams,
GetPortfolioTokenBalancesResponse,
} from './types';
14 changes: 4 additions & 10 deletions src/core/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,23 +258,17 @@ export type GetPortfolioTokenBalancesParams = {
/**
* Note: exported as public Type
*/
export type GetPortfolioTokenBalancesResponse = {
portfolios: PortfolioTokenBalances[];
};

export type PortfolioTokenBalances = {
address: Address;
portfolioBalanceInUsd: number;
tokenBalances: PortfolioTokenWithFiatValue[];
};

/**
* Note: exported as public Type
*/
export type PortfolioTokenWithFiatValue = Token & {
cryptoBalance: number;
fiatBalance: number;
};

/**
* Note: exported as public Type
*/
export type GetPortfoliosAPIResponse = {
portfolios: PortfolioTokenBalances[];
};

0 comments on commit b29af0b

Please sign in to comment.