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

@pythnetwork/client

Package Overview
Dependencies
Maintainers
4
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pythnetwork/client - npm Package Compare versions

Comparing version 2.3.2 to 2.4.0

4

CHANGELOG.md
# Changelog
### 2.3.2
Added PythConnection
## 2.2.0

@@ -4,0 +8,0 @@

10

lib/example_usage.js

@@ -13,4 +13,10 @@ "use strict";

// SRM/USD: $8.68725 ±$0.0131
// tslint:disable-next-line:no-console
console.log(product.symbol + ": $" + price.price + " \u00B1$" + price.confidence);
if (price.price && price.confidence) {
// tslint:disable-next-line:no-console
console.log(product.symbol + ": $" + price.price + " \u00B1$" + price.confidence);
}
else {
// tslint:disable-next-line:no-console
console.log(product.symbol + ": price currently unavailable");
}
});

@@ -17,0 +23,0 @@ // tslint:disable-next-line:no-console

@@ -56,3 +56,3 @@ /// <reference types="node" />

}
export interface PriceData extends Base, Price {
export interface PriceData extends Base {
priceType: number;

@@ -80,2 +80,5 @@ exponent: number;

priceComponents: PriceComponent[];
aggregate: Price;
price: number | undefined;
confidence: number | undefined;
}

@@ -82,0 +85,0 @@ /** Parse data as a generic Pyth account. Use this method if you don't know the account type. */

"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -194,3 +183,9 @@ exports.getPythProgramKeyForCluster = exports.PythConnection = exports.parsePriceData = exports.parseProductData = exports.parseMappingData = exports.parseBaseData = exports.MAX_SLOT_DIFFERENCE = exports.AccountType = exports.DeriveType = exports.PriceType = exports.CorpAction = exports.PriceStatus = exports.Version = exports.Version2 = exports.Magic = void 0;

var drv3 = Number(drv3Component) * Math.pow(10, exponent);
var aggregatePriceInfo = parsePriceInfo(data.slice(208, 240), exponent);
var aggregate = parsePriceInfo(data.slice(208, 240), exponent);
var price;
var confidence;
if (aggregate.status === 1) {
price = aggregate.price;
confidence = aggregate.confidence;
}
// price components - up to 32

@@ -204,7 +199,7 @@ var priceComponents = [];

if (publisher) {
var aggregate = parsePriceInfo(data.slice(offset, offset + 32), exponent);
var componentAggregate = parsePriceInfo(data.slice(offset, offset + 32), exponent);
offset += 32;
var latest = parsePriceInfo(data.slice(offset, offset + 32), exponent);
offset += 32;
priceComponents.push({ publisher: publisher, aggregate: aggregate, latest: latest });
priceComponents.push({ publisher: publisher, aggregate: componentAggregate, latest: latest });
}

@@ -215,3 +210,4 @@ else {

}
return __assign(__assign({ magic: magic,
return {
magic: magic,
version: version,

@@ -240,3 +236,8 @@ type: type,

drv3Component: drv3Component,
drv3: drv3 }, aggregatePriceInfo), { priceComponents: priceComponents });
drv3: drv3,
aggregate: aggregate,
priceComponents: priceComponents,
price: price,
confidence: confidence
};
};

@@ -243,0 +244,0 @@ exports.parsePriceData = parsePriceData;

{
"name": "@pythnetwork/client",
"version": "2.3.2",
"version": "2.4.0",
"description": "Client for consuming Pyth price data",

@@ -40,3 +40,3 @@ "homepage": "https://pyth.network",

"dependencies": {
"@solana/web3.js": "^1.10.1",
"@solana/web3.js": "^1.30.2",
"assert": "^2.0.0",

@@ -43,0 +43,0 @@ "buffer": "^6.0.1"

@@ -50,2 +50,9 @@ # @pythnetwork/client

You may also register to specific account updates using `connection.onAccountChange` in the solana web3 API, then
use the methods in `index.ts` to parse the on-chain data structures into Javascript-friendly objects.
use the methods in `index.ts` to parse the on-chain data structures into Javascript-friendly objects.
## Releases
In order to release a new version of this library and publish it to npm, follow these steps:
1. Update `CHANGELOG.md` with a description of the changes in this version.
2. Run `npm version <new version number>`. This command will update the version of the package, tag the branch in git, and push your changes to github.
3. Once your change is merged into `main`, a github action will automatically publish a new version of the package to npm.
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