diff --git a/src/protocol.rs b/src/protocol.rs index d267d73..36b634c 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -98,4 +98,6 @@ pub enum Event { ItemReceivedBid, /// A collection has received an offer. CollectionOffer, + /// A collection has received a trait offer. + TraitOffer, } diff --git a/src/schema.rs b/src/schema.rs index 9848040..ea3ab73 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -43,6 +43,8 @@ pub enum Payload { ItemReceivedBid(ItemReceivedBidData), /// A collection has received an offer. CollectionOffer(CollectionOfferData), + /// A collection has received a trait offer. + TraitOffer(TraitOfferData), } impl From for Event { @@ -56,6 +58,7 @@ impl From for Event { Payload::ItemReceivedOffer(_) => Event::ItemReceivedOffer, Payload::ItemReceivedBid(_) => Event::ItemReceivedBid, Payload::CollectionOffer(_) => Event::CollectionOffer, + Payload::TraitOffer(_) => Event::TraitOffer, } } } @@ -489,6 +492,42 @@ pub struct CollectionOfferData { pub asset_contract_criteria: serde_json::Value, } +/// Payload data for [`Payload::TraitOffer`]. +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct TraitOfferData { + /// Context + #[serde(flatten)] + pub context: Context, + + /// Timestamp of when the bid was received. + pub event_timestamp: DateTime, + /// Bid price. See `payment_token` for the actual value of each unit. + #[serde(with = "u256_fromstr_radix_10")] + pub base_price: U256, + /// Timestamp of when the bid was created. + pub created_date: DateTime, + /// Timestamp of when the bid will expire. + pub expiration_date: DateTime, + /// Creator of the bid. + #[serde(with = "address_fromjson")] + pub maker: Address, + /// Hash id of the listing. + pub order_hash: H256, + /// Token offered for payment. + pub payment_token: PaymentToken, + /// Number of items on the offer. This is always `1` for ERC-721 tokens. + pub quantity: u64, + /// Taker of the bid. + #[serde(with = "address_fromjson_opt", default)] + pub taker: Option
, + /// Collection criteria. + pub collection_criteria: serde_json::Value, + /// Asset contract criteria. + pub asset_contract_criteria: serde_json::Value, + /// Trait criteria. + pub trait_criteria: serde_json::Value, +} + /// Auctioning system used by the listing. #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "lowercase")]