Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: getPriceQuote error message and types #2073

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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