backend

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 41 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBaseCacheController

func NewBaseCacheController(expirationChecker func(expirationAnchor, valueToCompare any) bool) *baseCacheController

func NewTendermintValidatorsCache

func NewTendermintValidatorsCache(tmClient client.Client) *tendermintValidatorsCache

func NewValidatorsConsAddrToValAddrCache

func NewValidatorsConsAddrToValAddrCache(tmClient client.Client, stakingQueryClient stakingtypes.QueryClient, codec codec.Codec) *validatorsConsAddrToValAddr

Types

type Backend

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

Backend implements the BackendI interface

func NewBackend

func NewBackend(
	ctx *server.Context,
	logger log.Logger,
	clientCtx client.Context,
	messageParsers map[string]berpctypes.MessageParser,
	messageInvolversExtractors map[string]berpctypes.MessageInvolversExtractor,
	externalServices berpctypes.ExternalServices,
) *Backend

NewBackend creates a new Backend instance for RollApp Block Explorer

func (*Backend) GetAccount

func (m *Backend) GetAccount(accountAddressStr string) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetAccountBalances

func (m *Backend) GetAccountBalances(accountAddressStr string, denom *string) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetBlockByNumber

func (m *Backend) GetBlockByNumber(height int64) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetChainInfo

func (m *Backend) GetChainInfo() (berpctypes.GenericBackendResponse, error)

func (*Backend) GetClientContext

func (m *Backend) GetClientContext() client.Context

func (*Backend) GetConfig

func (m *Backend) GetConfig() config.BeJsonRpcConfig

func (*Backend) GetContext

func (m *Backend) GetContext() context.Context

func (*Backend) GetDenomMetadata

func (m *Backend) GetDenomMetadata(base string) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetDenomsMetadata

func (m *Backend) GetDenomsMetadata(pageNo int) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetExternalServices

func (m *Backend) GetExternalServices() berpctypes.ExternalServices

func (*Backend) GetGovProposal

func (m *Backend) GetGovProposal(proposalId uint64) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetGovProposals

func (m *Backend) GetGovProposals(pageNo int) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetLatestBlockNumber added in v1.0.3

func (m *Backend) GetLatestBlockNumber() (berpctypes.GenericBackendResponse, error)

func (*Backend) GetLogger

func (m *Backend) GetLogger() log.Logger

func (*Backend) GetModuleParams

func (m *Backend) GetModuleParams(moduleName string) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetQueryClient

func (m *Backend) GetQueryClient() *berpctypes.QueryClient

func (*Backend) GetStakingInfo

func (m *Backend) GetStakingInfo(delegatorAddr string) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetTotalSupply

func (m *Backend) GetTotalSupply(pageNo int) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetTransactionByHash

func (m *Backend) GetTransactionByHash(hashStr string) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetTransactionsInBlockRange

func (m *Backend) GetTransactionsInBlockRange(fromHeightIncluded, toHeightIncluded int64) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetValidatorAccount

func (m *Backend) GetValidatorAccount(consOrValAddr string) (berpctypes.GenericBackendResponse, error)

func (*Backend) GetValidators

func (m *Backend) GetValidators() (berpctypes.GenericBackendResponse, error)

func (*Backend) WithInterceptor

func (m *Backend) WithInterceptor(interceptor RequestInterceptor) *Backend

type BackendI

type BackendI interface {

	// GetChainInfo returns the chain information.
	GetChainInfo() (berpctypes.GenericBackendResponse, error)

	// GetModuleParams returns the module parameters by module name.
	GetModuleParams(moduleName string) (berpctypes.GenericBackendResponse, error)

	GetAccountBalances(accountAddressStr string, denom *string) (berpctypes.GenericBackendResponse, error)

	GetAccount(accountAddressStr string) (berpctypes.GenericBackendResponse, error)

	GetValidatorAccount(consOrValAddr string) (berpctypes.GenericBackendResponse, error)

	// GetLatestBlockNumber returns the latest block number, along with the epoch UTC seconds.
	GetLatestBlockNumber() (berpctypes.GenericBackendResponse, error)

	// GetBlockByNumber returns a block by its height.
	GetBlockByNumber(height int64) (berpctypes.GenericBackendResponse, error)

	// GetTransactionsInBlockRange returns the list transaction info within a block range.
	// The range is inclusive, specified clearly.
	GetTransactionsInBlockRange(fromHeightIncluded, toHeightIncluded int64) (berpctypes.GenericBackendResponse, error)

	// GetTransactionByHash returns a transaction by its hash.
	GetTransactionByHash(hash string) (berpctypes.GenericBackendResponse, error)

	// GetStakingInfo returns the staking information, includes:
	// - Delegator's staking information
	// - Validator's commission & outstanding rewards
	GetStakingInfo(delegatorAddr string) (berpctypes.GenericBackendResponse, error)

	GetValidators() (berpctypes.GenericBackendResponse, error)

	GetGovProposal(proposalId uint64) (berpctypes.GenericBackendResponse, error)

	GetGovProposals(pageNo int) (berpctypes.GenericBackendResponse, error)

	GetDenomMetadata(base string) (berpctypes.GenericBackendResponse, error)
	GetDenomsMetadata(pageNo int) (berpctypes.GenericBackendResponse, error)
	GetTotalSupply(pageNo int) (berpctypes.GenericBackendResponse, error)

	GetContext() context.Context
	GetClientContext() client.Context
	GetQueryClient() *berpctypes.QueryClient
	GetLogger() log.Logger
	GetConfig() config.BeJsonRpcConfig
	GetExternalServices() berpctypes.ExternalServices
}

type RequestInterceptor

type RequestInterceptor interface {
	GetTransactionByHash(hashStr string) (intercepted bool, response berpctypes.GenericBackendResponse, err error)

	GetDenomsInformation() (intercepted, append bool, denoms map[string]string, err error)

	GetModuleParams(moduleName string) (intercepted bool, params berpctypes.GenericBackendResponse, err error)

	GetAccount(accountAddressStr string) (intercepted, append bool, response berpctypes.GenericBackendResponse, err error)
}

RequestInterceptor is the interface for the request interceptor. It is used to intercept the request and return the response.

  • If the intercepted is true, the response from this interceptor must be respected.
  • If the intercepted is false, the response from this interceptor must be ignored and processed as usual.

Jump to

Keyboard shortcuts

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