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
- Variables
- func NewListener(conn *Connection, name string, id msg.ChainId, startBlock uint64, ...) *listener
- func NewWriter(conn *Connection, log log15.Logger, sysErr chan<- error, stop <-chan int, ...) *writer
- type Chain
- type ChainIdParam
- type Connection
- func (c *Connection) Address() string
- func (c *Connection) Close()
- func (c *Connection) FinalizedBlockNumber() (uint64, error)
- func (c *Connection) GetEvents(blockNum uint64) ([]*substrate.ChainEvent, error)
- func (c *Connection) LatestBlockNumber() (uint64, error)
- func (c *Connection) QueryStorage(prefix, method string, arg1, arg2 []byte, result interface{}) (bool, error)
- type DepositNonceParam
- type EventFungibleTransfer
- type VoteStatus
Constants ¶
View Source
const ( VoteStatusActive = "Active" VoteStatusPassed = "Passed" VoteStatusExpired = "Expired" VoteStatusExecuted = "Executed" )
View Source
const (
DefaultTypeFilePath = "../../network/stafi.json"
)
View Source
const FungibleTransfer eventName = config.FungibleTransferEventId
Variables ¶
View Source
var ( ValueNotStringError = errors.New("value not string") SkipError = errors.New("should skip") )
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 ErrorTerminated = errors.New("terminated")
View Source
var Subscriptions = []struct { name eventName handler eventHandler }{{FungibleTransfer, fungibleTransferHandler}}
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, decimals map[string]decimal.Decimal) *listener
Types ¶
type ChainIdParam ¶
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) ([]*substrate.ChainEvent, error)
func (*Connection) LatestBlockNumber ¶
func (c *Connection) LatestBlockNumber() (uint64, error)
func (*Connection) QueryStorage ¶
func (c *Connection) QueryStorage(prefix, method string, arg1, arg2 []byte, result interface{}) (bool, error)
queryStorage performs a storage lookup. Arguments may be nil, result must be a pointer.
type DepositNonceParam ¶
type EventFungibleTransfer ¶
type VoteStatus ¶
type VoteStatus string
Click to show internal directories.
Click to hide internal directories.