core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRestPort = "8080"

DefaultRestPort is the default port the REST API will start on if not specified

View Source
const DefaultRestPortOff = "off"

DefaultRestPortOff is the default value that should be passed if it is desired

to start the node without a REST endpoint available

Variables

View Source
var Hasher = sha256.Sha256{}
View Source
var Marshalizer = &marshal.JsonMarshalizer{}

Functions

func DoExecuteQueryOnTestnet

func DoExecuteQueryOnTestnet(request VMValueRequest) (*vmcommon.VMOutput, error)

func RegisterRoutes

func RegisterRoutes(router *gin.RouterGroup)

RegisterRoutes defines address related routes

Types

type DeploySCRequest

type DeploySCRequest struct {
	OnTestnet           bool   `form:"onTestnet" json:"onTestnet"`
	PrivateKey          string `form:"privateKey" json:"privateKey"`
	TestnetNodeEndpoint string `form:"testnetNodeEndpoint" json:"testnetNodeEndpoint"`
	SndAddress          string `form:"sndAddress" json:"sndAddress"`
	Value               string `form:"value" json:"value"`
	GasLimit            uint64 `form:"gasLimit" json:"gasLimit"`
	GasPrice            uint64 `form:"gasPrice" json:"gasPrice"`
	TxData              string `form:"txData" json:"txData"`
}

DeploySCRequest represents the structure on which user input for generating a new transaction will validate against

type DeploySmartContractCommand

type DeploySmartContractCommand struct {
	OnTestnet           bool
	PrivateKey          string
	TestnetNodeEndpoint string
	SndAddressEncoded   string
	SndAddress          []byte
	Value               string
	GasPrice            uint64
	GasLimit            uint64
	TxData              string
}

DeploySmartContractCommand represents the command for deploying a smart contract

type DeploySmartContractResponse

type DeploySmartContractResponse struct {
	Address string
	Other   interface{}
}

DeploySmartContractResponse represents the reponse for deploying a smart contract

type FacadeHandler

type FacadeHandler interface {
	ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, error)
	DeploySmartContract(command DeploySmartContractCommand) ([]byte, interface{}, error)
	RunSmartContract(command RunSmartContractCommand) (interface{}, error)
}

FacadeHandler interface defines methods that can be used from `elrondFacade` context variable

type NodeDebugFacade

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

NodeDebugFacade represents a facade for grouping the functionality for node, transaction and address

func NewNodeDebugFacade

func NewNodeDebugFacade(debugNode *SimpleDebugNode, restAPIServerDebugMode bool) *NodeDebugFacade

NewNodeDebugFacade creates a new Facade with a NodeWrapper

func (*NodeDebugFacade) DeploySmartContract

func (ef *NodeDebugFacade) DeploySmartContract(command DeploySmartContractCommand) ([]byte, interface{}, error)

DeploySmartContract deploys a smart contract.

func (*NodeDebugFacade) ExecuteSCQuery

func (ef *NodeDebugFacade) ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, error)

ExecuteSCQuery retrieves data from existing SC trie

func (*NodeDebugFacade) IsInterfaceNil

func (ef *NodeDebugFacade) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*NodeDebugFacade) IsNodeRunning

func (ef *NodeDebugFacade) IsNodeRunning() bool

IsNodeRunning gets if the underlying node is running

func (*NodeDebugFacade) PprofEnabled

func (ef *NodeDebugFacade) PprofEnabled() bool

PprofEnabled returns if profiling mode should be active or not on the application

func (*NodeDebugFacade) RestAPIServerDebugMode

func (ef *NodeDebugFacade) RestAPIServerDebugMode() bool

RestAPIServerDebugMode return true is debug mode for Rest API is enabled

func (*NodeDebugFacade) RestApiPort

func (ef *NodeDebugFacade) RestApiPort() string

RestApiPort returns the port on which the api should start on, based on the config file provided. The API will start on the DefaultRestPort value unless a correct value is passed or

the value is explicitly set to off, in which case it will not start at all

