diff --git a/generated/client/external/external_client.go b/generated/client/external/external_client.go index 0052a0bd..b19ded4b 100644 --- a/generated/client/external/external_client.go +++ b/generated/client/external/external_client.go @@ -52,6 +52,62 @@ func (a *Client) GetAccountByPubkey(params *GetAccountByPubkeyParams) (*GetAccou } +/* +GetAccountByPubkeyAndHash Get an account by public key after the block indicated by hash +*/ +func (a *Client) GetAccountByPubkeyAndHash(params *GetAccountByPubkeyAndHashParams) (*GetAccountByPubkeyAndHashOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAccountByPubkeyAndHashParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAccountByPubkeyAndHash", + Method: "GET", + PathPattern: "/accounts/{pubkey}/hash/{hash}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAccountByPubkeyAndHashReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAccountByPubkeyAndHashOK), nil + +} + +/* +GetAccountByPubkeyAndHeight Get an account by public key after the opening key block of the generation at height +*/ +func (a *Client) GetAccountByPubkeyAndHeight(params *GetAccountByPubkeyAndHeightParams) (*GetAccountByPubkeyAndHeightOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAccountByPubkeyAndHeightParams() + } + + result, err := a.transport.Submit(&runtime.ClientOperation{ + ID: "GetAccountByPubkeyAndHeight", + Method: "GET", + PathPattern: "/accounts/{pubkey}/height/{height}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{""}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAccountByPubkeyAndHeightReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + }) + if err != nil { + return nil, err + } + return result.(*GetAccountByPubkeyAndHeightOK), nil + +} + /* GetChannelByPubkey Get channel by public key */ diff --git a/generated/client/external/get_account_by_pubkey_and_hash_parameters.go b/generated/client/external/get_account_by_pubkey_and_hash_parameters.go new file mode 100644 index 00000000..5dbd4847 --- /dev/null +++ b/generated/client/external/get_account_by_pubkey_and_hash_parameters.go @@ -0,0 +1,157 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package external + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAccountByPubkeyAndHashParams creates a new GetAccountByPubkeyAndHashParams object +// with the default values initialized. +func NewGetAccountByPubkeyAndHashParams() *GetAccountByPubkeyAndHashParams { + var () + return &GetAccountByPubkeyAndHashParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAccountByPubkeyAndHashParamsWithTimeout creates a new GetAccountByPubkeyAndHashParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAccountByPubkeyAndHashParamsWithTimeout(timeout time.Duration) *GetAccountByPubkeyAndHashParams { + var () + return &GetAccountByPubkeyAndHashParams{ + + timeout: timeout, + } +} + +// NewGetAccountByPubkeyAndHashParamsWithContext creates a new GetAccountByPubkeyAndHashParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAccountByPubkeyAndHashParamsWithContext(ctx context.Context) *GetAccountByPubkeyAndHashParams { + var () + return &GetAccountByPubkeyAndHashParams{ + + Context: ctx, + } +} + +// NewGetAccountByPubkeyAndHashParamsWithHTTPClient creates a new GetAccountByPubkeyAndHashParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAccountByPubkeyAndHashParamsWithHTTPClient(client *http.Client) *GetAccountByPubkeyAndHashParams { + var () + return &GetAccountByPubkeyAndHashParams{ + HTTPClient: client, + } +} + +/*GetAccountByPubkeyAndHashParams contains all the parameters to send to the API endpoint +for the get account by pubkey and hash operation typically these are written to a http.Request +*/ +type GetAccountByPubkeyAndHashParams struct { + + /*Hash + The hash of the block + + */ + Hash string + /*Pubkey + The public key of the account + + */ + Pubkey string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) WithTimeout(timeout time.Duration) *GetAccountByPubkeyAndHashParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) WithContext(ctx context.Context) *GetAccountByPubkeyAndHashParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) WithHTTPClient(client *http.Client) *GetAccountByPubkeyAndHashParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHash adds the hash to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) WithHash(hash string) *GetAccountByPubkeyAndHashParams { + o.SetHash(hash) + return o +} + +// SetHash adds the hash to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) SetHash(hash string) { + o.Hash = hash +} + +// WithPubkey adds the pubkey to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) WithPubkey(pubkey string) *GetAccountByPubkeyAndHashParams { + o.SetPubkey(pubkey) + return o +} + +// SetPubkey adds the pubkey to the get account by pubkey and hash params +func (o *GetAccountByPubkeyAndHashParams) SetPubkey(pubkey string) { + o.Pubkey = pubkey +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAccountByPubkeyAndHashParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param hash + if err := r.SetPathParam("hash", o.Hash); err != nil { + return err + } + + // path param pubkey + if err := r.SetPathParam("pubkey", o.Pubkey); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/generated/client/external/get_account_by_pubkey_and_hash_responses.go b/generated/client/external/get_account_by_pubkey_and_hash_responses.go new file mode 100644 index 00000000..99c5c7db --- /dev/null +++ b/generated/client/external/get_account_by_pubkey_and_hash_responses.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package external + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/aeternity/aepp-sdk-go/generated/models" +) + +// GetAccountByPubkeyAndHashReader is a Reader for the GetAccountByPubkeyAndHash structure. +type GetAccountByPubkeyAndHashReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAccountByPubkeyAndHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAccountByPubkeyAndHashOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewGetAccountByPubkeyAndHashBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 404: + result := NewGetAccountByPubkeyAndHashNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAccountByPubkeyAndHashOK creates a GetAccountByPubkeyAndHashOK with default headers values +func NewGetAccountByPubkeyAndHashOK() *GetAccountByPubkeyAndHashOK { + return &GetAccountByPubkeyAndHashOK{} +} + +/*GetAccountByPubkeyAndHashOK handles this case with default header values. + +Successful operation +*/ +type GetAccountByPubkeyAndHashOK struct { + Payload *models.Account +} + +func (o *GetAccountByPubkeyAndHashOK) Error() string { + return fmt.Sprintf("[GET /accounts/{pubkey}/hash/{hash}][%d] getAccountByPubkeyAndHashOK %+v", 200, o.Payload) +} + +func (o *GetAccountByPubkeyAndHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetAccountByPubkeyAndHashBadRequest creates a GetAccountByPubkeyAndHashBadRequest with default headers values +func NewGetAccountByPubkeyAndHashBadRequest() *GetAccountByPubkeyAndHashBadRequest { + return &GetAccountByPubkeyAndHashBadRequest{} +} + +/*GetAccountByPubkeyAndHashBadRequest handles this case with default header values. + +Invalid public key or invalid hash +*/ +type GetAccountByPubkeyAndHashBadRequest struct { + Payload *models.Error +} + +func (o *GetAccountByPubkeyAndHashBadRequest) Error() string { + return fmt.Sprintf("[GET /accounts/{pubkey}/hash/{hash}][%d] getAccountByPubkeyAndHashBadRequest %+v", 400, o.Payload) +} + +func (o *GetAccountByPubkeyAndHashBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetAccountByPubkeyAndHashNotFound creates a GetAccountByPubkeyAndHashNotFound with default headers values +func NewGetAccountByPubkeyAndHashNotFound() *GetAccountByPubkeyAndHashNotFound { + return &GetAccountByPubkeyAndHashNotFound{} +} + +/*GetAccountByPubkeyAndHashNotFound handles this case with default header values. + +Account not found or hash not available +*/ +type GetAccountByPubkeyAndHashNotFound struct { + Payload *models.Error +} + +func (o *GetAccountByPubkeyAndHashNotFound) Error() string { + return fmt.Sprintf("[GET /accounts/{pubkey}/hash/{hash}][%d] getAccountByPubkeyAndHashNotFound %+v", 404, o.Payload) +} + +func (o *GetAccountByPubkeyAndHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/generated/client/external/get_account_by_pubkey_and_height_parameters.go b/generated/client/external/get_account_by_pubkey_and_height_parameters.go new file mode 100644 index 00000000..14dee9d9 --- /dev/null +++ b/generated/client/external/get_account_by_pubkey_and_height_parameters.go @@ -0,0 +1,158 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package external + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/swag" + + strfmt "github.com/go-openapi/strfmt" +) + +// NewGetAccountByPubkeyAndHeightParams creates a new GetAccountByPubkeyAndHeightParams object +// with the default values initialized. +func NewGetAccountByPubkeyAndHeightParams() *GetAccountByPubkeyAndHeightParams { + var () + return &GetAccountByPubkeyAndHeightParams{ + + timeout: cr.DefaultTimeout, + } +} + +// NewGetAccountByPubkeyAndHeightParamsWithTimeout creates a new GetAccountByPubkeyAndHeightParams object +// with the default values initialized, and the ability to set a timeout on a request +func NewGetAccountByPubkeyAndHeightParamsWithTimeout(timeout time.Duration) *GetAccountByPubkeyAndHeightParams { + var () + return &GetAccountByPubkeyAndHeightParams{ + + timeout: timeout, + } +} + +// NewGetAccountByPubkeyAndHeightParamsWithContext creates a new GetAccountByPubkeyAndHeightParams object +// with the default values initialized, and the ability to set a context for a request +func NewGetAccountByPubkeyAndHeightParamsWithContext(ctx context.Context) *GetAccountByPubkeyAndHeightParams { + var () + return &GetAccountByPubkeyAndHeightParams{ + + Context: ctx, + } +} + +// NewGetAccountByPubkeyAndHeightParamsWithHTTPClient creates a new GetAccountByPubkeyAndHeightParams object +// with the default values initialized, and the ability to set a custom HTTPClient for a request +func NewGetAccountByPubkeyAndHeightParamsWithHTTPClient(client *http.Client) *GetAccountByPubkeyAndHeightParams { + var () + return &GetAccountByPubkeyAndHeightParams{ + HTTPClient: client, + } +} + +/*GetAccountByPubkeyAndHeightParams contains all the parameters to send to the API endpoint +for the get account by pubkey and height operation typically these are written to a http.Request +*/ +type GetAccountByPubkeyAndHeightParams struct { + + /*Height + The height of the key block + + */ + Height int64 + /*Pubkey + The public key of the account + + */ + Pubkey string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithTimeout adds the timeout to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) WithTimeout(timeout time.Duration) *GetAccountByPubkeyAndHeightParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) WithContext(ctx context.Context) *GetAccountByPubkeyAndHeightParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) WithHTTPClient(client *http.Client) *GetAccountByPubkeyAndHeightParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHeight adds the height to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) WithHeight(height int64) *GetAccountByPubkeyAndHeightParams { + o.SetHeight(height) + return o +} + +// SetHeight adds the height to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) SetHeight(height int64) { + o.Height = height +} + +// WithPubkey adds the pubkey to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) WithPubkey(pubkey string) *GetAccountByPubkeyAndHeightParams { + o.SetPubkey(pubkey) + return o +} + +// SetPubkey adds the pubkey to the get account by pubkey and height params +func (o *GetAccountByPubkeyAndHeightParams) SetPubkey(pubkey string) { + o.Pubkey = pubkey +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAccountByPubkeyAndHeightParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param height + if err := r.SetPathParam("height", swag.FormatInt64(o.Height)); err != nil { + return err + } + + // path param pubkey + if err := r.SetPathParam("pubkey", o.Pubkey); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/generated/client/external/get_account_by_pubkey_and_height_responses.go b/generated/client/external/get_account_by_pubkey_and_height_responses.go new file mode 100644 index 00000000..587549e5 --- /dev/null +++ b/generated/client/external/get_account_by_pubkey_and_height_responses.go @@ -0,0 +1,139 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package external + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + + strfmt "github.com/go-openapi/strfmt" + + models "github.com/aeternity/aepp-sdk-go/generated/models" +) + +// GetAccountByPubkeyAndHeightReader is a Reader for the GetAccountByPubkeyAndHeight structure. +type GetAccountByPubkeyAndHeightReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAccountByPubkeyAndHeightReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + + case 200: + result := NewGetAccountByPubkeyAndHeightOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + + case 400: + result := NewGetAccountByPubkeyAndHeightBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + case 404: + result := NewGetAccountByPubkeyAndHeightNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + + default: + return nil, runtime.NewAPIError("unknown error", response, response.Code()) + } +} + +// NewGetAccountByPubkeyAndHeightOK creates a GetAccountByPubkeyAndHeightOK with default headers values +func NewGetAccountByPubkeyAndHeightOK() *GetAccountByPubkeyAndHeightOK { + return &GetAccountByPubkeyAndHeightOK{} +} + +/*GetAccountByPubkeyAndHeightOK handles this case with default header values. + +Successful operation +*/ +type GetAccountByPubkeyAndHeightOK struct { + Payload *models.Account +} + +func (o *GetAccountByPubkeyAndHeightOK) Error() string { + return fmt.Sprintf("[GET /accounts/{pubkey}/height/{height}][%d] getAccountByPubkeyAndHeightOK %+v", 200, o.Payload) +} + +func (o *GetAccountByPubkeyAndHeightOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetAccountByPubkeyAndHeightBadRequest creates a GetAccountByPubkeyAndHeightBadRequest with default headers values +func NewGetAccountByPubkeyAndHeightBadRequest() *GetAccountByPubkeyAndHeightBadRequest { + return &GetAccountByPubkeyAndHeightBadRequest{} +} + +/*GetAccountByPubkeyAndHeightBadRequest handles this case with default header values. + +Invalid public key or invalid height +*/ +type GetAccountByPubkeyAndHeightBadRequest struct { + Payload *models.Error +} + +func (o *GetAccountByPubkeyAndHeightBadRequest) Error() string { + return fmt.Sprintf("[GET /accounts/{pubkey}/height/{height}][%d] getAccountByPubkeyAndHeightBadRequest %+v", 400, o.Payload) +} + +func (o *GetAccountByPubkeyAndHeightBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetAccountByPubkeyAndHeightNotFound creates a GetAccountByPubkeyAndHeightNotFound with default headers values +func NewGetAccountByPubkeyAndHeightNotFound() *GetAccountByPubkeyAndHeightNotFound { + return &GetAccountByPubkeyAndHeightNotFound{} +} + +/*GetAccountByPubkeyAndHeightNotFound handles this case with default header values. + +Account not found or height not available +*/ +type GetAccountByPubkeyAndHeightNotFound struct { + Payload *models.Error +} + +func (o *GetAccountByPubkeyAndHeightNotFound) Error() string { + return fmt.Sprintf("[GET /accounts/{pubkey}/height/{height}][%d] getAccountByPubkeyAndHeightNotFound %+v", 404, o.Payload) +} + +func (o *GetAccountByPubkeyAndHeightNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/generated/models/contract_call_compute.go b/generated/models/contract_call_compute.go index d2af0a0d..a7aced16 100644 --- a/generated/models/contract_call_compute.go +++ b/generated/models/contract_call_compute.go @@ -19,10 +19,14 @@ import ( // swagger:model ContractCallCompute type ContractCallCompute struct { + // ABI version + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Amount // Required: true - // Minimum: 0 - Amount *int64 `json:"amount"` + Amount utils.BigInt `json:"amount"` // Contract call data function arguments (deprecated, use call) Arguments string `json:"arguments,omitempty"` @@ -62,17 +66,20 @@ type ContractCallCompute struct { // Minimum: 0 TTL *int64 `json:"ttl,omitempty"` - // Virtual machine's version - // Required: true - // Maximum: 255 + // VM version + // Maximum: 65535 // Minimum: 0 - VMVersion *int64 `json:"vm_version"` + VMVersion *int64 `json:"vm_version,omitempty"` } // Validate validates this contract call compute func (m *ContractCallCompute) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateAbiVersion(formats); err != nil { + res = append(res, err) + } + if err := m.validateAmount(formats); err != nil { res = append(res, err) } @@ -111,13 +118,29 @@ func (m *ContractCallCompute) Validate(formats strfmt.Registry) error { return nil } -func (m *ContractCallCompute) validateAmount(formats strfmt.Registry) error { +func (m *ContractCallCompute) validateAbiVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.AbiVersion) { // not required + return nil + } - if err := validate.Required("amount", "body", m.Amount); err != nil { + if err := validate.MinimumInt("abi_version", "body", int64(*m.AbiVersion), 0, false); err != nil { return err } - if err := validate.MinimumInt("amount", "body", int64(*m.Amount), 0, false); err != nil { + if err := validate.MaximumInt("abi_version", "body", int64(*m.AbiVersion), 65535, false); err != nil { + return err + } + + return nil +} + +func (m *ContractCallCompute) validateAmount(formats strfmt.Registry) error { + + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } return err } @@ -201,15 +224,15 @@ func (m *ContractCallCompute) validateTTL(formats strfmt.Registry) error { func (m *ContractCallCompute) validateVMVersion(formats strfmt.Registry) error { - if err := validate.Required("vm_version", "body", m.VMVersion); err != nil { - return err + if swag.IsZero(m.VMVersion) { // not required + return nil } if err := validate.MinimumInt("vm_version", "body", int64(*m.VMVersion), 0, false); err != nil { return err } - if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 255, false); err != nil { + if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 65535, false); err != nil { return err } diff --git a/generated/models/contract_call_tx.go b/generated/models/contract_call_tx.go index ea8d35d4..6e938a70 100644 --- a/generated/models/contract_call_tx.go +++ b/generated/models/contract_call_tx.go @@ -19,10 +19,14 @@ import ( // swagger:model ContractCallTx type ContractCallTx struct { + // ABI version + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Amount // Required: true - // Minimum: 0 - Amount *int64 `json:"amount"` + Amount utils.BigInt `json:"amount"` // Contract call data // Required: true @@ -57,17 +61,20 @@ type ContractCallTx struct { // Minimum: 0 TTL *int64 `json:"ttl,omitempty"` - // Virtual machine's version - // Required: true - // Maximum: 255 + // VM version + // Maximum: 65535 // Minimum: 0 - VMVersion *int64 `json:"vm_version"` + VMVersion *int64 `json:"vm_version,omitempty"` } // Validate validates this contract call tx func (m *ContractCallTx) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateAbiVersion(formats); err != nil { + res = append(res, err) + } + if err := m.validateAmount(formats); err != nil { res = append(res, err) } @@ -110,13 +117,29 @@ func (m *ContractCallTx) Validate(formats strfmt.Registry) error { return nil } -func (m *ContractCallTx) validateAmount(formats strfmt.Registry) error { +func (m *ContractCallTx) validateAbiVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.AbiVersion) { // not required + return nil + } - if err := validate.Required("amount", "body", m.Amount); err != nil { + if err := validate.MinimumInt("abi_version", "body", int64(*m.AbiVersion), 0, false); err != nil { return err } - if err := validate.MinimumInt("amount", "body", int64(*m.Amount), 0, false); err != nil { + if err := validate.MaximumInt("abi_version", "body", int64(*m.AbiVersion), 65535, false); err != nil { + return err + } + + return nil +} + +func (m *ContractCallTx) validateAmount(formats strfmt.Registry) error { + + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } return err } @@ -212,15 +235,15 @@ func (m *ContractCallTx) validateTTL(formats strfmt.Registry) error { func (m *ContractCallTx) validateVMVersion(formats strfmt.Registry) error { - if err := validate.Required("vm_version", "body", m.VMVersion); err != nil { - return err + if swag.IsZero(m.VMVersion) { // not required + return nil } if err := validate.MinimumInt("vm_version", "body", int64(*m.VMVersion), 0, false); err != nil { return err } - if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 255, false); err != nil { + if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 65535, false); err != nil { return err } diff --git a/generated/models/contract_create_compute.go b/generated/models/contract_create_compute.go index ef68d1ac..867d036e 100644 --- a/generated/models/contract_create_compute.go +++ b/generated/models/contract_create_compute.go @@ -19,10 +19,14 @@ import ( // swagger:model ContractCreateCompute type ContractCreateCompute struct { + // ABI version + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Amount // Required: true - // Minimum: 0 - Amount *int64 `json:"amount"` + Amount utils.BigInt `json:"amount"` // Contract call data init function arguments (deprecated, use call) Arguments string `json:"arguments,omitempty"` @@ -66,7 +70,7 @@ type ContractCreateCompute struct { // Virtual machine's version // Required: true - // Maximum: 255 + // Maximum: 65535 // Minimum: 0 VMVersion *int64 `json:"vm_version"` } @@ -75,6 +79,10 @@ type ContractCreateCompute struct { func (m *ContractCreateCompute) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateAbiVersion(formats); err != nil { + res = append(res, err) + } + if err := m.validateAmount(formats); err != nil { res = append(res, err) } @@ -117,13 +125,29 @@ func (m *ContractCreateCompute) Validate(formats strfmt.Registry) error { return nil } -func (m *ContractCreateCompute) validateAmount(formats strfmt.Registry) error { +func (m *ContractCreateCompute) validateAbiVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.AbiVersion) { // not required + return nil + } - if err := validate.Required("amount", "body", m.Amount); err != nil { + if err := validate.MinimumInt("abi_version", "body", int64(*m.AbiVersion), 0, false); err != nil { return err } - if err := validate.MinimumInt("amount", "body", int64(*m.Amount), 0, false); err != nil { + if err := validate.MaximumInt("abi_version", "body", int64(*m.AbiVersion), 65535, false); err != nil { + return err + } + + return nil +} + +func (m *ContractCreateCompute) validateAmount(formats strfmt.Registry) error { + + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } return err } @@ -222,7 +246,7 @@ func (m *ContractCreateCompute) validateVMVersion(formats strfmt.Registry) error return err } - if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 255, false); err != nil { + if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 65535, false); err != nil { return err } diff --git a/generated/models/contract_create_tx.go b/generated/models/contract_create_tx.go index 84a82b9c..662111bd 100644 --- a/generated/models/contract_create_tx.go +++ b/generated/models/contract_create_tx.go @@ -19,10 +19,14 @@ import ( // swagger:model ContractCreateTx type ContractCreateTx struct { + // ABI version + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Amount // Required: true - // Minimum: 0 - Amount *int64 `json:"amount"` + Amount utils.BigInt `json:"amount"` // Contract call data // Required: true @@ -64,7 +68,7 @@ type ContractCreateTx struct { // Virtual machine's version // Required: true - // Maximum: 255 + // Maximum: 65535 // Minimum: 0 VMVersion *int64 `json:"vm_version"` } @@ -73,6 +77,10 @@ type ContractCreateTx struct { func (m *ContractCreateTx) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateAbiVersion(formats); err != nil { + res = append(res, err) + } + if err := m.validateAmount(formats); err != nil { res = append(res, err) } @@ -119,13 +127,29 @@ func (m *ContractCreateTx) Validate(formats strfmt.Registry) error { return nil } -func (m *ContractCreateTx) validateAmount(formats strfmt.Registry) error { +func (m *ContractCreateTx) validateAbiVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.AbiVersion) { // not required + return nil + } - if err := validate.Required("amount", "body", m.Amount); err != nil { + if err := validate.MinimumInt("abi_version", "body", int64(*m.AbiVersion), 0, false); err != nil { return err } - if err := validate.MinimumInt("amount", "body", int64(*m.Amount), 0, false); err != nil { + if err := validate.MaximumInt("abi_version", "body", int64(*m.AbiVersion), 65535, false); err != nil { + return err + } + + return nil +} + +func (m *ContractCreateTx) validateAmount(formats strfmt.Registry) error { + + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } return err } @@ -239,7 +263,7 @@ func (m *ContractCreateTx) validateVMVersion(formats strfmt.Registry) error { return err } - if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 255, false); err != nil { + if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 65535, false); err != nil { return err } diff --git a/generated/models/contract_object.go b/generated/models/contract_object.go index 8f92ee15..b569c5d7 100644 --- a/generated/models/contract_object.go +++ b/generated/models/contract_object.go @@ -19,6 +19,11 @@ import ( // swagger:model ContractObject type ContractObject struct { + // abi version + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // active // Required: true Active *bool `json:"active"` @@ -45,7 +50,7 @@ type ContractObject struct { // vm version // Required: true - // Maximum: 255 + // Maximum: 65535 // Minimum: 0 VMVersion *int64 `json:"vm_version"` } @@ -54,6 +59,10 @@ type ContractObject struct { func (m *ContractObject) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateAbiVersion(formats); err != nil { + res = append(res, err) + } + if err := m.validateActive(formats); err != nil { res = append(res, err) } @@ -88,6 +97,23 @@ func (m *ContractObject) Validate(formats strfmt.Registry) error { return nil } +func (m *ContractObject) validateAbiVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.AbiVersion) { // not required + return nil + } + + if err := validate.MinimumInt("abi_version", "body", int64(*m.AbiVersion), 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("abi_version", "body", int64(*m.AbiVersion), 65535, false); err != nil { + return err + } + + return nil +} + func (m *ContractObject) validateActive(formats strfmt.Registry) error { if err := validate.Required("active", "body", m.Active); err != nil { @@ -169,7 +195,7 @@ func (m *ContractObject) validateVMVersion(formats strfmt.Registry) error { return err } - if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 255, false); err != nil { + if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 65535, false); err != nil { return err } diff --git a/generated/models/dry_run_account.go b/generated/models/dry_run_account.go index 5e40ec1f..0c1d82c5 100644 --- a/generated/models/dry_run_account.go +++ b/generated/models/dry_run_account.go @@ -10,7 +10,8 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/swag" - "github.com/go-openapi/validate" + + utils "github.com/aeternity/aepp-sdk-go/utils" ) // DryRunAccount dry run account @@ -19,7 +20,7 @@ type DryRunAccount struct { // amount // Required: true - Amount *int64 `json:"amount"` + Amount utils.BigInt `json:"amount"` // pub key // Required: true @@ -46,7 +47,10 @@ func (m *DryRunAccount) Validate(formats strfmt.Registry) error { func (m *DryRunAccount) validateAmount(formats strfmt.Registry) error { - if err := validate.Required("amount", "body", m.Amount); err != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } return err } diff --git a/generated/models/key_block.go b/generated/models/key_block.go index 7eb0b324..de3fac3c 100644 --- a/generated/models/key_block.go +++ b/generated/models/key_block.go @@ -29,6 +29,10 @@ type KeyBlock struct { // Required: true Height *uint64 `json:"height"` + // info + // Required: true + Info EncodedByteArray `json:"info"` + // miner // Required: true Miner EncodedHash `json:"miner"` @@ -80,6 +84,10 @@ func (m *KeyBlock) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateInfo(formats); err != nil { + res = append(res, err) + } + if err := m.validateMiner(formats); err != nil { res = append(res, err) } @@ -151,6 +159,18 @@ func (m *KeyBlock) validateHeight(formats strfmt.Registry) error { return nil } +func (m *KeyBlock) validateInfo(formats strfmt.Registry) error { + + if err := m.Info.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("info") + } + return err + } + + return nil +} + func (m *KeyBlock) validateMiner(formats strfmt.Registry) error { if err := m.Miner.Validate(formats); err != nil { diff --git a/generated/models/off_chain_call_contract.go b/generated/models/off_chain_call_contract.go index 90c4f31a..bc401f4f 100644 --- a/generated/models/off_chain_call_contract.go +++ b/generated/models/off_chain_call_contract.go @@ -20,6 +20,11 @@ import ( // swagger:model OffChainCallContract type OffChainCallContract struct { + // ABI version for the call/calldata + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Amount of tokens to transfer to the contract // Required: true Amount *uint64 `json:"amount"` @@ -44,9 +49,10 @@ type OffChainCallContract struct { // Required: true GasPrice *uint64 `json:"gas_price"` - // VM version of the contract - // Required: true - VMVersion *uint64 `json:"vm_version"` + // ABI version for the call/calldata + // Maximum: 65535 + // Minimum: 0 + VMVersion *int64 `json:"vm_version,omitempty"` } // Op gets the op of this subtype @@ -59,6 +65,8 @@ func (m *OffChainCallContract) SetOp(val string) { } +// AbiVersion gets the abi version of this subtype + // Amount gets the amount of this subtype // CallData gets the call data of this subtype @@ -77,6 +85,11 @@ func (m *OffChainCallContract) SetOp(val string) { func (m *OffChainCallContract) UnmarshalJSON(raw []byte) error { var data struct { + // ABI version for the call/calldata + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Amount of tokens to transfer to the contract // Required: true Amount *uint64 `json:"amount"` @@ -101,9 +114,10 @@ func (m *OffChainCallContract) UnmarshalJSON(raw []byte) error { // Required: true GasPrice *uint64 `json:"gas_price"` - // VM version of the contract - // Required: true - VMVersion *uint64 `json:"vm_version"` + // ABI version for the call/calldata + // Maximum: 65535 + // Minimum: 0 + VMVersion *int64 `json:"vm_version,omitempty"` } buf := bytes.NewBuffer(raw) dec := json.NewDecoder(buf) @@ -133,6 +147,8 @@ func (m *OffChainCallContract) UnmarshalJSON(raw []byte) error { return errors.New(422, "invalid op value: %q", base.Op) } + result.AbiVersion = data.AbiVersion + result.Amount = data.Amount result.CallData = data.CallData @@ -158,6 +174,11 @@ func (m OffChainCallContract) MarshalJSON() ([]byte, error) { var err error b1, err = json.Marshal(struct { + // ABI version for the call/calldata + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Amount of tokens to transfer to the contract // Required: true Amount *uint64 `json:"amount"` @@ -182,11 +203,14 @@ func (m OffChainCallContract) MarshalJSON() ([]byte, error) { // Required: true GasPrice *uint64 `json:"gas_price"` - // VM version of the contract - // Required: true - VMVersion *uint64 `json:"vm_version"` + // ABI version for the call/calldata + // Maximum: 65535 + // Minimum: 0 + VMVersion *int64 `json:"vm_version,omitempty"` }{ + AbiVersion: m.AbiVersion, + Amount: m.Amount, CallData: m.CallData, @@ -223,6 +247,10 @@ func (m OffChainCallContract) MarshalJSON() ([]byte, error) { func (m *OffChainCallContract) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateAbiVersion(formats); err != nil { + res = append(res, err) + } + if err := m.validateAmount(formats); err != nil { res = append(res, err) } @@ -257,6 +285,23 @@ func (m *OffChainCallContract) Validate(formats strfmt.Registry) error { return nil } +func (m *OffChainCallContract) validateAbiVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.AbiVersion) { // not required + return nil + } + + if err := validate.MinimumInt("abi_version", "body", int64(*m.AbiVersion), 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("abi_version", "body", int64(*m.AbiVersion), 65535, false); err != nil { + return err + } + + return nil +} + func (m *OffChainCallContract) validateAmount(formats strfmt.Registry) error { if err := validate.Required("amount", "body", m.Amount); err != nil { @@ -322,7 +367,15 @@ func (m *OffChainCallContract) validateGasPrice(formats strfmt.Registry) error { func (m *OffChainCallContract) validateVMVersion(formats strfmt.Registry) error { - if err := validate.Required("vm_version", "body", m.VMVersion); err != nil { + if swag.IsZero(m.VMVersion) { // not required + return nil + } + + if err := validate.MinimumInt("vm_version", "body", int64(*m.VMVersion), 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 65535, false); err != nil { return err } diff --git a/generated/models/off_chain_new_contract.go b/generated/models/off_chain_new_contract.go index e57fd0f8..d2377c5b 100644 --- a/generated/models/off_chain_new_contract.go +++ b/generated/models/off_chain_new_contract.go @@ -20,6 +20,11 @@ import ( // swagger:model OffChainNewContract type OffChainNewContract struct { + // ABI version of the contract + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Contract call data // Required: true CallData EncodedByteArray `json:"call_data"` @@ -38,7 +43,9 @@ type OffChainNewContract struct { // VM version of the contract // Required: true - VMVersion *uint64 `json:"vm_version"` + // Maximum: 65535 + // Minimum: 0 + VMVersion *int64 `json:"vm_version"` } // Op gets the op of this subtype @@ -51,6 +58,8 @@ func (m *OffChainNewContract) SetOp(val string) { } +// AbiVersion gets the abi version of this subtype + // CallData gets the call data of this subtype // Code gets the code of this subtype @@ -65,6 +74,11 @@ func (m *OffChainNewContract) SetOp(val string) { func (m *OffChainNewContract) UnmarshalJSON(raw []byte) error { var data struct { + // ABI version of the contract + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Contract call data // Required: true CallData EncodedByteArray `json:"call_data"` @@ -83,7 +97,9 @@ func (m *OffChainNewContract) UnmarshalJSON(raw []byte) error { // VM version of the contract // Required: true - VMVersion *uint64 `json:"vm_version"` + // Maximum: 65535 + // Minimum: 0 + VMVersion *int64 `json:"vm_version"` } buf := bytes.NewBuffer(raw) dec := json.NewDecoder(buf) @@ -113,6 +129,8 @@ func (m *OffChainNewContract) UnmarshalJSON(raw []byte) error { return errors.New(422, "invalid op value: %q", base.Op) } + result.AbiVersion = data.AbiVersion + result.CallData = data.CallData result.Code = data.Code @@ -134,6 +152,11 @@ func (m OffChainNewContract) MarshalJSON() ([]byte, error) { var err error b1, err = json.Marshal(struct { + // ABI version of the contract + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // Contract call data // Required: true CallData EncodedByteArray `json:"call_data"` @@ -152,9 +175,13 @@ func (m OffChainNewContract) MarshalJSON() ([]byte, error) { // VM version of the contract // Required: true - VMVersion *uint64 `json:"vm_version"` + // Maximum: 65535 + // Minimum: 0 + VMVersion *int64 `json:"vm_version"` }{ + AbiVersion: m.AbiVersion, + CallData: m.CallData, Code: m.Code, @@ -187,6 +214,10 @@ func (m OffChainNewContract) MarshalJSON() ([]byte, error) { func (m *OffChainNewContract) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateAbiVersion(formats); err != nil { + res = append(res, err) + } + if err := m.validateCallData(formats); err != nil { res = append(res, err) } @@ -213,6 +244,23 @@ func (m *OffChainNewContract) Validate(formats strfmt.Registry) error { return nil } +func (m *OffChainNewContract) validateAbiVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.AbiVersion) { // not required + return nil + } + + if err := validate.MinimumInt("abi_version", "body", int64(*m.AbiVersion), 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("abi_version", "body", int64(*m.AbiVersion), 65535, false); err != nil { + return err + } + + return nil +} + func (m *OffChainNewContract) validateCallData(formats strfmt.Registry) error { if err := m.CallData.Validate(formats); err != nil { @@ -270,6 +318,14 @@ func (m *OffChainNewContract) validateVMVersion(formats strfmt.Registry) error { return err } + if err := validate.MinimumInt("vm_version", "body", int64(*m.VMVersion), 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 65535, false); err != nil { + return err + } + return nil } diff --git a/generated/models/oracle_register_tx.go b/generated/models/oracle_register_tx.go index c636bf64..8e96e4b2 100644 --- a/generated/models/oracle_register_tx.go +++ b/generated/models/oracle_register_tx.go @@ -19,6 +19,11 @@ import ( // swagger:model OracleRegisterTx type OracleRegisterTx struct { + // abi version + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // account id // Required: true AccountID EncodedHash `json:"account_id"` @@ -50,14 +55,19 @@ type OracleRegisterTx struct { TTL uint64 `json:"ttl,omitempty"` // vm version + // Maximum: 65535 // Minimum: 0 - VMVersion *uint64 `json:"vm_version,omitempty"` + VMVersion *int64 `json:"vm_version,omitempty"` } // Validate validates this oracle register tx func (m *OracleRegisterTx) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateAbiVersion(formats); err != nil { + res = append(res, err) + } + if err := m.validateAccountID(formats); err != nil { res = append(res, err) } @@ -92,6 +102,23 @@ func (m *OracleRegisterTx) Validate(formats strfmt.Registry) error { return nil } +func (m *OracleRegisterTx) validateAbiVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.AbiVersion) { // not required + return nil + } + + if err := validate.MinimumInt("abi_version", "body", int64(*m.AbiVersion), 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("abi_version", "body", int64(*m.AbiVersion), 65535, false); err != nil { + return err + } + + return nil +} + func (m *OracleRegisterTx) validateAccountID(formats strfmt.Registry) error { if err := m.AccountID.Validate(formats); err != nil { @@ -174,6 +201,10 @@ func (m *OracleRegisterTx) validateVMVersion(formats strfmt.Registry) error { return err } + if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 65535, false); err != nil { + return err + } + return nil } diff --git a/generated/models/registered_oracle.go b/generated/models/registered_oracle.go index 4d5be5f7..039ad165 100644 --- a/generated/models/registered_oracle.go +++ b/generated/models/registered_oracle.go @@ -19,6 +19,11 @@ import ( // swagger:model RegisteredOracle type RegisteredOracle struct { + // abi version + // Maximum: 65535 + // Minimum: 0 + AbiVersion *int64 `json:"abi_version,omitempty"` + // id // Required: true ID EncodedHash `json:"id"` @@ -40,15 +45,19 @@ type RegisteredOracle struct { TTL *uint64 `json:"ttl"` // vm version - // Required: true + // Maximum: 65535 // Minimum: 0 - VMVersion *uint64 `json:"vm_version"` + VMVersion *int64 `json:"vm_version,omitempty"` } // Validate validates this registered oracle func (m *RegisteredOracle) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateAbiVersion(formats); err != nil { + res = append(res, err) + } + if err := m.validateID(formats); err != nil { res = append(res, err) } @@ -79,6 +88,23 @@ func (m *RegisteredOracle) Validate(formats strfmt.Registry) error { return nil } +func (m *RegisteredOracle) validateAbiVersion(formats strfmt.Registry) error { + + if swag.IsZero(m.AbiVersion) { // not required + return nil + } + + if err := validate.MinimumInt("abi_version", "body", int64(*m.AbiVersion), 0, false); err != nil { + return err + } + + if err := validate.MaximumInt("abi_version", "body", int64(*m.AbiVersion), 65535, false); err != nil { + return err + } + + return nil +} + func (m *RegisteredOracle) validateID(formats strfmt.Registry) error { if err := m.ID.Validate(formats); err != nil { @@ -132,14 +158,18 @@ func (m *RegisteredOracle) validateTTL(formats strfmt.Registry) error { func (m *RegisteredOracle) validateVMVersion(formats strfmt.Registry) error { - if err := validate.Required("vm_version", "body", m.VMVersion); err != nil { - return err + if swag.IsZero(m.VMVersion) { // not required + return nil } if err := validate.MinimumInt("vm_version", "body", int64(*m.VMVersion), 0, false); err != nil { return err } + if err := validate.MaximumInt("vm_version", "body", int64(*m.VMVersion), 65535, false); err != nil { + return err + } + return nil } diff --git a/generated/models/token_supply.go b/generated/models/token_supply.go new file mode 100644 index 00000000..8eeb37bf --- /dev/null +++ b/generated/models/token_supply.go @@ -0,0 +1,64 @@ +// 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 ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/swag" +) + +// TokenSupply token supply +// swagger:model TokenSupply +type TokenSupply struct { + + // Tokens in account balances + Accounts int64 `json:"accounts,omitempty"` + + // Tokens in contracts registered as oracles + ContractOracles int64 `json:"contract_oracles,omitempty"` + + // Tokens in contracts + Contracts int64 `json:"contracts,omitempty"` + + // Tokens locked (not owned by anyone) + Locked int64 `json:"locked,omitempty"` + + // Tokens in pending oracle queries + OracleQueries int64 `json:"oracle_queries,omitempty"` + + // Tokens in accounts registered as oracles + Oracles int64 `json:"oracles,omitempty"` + + // Tokens from fees and coinbase pending in the beneficiary reward delay + PendingRewards int64 `json:"pending_rewards,omitempty"` + + // Sum of all tokens from other fields + Total int64 `json:"total,omitempty"` +} + +// Validate validates this token supply +func (m *TokenSupply) Validate(formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TokenSupply) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TokenSupply) UnmarshalBinary(b []byte) error { + var res TokenSupply + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}