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

@evmnow/api-client

v0.3.0

Published

TypeScript client for the EVM Now API.

Downloads

655

Readme

@evmnow/api-client

import { evmNowApi } from '@evmnow/api-client'

const api = evmNowApi({ key: 'evm_now_key' })
const token = await api.token.metadata(
  '0x0000000000000000000000000000000000000000',
  '1',
)

console.log(token.name)
console.log(token.tokenUri)
console.log(token.sourceImageUri)
console.log(token.image?.sm)

Async image caching

Token images are cached on a background queue. metadata() polls the API until the image is ready (default: every 2.5s, up to 60s) and resolves with the fully cached metadata.

const token = await api.token.metadata(contract, tokenId, {
  pollIntervalMs: 2500,
  maxWaitMs: 60_000,
  signal: controller.signal,
  onPending: (partial) => {
    // Render `partial.name` and `partial.sourceImageUri` while waiting.
    // `partial.image` is null until the cache catches up.
  },
})

Set maxWaitMs: 0 to make a single request with no polling.

Single-shot mode (fetchMetadata)

When you want to drive polling yourself — e.g. a frontend that polls a proxy endpoint and renders the partial response while waiting — use fetchMetadata. It makes exactly one request and returns a discriminated union, never throwing on a pending response.

import type { TokenMetadataResponse } from '@evmnow/api-client'

const response: TokenMetadataResponse = await api.token.fetchMetadata(
  contract,
  tokenId,
)

if (response.status === 'ready') {
  // response.data.image is populated.
} else {
  // status === 'pending' — render response.data.name / sourceImageUri,
  // then call fetchMetadata again later.
}

metadata() is implemented as a polling wrapper around fetchMetadata.

Errors

  • EvmNowApiError — thrown for HTTP errors and when the server returns status: 'error' (e.g. unresolvable metadata). The server's error message is on .message.
  • EvmNowMetadataPendingError (extends EvmNowApiError) — thrown when polling exhausts maxWaitMs. The last partial TokenMetadata is on .lastData so you can still render name / sourceImageUri.
import {
  evmNowApi,
  EvmNowApiError,
  EvmNowMetadataPendingError,
} from '@evmnow/api-client'

try {
  const token = await api.token.metadata(contract, tokenId)
} catch (err) {
  if (err instanceof EvmNowMetadataPendingError) {
    // Image still caching — render with err.lastData and retry later.
  } else if (err instanceof EvmNowApiError) {
    // Server-side or HTTP error.
  }
}

Examples

In a repository checkout, copy .env.example to .env and set EVM_NOW_API_KEY.

pnpm example:fetch-token-metadata -- 0x3b3ee1931dc30c1957379fac9aba94d1c48a5405 77879

You can also set TOKEN_CONTRACT_ADDRESS and TOKEN_ID in .env, then run:

pnpm example:fetch-token-metadata