localtxsubmission

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package localtxsubmission implements the Ouroboros local-tx-submission protocol

Index

Constants

View Source
const (
	MessageTypeSubmitTx = 0
	MessageTypeAcceptTx = 1
	MessageTypeRejectTx = 2
	MessageTypeDone     = 3
)

Message types

Variables

View Source
var StateMap = protocol.StateMap{
	// contains filtered or unexported fields
}

LocalTxSubmission protocol state machine

Functions

func NewMsgFromCbor

func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error)

NewMsgFromCbor parses a LocalTxSubmission message from CBOR

Types

type Client added in v0.19.0

type Client struct {
	*protocol.Protocol
	// contains filtered or unexported fields
}

Client implements the LocalTxSubmission client

func NewClient added in v0.19.0

func NewClient(protoOptions protocol.ProtocolOptions, cfg *Config) *Client

NewClient returns a new LocalTxSubmission client object

func (*Client) Stop added in v0.20.0

func (c *Client) Stop() error

Stop transitions the protocol to the Done state. No more operations will be possible

func (*Client) SubmitTx added in v0.19.0

func (c *Client) SubmitTx(eraId uint16, tx []byte) error

SubmitTx submits a transaction using the specified transaction era ID and TX payload

type Config added in v0.18.0

type Config struct {
	SubmitTxFunc SubmitTxFunc
	Timeout      time.Duration
}

Config is used to configure the LocalTxSubmission protocol instance

func NewConfig added in v0.25.0

func NewConfig(options ...LocalTxSubmissionOptionFunc) Config

NewConfig returns a new LocalTxSubmission config object with the provided options

type LocalTxSubmission

type LocalTxSubmission struct {
	Client *Client
	Server *Server
}

LocalTxSubmission is a wrapper object that holds the client and server instances

func New

func New(protoOptions protocol.ProtocolOptions, cfg *Config) *LocalTxSubmission

New returns a new LocalTxSubmission object

type LocalTxSubmissionOptionFunc added in v0.25.0

type LocalTxSubmissionOptionFunc func(*Config)

LocalTxSubmissionOptionFunc represents a function used to modify the LocalTxSubmission protocol config

func WithSubmitTxFunc added in v0.25.0

func WithSubmitTxFunc(submitTxFunc SubmitTxFunc) LocalTxSubmissionOptionFunc

WithSubmitTxFunc specifies the callback function when a TX is submitted when acting as a server

func WithTimeout added in v0.25.0

func WithTimeout(timeout time.Duration) LocalTxSubmissionOptionFunc

WithTimeout specifies the timeout for a TX submit operation when acting as a client

type MsgAcceptTx added in v0.10.0

type MsgAcceptTx struct {
	protocol.MessageBase
}

func NewMsgAcceptTx added in v0.12.1

func NewMsgAcceptTx() *MsgAcceptTx

type MsgDone added in v0.10.0

type MsgDone struct {
	protocol.MessageBase
}

func NewMsgDone added in v0.10.0

func NewMsgDone() *MsgDone

type MsgRejectTx added in v0.10.0

type MsgRejectTx struct {
	protocol.MessageBase
	// We use RawMessage here because the failure reason can be numerous different
	// structures, and we'll need to do further processing
	Reason cbor.RawMessage
}

func NewMsgRejectTx added in v0.12.1

func NewMsgRejectTx(reasonCbor []byte) *MsgRejectTx

type MsgSubmitTx added in v0.10.0

type MsgSubmitTx struct {
	protocol.MessageBase
	Transaction MsgSubmitTxTransaction
}

func NewMsgSubmitTx added in v0.10.0

func NewMsgSubmitTx(eraId uint16, tx []byte) *MsgSubmitTx

type MsgSubmitTxTransaction added in v0.10.0

type MsgSubmitTxTransaction struct {
	EraId uint16
	Raw   cbor.Tag
	// contains filtered or unexported fields
}

type Server added in v0.19.0

type Server struct {
	*protocol.Protocol
	// contains filtered or unexported fields
}

Server implements the LocalTxSubmission server

func NewServer added in v0.19.0

func NewServer(protoOptions protocol.ProtocolOptions, cfg *Config) *Server

NewServer returns a new Server object

type SubmitTxFunc

type SubmitTxFunc func(interface{}) error

Callback function types

type TransactionRejectedError added in v0.20.0

type TransactionRejectedError struct {
	ReasonCbor []byte
	Reason     error
}

TransactionRejectedError represents an explicit transaction rejection

func (TransactionRejectedError) Error added in v0.20.0

func (e TransactionRejectedError) Error() string

Jump to

Keyboard shortcuts

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