Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pythnetwork/price-service-client

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pythnetwork/price-service-client - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

5

lib/examples/PriceServiceClient.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const yargs_1 = require("yargs");
const yargs_1 = __importDefault(require("yargs"));
const helpers_1 = require("yargs/helpers");

@@ -5,0 +8,0 @@ const index_1 = require("../index");

@@ -74,2 +74,13 @@ import { HexString, PriceFeed } from "@pythnetwork/price-service-sdk";

/**
* 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
*/
getPriceFeed(priceId: HexString, publishTime: EpochTimeStamp): Promise<PriceFeed>;
/**
* Fetch the list of available price feed ids.

@@ -76,0 +87,0 @@ * This will throw an axios error if there is a network problem or the price service returns a non-ok response.

28

lib/PriceServiceConnection.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PriceServiceConnection = void 0;
const price_service_sdk_1 = require("@pythnetwork/price-service-sdk");
const axios_1 = require("axios");
const axios_retry_1 = require("axios-retry");
const axios_1 = __importDefault(require("axios"));
const axios_retry_1 = __importDefault(require("axios-retry"));
const ResillientWebSocket_1 = require("./ResillientWebSocket");

@@ -108,2 +111,23 @@ const utils_1 = require("./utils");

/**
* 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, publishTime) {
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 price_service_sdk_1.PriceFeed.fromJson(response.data);
}
/**
* Fetch the list of available price feed ids.

@@ -110,0 +134,0 @@ * This will throw an axios error if there is a network problem or the price service returns a non-ok response.

@@ -1,2 +0,2 @@

import * as WebSocket from "isomorphic-ws";
import WebSocket from "isomorphic-ws";
import { Logger } from "ts-log";

@@ -3,0 +3,0 @@ /**

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResilientWebSocket = void 0;
const WebSocket = require("isomorphic-ws");
const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
const PING_TIMEOUT_DURATION = 30000 + 3000; // It is 30s on the server and 3s is added for delays

@@ -52,3 +55,3 @@ /**

this.logger?.info(`Creating Web Socket client`);
this.wsClient = new WebSocket(this.endpoint);
this.wsClient = new isomorphic_ws_1.default(this.endpoint);
this.wsUserClosed = false;

@@ -55,0 +58,0 @@ this.wsClient.onopen = () => {

{
"name": "@pythnetwork/price-service-client",
"version": "1.5.0",
"version": "1.6.0",
"description": "Pyth price service client",

@@ -59,3 +59,3 @@ "author": {

},
"gitHead": "6cdcf4dffd54017e19168be450df01acd68f07ab"
"gitHead": "5e44fa4c95ae7120ee8a05f145b27470d2c48e7b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc