#mermaid #markdown #arrow


Generating markdown for mermaid diagrams

2 unstable releases

0.2.0 Apr 11, 2022
0.1.0 Apr 5, 2022

33 downloads per month
Used in web3d


3.5K SLoC

Web3 Diagram

This is a cargo utility that allows developers to generate visualizations depicting data flows within their NEAR Rust smart contracts.

Which problem does it solve?

Provides the ability to generate representations of methods to allow for anyone to quickly understand how the contract works.

Who can use this?

Smart contract developers use it to generate the images, but the images can help anyone trying to understand what’s going on.

Key Features

Feature Description
View Functions Near smart contract view only functions
Mutation Near smart contract mutable functions
Process Helper or utility functions, also functions out of smart contract scope
Events Functions that falls into near event standard
View Trait Impl View only functions but trait implamentation
Mutation Trait Impl Mutable functions but trait implamentation
Payable Functions that except Near
Initializers Smart contract initializer functions


Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Install cli with brew

brew install mermaid-cli

Install web3d diagram utility

cargo install web3d 

Install node

brew install node

Web3 Utility Usage

1) Clone raffle smart contract from near examples

git clone git@github.com:near-examples/rust-ft-raffle.git

2) Go to the root directory

cd rust-ft-raffle

3) Run utility againt cloned smart contract and open in web browser

web3d -O --input raffle.md


Key/Command Description
-b, --backgroundColor Background color. Example: transparent, red, '#F0F0F0'. Optional. Default: white
-h, --help Print help information
-H, --height Height of the page. Optional. Default: 600
-i, --input Markdown file name
-o, --output Output file name. It should be either md, svg, png or pdf. Optional. Default:'./res/input_file_name.svg'
-O, --openb Should open output file in browser
-q, --quiet Suppress log output
-w, --width Width of the page. Optional. Default: 800


~37K SLoC