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

@obsidia/xnap

v1.0.0

Published

Send and receive Nano (XNO) directly from MetaMask

Readme

Xnap RPC API Documentation

Xnap provides several RPC methods that websites can use to interact with the Nano network through MetaMask. All methods are accessible through the wallet_invokeSnap MetaMask method and return a JSON object.

Connecting to Xnap

const result: any = await window.ethereum.request({
  method: 'wallet_requestSnaps',
  params: {
    // the snapId
    'npm:@obsidia/xnap': {
      // Version is optional, use it to specify the version range of the snap or leave as empty object
      version: '1.0.0',
    },
  },
});

More information about connecting to a snap can be found in MetaMask's docs.

JSON-RPC Methods

xno_getCurrentAddress

Returns the currently active Nano address and a unique Jazzicon representation.

Parameters: None

Returns:

  • address: string | undefined - The current Nano address or undefined if no address is selected.
  • icon: string | undefined - unique Jazzicon for the address as an SVG element, or undefined if no address is selected.

Example:

const response = await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: 'npm:@obsidia/xnap',
    request: {
      method: 'xno_getCurrentAddress',
    },
  },
});

// console.log(response.address); -> "nano_1xyz..."

xno_makeTransaction

Initiates a send transaction. This will prompt the user for confirmation before sending.

Parameters:

  • to: string - The recipient's Nano address or a Nano internet identifier.
  • value: string - The amount to send (in nano), use decimal point for fractions.

Returns:

  • hash: string | undefined - The transaction hash if successful, undefined otherwise

Example:

const response = await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: 'npm:@obsidia/xnap',
    request: {
      method: 'xno_makeTransaction',
      params: {
        to: 'nano_1xyz...', // or @[email protected]
        value: '1.5',
      },
    },
  },
});

xno_signMessage

Requests signing a message using the currently active Nano account.

Parameters:

  • message: string - The message to sign

Returns:

  • signature: string | undefined - The signature if successful, undefined otherwise

Example:

const response = await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: 'npm:@obsidia/xnap',
    request: {
      method: 'xno_signMessage',
      params: {
        message: 'Hello, Nano!', // or JSON.stringify({msg: "some message to sign"})
      },
    },
  },
});

Error Handling

All methods may throw errors if:

  • The method name is not supported
  • The parameters are invalid
  • The user rejects the request
  • There are network issues
  • The Snap is not properly initialized

Errors will be returned in the standard MetaMask error format with appropriate error codes and messages. Full list of error codes can be found here.

Example error handling:

window.ethereum
  .request({
    method: 'wallet_invokeSnap',
    params: {
      snapId: 'npm:@obsidia/xnap',
      request: {
        method: 'xno_makeTransaction',
        params: {
          to: 'invalid_nano_address',
          value: '1.5',
        },
      },
    },
  })
  .then((res: any) => {})
  .catch((error: { code: number, message: string }) => {
    console.error(error.message); // "Method parameters are invalid"
  });