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

@nemoprotocol/nemo-sdk

v0.6.2

Published

Lightweight TypeScript SDK for building NEMO transactions and queries on Sui.

Downloads

18

Readme

NEMO Protocol SDK

Lightweight TypeScript SDK for building NEMO transactions and queries on Sui.

Installation

pnpm add @nemoprotocol/nemo-sdk
# or
npm i @nemoprotocol/nemo-sdk
# or
yarn add @nemoprotocol/nemo-sdk

Quick Start: Mint LP

Mint LP using the high-level Market API. The config is resolved from the public API using a marketStateId.

import { Transaction } from "@mysten/sui/transactions";
import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
import { Market } from "@nemoprotocol/nemo-sdk";

async function main() {
  // 1) Create tx and resolve Market via API
  const tx = new Transaction();
  const marketStateId = "0x..."; // replace with a real Market state id
  const market = await Market.fromMarketState(tx, marketStateId);

  // 2) Prepare inputs (must be real on-chain objects/ids owned by the sender)
  const syCoin = tx.object("0x...");       // SY coin object to deposit
  const ptAmount = tx.object("0x...");     // PT coin object (paired with SY)
  const pyPosition = tx.object("0x...");   // Your PY position object id

  // 3) Build the mint_lp call on the tx
  const { result: lpCoin } = await market.market.mintLp(
    syCoin,
    ptAmount,
    "950000000",  // min LP amount (base units)
    pyPosition
  );

  // 4) Sign & execute
  const client = new SuiClient({ url: getFullnodeUrl("mainnet") });
  // const keypair = ... // load your Ed25519 keypair
  // const resp = await client.signAndExecuteTransaction({ signer: keypair, transaction: tx });
  // console.log("txDigest:", resp.digest);
}

main().catch(console.error);

Notes:

  • mintLp automatically fetches a price voucher via the Oracle module.
  • Prefer manual config? Use buildMarketConfigFromApi(marketStateId) and new Market(tx, config).

Quick Start: Get SY and Mint PY from SY

The flow below shows how to get SY (via SY providers) and then mint PY from SY using PyManager.

import { Transaction } from "@mysten/sui/transactions";
import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
import { SyManager, PyManager } from "@nemoprotocol/nemo-sdk";

async function main() {
  const tx = new Transaction();
  const marketStateId = "0x..."; // replace with a real Market state id

  // 1) Get SY by depositing underlying via SyManager
  const syManager = await SyManager.fromMarketState(tx, marketStateId);
  const underlyingCoin = tx.object("0xunderlying-coin-object-id");
  const { result: syCoin } = await syManager.depositToSy({
    coin: underlyingCoin,
  });

  // 2) Initialize a new PY position and mint PY from SY
  const py = await PyManager.fromMarketState(tx, marketStateId);
  const { result: pyPosition } = await py.positions.initPyPosition();

  const { result: mintedPy } = await py.yield.mintPy(
    syCoin,
    pyPosition
  );

  // 3) Optional: redeem to SY later
  // const { result: redeemedSy } = await py.yield.redeemPy("100", "100", pyPosition);

  // 4) Sign & execute
  const client = new SuiClient({ url: getFullnodeUrl("mainnet") });
  // const keypair = ...
  // const resp = await client.signAndExecuteTransaction({ signer: keypair, transaction: tx });
}

main().catch(console.error);

Quick Start: SY from Market State ID

You can directly create an SyManager from a marketStateId. The SDK will resolve the SY provider via the public API and preload it for you.

import { Transaction } from "@mysten/sui/transactions";
import { SyManager } from "@nemoprotocol/nemo-sdk";

async function main() {
  const tx = new Transaction();
  const marketStateId = "0x..."; // replace with a real Market state id

  // Create from market state id (preloads provider)
  const sy = await SyManager.fromMarketState(tx, marketStateId);

  // Mint sCoin from underlying
  const underlyingCoin = tx.object("0xunderlying-coin-object-id");
  const { result: sCoin } = await sy.mintSCoin({
    marketStateId,
    coin: underlyingCoin,
    amount: "1000000",
  });

  // Optional: burn back to underlying
  // await sy.burnSCoin({ marketStateId, sCoin, address: "0xyour-address" });
}

main().catch(console.error);

Query Operations: LP Amount Estimations

The QueryOperations class provides methods to estimate LP token amounts for various operations. These methods use dry-run transactions to calculate expected outputs without executing actual transactions.

Get LP Out for Single SY In

Estimates the LP token amount you would receive when depositing a single SY coin into the market.

import { Transaction } from "@mysten/sui/transactions";
import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
import { Market } from "@nemoprotocol/nemo-sdk";

async function main() {
  const tx = new Transaction();
  const marketStateId = "0x..."; // replace with a real Market state id
  const market = await Market.fromMarketState(tx, marketStateId);

  const suiClient = new SuiClient({ url: getFullnodeUrl("mainnet") });
  const sender = "0x..."; // your wallet address

  // Estimate LP output for depositing 1000000 SY tokens (base units)
  const { result } = await market.query.getLpOutForSingleSyIn(
    "1000000", // syAmountIn: amount of SY tokens to deposit
    suiClient,
    sender
  );

  console.log("Estimated LP output:", result.lpOut);
  console.log("SY fee:", result.syFee);
  console.log("SY to reserve:", result.syToReserve);
}

main().catch(console.error);

Get LP Out from Mint LP

Estimates the LP token amount you would receive when minting LP tokens with both PT and SY coins.

import { Transaction } from "@mysten/sui/transactions";
import { SuiClient, getFullnodeUrl } from "@mysten/sui/client";
import { Market } from "@nemoprotocol/nemo-sdk";

async function main() {
  const tx = new Transaction();
  const marketStateId = "0x..."; // replace with a real Market state id
  const market = await Market.fromMarketState(tx, marketStateId);

  const suiClient = new SuiClient({ url: getFullnodeUrl("mainnet") });
  const sender = "0x..."; // your wallet address

  // Estimate LP output for minting with 500000 PT and 1000000 SY tokens
  const { result } = await market.query.getLpOutFromMintLp(
    "1000000",  // ptValue: amount of PT tokens
    "2000000", // syValue: amount of SY tokens
    suiClient,
    sender
  );

  console.log("Estimated LP output:", result);
}

main().catch(console.error);

More examples

See the samples/ directory for runnable scripts:

  • samples/py-manager-basic.ts
  • samples/py-yield.ts
  • samples/py-query.ts
  • samples/py-get-sy-pt.ts (estimate PT from mintPy and read SY on redeem)
  • samples/market.ts (Market.mintLp build example)
  • samples/sy-from-market-state.ts (Create SyManager from marketStateId and mint/burn sCoin)