Documentation
¶
Index ¶
- Constants
- Variables
- func MakeInternal(err error) *goa.ServiceError
- func MakeNotFound(err error) *goa.ServiceError
- func NewGetAccountEndpoint(s Service) goa.Endpoint
- func NewGetActiveOrderEndpoint(s Service) goa.Endpoint
- func NewGetArchiveOrderEndpoint(s Service) goa.Endpoint
- func NewGetOnlineAccountsEndpoint(s Service) goa.Endpoint
- func NewGetTradePairEndpoint(s Service) goa.Endpoint
- func NewListDerivativeMarketsEndpoint(s Service) goa.Endpoint
- func NewListOrdersEndpoint(s Service) goa.Endpoint
- func NewListTradePairsEndpoint(s Service) goa.Endpoint
- type Client
- func (c *Client) GetAccount(ctx context.Context, p *GetAccountPayload) (res *GetAccountResult, err error)
- func (c *Client) GetActiveOrder(ctx context.Context, p *GetActiveOrderPayload) (res *GetActiveOrderResult, err error)
- func (c *Client) GetArchiveOrder(ctx context.Context, p *GetArchiveOrderPayload) (res *GetArchiveOrderResult, err error)
- func (c *Client) GetOnlineAccounts(ctx context.Context, p *GetOnlineAccountsPayload) (res *GetOnlineAccountsResult, err error)
- func (c *Client) GetTradePair(ctx context.Context, p *GetTradePairPayload) (res *GetTradePairResult, err error)
- func (c *Client) ListDerivativeMarkets(ctx context.Context) (res *ListDerivativeMarketsResult, err error)
- func (c *Client) ListOrders(ctx context.Context, p *ListOrdersPayload) (res *ListOrdersResult, err error)
- func (c *Client) ListTradePairs(ctx context.Context, p *ListTradePairsPayload) (res *ListTradePairsResult, err error)
- type DerivativeMarket
- type Endpoints
- type GetAccountPayload
- type GetAccountResult
- type GetActiveOrderPayload
- type GetActiveOrderResult
- type GetArchiveOrderPayload
- type GetArchiveOrderResult
- type GetOnlineAccountsPayload
- type GetOnlineAccountsResult
- type GetTradePairPayload
- type GetTradePairResult
- type ListDerivativeMarketsResult
- type ListOrdersPayload
- type ListOrdersResult
- type ListTradePairsPayload
- type ListTradePairsResult
- type Order
- type RESTValidationError
- type RESTValidationErrorResponse
- type RelayerAccount
- type Service
- type TradePair
Constants ¶
const ServiceName = "RestAPI"
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 ¶
var MethodNames = [8]string{"getActiveOrder", "getArchiveOrder", "listOrders", "getTradePair", "listTradePairs", "listDerivativeMarkets", "getAccount", "getOnlineAccounts"}
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 NewGetAccountEndpoint ¶
NewGetAccountEndpoint returns an endpoint function that calls the method "getAccount" of service "RestAPI".
func NewGetActiveOrderEndpoint ¶
NewGetActiveOrderEndpoint returns an endpoint function that calls the method "getActiveOrder" of service "RestAPI".
func NewGetArchiveOrderEndpoint ¶
NewGetArchiveOrderEndpoint returns an endpoint function that calls the method "getArchiveOrder" of service "RestAPI".
func NewGetOnlineAccountsEndpoint ¶
NewGetOnlineAccountsEndpoint returns an endpoint function that calls the method "getOnlineAccounts" of service "RestAPI".
func NewGetTradePairEndpoint ¶
NewGetTradePairEndpoint returns an endpoint function that calls the method "getTradePair" of service "RestAPI".
func NewListDerivativeMarketsEndpoint ¶
NewListDerivativeMarketsEndpoint returns an endpoint function that calls the method "listDerivativeMarkets" of service "RestAPI".
func NewListOrdersEndpoint ¶
NewListOrdersEndpoint returns an endpoint function that calls the method "listOrders" of service "RestAPI".
func NewListTradePairsEndpoint ¶
NewListTradePairsEndpoint returns an endpoint function that calls the method "listTradePairs" of service "RestAPI".
Types ¶
type Client ¶
type Client struct {
GetActiveOrderEndpoint goa.Endpoint
GetArchiveOrderEndpoint goa.Endpoint
ListOrdersEndpoint goa.Endpoint
GetTradePairEndpoint goa.Endpoint
ListTradePairsEndpoint goa.Endpoint
ListDerivativeMarketsEndpoint goa.Endpoint
GetAccountEndpoint goa.Endpoint
GetOnlineAccountsEndpoint goa.Endpoint
}
Client is the "RestAPI" service client.
func NewClient ¶
func NewClient(getActiveOrder, getArchiveOrder, listOrders, getTradePair, listTradePairs, listDerivativeMarkets, getAccount, getOnlineAccounts goa.Endpoint) *Client
NewClient initializes a "RestAPI" service client given the endpoints.
func (*Client) GetAccount ¶
func (c *Client) GetAccount(ctx context.Context, p *GetAccountPayload) (res *GetAccountResult, err error)
GetAccount calls the "getAccount" endpoint of the "RestAPI" service.
func (*Client) GetActiveOrder ¶
func (c *Client) GetActiveOrder(ctx context.Context, p *GetActiveOrderPayload) (res *GetActiveOrderResult, err error)
GetActiveOrder calls the "getActiveOrder" endpoint of the "RestAPI" service.
func (*Client) GetArchiveOrder ¶
func (c *Client) GetArchiveOrder(ctx context.Context, p *GetArchiveOrderPayload) (res *GetArchiveOrderResult, err error)
GetArchiveOrder calls the "getArchiveOrder" endpoint of the "RestAPI" service.
func (*Client) GetOnlineAccounts ¶
func (c *Client) GetOnlineAccounts(ctx context.Context, p *GetOnlineAccountsPayload) (res *GetOnlineAccountsResult, err error)
GetOnlineAccounts calls the "getOnlineAccounts" endpoint of the "RestAPI" service.
func (*Client) GetTradePair ¶
func (c *Client) GetTradePair(ctx context.Context, p *GetTradePairPayload) (res *GetTradePairResult, err error)
GetTradePair calls the "getTradePair" endpoint of the "RestAPI" service.
func (*Client) ListDerivativeMarkets ¶
func (c *Client) ListDerivativeMarkets(ctx context.Context) (res *ListDerivativeMarketsResult, err error)
ListDerivativeMarkets calls the "listDerivativeMarkets" endpoint of the "RestAPI" service.
func (*Client) ListOrders ¶
func (c *Client) ListOrders(ctx context.Context, p *ListOrdersPayload) (res *ListOrdersResult, err error)
ListOrders calls the "listOrders" endpoint of the "RestAPI" service.
func (*Client) ListTradePairs ¶
func (c *Client) ListTradePairs(ctx context.Context, p *ListTradePairsPayload) (res *ListTradePairsResult, err error)
ListTradePairs calls the "listTradePairs" endpoint of the "RestAPI" service.
type DerivativeMarket ¶
type DerivativeMarket struct {
// Ticker for the derivative contract.
Ticker string
// Address of the oracle for the derivative contract
Oracle string
// Address of the base currency for the derivative contract
BaseCurrency string
// Random number to faciltate uniqueness of the derivative market ID
Nonce string
// MarketID identifying the market.
MarketID string
// If false, then the pair is suspended and trades cannot be made.
Enabled bool
}
An object describing a derivative market in the Injective Futures Protocol.
type Endpoints ¶
type Endpoints struct {
GetActiveOrder goa.Endpoint
GetArchiveOrder goa.Endpoint
ListOrders goa.Endpoint
GetTradePair goa.Endpoint
ListTradePairs goa.Endpoint
ListDerivativeMarkets goa.Endpoint
GetAccount goa.Endpoint
GetOnlineAccounts goa.Endpoint
}
Endpoints wraps the "RestAPI" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "RestAPI" service with endpoints.
type GetAccountPayload ¶
type GetAccountPayload struct {
// Address of the relayer account.
Address string
}
GetAccountPayload is the payload type of the RestAPI service getAccount method.
type GetAccountResult ¶
type GetAccountResult struct {
RLimitLimit *string
RLimitRemaining *string
RLimitReset *string
// Found relayer account.
Account *RelayerAccount
// Additional meta data.
MetaData interface{}
}
GetAccountResult is the result type of the RestAPI service getAccount method.
type GetActiveOrderPayload ¶
type GetActiveOrderPayload struct {
// The hash of the desired 0x order.
OrderHash string
}
GetActiveOrderPayload is the payload type of the RestAPI service getActiveOrder method.
type GetActiveOrderResult ¶
type GetActiveOrderResult struct {
RLimitLimit *string
RLimitRemaining *string
RLimitReset *string
// Found active 0x order.
Order *Order
// Additional meta data.
MetaData interface{}
}
GetActiveOrderResult is the result type of the RestAPI service getActiveOrder method.
type GetArchiveOrderPayload ¶
type GetArchiveOrderPayload struct {
// The hash of the desired 0x order.
OrderHash string
}
GetArchiveOrderPayload is the payload type of the RestAPI service getArchiveOrder method.
type GetArchiveOrderResult ¶
type GetArchiveOrderResult struct {
RLimitLimit *string
RLimitRemaining *string
RLimitReset *string
// Order item.
Order *Order
// Additional meta data.
MetaData map[string]string
}
GetArchiveOrderResult is the result type of the RestAPI service getArchiveOrder method.
type GetOnlineAccountsPayload ¶
type GetOnlineAccountsPayload struct {
// Specify a version to filter online accounts with this logic version.
Version *string
// Specify a threshold in seconds to filter online accounts within a period of
// time.
Threshold *int64
}
GetOnlineAccountsPayload is the payload type of the RestAPI service getOnlineAccounts method.
type GetOnlineAccountsResult ¶
type GetOnlineAccountsResult struct {
RLimitLimit *string
RLimitRemaining *string
RLimitReset *string
// Filtered online relayer accounts.
Accounts []*RelayerAccount
// Additional meta data.
MetaData interface{}
}
GetOnlineAccountsResult is the result type of the RestAPI service getOnlineAccounts method.
type GetTradePairPayload ¶
type GetTradePairPayload struct {
// Specify name of the trade pair.
Name *string
// Most effective way is to specify hash of the trade pair.
Hash *string
// ABIv2 encoded data that can be decoded by a specified proxy contract when
// transferring makerAsset.
MakerAssetData *string
// ABIv2 encoded data that can be decoded by a specified proxy contract when
// transferring takerAsset.
TakerAssetData *string
}
GetTradePairPayload is the payload type of the RestAPI service getTradePair method.
type GetTradePairResult ¶
type GetTradePairResult struct {
RLimitLimit *string
RLimitRemaining *string
RLimitReset *string
// Found trade pair.
TradePair *TradePair
// Additional meta data.
MetaData interface{}
}
GetTradePairResult is the result type of the RestAPI service getTradePair method.
type ListDerivativeMarketsResult ¶
type ListDerivativeMarketsResult struct {
RLimitLimit *string
RLimitRemaining *string
RLimitReset *string
// Derivative Markets.
Markets []*DerivativeMarket
}
ListDerivativeMarketsResult is the result type of the RestAPI service listDerivativeMarkets method.
type ListOrdersPayload ¶
type ListOrdersPayload struct {
// Filter by status of the order
Status *string
// Filter by collection of the order
Collection *string
// Filter by trade pair hash
TradePairHash *string
// Enabled sort by VDF (1 = asc, -1 = desc)
SortByVdf *int32
// Limits the amout of results by top N
Limit *int32
}
ListOrdersPayload is the payload type of the RestAPI service listOrders method.
type ListOrdersResult ¶
type ListOrdersResult struct {
RLimitLimit *string
RLimitRemaining *string
RLimitReset *string
// Filtered orders.
Orders []*Order
// Additional meta data.
MetaData interface{}
}
ListOrdersResult is the result type of the RestAPI service listOrders method.
type ListTradePairsPayload ¶
type ListTradePairsPayload struct {
// Specify to include all trade pairs, suspended and active.
All *bool
}
ListTradePairsPayload is the payload type of the RestAPI service listTradePairs method.
type ListTradePairsResult ¶
type ListTradePairsResult struct {
RLimitLimit *string
RLimitRemaining *string
RLimitReset *string
// Filtered trade pairs.
TradePairs []*TradePair
// Additional meta data.
MetaData interface{}
}
ListTradePairsResult is the result type of the RestAPI service listTradePairs method.
type Order ¶
type Order struct {
// Specify chain ID.
ChainID int64
// Exchange v3 contract address.
ExchangeAddress string
// Address that created the order.
MakerAddress string
// Address that is allowed to fill the order. If set to 0, any address is
// allowed to fill the order.
TakerAddress string
// Address that will receive fees when order is filled.
FeeRecipientAddress string
// Address that is allowed to call Exchange contract methods that affect this
// order. If set to 0, any address is allowed to call these methods.
SenderAddress string
// Amount of makerAsset being offered by maker. Must be greater than 0.
MakerAssetAmount string
// Amount of takerAsset being bid on by maker. Must be greater than 0.
TakerAssetAmount string
// Amount of ZRX paid to feeRecipient by maker when order is filled. If set to
// 0, no transfer of ZRX from maker to feeRecipient will be attempted.
MakerFee string
// Amount of ZRX paid to feeRecipient by taker when order is filled. If set to
// 0, no transfer of ZRX from taker to feeRecipient will be attempted.
TakerFee string
// Timestamp in seconds at which order expires.
ExpirationTimeSeconds string
// Arbitrary number to facilitate uniqueness of the order's hash.
Salt string
// ABIv2 encoded data that can be decoded by a specified proxy contract when
// transferring makerAsset.
MakerAssetData string
// ABIv2 encoded data that can be decoded by a specified proxy contract when
// transferring takerAsset.
TakerAssetData string
// ABIv2 encoded data that can be decoded by a specified proxy contract when
// transferring makerFee.
MakerFeeAssetData string
// ABIv2 encoded data that can be decoded by a specified proxy contract when
// transferring takerFee.
TakerFeeAssetData string
// Order signature.
Signature string
}
A valid signed 0x order based on the schema.
type RESTValidationError ¶
type RESTValidationError struct {
// Validation error code
Code int
// Validation error reason description
Reason string
// Field name
Field *string
}
Order validation error explained
func (*RESTValidationError) Error ¶
func (e *RESTValidationError) Error() string
Error returns an error description.
func (*RESTValidationError) ErrorName ¶
func (e *RESTValidationError) ErrorName() string
ErrorName returns "RESTValidationError".
type RESTValidationErrorResponse ¶
type RESTValidationErrorResponse struct {
// General error code
Code int
// Error reason description
Reason string
// A list of explained validation errors.
ValidationErrors []*RESTValidationError
}
Error and description for bad requests.
func (*RESTValidationErrorResponse) Error ¶
func (e *RESTValidationErrorResponse) Error() string
Error returns an error description.
func (*RESTValidationErrorResponse) ErrorName ¶
func (e *RESTValidationErrorResponse) ErrorName() string
ErrorName returns "RESTValidationErrorResponse".
type RelayerAccount ¶
type RelayerAccount struct {
// Cosmos address of the relayer account.
Address string
// Ethereum address associated with this relayer account.
StakerAddress *string
// Public key of the relayer account, as hex string.
PublicKey string
// Timestamp in UNIX seconds of the last time seen.
LastSeen int64
// Last logic version seen.
LastVersion string
// A flag of liveness status of the account. Must be considered with lastSeen
// timestamp.
IsOnline bool
}
A relayer account that enhances Cosmos Account with liveness info.
type Service ¶
type Service interface {
// Retrieves an active 0x order with meta info that is associated with the hash.
GetActiveOrder(context.Context, *GetActiveOrderPayload) (res *GetActiveOrderResult, err error)
// Retrieves an archive 0x order with meta info that is associated with the
// hash.
GetArchiveOrder(context.Context, *GetArchiveOrderPayload) (res *GetArchiveOrderResult, err error)
// Retrieves a list of 0x orders matching the filtering rules.
ListOrders(context.Context, *ListOrdersPayload) (res *ListOrdersResult, err error)
// Retrieves a trade pair by name or hash.
GetTradePair(context.Context, *GetTradePairPayload) (res *GetTradePairResult, err error)
// Retrieves a list trade pairs.
ListTradePairs(context.Context, *ListTradePairsPayload) (res *ListTradePairsResult, err error)
// Retrieves a list derivative markets.
ListDerivativeMarkets(context.Context) (res *ListDerivativeMarketsResult, err error)
// Retrieves a relayer account by address.
GetAccount(context.Context, *GetAccountPayload) (res *GetAccountResult, err error)
// Retrieves online relayer accounts only.
GetOnlineAccounts(context.Context, *GetOnlineAccountsPayload) (res *GetOnlineAccountsResult, err error)
}
RestAPI implements misc API methods for external clients. Not part of any standard (yet).
type TradePair ¶
type TradePair struct {
// A name of the pair in format AAA/BBB, where AAA - maker's asset, BBB -
// taker's asset.
Name string
// ABIv2 encoded data that can be decoded by a specified proxy contract when
// transferring makerAsset.
MakerAssetData string
// ABIv2 encoded data that can be decoded by a specified proxy contract when
// transferring takerAsset.
TakerAssetData string
// Hash of both asset data, to identify the trading pair in store.
Hash string
// If false, then the pair is suspended and trades cannot be made.
Enabled bool
}
An object describing trade pair of two assets.