Documentation ¶
Overview ¶
The substrate package contains the logic for interacting with substrate chains. The current supported transfer types are Fungible, Nonfungible, and generic.
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, it constructs proposals. If a proposal is still active, the writer will attempt to vote on it. Resource IDs are resolved to method name on-chain, which are then used in the proposals when constructing the resulting Call struct.
Index ¶
- Constants
- Variables
- func EncodeCall(call types.Call) []byte
- func NewListener(conn *Connection, name string, id msg.ChainId, startBlock uint64, ...) *listener
- func NewWriter(conn *Connection, listener *listener, log log15.Logger, sysErr chan<- error, ...) *writer
- type BlockNumber
- type Chain
- type Connection
- type MultiSigAsMulti
- type MultiSignTx
- type MultiSignTxId
- type MultiSignTxStatistics
- type Relayer
- type TimePointSafe32
Constants ¶
const FungibleTransfer eventName = "FungibleTransfer"
const GenericTransfer eventName = "GenericTransfer"
const Mod = 1
const NonFungibleTransfer eventName = "NonFungibleTransfer"
const RoundInterval = time.Second * 2
Variables ¶
var BlockRetryInterval = time.Second * 5
Frequency of polling for a new block
var ErrBlockNotReady = errors.New("required result to be 32 bytes, but got 0")
var NotExecuted = MultiSignTx{
BlockNumber: -1,
MultiSignTxId: 0,
}
var Subscriptions = []struct { name eventName handler eventHandler }{ {FungibleTransfer, fungibleTransferHandler}, {NonFungibleTransfer, nonFungibleTransferHandler}, {GenericTransfer, genericTransferHandler}, }
var TerminatedError = errors.New("terminated")
Functions ¶
func EncodeCall ¶
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, m *metrics.ChainMetrics, multiSignAddress types.AccountID, cli *client.Client, resource msg.ResourceId, dest msg.ChainId) *listener
Types ¶
type BlockNumber ¶
type BlockNumber int64
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func InitializeChain ¶
func InitializeChain(cfg *core.ChainConfig, logger log15.Logger, sysErr chan<- error, m *metrics.ChainMetrics) (*Chain, error)
func (*Chain) LatestBlock ¶
func (c *Chain) LatestBlock() metrics.LatestBlock
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(url string, name string, key *signature.KeyringPair, log log15.Logger, stop <-chan int, sysErr chan<- error) *Connection
func (*Connection) Close ¶
func (c *Connection) Close()
func (*Connection) Connect ¶
func (c *Connection) Connect() error
func (*Connection) SubmitTx ¶
func (c *Connection) SubmitTx(method utils.Method, args ...interface{}) error
SubmitTx constructs and submits an extrinsic to call the method with the given arguments. All args are passed directly into GSRPC. GSRPC types are recommended to avoid serialization inconsistencies.
type MultiSigAsMulti ¶
type MultiSignTx ¶
type MultiSignTx struct { BlockNumber BlockNumber MultiSignTxId MultiSignTxId }
type MultiSignTxId ¶
type MultiSignTxId uint64
type MultiSignTxStatistics ¶
type MultiSignTxStatistics struct { TotalCount MultiSignTxId CurrentTx MultiSignTx }