Skip to content

Commit 73efccc

Browse files
authored
Add trait criteria types (#495)
* Add trait criteria types * more types * 0.2.3
1 parent 3d3067b commit 73efccc

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ yarn-error.log*
1818
# Yarn Integrity file
1919
.yarn-integrity
2020

21+
# Examples
22+
examples/
2123

package-lock.json

Lines changed: 2 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opensea/stream-js",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"description": "A TypeScript SDK to receive pushed updates from OpenSea over websocket",
55
"license": "MIT",
66
"author": "OpenSea Developers",

src/types.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ export type PaymentToken = {
109109
usd_price: string;
110110
};
111111

112+
export type AssetContractCriteria = {
113+
address: string;
114+
};
115+
116+
export type CollectionIdentifier = {
117+
slug: string;
118+
};
119+
112120
export interface ItemListedEventPayload extends Payload {
113121
quantity: number;
114122
listing_type: string;
@@ -213,14 +221,19 @@ export interface CollectionOfferEventPayload extends Payload {
213221
base_price: string;
214222
order_hash: string;
215223
payment_token: PaymentToken;
216-
collection_criteria: object;
217-
asset_contract_criteria: object;
224+
collection_criteria: CollectionIdentifier;
225+
asset_contract_criteria: AssetContractCriteria;
218226
event_timestamp: string;
219227
}
220228

221229
export type CollectionOfferEvent =
222230
BaseStreamMessage<CollectionOfferEventPayload>;
223231

232+
export type TraitCriteria = {
233+
trait_type: string;
234+
trait_name: string;
235+
};
236+
224237
export interface TraitOfferEventPayload extends Payload {
225238
quantity: number;
226239
created_date: string;
@@ -230,9 +243,10 @@ export interface TraitOfferEventPayload extends Payload {
230243
base_price: string;
231244
order_hash: string;
232245
payment_token: PaymentToken;
233-
collection_criteria: object;
234-
asset_contract_criteria: object;
235-
trait_criteria: object;
246+
collection_criteria: CollectionIdentifier;
247+
asset_contract_criteria: AssetContractCriteria;
248+
trait_criteria?: TraitCriteria;
249+
trait_criteria_list?: TraitCriteria[];
236250
event_timestamp: string;
237251
}
238252

0 commit comments

Comments
 (0)