@veive/mod-hooks-as v1.0.10
Veive SCA Hooks Module
This package provides the interface and protobuf definitions to be used for developing hooks modules that add functionality to the Veive smart account on the Koinos blockchain. It is inspired by the ERC-7579 standard.
ERC-7579 defines a standard interface for modular smart accounts. In this context, a module represents a pluggable unit that adds specific functionality to a smart account. Hooks modules specifically handle tasks such as pre-checks and post-checks, making smart accounts more flexible and extensible. This allows developers to create custom hook modules that can be easily integrated into the Veive smart account system on the Koinos blockchain.
Installation
To install the package, use npm or yarn:
npm install @veive/mod-hooks
Usage
Importing the Package
First, import the necessary components from the package:
import { modhooks, Modhooks, IModhooks } from '@veive/mod-hooks';
Example Implementation
Create a hook module by extending Modhooks
:
import { Modhooks } from '@veive/mod-hooks';
class MyHooksModule extends Modhooks {
// Your implementation here
}
Interface
The ModHooks class includes methods for performing pre-checks and post-checks, allowing the addition of hook functionality to smart accounts in a modular fashion.
The class is designed to be used within a modular smart account system, enabling pluggable hook logic that can be easily extended or modified.
Key Methods:
pre_check
: Performs a pre-check before the main operation is executed.post_check
: Performs a post-check after the main operation is executed.manifest
: Returns the manifest of the module, including metadata such as name, description, and type ID.
The pre_check
and post_check
methods can be used to implement custom logic that needs to run before and after
the main operation, respectively. This can include validation, logging, or other auxiliary tasks.
Scripts
Build
To compile the package, run:
yarn build
Release
To create a release, run:
yarn release
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.