rpcsrv

package
v0.99.6 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 55 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ledger

type Ledger interface {
	AddBlock(block *block.Block) error
	BlockHeight() uint32
	CalculateClaimable(h util.Uint160, endHeight uint32) (*big.Int, error)
	CurrentBlockHash() util.Uint256
	FeePerByte() int64
	ForEachNEP11Transfer(acc util.Uint160, newestTimestamp uint64, f func(*state.NEP11Transfer) (bool, error)) error
	ForEachNEP17Transfer(acc util.Uint160, newestTimestamp uint64, f func(*state.NEP17Transfer) (bool, error)) error
	GetAppExecResults(util.Uint256, trigger.Type) ([]state.AppExecResult, error)
	GetBaseExecFee() int64
	GetBlock(hash util.Uint256) (*block.Block, error)
	GetCommittee() (keys.PublicKeys, error)
	GetConfig() config.ProtocolConfiguration
	GetContractScriptHash(id int32) (util.Uint160, error)
	GetContractState(hash util.Uint160) *state.Contract
	GetEnrollments() ([]state.Validator, error)
	GetGoverningTokenBalance(acc util.Uint160) (*big.Int, uint32)
	GetHeader(hash util.Uint256) (*block.Header, error)
	GetHeaderHash(int) util.Uint256
	GetMaxVerificationGAS() int64
	GetMemPool() *mempool.Pool
	GetNEP11Contracts() []util.Uint160
	GetNEP17Contracts() []util.Uint160
	GetNativeContractScriptHash(string) (util.Uint160, error)
	GetNatives() []state.NativeContract
	GetNextBlockValidators() ([]*keys.PublicKey, error)
	GetNotaryContractScriptHash() util.Uint160
	GetNotaryServiceFeePerKey() int64
	GetStateModule() core.StateRoot
	GetStorageItem(id int32, key []byte) state.StorageItem
	GetTestHistoricVM(t trigger.Type, tx *transaction.Transaction, nextBlockHeight uint32) (*interop.Context, error)
	GetTestVM(t trigger.Type, tx *transaction.Transaction, b *block.Block) (*interop.Context, error)
	GetTokenLastUpdated(acc util.Uint160) (map[int32]uint32, error)
	GetTransaction(util.Uint256) (*transaction.Transaction, uint32, error)
	GetValidators() ([]*keys.PublicKey, error)
	HeaderHeight() uint32
	InitVerificationContext(ic *interop.Context, hash util.Uint160, witness *transaction.Witness) error
	SubscribeForBlocks(ch chan *block.Block)
	SubscribeForExecutions(ch chan *state.AppExecResult)
	SubscribeForNotifications(ch chan *state.ContainedNotificationEvent)
	SubscribeForTransactions(ch chan *transaction.Transaction)
	UnsubscribeFromBlocks(ch chan *block.Block)
	UnsubscribeFromExecutions(ch chan *state.AppExecResult)
	UnsubscribeFromNotifications(ch chan *state.ContainedNotificationEvent)
	UnsubscribeFromTransactions(ch chan *transaction.Transaction)
	VerifyTx(*transaction.Transaction) error
	VerifyWitness(util.Uint160, hash.Hashable, *transaction.Witness, int64) (int64, error)
	mempool.Feer // fee interface
}

Ledger abstracts away the Blockchain as used by the RPC server.

type OracleHandler added in v0.99.2

type OracleHandler interface {
	AddResponse(pub *keys.PublicKey, reqID uint64, txSig []byte)
}

OracleHandler is the interface oracle service needs to provide for the Server.

type Server

type Server struct {
	*http.Server
	// contains filtered or unexported fields
}

Server represents the JSON-RPC 2.0 server.

func New

func New(chain Ledger, conf config.RPC, coreServer *network.Server,
	orc OracleHandler, log *zap.Logger, errChan chan error) Server

New creates a new Server struct.

func (*Server) Name

func (s *Server) Name() string

Name returns service name.

func (*Server) SetOracleHandler added in v0.99.2

func (s *Server) SetOracleHandler(orc OracleHandler)

SetOracleHandler allows to update oracle handler used by the Server.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown stops the RPC server if it's running. It can only be called once, subsequent calls to Shutdown on the same instance are no-op. The instance that was stopped can not be started again by calling Start (use a new instance if needed).

func (*Server) Start

func (s *Server) Start()

Start creates a new JSON-RPC server listening on the configured port. It creates goroutines needed internally and it returns its errors via errChan passed to New(). The Server only starts once, subsequent calls to Start are no-op.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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