Introducing Web3 CLI

Introducing Web3 CLI

Arpan Pandey
·Jan 25, 2022·

3 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Table of contents

  • Introduction
  • What's thirdweb tho?
  • How do you create CLIs in python?
  • Dependencies
  • What can it do?
  • Documentation
  • Subtle Features
  • The Code
  • Final Words

Introduction

Many people in the thirdweb community have different projects on their minds. I thought of sharing my interesting project with the community so that a lot of people can benefit from it. It will also help me to get some positive criticism so that my next project can be even better.

The thirdweb platform is quite a powerful tool and can be used to develop many different applications. The CLI (Command Line Interface) which I have developed is just an example of how applications can be developed using these tools.

What's thirdweb tho?

Thirdweb is a platform that allows us to easily create and use smart contracts without those annoying Solidity bits. We can use their SDKs to create, view and use smart contracts. Now with thirdweb creating an NFT, Cryptocurrency etc. is just a few clicks away. They offer various modules to mint NFTs, Bundles of NFTs, Packs etc, heck even conduct votes in your DAOs etc.

How do you create CLIs in python?

Well, Python is a very versatile language, you can do almost everything with its wonderful packages. For creating CLIs we have many modules like click etc. But for this, I used PyInquirer. It allows you to prompt the user for data and returns the data as a dictionary.

Dependencies

I have used the following packages/libraries in making this CLI. A huge shout out to the creators of these wonderful packages and libraries.

What can it do?

This CLI currently only supports the NFT Collection, Currency module. But, you can almost do everything on these two modules. Like minting tokens, burning tokens etc. The following are the functions that can be called for each of the modules:

Currency

This module can be used to do all sorts of things like Minting new tokens, burning tokens, viewing the supply, transferring tokens etc.

  • Balance
  • Burn
  • Get
  • Mint
  • Supply
  • Transfer
  • Value

NFT Collection

This module can be used to mint NFTs, transfer NFTs, view NFT data etc.

  • Burn
  • Mint
  • Transfer
  • View By Owner
  • View

Documentation

You can view the documentation over here.

Subtle Features

  • When you use the NFT Collection's view or view_by_owner, it gives you an option to whether print the data or write it to a .json file.
  • When you are minting an NFT, you can either pass the path to an image file or a remote URL.
  • If your private key is in a .env file in the same directory, you can use that or choose to provide one.

The Code

The code for this CLI is over at Github. I welcome your reviews and contributions.

Final Words

All in all, this was a very fun little project and I will continue to develop it. Had a good time coding, solving problems along with the thirdweb team.
See ya in the next one!

Did you find this article valuable?

Support Arpan Pandey by becoming a sponsor. Any amount is appreciated!

See recent sponsors Learn more about Hashnode Sponsors
 
Share this