Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@synthetixio/js
Advanced tools
:warning: This library is still under construction and in BETA, please use with caution.
This library can be used in 2 different environments:
// For node environments:
const { synthetix } = require('@synthetixio/js');
// For single page applications:
import { synthetix } from '@synthetixio/js';
// For browser environments:
// after running npm build take the index.browser.js file and put it in a script tag
// then you can access synthetix on the window object:
const { synthetix } = window;
const snxjs = synthetix({ network: 'mainnet' });
// Note for typescript applications:
import { synthetix, Network } from '@synthetixio/js';
const snxjs = synthetix({ network: Network.Mainnet });
// this instance exposes props for the given network: synths, sources, targets, users, etc... as well as helper function toBytes32 - as per synthetix: https://github.com/Synthetixio/synthetix/blob/develop/index.js#L199.
const snxjs = synthetix({ network: 'mainnet' });
// If you want to interact with a contract, simply follow the convention:
// await snxjs[contractName].methodName(arguments)
// many arguments require being formatted toBytes32, which we also provide with the library
// Note can optionally pass in a { blockTag: someBlockNumber } to get data from a specific block instead of {}
E.g:
const unformattedSnxPrice = await snxjs.contracts.ExchangeRates.rateForCurrency(snxjs.toBytes32('SNX'), {});
const unformattedTotalSupply = await snxjs.contracts.SynthsUSD.totalSupply({});
// We also expose ethers utils which provides handy methods for formatting responses to queries.
const { formatEther } = snxjs.utils;
const snxPrice = formatEther(unformattedSnxPrice);
const totalSupply = formatEther(unformattedTotalSupply);
See the examples folder for more usage details
FAQs
A library for interacting with Synthetix smart contracts
The npm package @synthetixio/js receives a total of 328 weekly downloads. As such, @synthetixio/js popularity was classified as not popular.
We found that @synthetixio/js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.