commands

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AccountCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use: "account",
	}

	getAccountCmd := &cobra.Command{
		Use:   "get",
		Short: "get account info",
		Args:  cobra.ExactArgs(1),
		Run:   getAccount,
	}

	updateAccountCmd := &cobra.Command{
		Use:     "update",
		Short:   "update account public key",
		Example: "account update [name] [newpubkey] [newprikey]",
		Args:    cobra.ExactArgs(3),
		Run:     updateAccount,
	}

	cmd.AddCommand(getAccountCmd)
	cmd.AddCommand(updateAccountCmd)
	utils.ProcessEstimate(cmd)

	return cmd
}
View Source
var BatchCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "conductBatch",
		Short:   "conduct batch commands",
		Example: "conduct [path]",
		Args:    cobra.ExactArgs(1),
		Run:     conductBatch,
	}
	return cmd
}
View Source
var BlockCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use: "block",
	}

	blockCmd := &cobra.Command{
		Use:     "get",
		Short:   "get block detail info",
		Example: "block get id",
		Args:    cobra.ExactArgs(1),
		Run:     blockQuery,
	}

	cmd.AddCommand(blockCmd)

	return cmd
}
View Source
var BpCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use: "bp",
	}

	registerCmd := &cobra.Command{
		Use:     "register",
		Short:   "register as a new block-producer",
		Example: "bp register [bpname] [pubkey]",
		Args:    cobra.ExactArgs(2),
		Run:     registerBP,
	}

	registerCmd.Flags().StringVarP(&bpUrlFlag, "url", "u", "", `bp register alice --url "http://example.com"`)
	registerCmd.Flags().StringVarP(&bpDescFlag, "desc", "d", "", `bp register alice --desc "Hello World"`)
	registerCmd.Flags().StringVarP(&bpCreateAccountFee, "fee", "f", utils.MinimumCos, `bp register alice --fee 1.000000`)
	registerCmd.Flags().Uint64VarP(&proposedStaminaFree, "stamina_free", "s", constants.DefaultStaminaFree, `bp register alice --stamina_free 1`)
	registerCmd.Flags().Uint64VarP(&tpsExpected, "tps", "t", constants.DefaultTPSExpected, `bp register alice --tps 1`)
	registerCmd.Flags().Uint64VarP(&bpEpochDuration, "epoch_duration", "", constants.InitEpochDuration, `bp register alice --epoch_duration 1000000`)
	registerCmd.Flags().Uint32VarP(&bpTopN, "top_n", "", constants.InitTopN, `bp register alice --top_n 1000`)
	registerCmd.Flags().StringVarP(&bpPerTicketPrice, "ticket_price", "", constants.PerTicketPriceStr, `bp register alice --ticket_price 5.000000`)
	registerCmd.Flags().Uint64VarP(&bpPerTicketWeight, "ticket_weight", "", constants.PerTicketWeight, `bp register alice --ticket_weight 10000000`)

	enableCmd := &cobra.Command{
		Use:     "enable",
		Short:   "enable a block-producer",
		Example: "bp enable [bpname]",
		Args:    cobra.ExactArgs(1),
		Run:     enableBP,
	}

	enableCmd.Flags().BoolVarP(&bpEnableCancel, "cancel", "c", false, `bp enable alice --cancel`)

	voteCmd := &cobra.Command{
		Use:     "vote",
		Short:   "vote to a block-producer or unvote it",
		Example: "bp vote [voter] [bpname]",
		Args:    cobra.ExactArgs(2),
		Run:     voteBp,
	}

	voteCmd.Flags().BoolVarP(&bpVoteCancel, "cancel", "c", false, `bp vote alice bob --cancel`)

	updateCmd := &cobra.Command{
		Use:     "update",
		Short:   "update block-producer state",
		Example: "bp update [bpname] --xxx xx",
		Args:    cobra.ExactArgs(1),
		Run:     updateBp,
	}

	updateCmd.Flags().Uint64VarP(&bpUpdateStaminaFree, "stamina_free", "s", bpUpdateInvalidUint64, `bp update alice --stamina_free 1`)
	updateCmd.Flags().Uint64VarP(&bpUpdateTpsExpected, "tps", "t", bpUpdateInvalidUint64, `bp update alice --tps 1`)
	updateCmd.Flags().StringVarP(&bpUpdateCreateAccountFee, "fee", "f", bpUpdateInvalidString, `bp update alice --fee 1`)
	updateCmd.Flags().Uint64VarP(&bpUpdateEpochDuration, "epoch_duration", "", bpUpdateInvalidUint64, `bp update alice --epoch_duration 1000000`)
	updateCmd.Flags().Uint32VarP(&bpUpdateTopN, "top_n", "", bpUpdateInvalidUint32, `bp update alice --top_n 1000`)
	updateCmd.Flags().StringVarP(&bpUpdatePerTicketPrice, "ticket_price", "", bpUpdateInvalidString, `bp update alice --ticket_price 5.000000`)
	updateCmd.Flags().Uint64VarP(&bpUpdatePerTicketWeight, "ticket_weight", "", bpUpdateInvalidUint64, `bp update alice --ticket_weight 10000000`)

	cmd.AddCommand(registerCmd)
	cmd.AddCommand(enableCmd)
	cmd.AddCommand(voteCmd)
	cmd.AddCommand(updateCmd)
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var CallCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "call",
		Short:   "call a deployed contract",
		Example: "call [caller] [owner] [contract_name] [method] [args]",
		Args:    cobra.ExactArgs(5),
		Run:     call,
	}
	cmd.Flags().Uint64VarP(&fundToContract, "fund", "f", 0, `call [caller] [owner] [contract_name] [args]  -f 300`)
	cmd.Flags().Uint64VarP(&maxGas, "gas", "g", 0, `call [caller] [owner] [contract_name] [args]  -g 300`)
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var ChainCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "chain",
		Short:   "chain <main|test|dev>",
		Example: "chain test",
		Args:    cobra.ExactArgs(1),
		Run:     chainSwitch,
	}
	return cmd
}
View Source
var ChainStateCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "chainstate",
		Short: "get chainstate info",
		Run:   getChainState,
	}

	return cmd
}
View Source
var CloseCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "close",
		Short: "close the wallet-cli",
		Run:   closec,
	}
	return cmd
}
View Source
var CntIdx uint64 = 0
View Source
var ContractCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "contract",
		Short:   "query contract info",
		Example: "contract [owner] [contract_name]",
		Args:    cobra.ExactArgs(2),
		Run:     queryContract,
	}
	return cmd
}
View Source
var ConvertVestCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "convert_vest",
		Short:   "convert VEST to COS",
		Long:    "convert VEST to COS, it takes 13 weeks before finish",
		Example: "convert_vest alice 500.000000",
		Args:    cobra.MinimumNArgs(2),
		Run:     convert,
	}
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var CreateCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "create",
		Short:   "create a new account",
		Example: "create [creator] [name]",
		Args:    cobra.ExactArgs(2),
		Run:     create,
	}

	cmd.Flags().StringVarP(&createAccountFee, "fee", "f", "", `create alice bob --fee 1.000000`)
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var CreateFromMnemonic = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "create_from_mnemonic",
		Short:   "create from mnemonic",
		Example: "create_from_mnemonic [creator] [name]",
		Args:    cobra.ExactArgs(2),
		Run:     createFromMnemonic,
	}
	cmd.Flags().StringVarP(&createAccountFee, "fee", "f", "", `create_from_mnemonic alice  bob --fee 1.000000`)
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var CreateFundAccountCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "createfund",
		Short:   "createfund <creator> <acc_name_prefix> <acc_count> <fund_balance>",
		Example: "createfund initminer user 1000 10",
		Args:    cobra.ExactArgs(4),
		Run:     createFundAccount,
	}
	return cmd
}
View Source
var DelegateCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "delegate",
		Short: "vest delegation, claiming and order list",
	}

	listCmd := &cobra.Command{
		Use:     "list",
		Short:   "list delegation orders of specific account",
		Example: "delegate list alice",
		Args:    cobra.ExactArgs(1),
		Run:     listDelegations,
	}
	listCmd.Flags().BoolVarP(&delegationListOptionTo, "to", "t", false, `delegate list alice --to`)

	newCmd := &cobra.Command{
		Use:     "new",
		Short:   "create a new delegation order",
		Example: "delegate new alice bob 100.000000 86400",
		Args:    cobra.ExactArgs(4),
		Run:     newDelegation,
	}

	claimCmd := &cobra.Command{
		Use:     "claim",
		Short:   "claim the vests from a matured delegation order",
		Example: "delegate claim alice [order_id]",
		Args:    cobra.ExactArgs(2),
		Run:     claimDelegation,
	}

	cmd.AddCommand(listCmd)
	cmd.AddCommand(newCmd)
	cmd.AddCommand(claimCmd)
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var DeployCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "deploy",
		Short:   "deploy a new contract",
		Example: "deploy [author] [contract_name] [local_wasm_path] [local_abi_path] [upgradeable]",
		Args:    cobra.ExactArgs(5),
		Run:     deploy,
	}
	cmd.Flags().StringVarP(&contractUrl, "url", "u", "", `deploy alice contractname path_to_wasm path_to_abi false --url "http://example.com"`)
	cmd.Flags().StringVarP(&contractDesc, "desc", "d", "", `deploy alice contractname path_to_wasm path_to_abi false --desc "some description"`)
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var FollowCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "follow",
		Short:   "follow an author",
		Example: "follow [follower] [following]",
		Args:    cobra.ExactArgs(2),
		Run:     follow,
	}

	cmd.Flags().BoolVarP(&followCancel, "cancel", "c", false, `follow alice bob --cancel`)
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var FollowCntCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "follow_count",
		Short:   "get account follow relation",
		Example: "follow_count [account_name]",
		Args:    cobra.ExactArgs(1),
		Run:     followCnt,
	}

	return cmd
}
View Source
var GenKeyPairWithMnemonicCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "genKeyPair",
		Short: "generate new key pair and mnemonic",
		Run:   genKeyPairAndMnemonic,
	}
	return cmd
}
View Source
var ImportCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "import",
		Short:   "import an account",
		Example: "import [name] [privkey]",
		Args:    cobra.ExactArgs(2),
		Run:     importAccount,
	}
	cmd.Flags().BoolVarP(&importForceFlag, "force", "f", false, "import --force")
	return cmd
}
View Source
var ImportFromMnemonicCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "import_from_mnemonic",
		Short:   "import an account from mnemonic",
		Example: "import_from_mnemonic [name]",
		Args:    cobra.ExactArgs(1),
		Run:     importFromMnemonic,
	}
	cmd.Flags().BoolVarP(&importForceFlag, "force", "f", false, "import_from_mnemonic --force")
	return cmd
}
View Source
var InfoCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "info",
		Short:   "display an unlocked account's info",
		Example: "info alice",
		Args:    cobra.ExactArgs(1),
		Run:     info,
	}
	return cmd
}
View Source
var IsLockedCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "locked",
		Short: "whether a account has been locked",
		Args:  cobra.ExactArgs(1),
		Run:   isLocked,
	}
	return cmd
}
View Source
var ListCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "list",
		Short: "list all accounts",
		Run:   list,
	}
	return cmd
}
View Source
var LoadAllCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "loadAll",
		Short: "load all accounts in default path",
		Args:  cobra.ExactArgs(0),
		Run:   loadAll,
	}
	return cmd
}
View Source
var LoadCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "load",
		Short: "load a created account",
		Args:  cobra.ExactArgs(1),
		Run:   load,
	}
	return cmd
}
View Source
var LockCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "lock",
		Short: "lock a account",
		Args:  cobra.ExactArgs(1),
		Run:   lock,
	}
	return cmd
}
View Source
var MultinodetesterCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "multinodetester",
		Short:   "multinodetester count",
		Example: "multinodetester count",
		Args:    cobra.ExactArgs(1),
		Run:     multinodetester,
	}
	return cmd
}
View Source
var NodeNeighboursCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "nodeNeighbours",
		Short: "nodeNeighbours",
		Run:   nodeNeighbours,
	}

	cmd.Flags().StringVarP(&plist, "rpc", "r", "localhost:8888", `nodeNeighbours --rpc xxx:xxx,xxx:xxx`)

	return cmd
}
View Source
var NodesCheckCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "nodescheck",
		Short: "nodescheck",
		Run:   nodesCheck,
	}

	cmd.Flags().StringVarP(&rpclist, "rpc", "r", "localhost:8888", `nodescheck --rpc xxx:xxx,xxx:xxx`)

	return cmd
}
View Source
var PostCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "post",
		Short:   "post a topic",
		Example: "post [author] [tags] [title] [content]",
		Args:    cobra.ExactArgs(4),
		Run:     post,
	}
	cmd.Flags().StringToIntVarP(&postBeneficiaryRoute, "beneficiary", "b", map[string]int{},
		`post --beneficiary="Alice=5,Bob=10"`)
	return cmd
}
View Source
var QueryCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "query <table_name> <json_of_key>",
		Short:   "query any app table record",
		Example: strings.Join([]string{"query Account \\\"initminer\\\"", "query BlockProducerVote {\\\"block_producer\\\":\\\"initminer\\\",\\\"voter\\\":\\\"initminer\\\"}"}, "\n"),
		Args:    cobra.ExactArgs(2),
		Run:     query,
	}
	return cmd
}
View Source
var RTransferCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "rtran",
		Short:   "rtran <thread-count> <acc_name_prefix> <acc_count>",
		Example: "rtran 2 user 1000",
		Args:    cobra.ExactArgs(3),
		Run:     rTransfer,
	}
	return cmd
}
View Source
var RandomTransferCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "randtran",
		Short:   fmt.Sprintf("create %d random accounts and transfer randomly among them", randAccounts),
		Example: "randtran [creator] [#threads]",
		Args:    cobra.ExactArgs(2),
		Run:     randomTransfer,
	}
	return cmd
}
View Source
var ReplyCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "reply",
		Short:   "reply a topic",
		Example: "reply [author] [content] [postId]",
		Args:    cobra.ExactArgs(3),
		Run:     reply,
	}
	cmd.Flags().StringToIntVarP(&replyBeneficiaryRoute, "beneficiary", "b", map[string]int{},
		`reply --beneficiary="Alice=5,Bob=10"`)
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var StakeCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "stake",
		Short:   "stake some cos for stamina",
		Long:    "",
		Example: "stake alice bob 1.000000",
		Args:    cobra.MinimumNArgs(3),
		Run:     stake,
	}
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var StakerListCmd = func() *cobra.Command {

	cmd := &cobra.Command{
		Use: "stakers",
	}

	getMyStakersCmd := &cobra.Command{
		Use:     "forme",
		Short:   "query who stake to me",
		Example: "forme bob alice mike",
		Args:    cobra.MinimumNArgs(3),
		Run:     stakersForMe,
	}
	getMyStakersCmd.Flags().Uint32VarP(&limit, "limit", "", 30, `stakers forme initminer accountstart accountend --limit 10`)

	getMyStakesCmd := &cobra.Command{
		Use:     "toother",
		Short:   "query users that i stake to",
		Example: "forother bob alice mike",
		Args:    cobra.MinimumNArgs(3),
		Run:     stakersToOther,
	}
	getMyStakesCmd.Flags().Uint32VarP(&limit, "limit", "", 30, `stakers forme initminer accountstart accountend --limit 10`)

	cmd.AddCommand(getMyStakersCmd)
	cmd.AddCommand(getMyStakesCmd)
	return cmd
}
View Source
var StressCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "stress",
		Short:   "stress thread-count initminer alicex 1",
		Long:    "stress thread-count transfer cos from one account to another account",
		Example: "stress 2 initminer alicex 1",
		Args:    cobra.MinimumNArgs(4),
		Run:     stress,
	}
	return cmd
}
View Source
var StressCreAccountCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "stressaccount",
		Short:   "create a new random account ",
		Long:    "use thread-count thread to stress test create new random account by a exist creator(initminer)",
		Example: "stressaccount 2 initminer 0",
		Args:    cobra.MinimumNArgs(2),
		Run:     stressCreAccount,
	}
	return cmd
}
View Source
var StressVMCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "stressvm",
		Short:   "stressvm [count] [caller] [owner] [contract_name]",
		Long:    "stress vm call",
		Example: "stress 2 initminer initminer print",
		Args:    cobra.MinimumNArgs(4),
		Run:     stressVM,
	}
	return cmd
}
View Source
var SwitchPortcmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "switchport",
		Short:   "switchport address",
		Example: "switchport [ip:]port",
		Args:    cobra.ExactArgs(1),
		Run:     switchport,
	}
	return cmd
}
View Source
var TicketCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use: "ticket",
	}

	acquireCmd := &cobra.Command{
		Use:     "acquire",
		Short:   "acquire tickets using VEST",
		Example: "ticket acquire [name] [count]",
		Args:    cobra.ExactArgs(2),
		Run:     acquireTicket,
	}

	voteCmd := &cobra.Command{
		Use:     "vote",
		Short:   "vote tickets to post",
		Example: "ticket vote [name] [postId] [count]",
		Args:    cobra.ExactArgs(3),
		Run:     voteByTicket,
	}

	cmd.AddCommand(acquireCmd)
	cmd.AddCommand(voteCmd)

	return cmd
}
View Source
var TransferCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "transfer",
		Short:   "transfer to another account",
		Long:    "transfer cos to another account by name, should unlock sender first",
		Example: "transfer alice bob 500.000000",
		Args:    cobra.MinimumNArgs(3),
		Run:     transfer,
	}
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var TransferVestCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "transfer_vest",
		Short:   "convert COS to VEST",
		Long:    "convert amounts of liquidity COS to VEST",
		Example: "transfer_vest alice alice 500.000000 \"memo\"",
		Args:    cobra.ExactArgs(4),
		Run:     transferVest,
	}
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var UnStakeCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "unstake",
		Short:   "unstake some cos for stamina",
		Long:    "",
		Example: "unstake alice 500.000000",
		Args:    cobra.MinimumNArgs(3),
		Run:     unstake,
	}
	utils.ProcessEstimate(cmd)
	return cmd
}
View Source
var UnlockCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "unlock",
		Short:   "unlock a account",
		Example: "unlock [name]",
		Args:    cobra.ExactArgs(1),
		Run:     unlock,
	}
	return cmd
}
View Source
var VmTableCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "table",
		Short:   "query vm table content",
		Example: "table owner_name contract_name table_name field_name field_begin count(max value:100) [reverse]",
		Args:    cobra.MinimumNArgs(3),
		Run:     queryTable,
	}

	return cmd
}
View Source
var VoteCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:     "vote",
		Short:   "vote to a post",
		Example: "vote [voter] [postId]",
		Args:    cobra.ExactArgs(2),
		Run:     vote,
	}
	utils.ProcessEstimate(cmd)
	return cmd
}

Functions

This section is empty.

Types

type RandTransfer added in v1.0.2

type RandTransfer struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
mock
Package mock_utils is a generated GoMock package.
Package mock_utils is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL