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

@nexusmutual/sdk

v1.31.2

Published

Nexus Mutual SDK

Readme

Nexus Mutual SDK

Installation

npm install @nexusmutual/sdk

Usage

This package only exports CommonJS modules. You can import it like this:

// Usage with ES6 modules
import { products, productTypes } from '@nexusmutual/sdk';

Nexus Mutual contract addresses and abis

Source of truth for the latest mainnet addresses. Feeds into https://api.nexusmutual.io/sdk/.

Listed products and product types metadata

The products folder contains all protocols listed on Nexus Mutual.

If you're a protocol owner and want to update any details (i.e. logo, website, etc), please submit a PR. Logos should meet the following criteria:

  • svg format, with 1:1 ratio
  • no fixed width or height
  • the image should reach the edge of the viewbox

Development

Install dependencies

npm ci

ENV variables setup

Copy the .env.example file into .env and populate with the required values.

Build locally

npm build

IPFS Upload

Use the uploadIPFSContent method in Ipfs class to upload the content to IPFS. The function takes the following parameters:

  • type: The type of the content. Based on ContentType enum.
  • content: The content to be uploaded to IPFS as IPFSContentTypes.

The function returns the IPFS hash of the uploaded content.

For claims submission and assessment IPFS data, use the get32BytesIPFSHash method in Ipfs class to convert the IPFS hash you get from uploadIPFSContent to 32 bytes format. Use the getIPFSCidFromHexBytes method to convert back to standard IPFS hash.

Example

import { Ipfs } from '@nexusmutual/sdk';

const content: IPFSContentTypes = {
  version: '2.0',
  walletAddresses: ['0x1234567890'],
};

const ipfs = new Ipfs(config: NexusSDKConfig = {});
const ipfsHash = await ipfs.uploadIPFSContent([ContentType.coverWalletAddresses, content]);

console.log(ipfsHash);

Quote

Use the NexusSDK or Quote class directly to get the inputs required to get a quote and buy cover.

interface NexusSDKConfig {
  apiUrl?: string;
}
const nexusSDK = new NexusSDK(config: NexusSDKConfig = {}, ipfs?: Ipfs)
const quote = new Quote(config: NexusSDKConfig = {}, ipfs?: Ipfs)

Params

export interface GetQuoteAndBuyCoverInputsParams {
  /**
   * ID of the product to buy cover for
   */
  productId: number;

  /**
   * Amount of cover to buy, as a string
   */
  amount: string;

  /**
   * Cover period in days
   */
  period: number;

  /**
   * Asset to use for cover
   * Must be a valid CoverAsset enum value
   */
  coverAsset: number;

  /**
   * Address of the cover buyer
   * Must be a valid Ethereum address
   */
  buyerAddress: string;

  /**
   * ID of the cover to edit
   */
  coverId?: number;

  /**
   * Optional slippage tolerance percentage
   * Value between 0-1 (defaults to 0.001 ~ 0.1%)
   */
  slippage?: number;

  /**
   * Optional IPFS CID string or content object to upload
   */
  ipfsCidOrContent?: string | Record<string, unknown>;

  /**
   * Optional commission ratio
   */
  commissionRatio?: number;

  /**
   * Optional address of the commission receiver
   */
  commissionDestination?: string;

  /**
   * Asset to use for cover payment
   * Must be a valid PaymentAsset enum value
   */
  paymentAsset?: number;
}

Example 1

import { NexusSDK } from '@nexusmutual/sdk';

const productId = 247; // Elite Cover Product - Nexus Mutual Cover Product Type
const amount = '100';
const period = 30;
const coverAsset = CoverAsset.ETH;
const paymentAsset = CoverAsset.ETH;
const buyerAddress = '0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5';
const ipfsCidOrContent = 'QmXUzXDMbeKSCewUie34vPD7mCAGnshi4ULRy4h7DLmoRS';

const nexusSDK = new NexusSDK();

