localtxsubmission

package
v0.121.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package localtxsubmission implements the Ouroboros local-tx-submission protocol

Index

Constants

View Source
const (
	ProtocolName        = "local-tx-submission"
	ProtocolId   uint16 = 6
)

Protocol identifiers

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 CallbackContext added in v0.78.0

type CallbackContext struct {
	ConnectionId connection.ConnectionId
	Client       *Client
	Server       *Server
}

Callback context

type Client

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

Client implements the LocalTxSubmission client

func NewClient

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

NewClient returns a new LocalTxSubmission client object

func (*Client) Start added in v0.73.3

func (c *Client) Start()

func (*Client) Stop

func (c *Client) Stop() error

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

func (*Client) SubmitTx

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

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

type Config

type Config struct {
	SubmitTxFunc SubmitTxFunc
	Timeout      time.Duration
}

Config is used to configure the LocalTxSubmission protocol instance

func NewConfig

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

type LocalTxSubmissionOptionFunc func(*Config)

LocalTxSubmissionOptionFunc represents a function used to modify the LocalTxSubmission protocol config

func WithSubmitTxFunc

func WithSubmitTxFunc(submitTxFunc SubmitTxFunc) LocalTxSubmissionOptionFunc

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

func WithTimeout

func WithTimeout(timeout time.Duration) LocalTxSubmissionOptionFunc

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

type MsgAcceptTx

type MsgAcceptTx struct {
	protocol.MessageBase
}

func NewMsgAcceptTx

func NewMsgAcceptTx() *MsgAcceptTx

type MsgDone

type MsgDone struct {
	protocol.MessageBase
}

func NewMsgDone

func NewMsgDone() *MsgDone

type MsgRejectTx

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

func NewMsgRejectTx(reasonCbor []byte) *MsgRejectTx

type MsgSubmitTx

type MsgSubmitTx struct {
	protocol.MessageBase
	Transaction MsgSubmitTxTransaction
}

func NewMsgSubmitTx

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

type MsgSubmitTxTransaction

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

type Server

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

Server implements the LocalTxSubmission server

func NewServer

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

NewServer returns a new Server object

type SubmitTxFunc

type SubmitTxFunc func(CallbackContext, MsgSubmitTxTransaction) error

Callback function types

type TransactionRejectedError

type TransactionRejectedError struct {
	ReasonCbor []byte
	Reason     error
}

TransactionRejectedError represents an explicit transaction rejection

func (TransactionRejectedError) Error

func (e TransactionRejectedError) Error() string

Jump to

Keyboard shortcuts

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

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy