#blockchain #smart-contracts #mocking #transaction #framework #novax #executor

novax-executor

Part of the NovaX framework, this crate facilitates the execution of transactions and queries against smart contracts on the blockchain

47 releases

0.1.20 Oct 30, 2024
0.1.9 Sep 30, 2024
0.1.7-beta.2 Jul 17, 2024
0.1.4 Mar 31, 2024
0.0.24 Nov 26, 2023

#2 in #novax

Download history 27/week @ 2024-07-29 219/week @ 2024-08-05 217/week @ 2024-08-12 465/week @ 2024-08-19 426/week @ 2024-08-26 76/week @ 2024-09-02 80/week @ 2024-09-09 100/week @ 2024-09-16 112/week @ 2024-09-23 467/week @ 2024-09-30 306/week @ 2024-10-07 90/week @ 2024-10-14 803/week @ 2024-10-21 304/week @ 2024-10-28 42/week @ 2024-11-04 5/week @ 2024-11-11

1,157 downloads per month
Used in 5 crates (2 directly)

GPL-3.0-only

275KB
5.5K SLoC

novax-executor is a crate designed to facilitate the interaction between your Rust application and a blockchain network. Its main purpose is to be used by other "novax" crates like "novax", however, it's designed in a way that developers can also use it for mocking purposes during testing. It abstracts the complexities involved in querying the blockchain, executing transactions, and deploying smart contracts, thereby providing a streamlined interface for developers.

The crate offers several core abstractions and implementations to interact with a blockchain:

  • Executor Abstractions:

    • QueryExecutor: An asynchronous trait for executing queries on the blockchain.
    • TransactionExecutor: An asynchronous trait for executing transactions on the blockchain.
    • DeployExecutor: An asynchronous trait for deploying smart contracts on the blockchain.
  • Network Interaction:

    • BlockchainInteractor: A trait abstracting over a blockchain interactor to allow mocking.
    • BlockchainProxy: A trait abstracting the communication proxy to allow mocking, providing methods to interact with the blockchain gateway.
    • ProxyQueryExecutor and QueryNetworkExecutor: Implementations for executing queries on the blockchain.
    • NetworkExecutor and BaseTransactionNetworkExecutor: Implementations for executing transactions on the blockchain.
  • Mocking Framework:

    • MockExecutor: A structure to help mock blockchain interactions during testing using the MultiversX Rust Testing Framework.
    • StandardMockExecutor: An extension of MockExecutor providing standard mocking behaviors.
  • Dummy Framework:

    • DummyExecutor, DummyTransactionExecutor, and DummyDeployExecutor: Implementations to assist in testing and development without actual blockchain interaction.
  • Utility Types and Traits:

    • SendableTransaction and SendableTransactionConvertible: Utility types and traits to facilitate transaction handling.
  • Error Handling:

    • ExecutorError: A comprehensive enumeration of errors that could occur during blockchain interaction, encompassing data errors, network query errors, and mock deploy errors.

The abstraction layers provided by this crate are designed to make it easy to implement mock or dummy executors, allowing for thorough testing and development without requiring a live blockchain network. This is especially helpful in early stages of development or in testing scenarios where the blockchain's state or behavior needs to be controlled precisely.

The architecture also allows for the easy extension of the executor framework to support additional blockchain networks or custom interaction patterns.

Features

  • async-trait: This crate uses the async-trait crate to allow for async trait methods, enabling asynchronous blockchain interaction.

Error Handling

Error handling in novax-executor is comprehensive and designed to cover a range of issues that might arise while interacting with the blockchain. See ExecutorError, NetworkQueryError, and MockDeployError for more details.

Dependencies

~20–31MB
~511K SLoC