orderfilter

package
v0.0.0-...-a40744b Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// DefaultCustomOrderSchema is the default schema for /customOrder. It
	// includes all 0x orders and doesn't add any additional requirements.
	DefaultCustomOrderSchema = `{}`
)

Variables

This section is empty.

Functions

func GetDefaultTopic

func GetDefaultTopic(chainID int, contractAddresses ethereum.ContractAddresses) (string, error)

func GetDefaultTopicV4

func GetDefaultTopicV4(chainID int, contractAddresses ethereum.ContractAddresses) (string, error)

Types

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

func GetDefaultFilter

func GetDefaultFilter(chainID int, contractAddresses ethereum.ContractAddresses) (*Filter, error)

func New

func New(chainID int, customOrderSchema string, contractAddresses ethereum.ContractAddresses) (*Filter, error)

TODO(jalextowle): We do not need `contractAddresses` since we only use `contractAddresses.Exchange`. In a future refactor, we should update this interface.

func NewFromTopic

func NewFromTopic(topic string, contractAddresses ethereum.ContractAddresses) (*Filter, error)

func (*Filter) MarshalJSON

func (f *Filter) MarshalJSON() ([]byte, error)

func (*Filter) MatchOrder

func (f *Filter) MatchOrder(order *zeroex.SignedOrder) (bool, error)

MatchOrder returns true if the order passes the filter. It only returns an error if there was a problem with validation. For details about orders that do not pass the filter, use ValidateOrder.

func (*Filter) MatchOrderMessageJSON

func (f *Filter) MatchOrderMessageJSON(messageJSON []byte) (bool, error)

func (*Filter) Rendezvous

func (f *Filter) Rendezvous() string

func (*Filter) Topic

func (f *Filter) Topic() string

func (*Filter) TopicV4

func (f *Filter) TopicV4() string

func (*Filter) UnmarshalJSON

func (f *Filter) UnmarshalJSON(data []byte) error

func (*Filter) ValidateOrder

func (f *Filter) ValidateOrder(order *zeroex.SignedOrder) (*jsonschema.Result, error)

func (*Filter) ValidateOrderJSON

func (f *Filter) ValidateOrderJSON(orderJSON []byte) (*jsonschema.Result, error)

func (*Filter) ValidateOrderJSONV4

func (f *Filter) ValidateOrderJSONV4(orderJSON []byte) (*jsonschema.Result, error)

func (*Filter) ValidatePubSubMessage

func (f *Filter) ValidatePubSubMessage(ctx context.Context, sender peer.ID, msg *pubsub.Message) bool

ValidatePubSubMessage is an implementation of pubsub.Validator and will return true if the contents of the message pass the message JSON Schema.

type WrongTopicVersionError

type WrongTopicVersionError struct {
	// contains filtered or unexported fields
}

func (WrongTopicVersionError) Error

func (e WrongTopicVersionError) Error() string

Jump to

Keyboard shortcuts

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