types

package
v0.0.0-...-613d1fa Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package types holds common types that are used across a variety of interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToHex

func BytesToHex(b []byte) string

BytesToHex converts the given slice of bytes to a hex string with a "0x" prefix. If b is nil or has length 0, it returns "0x".

func HexToBytes

func HexToBytes(s string) []byte

HexToBytes converts the the given hex string (with or without the "0x" prefix) to a slice of bytes. If the string is "0x" it returns nil.

Types

type AddOrdersOpts

type AddOrdersOpts struct {
	// Pinned determines whether or not the added orders should be pinned. Pinned
	// orders will not be affected by any DDoS prevention or incentive mechanisms
	// and will always stay in storage until they are no longer fillable. Defaults
	// to true.
	Pinned bool `json:"pinned"`
}

AddOrdersOpts is a set of options for core.AddOrders. Also used in the browser interface.

type GetOrdersResponse

type GetOrdersResponse struct {
	Timestamp   time.Time    `json:"timestamp"`
	OrdersInfos []*OrderInfo `json:"ordersInfos"`
}

GetOrdersResponse is the return value for core.GetOrders. Also used in the browser interface.

type LatestBlock

type LatestBlock struct {
	Number *big.Int    `json:"number"`
	Hash   common.Hash `json:"hash"`
}

LatestBlock is the latest block processed by the Mesh node.

type Metadata

type Metadata struct {
	EthereumChainID                   int
	EthRPCRequestsSentInCurrentUTCDay int
	StartOfCurrentUTCDay              time.Time
}

type MiniHeader

type MiniHeader struct {
	Hash      common.Hash `json:"hash"`
	Parent    common.Hash `json:"parent"`
	Number    *big.Int    `json:"number"`
	Timestamp time.Time   `json:"timestamp"`
	Logs      []types.Log `json:"logs"`
}

type OrderInfo

type OrderInfo struct {
	OrderHash                common.Hash         `json:"orderHash"`
	SignedOrder              *zeroex.SignedOrder `json:"signedOrder"`
	FillableTakerAssetAmount *big.Int            `json:"fillableTakerAssetAmount"`
}

OrderInfo represents an fillable order and how much it could be filled for.

func (OrderInfo) MarshalJSON

func (o OrderInfo) MarshalJSON() ([]byte, error)

MarshalJSON is a custom Marshaler for OrderInfo

func (*OrderInfo) UnmarshalJSON

func (o *OrderInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON implements a custom JSON unmarshaller for the OrderEvent type

type OrderWithMetadata

type OrderWithMetadata struct {
	Hash                     common.Hash    `json:"hash"`
	ChainID                  *big.Int       `json:"chainID"`
	ExchangeAddress          common.Address `json:"exchangeAddress"`
	MakerAddress             common.Address `json:"makerAddress"`
	MakerAssetData           []byte         `json:"makerAssetData"`
	MakerFeeAssetData        []byte         `json:"makerFeeAssetData"`
	MakerAssetAmount         *big.Int       `json:"makerAssetAmount"`
	MakerFee                 *big.Int       `json:"makerFee"`
	TakerAddress             common.Address `json:"takerAddress"`
	TakerAssetData           []byte         `json:"takerAssetData"`
	TakerFeeAssetData        []byte         `json:"takerFeeAssetData"`
	TakerAssetAmount         *big.Int       `json:"takerAssetAmount"`
	TakerFee                 *big.Int       `json:"takerFee"`
	SenderAddress            common.Address `json:"senderAddress"`
	FeeRecipientAddress      common.Address `json:"feeRecipientAddress"`
	ExpirationTimeSeconds    *big.Int       `json:"expirationTimeSeconds"`
	Salt                     *big.Int       `json:"salt"`
	Signature                []byte         `json:"signature"`
	FillableTakerAssetAmount *big.Int       `json:"fillableTakerAssetAmount"`
	LastUpdated              time.Time      `json:"lastUpdated"`
	// Was this order flagged for removal? Due to the possibility of block-reorgs, instead
	// of immediately removing an order when FillableTakerAssetAmount becomes 0, we instead
	// flag it for removal. After this order isn't updated for X time and has IsRemoved = true,
	// the order can be permanently deleted.
	IsRemoved bool `json:"isRemoved"`
	// IsPinned indicates whether or not the order is pinned. Pinned orders are
	// not removed from the database unless they become unfillable.
	IsPinned bool `json:"isPinned"`
	// JSON-encoded list of assetdatas contained in MakerAssetData. For non-MAP
	// orders, the list contains only one element which is equal to MakerAssetData.
	// For MAP orders, it contains each component assetdata.
	ParsedMakerAssetData []*SingleAssetData `json:"parsedMakerAssetData"`
	// Same as ParsedMakerAssetData but for MakerFeeAssetData instead of MakerAssetData.
	ParsedMakerFeeAssetData []*SingleAssetData `json:"parsedMakerFeeAssetData"`
	// LastValidatedBlockNumber is the block number at which the order was
	// last validated.
	LastValidatedBlockNumber *big.Int `json:"lastValidatedBlockNumber"`
	// LastValidatedBlockHash is the hash of the block at which the order was
	// last validated.
	LastValidatedBlockHash common.Hash `json:"lastValidatedBlockHash"`
}

func (OrderWithMetadata) SignedOrder

func (order OrderWithMetadata) SignedOrder() *zeroex.SignedOrder

type SingleAssetData

type SingleAssetData struct {
	Address common.Address `json:"address"`
	TokenID *big.Int       `json:"tokenID"`
}

type Stats

type Stats struct {
	Version                           string      `json:"version"`
	PubSubTopic                       string      `json:"pubSubTopic"`
	Rendezvous                        string      `json:"rendezvous"`
	SecondaryRendezvous               []string    `json:"secondaryRendezvous"`
	PeerID                            string      `json:"peerID"`
	EthereumChainID                   int         `json:"ethereumChainID"`
	LatestBlock                       LatestBlock `json:"latestBlock"`
	NumPeers                          int         `json:"numPeers"`
	NumOrders                         int         `json:"numOrders"`
	NumOrdersIncludingRemoved         int         `json:"numOrdersIncludingRemoved"`
	NumPinnedOrders                   int         `json:"numPinnedOrders"`
	MaxExpirationTime                 *big.Int    `json:"maxExpirationTime"`
	StartOfCurrentUTCDay              time.Time   `json:"startOfCurrentUTCDay"`
	EthRPCRequestsSentInCurrentUTCDay int         `json:"ethRPCRequestsSentInCurrentUTCDay"`
	EthRPCRateLimitExpiredRequests    int64       `json:"ethRPCRateLimitExpiredRequests"`
}

Stats is the return value for core.GetStats. Also used in the browser interface.

Jump to

Keyboard shortcuts

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