parachain

package
v0.0.0-...-8ab0d56 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: LGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const MortalEraPeriod = uint64(64)

Must be a power of two between 4 and 65536 (inclusive)

Variables

This section is empty.

Functions

func NewMortalEra

func NewMortalEra(currentBlockNumber uint64) types.ExtrinsicEra

func ResolvePrivateKey

func ResolvePrivateKey(privateKey, privateKeyFile string) (*sr25519.Keypair, error)

Types

type ChainWriter

type ChainWriter interface {
	BatchCall(ctx context.Context, extrinsic string, calls []interface{}) error
	WriteToParachainAndRateLimit(ctx context.Context, extrinsicName string, payload ...interface{}) error
	WriteToParachainAndWatch(ctx context.Context, extrinsicName string, payload ...interface{}) error
	GetLastFinalizedHeaderState() (state.FinalizedHeader, error)
	GetFinalizedStateByStorageKey(key string) (scale.BeaconState, error)
	GetLastBasicChannelBlockNumber() (uint64, error)
	GetLastBasicChannelNonceByAddress(address common.Address) (uint64, error)
	GetFinalizedHeaderStateByBlockRoot(blockRoot types.H256) (state.FinalizedHeader, error)
	GetLastFinalizedStateIndex() (types.U32, error)
	GetFinalizedBeaconRootByIndex(index uint32) (types.H256, error)
}

type Connection

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

func NewConnection

func NewConnection(endpoint string, kp *signature.KeyringPair) *Connection

func (*Connection) API

func (co *Connection) API() *gsrpc.SubstrateAPI

func (*Connection) Close

func (co *Connection) Close()

func (*Connection) Connect

func (co *Connection) Connect(_ context.Context) error

func (*Connection) GenesisHash

func (co *Connection) GenesisHash() types.Hash

func (*Connection) GetFinalizedHeader

func (co *Connection) GetFinalizedHeader() (*types.Header, error)

func (*Connection) GetLatestBlockNumber

func (co *Connection) GetLatestBlockNumber() (*types.BlockNumber, error)

func (*Connection) Keypair

func (co *Connection) Keypair() *signature.KeyringPair

func (*Connection) Metadata

func (co *Connection) Metadata() *types.Metadata

type EventLog

type EventLog struct {
	Address types.H160
	Topics  []types.H256
	Data    types.Bytes
}

type EventLogJSON

type EventLogJSON struct {
	Address string   `json:"address"`
	Topics  []string `json:"topics"`
	Data    string   `json:"data"`
}

func (*EventLogJSON) RemoveLeadingZeroHashes

func (e *EventLogJSON) RemoveLeadingZeroHashes()

type ExtrinsicPool

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

func NewExtrinsicPool

func NewExtrinsicPool(eg *errgroup.Group, conn *Connection, maxWatchedExtrinsics int64) *ExtrinsicPool

func (*ExtrinsicPool) WaitForSubmitAndWatch

func (ep *ExtrinsicPool) WaitForSubmitAndWatch(
	ctx context.Context,
	ext *types.Extrinsic,
	onFinalized OnFinalized,
) error

type Message

type Message struct {
	EventLog EventLog
	Proof    Proof
}

func (Message) ToJSON

func (m Message) ToJSON() MessageJSON

type MessageJSON

type MessageJSON struct {
	EventLog EventLogJSON `json:"event_log"`
	Proof    ProofJSON    `json:"proof"`
}

func (*MessageJSON) RemoveLeadingZeroHashes

func (m *MessageJSON) RemoveLeadingZeroHashes()

type OnFinalized

type OnFinalized func(types.Hash) error

type ParachainWriter

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

func NewParachainWriter

func NewParachainWriter(
	conn *Connection,
	maxWatchedExtrinsics int64,
	maxBatchCallSize int64,
) *ParachainWriter

func (*ParachainWriter) BatchCall

func (wr *ParachainWriter) BatchCall(ctx context.Context, extrinsic string, calls []interface{}) error

func (*ParachainWriter) GetFinalizedBeaconRootByIndex

func (wr *ParachainWriter) GetFinalizedBeaconRootByIndex(index uint32) (types.H256, error)

func (*ParachainWriter) GetFinalizedHeaderStateByBlockRoot

func (wr *ParachainWriter) GetFinalizedHeaderStateByBlockRoot(blockRoot types.H256) (state.FinalizedHeader, error)

func (*ParachainWriter) GetFinalizedStateByStorageKey

func (wr *ParachainWriter) GetFinalizedStateByStorageKey(key string) (scale.BeaconState, error)

func (*ParachainWriter) GetLastBasicChannelBlockNumber

func (wr *ParachainWriter) GetLastBasicChannelBlockNumber() (uint64, error)

func (*ParachainWriter) GetLastBasicChannelNonceByAddress

func (wr *ParachainWriter) GetLastBasicChannelNonceByAddress(address common.Address) (uint64, error)

func (*ParachainWriter) GetLastBasicChannelNonceByAddresses

func (wr *ParachainWriter) GetLastBasicChannelNonceByAddresses(addresses []common.Address) (map[common.Address]uint64, error)

func (*ParachainWriter) GetLastFinalizedHeaderState

func (wr *ParachainWriter) GetLastFinalizedHeaderState() (state.FinalizedHeader, error)

func (*ParachainWriter) GetLastFinalizedStateIndex

func (wr *ParachainWriter) GetLastFinalizedStateIndex() (types.U32, error)

func (*ParachainWriter) Start

func (wr *ParachainWriter) Start(ctx context.Context, eg *errgroup.Group) error

func (*ParachainWriter) WriteToParachainAndRateLimit

func (wr *ParachainWriter) WriteToParachainAndRateLimit(ctx context.Context, extrinsicName string, payload ...interface{}) error

func (*ParachainWriter) WriteToParachainAndWatch

func (wr *ParachainWriter) WriteToParachainAndWatch(ctx context.Context, extrinsicName string, payload ...interface{}) error

type Proof

type Proof struct {
	ReceiptProof   *ProofData
	ExecutionProof scale.HeaderUpdatePayload
}

type ProofData

type ProofData struct {
	Keys   []types.Bytes
	Values []types.Bytes
}

func NewProofData

func NewProofData() *ProofData

func (*ProofData) Delete

func (p *ProofData) Delete(_ []byte) error

For interface ethdb.KeyValueWriter

func (*ProofData) Put

func (p *ProofData) Put(key []byte, value []byte) error

For interface ethdb.KeyValueWriter

type ProofDataJSON

type ProofDataJSON struct {
	Keys   []string `json:"keys"`
	Values []string `json:"values"`
}

func (*ProofDataJSON) RemoveLeadingZeroHashes

func (p *ProofDataJSON) RemoveLeadingZeroHashes()

type ProofJSON

type ProofJSON struct {
	ReceiptProof   *ProofDataJSON    `json:"receipt_proof"`
	ExecutionProof json.HeaderUpdate `json:"execution_proof"`
}

func (*ProofJSON) RemoveLeadingZeroHashes

func (p *ProofJSON) RemoveLeadingZeroHashes()

Jump to

Keyboard shortcuts

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