console

package
v0.1.8-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2019 License: GPL-3.0 Imports: 27 Imported by: 1

Documentation

Overview

Package console provides javascript-enabled console environment for interacting with the client. It includes pre-loaded methods that access the node's RPC interface allowing access to the state and condition of the client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RPCClientError

func RPCClientError(msg string) error

RPCClientError creates an error describing an issue with the rpc client.

Types

type Console

type Console struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Console defines functionalities for create and using an interactive Javascript console to perform and query the system.

func New

func New(coinbase *crypto.Key, historyPath string, cfg *config.EngineConfig, log logger.Logger) *Console

New creates a new Console instance. signatory is the address

func NewAttached

func NewAttached(coinbase *crypto.Key, historyPath string, cfg *config.EngineConfig, log logger.Logger) *Console

NewAttached is like New but enables attach mode

func (*Console) APIs

func (c *Console) APIs() jsonrpc.APISet

APIs returns all API handlers

func (*Console) OnStop

func (c *Console) OnStop(f func())

OnStop sets a function that is called when the console is stopped

func (*Console) Prepare

func (c *Console) Prepare() error

Prepare sets up the console's prompt colors, suggestions etc.

func (*Console) Run

func (c *Console) Run()

Run the console

func (*Console) SetRPCServer

func (c *Console) SetRPCServer(rpcServer *rpc.Server, secured bool)

SetRPCServer sets the rpc server so we can start and stop it. It will panic if this is called on a console with attach mode enabled.

func (*Console) SetRPCServerAddr

func (c *Console) SetRPCServerAddr(addr string, secured bool)

SetRPCServerAddr sets the address of the RPC server to be dialled

func (*Console) SetVersions

func (c *Console) SetVersions(protocol, client, runtime, commit string)

SetVersions sets the versions of components

func (*Console) Stop

func (c *Console) Stop(immediately bool)

Stop stops console. It saves command history and calls the stop callback

type Executor

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

Executor is responsible for executing operations inside a javascript VM.

func (*Executor) OnInput

func (e *Executor) OnInput(in string)

OnInput receives inputs and executes

func (*Executor) PrepareContext

func (e *Executor) PrepareContext() ([]prompt.Suggest, error)

PrepareContext adds objects and functions into the VM's global contexts allowing users to have access to pre-defined values and objects

type RPCClient

type RPCClient struct {
	Address string
}

RPCClient provides the ability to call methods of an rpc server.

type RPCConfig

type RPCConfig struct {
	Client RPCClient
}

RPCConfig holds information required to create an rpc client

type SuggestionManager

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

SuggestionManager manages suggestions

type TxBalanceBuilder

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

TxBalanceBuilder provides methods for building a balance transaction.

func (*TxBalanceBuilder) Fee

func (o *TxBalanceBuilder) Fee(amount string) *TxBalanceBuilder

Fee sets the fee

func (*TxBalanceBuilder) Finalize

func (o *TxBalanceBuilder) Finalize() map[string]interface{}

Finalize returns the transaction payload with nonce, timestamp, hash and signature computed and ready for broadcast.

func (*TxBalanceBuilder) From

func (o *TxBalanceBuilder) From(address string) *TxBalanceBuilder

From sets the sender's address

func (*TxBalanceBuilder) Nonce

func (o *TxBalanceBuilder) Nonce(nonce int64) *TxBalanceBuilder

Nonce sets the nonce

func (*TxBalanceBuilder) Packed

func (o *TxBalanceBuilder) Packed() string

Packed returns a base58check encode equivalent of the signed payload.

func (*TxBalanceBuilder) Payload

func (o *TxBalanceBuilder) Payload(finalize bool) map[string]interface{}

Payload returns the transaction being built. If finalize is true, the builder attempts to compute the hash, sign and other fields before returning the transaction

func (*TxBalanceBuilder) Reset

func (o *TxBalanceBuilder) Reset()

Reset the builder

func (*TxBalanceBuilder) Send

func (o *TxBalanceBuilder) Send() map[string]interface{}

Send signs, compute hash and signature and sends the payload to the transaction handling RPC API.

func (*TxBalanceBuilder) SenderPubKey

func (o *TxBalanceBuilder) SenderPubKey(pk string) *TxBalanceBuilder

SenderPubKey sets the senders public key

func (*TxBalanceBuilder) To

func (o *TxBalanceBuilder) To(address string) *TxBalanceBuilder

To sets the recipient's address

func (*TxBalanceBuilder) Value

func (o *TxBalanceBuilder) Value(amount string) *TxBalanceBuilder

Value sets the amount to be sent

type TxBuilder

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

TxBuilder provides methods for building and executing a transaction

func NewTxBuilder

func NewTxBuilder(e *Executor) *TxBuilder

NewTxBuilder creates a TxBuilder

func (*TxBuilder) Balance

func (o *TxBuilder) Balance() *TxBalanceBuilder

Balance creates a balance transaction builder. It will attempt to fetch the address

Jump to

Keyboard shortcuts

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