orderbook

package
v0.0.0-...-038b677 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 17 Imported by: 2

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var GenerateSalt = func() string {
	return fmt.Sprintf("%d", time.Now().UnixNano()/int64(time.Millisecond))
}

Functions

func ConfirmApprovalWithUser

func ConfirmApprovalWithUser(ethClient *ethclient.Client, publicAddress string, tokenAddress string) (bool, error)

func ConfirmLimitOrderWithUser

func ConfirmLimitOrderWithUser(order *Order, ethClient *ethclient.Client) (bool, error)

func CumulativeSum

func CumulativeSum(initial int) func(int) int

func GetInteractions

func GetInteractions(client *ethclient.Client, seriesNonceManager string, expiration int64, maker string, makerAsset string, permit string) ([]string, error)

func Trim0x

func Trim0x(data string) string

Types

type CountResponse

type CountResponse struct {
	Count int `json:"count"`
}

type CreateOrderParams

type CreateOrderParams struct {
	ApprovalType           onchain.ApprovalType
	ChainId                int
	PrivateKey             string
	ExpireAfter            int64
	Maker                  string
	MakerAsset             string
	TakerAsset             string
	TakingAmount           string
	MakingAmount           string
	Taker                  string
	SkipWarnings           bool
	FailIfApprovalIsNeeded bool
}

func (*CreateOrderParams) Validate

func (params *CreateOrderParams) Validate() error

type CreateOrderResponse

type CreateOrderResponse struct {
	Success bool `json:"success"`
}

type EventResponse

type EventResponse struct {
	Id                   int       `json:"id"`
	Network              int       `json:"network"`
	LogId                string    `json:"logId"`
	Version              int       `json:"version"`
	Action               string    `json:"action"`
	OrderHash            string    `json:"orderHash"`
	Taker                string    `json:"taker"`
	RemainingMakerAmount string    `json:"remainingMakerAmount"`
	TransactionHash      string    `json:"transactionHash"`
	BlockNumber          int       `json:"blockNumber"`
	CreateDateTime       time.Time `json:"createDateTime"`
}

type GetActiveOrdersWithPermitParams

type GetActiveOrdersWithPermitParams struct {
	ChainId int
	Wallet  string
	Token   string
}

func (*GetActiveOrdersWithPermitParams) Validate

func (params *GetActiveOrdersWithPermitParams) Validate() error

type GetAllOrdersParams

type GetAllOrdersParams struct {
	ChainId int
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams
}

func (*GetAllOrdersParams) Validate

func (params *GetAllOrdersParams) Validate() error

type GetCountParams

type GetCountParams struct {
	ChainId int
	LimitOrderV3SubscribedApiControllerGetAllOrdersCountParams
}

func (*GetCountParams) Validate

func (params *GetCountParams) Validate() error

type GetEventParams

type GetEventParams struct {
	ChainId   int
	OrderHash string
}

func (*GetEventParams) Validate

func (params *GetEventParams) Validate() error

type GetEventsParams

type GetEventsParams struct {
	ChainId int
	LimitOrderV3SubscribedApiControllerGetEventsParams
}

func (*GetEventsParams) Validate

func (params *GetEventsParams) Validate() error

type GetOrdersByCreatorAddressParams

type GetOrdersByCreatorAddressParams struct {
	ChainId        int
	CreatorAddress string
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams
}

func (*GetOrdersByCreatorAddressParams) Validate

func (params *GetOrdersByCreatorAddressParams) Validate() error

type LimitOrderV3Data

type LimitOrderV3Data struct {
	// AllowedSender An address of the wallet or contract who will be able to fill this order (equals to Zero address on public orders)
	AllowedSender string `json:"allowedSender,omitempty"`

	// Interactions Merged offsets of each field in interactions
	Interactions string `json:"interactions,omitempty"`

	// Maker An address of the maker (wallet or contract address)
	Maker string `json:"maker"`

	// MakerAsset Address of the maker asset
	MakerAsset string `json:"makerAsset"`

	// MakingAmount Order maker's token amount
	MakingAmount string `json:"makingAmount"`

	// Offsets An interaction call data. ABI encoded set of makerAssetData, takerAssetData, getMakingAmount, getTakingAmount, predicate, permit, preInteraction, postInteraction
	Offsets string `json:"offsets,omitempty"`

	// Receiver An address of the wallet or contract who will receive filled amount (equals to Zero address for receiver == makerAddress)
	Receiver string `json:"receiver,omitempty"`

	// Salt Some unique value. It is necessary to be able to create limit orders with the same parameters (so that they have a different hash)
	Salt string `json:"salt"`

	// TakerAsset Address of the taker asset
	TakerAsset string `json:"takerAsset"`

	// TakingAmount Order taker's token amount
	TakingAmount string `json:"takingAmount"`
}

LimitOrderV3Data defines model for LimitOrderV3Data.

type LimitOrderV3Request

type LimitOrderV3Request struct {
	// Data Limit order data
	Data LimitOrderV3Data `json:"data"`

	// OrderHash Hash of the limit order typed data
	OrderHash string `json:"orderHash"`

	// Signature Signature of the limit order typed data (using signTypedData_v4)
	Signature string `json:"signature"`
}

LimitOrderV3Request defines model for LimitOrderV3Request.

type LimitOrderV3SubscribedApiControllerCreateLimitOrderJSONRequestBody

type LimitOrderV3SubscribedApiControllerCreateLimitOrderJSONRequestBody = LimitOrderV3Request

LimitOrderV3SubscribedApiControllerCreateLimitOrderJSONRequestBody defines body for LimitOrderV3SubscribedApiControllerCreateLimitOrder for application/json ContentType.

type LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams

type LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams struct {
	// Page Pagination step, default: 1 (page = offset / limit)
	Page float32 `url:"page,omitempty" json:"page,omitempty"`

	// Limit Number of limit orders to receive (default: 100, max: 500)
	Limit float32 `url:"limit,omitempty" json:"limit,omitempty"`

	// Statuses JSON an array of statuses by which limit orders will be filtered: 1 - valid limit orders, 2 - temporary invalid limit orders, 3 - invalid limit orders
	Statuses []float32                                                        `url:"statuses,omitempty" json:"statuses,omitempty"`
	SortBy   LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy `url:"sortBy,omitempty" json:"sortBy,omitempty"`

	// TakerAsset Address of the maker asset
	TakerAsset string `url:"takerAsset,omitempty" json:"takerAsset,omitempty"`

	// MakerAsset Address of the maker asset
	MakerAsset string `url:"makerAsset,omitempty" json:"makerAsset,omitempty"`
}

LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams defines parameters for LimitOrderV3SubscribedApiControllerGetAllLimitOrders.

type LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy

type LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy string

LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy defines parameters for LimitOrderV3SubscribedApiControllerGetAllLimitOrders.

const (
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByCreateDateTime LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "createDateTime"
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByMakerAmount    LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "makerAmount"
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByMakerRate      LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "makerRate"
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByTakerAmount    LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "takerAmount"
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByTakerRate      LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "takerRate"
)

Defines values for LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy.

type LimitOrderV3SubscribedApiControllerGetAllOrdersCountParams

type LimitOrderV3SubscribedApiControllerGetAllOrdersCountParams struct {
	Statuses []string `url:"statuses" json:"statuses"`
}

LimitOrderV3SubscribedApiControllerGetAllOrdersCountParams defines parameters for LimitOrderV3SubscribedApiControllerGetAllOrdersCount.

type LimitOrderV3SubscribedApiControllerGetEventsParams

type LimitOrderV3SubscribedApiControllerGetEventsParams struct {
	Limit float32 `url:"limit" json:"limit"`
}

LimitOrderV3SubscribedApiControllerGetEventsParams defines parameters for LimitOrderV3SubscribedApiControllerGetEvents.

type LimitOrderV3SubscribedApiControllerGetLimitOrderParams

type LimitOrderV3SubscribedApiControllerGetLimitOrderParams struct {
	// Page Pagination step, default: 1 (page = offset / limit)
	Page float32 `url:"page,omitempty" json:"page,omitempty"`

	// Limit Number of limit orders to receive (default: 100, max: 500)
	Limit float32 `url:"limit,omitempty" json:"limit,omitempty"`

	// Statuses JSON an array of statuses by which limit orders will be filtered: 1 - valid limit orders, 2 - temporary invalid limit orders, 3 - invalid limit orders
	Statuses []float32                                                    `url:"statuses,omitempty" json:"statuses,omitempty"`
	SortBy   LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy `url:"sortBy,omitempty" json:"sortBy,omitempty"`

	// TakerAsset Address of the taker asset
	TakerAsset string `url:"takerAsset,omitempty" json:"takerAsset,omitempty"`

	// MakerAsset Address of the maker asset
	MakerAsset string `url:"makerAsset,omitempty" json:"makerAsset,omitempty"`
}

LimitOrderV3SubscribedApiControllerGetLimitOrderParams defines parameters for LimitOrderV3SubscribedApiControllerGetLimitOrder.

type LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy

type LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy string

LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy defines parameters for LimitOrderV3SubscribedApiControllerGetLimitOrder.

const (
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByCreateDateTime LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "createDateTime"
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByMakerAmount    LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "makerAmount"
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByMakerRate      LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "makerRate"
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByTakerAmount    LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "takerAmount"
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByTakerRate      LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "takerRate"
)

Defines values for LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy.

type Order

type Order struct {
	OrderHash string    `json:"orderHash"`
	Signature string    `json:"signature"`
	Data      OrderData `json:"data"`
}

func CreateLimitOrderMessage

func CreateLimitOrderMessage(orderRequest CreateOrderParams, interactions []string) (*Order, error)

type OrderData

type OrderData struct {
	MakerAsset    string `json:"makerAsset"`
	TakerAsset    string `json:"takerAsset"`
	MakingAmount  string `json:"makingAmount"`
	TakingAmount  string `json:"takingAmount"`
	Salt          string `json:"salt"`
	Maker         string `json:"maker"`
	AllowedSender string `json:"allowedSender"`
	Receiver      string `json:"receiver"`
	Offsets       string `json:"offsets"`
	Interactions  string `json:"interactions"`
}

type OrderResponse

type OrderResponse struct {
	Signature            string    `json:"signature"`
	OrderHash            string    `json:"orderHash"`
	CreateDateTime       time.Time `json:"createDateTime"`
	RemainingMakerAmount string    `json:"remainingMakerAmount"`
	MakerBalance         string    `json:"makerBalance"`
	MakerAllowance       string    `json:"makerAllowance"`
	Data                 struct {
		MakerAsset    string `json:"makerAsset"`
		TakerAsset    string `json:"takerAsset"`
		Salt          string `json:"salt"`
		Receiver      string `json:"receiver"`
		AllowedSender string `json:"allowedSender"`
		MakingAmount  string `json:"makingAmount"`
		TakingAmount  string `json:"takingAmount"`
		Maker         string `json:"maker"`
		Interactions  string `json:"interactions"`
		Offsets       string `json:"offsets"`
	} `json:"data"`
	MakerRate          string      `json:"makerRate"`
	TakerRate          string      `json:"takerRate"`
	IsMakerContract    bool        `json:"isMakerContract"`
	OrderInvalidReason interface{} `json:"orderInvalidReason"`
}

Jump to

Keyboard shortcuts

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