iotex-core
iotex-core copied to clipboard
[ioctl] build xrc20 allowance command line into new ioctl
What would you like to be added
- Step 1: create
xrc20allowance.goandxrc20allowance_test.gofiles 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/xrc20allowance.go in
xrc20allowance.go - Step 3: add unit test in xx_test.go
Notes:
- Use client interface to construct the Cobra command.
- Output package is deprecated.
e.g.output.PrintErrorcould be replaced witherrors.Wrap. - Global variables (config.ReadConfig config.DefaultConfigFile etc.) have been wrapped into client interface. Please use client interface to access them if needed
- The logic of new code should be similar to the old one.
- In each unit test, the results should be checked whether they are as the expected.
Example:
- https://github.com/iotexproject/iotex-core/blob/master/ioctl/newcmd/account/accountinfo.go
- https://github.com/iotexproject/iotex-core/blob/master/ioctl/newcmd/account/accountdelete.go
- 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)