service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FinalizedWaitingBlockCount = 3
	ChainNewHead               = "chain_newHead"
	ChainFinalizedHead         = "chain_finalizedHead"
	StateStorage               = "state_storage"
	BlockTime                  = 6
)

FinalizedWaitingBlockCount Because when receive chain_finalizedHead, get block still not finalized so set Waiting block count to try avoid

Variables

This section is empty.

Functions

func GetExtrinsicFee

func GetExtrinsicFee(p websocket.WsConn, encodeExtrinsic string) (fee decimal.Decimal, err error)

GetExtrinsicFee

Types

type Service

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

Service

func New

func New() (s *Service)

New new a service and return.

func (*Service) AddEvent

func (s *Service) AddEvent(
	txn *dao.GormDB,
	block *model.ChainBlock,
	e []model.ChainEvent,
	hashMap map[string]string,
	feeMap map[string]decimal.Decimal) (eventCount int, err error)

func (*Service) BlockAsSampleJson

func (s *Service) BlockAsSampleJson(block *model.ChainBlock) *model.SampleBlockJson

func (*Service) Close

func (s *Service) Close()

Close close the resource.

func (*Service) CreateChainBlock

func (s *Service) CreateChainBlock(conn websocket.WsConn, hash string, block *rpc.Block, event string, spec int, finalized bool) (err error)

func (*Service) DaemonHealth

func (s *Service) DaemonHealth(ctx context.Context) map[string]bool

func (*Service) EmitLog

func (s *Service) EmitLog(txn *dao.GormDB, blockNum int, l []storage.DecoderLog, finalized bool, validatorList []string) (validator string, err error)

func (*Service) EventByIndex

func (s *Service) EventByIndex(index string) *model.ChainEvent

func (*Service) ExtrinsicsAsJson

func (s *Service) ExtrinsicsAsJson(e *model.ChainExtrinsic) *model.ChainExtrinsicJson

func (*Service) FillBlockData

func (s *Service) FillBlockData(conn websocket.WsConn, blockNum int, finalized bool) (err error)

func (*Service) GetBlockByHash

func (s *Service) GetBlockByHash(hash string) *model.ChainBlock

func (*Service) GetBlockByHashJson

func (s *Service) GetBlockByHashJson(hash string) *model.ChainBlockJson

func (*Service) GetBlockByNum

func (s *Service) GetBlockByNum(num int) *model.ChainBlockJson

func (*Service) GetBlocksSampleByNums

func (s *Service) GetBlocksSampleByNums(page, row int) []model.SampleBlockJson

func (*Service) GetCurrentBlockNum

func (s *Service) GetCurrentBlockNum(c context.Context) (uint64, error)

func (*Service) GetCurrentRuntimeSpecVersion

func (s *Service) GetCurrentRuntimeSpecVersion(blockNum int) int

func (*Service) GetExtrinsicByHash

func (s *Service) GetExtrinsicByHash(hash string) *model.ChainExtrinsic

func (*Service) GetExtrinsicByIndex

func (s *Service) GetExtrinsicByIndex(index string) *model.ExtrinsicDetail

func (*Service) GetExtrinsicDetailByHash

func (s *Service) GetExtrinsicDetailByHash(hash string) *model.ExtrinsicDetail

func (*Service) GetExtrinsicList

func (s *Service) GetExtrinsicList(page, row int, order string, query ...string) ([]*model.ChainExtrinsicJson, int)

func (*Service) Metadata

func (s *Service) Metadata() (map[string]string, error)

func (*Service) Ping

func (s *Service) Ping(ctx context.Context, e *empty.Empty) (*empty.Empty, error)

Ping ping the resource.

func (*Service) RenderEvents

func (s *Service) RenderEvents(page, row int, order string, where ...string) ([]model.ChainEventJson, int)

func (*Service) SetHeartBeat

func (s *Service) SetHeartBeat(action string)

func (*Service) Subscribe

func (s *Service) Subscribe(conn ws.WsConn, interrupt chan os.Signal)

func (*Service) SubstrateRuntimeInfo

func (s *Service) SubstrateRuntimeInfo(spec int) *metadata.Instant

func (*Service) SubstrateRuntimeList

func (s *Service) SubstrateRuntimeList() []model.RuntimeVersion

func (*Service) UpdateBlockData

func (s *Service) UpdateBlockData(conn websocket.WsConn, block *model.ChainBlock, finalized bool) (err error)

func (*Service) ValidatorsList

func (s *Service) ValidatorsList(conn websocket.WsConn, hash string) (validatorList []string)

type SubscribeService

type SubscribeService struct {
	*Service
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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