transaction

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2025 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Overview

Package transaction provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var DEFINITION string

Functions

func EncodePaioFormat

func EncodePaioFormat(sigAndData eip712.SigAndData) (string, error)

func NewGetNonceRequest

func NewGetNonceRequest(server string, body GetNonceJSONRequestBody) (*http.Request, error)

NewGetNonceRequest calls the generic GetNonce builder with application/json body

func NewGetNonceRequestWithBody

func NewGetNonceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewGetNonceRequestWithBody generates requests for GetNonce with any type of body

func NewSendCartesiTransactionRequest

func NewSendCartesiTransactionRequest(server string, body SendCartesiTransactionJSONRequestBody) (*http.Request, error)

NewSendCartesiTransactionRequest calls the generic SendCartesiTransaction builder with application/json body

func NewSendCartesiTransactionRequestWithBody

func NewSendCartesiTransactionRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewSendCartesiTransactionRequestWithBody generates requests for SendCartesiTransaction with any type of body

func Register

func Register(e *echo.Echo, paioServerAPI ServerInterface)

Register the Paio API to echo

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type Cartesi712

type Cartesi712 struct {
	Address   *string `json:"address,omitempty"`
	Signature *string `json:"signature,omitempty"`
	TypedData *struct {
		Account *string `json:"account,omitempty"`
		Domain  struct {
			ChainId           *int    `json:"chainId,omitempty"`
			Name              *string `json:"name,omitempty"`
			VerifyingContract *string `json:"verifyingContract,omitempty"`
			Version           *string `json:"version,omitempty"`
		} `json:"domain"`
		Message struct {
			App         string                                   `json:"app"`
			Data        string                                   `json:"data"`
			MaxGasPrice Cartesi712_TypedData_Message_MaxGasPrice `json:"max_gas_price"`
			Nonce       Cartesi712_TypedData_Message_Nonce       `json:"nonce"`
		} `json:"message"`
		PrimaryType string `json:"primaryType"`
		Types       struct {
			CartesiMessage *[]struct {
				Name *string `json:"name,omitempty"`
				Type *string `json:"type,omitempty"`
			} `json:"CartesiMessage,omitempty"`
			EIP712Domain *[]struct {
				Name *string `json:"name,omitempty"`
				Type *string `json:"type,omitempty"`
			} `json:"EIP712Domain,omitempty"`
		} `json:"types"`
	} `json:"typedData,omitempty"`
}

Cartesi712 defines model for Cartesi712.

type Cartesi712TypedDataMessageMaxGasPrice0

type Cartesi712TypedDataMessageMaxGasPrice0 = string

Cartesi712TypedDataMessageMaxGasPrice0 defines model for .

type Cartesi712TypedDataMessageMaxGasPrice1

type Cartesi712TypedDataMessageMaxGasPrice1 = int

Cartesi712TypedDataMessageMaxGasPrice1 defines model for .

type Cartesi712TypedDataMessageNonce0

type Cartesi712TypedDataMessageNonce0 = string

Cartesi712TypedDataMessageNonce0 defines model for .

type Cartesi712TypedDataMessageNonce1

type Cartesi712TypedDataMessageNonce1 = uint64

Cartesi712TypedDataMessageNonce1 defines model for .

type Cartesi712_TypedData_Message_MaxGasPrice

type Cartesi712_TypedData_Message_MaxGasPrice struct {
	// contains filtered or unexported fields
}

Cartesi712_TypedData_Message_MaxGasPrice defines model for Cartesi712.TypedData.Message.MaxGasPrice.

func (Cartesi712_TypedData_Message_MaxGasPrice) AsCartesi712TypedDataMessageMaxGasPrice0

func (t Cartesi712_TypedData_Message_MaxGasPrice) AsCartesi712TypedDataMessageMaxGasPrice0() (Cartesi712TypedDataMessageMaxGasPrice0, error)

AsCartesi712TypedDataMessageMaxGasPrice0 returns the union data inside the Cartesi712_TypedData_Message_MaxGasPrice as a Cartesi712TypedDataMessageMaxGasPrice0

func (Cartesi712_TypedData_Message_MaxGasPrice) AsCartesi712TypedDataMessageMaxGasPrice1

