Documentation ¶
Index ¶
Constants ¶
const ( ESInvalid = OrderEventEndState("INVALID") ESOrderAdded = OrderEventEndState("ADDED") ESOrderFilled = OrderEventEndState("FILLED") ESOrderFullyFilled = OrderEventEndState("FULLY_FILLED") ESOrderCancelled = OrderEventEndState("CANCELLED") ESOrderExpired = OrderEventEndState("EXPIRED") ESOrderUnexpired = OrderEventEndState("UNEXPIRED") // An order becomes unfunded if the maker transfers the balance / changes their // allowance backing an order ESOrderBecameUnfunded = OrderEventEndState("UNFUNDED") // Fillability for an order can increase if a previously processed fill event // gets reverted, or if a maker tops up their balance/allowance backing an order ESOrderFillabilityIncreased = OrderEventEndState("FILLABILITY_INCREASED") // Order is potentially still valid but was removed for a different reason // (e.g. the database is full or the peer that sent the order was // misbehaving). The order will no longer be watched and no further events for // this order will be emitted. In some cases, the order may be re-added in the // future. ESStoppedWatching = OrderEventEndState("STOPPED_WATCHING") )
OrderEventEndState values
const ERC1155AssetDataID = "a7cb5fb7"
ERC1155AssetDataID is the assetDataId for ERC721 tokens
const ERC20AssetDataID = "f47261b0"
ERC20AssetDataID is the assetDataId for ERC20 tokens
const ERC721AssetDataID = "02571792"
ERC721AssetDataID is the assetDataId for ERC721 tokens
const MultiAssetDataID = "94cfcdd7"
MultiAssetDataID is the assetDataId for multiAsset tokens
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetDataDecoder ¶
type AssetDataDecoder struct {
// contains filtered or unexported fields
}
AssetDataDecoder decodes 0x order asset data
func NewAssetDataDecoder ¶
func NewAssetDataDecoder() *AssetDataDecoder
NewAssetDataDecoder instantiates a new asset data decoder
func (*AssetDataDecoder) Decode ¶
func (a *AssetDataDecoder) Decode(assetData []byte, decodedAssetData interface{}) error
Decode decodes an encoded asset data into it's sub-components
type ContractEvent ¶
type ContractEvent struct { BlockHash common.Hash TxHash common.Hash TxIndex uint LogIndex uint IsRemoved bool Address common.Address Kind string Parameters interface{} }
ContractEvent is an event emitted by a smart contract
func (ContractEvent) MarshalJSON ¶
func (c ContractEvent) MarshalJSON() ([]byte, error)
MarshalJSON implements a custom JSON marshaller for the ContractEvent type
type ERC1155AssetData ¶
type ERC1155AssetData struct { Address common.Address Ids []*big.Int Values []*big.Int CallbackData []byte }
ERC1155AssetData represents an ERC1155 assetData
type ERC20AssetData ¶
ERC20AssetData represents an ERC20 assetData
type ERC721AssetData ¶
ERC721AssetData represents an ERC721 assetData
type MultiAssetData ¶
MultiAssetData represents an MultiAssetData
type Order ¶
type Order struct { MakerAddress common.Address `json:"makerAddress"` MakerAssetData []byte `json:"makerAssetData"` MakerAssetAmount *big.Int `json:"makerAssetAmount"` MakerFee *big.Int `json:"makerFee"` TakerAddress common.Address `json:"takerAddress"` TakerAssetData []byte `json:"takerAssetData"` TakerAssetAmount *big.Int `json:"takerAssetAmount"` TakerFee *big.Int `json:"takerFee"` SenderAddress common.Address `json:"senderAddress"` ExchangeAddress common.Address `json:"exchangeAddress"` FeeRecipientAddress common.Address `json:"feeRecipientAddress"` ExpirationTimeSeconds *big.Int `json:"expirationTimeSeconds"` Salt *big.Int `json:"salt"` // contains filtered or unexported fields }
Order represents an unsigned 0x order
func (*Order) ComputeOrderHash ¶
ComputeOrderHash computes a 0x order hash
type OrderEvent ¶
type OrderEvent struct { OrderHash common.Hash `json:"orderHash"` SignedOrder *SignedOrder `json:"signedOrder"` EndState OrderEventEndState `json:"endState"` FillableTakerAssetAmount *big.Int `json:"fillableTakerAssetAmount"` // All the contract events that triggered this orders re-evaluation. They did not // all necessarily cause the orders state change itself, only it's re-evaluation. // Since it's state _did_ change, at least one of them did cause the actual state change. ContractEvents []*ContractEvent `json:"contractEvents"` }
OrderEvent is the order event emitted by Mesh nodes on the "orders" topic when calling JSON-RPC method `mesh_subscribe`
func (OrderEvent) MarshalJSON ¶
func (o OrderEvent) MarshalJSON() ([]byte, error)
MarshalJSON implements a custom JSON marshaller for the OrderEvent type
func (*OrderEvent) UnmarshalJSON ¶
func (o *OrderEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements a custom JSON unmarshaller for the OrderEvent type
type OrderEventEndState ¶
type OrderEventEndState string
OrderEventEndState enumerates all the possible order event types. An OrderEventEndState describes the end state of a 0x order after revalidation
type OrderStatus ¶
type OrderStatus uint8
OrderStatus represents the status of an order as returned from the 0x smart contracts as part of OrderInfo
const ( OSInvalid OrderStatus = iota OSInvalidMakerAssetAmount OSInvalidTakerAssetAmount OSFillable OSExpired OSFullyFilled OSCancelled OSSignatureInvalid OSInvalidMakerAssetData OSInvalidTakerAssetData )
OrderStatus values
type SignatureType ¶
type SignatureType uint8
SignatureType represents the type of 0x signature encountered
const ( IllegalSignature SignatureType = iota InvalidSignature EIP712Signature EthSignSignature WalletSignature ValidatorSignature PreSignedSignature NSignatureTypesSignature )
SignatureType values
type SignedOrder ¶
SignedOrder represents a signed 0x order
func SignOrder ¶
func SignOrder(signer signer.Signer, order *Order) (*SignedOrder, error)
SignOrder signs the 0x order with the supplied Signer
func SignTestOrder ¶
func SignTestOrder(order *Order) (*SignedOrder, error)
SignTestOrder signs the 0x order with the local test signer
func (*SignedOrder) ConvertToOrderWithoutExchangeAddress ¶
func (s *SignedOrder) ConvertToOrderWithoutExchangeAddress() wrappers.OrderWithoutExchangeAddress
ConvertToOrderWithoutExchangeAddress re-formats a SignedOrder into the format expected by the 0x smart contracts.
func (SignedOrder) MarshalJSON ¶
func (s SignedOrder) MarshalJSON() ([]byte, error)
MarshalJSON implements a custom JSON marshaller for the SignedOrder type
func (*SignedOrder) UnmarshalJSON ¶
func (s *SignedOrder) UnmarshalJSON(data []byte) error
UnmarshalJSON implements a custom JSON unmarshaller for the SignedOrder type
type SignedOrderJSON ¶
type SignedOrderJSON struct { MakerAddress string `json:"makerAddress"` MakerAssetData string `json:"makerAssetData"` MakerAssetAmount string `json:"makerAssetAmount"` MakerFee string `json:"makerFee"` TakerAddress string `json:"takerAddress"` TakerAssetData string `json:"takerAssetData"` TakerAssetAmount string `json:"takerAssetAmount"` TakerFee string `json:"takerFee"` SenderAddress string `json:"senderAddress"` ExchangeAddress string `json:"exchangeAddress"` FeeRecipientAddress string `json:"feeRecipientAddress"` ExpirationTimeSeconds string `json:"expirationTimeSeconds"` Salt string `json:"salt"` Signature string `json:"signature"` }
SignedOrderJSON is an unmodified JSON representation of a SignedOrder