
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@solana/sysvars
Advanced tools
An abstraction layer over signing messages and transactions in Solana
This package contains types and helpers for fetching and decoding Solana
sysvars. It can be used standalone, but it is also exported as part of the
Solana JavaScript SDK
@solana/web3.js@next
.
More information about the available sysvars on Solana can be found in the docs at https://docs.solanalabs.com/runtime/sysvars.
All currently available sysvars can be retrieved and/or decoded using this library.
This package offers a simple API for working with sysvars.
One can fetch an encoded sysvar account using an RPC client.
const maybeEncodedClock = await fetchEncodedSysvarAccount(rpc, SYSVAR_CLOCK_ADDRESS);
maybeEncodedClock satisfies MaybeEncodedAccount<'SysvarC1ock11111111111111111111111111111111'>;
One can also attempt to fetch a JSON-parsed sysvar account.
const maybeJsonParsedClock = await fetchJsonParsedSysvarAccount(rpc, SYSVAR_CLOCK_ADDRESS);
maybeJsonParsedClock satisfies
| MaybeAccount<JsonParsedSysvarAccount, 'SysvarC1ock11111111111111111111111111111111'>
| MaybeEncodedAccount<'SysvarC1ock11111111111111111111111111111111'>;
Each sysvar within the library ships with its own codec for deserializing the account data.
You can pair this codec with the helpers from
@solana/accounts
to assert and decode sysvar account data.
// Fetch.
const clock = await fetchEncodedSysvarAccount(rpc, SYSVAR_CLOCK_ADDRESS);
clock satisfies MaybeEncodedAccount<'SysvarC1ock11111111111111111111111111111111'>;
// Assert.
assertAccountExists(clock);
clock satisfies EncodedAccount<'SysvarC1ock11111111111111111111111111111111'>;
// Decode.
const decodedClock = decodeAccount(clock, getSysvarClockDecoder());
decodedClock satisfies Account<SysvarClock, 'SysvarC1ock11111111111111111111111111111111'>;
Each supported sysvar also ships with its own fetch-and-decode function to perform the steps above and return the decoded sysvar data.
const clock: SysvarClock = await fetchSysvarClock(rpc);
This package supports the following Solana sysvars:
Clock
EpochRewards
EpochSchedule
Fees
LastRestartSlot
RecentBlockhashes
Rent
SlotHashes
SlotHistory
StakeHistory
The Instructions
sysvar is also supported but does not exist on-chain,
therefore has no corresponding module or codec.
FAQs
An abstraction layer over signing messages and transactions in Solana
The npm package @solana/sysvars receives a total of 43,056 weekly downloads. As such, @solana/sysvars popularity was classified as popular.
We found that @solana/sysvars demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 14 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.