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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rheo/sdk

v0.3.2

Published

Rheo TypeScript SDK

Readme

@rheo/sdk Coverage Status npm version

Rheo TypeScript SDK

Installation

npm install @rheo/sdk

Usage

import { ethers } from "ethers";
import SDK from "@rheo/sdk";

// Initialize the SDK with the Size Factory address and market addresses
const sdk = new SDK({
  sizeFactory: "<SIZE_FACTORY_ADDRESS>",
  version: "v1.8", // or "v1.7" | "v1.9"
  labels: {
    "<SIZE_FACTORY_ADDRESS>": "SizeFactory",
  },
});

Features

Build the transaction target and calldata from an array of operations

v1.9 notes:

  • Fixed-maturity offers only: buy/sellCreditLimit use { maturities[], aprs[] }.
  • Market orders take maturity (not tenor).
  • sizeFactory is used for both legacy Size markets and new Rheo markets. There is no RheoFactory.
const txs = size.tx.build(alice, [
  size.market.setUserConfiguration(market2, {
    vault: "0x000000000000000000000000000000000000eeee",
    openingLimitBorrowCR: 0,
    allCreditPositionsForSaleDisabled: false,
    creditPositionIdsForSale: false,
    creditPositionIds: [],
  }),
  size.market.deposit(market1, {
    amount: BigNumber.from(100),
    to: "0x0000000000000000000000000000000000001337",
    token: "0x4200000000000000000000000000000000000006",
  }),
  size.market.copyLimitOrders(market1, {
    copyLoanOfferConfig: size.constants.FullCopy,
    copyBorrowOfferConfig: size.constants.NoCopy,
  }),
  size.factory.subscribeToCollections([42n]),
]);

// The SDK will automatically:
// 1. Combine operations into a single transaction when possible
// 2. Handle authorization for operations that require it
// 3. Use multicall for batch operations
// 4. Handle ERC20 approvals separately

Error Decoding

try {
  await tx.wait();
} catch (error) {
  const decodedError = size.errorDecoder.decode(error.data);
  console.log(decodedError);
  // Example outputs:
  // - "ERC20InsufficientBalance(0x123..., 1000000, 2000000)"
  // - "MUST_IMPROVE_COLLATERAL_RATIO(0x123..., 1500000, 1400000)"
  // - "INVALID_APR_RANGE(500000, 1000000)"
  // - "LOAN_NOT_SELF_LIQUIDATABLE(123, 1500000, 1)"
}

Calldata Decoding

const decodedCalldata = size.calldataDecoder.decode(tx.data);
console.log(decodedCalldata);
// Example output:
// multicall(
//   [
//     setAuthorization(
//       SizeFactory,
//       [DEPOSIT,WITHDRAW,SELL_CREDIT_MARKET]
//     ),
//     callMarket(
//       0x0000000000000000000000000000000000000123,
//       depositOnBehalfOf(
//         {
//           params: {
//             token: 0x4200000000000000000000000000000000000006,
//             amount: 300,
//             to: 0x0000000000000000000000000000000000010000
//           },
//           onBehalfOf: 0x0000000000000000000000000000000000010000
//         }
//       )
//     ),
//     callMarket(
//       0x0000000000000000000000000000000000000123,
//       sellCreditMarketOnBehalfOf(
//         {
//           params: {
//             lender: 0x0000000000000000000000000000000000020000,
//             creditPositionId: type(uint256).max,
//             amount: 100,
//             tenor: 31536000,
//             deadline: 1893456000,
//             maxAPR: type(uint256).max,
//             exactAmountIn: false,
//             collectionId: 0,
//             rateProvider: address(0)
//           },
//           onBehalfOf: 0x0000000000000000000000000000000000010000,
//           recipient: 0x0000000000000000000000000000000000010000
//         }
//       )
//     ),
//     callMarket(
//       0x0000000000000000000000000000000000000456,
//       depositOnBehalfOf(
//         {
//           params: {
//             token: 0x0000000000000000000000000000000000007777,
//             amount: 400,
//             to: 0x0000000000000000000000000000000000010000
//           },
//           onBehalfOf: 0x0000000000000000000000000000000000010000
//         }
//       )
//     ),
//     callMarket(
//       0x0000000000000000000000000000000000000456,
//       sellCreditMarketOnBehalfOf(
//         {
//           params: {
//             lender: 0x0000000000000000000000000000000000030000,
//             creditPositionId: type(uint256).max,
//             amount: 100,
//             tenor: 31536000,
//             deadline: 1893456000,
//             maxAPR: type(uint256).max,
//             exactAmountIn: false,
//             collectionId: 0,
//             rateProvider: address(0)
//           },
//           onBehalfOf: 0x0000000000000000000000000000000000010000,
//           recipient: 0x0000000000000000000000000000000000010000
//         }
//       )
//     ),
//     callMarket(
//       0x0000000000000000000000000000000000000123,
//       withdrawOnBehalfOf(
//         {
//           params: {
//             token: 0x0000000000000000000000000000000000008888,
//             amount: type(uint256).max,
//             to: 0x0000000000000000000000000000000000010000
//           },
//           onBehalfOf: 0x0000000000000000000000000000000000010000
//         }
//       )
//     ),
//     setAuthorization(
//       SizeFactory,
//       []
//     )
//   ]
// ),

Testing

npm test

Publishing

# 1. Make sure tests pass
npm run test
# 2. Build
npm build
# 3. Publish
npm publish

Disclaimer

This code is provided "as is" and has not undergone a formal security audit.

Use it at your own risk. The author(s) assume no liability for any damages or losses resulting from the use of this code. It is your responsibility to thoroughly review, test, and validate its security and functionality before deploying or relying on it in any environment.