Skip to main content

A tool to convert MultiversX Smart Contract ABI files into Markdown documentation.

Project description

abi-markdowner

abi-markdowner is a Python tool that converts MultiversX Smart Contract ABI (Application Binary Interface) files into structured and detailed Markdown documentation. This makes it easy to document, share, and understand smart contracts.

Features

  • Convert ABI to Markdown: Generates comprehensive Markdown documentation from smart contract ABI files.
  • Customizable Output: Organizes endpoints, views, events, and types with formatted tables and detailed descriptions based on documentations in the contracts.
  • Matrix-Style Input/Output Tables: Automatically formats function inputs and outputs into a clear matrix with support for optional and multi-value parameters.
  • Automatic Table of Contents: Includes a TOC for easy navigation within the generated documentation.
  • Deployment Links: Supports including multiple mainnet and devnet addresses with customizable labels from a deployments.json file.

Installation

Install abi-markdowner using pip

pip install abi-markdowner

or pipx

pipx install abi-markdowner

Usage

Simply run the tool from your SC main directory:

abi-markdowner

Alternatively, you can pass another project directory as argument. For more information, check the Parameters section.

Parameters

  • --sc-path:

    (Optional - default is the current working directory)

    Specify the path to your smart contract project containing the Cargo.toml and optionally the deployments.json files. The ABI file will be read from the output directory within this path.

  • --output-file:

    (Optional - default is ABI.md in the sc-path/output directory)

    Specify the output file path for the generated Markdown.

  • --cargo-toml:

    (Optional - default is Cargo.toml in the sc-path directory)

    Specify the path to the Cargo.toml file.

  • --deployments-json:

    (Optional - default is deployments.json in the sc-path directory)

    Specify the path to the deployments.json file containing deployment addresses.

Important: ABI file is obtained from the /output folder in the sc-path directory.

Execution example

abi-markdowner --sc-path path_to_sc/

This will generate a Markdown document summarizing your smart contract's structure, including types, endpoints, views, and events, along with links to the specified deployment addresses.

Example of deployments.json file

The existence of this file is not mandatory. If found, a Links section will be created in the documentation.

Here’s an example of how your deployments.json file can be structured:

{
  "mainnet": [
    {
      "address": "erd1qqqqqqqqqqqqqpgqvc7gdl0p4s97guh498wgz75k8sav6sjfjlwqh679jy",
      "label": "Shard 0"
    },
    {
      "address": "erd1qqqqqqqqqqqqqpgqhe8t5jewej70zupmh44jurgn29psua5l2jps3ntjj3",
      "label": "Shard 1"
    }
  ],
  "devnet": [
    {
      "address": "erd1qqqqqqqqqqqqqpgqvn9ew0wwn7a3pk053ezex98497hd4exqdg0q8v2e0c"
    }
  ]
}

The above would result in something similar to the following:

Links
    - Mainnet Deployments:
        - Shard 0: erd1qqqqqqqqqqqqqpgqvc7gdl0p4s97guh498wgz75k8sav6sjfjlwqh679jy
        - Shard 1: erd1qqqqqqqqqqqqqpgqhe8t5jewej70zupmh44jurgn29psua5l2jps3ntjj3
    - Devnet Deployments:
        - Address: erd1qqqqqqqqqqqqqpgqvn9ew0wwn7a3pk053ezex98497hd4exqdg0q8v2e0c

Tests

Tests have not been added yet. (WIP)

License

abi-markdowner is licensed under the MIT License. See the LICENSE file for more information.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abi_markdowner-0.1.9.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

abi_markdowner-0.1.9-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file abi_markdowner-0.1.9.tar.gz.

File metadata

  • Download URL: abi_markdowner-0.1.9.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for abi_markdowner-0.1.9.tar.gz
Algorithm Hash digest
SHA256 f641c001fb414d159a389199c8102bfa67e9556808eca0d15898d44640a6d0a4
MD5 f791fdf3aae65054b1ff31a495214572
BLAKE2b-256 6a3147cb901ee9643c7a29b886d67208b0d42595dc6e9d8f978f48f7fb5532a4

See more details on using hashes here.

File details

Details for the file abi_markdowner-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for abi_markdowner-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 5a0079b86bbdea11dd0c920431a4507cd82473bf9a4aee13bf33c53871a348b7
MD5 86bf04eb665f43020a130b682519c5ec
BLAKE2b-256 4fbd55751264add9f4c09c97ff4155bed023aeeb934224ea44a0c89fa73dabd8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page