messages

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: AGPL-3.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MuSigStartV1MessageName            = "musig_initialize/v1"
	MuSigTerminateV1MessageName        = "musig_terminate/v1"
	MuSigCommitmentV1MessageName       = "musig_commitment/v1"
	MuSigPartialSignatureV1MessageName = "musig_partial_signature/v1"
	MuSigSignatureV1MessageName        = "musig_signature/v1"
)
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 added in v0.13.5

func DataPointMessageLogFields(d DataPoint) log.Fields

Types

type DataPoint added in v0.11.0

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

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

func (*DataPoint) GobEncode added in v0.14.1

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

func (DataPoint) MarshalJSON added in v0.15.3

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

func (*DataPoint) Marshall added in v0.11.4

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

func (DataPoint) MarshallBinary added in v0.11.0

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

MarshallBinary implements the transport.Message interface.

func (*DataPoint) Unmarshall added in v0.11.4

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

func (*DataPoint) UnmarshallBinary added in v0.11.0

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

UnmarshallBinary implements the transport.Message interface.

type Greet added in v0.11.5

type Greet struct {
	transport.AppInfo

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

func (Greet) MarshalJSON added in v0.15.3

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

func (Greet) MarshallBinary added in v0.11.5

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

MarshallBinary implements the transport.Message interface.

func (*Greet) UnmarshallBinary added in v0.11.5

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

UnmarshallBinary implements the transport.Message interface.

type MessageMap added in v0.15.2

type MessageMap map[string]transport.Message

func (MessageMap) Keys added in v0.15.2

func (mm MessageMap) Keys() []string

Keys returns a sorted list of keys.

func (MessageMap) SelectByTopic added in v0.15.2

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

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

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

func (MuSigCommitment) MarshallBinary added in v0.11.0

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

MarshallBinary implements the transport.Message interface.

func (*MuSigCommitment) UnmarshallBinary added in v0.11.0

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

UnmarshallBinary implements the transport.Message interface.

type MuSigInitialize added in v0.11.0

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

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

func (MuSigInitialize) MarshallBinary added in v0.11.0

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

MarshallBinary implements the transport.Message interface.

func (*MuSigInitialize) UnmarshallBinary added in v0.11.0

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

UnmarshallBinary implements the transport.Message interface.

type MuSigMessage added in v0.13.10

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

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

func (*MuSigMeta) TickV1 added in v0.13.10

func (m *MuSigMeta) TickV1() *MuSigMetaTickV1

type MuSigMetaFeedTick added in v0.13.10

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

func (MuSigMetaFeedTick) MarshalJSON added in v0.15.3

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

type MuSigMetaOptimistic added in v0.13.10

type MuSigMetaOptimistic struct {
	ECDSASignature types.Signature `json:"ecdsa_signature"`
	SignerIndexes  []uint8         `json:"signer_indexes"`
}

func (MuSigMetaOptimistic) MarshalJSON added in v0.15.3

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

type MuSigMetaTickV1 added in v0.13.10

type MuSigMetaTickV1 struct {
	Wat        string                  // Asset name.
	Val        *bn.DecFixedPointNumber // Median price.
	Age        time.Time               // Oldest tick timestamp.
	Optimistic []MuSigMetaOptimistic   // Optimistic signatures.
	FeedTicks  []MuSigMetaFeedTick     // All ticks used to calculate the median price.
}

func (MuSigMetaTickV1) MarshalJSON added in v0.15.3

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

type MuSigPartialSignature added in v0.11.0

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

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

func (MuSigPartialSignature) MarshallBinary added in v0.11.0

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

MarshallBinary implements the transport.Message interface.

func (*MuSigPartialSignature) UnmarshallBinary added in v0.11.0

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

UnmarshallBinary implements the transport.Message interface.

type MuSigSignature added in v0.11.0

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

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

func (MuSigSignature) MarshallBinary added in v0.11.0

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

MarshallBinary implements the transport.Message interface.

func (*MuSigSignature) UnmarshallBinary added in v0.11.0

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

UnmarshallBinary implements the transport.Message interface.

type MuSigTerminate added in v0.11.0

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

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

func (MuSigTerminate) MarshallBinary added in v0.11.0

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

MarshallBinary implements the transport.Message interface.

func (*MuSigTerminate) UnmarshallBinary added in v0.11.0

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

func (p *Price) AsV0() *Price

func (*Price) AsV1 added in v0.6.0

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