func (*NodeDebugFacade) RunSmartContract

func (ef *NodeDebugFacade) RunSmartContract(command RunSmartContractCommand) (interface{}, error)

RunSmartContract runs a smart contract function.

func (*NodeDebugFacade) SetConfig

func (ef *NodeDebugFacade) SetConfig(facadeConfig *config.FacadeConfig)

SetConfig sets the configuration options for the facade

func (*NodeDebugFacade) StartBackgroundServices

func (ef *NodeDebugFacade) StartBackgroundServices(wg *sync.WaitGroup)

StartBackgroundServices starts all background services needed for the correct functionality of the node

func (*NodeDebugFacade) StartNode

func (ef *NodeDebugFacade) StartNode() error

StartNode starts the underlying node

func (*NodeDebugFacade) StatusMetrics

func (ef *NodeDebugFacade) StatusMetrics() external.StatusMetricsHandler

StatusMetrics will return the node's status metrics

func (*NodeDebugFacade) StopNode

func (ef *NodeDebugFacade) StopNode() error

StopNode stops the underlying node

type RunSCRequest

type RunSCRequest struct {
	OnTestnet           bool   `form:"onTestnet" json:"onTestnet"`
	PrivateKey          string `form:"privateKey" json:"privateKey"`
	TestnetNodeEndpoint string `form:"testnetNodeEndpoint" json:"testnetNodeEndpoint"`
	SndAddress          string `form:"sndAddress" json:"sndAddress"`
	ScAddress           string `form:"scAddress" json:"scAddress"`
	Value               string `form:"value" json:"value"`
	GasLimit            uint64 `form:"gasLimit" json:"gasLimit"`
	GasPrice            uint64 `form:"gasPrice" json:"gasPrice"`
	TxData              string `form:"txData" json:"txData"`
}

RunSCRequest represents the structure on which user input for generating a new transaction will validate against

type RunSmartContractCommand

type RunSmartContractCommand struct {
	OnTestnet           bool
	PrivateKey          string
	TestnetNodeEndpoint string
	SndAddressEncoded   string
	SndAddress          []byte
	ScAddress           []byte
	Value               string
	GasPrice            uint64
	GasLimit            uint64
	TxData              string
}

RunSmartContractCommand represents the command for running a smart contract.

type SimpleDebugNode

type SimpleDebugNode struct {
	Accounts         state.AccountsAdapter
	TxProcessor      process.TransactionProcessor
	BlockChainHook   process.BlockChainHookHandler
	AddressConverter state.AddressConverter
	VMContainer      process.VirtualMachinesContainer
	SCQueryService   external.SCQueryService
	APIResolver      facade.ApiResolver
}

func NewSimpleDebugNode

func NewSimpleDebugNode(accounts state.AccountsAdapter) (*SimpleDebugNode, error)

func (*SimpleDebugNode) AddAccountsAccordingToGenesisFile

func (node *SimpleDebugNode) AddAccountsAccordingToGenesisFile(genesisFile string) error

func (*SimpleDebugNode) DeploySmartContract

func (node *SimpleDebugNode) DeploySmartContract(command DeploySmartContractCommand) ([]byte, interface{}, error)

DeploySmartContract deploys a smart contract (with its code).

func (*SimpleDebugNode) RunSmartContract

func (node *SimpleDebugNode) RunSmartContract(command RunSmartContractCommand) (interface{}, error)

RunSmartContract runs a smart contract (a function defined by the smart contract).

type VMValueRequest

type VMValueRequest struct {
	OnTestnet           bool     `form:"onTestnet" json:"onTestnet"`
	TestnetNodeEndpoint string   `form:"testnetNodeEndpoint" json:"testnetNodeEndpoint"`
	ScAddress           string   `form:"scAddress" json:"scAddress"`
	FuncName            string   `form:"funcName" json:"funcName"`
	Args                []string `form:"args"  json:"args"`
}

VMValueRequest represents the structure on which user input for generating a new transaction will validate against

Jump to

Keyboard shortcuts

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