Skip to content

Commit

Permalink
fix: getPriceQuote error message and types (#2073)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendan-defi authored Mar 4, 2025
1 parent bded965 commit 68bc0a8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/api/getPriceQuote.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('getPriceQuote', () => {
expect(result).toEqual({
code: 'INVALID_INPUT',
error: 'Invalid input: tokens must be an array of at least one token',
message: '',
message: 'Tokens must be an array of at least one token',
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/api/getPriceQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function getPriceQuote(
);
if (res.error) {
return {
code: `${res.error.code}`,
code: String(res.error.code),
error: 'Error fetching price quote',
message: res.error.message,
};
Expand All @@ -51,7 +51,7 @@ function validateGetPriceQuoteParams(params: GetPriceQuoteParams) {
return {
code: 'INVALID_INPUT',
error: 'Invalid input: tokens must be an array of at least one token',
message: '',
message: 'Tokens must be an array of at least one token',
};
}

Expand Down
8 changes: 4 additions & 4 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,15 @@ export type GetPriceQuoteParams = {

type PriceQuote = {
/** The name of the token */
name: string | '';
name: string;
/** The symbol of the token */
symbol: string | '';
symbol: string;
/** The contract address of the token */
contractAddress: Address | '';
/** The price of the token */
price: string | '';
price: string;
/** The timestamp of the price quote */
timestamp: number | 0;
timestamp: number;
};

/**
Expand Down

0 comments on commit 68bc0a8

Please sign in to comment.