cmd

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: LGPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the poly network. If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the poly network. If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the poly network. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	AppHelpTemplate = `` /* 811-byte string literal not displayed */

	SubcommandHelpTemplate = `` /* 433-byte string literal not displayed */

	CommandHelpTemplate = `` /* 582-byte string literal not displayed */

)

AppHelpTemplate is the test template for the default, global app help topic.

View Source
var (
	AccountCommand = cli.Command{
		Action:    cli.ShowSubcommandHelp,
		Name:      "account",
		Usage:     "Manage accounts",
		ArgsUsage: "[arguments...]",
		Description: `Wallet management commands can be used to add, view, modify, delete, import account, and so on.
You can use ./Ontology account --help command to view help information of wallet management command.`,
		Subcommands: []cli.Command{
			{
				Action:    accountCreate,
				Name:      "add",
				Usage:     "Add a new account",
				ArgsUsage: "[sub-command options]",
				Flags: []cli.Flag{
					utils.AccountQuantityFlag,
					utils.AccountTypeFlag,
					utils.AccountKeylenFlag,
					utils.AccountSigSchemeFlag,
					utils.AccountDefaultFlag,
					utils.AccountLabelFlag,
					utils.IdentityFlag,
					utils.WalletFileFlag,
				},
				Description: ` Add a new account to wallet.
   Ontology support three type of key: ecdsa, sm2 and ed25519, and support 224、256、384、521 bits length of key in ecdsa, but only support 256 bits length of key in sm2 and ed25519.
   Ontology support multiple signature scheme.
   For ECDSA support SHA224withECDSA、SHA256withECDSA、SHA384withECDSA、SHA512withEdDSA、SHA3-224withECDSA、SHA3-256withECDSA、SHA3-384withECDSA、SHA3-512withECDSA、RIPEMD160withECDSA;
   For SM2 support SM3withSM2, and for SHA512withEdDSA.
   -------------------------------------------------
      Key   |key-length(bits)|  signature-scheme
   ---------|----------------|----------------------
   1 ecdsa  |  1 P-224: 224  | 1 SHA224withECDSA
            |----------------|----------------------
            |  2 P-256: 256  | 2 SHA256withECDSA
            |----------------|----------------------
            |  3 P-384: 384  | 3 SHA384withECDSA
            |----------------|----------------------
            |  4 P-521: 521  | 4 SHA512withEdDSA
            |----------------|----------------------
            |                | 5 SHA3-224withECDSA
            |                |----------------------
            |                | 6 SHA3-256withECDSA
            |                |----------------------
            |                | 7 SHA3-384withECDSA
            |                |----------------------
            |                | 8 SHA3-512withECDSA
            |                |----------------------
            |                | 9 RIPEMD160withECDSA
   ---------|----------------|----------------------
   2 sm2    | sm2p256v1 256  | SM3withSM2
   ---------|----------------|----------------------
   3 ed25519|   25519 256    | SHA512withEdDSA
   -------------------------------------------------`,
			},
			{
				Action:    accountList,
				Name:      "list",
				Usage:     "List existing accounts",
				ArgsUsage: "[sub-command options] <label|address|index>",
				Flags: []cli.Flag{
					utils.WalletFileFlag,
					utils.AccountVerboseFlag,
				},
				Description: `List existing accounts. If specified in args, will list those account. If not specified in args, will list all accouns in wallet`,
			},
			{
				Action:    accountSet,
				Name:      "set",
				Usage:     "Modify an account",
				ArgsUsage: "[sub-command options] <label|address|index>",
				Flags: []cli.Flag{
					utils.AccountSetDefaultFlag,
					utils.WalletFileFlag,
					utils.AccountLabelFlag,
					utils.AccountChangePasswdFlag,
					utils.AccountSigSchemeFlag,
				},
				Description: `Modify settings for an account. Account is specified by address, label of index. Index start from 1. This can be showed by the 'list' command.`,
			},
			{
				Action:    accountDelete,
				Name:      "del",
				Usage:     "Delete an account",
				ArgsUsage: "[sub-command options] <address|label|index>",
				Flags: []cli.Flag{
					utils.WalletFileFlag,
				},
				Description: `Delete an account specified by address, label of index. Index start from 1. This can be showed by the 'list' command`,
			},
			{
				Action:    accountImport,
				Name:      "import",
				Usage:     "Import accounts of wallet to another",
				ArgsUsage: "[sub-command options] <address|label|index>",
				Flags: []cli.Flag{
					utils.WalletFileFlag,
					utils.AccountSourceFileFlag,
					utils.AccountWIFFlag,
				},
				Description: "Import accounts of wallet to another. If not specific accounts in args, all account in source will be import",
			},
			{
				Action:    accountExport,
				Name:      "export",
				Usage:     "Export accounts to a specified wallet file",
				ArgsUsage: "[sub-command options] <filename>",
				Flags: []cli.Flag{
					utils.WalletFileFlag,
					utils.AccountLowSecurityFlag,
				},
			},
		},
	}
)
View Source
var AppHelpFlagGroups = []flagGroup{
	{
		Name: "ONTOLOGY",
		Flags: []cli.Flag{
			utils.ConfigFlag,
			utils.LogLevelFlag,
			utils.DisableEventLogFlag,
			utils.DataDirFlag,
		},
	},
	{
		Name: "ACCOUNT",
		Flags: []cli.Flag{
			utils.WalletFileFlag,
			utils.AccountAddressFlag,
			utils.AccountPassFlag,
			utils.AccountDefaultFlag,
			utils.AccountKeylenFlag,
			utils.AccountSetDefaultFlag,
			utils.AccountSigSchemeFlag,
			utils.AccountTypeFlag,
			utils.AccountVerboseFlag,
			utils.AccountLabelFlag,
			utils.AccountQuantityFlag,
			utils.AccountChangePasswdFlag,
			utils.AccountSourceFileFlag,
			utils.AccountWIFFlag,
			utils.AccountLowSecurityFlag,
			utils.AccountMultiMFlag,
			utils.AccountMultiPubKeyFlag,
			utils.IdentityFlag,
		},
	},
	{
		Name: "CONSENSUS",
		Flags: []cli.Flag{
			utils.EnableConsensusFlag,
			utils.MaxTxInBlockFlag,
		},
	},
	{
		Name: "TXPOOL",
		Flags: []cli.Flag{
			utils.TxpoolPreExecDisableFlag,
			utils.DisableBroadcastNetTxFlag,
		},
	},
	{
		Name: "P2P NODE",
		Flags: []cli.Flag{
			utils.ReservedPeersOnlyFlag,
			utils.ReservedPeersFileFlag,
			utils.NetworkIdFlag,
			utils.NodePortFlag,
			utils.DualPortSupportFlag,
			utils.ConsensusPortFlag,
			utils.HttpInfoPortFlag,
			utils.MaxConnInBoundFlag,
			utils.MaxConnOutBoundFlag,
			utils.MaxConnInBoundForSingleIPFlag,
		},
	},
	{
		Name: "RPC",
		Flags: []cli.Flag{
			utils.RPCDisabledFlag,
			utils.RPCPortFlag,
			utils.RPCLocalEnableFlag,
			utils.RPCLocalProtFlag,
		},
	},
	{
		Name: "RESTFUL",
		Flags: []cli.Flag{
			utils.RestfulEnableFlag,
			utils.RestfulPortFlag,
			utils.RestfulMaxConnsFlag,
		},
	},
	{
		Name: "WEB SOCKET",
		Flags: []cli.Flag{
			utils.WsEnabledFlag,
			utils.WsPortFlag,
		},
	},
	{
		Name: "TEST MODE",
		Flags: []cli.Flag{
			utils.EnableTestModeFlag,
			utils.TestModeGenBlockTimeFlag,
		},
	},
	{
		Name: "CONTRACT",
		Flags: []cli.Flag{
			utils.ContractPrepareDeployFlag,
			utils.ContractAddrFlag,
			utils.ContractAuthorFlag,
			utils.ContractCodeFileFlag,
			utils.ContractDescFlag,
			utils.ContractEmailFlag,
			utils.ContractNameFlag,
			utils.ContractVersionFlag,
			utils.ContractStorageFlag,
			utils.ContractPrepareInvokeFlag,
			utils.ContractParamsFlag,
			utils.ContractReturnTypeFlag,
		},
	},
	{
		Name: "TRANSACTION",
		Flags: []cli.Flag{
			utils.TransactionHashFlag,
			utils.TransferFromSenderFlag,
			utils.ApproveAssetFlag,
			utils.ApproveAssetFromFlag,
			utils.ApproveAssetToFlag,
			utils.ApproveAmountFlag,
			utils.SendTxFlag,
			utils.ForceSendTxFlag,
			utils.TransactionPayerFlag,
			utils.PrepareExecTransactionFlag,
			utils.TransferFromAmountFlag,
			utils.WithdrawONGReceiveAccountFlag,
			utils.WithdrawONGAmountFlag,
		},
	},
	{
		Name: "Approve",
		Flags: []cli.Flag{
			utils.ApproveAssetFromFlag,
			utils.ApproveAssetToFlag,
		},
	},
	{
		Name: "EXPORT",
		Flags: []cli.Flag{
			utils.ExportFileFlag,
			utils.ExportSpeedFlag,
			utils.ExportStartHeightFlag,
			utils.ExportEndHeightFlag,
		},
	},
	{
		Name: "IMPORT",
		Flags: []cli.Flag{
			utils.ImportFileFlag,
			utils.ImportEndHeightFlag,
		},
	},
	{
		Name: "MISC",
	},
}
View Source
var ExportCommand = cli.Command{
	Name:      "export",
	Usage:     "Export blocks in DB to a file",
	ArgsUsage: "",
	Action:    exportBlocks,
	Flags: []cli.Flag{
		utils.RPCPortFlag,
		utils.ExportFileFlag,
		utils.ExportStartHeightFlag,
		utils.ExportEndHeightFlag,
		utils.ExportSpeedFlag,
	},
	Description: "",
}
View Source
var ImportCommand = cli.Command{
	Name:      "import",
	Usage:     "Import blocks to DB from a file",
	ArgsUsage: "",
	Action:    importBlocks,
	Flags: []cli.Flag{
		utils.ImportFileFlag,
		utils.ImportEndHeightFlag,
		utils.DataDirFlag,
		utils.ConfigFlag,
		utils.NetworkIdFlag,
		utils.DisableEventLogFlag,
	},
	Description: "Note that import cmd doesn't support testmode",
}
View Source
var InfoCommand = cli.Command{
	Name:  "info",
	Usage: "Display information about the chain",
	Subcommands: []cli.Command{
		{
			Action:    txInfo,
			Name:      "tx",
			Usage:     "Display transaction information",
			ArgsUsage: "txHash",
			Flags: []cli.Flag{
				utils.RPCPortFlag,
			},
			Description: "Display transaction information",
		},
		{
			Action:    blockInfo,
			Name:      "block",
			Usage:     "Display block information",
			ArgsUsage: "<blochHash|height>",
			Flags: []cli.Flag{
				utils.RPCPortFlag,
			},
			Description: "Display block information",
		},
		{
			Action:      txStatus,
			Name:        "status",
			Usage:       "Display transaction status",
			ArgsUsage:   "<txhash>",
			Description: `Display status of transaction.`,
			Flags: []cli.Flag{
				utils.RPCPortFlag,
			},
		},
		{
			Action:      curBlockHeight,
			Name:        "curblockheight",
			Usage:       "Display the current block height",
			ArgsUsage:   "",
			Description: `Display the current block height.`,
			Flags: []cli.Flag{
				utils.RPCPortFlag,
			},
		},
	},
	Description: `Query information command can query information such as blocks, transactions, and transaction executions. 
You can use the ./Ontology info block --help command to view help information.`,
}
View Source
var MultiSigAddrCommand = cli.Command{
	Name:        "multisigaddr",
	Usage:       "Generate multi-signature address",
	Description: "Generate multi-signature address.",
	Action:      genMultiSigAddress,
	Flags: []cli.Flag{
		utils.AccountMultiMFlag,
		utils.AccountMultiPubKeyFlag,
	},
}
View Source
var MultiSigTxCommand = cli.Command{
	Name:        "multisigtx",
	Usage:       "Sign to multi-signature transaction",
	ArgsUsage:   "<rawtx>",
	Description: "Sign to multi-signature transaction.",
	Action:      multiSigToTx,
	Flags: []cli.Flag{
		utils.RPCPortFlag,
		utils.WalletFileFlag,
		utils.AccountMultiMFlag,
		utils.AccountMultiPubKeyFlag,
		utils.AccountAddressFlag,
		utils.SendTxFlag,
		utils.PrepareExecTransactionFlag,
	},
}
View Source
var SendTxCommand = cli.Command{
	Name:        "sendtx",
	Usage:       "Send raw transaction to Ontology",
	Description: "Send raw transaction to Ontology.",
	ArgsUsage:   "<rawtx>",
	Action:      sendTx,
	Flags: []cli.Flag{
		utils.RPCPortFlag,
		utils.PrepareExecTransactionFlag,
	},
}
View Source
var ShowTxCommand = cli.Command{
	Action:    showTx,
	Name:      "showtx",
	Usage:     "Show info of raw transaction.",
	ArgsUsage: "<rawtx>",
	Flags: []cli.Flag{
		utils.RPCPortFlag,
	},
	Description: "Show info of raw transaction.",
}
View Source
var SigTxCommand = cli.Command{
	Name:        "sigtx",
	Usage:       "Sign to transaction",
	ArgsUsage:   "<rawtx>",
	Description: "Sign to transaction.",
	Action:      sigToTx,
	Flags: []cli.Flag{
		utils.RPCPortFlag,
		utils.WalletFileFlag,
		utils.AccountAddressFlag,
		utils.SendTxFlag,
		utils.PrepareExecTransactionFlag,
	},
}

Functions

func PrintErrorMsg added in v1.0.3

func PrintErrorMsg(format string, a ...interface{})

func PrintInfoMsg added in v1.0.3

func PrintInfoMsg(format string, a ...interface{})

func PrintJsonData added in v1.0.3

func PrintJsonData(data []byte)

func PrintJsonObject added in v1.0.3

func PrintJsonObject(obj interface{})

func PrintWarnMsg added in v1.0.3

func PrintWarnMsg(format string, a ...interface{})

func SetOntologyConfig

func SetOntologyConfig(ctx *cli.Context) (*config.OntologyConfig, error)

func SetRpcPort added in v0.9.2

func SetRpcPort(ctx *cli.Context)

Types

type FmtFlag added in v1.0.3

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

func (*FmtFlag) Apply added in v1.0.3

func (this *FmtFlag) Apply(*flag.FlagSet)

func (*FmtFlag) GetName added in v1.0.3

func (this *FmtFlag) GetName() string

func (*FmtFlag) String added in v1.0.3

func (this *FmtFlag) String() string

Directories

Path Synopsis
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library.
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library.
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library.
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library.
handlers
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library.
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library.
store
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library.
* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library.

Jump to

Keyboard shortcuts

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