diff --git a/package-lock.json b/package-lock.json index 8403cedb..953f3909 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55889,7 +55889,7 @@ }, "price_pusher": { "name": "@pythnetwork/price-pusher", - "version": "5.3.1", + "version": "5.4.1", "license": "Apache-2.0", "dependencies": { "@injectivelabs/sdk-ts": "1.10.72", @@ -57320,7 +57320,7 @@ }, "price_service/client/js": { "name": "@pythnetwork/price-service-client", - "version": "1.5.0", + "version": "1.6.0", "license": "Apache-2.0", "dependencies": { "@pythnetwork/price-service-sdk": "*", @@ -57846,7 +57846,7 @@ }, "target_chains/aptos/sdk/js": { "name": "@pythnetwork/pyth-aptos-js", - "version": "1.1.0", + "version": "1.2.0", "license": "Apache-2.0", "dependencies": { "@pythnetwork/price-service-client": "*", @@ -57937,7 +57937,7 @@ }, "target_chains/cosmwasm/sdk/js": { "name": "@pythnetwork/pyth-terra-js", - "version": "1.2.0", + "version": "1.3.0", "license": "Apache-2.0", "dependencies": { "@pythnetwork/price-service-client": "*", @@ -58980,7 +58980,7 @@ }, "target_chains/ethereum/sdk/js": { "name": "@pythnetwork/pyth-evm-js", - "version": "1.18.0", + "version": "1.19.0", "license": "Apache-2.0", "dependencies": { "@pythnetwork/price-service-client": "*", diff --git a/price_service/client/js/package.json b/price_service/client/js/package.json index 2b940462..4de19655 100644 --- a/price_service/client/js/package.json +++ b/price_service/client/js/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/price-service-client", - "version": "1.5.0", + "version": "1.6.0", "description": "Pyth price service client", "author": { "name": "Pyth Data Association" diff --git a/price_service/client/js/src/PriceServiceConnection.ts b/price_service/client/js/src/PriceServiceConnection.ts index eb1f3768..6c9969f3 100644 --- a/price_service/client/js/src/PriceServiceConnection.ts +++ b/price_service/client/js/src/PriceServiceConnection.ts @@ -174,6 +174,32 @@ export class PriceServiceConnection { return [response.data.vaa, response.data.publishTime]; } + /** + * Fetch the PriceFeed of the given price id that is published since the given publish time. + * This will throw an error if the given publish time is in the future, or if the publish time + * is old and the price service endpoint does not have a db backend for historical requests. + * This will throw an axios error if there is a network problem or the price service returns a non-ok response (e.g: Invalid price id) + * + * @param priceId Hex-encoded price id. + * @param publishTime Epoch timestamp in seconds. + * @returns PriceFeed + */ + async getPriceFeed( + priceId: HexString, + publishTime: EpochTimeStamp + ): Promise { + const response = await this.httpClient.get("/api/get_price_feed", { + params: { + id: priceId, + publish_time: publishTime, + verbose: this.priceFeedRequestConfig.verbose, + binary: this.priceFeedRequestConfig.binary, + }, + }); + + return PriceFeed.fromJson(response.data); + } + /** * Fetch the list of available price feed ids. * This will throw an axios error if there is a network problem or the price service returns a non-ok response. diff --git a/target_chains/aptos/sdk/js/package.json b/target_chains/aptos/sdk/js/package.json index 50c73741..4e45efaa 100644 --- a/target_chains/aptos/sdk/js/package.json +++ b/target_chains/aptos/sdk/js/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/pyth-aptos-js", - "version": "1.1.0", + "version": "1.2.0", "description": "Pyth Network Aptos Utilities", "homepage": "https://pyth.network", "author": { diff --git a/target_chains/cosmwasm/sdk/js/package.json b/target_chains/cosmwasm/sdk/js/package.json index 5414937f..ea3872d0 100644 --- a/target_chains/cosmwasm/sdk/js/package.json +++ b/target_chains/cosmwasm/sdk/js/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/pyth-terra-js", - "version": "1.2.0", + "version": "1.3.0", "description": "Pyth Network Terra Utils in JS", "homepage": "https://pyth.network", "author": { diff --git a/target_chains/ethereum/sdk/js/package.json b/target_chains/ethereum/sdk/js/package.json index 891a83ed..14a93395 100644 --- a/target_chains/ethereum/sdk/js/package.json +++ b/target_chains/ethereum/sdk/js/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/pyth-evm-js", - "version": "1.18.0", + "version": "1.19.0", "description": "Pyth Network EVM Utils in JS", "homepage": "https://pyth.network", "author": {