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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@stakewise/v3-deposit-data-parser

v1.8.10

Published

v3-deposit-data-parser

Downloads

100

Readme

StakeWise Deposit Data Parser

StakeWise Deposit Data Parser is a comprehensive TypeScript package designed to facilitate the processing and validation of deposit data files within blockchain applications. Tailored for developers working on staking platforms, blockchain validators, or any applications requiring meticulous deposit data verification and processing, particularly in the context of the StakeWise ecosystem.

Version Size

Features

  • Json Validation: Ensures the input data meets specified criteria, effectively preventing the processing of invalid or corrupted json.
  • Deposit Data Extraction: Parses deposit data from files, preparing it for further processing or verification.
  • Public Key Verification: Validates the uniqueness and format of public keys within the deposit data to ensure data integrity.
  • Signature Verification: Leverages BLS (Boneh-Lynn-Shacham) signatures to authenticate deposit data against given public keys.
  • Progress Callbacks: Provides real-time feedback on processing progress, suitable for applications processing large datasets.
  • Error Handling: Implements comprehensive error handling, with custom error types and callback functions for robust error management.
  • Withdrawal Address Verification: The verification is carried out to confirm that the Withdrawal Address is included in the deposit data and that it matches any of the eigen pods addresses that we request directly for the restake vault.

Installation and Setup

npm i @stakewise/v3-deposit-data-parser

Usage example

To ensure optimal performance and responsiveness, StakeWise Deposit Data Parser is optimized for execution within a Web Worker. This allows your application to process data without blocking the main thread, keeping the UI smooth and responsive, even during intensive computations.

import { depositDataParser } from '@stakewise/v3-deposit-data-parser'

self.addEventListener('message', async (event) => {
  const { vaultAddress, network, file } = event.data

  try {
    const onProgress = (progress: Progress) => {
      postMessage({ progress })
    }

    const result = await depositDataParser({
      data,
      vaultAddress,
      network,
      onProgress,
    })

    postMessage({ result })
  }
  catch (error) {
    if (error instanceof ParserError) {
      const parserError: ParserError = { ...error }
      
      postMessage({ error: parserError })
    }
    else {
      postMessage({ error })
    }
  }
  finally {
    close()
  }
})

Deposit data parser Arguments:

| Name | Type | Required | Description | |--------------|-------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | network | Network | Yes | Network to which the deposit data belongs. | | vaultAddress | string | Yes | The address of the vault for which the deposit data is being parsed. | | data | DepositDataFile | Yes | Data that contains basic information about the file to be downloaded. | | onProgress | Function | Optional | Callback function that is called with progress information as the file is being parsed. The function is expected to accept an object with total and value properties, where total is the total number of items to process, and value is the current number of items processed. |

Parser Errors:

| Type | Message | |------------|---------| | EMPTY_FILE | Deposit data file is empty | EIGEN_PODS_EMPTY | No Eigen pods in the Vault | INVALID_JSON_FORMAT | Deposit data file must be in JSON format | MERKLE_TREE_GENERATION_ERROR | Failed to generate the Merkle tree | INVALID_PUBLIC_KEY_FORMAT | Failed to parse deposit data public key | DUPLICATE_DEPOSIT_DATA | The deposit data file has already been uploaded. | INVALID_WITHDRAW_ADDRESS | The withdrawal addresses don’t match Eigen pods | MISSING_FIELDS | Failed to verify the deposit data public keys. Missing fields: {fields} | DUPLICATE_PUBLIC_KEYS | Failed to verify the deposit data public keys. All the entries must be unique. | INVALID_SIGNATURE | Failed to verify the deposit data signatures. Please make sure the file is generated for the {network} network.