github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/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 14 utils "github.com/aeternity/aepp-sdk-go/utils" 15 ) 16 17 // ChannelDepositTx channel deposit tx 18 // swagger:model ChannelDepositTx 19 type ChannelDepositTx struct { 20 21 // amount 22 // Required: true 23 Amount utils.BigInt `json:"amount"` 24 25 // channel id 26 // Required: true 27 ChannelID EncodedPubkey `json:"channel_id"` 28 29 // fee 30 // Required: true 31 Fee utils.BigInt `json:"fee"` 32 33 // from id 34 // Required: true 35 FromID EncodedPubkey `json:"from_id"` 36 37 // nonce 38 // Required: true 39 Nonce Uint64 `json:"nonce"` 40 41 // Channel's next round 42 // Required: true 43 Round Uint64 `json:"round"` 44 45 // Root hash of the channel's internal state tree after the deposit had been applied to it 46 // Required: true 47 StateHash EncodedHash `json:"state_hash"` 48 49 // ttl 50 TTL Uint64 `json:"ttl,omitempty"` 51 } 52 53 // Validate validates this channel deposit tx 54 func (m *ChannelDepositTx) Validate(formats strfmt.Registry) error { 55 var res []error 56 57 if err := m.validateAmount(formats); err != nil { 58 res = append(res, err) 59 } 60 61 if err := m.validateChannelID(formats); err != nil { 62 res = append(res, err) 63 } 64 65 if err := m.validateFee(formats); err != nil { 66 res = append(res, err) 67 } 68 69 if err := m.validateFromID(formats); err != nil { 70 res = append(res, err) 71 } 72 73 if err := m.validateNonce(formats); err != nil { 74 res = append(res, err) 75 } 76 77 if err := m.validateRound(formats); err != nil { 78 res = append(res, err) 79 } 80 81 if err := m.validateStateHash(formats); err != nil { 82 res = append(res, err) 83 } 84 85 if err := m.validateTTL(formats); err != nil { 86 res = append(res, err) 87 } 88 89 if len(res) > 0 { 90 return errors.CompositeValidationError(res...) 91 } 92 return nil 93 } 94 95 func (m *ChannelDepositTx) validateAmount(formats strfmt.Registry) error { 96 97 if err := m.Amount.Validate(formats); err != nil { 98 if ve, ok := err.(*errors.Validation); ok { 99 return ve.ValidateName("amount") 100 } 101 return err 102 } 103 104 return nil 105 } 106 107 func (m *ChannelDepositTx) validateChannelID(formats strfmt.Registry) error { 108 109 if err := m.ChannelID.Validate(formats); err != nil { 110 if ve, ok := err.(*errors.Validation); ok { 111 return ve.ValidateName("channel_id") 112 } 113 return err 114 } 115 116 return nil 117 } 118 119 func (m *ChannelDepositTx) validateFee(formats strfmt.Registry) error { 120 121 if err := m.Fee.Validate(formats); err != nil { 122 if ve, ok := err.(*errors.Validation); ok { 123 return ve.ValidateName("fee") 124 } 125 return err 126 } 127 128 return nil 129 } 130 131 func (m *ChannelDepositTx) validateFromID(formats strfmt.Registry) error { 132 133 if err := m.FromID.Validate(formats); err != nil { 134 if ve, ok := err.(*errors.Validation); ok { 135 return ve.ValidateName("from_id") 136 } 137 return err 138 } 139 140 return nil 141 } 142 143 func (m *ChannelDepositTx) validateNonce(formats strfmt.Registry) error { 144 145 if err := m.Nonce.Validate(formats); err != nil { 146 if ve, ok := err.(*errors.Validation); ok { 147 return ve.ValidateName("nonce") 148 } 149 return err 150 } 151 152 return nil 153 } 154 155 func (m *ChannelDepositTx) validateRound(formats strfmt.Registry) error { 156 157 if err := m.Round.Validate(formats); err != nil { 158 if ve, ok := err.(*errors.Validation); ok { 159 return ve.ValidateName("round") 160 } 161 return err 162 } 163 164 return nil 165 } 166 167 func (m *ChannelDepositTx) validateStateHash(formats strfmt.Registry) error { 168 169 if err := m.StateHash.Validate(formats); err != nil { 170 if ve, ok := err.(*errors.Validation); ok { 171 return ve.ValidateName("state_hash") 172 } 173 return err 174 } 175 176 return nil 177 } 178 179 func (m *ChannelDepositTx) validateTTL(formats strfmt.Registry) error { 180 181 if swag.IsZero(m.TTL) { // not required 182 return nil 183 } 184 185 if err := m.TTL.Validate(formats); err != nil { 186 if ve, ok := err.(*errors.Validation); ok { 187 return ve.ValidateName("ttl") 188 } 189 return err 190 } 191 192 return nil 193 } 194 195 // MarshalBinary interface implementation 196 func (m *ChannelDepositTx) MarshalBinary() ([]byte, error) { 197 if m == nil { 198 return nil, nil 199 } 200 return swag.WriteJSON(m) 201 } 202 203 // UnmarshalBinary interface implementation 204 func (m *ChannelDepositTx) UnmarshalBinary(b []byte) error { 205 var res ChannelDepositTx 206 if err := swag.ReadJSON(b, &res); err != nil { 207 return err 208 } 209 *m = res 210 return nil 211 }