When reading the documentation, the explanation of the protocol contracts is great. However, developers have to setup a basic testing environment to interact with the contracts to better understand the behavior.

The widget eliminates this by enabling developers to interact with the contract methods directly within the documentation. This greatly reduces integration time and the context switching that would otherwise be required, making protocols more developer-friendly.

Bonadocs widget allows you to enable interactivity within your docs through widgets.

Getting Started

Let’s first install our bonadocs CLI. This CLI allows you to generate the necessary widgets for your documentation.

npm install -g @bonadocs/cli

After installation, we need to create a collection. You can think about a collection the same way you think about a protocol. It's simply a protocol that can have smart contract(s) as children.

bonadocs collections create

You’ll get prompted to add the name and description of the collection. After successful collection creation, it returns a unique id. In this case, it’s 0xb52b23ce.

Creation of a protocol called NFT-Protocol

https://paper-attachments.dropboxusercontent.com/s_391435AF9B6B0FE3A5CF6EBA54DB30147DE67FE477607CBEDA18A5FFE7D0BF46_1717563567252_Screenshot+2024-06-05+at+05.59.07.png

Now, add contract(s) into the collection. To do this, use the command below:

bonadocs collections 0xb52b23ce contracts add

It prompts you to provide the name, network, and address of the contract. This adds the contract to the collection.

P.S: If it can’t load the contract details from the address, you can use the ABI by following these steps:

https://lh7-us.googleusercontent.com/docsz/AD_4nXdeRtCUKUzHCuGcF2PEc4-cxIq_ErLnG5MkIhba7DzFMlkuXf99u4gJjF2JCmbjhx8BPQhw64B0VwzdvDMqlwjVl59dbnZd0jk97pkXqCzFAUldtphQB_a8_59g09TpheuPlQaqsnOR7zYDgtMnVugT45_d?key=fqhk6c6ORhDEI_CDFwy24w