Skip to content

Commit a691e18

Browse files
authored
fix(hermes-client)!: Correct filter parameter to assetType in getPriceFeeds function (#2248)
1 parent 4d6418a commit a691e18

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

apps/hermes/client/js/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const priceIds = [
3434
// Get price feeds
3535
const priceFeeds = await connection.getPriceFeeds({
3636
query: "btc",
37-
filter: "crypto",
37+
assetType: "crypto",
3838
});
3939
console.log(priceFeeds);
4040

apps/hermes/client/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/hermes-client",
3-
"version": "1.4.0",
3+
"version": "2.0.0",
44
"description": "Pyth Hermes Client",
55
"author": {
66
"name": "Pyth Data Association"

apps/hermes/client/js/src/HermesClient.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class HermesClient {
104104
*
105105
* @param options Optional parameters:
106106
* - 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".
107-
* - filter: String to filter the price feeds by asset type. Possible values are "crypto", "equity", "fx", "metal", "rates". Filter string is case insensitive.
107+
* - 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.
108108
*
109109
* @returns Array of PriceFeedMetadata objects.
110110
*/
@@ -113,12 +113,13 @@ export class HermesClient {
113113
...options
114114
}: {
115115
query?: string;
116-
filter?: string;
116+
assetType?: AssetType;
117117
fetchOptions?: RequestInit;
118118
} = {}): Promise<PriceFeedMetadata[]> {
119119
const url = this.buildURL("price_feeds");
120120
if (options) {
121-
this.appendUrlSearchParams(url, options);
121+
const transformedOptions = camelToSnakeCaseObject(options);
122+
this.appendUrlSearchParams(url, transformedOptions);
122123
}
123124
return await this.httpRequest(
124125
url.toString(),

apps/hermes/client/js/src/examples/HermesClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async function run() {
6464
console.log(`Price feeds matching "btc" with asset type "crypto":`);
6565
const priceFeeds = await connection.getPriceFeeds({
6666
query: "btc",
67-
filter: "crypto",
67+
assetType: "crypto",
6868
});
6969
console.log(priceFeeds);
7070

0 commit comments

Comments
 (0)