Skip to content

Commit 210b8de

Browse files
devin-ai-integration[bot]Jayant Krishnamurthy
andcommitted
feat(price-service): update deprecated Hermes API endpoints to v2
- Replace /api/latest_price_feeds with /v2/updates/price/latest - Replace /api/latest_vaas with /v2/updates/price/latest - Replace /api/get_vaa with /v2/updates/price/{publish_time} - Replace /api/get_price_feed with /v2/updates/price/{publish_time} - Replace /api/price_feed_ids with /v2/price_feeds - Add deprecation notices for affected methods Co-Authored-By: Jayant Krishnamurthy <[email protected]>
1 parent a9b6b69 commit 210b8de

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

price_service/client/js/src/PriceServiceConnection.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class PriceServiceConnection {
143143
return [];
144144
}
145145

146-
const response = await this.httpClient.get("/api/latest_price_feeds", {
146+
const response = await this.httpClient.get("/v2/updates/price/latest", {
147147
params: {
148148
ids: priceIds,
149149
verbose: this.priceFeedRequestConfig.verbose,
@@ -164,9 +164,11 @@ export class PriceServiceConnection {
164164
*
165165
* @param priceIds Array of hex-encoded price ids.
166166
* @returns Array of base64 encoded VAAs.
167+
* @deprecated This method uses the v2 API endpoint which may return data in a different format.
168+
* Please verify the response format when using this method.
167169
*/
168170
async getLatestVaas(priceIds: HexString[]): Promise<string[]> {
169-
const response = await this.httpClient.get("/api/latest_vaas", {
171+
const response = await this.httpClient.get("/v2/updates/price/latest", {
170172
params: {
171173
ids: priceIds,
172174
},
@@ -185,15 +187,16 @@ export class PriceServiceConnection {
185187
* @param priceId Hex-encoded price id.
186188
* @param publishTime Epoch timestamp in seconds.
187189
* @returns Tuple of VAA and publishTime.
190+
* @deprecated This method uses the v2 API endpoint which may return data in a different format.
191+
* Please verify the response format when using this method.
188192
*/
189193
async getVaa(
190194
priceId: HexString,
191195
publishTime: EpochTimeStamp
192196
): Promise<[string, EpochTimeStamp]> {
193-
const response = await this.httpClient.get("/api/get_vaa", {
197+
const response = await this.httpClient.get(`/v2/updates/price/${publishTime}`, {
194198
params: {
195199
id: priceId,
196-
publish_time: publishTime,
197200
},
198201
});
199202
return [response.data.vaa, response.data.publishTime];
@@ -208,15 +211,16 @@ export class PriceServiceConnection {
208211
* @param priceId Hex-encoded price id.
209212
* @param publishTime Epoch timestamp in seconds.
210213
* @returns PriceFeed
214+
* @deprecated This method uses the v2 API endpoint which may return data in a different format.
215+
* Please verify the response format when using this method.
211216
*/
212217
async getPriceFeed(
213218
priceId: HexString,
214219
publishTime: EpochTimeStamp
215220
): Promise<PriceFeed> {
216-
const response = await this.httpClient.get("/api/get_price_feed", {
221+
const response = await this.httpClient.get(`/v2/updates/price/${publishTime}`, {
217222
params: {
218223
id: priceId,
219-
publish_time: publishTime,
220224
verbose: this.priceFeedRequestConfig.verbose,
221225
binary: this.priceFeedRequestConfig.binary,
222226
},
@@ -230,9 +234,11 @@ export class PriceServiceConnection {
230234
* This will throw an axios error if there is a network problem or the price service returns a non-ok response.
231235
*
232236
* @returns Array of hex-encoded price ids.
237+
* @deprecated This method uses the v2 API endpoint which may return data in a different format.
238+
* Please verify the response format when using this method.
233239
*/
234240
async getPriceFeedIds(): Promise<HexString[]> {
235-
const response = await this.httpClient.get("/api/price_feed_ids");
241+
const response = await this.httpClient.get("/v2/price_feeds");
236242
return response.data;
237243
}
238244

0 commit comments

Comments
 (0)