func (t Cartesi712_TypedData_Message_MaxGasPrice) AsCartesi712TypedDataMessageMaxGasPrice1() (Cartesi712TypedDataMessageMaxGasPrice1, error)

AsCartesi712TypedDataMessageMaxGasPrice1 returns the union data inside the Cartesi712_TypedData_Message_MaxGasPrice as a Cartesi712TypedDataMessageMaxGasPrice1

func (*Cartesi712_TypedData_Message_MaxGasPrice) FromCartesi712TypedDataMessageMaxGasPrice0

func (t *Cartesi712_TypedData_Message_MaxGasPrice) FromCartesi712TypedDataMessageMaxGasPrice0(v Cartesi712TypedDataMessageMaxGasPrice0) error

FromCartesi712TypedDataMessageMaxGasPrice0 overwrites any union data inside the Cartesi712_TypedData_Message_MaxGasPrice as the provided Cartesi712TypedDataMessageMaxGasPrice0

func (*Cartesi712_TypedData_Message_MaxGasPrice) FromCartesi712TypedDataMessageMaxGasPrice1

func (t *Cartesi712_TypedData_Message_MaxGasPrice) FromCartesi712TypedDataMessageMaxGasPrice1(v Cartesi712TypedDataMessageMaxGasPrice1) error

FromCartesi712TypedDataMessageMaxGasPrice1 overwrites any union data inside the Cartesi712_TypedData_Message_MaxGasPrice as the provided Cartesi712TypedDataMessageMaxGasPrice1

func (Cartesi712_TypedData_Message_MaxGasPrice) MarshalJSON

func (*Cartesi712_TypedData_Message_MaxGasPrice) MergeCartesi712TypedDataMessageMaxGasPrice0

func (t *Cartesi712_TypedData_Message_MaxGasPrice) MergeCartesi712TypedDataMessageMaxGasPrice0(v Cartesi712TypedDataMessageMaxGasPrice0) error

MergeCartesi712TypedDataMessageMaxGasPrice0 performs a merge with any union data inside the Cartesi712_TypedData_Message_MaxGasPrice, using the provided Cartesi712TypedDataMessageMaxGasPrice0

func (*Cartesi712_TypedData_Message_MaxGasPrice) MergeCartesi712TypedDataMessageMaxGasPrice1

func (t *Cartesi712_TypedData_Message_MaxGasPrice) MergeCartesi712TypedDataMessageMaxGasPrice1(v Cartesi712TypedDataMessageMaxGasPrice1) error

MergeCartesi712TypedDataMessageMaxGasPrice1 performs a merge with any union data inside the Cartesi712_TypedData_Message_MaxGasPrice, using the provided Cartesi712TypedDataMessageMaxGasPrice1

func (*Cartesi712_TypedData_Message_MaxGasPrice) UnmarshalJSON

func (t *Cartesi712_TypedData_Message_MaxGasPrice) UnmarshalJSON(b []byte) error

type Cartesi712_TypedData_Message_Nonce

type Cartesi712_TypedData_Message_Nonce struct {
	// contains filtered or unexported fields
}

Cartesi712_TypedData_Message_Nonce defines model for Cartesi712.TypedData.Message.Nonce.

func (Cartesi712_TypedData_Message_Nonce) AsCartesi712TypedDataMessageNonce0

func (t Cartesi712_TypedData_Message_Nonce) AsCartesi712TypedDataMessageNonce0() (Cartesi712TypedDataMessageNonce0, error)

AsCartesi712TypedDataMessageNonce0 returns the union data inside the Cartesi712_TypedData_Message_Nonce as a Cartesi712TypedDataMessageNonce0

func (Cartesi712_TypedData_Message_Nonce) AsCartesi712TypedDataMessageNonce1

func (t Cartesi712_TypedData_Message_Nonce) AsCartesi712TypedDataMessageNonce1() (Cartesi712TypedDataMessageNonce1, error)

AsCartesi712TypedDataMessageNonce1 returns the union data inside the Cartesi712_TypedData_Message_Nonce as a Cartesi712TypedDataMessageNonce1

func (*Cartesi712_TypedData_Message_Nonce) FromCartesi712TypedDataMessageNonce0

