rpcsrv

package
v0.106.3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 56 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractStorageSeeker added in v0.102.0

type ContractStorageSeeker interface {
	SeekStorage(id int32, prefix []byte, cont func(k, v []byte) bool)
}

ContractStorageSeeker is the interface `findstorage*` handlers need to be able to seek over contract storage. Prefix is trimmed in the resulting pair's key.

type Ledger

type Ledger interface {
	AddBlock(block *block.Block) error
	BlockHeight() uint32
	CalculateAttributesFee(tx *transaction.Transaction) int64
	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.Blockchain
	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(uint32) util.Uint256
	GetMaxVerificationGAS() int64
	GetMemPool() *mempool.Pool
	GetNEP11Contracts() []util.Uint160
	GetNEP17Contracts() []util.Uint160
	GetNativeContractScriptHash(string) (util.Uint160, error)
	GetNatives() []state.Contract
	GetNextBlockValidators() ([]*keys.PublicKey, error)
	GetNotaryContractScriptHash() util.Uint160
	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)
	HeaderHeight() uint32
	InitVerificationContext(ic *interop.Context, hash util.Uint160, witness *transaction.Witness) error
	P2PSigExtensionsEnabled() bool
	SubscribeForBlocks(ch chan *block.Block)
	SubscribeForHeadersOfAddedBlocks(ch chan *block.Header)
	SubscribeForExecutions(ch chan *state.AppExecResult)
	SubscribeForNotifications(ch chan *state.ContainedNotificationEvent)
	SubscribeForTransactions(ch chan *transaction.Transaction)
	UnsubscribeFromBlocks(ch chan *block.Block)
	UnsubscribeFromHeadersOfAddedBlocks(ch chan *block.Header)
	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
	ContractStorageSeeker
}

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 {
	// 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. Pay attention that orc is expected to be either untyped nil or non-nil structure implementing OracleHandler interface.

func (*Server) Addresses added in v0.100.0

func (s *Server) Addresses() []string

Addresses returns the list of addresses RPC server is listening to in the form of address:port.

func (*Server) Name

func (s *Server) Name() string

Name returns service name.

func (*Server) RegisterLocal added in v0.101.1

func (s *Server) RegisterLocal(ctx context.Context, events chan<- neorpc.Notification) func(*neorpc.Request) (*neorpc.Response, error)

RegisterLocal performs local client registration.

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