Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@opiumteam/opium-sdk-v2
Advanced tools
one-stop-shop SDK to interact with the Opium-v2 protocol contracts, subgraphs and APIs
The OpiumV2SDK
class is the entry-point to all the core functionality of the SDK.
The SDK is divided in 4 main services:
It includes class wrappers to facilitate the interaction with the Opium V2 core contract, respectively Registry, Core, SyntheticAggregator, OracleAggregator. The address of the contracts will be automatically initialized according to the chainId
with which the SDK class had been initialized.
It allows to easily query the Opium V2 subgraph according to the chainId
with which the SDK class had been initialized.
It allows to perform some useful queries about the protocol parameters - i.e.: calculate the derivative hash for a given derivative, calculate the LONG/SHORT positions addresses for a given derivative etc. - either locally via ethers.js
or by calling a helper contract.
It allows to query the state of user-defined contracts running on the Opium V2 protocol - i.e: oracleIds and syntheticIds.
yarn add @opiumteam/opium-sdk-v2
You can easily initialize the OpiumV2SDK
by passing a valid rpcUrl and its associated chainId, as in the following code snippet:
const main = async () => {
const sdk = new OpiumV2SDK({
rpcUrl: 'https://rinkeby.arbitrum.io/rpc',
chainId: 421611,
});
const { registryInstance, subgraphService, simulatorService, derivativeLensFactory } = sdk;
const { coreInstance, oracleAggregatorInstance, syntheticAggregatorInstance } = await sdk.setup();
};
OpiumV2SDK
, the registryInstance, subgraphService, simulatorService, derivativeLensFactory will be instantiated.setup
function: this is because the addresses used for the initialization of the core wrapped contracts are fetched directly from the Opium V2 Registry contract as to avoid forcing the users to pass them manually.JsonRpcProvider
provider by passing a web3.js provider in the override
field. Read more here.export interface IOpiumV2SDKConfig {
rpcUrl: string;
chainId: number;
override?: providers.ExternalProvider;
}
SimulatorService
class to calculate the LONG/SHORT positions addresses locally by using the ethers.utils.getCreate2Address
FAQs
one-stop-shop SDK to interact with the Opium-v2 protocol contracts, subgraphs and APIs
We found that @opiumteam/opium-sdk-v2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.