Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@pythnetwork/client
Advanced tools
Pyth is building a way to deliver a decentralized, cross-chain market of verifiable data from high-quality nodes to any smart contract, anywhere.
This library consumes on-chain Pyth accountInfo.data
from @solana/web3.js and returns JavaScript-friendly objects.
See our examples repo for real-world usage examples.
import { Connection, PublicKey } from '@solana/web3.js'
import { parseMappingData, parsePriceData, parseProductData } from '@pythnetwork/pyth-client'
const connection = new Connection(SOLANA_CLUSTER_URL)
const publicKey = new PublicKey(ORACLE_MAPPING_PUBLIC_KEY)
connection.getAccountInfo(publicKey).then((accountInfo) => {
const { productAccountKeys } = parseMappingData(accountInfo.data)
connection.getAccountInfo(productAccountKeys[productAccountKeys.length - 1]).then((accountInfo) => {
const { product, priceAccountKey } = parseProductData(accountInfo.data)
connection.getAccountInfo(priceAccountKey).then((accountInfo) => {
const { price, confidence } = parsePriceData(accountInfo.data)
console.log(`${product.symbol}: $${price} \xB1$${confidence}`)
// SRM/USD: $8.68725 ±$0.0131
})
})
})
To get streaming price updates, you may want to use connection.onAccountChange
1.0.0
Initial release
FAQs
Client for consuming Pyth price data
The npm package @pythnetwork/client receives a total of 32,971 weekly downloads. As such, @pythnetwork/client popularity was classified as popular.
We found that @pythnetwork/client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.