types

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TxStatusInMempool  = "in_mempool"
	TxStatusInPushpool = "in_pushpool"
	TxStatusInBlock    = "in_block"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsoleUtilModule

type ConsoleUtilModule interface {
	Module
	PrettyPrint(values ...interface{})
	Dump(objs ...interface{})
	Diff(a, b interface{})
	Eval(src interface{}) otto.Value
	EvalFile(file string) otto.Value
	ReadFile(filename string) []byte
	ReadTextFile(filename string) string
	TreasuryAddress() string
	GenKey(seed ...int64) util.Map
}

type DHTModule

type DHTModule interface {
	Module
	Store(key string, val string)
	Lookup(key string) string
	Announce(key string)
	GetRepoObjectProviders(key string) (res []util.Map)
	GetProviders(key string) (res []util.Map)
	GetPeers() []string
}

type DevModule

type DevModule interface {
	Module
	GetDevUserAccountKey() string
	GetDevUserAddress() string
}

type ExtManager

type ExtManager interface {
	Module
	Exist(name string) bool
	Installed() (extensions []string)
	Load(name string, args ...map[string]string) map[string]interface{}
	Run(name string, args ...map[string]string) map[string]interface{}
	Stop(name string)
	Running() []string
	IsRunning(name string) bool
}

type GetOptions

type GetOptions struct {
	Height interface{} `json:"height"`
	Select []string    `json:"select"`
}

type Module

type Module interface {
	ConfigureVM(vm *otto.Otto) prompt.Completer
}

type ModuleCommon

type ModuleCommon struct {
	// Suggestions contains console suggestions
	Suggestions []prompt.Suggest

	// Client is an RPC client
	Client types.Client
}

ModuleCommon provides common module fields and methods.

func (*ModuleCommon) Completer

func (m *ModuleCommon) Completer(d prompt.Document) []prompt.Suggest

Completer returns suggestions for console input

func (*ModuleCommon) IsAttached

func (m *ModuleCommon) IsAttached() bool

IsAttached checks whether the module is in attach mode.

type Modules

type Modules struct {
	Tx      TxModule
	Chain   NodeModule
	Pool    PoolModule
	User    UserModule
	PushKey PushKeyModule
	Util    ConsoleUtilModule
	Ticket  TicketModule
	Repo    RepoModule
	NS      NamespaceModule
	DHT     DHTModule
	ExtMgr  ExtManager
	RPC     RPCModule
	Dev     DevModule
}

Modules contains all supported modules

func (*Modules) ConfigureVM

func (m *Modules) ConfigureVM(vm *otto.Otto) (completers []prompt.Completer)

ConfigureVM applies all modules' VM configurations to the given VM.

type ModulesHub

type ModulesHub interface {
	// ConfigureVM instructs VM-accessible modules accessible to configure the VM
	ConfigureVM(vm *otto.Otto) []prompt.Completer

	// GetModules returns modules
	GetModules() *Modules
}

ModulesHub describes a mechanism for aggregating, configuring and accessing modules that provide uniform functionalities in JS environment, JSON-RPC APIs and REST APIs

type NamespaceModule

type NamespaceModule interface {
	Module
	Lookup(name string, height ...uint64) util.Map
	GetTarget(path string, height ...uint64) string
	Register(params map[string]interface{}, options ...interface{}) util.Map
	UpdateDomain(params map[string]interface{}, options ...interface{}) util.Map
}

type NodeModule

type NodeModule interface {
	Module
	GetBlock(height string) util.Map
	GetCurHeight() string
	GetBlockInfo(height string) util.Map
	GetValidators(height string) (res []util.Map)
	GetCurrentEpoch() string
	GetEpoch(height int64) string
	IsSyncing() bool
}

type PoolModule

type PoolModule interface {
	Module
	GetSize() util.Map
	GetTop(n int) []util.Map
	GetPushPoolSize() int
}

type PushKeyModule

type PushKeyModule interface {
	Module
	Register(params map[string]interface{}, options ...interface{}) util.Map
	Update(params map[string]interface{}, options ...interface{}) util.Map
	Find(id string, blockHeight ...uint64) util.Map
	Unregister(params map[string]interface{}, options ...interface{}) util.Map
	GetByAddress(address string) []string
	GetAccountOfOwner(gpgID string, blockHeight ...uint64) util.Map
}

type RPCModule

type RPCModule interface {
	Module
}

type RepoModule

type RepoModule interface {
	Module
	Create(params map[string]interface{}, options ...interface{}) util.Map
	UpsertOwner(params map[string]interface{}, options ...interface{}) util.Map
	Vote(params map[string]interface{}, options ...interface{}) util.Map
	Get(name string, opts ...GetOptions) util.Map
	Update(params map[string]interface{}, options ...interface{}) util.Map
	DepositProposalFee(params map[string]interface{}, options ...interface{}) util.Map
	AddContributor(params map[string]interface{}, options ...interface{}) util.Map
	Track(names string, height ...uint64)
	UnTrack(names string)
	GetTracked() util.Map
	GetReposCreatedByAddress(address string) []string
	ListPath(name, path string, revision ...string) []util.Map
	ReadFileLines(name, filePath string, revision ...string) []string
	ReadFile(name, filePath string, revision ...string) string
	GetBranches(name string) []string
	GetLatestBranchCommit(name, branch string) util.Map
	GetCommits(reference, branch string, limit ...int) []util.Map
	GetCommit(name, hash string) util.Map
	CountCommits(name, branch string) int
	GetCommitAncestors(name, commitHash string, limit ...int) []util.Map
	GetParentsAndCommitDiff(name string, commitHash string) util.Map
}

type TicketModule

type TicketModule interface {
	Module
	BuyValidatorTicket(params map[string]interface{}, options ...interface{}) util.Map
	BuyHostTicket(params map[string]interface{}, options ...interface{}) util.Map
	GetValidatorTicketsByProposer(proposerPubKey string, queryOpts ...util.Map) []util.Map
	GetHostTicketsByProposer(proposerPubKey string, queryOpts ...util.Map) []util.Map
	GetTopValidators(limit ...int) []util.Map
	GetTopHosts(limit ...int) []util.Map
	GetStats(proposerPubKey ...string) (result util.Map)
	GetAll(limit ...int) []util.Map
	UnbondHostTicket(params map[string]interface{}, options ...interface{}) util.Map
}

type TxModule

type TxModule interface {
	Module
	Get(hash string) util.Map
	SendPayload(params map[string]interface{}) util.Map
}

type UserModule

type UserModule interface {
	Module
	GetKeys() []string
	GetPrivKey(address string, passphrase ...string) string
	GetPublicKey(address string, passphrase ...string) string
	GetNonce(address string, height ...uint64) string
	GetAccount(address string, height ...uint64) util.Map
	GetAvailableBalance(address string, height ...uint64) string
	GetStakedBalance(address string, height ...uint64) string
	GetValidator(includePrivKey ...bool) util.Map
	SetCommission(params map[string]interface{}, options ...interface{}) util.Map
	SendCoin(params map[string]interface{}, options ...interface{}) util.Map
}

type VMMember

type VMMember struct {

	// Name of the member
	Name string

	// Value is the value of the member
	Value interface{}

	// Description is the brief human description of the member
	Description string
}

VMMember describes a member function or variable of a VM

Jump to

Keyboard shortcuts

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