0x-mesh: github.com/0xProject/0x-mesh/common/types Index | Files

package types

import "github.com/0xProject/0x-mesh/common/types"

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


Package Files


func BytesToHex Uses

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 Uses

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.

type AddOrdersOpts Uses

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 Uses

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 Uses

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 Uses

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

type MiniHeader Uses

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 Uses

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 Uses

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

MarshalJSON is a custom Marshaler for OrderInfo

func (*OrderInfo) UnmarshalJSON Uses

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

UnmarshalJSON implements a custom JSON unmarshaller for the OrderEvent type

type OrderWithMetadata Uses

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 Uses

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

type SingleAssetData Uses

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

type Stats Uses

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.

Package types imports 9 packages (graph) and is imported by 5 packages. Updated 2020-09-30. Refresh now. Tools for package owners.