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

@veive-io/mod-hooks-as

v1.0.0

Published

Veive smart account hooks module

Downloads

9

Readme

Mod hooks

Overview

mod-hooks-as is a core library in the Veive protocol, providing the framework for creating hook modules that execute pre-checks and post-checks around operations within Koinos blockchain smart accounts. These modules enable additional logic to be run before and after main operations, offering enhanced flexibility and security.

Components and Functional Description

1. ModHooks Class

  • Description: The ModHooks class serves as the foundational class for all hook modules within the Veive ecosystem. It provides methods for implementing specific pre-check and post-check logic by derived classes.

  • Key Methods:

    • pre_check: Invoked before the main operation is executed, this method allows developers to implement custom logic to verify conditions or perform actions that should happen prior to the operation. For instance, it can enforce spending limits or additional authentication steps.
    • post_check: This method is called after the main operation is executed. It is used to implement logic that should occur post-operation, such as logging actions, updating internal states, or handling follow-up tasks.
    • on_install and on_uninstall: Manage the installation and uninstallation of the hook module. These methods set up necessary resources or perform cleanup tasks when the module is added or removed.
    • is_type: Verifies if the module matches a specific type ID, confirming its identity and ensuring proper interaction with other components.
  • Use Case: The ModHooks class is foundational for creating hook modules that add security layers, auditing, or custom functionalities to smart accounts. For example, a hook module could enforce daily transaction limits or log outgoing transfers for auditing.

2. modhooks Proto

  • Description: The modhooks protocol buffer (proto) defines data structures and communication formats used by hook modules.
  • Purpose: It standardizes data exchange between the smart account and the hook modules, ensuring consistency and reliability in communication.

Usage and Integration

Integration in the Veive Protocol

The mod-hooks-as library integrates seamlessly with the Veive protocol, enabling smart accounts to execute pre-checks and post-checks as part of the operation lifecycle.

Flow Integration:

  • The ModHooks methods pre_check and post_check are called at the appropriate times during an operation's lifecycle. This integration ensures that all necessary checks and actions are performed before and after operations, enhancing security and operational integrity.

Development and Customization:

  • Developers can extend the ModHooks class to create custom hook modules that perform specific tasks, such as additional validation checks, logging, or state updates. This flexibility allows for a wide range of use cases and customizations, depending on the needs of the smart account and its operations.

Usage

Installation

To install the mod-hooks-as library, use the following command:

yarn add @veive/mod-hooks-as

Scripts

Build

To compile the package, run:

yarn build

Contributing

Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.