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 🙏

© 2025 – Pkg Stats / Ryan Hefner

curvance

v3.1.10

Published

A SDK to explore the curvance protocol efficently & easily.

Downloads

5,244

Readme

Features

  • Efficient RPC Usage: Preloads all market data with minimal calls.
  • Typed Contracts: Uses ethers.js for safe, typed blockchain interactions.
  • Price Feeds: Integrates Redstone for on-chain price updates.
  • Decimal Support: Handles BigInt and floating-point math with decimal.js.
  • Flexible Providers: Works with multiple providers:
    • ethers.Wallet - For CLI/Local wallet connections
    • ethers.JsonRpcSigner - For browser interactions
    • ethers.JsonRpcProvider - For a user configured RPC
    • null - We setup a JsonRpcProvider if we configured one for you
  • Property conversions: For example getting a users asset balance can optionally be returned in USD or token amount
  • Contract addresses: Use this package to pull in curvance contracts & have the latest contract addresses (especially useful on testnet)

Dependencies:

  • Redstone: Used to attach price updates in a multicall for some actions.
  • Decimals: Any floating point path being done with BigInt is done with Decimals.
  • ethers.js: All signers passed into the protocol are using ether.js typed signers.

Notes:

  • All values are returned in either BigInt or Decimals
  • We use alchemy chain prefixing for exaple: eth-mainnet or arb-sepolia to represents chains

❯ Install

$ npm install --save curvance

❯ Usage

Grab general information

This is very RPC efficient as it uses 1-3 RPC call's to setup all the data you need. This is the main way to use the SDK as ALL the data is pre-setup for you. All you need to do is traverse the markets.

const { markets, reader, faucet } = await setupChain("monad-testnet", wallet);

You can then explore the data pretty easily like so:

let count = 0;
console.log(`Market summaries in USD:`);
for(const market of markets) {
    console.log(`[${count}] tvl: ${market.tvl.toFixed(18)} | totalDebt: ${market.totalDebt.toFixed(18)} | totalCollateral: ${market.totalCollateral.toFixed(18)}`);
    for(const token of market.tokens) {
        console.log(`\tToken: ${token.symbol} | Price: ${token.getPrice()} | Amount: ${token.getTvl(false)}`);
    }
    count++;
}

Grab individaul classes

const test_1 = new ERC20(signer, `0x123`);
await test_1.approve(someGuy, BigInt(50e18));

Some of these classes use preloaded cache to prevent RPC calls for example

const test_1 = new ERC20(signer, `0x123`);
console.log(test_1.name); // Attempts to use cache for name, so this returns undefined
const name = await test_1.fetchName();
console.log(name); // My Test Token
console.log(test_1.name); // My Test Token

Note: Protocol reader will populate things like test_1.name for underlying assets from the first preload RPC call and wont need to be fetched.

Helpers

  • getContractAddresses - Grab the contracts addresses for a given chain
  • AdaptorTypes - Adaptor identifier enums
  • WAD - WAD amount
  • WAD_DECIMAL - WAD amount as Decimal.js type
  • contractSetup - Used to initialize contract & attach typescript interface
  • handleTransactionWithOracles - Depending on what adaptor is being used to execute the function we choose to run a multi-call that will write-price on-chain with the given function -- but only if the adaptor is the type of adaptor that requires this (pull oracle)
const contracts = getContractAddresses('monad-testnet');
console.log(contracts.ProtocolReader);