func (t *Cartesi712_TypedData_Message_Nonce) FromCartesi712TypedDataMessageNonce0(v Cartesi712TypedDataMessageNonce0) error

FromCartesi712TypedDataMessageNonce0 overwrites any union data inside the Cartesi712_TypedData_Message_Nonce as the provided Cartesi712TypedDataMessageNonce0

func (*Cartesi712_TypedData_Message_Nonce) FromCartesi712TypedDataMessageNonce1

func (t *Cartesi712_TypedData_Message_Nonce) FromCartesi712TypedDataMessageNonce1(v Cartesi712TypedDataMessageNonce1) error

FromCartesi712TypedDataMessageNonce1 overwrites any union data inside the Cartesi712_TypedData_Message_Nonce as the provided Cartesi712TypedDataMessageNonce1

func (Cartesi712_TypedData_Message_Nonce) MarshalJSON

func (t Cartesi712_TypedData_Message_Nonce) MarshalJSON() ([]byte, error)

func (*Cartesi712_TypedData_Message_Nonce) MergeCartesi712TypedDataMessageNonce0

func (t *Cartesi712_TypedData_Message_Nonce) MergeCartesi712TypedDataMessageNonce0(v Cartesi712TypedDataMessageNonce0) error

MergeCartesi712TypedDataMessageNonce0 performs a merge with any union data inside the Cartesi712_TypedData_Message_Nonce, using the provided Cartesi712TypedDataMessageNonce0

func (*Cartesi712_TypedData_Message_Nonce) MergeCartesi712TypedDataMessageNonce1

func (t *Cartesi712_TypedData_Message_Nonce) MergeCartesi712TypedDataMessageNonce1(v Cartesi712TypedDataMessageNonce1) error

MergeCartesi712TypedDataMessageNonce1 performs a merge with any union data inside the Cartesi712_TypedData_Message_Nonce, using the provided Cartesi712TypedDataMessageNonce1

func (*Cartesi712_TypedData_Message_Nonce) UnmarshalJSON

func (t *Cartesi712_TypedData_Message_Nonce) UnmarshalJSON(b []byte) error

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetNonce

