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

@alien-worlds/aw-antelope

v0.0.45

Published

The AW-Antelope is part of the AlienWorlds open source project. This repository consists of three main components: **Blockchain Service**, **Smart Contract Service**, and **Serializer**.

Downloads

20

Readme

AW-Antelope

The AW-Antelope is part of the AlienWorlds open source project. This repository consists of three main components: Blockchain Service, Smart Contract Service, and Serializer.

Dependencies

Table of Contents

Installation

To install the @alien-worlds/aw-antelope package, use the following command:

yarn add @alien-worlds/aw-antelope

Block Reader

Block Reader is responsible for managing the connection to a block reader service and handling block retrieval. It plays a crucial role in ensuring the correct interaction with the blockchain, retrieving all necessary information, and forwarding it to the appropriate handlers.

Features

  1. Connects to a State History Plugin SHIP.
  2. Manages the WebSocket connection using a AntelopeBlockReaderSource instance.
  3. Handles SHIP abis using a AntelopeShipAbiRepository instance.
  4. Serializes and deserializes messages with a Serializer instance.
  5. Manages the retrieval of blocks, with the ability to pause and resume this process.
  6. Provides callback handlers for various events (such as receiving blocks, completion of block range retrieval, handling errors, and handling warnings).

Blockchain Service

The Blockchain Service is responsible for handling various blockchain-related operations. This service exposes three main methods:

  • getInfo(): Retrieves the blockchain information.
  • getHeadBlockNumber(): Retrieves the block number of the head block.
  • getLastIrreversibleBlockNumber(): Retrieves the block number of the last irreversible block.

Smart Contract Service

The Smart Contract Service manages operations related to smart contracts. The service currently implements the following method:

  • getStats(contract: string): Retrieves the statistics of the given smart contract.

Smart Contract Service is designed not only to fetch contract statistics. The service has protected methods to fetch table data (getOne, getMany and getAll). Thanks to these methods, you can write your own to retrieve data from each of the tables contained in the contract. Examples of use can be found in dedicated contract packages such as aw-contract-dao-worlds

// example of retrieving table data "Candidates"
public readonly fetchCandidates = async (
  options?: GetTableRowsOptions
): Promise<Result<CandidatesRawModel[], Error>> => {
  return await this.getAll<CandidatesRawModel>('candidate_name', {
    ...options,
    code: 'dao.worlds',
    table: 'candidates',
    table_key: 'candidate_name',
  });
};

Serializer

The Serializer is responsible for the serialization and deserialization of various data types. It provides the following methods:

  • getAbiFromHex(hex: string): Deserializes ABI from hexadecimal representation.
  • getHexFromAbi(abi: AbiType): Converts ABI to hexadecimal string.
  • getTypesFromAbi(abi: UnknownObject): Gets types from provided ABI.
  • serialize(value: unknown, type: string, types: Map<string, unknown>): Serializes a value to Uint8Array based on the given type.
  • deserialize(value: Uint8Array, type: string, types: Map<string, unknown>): Deserializes a value from Uint8Array based on the given type.
  • deserializeActionData(contract: string, action: string, data: Uint8Array, abi: string | UnknownObject): Deserializes the action data for a specific account and action.
  • deserializeTableRow(row: Uint8Array, abi: string | UnknownObject): Deserializes the table row.
  • deserializeTableRowData(table: string, data: Uint8Array, abi: string | UnknownObject): Deserializes a table delta for a specific table.
  • deserializeTransaction(contract: string, data: Uint8Array, abi: string | UnknownObject): Deserializes a transaction for a specific contract.
  • deserializeBlock(data: DataType, abi?: string | UnknownObject): Deserializes a block.
  • hexToUint8Array(value: string): Converts a hexadecimal string to Uint8Array.
  • uint8ArrayToHex(value: Uint8Array): Converts a Uint8Array to a hexadecimal string.

Contributing

We welcome contributions from the community. Before contributing, please read through the existing issues on this repository to prevent duplicate submissions. New feature requests and bug reports can be submitted as an issue. If you would like to contribute code, please open a pull request.

License

This project is licensed under the terms of the MIT license. For more information, refer to the LICENSE file.