stafihub

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

The substrate package contains the logic for interacting with substrate chains. The current supported transfer types are Fungible.

There are 3 major components: the connection, the listener, and the writer.

Connection

The Connection handles connecting to the substrate client, and submitting transactions to the client. It also handles state queries. The connection is shared by the writer and listener.

Listener

The substrate listener polls blocks and parses the associated events for the three transfer types. It then forwards these into the router.

Writer

As the writer receives messages from the router, nothing happened.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Frequency of polling for a new block
	BlockRetryInterval = 6 * time.Second
	BlockRetryLimit    = 100

	EventRetryLimit    = 20
	EventRetryInterval = 100 * time.Millisecond
)
View Source
var (
	ErrEventAttributeNumberUnMatch = errors.New("ErrEventAttributeNumberTooFew")
)
View Source
var ErrorTerminated = errors.New("terminated")

Functions

func NewListener

func NewListener(conn *Connection, name string, id msg.ChainId, startBlock uint64, log log15.Logger,
	bs blockstore.Blockstorer, stop <-chan int, sysErr chan<- error) *listener

func NewWriter

func NewWriter(conn *Connection, log log15.Logger, sysErr chan<- error, stop <-chan int) *writer

Types

type Chain

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

func InitializeChain

func InitializeChain(cfg *core.ChainConfig, logger log15.Logger, sysErr chan<- error) (*Chain, error)

func (*Chain) Id

func (c *Chain) Id() msg.ChainId

func (*Chain) Name

func (c *Chain) Name() string

func (*Chain) SetRouter

func (c *Chain) SetRouter(r *core.Router)

func (*Chain) Start

func (c *Chain) Start() error

func (*Chain) Stop

func (c *Chain) Stop()

type Connection

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

func NewConnection

func NewConnection(cfg *core.ChainConfig, log log15.Logger, stop <-chan int) (*Connection, error)

func (*Connection) Address

func (c *Connection) Address() string

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) FinalizedBlockNumber

func (c *Connection) FinalizedBlockNumber() (uint64, error)

func (*Connection) GetEvents

func (c *Connection) GetEvents(blockNum uint64) ([]*types.TxResponse, error)

func (*Connection) LatestBlockNumber

func (c *Connection) LatestBlockNumber() (uint64, error)

Jump to

Keyboard shortcuts

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