const { result, error } = await nexusSDK.quote.getQuoteAndBuyCoverInputs({
  productId,
  amount,
  period,
  coverAsset,
  paymentAsset,
  buyerAddress,
  ipfsCidOrContent,
});

console.log(result);

Example 2

import { Quote } from '@nexusmutual/sdk';

const productId = 247; // Elite Cover Product - Nexus Mutual Cover Product Type
const amount = '100';
const period = 30;
const coverAsset = CoverAsset.ETH;
const paymentAsset = CoverAsset.ETH;
const buyerAddress = '0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5';
const ipfsCidOrContent = 'QmXUzXDMbeKSCewUie34vPD7mCAGnshi4ULRy4h7DLmoRS';

const quote = new Quote();

const { result, error } = await quote.getQuoteAndBuyCoverInputs({
  productId,
  amount,
  period,
  coverAsset,
  paymentAsset,
  buyerAddress,
  ipfsCidOrContent,
});

console.log(result);

If the productId's type needs an IPFS upload, you can pass the ipfsCidOrContent param and the function will upload the content to IPFS and use the IPFS hash returned or you can pass the hash if you manually uploaded.

The ipfsCidOrContent param must be a valid IPFS Cid or a valid IPFSContentTypes - the allowed types can be found in src/types/ipfs.ts.

Product Types and IPFS Content Mapping

The following table shows the mapping between product types and their required IPFS content types:

| Product Type | Content Type | Content Structure | Description | | -------------------------- | ----------------------------- | --------------------------------------------------------------- | ---------------------------- | | ethSlashing | coverValidators | { version: '1.0', validators: string[] } | Array of validator addresses | | liquidCollectiveEthStaking | coverValidators | { version: '1.0', validators: string[] } | Array of validator addresses | | stakewiseEthStaking | coverValidators | { version: '1.0', validators: string[] } | Array of validator addresses | | sherlockQuotaShare | coverQuotaShare | { version: '1.0', quotaShare: number } | Percentage value, 0 to 100 | | unoReQuotaShare | coverQuotaShare | { version: '1.0', quotaShare: number } | Percentage value, 0 to 100 | | deFiPass | coverWalletAddress | { version: '1.0', walletAddress: string } | Single wallet address | | nexusMutual | coverWalletAddresses | { version: '1.0', walletAddresses: string } | Single wallet address | | nexusMutual | coverWalletAddresses | { version: '2.0', walletAddresses: string[] } | Array of wallet addresses | | followOn | coverFreeText | { version: '1.0', freeText: string } | Free text description | | fundPortfolio | coverAumCoverAmountPercentage | { version: '1.0', aumCoverAmountPercentage: number } | Percentage value, 0 to 100 | | generalizedFundPortfolio | coverAumCoverAmountPercentage | { version: '1.0', aumCoverAmountPercentage: number } | Percentage value, 0 to 100 |

Note: The following product types do not require IPFS content:

  • singleProtocol
  • custody
  • yieldToken
  • sherlockExcess
  • nativeProtocol
  • theRetailMutual
  • multiProtocol
  • ethSlashingUmbrella
  • openCoverTransaction
  • sherlockBugBounty
  • immunefiBugBounty

For a complete list of products and product types, see products.json and product-types.json.

Validation Errors

IPFS content is validated using Zod schemas, if validation fails, the error response will contain a stringified array of Zod validation errors in the error.message field. These errors provide detailed information about what went wrong during validation.

Example error response:

{
  "result": undefined,
  "error": {
    "message": "[{\"code\":\"too_small\",\"minimum\":1,\"type\":\"array\",\"inclusive\":true,\"exact\":false,\"message\":\"At least one transaction hash is required\",\"path\":[\"incidentTransactionHashes\"]}]"
  }
}

Each Zod error object in the array includes:

  • code: The type of validation error
  • message: A human-readable error message
  • path: The path to the invalid field
  • Additional context-specific fields

For more information about Zod error handling and validation, see the Zod Error Handling documentation.