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

meng-vaults-sdk

v0.1.15

Published

TypeScript SDK for MetEngine Vaults

Downloads

1,720

Readme

meng-vaults-sdk

TypeScript SDK for MetEngine Vaults — multi-protocol DeFi vaults on Solana.

Install

npm install meng-vaults-sdk @solana/kit

Usage

  1. Fetch a vault
import { fetchVault, encodeVaultName, getVaultPda } from "meng-vaults-sdk";

const [vaultAddress] = await getVaultPda(encodeVaultName("sol-vault"));
const vault = await fetchVault(rpc, vaultAddress);
  1. Initialize depositor account (required once before first deposit)
import { getInitializeDepositorInstruction, getVaultDepositorPda } from "meng-vaults-sdk";

const [depositorAddress] = await getVaultDepositorPda(vaultAddress, signer.address);

const ix = getInitializeDepositorInstruction({
  vault: vaultAddress,
  vaultDepositor: depositorAddress,
  authority: signer,
  payer: signer,
});
  1. Deposit
import { getDepositInstruction } from "meng-vaults-sdk";

const ix = getDepositInstruction({
  globalConfig: globalConfigAddress,
  vault: vaultAddress,
  vaultDepositor: depositorAddress,
  vaultTokenAccount: vault.data.tokenAccount,
  shareMint: vault.data.shareMint,
  userTokenAccount,
  userShareAccount,
  authority: signer,
  amount: 1_000_000n,
  minSharesOut: 0n,
});
  1. Request withdraw (locks shares, starts redeem period)
import { getRequestWithdrawInstruction } from "meng-vaults-sdk";

const ix = getRequestWithdrawInstruction({
  vault: vaultAddress,
  vaultDepositor: depositorAddress,
  vaultTokenAccount: vault.data.tokenAccount,
  userShareAccount,
  authority: signer,
  shares: 500_000n,
});
  1. Withdraw (after redeem period has passed)
import { getWithdrawInstruction } from "meng-vaults-sdk";

const ix = getWithdrawInstruction({
  vault: vaultAddress,
  vaultDepositor: depositorAddress,
  vaultTokenAccount: vault.data.tokenAccount,
  shareMint: vault.data.shareMint,
  userTokenAccount,
  userShareAccount,
  authority: signer,
});
  1. Cancel withdraw request
import { getCancelWithdrawRequestInstruction } from "meng-vaults-sdk";

const ix = getCancelWithdrawRequestInstruction({
  vault: vaultAddress,
  vaultDepositor: depositorAddress,
  authority: signer,
});
  1. Emergency withdraw (skips redeem period, pays emergency fee)
import { getEmergencyWithdrawInstruction } from "meng-vaults-sdk";

const ix = getEmergencyWithdrawInstruction({
  vault: vaultAddress,
  vaultDepositor: depositorAddress,
  vaultTokenAccount: vault.data.tokenAccount,
  shareMint: vault.data.shareMint,
  userTokenAccount,
  userShareAccount,
  authority: signer,
  shares: 500_000n,
});
  1. Close depositor account (reclaim rent, must have 0 shares)
import { getCloseDepositorInstruction } from "meng-vaults-sdk";

const ix = getCloseDepositorInstruction({
  vault: vaultAddress,
  vaultDepositor: depositorAddress,
  userShareAccount,
  authority: signer,
});

Accounts

import {
  fetchVault,
  fetchMaybeVault,
  fetchAllVault,
  fetchVaultDepositor,
  fetchMaybeVaultDepositor,
  fetchGlobalConfig,
} from "meng-vaults-sdk";

const vault = await fetchVault(rpc, vaultAddress);
const depositor = await fetchMaybeVaultDepositor(rpc, depositorAddress);
const vaults = await fetchAllVault(rpc, [vault1, vault2, vault3]);
const config = await fetchGlobalConfig(rpc, globalConfigAddress);

PDA Helpers

import {
  getVaultPda,
  getVaultDepositorPda,
  getVaultTokenAccountPda,
  getShareMintPda,
  getWhitelistEntryPda,
  getShareMintMetadataPda,
  encodeVaultName,
} from "meng-vaults-sdk";

const [vault] = await getVaultPda(encodeVaultName("sol-vault"));
const [depositor] = await getVaultDepositorPda(vault, userAddress);
const [tokenAccount] = await getVaultTokenAccountPda(vault);
const [shareMint] = await getShareMintPda(vault);
const [whitelist] = await getWhitelistEntryPda(vault, userAddress);
const [metadata] = await getShareMintMetadataPda(shareMint);

Math

import { calcSharePrice, calcSharesForDeposit, calcTokensForShares } from "meng-vaults-sdk";

const price = calcSharePrice(vault.data, idleBalance);
const sharesOut = calcSharesForDeposit(vault.data, idleBalance, depositAmount);
const tokensOut = calcTokensForShares(vault.data, idleBalance, sharesToRedeem);

Program

import {
  MENG_VAULTS_PROGRAM_ADDRESS,
  identifyMengVaultsInstruction,
  identifyMengVaultsAccount,
} from "meng-vaults-sdk";