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

hoodvault-sdk

v0.1.0

Published

TypeScript SDK for the Hoodvault protocol on Robinhood Chain — lending, co-buy vaults, synthetic baskets and one-click leverage over tokenized stocks.

Readme

hoodvault-sdk

TypeScript SDK for the Hoodvault protocol on Robinhood Chain (chain id 4663) — borrow USDG against tokenized stocks, co-own baskets in vaults, take oracle-settled synthetic basket exposure (capped $30/basket pilot), and open one-click leverage.

Thin, typed wrappers over viem. All contract addresses and the 6 synthetic baskets are baked in, so the package is self-contained.

npm install hoodvault-sdk viem

viem (^2.21.0) is a peer dependency — install it alongside so your app controls the version.

Quick start

import { HoodvaultClient, fromUsdg, fromWad, healthFactorToNumber } from 'hoodvault-sdk';

// read-only (defaults to the public RPC; override with HOODVAULT_RPC_URL or { rpcUrl })
const hv = new HoodvaultClient();

const reserve = await hv.lending.reserveAvailable();
console.log('pool reserve:', fromUsdg(reserve), 'USDG');

// per-basket synthetic index + remaining cap
for (const b of hv.synthetic.baskets()) {
  const [index, capLeft] = await Promise.all([
    hv.synthetic.basketIndex(b.id),
    hv.synthetic.capLeft(b.id),
  ]);
  console.log(`#${b.id} ${b.name}: index=${fromWad(index)}  capLeft=${fromUsdg(capLeft)} USDG`);
}

Signing transactions

Pass an account — a private-key hex or a viem Account. Amounts are native USDG (6 decimals); use hv.toUsdg('12.5') to convert.

const hv = new HoodvaultClient({ account: process.env.PRIVATE_KEY as `0x${string}` });
const me = hv.address!;

// deposit collateral → borrow USDG
await hv.approve(collateralToken, hv.addresses.LendingPool, amount);
await hv.waitForReceipt(await hv.lending.deposit(collateralToken, amount));
await hv.waitForReceipt(await hv.lending.borrow(hv.toUsdg('50')));

const acct = await hv.lending.accountData(me);
console.log('debt:', fromWad(acct.debtUSDG), 'USD');
console.log('health factor:', healthFactorToNumber(acct.healthFactor));

// repay (needs USDG approval to the pool)
await hv.approve(hv.addresses.USDG, hv.addresses.LendingPool, hv.toUsdg('50'));
await hv.lending.repay(hv.toUsdg('50'));

Synthetic baskets

The protocol is the counterparty: P&L is computed from the oracle and settled in USDG (no real stock is bought — a cash-settled derivative, capped at $30 per basket, pilot).

// open a $5 position in basket #1 (AI & Semiconductors)
await hv.approve(hv.addresses.USDG, hv.addresses.SyntheticVault, hv.toUsdg('5'));
await hv.waitForReceipt(await hv.synthetic.deposit(1, hv.toUsdg('5')));

// … later, read current value and close by positionId
console.log('value now:', fromUsdg(await hv.synthetic.positionValue(positionId)), 'USDG');
await hv.synthetic.redeem(positionId);

Leverage

// first time only: approve collateral to the pool and set the router as operator
await hv.lending.setOperator(hv.addresses.LeverageRouter, true);
await hv.approve(collateralToken, hv.addresses.LendingPool, amount);

// leverage into a synthetic basket (id) or a real CoBuy vault (address)
await hv.leverage.openLeverageSynthetic(collateralToken, amount, hv.toUsdg('10'), 1);
// close (only the opener can)
await hv.leverage.closeLeverageSynthetic(positionId, 2n ** 255n);

Real CoBuy vaults

const vaults = await hv.vaults.list();
for (const v of vaults) {
  console.log(v, fromWad(await hv.vaults.nav(v)), await hv.vaults.basketOf(v));
}
await hv.vaults.deposit(vault, hv.toUsdg('5'));   // needs USDG approval to the vault

What's exported

  • HoodvaultClient with .lending, .vaults, .synthetic, .leverage modules.
  • ADDRESSES, BASKETS, CHAIN_ID, robinhoodChain, USDG_DECIMALS, SYNTH_CAP.
  • ABIs: lendingPoolAbi, syntheticVaultAbi, leverageRouterAbi, vaultAbi, collateralManagerAbi, … (with typed events).
  • Client factories: createHoodvaultPublicClient, createHoodvaultWalletClient.
  • Utils: toUsdg / fromUsdg (6 dec), toWad / fromWad (1e18), healthFactorToNumber, maxBorrowNative, projectHealthFactor, formatUsd, parseHoodvaultError.

Units

  • USDG is 6 decimals. Borrow/repay/deposit amounts are native USDG.
  • Debt, prices, USD values and the health factor are WAD (1e18). Liquidation happens below 1e18.

Synthetic baskets are a capped pilot and a cash-settled derivative; not investment advice, not for public use pending regulatory review.

License

MIT