func (c *Client) GetNonce(ctx context.Context, body GetNonceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetNonceWithBody

func (c *Client) GetNonceWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendCartesiTransaction

func (c *Client) SendCartesiTransaction(ctx context.Context, body SendCartesiTransactionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendCartesiTransactionWithBody

func (c *Client) SendCartesiTransactionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetNonceWithBody request with any body
	GetNonceWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	GetNonce(ctx context.Context, body GetNonceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SendCartesiTransactionWithBody request with any body
	SendCartesiTransactionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SendCartesiTransaction(ctx context.Context, body SendCartesiTransactionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetNonceWithBodyWithResponse

func (c *ClientWithResponses) GetNonceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GetNonceResponse, error)

GetNonceWithBodyWithResponse request with arbitrary body returning *GetNonceResponse

func (*ClientWithResponses) GetNonceWithResponse

func (c *ClientWithResponses) GetNonceWithResponse(ctx context.Context, body GetNonceJSONRequestBody, reqEditors ...RequestEditorFn) (*GetNonceResponse, error)

func (*ClientWithResponses) SendCartesiTransactionWithBodyWithResponse

func (c *ClientWithResponses) SendCartesiTransactionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendCartesiTransactionResponse, error)

SendCartesiTransactionWithBodyWithResponse request with arbitrary body returning *SendCartesiTransactionResponse

func (*ClientWithResponses) SendCartesiTransactionWithResponse

func (c *ClientWithResponses) SendCartesiTransactionWithResponse(ctx context.Context, body SendCartesiTransactionJSONRequestBody, reqEditors ...RequestEditorFn) (*SendCartesiTransactionResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetNonceWithBodyWithResponse request with any body
	GetNonceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GetNonceResponse, error)

	GetNonceWithResponse(ctx context.Context, body GetNonceJSONRequestBody, reqEditors ...RequestEditorFn) (*GetNonceResponse, error)

	// SendCartesiTransactionWithBodyWithResponse request with any body
	SendCartesiTransactionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendCartesiTransactionResponse, error)

	SendCartesiTransactionWithResponse(ctx context.Context, body SendCartesiTransactionJSONRequestBody, reqEditors ...RequestEditorFn) (*SendCartesiTransactionResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type GetNonce

type GetNonce struct {
	// AppContract App contract address
	AppContract string `json:"app_contract"`

	// MsgSender Message sender address
	MsgSender string `json:"msg_sender"`
}

GetNonce defines model for GetNonce.

type GetNonceJSONRequestBody

type GetNonceJSONRequestBody = GetNonce

GetNonceJSONRequestBody defines body for GetNonce for application/json ContentType.

type GetNonceResponse

type GetNonceResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *NonceResponse
}

func ParseGetNonceResponse

func ParseGetNonceResponse(rsp *http.Response) (*GetNonceResponse, error)

ParseGetNonceResponse parses an HTTP response from a GetNonceWithResponse call

func (GetNonceResponse) Status

func (r GetNonceResponse) Status() string

Status returns HTTPResponse.Status

func (GetNonceResponse) StatusCode

func (r GetNonceResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type NonceResponse

type NonceResponse struct {
	// Nonce Nonce number
	Nonce *int `json:"nonce,omitempty"`
}

NonceResponse defines model for NonceResponse.

type PaioReqMessage

type PaioReqMessage struct {
	Signature string `json:"signature"`
	Message   string `json:"message"`
}

type PaioSender2Server

type PaioSender2Server struct {
	PaioServerUrl string
}

func (PaioSender2Server) GetNonce

func (c PaioSender2Server) GetNonce(
	ctx context.Context,
	appContract common.Address,
	msgSender common.Address,
) (uint64, error)

func (PaioSender2Server) SubmitSigAndData

func (p PaioSender2Server) SubmitSigAndData(ctx context.Context, sigAndData eip712.SigAndData) (string, error)

SubmitSigAndData implements Sender.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type SendCartesiTransactionJSONRequestBody

type SendCartesiTransactionJSONRequestBody = Cartesi712

SendCartesiTransactionJSONRequestBody defines body for SendCartesiTransaction for application/json ContentType.

type SendCartesiTransactionResponse

type SendCartesiTransactionResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *TransactionResponse
	JSON400      *TransactionError
}

func ParseSendCartesiTransactionResponse

func ParseSendCartesiTransactionResponse(rsp *http.Response) (*SendCartesiTransactionResponse, error)

ParseSendCartesiTransactionResponse parses an HTTP response from a SendCartesiTransactionWithResponse call

func (SendCartesiTransactionResponse) Status

Status returns HTTPResponse.Status

func (SendCartesiTransactionResponse) StatusCode

func (r SendCartesiTransactionResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Sender

type Sender interface {
	SubmitSigAndData(
		ctx context.Context,
		sigAndData eip712.SigAndData,
	) (string, error)
	GetNonce(
		ctx context.Context,
		appContract common.Address,
		msgSender common.Address,
	) (uint64, error)
}

func NewPaioSender2Server

func NewPaioSender2Server(url string) Sender

type ServerInterface

type ServerInterface interface {
	// Get Nonce
	// (POST /nonce)
	GetNonce(ctx echo.Context) error

	// (POST /submit)
	SendCartesiTransaction(ctx echo.Context) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) GetNonce

func (w *ServerInterfaceWrapper) GetNonce(ctx echo.Context) error

GetNonce converts echo context to params.

func (*ServerInterfaceWrapper) SendCartesiTransaction

func (w *ServerInterfaceWrapper) SendCartesiTransaction(ctx echo.Context) error

SendCartesiTransaction converts echo context to params.

type TransactionAPI

type TransactionAPI struct {
	ClientSender Sender
}

func (*TransactionAPI) GetNonce

func (p *TransactionAPI) GetNonce(ctx echo.Context) error

func (*TransactionAPI) SendCartesiTransaction

func (p *TransactionAPI) SendCartesiTransaction(ctx echo.Context) error

SendCartesiTransaction implements ServerInterface.

type TransactionError

type TransactionError struct {
	// Message Detailed error message
	Message *string `json:"message,omitempty"`
}

TransactionError defines model for TransactionError.

type TransactionResponse

type TransactionResponse struct {
	// Id tx number
	Id *string `json:"id,omitempty"`
}

TransactionResponse defines model for TransactionResponse.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL