github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/contract_call_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  // ContractCallTx contract call tx
    19  // swagger:model ContractCallTx
    20  type ContractCallTx struct {
    21  
    22  	// ABI version
    23  	// Required: true
    24  	AbiVersion *uint16 `json:"abi_version"`
    25  
    26  	// amount
    27  	// Required: true
    28  	Amount utils.BigInt `json:"amount"`
    29  
    30  	// Contract call data
    31  	// Required: true
    32  	CallData *string `json:"call_data"`
    33  
    34  	// Contract caller pub_key
    35  	// Required: true
    36  	CallerID *string `json:"caller_id"`
    37  
    38  	// Contract's pub_key
    39  	// Required: true
    40  	ContractID *string `json:"contract_id"`
    41  
    42  	// fee
    43  	// Required: true
    44  	Fee utils.BigInt `json:"fee"`
    45  
    46  	// gas
    47  	// Required: true
    48  	Gas *uint64 `json:"gas"`
    49  
    50  	// gas price
    51  	// Required: true
    52  	GasPrice utils.BigInt `json:"gas_price"`
    53  
    54  	// Caller's nonce
    55  	Nonce uint64 `json:"nonce,omitempty"`
    56  
    57  	// ttl
    58  	TTL uint64 `json:"ttl,omitempty"`
    59  }
    60  
    61  // Validate validates this contract call tx
    62  func (m *ContractCallTx) Validate(formats strfmt.Registry) error {
    63  	var res []error
    64  
    65  	if err := m.validateAbiVersion(formats); err != nil {
    66  		res = append(res, err)
    67  	}
    68  
    69  	if err := m.validateAmount(formats); err != nil {
    70  		res = append(res, err)
    71  	}
    72  
    73  	if err := m.validateCallData(formats); err != nil {
    74  		res = append(res, err)
    75  	}
    76  
    77  	if err := m.validateCallerID(formats); err != nil {
    78  		res = append(res, err)
    79  	}
    80  
    81  	if err := m.validateContractID(formats); err != nil {
    82  		res = append(res, err)
    83  	}
    84  
    85  	if err := m.validateFee(formats); err != nil {
    86  		res = append(res, err)
    87  	}
    88  
    89  	if err := m.validateGas(formats); err != nil {
    90  		res = append(res, err)
    91  	}
    92  
    93  	if err := m.validateGasPrice(formats); err != nil {
    94  		res = append(res, err)
    95  	}
    96  
    97  	if len(res) > 0 {
    98  		return errors.CompositeValidationError(res...)
    99  	}
   100  	return nil
   101  }
   102  
   103  func (m *ContractCallTx) validateAbiVersion(formats strfmt.Registry) error {
   104  
   105  	if err := validate.Required("abi_version", "body", m.AbiVersion); err != nil {
   106  		return err
   107  	}
   108  
   109  	return nil
   110  }
   111  
   112  func (m *ContractCallTx) validateAmount(formats strfmt.Registry) error {
   113  
   114  	if err := m.Amount.Validate(formats); err != nil {
   115  		if ve, ok := err.(*errors.Validation); ok {
   116  			return ve.ValidateName("amount")
   117  		}
   118  		return err
   119  	}
   120  
   121  	return nil
   122  }
   123  
   124  func (m *ContractCallTx) validateCallData(formats strfmt.Registry) error {
   125  
   126  	if err := validate.Required("call_data", "body", m.CallData); err != nil {
   127  		return err
   128  	}
   129  
   130  	return nil
   131  }
   132  
   133  func (m *ContractCallTx) validateCallerID(formats strfmt.Registry) error {
   134  
   135  	if err := validate.Required("caller_id", "body", m.CallerID); err != nil {
   136  		return err
   137  	}
   138  
   139  	return nil
   140  }
   141  
   142  func (m *ContractCallTx) validateContractID(formats strfmt.Registry) error {
   143  
   144  	if err := validate.Required("contract_id", "body", m.ContractID); err != nil {
   145  		return err
   146  	}
   147  
   148  	return nil
   149  }
   150  
   151  func (m *ContractCallTx) validateFee(formats strfmt.Registry) error {
   152  
   153  	if err := m.Fee.Validate(formats); err != nil {
   154  		if ve, ok := err.(*errors.Validation); ok {
   155  			return ve.ValidateName("fee")
   156  		}
   157  		return err
   158  	}
   159  
   160  	return nil
   161  }
   162  
   163  func (m *ContractCallTx) validateGas(formats strfmt.Registry) error {
   164  
   165  	if err := validate.Required("gas", "body", m.Gas); err != nil {
   166  		return err
   167  	}
   168  
   169  	return nil
   170  }
   171  
   172  func (m *ContractCallTx) validateGasPrice(formats strfmt.Registry) error {
   173  
   174  	if err := m.GasPrice.Validate(formats); err != nil {
   175  		if ve, ok := err.(*errors.Validation); ok {
   176  			return ve.ValidateName("gas_price")
   177  		}
   178  		return err
   179  	}
   180  
   181  	return nil
   182  }
   183  
   184  // MarshalBinary interface implementation
   185  func (m *ContractCallTx) MarshalBinary() ([]byte, error) {
   186  	if m == nil {
   187  		return nil, nil
   188  	}
   189  	return swag.WriteJSON(m)
   190  }
   191  
   192  // UnmarshalBinary interface implementation
   193  func (m *ContractCallTx) UnmarshalBinary(b []byte) error {
   194  	var res ContractCallTx
   195  	if err := swag.ReadJSON(b, &res); err != nil {
   196  		return err
   197  	}
   198  	*m = res
   199  	return nil
   200  }