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

viem-erc7540

v1.0.0

Published

Viem extensions for ERC-7540 asynchronous tokenized vaults

Readme

viem-erc7540

Viem extensions for ERC-7540 asynchronous tokenized vaults

NPM version Package size Follow Hemi on X

Installation

Install viem, viem-erc20, viem-erc4626, and viem-erc7540 as dependencies:

npm install viem viem-erc20 viem-erc4626 viem-erc7540

Methods

This package provides ESM-friendly helpers for interacting with ERC-7540 asynchronous vault contracts using viem.

All the methods are named after the ERC-7540.

ERC-7540 extends ERC-4626, so every action from viem-erc4626 — which in turn re-exports every action from viem-erc20 — is also re-exported from viem-erc7540/actions. See their READMEs for the reference of those methods.

claimableDepositRequest

Returns the amount of requested assets in the Claimable state for the controller to deposit or mint. View docs

claimableDepositRequest(client, { address, controller, requestId });
  • client: Client — from viem — (required)
  • address: Address — ERC-7540 vault contract address (required)
  • controller: Address — Address that controls the request (required)
  • requestId: bigint — Identifier of the request. Vaults that aggregate all of a controller's requests use BigInt(0) (required)

Example:

import { claimableDepositRequest } from "viem-erc7540/actions";
const claimableAssets = await claimableDepositRequest(client, {
  address: "0x1234567891234567891234567891234567891234",
  controller: "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
  requestId: BigInt(0),
});

claimableRedeemRequest

Returns the amount of requested shares in the Claimable state for the controller to redeem or withdraw. View docs

claimableRedeemRequest(client, { address, controller, requestId });
  • client: Client — from viem — (required)
  • address: Address — ERC-7540 vault contract address (required)
  • controller: Address — Address that controls the request (required)
  • requestId: bigint — Identifier of the request. Vaults that aggregate all of a controller's requests use BigInt(0) (required)

Example:

import { claimableRedeemRequest } from "viem-erc7540/actions";
const claimableShares = await claimableRedeemRequest(client, {
  address: "0x1234567891234567891234567891234567891234",
  controller: "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
  requestId: BigInt(0),
});

pendingDepositRequest

Returns the amount of requested assets in the Pending state, not yet claimable. View docs

pendingDepositRequest(client, { address, controller, requestId });
  • client: Client — from viem — (required)
  • address: Address — ERC-7540 vault contract address (required)
  • controller: Address — Address that controls the request (required)
  • requestId: bigint — Identifier of the request. Vaults that aggregate all of a controller's requests use BigInt(0) (required)

Example:

import { pendingDepositRequest } from "viem-erc7540/actions";
const pendingAssets = await pendingDepositRequest(client, {
  address: "0x1234567891234567891234567891234567891234",
  controller: "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
  requestId: BigInt(0),
});

pendingRedeemRequest

Returns the amount of requested shares in the Pending state, not yet claimable. View docs

pendingRedeemRequest(client, { address, controller, requestId });
  • client: Client — from viem — (required)
  • address: Address — ERC-7540 vault contract address (required)
  • controller: Address — Address that controls the request (required)
  • requestId: bigint — Identifier of the request. Vaults that aggregate all of a controller's requests use BigInt(0) (required)

Example:

import { pendingRedeemRequest } from "viem-erc7540/actions";
const pendingShares = await pendingRedeemRequest(client, {
  address: "0x1234567891234567891234567891234567891234",
  controller: "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
  requestId: BigInt(0),
});

requestDeposit

Transfers assets from owner into the vault and submits a request for an asynchronous deposit. View docs

requestDeposit(client, { address, assets, controller, owner });
  • client: Client — from viem — (required)
  • address: Address — ERC-7540 vault contract address (required)
  • assets: bigint — Amount of assets to deposit (required)
  • controller: Address — Address that will control the request (required)
  • owner: Address — Address that owns the assets being deposited (required)

Example:

import { requestDeposit } from "viem-erc7540/actions";
const hash = await requestDeposit(client, {
  address: "0x1234567891234567891234567891234567891234",
  assets: BigInt("1000000000000000000"), // 1 asset
  controller: "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
  owner: "0x9876543219876543219876543219876543219876",
});

requestRedeem

Assumes control of shares from owner and submits a request for an asynchronous redeem. View docs

requestRedeem(client, { address, controller, owner, shares });
  • client: Client — from viem — (required)
  • address: Address — ERC-7540 vault contract address (required)
  • controller: Address — Address that will control the request (required)
  • owner: Address — Address that owns the vault shares (required)
  • shares: bigint — Amount of shares to redeem (required)

Example:

import { requestRedeem } from "viem-erc7540/actions";
const hash = await requestRedeem(client, {
  address: "0x1234567891234567891234567891234567891234",
  controller: "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
  owner: "0x9876543219876543219876543219876543219876",
  shares: BigInt("1000000000000000000"), // 1 share
});