mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 20:24:21 +01:00
* [proto] add APIs to send and receive musig2 signing data * [common] add serialization functions for nonces and signatures * [application] implements tree signing * fix: remove old debug logs * [proto] cleaning * [common] fix musig2.go * [application] fixes and logs * [interface] fix: stop forwarding 2 times the events * [client] add musig2 support + sign the tree when joining a round * [interface] add new APIs into permissions.go * [application][proto] rework PingResponse (return all events type) * [common] split SetKeys into 2 distinct methods * [client] fixes according to musig2.go changes * [sdk] support tree signing + new PingResponse * [sdk] fixes * [application] revert event channel type * [application] use domain.RoundEvent as lastEvent type * [application] remove IsCovenantLess * comments * [application] revert roundAborted changes * [interface] remove bitcointree dependencie
314 lines
7.7 KiB
Go
314 lines
7.7 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package models
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// V1PingResponse v1 ping response
|
|
//
|
|
// swagger:model v1PingResponse
|
|
type V1PingResponse struct {
|
|
|
|
// round failed
|
|
RoundFailed *V1RoundFailed `json:"roundFailed,omitempty"`
|
|
|
|
// round finalization
|
|
RoundFinalization *V1RoundFinalizationEvent `json:"roundFinalization,omitempty"`
|
|
|
|
// round finalized
|
|
RoundFinalized *V1RoundFinalizedEvent `json:"roundFinalized,omitempty"`
|
|
|
|
// round signing
|
|
RoundSigning *V1RoundSigningEvent `json:"roundSigning,omitempty"`
|
|
|
|
// round signing nonces generated
|
|
RoundSigningNoncesGenerated *V1RoundSigningNoncesGeneratedEvent `json:"roundSigningNoncesGenerated,omitempty"`
|
|
}
|
|
|
|
// Validate validates this v1 ping response
|
|
func (m *V1PingResponse) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateRoundFailed(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRoundFinalization(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRoundFinalized(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRoundSigning(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.validateRoundSigningNoncesGenerated(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) validateRoundFailed(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.RoundFailed) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.RoundFailed != nil {
|
|
if err := m.RoundFailed.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundFailed")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundFailed")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) validateRoundFinalization(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.RoundFinalization) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.RoundFinalization != nil {
|
|
if err := m.RoundFinalization.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundFinalization")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundFinalization")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) validateRoundFinalized(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.RoundFinalized) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.RoundFinalized != nil {
|
|
if err := m.RoundFinalized.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundFinalized")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundFinalized")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) validateRoundSigning(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.RoundSigning) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.RoundSigning != nil {
|
|
if err := m.RoundSigning.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundSigning")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundSigning")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) validateRoundSigningNoncesGenerated(formats strfmt.Registry) error {
|
|
if swag.IsZero(m.RoundSigningNoncesGenerated) { // not required
|
|
return nil
|
|
}
|
|
|
|
if m.RoundSigningNoncesGenerated != nil {
|
|
if err := m.RoundSigningNoncesGenerated.Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundSigningNoncesGenerated")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundSigningNoncesGenerated")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this v1 ping response based on the context it is used
|
|
func (m *V1PingResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.contextValidateRoundFailed(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateRoundFinalization(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateRoundFinalized(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateRoundSigning(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if err := m.contextValidateRoundSigningNoncesGenerated(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) contextValidateRoundFailed(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.RoundFailed != nil {
|
|
|
|
if swag.IsZero(m.RoundFailed) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.RoundFailed.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundFailed")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundFailed")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) contextValidateRoundFinalization(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.RoundFinalization != nil {
|
|
|
|
if swag.IsZero(m.RoundFinalization) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.RoundFinalization.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundFinalization")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundFinalization")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) contextValidateRoundFinalized(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.RoundFinalized != nil {
|
|
|
|
if swag.IsZero(m.RoundFinalized) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.RoundFinalized.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundFinalized")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundFinalized")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) contextValidateRoundSigning(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.RoundSigning != nil {
|
|
|
|
if swag.IsZero(m.RoundSigning) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.RoundSigning.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundSigning")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundSigning")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (m *V1PingResponse) contextValidateRoundSigningNoncesGenerated(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
if m.RoundSigningNoncesGenerated != nil {
|
|
|
|
if swag.IsZero(m.RoundSigningNoncesGenerated) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := m.RoundSigningNoncesGenerated.ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("roundSigningNoncesGenerated")
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("roundSigningNoncesGenerated")
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *V1PingResponse) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *V1PingResponse) UnmarshalBinary(b []byte) error {
|
|
var res V1PingResponse
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|