Skip to content

Commit

Permalink
Refreshing the documentation (#376)
Browse files Browse the repository at this point in the history
* fixed all existing documented zwallet commands

* hide vp-update-settings cmd

* hid some commands

* hid one more command

* reorganize some docs

* made some fixes to the documentation

* fixes

* fix readme

* more documentation

* remove unfinished points

* consistent docs for commands

---------

Co-authored-by: Gaurboy's M3Pro <[email protected]>
Co-authored-by: devyetii <[email protected]>
  • Loading branch information
3 people authored May 2, 2024
1 parent c015966 commit b5a1f11
Show file tree
Hide file tree
Showing 34 changed files with 479 additions and 120 deletions.
460 changes: 347 additions & 113 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cmd/auth-register.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func init() {
"Register an authorizer manually",
"Register an authorizer manually",
registerAuthorizerInChain,
true,
&Option{
name: "url",
typename: "string",
Expand Down
1 change: 1 addition & 0 deletions cmd/auth-sc-delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func init() {
"Deletes an authorizer to token bridge SC manually",
"Deletes an authorizer to token bridge SC manually",
deleteAuthorizerInSC,
true,
&Option{
name: "ethereum_address",
typename: "string",
Expand Down
1 change: 1 addition & 0 deletions cmd/auth-sc-register.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func init() {
"Register an authorizer to token bridge SC manually",
"Register an authorizer to token bridge SC manually",
registerAuthorizerInSC,
true,
&Option{
name: "ethereum_address",
typename: "string",
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-auth-config-update.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var updateAuthorizerConfigCmd = &cobra.Command{
Short: "Update ZCNSC authorizer settings by ID",
Long: `Update ZCNSC authorizer settings by ID.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
const (
IDFlag = "id"
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-auth-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var getAuthorizerConfigCmd = &cobra.Command{
Short: "Show authorizer configurations.",
Long: `Show authorizer configurations.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var (
flags = cmd.Flags()
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-auth-delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var deleteAuthorizerConfigCmd = &cobra.Command{
Short: "Delete ZCNSC authorizer by ID",
Long: `Delete ZCNSC authorizer by ID`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
const (
IDFlag = "id"
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-burn-bnt.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func init() {
"burn bnt tokens",
"burn bnt tokens that will be minted on ZCN chain",
commandBurnBnt,
false,
WithAmount("WZCN token amount to be burned"),
WithRetries("Num of seconds a transaction status check should run"),
))
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-burn-eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func init() {
"burn eth tokens",
"burn eth tokens that will be minted on ZCN chain",
commandBurnEth,
false,
WithAmount("WZCN token amount to be burned"),
WithRetries("Num of seconds a transaction status check should run"),
))
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-burn-eurc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func init() {
"burn eurc tokens",
"burn eurc tokens that will be minted on ZCN chain",
commandBurnEurc,
false,
WithAmount("WZCN token amount to be burned"),
WithRetries("Num of seconds a transaction status check should run"),
))
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-burn-usdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func init() {
"burn usdc tokens",
"burn usdc tokens that will be minted on ZCN chain",
commandBurnUsdc,
false,
WithAmount("WZCN token amount to be burned"),
WithRetries("Num of seconds a transaction status check should run"),
))
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-burn-wzcn.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func init() {
"burn wzcn tokens",
"burn wzcn tokens that will be minted on ZCN chain",
commandBurnWzcn,
false,
WithAmount("WZCN token amount to be burned"),
WithRetries("Num of seconds a transaction status check should run"),
))
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-burn-zcn.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func init() {
"burn zcn tokens",
"burn zcn tokens that will be minted for WZCN tokens",
commandBurnZCN,
false,
WithToken("ZCN tokens quantity to be burned"),
))
}
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-config-update.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var updateBridgeGlobalConfigCmd = &cobra.Command{
Short: "Update ZCNSC bridge global settings",
Long: `Update ZCNSC bridge global settings.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
4 changes: 3 additions & 1 deletion cmd/bridge-config.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package cmd

import (
"log"

"github.com/0chain/gosdk/zcnbridge"
"github.com/0chain/gosdk/zcncore"
"github.com/spf13/cobra"
"log"
)

var getBridgeConfigCmd = &cobra.Command{
Use: "bridge-config",
Short: "Show ZCNBridge configurations.",
Long: `Show ZCNBridge configurations.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var (
response = new(zcncore.InputMap)
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-get-wzcn-burnticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func init() {
"get confirmed burn ticket for ethereum burn transaction",
"get transaction ticket with the given Ethereum transaction hash",
commandGetETHBurnTicket,
false,
WithHash("Ethereum transaction hash"),
))
}
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-get-zcn-burnticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func init() {
"get the confirmed burn ticket for zcn burn transaction",
"get transaction ticket with the given ZCN transaction hash",
commandGetZCNBurnTicket,
false,
WithHash("ZCN transaction hash"),
))
}
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-mint-wzcn.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func init() {
"mint WZCN tokens using the hash of ZCN burn transaction",
"mint WZCN tokens after burning ZCN tokens in ZCN chain",
commandMintEth,
false,
))
}

Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-mint-zcn.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func init() {
"mint zcn tokens using the hash of Ethereum burn transaction",
"mint zcn tokens after burning WZCN tokens in Ethereum chain",
commandMintZCN,
false,
&Option{
name: "burn-txn-hash",
typename: "string",
Expand Down
1 change: 1 addition & 0 deletions cmd/bridge-verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func init() {
`verify transaction.
<hash>`,
VerifyEthereumTransaction,
false,
WithHash("Ethereum transaction hash"),
)

Expand Down
11 changes: 6 additions & 5 deletions cmd/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,21 +274,21 @@ func getUint64(args []*Arg, name string) uint64 {
}

// createCommand Function to initialize bridge commands with DRY principle
func createCommand(use, short, long string, functor Command, opts ...*Option) *cobra.Command {
func createCommand(use, short, long string, functor Command, hidden bool, opts ...*Option,) *cobra.Command {
fn := func(parameters ...*Arg) {
functor(parameters...)
}

opts = append(opts, configFolderOption)
opts = append(opts, configChainFileOption)

command := createBridgeComm(use, short, long, fn, opts)
command := createBridgeComm(use, short, long, fn, opts, hidden)
AppendOptions(opts, command)
return command
}

// createCommandWithBridge Function to initialize bridge commands with DRY principle
func createCommandWithBridge(use, short, long string, functor CommandWithBridge, opts ...*Option) *cobra.Command {
func createCommandWithBridge(use, short, long string, functor CommandWithBridge, hidden bool, opts ...*Option) *cobra.Command {
fn := func(parameters ...*Arg) {
folder := GetConfigFolder(parameters)
chainConfigFile := GetChainConfigFile(parameters)
Expand All @@ -299,8 +299,7 @@ func createCommandWithBridge(use, short, long string, functor CommandWithBridge,

opts = append(opts, configFolderOption)
opts = append(opts, configChainFileOption)

command := createBridgeComm(use, short, long, fn, opts)
command := createBridgeComm(use, short, long, fn, opts, hidden)
AppendOptions(opts, command)
return command
}
Expand Down Expand Up @@ -330,12 +329,14 @@ func createBridgeComm(
long string,
functor Command,
opts []*Option,
hidden bool,
) *cobra.Command {
var cobraCommand = &cobra.Command{
Use: use,
Short: short,
Long: long,
Args: cobra.MinimumNArgs(0),
Hidden: hidden,
Run: func(cmd *cobra.Command, args []string) {
fflags := cmd.Flags()

Expand Down
1 change: 1 addition & 0 deletions cmd/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var faucetcmd = &cobra.Command{
Long: `Faucet smart contract.
<methodName> <input>`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
fflags := cmd.Flags()
if fflags.Changed("methodName") == false {
Expand Down
4 changes: 3 additions & 1 deletion cmd/fc-config.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package cmd

import (
"log"

"github.com/0chain/gosdk/zcncore"
"github.com/spf13/cobra"
"log"
)

var getFaucetConfigCmd = &cobra.Command{
Use: "fc-config",
Short: "Show Faucet configurations.",
Long: `Show Faucet configurations.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {

var (
Expand Down
1 change: 1 addition & 0 deletions cmd/fc-update-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var updateFaucetCmd = &cobra.Command{
Short: "Update the Faucet smart contract",
Long: `Update the Faucet smart contract.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
1 change: 1 addition & 0 deletions cmd/global-update-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var updateGlobalConfigCmd = &cobra.Command{
Short: "Update global settings",
Long: `Update global settings.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
1 change: 1 addition & 0 deletions cmd/hardfork.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var addHardForkCmd = &cobra.Command{
Short: "Add hardfork",
Long: `Add hardfork`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
1 change: 1 addition & 0 deletions cmd/mn-update-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var updateMinerScConfigCmd = &cobra.Command{
Short: "Update the miner smart contract",
Long: `Update the miner smart contract.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
1 change: 1 addition & 0 deletions cmd/mswallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var createmswalletcmd = &cobra.Command{
Long: `create multisig wallet
<numsigners> <threshold> <testN>`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
MaxSigners := 20 //This is the limitation from MultiSigSC
MinSigners := 2 //This is the limitation from MultiSigSC
Expand Down
1 change: 1 addition & 0 deletions cmd/reset-user-nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func init() {
"Reset user minted nonce",
"Resets user minted nonce in bridge SC",
resetUserNonce,
false,
))
}

Expand Down
1 change: 1 addition & 0 deletions cmd/sc-update-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var updateStoragScConfigCmd = &cobra.Command{
Short: "Update the storage smart contract",
Long: `Update the storage smart contract.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
7 changes: 7 additions & 0 deletions cmd/vesting.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var getVestingPoolInfoCmd = &cobra.Command{
Short: "Check out vesting pool information.",
Long: `Check out vesting pool information.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var flags = cmd.Flags()
if !flags.Changed("pool_id") {
Expand Down Expand Up @@ -74,6 +75,7 @@ var getVestingClientPoolsCmd = &cobra.Command{
Short: "Check out vesting pools list.",
Long: `Check out vesting pools list.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var (
flags = cmd.Flags()
Expand Down Expand Up @@ -148,6 +150,7 @@ var vestingPoolAddCmd = &cobra.Command{
Short: "Add a vesting pool",
Long: "Add a vesting pool.",
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {

var (
Expand Down Expand Up @@ -261,6 +264,7 @@ var vestingPoolDeleteCmd = &cobra.Command{
Short: "Delete a vesting pool",
Long: "Delete a vesting pool.",
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {

var (
Expand Down Expand Up @@ -323,6 +327,7 @@ var vestingPoolStopCmd = &cobra.Command{
Short: "Stop vesting for one of destinations and unlock tokens not vested",
Long: "Stop vesting for one of destinations and unlock tokens not vested",
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {

var (
Expand Down Expand Up @@ -397,6 +402,7 @@ var vestingPoolUnlockCmd = &cobra.Command{
Short: "Unlock tokens of a vesting pool",
Long: "Unlock tokens of a vesting pool.",
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {

var (
Expand Down Expand Up @@ -460,6 +466,7 @@ var vestingPoolTriggerCmd = &cobra.Command{
Short: "Trigger a vesting pool work.",
Long: `Move current vested tokens to destinations`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {

var (
Expand Down
1 change: 1 addition & 0 deletions cmd/vp-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var getVestingPoolConfigCmd = &cobra.Command{
Short: "Check out vesting pool configurations.",
Long: `Check out vesting pool configurations.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var (
fields = new(zcncore.InputMap)
Expand Down
1 change: 1 addition & 0 deletions cmd/vp-update-settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var updateVestingPoolConfigCmd = &cobra.Command{
Short: "Update the vesting pool configurations.",
Long: `Update the vesting pool configurations.`,
Args: cobra.MinimumNArgs(0),
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
var err error

Expand Down
Loading

0 comments on commit b5a1f11

Please sign in to comment.