coordinatorapi

package
v0.0.0-...-dd16f27 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "CoordinatorAPI"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [3]string{"configuration", "request_transaction", "soft_cancels"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeInternal

func MakeInternal(err error) *goa.ServiceError

MakeInternal builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func NewConfigurationEndpoint

func NewConfigurationEndpoint(s Service) goa.Endpoint

NewConfigurationEndpoint returns an endpoint function that calls the method "configuration" of service "CoordinatorAPI".

func NewRequestTransactionEndpoint

func NewRequestTransactionEndpoint(s Service) goa.Endpoint

NewRequestTransactionEndpoint returns an endpoint function that calls the method "request_transaction" of service "CoordinatorAPI".

func NewSoftCancelsEndpoint

func NewSoftCancelsEndpoint(s Service) goa.Endpoint

NewSoftCancelsEndpoint returns an endpoint function that calls the method "soft_cancels" of service "CoordinatorAPI".

Types

type Client

type Client struct {
	ConfigurationEndpoint      goa.Endpoint
	RequestTransactionEndpoint goa.Endpoint
	SoftCancelsEndpoint        goa.Endpoint
}

Client is the "CoordinatorAPI" service client.

func NewClient

func NewClient(configuration, requestTransaction, softCancels goa.Endpoint) *Client

NewClient initializes a "CoordinatorAPI" service client given the endpoints.

func (*Client) Configuration

func (c *Client) Configuration(ctx context.Context, p *ConfigurationPayload) (res *ConfigurationResult, err error)

Configuration calls the "configuration" endpoint of the "CoordinatorAPI" service.

func (*Client) RequestTransaction

func (c *Client) RequestTransaction(ctx context.Context, p *RequestTransactionPayload) (res *RequestTransactionResult, err error)

RequestTransaction calls the "request_transaction" endpoint of the "CoordinatorAPI" service.

func (*Client) SoftCancels

func (c *Client) SoftCancels(ctx context.Context, p *SoftCancelsPayload) (res *SoftCancelsResult, err error)

SoftCancels calls the "soft_cancels" endpoint of the "CoordinatorAPI" service.

type ConfigurationPayload

type ConfigurationPayload struct {
	// Specify Ethereum chain ID
	ChainID int64
}

ConfigurationPayload is the payload type of the CoordinatorAPI service configuration method.

type ConfigurationResult

type ConfigurationResult struct {
	// Duration of validity of coordinator approval in seconds
	ExpirationDurationSeconds uint32
	// Duration of selective delay in milliseconds
	SelectiveDelayMs uint32
	// Supported Ethereum chain IDs
	SupportedChainIds []uint32
}

ConfigurationResult is the result type of the CoordinatorAPI service configuration method.

type CoordinatorValidationError

type CoordinatorValidationError struct {
	// Validation error code
	Code int
	// Validation error reason description
	Reason string
	// Field name
	Field *string
}

Order validation error explained

func (*CoordinatorValidationError) Error

Error returns an error description.

func (*CoordinatorValidationError) ErrorName

func (e *CoordinatorValidationError) ErrorName() string

ErrorName returns "CoordinatorValidationError".

type CoordinatorValidationErrorResponse

type CoordinatorValidationErrorResponse struct {
	// General error code
	Code int
	// Error reason description
	Reason string
	// A list of explained validation errors.
	ValidationErrors []*CoordinatorValidationError
}

Error and description for bad requests.

func (*CoordinatorValidationErrorResponse) Error

Error returns an error description.

func (*CoordinatorValidationErrorResponse) ErrorName

ErrorName returns "CoordinatorValidationErrorResponse".

type Endpoints

type Endpoints struct {
	Configuration      goa.Endpoint
	RequestTransaction goa.Endpoint
	SoftCancels        goa.Endpoint
}

Endpoints wraps the "CoordinatorAPI" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "CoordinatorAPI" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "CoordinatorAPI" service endpoints.

type ExchangeDomain

type ExchangeDomain struct {
	// Address of the Injective Coordinator Contract.
	VerifyingContract string
	// Ethereum Chain ID of the transaction
	ChainID string
}

type FillSignatures

type FillSignatures struct {
	// EIP712 hash of order (see LibOrder.getTypedDataHash)
	OrderHash string
	// Array of signatures that correspond to the required signatures to execute
	// each order in the transaction
	ApprovalSignatures []string
	// Timestamp in seconds at which approval expires
	ExpirationTimeSeconds string
	// Desired amount of takerAsset to sell
	TakerAssetFillAmount string
}

type RequestTransactionPayload

type RequestTransactionPayload struct {
	// Signed 0x Transaction
	SignedTransaction *SignedTransaction
	// Address of Ethereum transaction signer that is allowed to execute this 0x
	// transaction
	TxOrigin string
}

RequestTransactionPayload is the payload type of the CoordinatorAPI service request_transaction method.

type RequestTransactionResult

type RequestTransactionResult struct {
	// when the signatures will expire and no longer be valid
	ExpirationTimeSeconds *string
	// the Coordinator signatures required to submit the 0x transaction
	Signatures []string
	// Information about the outstanding signatures to fill the order(s) that have
	// been soft-cancelled.
	OutstandingFillSignatures []*FillSignatures
	// An approval signature of the cancellation 0x transaction submitted to the
	// Coordinator (with the expiration hard-coded to 0 -- although these never
	// expire). These signatures can be used to prove that a soft-cancel was
	// granted for these order(s).
	CancellationSignatures []string
}

RequestTransactionResult is the result type of the CoordinatorAPI service request_transaction method.

type Service

type Service interface {
	// Retrieves the current coordinator configuration
	Configuration(context.Context, *ConfigurationPayload) (res *ConfigurationResult, err error)
	// Submit a signed 0x transaction encoding either a 0x fill or cancellation. If
	// the 0x transaction encodes a fill, the sender is requesting a Coordinator
	// signature required to fill the order(s) on-chain. If the 0x transaction
	// encodes an order(s) cancellation request, the sender is requesting the
	// included order(s) to be soft-cancelled by the Coordinator.
	RequestTransaction(context.Context, *RequestTransactionPayload) (res *RequestTransactionResult, err error)
	// Within the Coordinator model, the Coordinator server is the source-of-truth
	// when it comes to determining whether an order has been soft-cancelled. This
	// endpoint can be used to query whether a set of orders have been
	// soft-cancelled. The response returns the subset of orders that have been
	// soft-cancelled.
	SoftCancels(context.Context, *SoftCancelsPayload) (res *SoftCancelsResult, err error)
}

CoordinatorAPI implements a Standard Coordinator API v2.

type SignedTransaction

type SignedTransaction struct {
	// Arbitrary number to facilitate uniqueness of the transactions's hash.
	Salt string
	// Address of transaction signer
	SignerAddress string
	// The calldata that is to be executed. This must call an Exchange contract
	// method.
	Data string
	// Timestamp in seconds at which transaction expires.
	ExpirationTimeSeconds string
	// gasPrice that transaction is required to be executed with.
	GasPrice string
	// Exchange Domain specific values.
	Domain *ExchangeDomain
	// Signature of the 0x Transaction
	Signature string
}

type SoftCancelsPayload

type SoftCancelsPayload struct {
	// Specify Ethereum chain ID
	ChainID int64
	// The hashes of orders to be checked whether they can be soft-cancelled
	OrderHashes []string
}

SoftCancelsPayload is the payload type of the CoordinatorAPI service soft_cancels method.

type SoftCancelsResult

type SoftCancelsResult struct {
	// The subset of orders that have been soft-cancelled
	OrderHashes []string
}

SoftCancelsResult is the result type of the CoordinatorAPI service soft_cancels method.

Jump to

Keyboard shortcuts

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