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 files into structured and detailed Markdown documentation. This makes it easy to document, share, understand, and interact with smart contracts.
TL;DR
Discover how abi-markdowner effortlessly transforms complex and cumbersome abi.json files into clear, structured documentation. Check out these examples:
- The simple yet illustrative Ping-Pong SC.
- The more advanced Hatom Liquid Staking SC.
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.jsonfile.
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/outputdirectory)Specify the output file path for the generated Markdown.
-
--cargo-toml:(Optional - default is Cargo.toml in the
sc-pathdirectory)Specify the path to the Cargo.toml file.
-
--deployments-json:(Optional - default is deployments.json in the
sc-pathdirectory)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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file abi_markdowner-0.1.17.tar.gz.
File metadata
- Download URL: abi_markdowner-0.1.17.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f938c625d0916f802d30bf28311ca70c70314412fddeb9f789c57556db7a4905
|
|
| MD5 |
0f07ad72504a4af837ed477ce6e17bd6
|
|
| BLAKE2b-256 |
c8f95a1b004feba1bb68ab2912a9ed8b0c6021521663dfa799c112a874065779
|
Provenance
The following attestation bundles were made for abi_markdowner-0.1.17.tar.gz:
Publisher:
publish.yml on 0xk0stas/abi-markdowner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
abi_markdowner-0.1.17.tar.gz -
Subject digest:
f938c625d0916f802d30bf28311ca70c70314412fddeb9f789c57556db7a4905 - Sigstore transparency entry: 407534005
- Sigstore integration time:
-
Permalink:
0xk0stas/abi-markdowner@aad6e5a8f0b27a6f526348ce8bc2fdcb4df41854 -
Branch / Tag:
refs/tags/v0.1.17 - Owner: https://github.com/0xk0stas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aad6e5a8f0b27a6f526348ce8bc2fdcb4df41854 -
Trigger Event:
push
-
Statement type:
File details
Details for the file abi_markdowner-0.1.17-py3-none-any.whl.
File metadata
- Download URL: abi_markdowner-0.1.17-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d526f0078e6b9ee225afdbdfc302ff25992b84a4525039e760fa50e35cc1df6c
|
|
| MD5 |
41193bf7b2d14416c17dbf2dc60eebb9
|
|
| BLAKE2b-256 |
97ae826014b004718c346248701c4b43f92a5904c550c6da35186bfb302c8c6b
|
Provenance
The following attestation bundles were made for abi_markdowner-0.1.17-py3-none-any.whl:
Publisher:
publish.yml on 0xk0stas/abi-markdowner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
abi_markdowner-0.1.17-py3-none-any.whl -
Subject digest:
d526f0078e6b9ee225afdbdfc302ff25992b84a4525039e760fa50e35cc1df6c - Sigstore transparency entry: 407534042
- Sigstore integration time:
-
Permalink:
0xk0stas/abi-markdowner@aad6e5a8f0b27a6f526348ce8bc2fdcb4df41854 -
Branch / Tag:
refs/tags/v0.1.17 - Owner: https://github.com/0xk0stas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aad6e5a8f0b27a6f526348ce8bc2fdcb4df41854 -
Trigger Event:
push
-
Statement type: