cmd

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: Apache-2.0, MIT Imports: 96 Imported by: 0

Documentation

Overview

Package commands implements the command to print the blockchain.

Package cmd implements the command to print the blockchain.

Index

Constants

View Source
const (
	// OptionAPI is the name of the option for specifying the api port.
	OptionAPI = "cmdapiaddr"

	OptionToken = "token"
	// OptionRepoDir is the name of the option for specifying the directory of the repo.
	OptionRepoDir = "repo"

	OptionLegacyRepoDir = "repodir"

	// OptionDrandConfigAddr is the init option for configuring drand to a given network address at init time
	OptionDrandConfigAddr = "drand-config-addr"

	// offlineMode tells us if we should try to connect this Filecoin node to the network
	OfflineMode = "offline"

	// ELStdout tells the daemon to write event logs to stdout.
	ELStdout = "elstdout"

	ULimit = "manage-fdlimit"

	// SwarmAddress is the multiaddr for this Filecoin node
	SwarmAddress = "swarmlisten"

	// SwarmPublicRelayAddress is a public address that the venus node
	// will listen on if it is operating as a relay.  We use this to specify
	// the public ip:port of a relay node that is sitting behind a static
	// NAT mapping.
	SwarmPublicRelayAddress = "swarmrelaypublic"

	// GenesisFile is the path of file containing archive of genesis block DAG data
	GenesisFile = "genesisfile"

	// Network populates config with network-specific parameters for a known network (e.g. testnet2)
	Network = "network"

	// IsRelay when set causes the the daemon to provide libp2p relay
	// services allowing other filecoin nodes behind NATs to talk directly.
	IsRelay = "is-relay"

	Size = "size"

	ImportSnapshot = "import-snapshot"

	// wallet password
	Password = "password"

	AuthServiceURL = "auth-url"
)
View Source
const Confidence = 10

Variables

View Source
var (
	// ErrInvalidSize indicates that the provided size was invalid.
	ErrInvalidSize = fmt.Errorf("invalid size")

	// ErrInvalidPrice indicates that the provided price was invalid.
	ErrInvalidPrice = fmt.Errorf("invalid price")

	// ErrInvalidAmount indicates that the provided amount was invalid.
	ErrInvalidAmount = fmt.Errorf("invalid amount")

	// ErrInvalidCollateral indicates that provided collateral was invalid.
	ErrInvalidCollateral = fmt.Errorf("invalid collateral")

	// ErrInvalidPledge indicates that provided pledge was invalid.
	ErrInvalidPledge = fmt.Errorf("invalid pledge")

	// ErrInvalidBlockHeight indicates that the provided block height was invalid.
	ErrInvalidBlockHeight = fmt.Errorf("invalid block height")

	// ErrMissingDaemon is the error returned when trying to execute a command that requires the daemon to be started.
	ErrMissingDaemon = errors.New("daemon must be started before using this command")

	// ErrNoWalletAddresses indicates that there are no addresses in wallet to mine to.
	ErrNoWalletAddresses = fmt.Errorf("no addresses in wallet to mine to")
)
View Source
var (
	AdminExtra = new(cmds.Extra).SetValue("perm", "admin")
	WriteExtra = new(cmds.Extra).SetValue("perm", "write")
	SignExtra  = new(cmds.Extra).SetValue("perm", "sign")
	ReadExtra  = new(cmds.Extra).SetValue("perm", "read")
)
View Source
var RootCmd = &cmds.Command{
	Helptext: cmds.HelpText{
		Tagline: "Filecoin decentralized storage network client",
		Subcommands: `
START RUNNING VENUS
  daemon                 - Start a venus daemon process
  wallet                 - Manage wallet
  msig                   - Interact with a multisig wallet

VIEW DATA STRUCTURES
  chain                  - Inspect the filecoin blockchain
  sync                   - Inspect the filecoin Sync
  dag                    - Interact with IPLD DAG objects
  show                   - Get human-readable representations of filecoin objects

NETWORK COMMANDS
  swarm                  - Interact with the swarm
  drand                  - Retrieve randomness from drand server

MESSAGE COMMANDS
  send                   - Send message
  mpool                  - Manage the message pool

State COMMANDS
  wait-msg               - Wait for a message to appear on chain
  search-msg             - Search to see whether a message has appeared on chain
  power                  - Query network or miner power
  sectors                - Query the sector set of a miner
  active-sectors         - Query the active sector set of a miner
  sector                 - Get miner sector info
  get-actor              - Print actor information
  lookup                 - Find corresponding ID address
  sector-size            - Look up miners sector size
  get-deal               - View on-chain deal info
  miner-info             - Retrieve miner information
  network-version        - MReturns the network version
  list-actor             - list all actors

Paych COMMANDS 
  paych                  - Manage payment channels

Cid COMMANDS
  manifest-cid-from-car  - Get the manifest CID from a car file

TOOL COMMANDS
  inspect                - Show info about the venus node
  log                    - Interact with the daemon event log output
  version                - Show venus version information
  seed                   - Seal sectors for genesis miner
  fetch                  - Fetch proving parameters
`,
	},
	Options: []cmds.Option{
		cmds.StringsOption(OptionToken, "set the auth token to use"),
		cmds.StringOption(OptionAPI, "set the api port to use"),
		cmds.StringOption(OptionRepoDir, OptionLegacyRepoDir, "set the repo directory, defaults to ~/.venus"),
		cmds.StringOption(cmds.EncLong, cmds.EncShort, "The encoding type the output should be encoded with (pretty-json or json)").WithDefault("pretty-json"),
		cmds.BoolOption("help", "Show the full command help text."),
		cmds.BoolOption("h", "Show a short version of the command help text."),
	},
	Subcommands: make(map[string]*cmds.Command),
}

command object for the local cli

View Source
var RootCmdDaemon = &cmds.Command{
	Subcommands: make(map[string]*cmds.Command),
}

command object for the daemon

Functions

func EpochTime

func EpochTime(curr, e abi.ChainEpoch, blockDelay uint64) string

func Import

func Import(ctx context.Context, r repo.Repo, fileName string) error

Import cache tipset cids to store. The value of the cached tipset CIDS is used as the check-point when running `venus daemon`

func LoadTipSet added in v1.1.0

func LoadTipSet(ctx context.Context, req *cmds.Request, chainAPI v1api.IChain) (*types.TipSet, error)

LoadTipSet gets the tipset from the context, or the head from the API.

It always gets the head from the API so commands use a consistent tipset even if time pases.

func ParseTipSetRef added in v1.1.0

func ParseTipSetRef(ctx context.Context, chainAPI v1api.IChain, tss string) (*types.TipSet, error)

func ParseTipSetString added in v1.1.0

func ParseTipSetString(ts string) ([]cid.Cid, error)

func PrintString

func PrintString(w io.Writer, s fmt.Stringer) error

PrintString prints a given Stringer to the writer.

func ReqContext added in v0.9.4

func ReqContext(cctx context.Context) context.Context

func Run

func Run(ctx context.Context, args []string, stdin, stdout, stderr *os.File) (int, error)

Run processes the arguments and stdin

Types

type APIInfo added in v0.9.7

type APIInfo struct {
	Addr  string
	Token string
}

type ActorInfo

type ActorInfo struct {
	Address string
	Balance string
	Nonce   uint64
	Code    string
	Head    string
}

type ActorView

type ActorView struct {
	Address string          `json:"address"`
	Code    cid.Cid         `json:"code,omitempty"`
	Nonce   uint64          `json:"nonce"`
	Balance abi.TokenAmount `json:"balance"`
	Head    cid.Cid         `json:"head,omitempty"`
}

ActorView represents a generic way to represent details about any actor to the user.

type AddressLsResult

type AddressLsResult struct {
	Addresses []address.Address
}

AddressLsResult is the result of running the address list command.

type AddressResult

type AddressResult struct {
	Address address.Address
}

type BlockResult

type BlockResult struct {
	Cid   cid.Cid
	Miner address.Address
}

type ChainHeadResult

type ChainHeadResult struct {
	Height       abi.ChainEpoch
	ParentWeight big.Int
	Cids         []cid.Cid
	Timestamp    string
}

type ChainLsResult

type ChainLsResult struct {
	Height    abi.ChainEpoch
	Timestamp string
	Blocks    []BlockResult
}

type IDDetails

type IDDetails struct {
	Addresses       []ma.Multiaddr
	ID              peer.ID
	AgentVersion    string
	ProtocolVersion string
	PublicKey       []byte // raw bytes
}

IDDetails is a collection of information about a node.

func (IDDetails) MarshalJSON

func (idd IDDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*IDDetails) UnmarshalJSON

func (idd *IDDetails) UnmarshalJSON(data []byte) error

UnmarshalJSON implements Unmarshaler

type MessageSendResult

type MessageSendResult struct {
	Cid     cid.Cid
	GasUsed int64
	Preview bool
}

MessageSendResult is the return type for message send command

type SilentWriter

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

SilentWriter writes to a stream, stopping after the first error and discarding output until the error is cleared. No printing methods return an error (to avoid warnings about ignoring it), but they do return a boolean indicating whether an error is waiting to be cleared. Example usage:

sw := NewSilentWriter(w)
sw.Println("A line")
sw.Println("Another line")
return sw.Error()

func NewSilentWriter

func NewSilentWriter(w io.Writer) *SilentWriter

NewSilentWriter returns a new writer backed by `w`.

func (*SilentWriter) ClearError

func (sw *SilentWriter) ClearError() error

ClearError clears and returns any error encountered while writing. Subsequent writes will attempt to write to the underlying writer again.

func (*SilentWriter) Error

func (sw *SilentWriter) Error() error

Error returns any error encountered while writing.

func (*SilentWriter) Print

func (sw *SilentWriter) Print(a ...interface{}) bool

Print writes with fmt.Fprint and returns true if there was no error.

func (*SilentWriter) Printf

func (sw *SilentWriter) Printf(format string, a ...interface{}) bool

Printf writes with fmt.Fprintf and returns true if there was no error.

func (*SilentWriter) Println

func (sw *SilentWriter) Println(a ...interface{}) bool

Println writes with fmt.Fprintln and returns true if there was no error.

func (*SilentWriter) Write

func (sw *SilentWriter) Write(p []byte) bool

Write writes with io.Writer.Write and returns true if there was no error.

func (*SilentWriter) WriteString

func (sw *SilentWriter) WriteString(str string) bool

WriteString writes with io.WriteString and returns true if there was no error.

func (*SilentWriter) WriteStringln

func (sw *SilentWriter) WriteStringln(str string) bool

WriteString writes with io.WriteString and returns true if there was no error.

type WaitResult

type WaitResult struct {
	Message   *types.Message
	Receipt   *types.MessageReceipt
	Signature vm.ActorMethodSignature
}

WaitResult is the result of a message wait call.

type WalletSerializeResult

type WalletSerializeResult struct {
	KeyInfo []*crypto.KeyInfo
}

WalletSerializeResult is the type wallet export and import return and expect.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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