npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@voltz-protocol/v1-sdk

v1.177.2

Published

A TypeScript wrapper for the Voltz smart contract

Downloads

323

Readme

| Statements | Branches | Functions | Lines | | --------------------------- | ----------------------- | ------------------------- | ----------------- | | Statements | Branches | Functions | Lines |

Voltz SDK

This is the Typescript SDK for Voltz Protocol v1. The main functions of the SDK which interact with the smart contracts in the voltz-core repository are in the amm.ts file. You can also find in-depth documentation on the functions in amm.ts here.

Installation before setup

  1. Run yarn

Setup

Before you can run the SDK you need to set up the core repository and spin up a local node using the following commands in the core repository.

(in core): yarn deploy:localhost
(in core): npx hardhat createIrsInstance --network localhost --rate-oracle MockTokenRateOracle

Note, you may get a PF value already set error after running the npx hardhat createIrsInstance --network localhost --rate-oracle MockTokenRateOracle command. This is expected as the PF variable (protocol fee) has already been setby default. The actual IRS instance gets deployed despite the error and we will in future releases account for this in a deployment script.

Next, make a note of the first address created (i.e. Account #0) by the local node and mint some ERC20 tokens.

...

Accounts
========

WARNING: These accounts, and their private keys, are publicly known.
Any funds sent to them on Mainnet or any other live network WILL BE LOST.

Account #0: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (10000 ETH)
Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

...

The address should be included in --beneficiaries:

(in core): npx hardhat mintTestTokens --network localhost --beneficiaries 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 --amount 10000
(in core): npx hardhat updatePositionMargin --network localhost --meaddress "0x75537828f2ce51be7289709686A69CbFDbB714F1"  --owner 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 --tickupper 0 --ticklower -7000 --margindelta 100

Run test functions

To run the tests execute yarn test. This runs all the tests inside the /tests directory.

Testing local version in UI using yalc

Creating the link between repos

  1. SDK -> Run yarn build-release (this prepares the JS build files)
  2. SDK -> Run npx yalc publish
  3. UI repo, to test local version(link) -> run npx yalc add @voltz-protocol/v1-sdk

Pushing changes on code changes in SDK

  1. SDK -> Perform code changes
  2. SDK -> Run yarn yalc:push-changes
  3. If you have the UI repo running, changes will be refreshed automatically or via refresh in browser
  4. Repeat 1->3 on new code changes

Terms & Conditions

The Voltz Protocol, and any products or services associated therewith, is offered only to persons (aged 18 years or older) or entities who are not residents of, citizens of, are incorporated in, owned or controlled by a person or entity in, located in, or have a registered office or principal place of business in any “Restricted Territory.”

The term Restricted Territory includes the United States of America (including its territories), Algeria, Bangladesh, Bolivia, Belarus, Myanmar (Burma), Côte d’Ivoire (Ivory Coast), Egypt, Republic of Crimea, Cuba, Democratic Republic of the Congo, Iran, Iraq, Liberia, Libya, Mali, Morocco, Nepal, North Korea, Oman, Qatar, Somalia, Sudan, Syria, Tunisia, Venezuela, Yemen, Zimbabwe; or any jurisdictions in which the sale of cryptocurrencies are prohibited, restricted or unauthorized in any form or manner whether in full or in part under the laws, regulatory requirements or rules in such jurisdiction; or any state, country, or region that is subject to sanctions enforced by the United States, such as the Specially Designed Nationals and Blocked Persons List (“SDN List”) and Consolidated Sanctions List (“Non-SDN Lists”), the United Kingdom, or the European Union.