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(hermes-client)!: Correct filter parameter to assetType in getPriceFeeds function #2248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion apps/hermes/client/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ const priceIds = [
];

// Get price feeds
const priceFeeds = await connection.getPriceFeeds("btc", "crypto");
const priceFeeds = await connection.getPriceFeeds({
query: "btc",
assetType: "crypto",
});
console.log(priceFeeds);

// Latest price updates
Expand Down
2 changes: 1 addition & 1 deletion apps/hermes/client/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/hermes-client",
"version": "1.3.0",
"version": "2.0.0",
"description": "Pyth Hermes Client",
"author": {
"name": "Pyth Data Association"
Expand Down
7 changes: 4 additions & 3 deletions apps/hermes/client/js/src/HermesClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,18 @@ export class HermesClient {
*
* @param options Optional parameters:
* - query: String to filter the price feeds. If provided, the results will be filtered to all price feeds whose symbol contains the query string. Query string is case insensitive. Example: "bitcoin".
* - filter: String to filter the price feeds by asset type. Possible values are "crypto", "equity", "fx", "metal", "rates". Filter string is case insensitive.
* - assetType: String to filter the price feeds by asset type. Possible values are "crypto", "equity", "fx", "metal", "rates", "crypto_redemption_rate". Filter string is case insensitive.
*
* @returns Array of PriceFeedMetadata objects.
*/
async getPriceFeeds(options?: {
query?: string;
filter?: string;
assetType?: AssetType;
}): Promise<PriceFeedMetadata[]> {
const url = new URL("v2/price_feeds", this.baseURL);
if (options) {
this.appendUrlSearchParams(url, options);
const transformedOptions = camelToSnakeCaseObject(options);
this.appendUrlSearchParams(url, transformedOptions);
}
return await this.httpRequest(
url.toString(),
Expand Down
2 changes: 1 addition & 1 deletion apps/hermes/client/js/src/examples/HermesClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function run() {
console.log(`Price feeds matching "btc" with asset type "crypto":`);
const priceFeeds = await connection.getPriceFeeds({
query: "btc",
filter: "crypto",
assetType: "crypto",
});
console.log(priceFeeds);

Expand Down