iotex-core icon indicating copy to clipboard operation
iotex-core copied to clipboard

[ioctl] build xrc20 totalsupply command line into new ioctl

Open huof6829 opened this issue 3 years ago • 0 comments

What would you like to be added

  • Step 1: create xrc20totalsupply.go and xrc20totalsupply_test.go files in ./ioctl/newcmd/action. create this directory if not exist.
  • Step 2: refactor command https://github.com/iotexproject/iotex-core/blob/master/ioctl/cmd/action/xrc20totalsupply.go in xrc20totalsupply.go
  • Step 3: add unit test in xx_test.go

Notes:

  1. Use client interface to construct the Cobra command.
  2. Output package is deprecated. e.g. output.PrintError could be replaced with errors.Wrap.
  3. Global variables (config.ReadConfig config.DefaultConfigFile etc.) have been wrapped into client interface. Please use client interface to access them if needed
  4. The logic of new code should be similar to the old one.
  5. In each unit test, the results should be checked whether they are as the expected.

Example:

  1. https://github.com/iotexproject/iotex-core/blob/master/ioctl/newcmd/account/accountinfo.go
  2. https://github.com/iotexproject/iotex-core/blob/master/ioctl/newcmd/account/accountdelete.go
  3. https://github.com/iotexproject/iotex-core/blob/master/ioctl/newcmd/account/accountcreateadd.go

Why is this needed

Unit tests couldn't be added for the old ioctl command (./ioctl/cmd)

huof6829 avatar Apr 15 '22 13:04 huof6829