messages

package
v0.0.0-...-9e55092 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MuSigStartV1MessageName            = "musig_initialize/v1.1"
	MuSigTerminateV1MessageName        = "musig_terminate/v1.1"
	MuSigCommitmentV1MessageName       = "musig_commitment/v1.1"
	MuSigPartialSignatureV1MessageName = "musig_partial_signature/v1.1"
	MuSigSignatureV1MessageName        = "musig_signature/v1.1"
)
View Source
const DataPointV1MessageName = "data_point/v1"
View Source
const GreetV1MessageName = "greet/v1"
View Source
const (
	MuSigTickV1DataType = "tick/v1"
)
View Source
const PriceV0MessageName = "price/v0"

Deprecated: use DataPointV1MessageName instead.

View Source
const PriceV1MessageName = "price/v1"

Deprecated: use DataPointV1MessageName instead.

Variables

View Source
var (
	ErrPriceMessageTooLarge       = errors.New("price message too large")
	ErrUnknownPriceMessageVersion = errors.New("unknown message version")
	ErrInvalidPriceMessage        = errors.New("invalid price message")
	ErrMessageTooLarge            = errors.New("message too large")
)
View Source
var AllMessagesMap = MessageMap{
	PriceV0MessageName:                 (*Price)(nil),
	PriceV1MessageName:                 (*Price)(nil),
	DataPointV1MessageName:             (*DataPoint)(nil),
	GreetV1MessageName:                 (*Greet)(nil),
	MuSigStartV1MessageName:            (*MuSigInitialize)(nil),
	MuSigTerminateV1MessageName:        (*MuSigTerminate)(nil),
	MuSigCommitmentV1MessageName:       (*MuSigCommitment)(nil),
	MuSigPartialSignatureV1MessageName: (*MuSigPartialSignature)(nil),
	MuSigSignatureV1MessageName:        (*MuSigSignature)(nil),
}

Functions

func DataPointMessageLogFields

func DataPointMessageLogFields(d DataPoint) log.Fields

Types

type DataPoint

type DataPoint struct {
	transport.AppInfo

	// Model is the name of the data model.
	Model string

	// Value is a binary representation of the data point.
	Point datapoint.Point

	// Signature is the feed signature of the data point.
	ECDSASignature types.Signature
}

func (*DataPoint) GobDecode

func (d *DataPoint) GobDecode(b []byte) error

func (*DataPoint) GobEncode

func (d *DataPoint) GobEncode() ([]byte, error)

func (DataPoint) MarshalJSON

func (d DataPoint) MarshalJSON() ([]byte, error)

func (*DataPoint) Marshall

func (d *DataPoint) Marshall() ([]byte, error)

func (DataPoint) MarshallBinary

func (d DataPoint) MarshallBinary() ([]byte, error)

MarshallBinary implements the transport.Message interface.

func (*DataPoint) Unmarshall

func (d *DataPoint) Unmarshall(b []byte) error

func (*DataPoint) UnmarshallBinary

func (d *DataPoint) UnmarshallBinary(data []byte) error

UnmarshallBinary implements the transport.Message interface.

type Greet

type Greet struct {
	transport.AppInfo

	Signature  types.Signature
	PublicKeyX *big.Int
	PublicKeyY *big.Int
	WebURL     string
}

func (Greet) MarshalJSON

func (e Greet) MarshalJSON() ([]byte, error)

func (Greet) MarshallBinary

func (e Greet) MarshallBinary() ([]byte, error)

MarshallBinary implements the transport.Message interface.

func (*Greet) UnmarshallBinary

func (e *Greet) UnmarshallBinary(data []byte) (err error)

UnmarshallBinary implements the transport.Message interface.

type MessageMap

type MessageMap map[string]transport.Message

func (MessageMap) Keys

func (mm MessageMap) Keys() []string

Keys returns a sorted list of keys.

func (MessageMap) SelectByTopic

func (mm MessageMap) SelectByTopic(topics ...string) (MessageMap, error)

SelectByTopic returns a new MessageMap with messages selected by topic. Empty topic list will yield an empty map.

type MuSigCommitment

type MuSigCommitment struct {
	transport.AppInfo

	// Unique SessionID of the MuSig session.
	SessionID types.Hash

	CommitmentKeyX *big.Int
	CommitmentKeyY *big.Int

	PublicKeyX *big.Int
	PublicKeyY *big.Int
}

func (MuSigCommitment) MarshalJSON

func (m MuSigCommitment) MarshalJSON() ([]byte, error)

func (MuSigCommitment) MarshallBinary

func (m MuSigCommitment) MarshallBinary() ([]byte, error)

MarshallBinary implements the transport.Message interface.

func (*MuSigCommitment) UnmarshallBinary

func (m *MuSigCommitment) UnmarshallBinary(bytes []byte) error

UnmarshallBinary implements the transport.Message interface.

type MuSigInitialize

type MuSigInitialize struct {
	transport.AppInfo

	*MuSigMessage

	// SessionID is the unique ID of the MuSig session.
	SessionID types.Hash

	// CreatedAt is the time when the session was started.
	StartedAt time.Time
}

func (MuSigInitialize) MarshalJSON

func (m MuSigInitialize) MarshalJSON() ([]byte, error)

func (MuSigInitialize) MarshallBinary

func (m MuSigInitialize) MarshallBinary() ([]byte, error)

MarshallBinary implements the transport.Message interface.

func (*MuSigInitialize) UnmarshallBinary

func (m *MuSigInitialize) UnmarshallBinary(bytes []byte) (err error)

UnmarshallBinary implements the transport.Message interface.

type MuSigMessage

type MuSigMessage struct {
	// Type of the message.
	MsgType string

	// Message body that will be signed.
	MsgBody types.Hash

	// Meta is a message-specific metadata.
	MsgMeta MuSigMeta

	// Signers is a list of signers that will participate in the MuSig session.
	Signers []types.Address
}

type MuSigMeta

type MuSigMeta struct {
	// Meta must be one of the following types:
	// * MuSigMetaTickV1
	Meta muSigMeta
}

func (*MuSigMeta) TickV1

func (m *MuSigMeta) TickV1() *MuSigMetaTickV1

type MuSigMetaFeedTick

type MuSigMetaFeedTick struct {
	Val *bn.DecFixedPointNumber // Price.
	Age time.Time               // Price timestamp.
	VRS types.Signature         // Signature.
}

func (MuSigMetaFeedTick) MarshalJSON

func (m MuSigMetaFeedTick) MarshalJSON() ([]byte, error)

type MuSigMetaTickV1

type MuSigMetaTickV1 struct {
	Wat       string                  // Asset name.
	Val       *bn.DecFixedPointNumber // Median price.
	Age       time.Time               // Oldest tick timestamp.
	ECDSAData *types.Signature        // Optional ECDSA signature data required for the optimistic poke.
	FeedTicks []MuSigMetaFeedTick     // All ticks used to calculate the median price.
}

func (MuSigMetaTickV1) MarshalJSON

func (m MuSigMetaTickV1) MarshalJSON() ([]byte, error)

type MuSigPartialSignature

type MuSigPartialSignature struct {
	transport.AppInfo

	// Unique SessionID of the MuSig session.
	SessionID types.Hash

	// Partial signature of the MuSig session.
	PartialSignature *big.Int
}

func (MuSigPartialSignature) MarshalJSON

func (m MuSigPartialSignature) MarshalJSON() ([]byte, error)

func (MuSigPartialSignature) MarshallBinary

func (m MuSigPartialSignature) MarshallBinary() ([]byte, error)

MarshallBinary implements the transport.Message interface.

func (*MuSigPartialSignature) UnmarshallBinary

func (m *MuSigPartialSignature) UnmarshallBinary(bytes []byte) error

UnmarshallBinary implements the transport.Message interface.

type MuSigSignature

type MuSigSignature struct {
	transport.AppInfo

	*MuSigMessage

	// Unique SessionID of the MuSig session.
	SessionID types.Hash `json:"sessionID"`

	// ComputedAt is the time at which the signature was computed.
	ComputedAt time.Time `json:"computedAt"`

	// Commitment of the MuSig session.
	Commitment types.Address `json:"commitment"`

	// SchnorrSignature is a MuSig Schnorr signature calculated from the partial
	// signatures of all participants.
	SchnorrSignature *big.Int `json:"schnorrSignature"`
}

func (MuSigSignature) MarshalJSON

func (m MuSigSignature) MarshalJSON() ([]byte, error)

func (MuSigSignature) MarshallBinary

func (m MuSigSignature) MarshallBinary() ([]byte, error)

MarshallBinary implements the transport.Message interface.

func (*MuSigSignature) UnmarshallBinary

func (m *MuSigSignature) UnmarshallBinary(bytes []byte) error

UnmarshallBinary implements the transport.Message interface.

type MuSigTerminate

type MuSigTerminate struct {
	transport.AppInfo

	// Unique SessionID of the MuSig session.
	SessionID types.Hash

	// Reason for terminating the MuSig session.
	Reason string
}

func (MuSigTerminate) MarshalJSON

func (m MuSigTerminate) MarshalJSON() ([]byte, error)

func (MuSigTerminate) MarshallBinary

func (m MuSigTerminate) MarshallBinary() ([]byte, error)

MarshallBinary implements the transport.Message interface.

func (*MuSigTerminate) UnmarshallBinary

func (m *MuSigTerminate) UnmarshallBinary(bytes []byte) error

UnmarshallBinary implements the transport.Message interface.

type Price

type Price struct {
	Price   *median.Price   `json:"price"`
	Trace   json.RawMessage `json:"trace"`
	Version string          `json:"version,omitempty"` // TODO: this should move to some meta field e.g. `feedVersion`
	// contains filtered or unexported fields
}

Price is a message that contains a price and a trace of the price. Deprecated: move to datapoint/v1 message.

func (*Price) AsV0

func (p *Price) AsV0() *Price

func (*Price) AsV1

func (p *Price) AsV1() *Price

func (*Price) Marshall

func (p *Price) Marshall() ([]byte, error)

func (*Price) MarshallBinary

func (p *Price) MarshallBinary() ([]byte, error)

MarshallBinary implements the transport.Message interface.

func (*Price) Unmarshall

func (p *Price) Unmarshall(b []byte) error

func (*Price) UnmarshallBinary

func (p *Price) UnmarshallBinary(data []byte) error

UnmarshallBinary implements the transport.Message interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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