github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/channel_deposit_tx.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 strfmt "github.com/go-openapi/strfmt" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/swag" 13 "github.com/go-openapi/validate" 14 15 utils "github.com/aeternity/aepp-sdk-go/utils" 16 ) 17 18 // ChannelDepositTx channel deposit tx 19 // swagger:model ChannelDepositTx 20 type ChannelDepositTx struct { 21 22 // amount 23 // Required: true 24 Amount utils.BigInt `json:"amount"` 25 26 // channel id 27 // Required: true 28 ChannelID *string `json:"channel_id"` 29 30 // fee 31 // Required: true 32 Fee utils.BigInt `json:"fee"` 33 34 // from id 35 // Required: true 36 FromID *string `json:"from_id"` 37 38 // nonce 39 // Required: true 40 Nonce *uint64 `json:"nonce"` 41 42 // Channel's next round 43 // Required: true 44 Round *uint64 `json:"round"` 45 46 // Root hash of the channel's internal state tree after the deposit had been applied to it 47 // Required: true 48 StateHash *string `json:"state_hash"` 49 50 // ttl 51 TTL uint64 `json:"ttl,omitempty"` 52 } 53 54 // Validate validates this channel deposit tx 55 func (m *ChannelDepositTx) Validate(formats strfmt.Registry) error { 56 var res []error 57 58 if err := m.validateAmount(formats); err != nil { 59 res = append(res, err) 60 } 61 62 if err := m.validateChannelID(formats); err != nil { 63 res = append(res, err) 64 } 65 66 if err := m.validateFee(formats); err != nil { 67 res = append(res, err) 68 } 69 70 if err := m.validateFromID(formats); err != nil { 71 res = append(res, err) 72 } 73 74 if err := m.validateNonce(formats); err != nil { 75 res = append(res, err) 76 } 77 78 if err := m.validateRound(formats); err != nil { 79 res = append(res, err) 80 } 81 82 if err := m.validateStateHash(formats); err != nil { 83 res = append(res, err) 84 } 85 86 if len(res) > 0 { 87 return errors.CompositeValidationError(res...) 88 } 89 return nil 90 } 91 92 func (m *ChannelDepositTx) validateAmount(formats strfmt.Registry) error { 93 94 if err := m.Amount.Validate(formats); err != nil { 95 if ve, ok := err.(*errors.Validation); ok { 96 return ve.ValidateName("amount") 97 } 98 return err 99 } 100 101 return nil 102 } 103 104 func (m *ChannelDepositTx) validateChannelID(formats strfmt.Registry) error { 105 106 if err := validate.Required("channel_id", "body", m.ChannelID); err != nil { 107 return err 108 } 109 110 return nil 111 } 112 113 func (m *ChannelDepositTx) validateFee(formats strfmt.Registry) error { 114 115 if err := m.Fee.Validate(formats); err != nil { 116 if ve, ok := err.(*errors.Validation); ok { 117 return ve.ValidateName("fee") 118 } 119 return err 120 } 121 122 return nil 123 } 124 125 func (m *ChannelDepositTx) validateFromID(formats strfmt.Registry) error { 126 127 if err := validate.Required("from_id", "body", m.FromID); err != nil { 128 return err 129 } 130 131 return nil 132 } 133 134 func (m *ChannelDepositTx) validateNonce(formats strfmt.Registry) error { 135 136 if err := validate.Required("nonce", "body", m.Nonce); err != nil { 137 return err 138 } 139 140 return nil 141 } 142 143 func (m *ChannelDepositTx) validateRound(formats strfmt.Registry) error { 144 145 if err := validate.Required("round", "body", m.Round); err != nil { 146 return err 147 } 148 149 return nil 150 } 151 152 func (m *ChannelDepositTx) validateStateHash(formats strfmt.Registry) error { 153 154 if err := validate.Required("state_hash", "body", m.StateHash); err != nil { 155 return err 156 } 157 158 return nil 159 } 160 161 // MarshalBinary interface implementation 162 func (m *ChannelDepositTx) MarshalBinary() ([]byte, error) { 163 if m == nil { 164 return nil, nil 165 } 166 return swag.WriteJSON(m) 167 } 168 169 // UnmarshalBinary interface implementation 170 func (m *ChannelDepositTx) UnmarshalBinary(b []byte) error { 171 var res ChannelDepositTx 172 if err := swag.ReadJSON(b, &res); err != nil { 173 return err 174 } 175 *m = res 176 return nil 177 }