@opensea/sdk 11.9.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/lib/api/types.d.ts +20 -64
- package/lib/api/types.js.map +1 -1
- package/lib/api/walletAuth.d.ts +95 -8
- package/lib/api/walletAuth.js +75 -6
- package/lib/api/walletAuth.js.map +1 -1
- package/lib/orders/attribution.d.ts +18 -0
- package/lib/orders/attribution.js +29 -0
- package/lib/orders/attribution.js.map +1 -0
- package/lib/orders/types.d.ts +16 -28
- package/lib/orders/types.js.map +1 -1
- package/lib/scopes.d.ts +1 -0
- package/lib/scopes.js +1 -0
- package/lib/scopes.js.map +1 -1
- package/lib/sdk/fulfillment.js +7 -3
- package/lib/sdk/fulfillment.js.map +1 -1
- package/lib/stream/client.d.ts +14 -1
- package/lib/stream/client.js +39 -22
- package/lib/stream/client.js.map +1 -1
- package/lib/stream/types.d.ts +32 -63
- package/lib/stream/types.js +7 -0
- package/lib/stream/types.js.map +1 -1
- package/package.json +2 -2
- package/src/api/types.ts +27 -64
- package/src/api/walletAuth.ts +100 -13
- package/src/orders/attribution.ts +29 -0
- package/src/orders/types.ts +21 -44
- package/src/scopes.ts +1 -0
- package/src/sdk/fulfillment.ts +8 -3
- package/src/stream/client.ts +45 -23
- package/src/stream/types.ts +39 -64
package/lib/stream/client.d.ts
CHANGED
|
@@ -20,8 +20,10 @@ export declare class OpenSeaStreamClient {
|
|
|
20
20
|
private logLevel;
|
|
21
21
|
private onEvent;
|
|
22
22
|
constructor({ network, apiKey, token, apiUrl, connectOptions, logLevel, onError, onEvent, }: ClientConfig);
|
|
23
|
+
private log;
|
|
23
24
|
private debug;
|
|
24
25
|
private info;
|
|
26
|
+
private warn;
|
|
25
27
|
private error;
|
|
26
28
|
connect: () => void;
|
|
27
29
|
disconnect: (callback?: () => void) => void;
|
|
@@ -31,7 +33,18 @@ export declare class OpenSeaStreamClient {
|
|
|
31
33
|
onItemListed: (collectionSlug: string, callback: Callback<ItemListedEvent>) => () => void;
|
|
32
34
|
onItemSold: (collectionSlug: string, callback: Callback<ItemSoldEvent>) => () => void;
|
|
33
35
|
onItemTransferred: (collectionSlug: string, callback: Callback<ItemTransferredEvent>) => () => void;
|
|
34
|
-
|
|
36
|
+
/**
|
|
37
|
+
* No-op. The Stream API does not emit `item_received_offer` and never has, so
|
|
38
|
+
* this only ever registered a handler that could not fire. Item-level offers
|
|
39
|
+
* arrive as `item_received_bid`, so use {@link onItemReceivedBid} instead.
|
|
40
|
+
*
|
|
41
|
+
* Kept callable, and kept from opening a connection for a topic that yields
|
|
42
|
+
* nothing, so existing call sites keep compiling and running unchanged.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Use {@link onItemReceivedBid}. This does nothing.
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
47
|
+
onItemReceivedOffer: (_collectionSlug: string, _callback: Callback<ItemReceivedOfferEvent>) => () => void;
|
|
35
48
|
onItemReceivedBid: (collectionSlug: string, callback: Callback<ItemReceivedBidEvent>) => () => void;
|
|
36
49
|
onCollectionOffer: (collectionSlug: string, callback: Callback<CollectionOfferEvent>) => () => void;
|
|
37
50
|
onTraitOffer: (collectionSlug: string, callback: Callback<TraitOfferEvent>) => () => void;
|
package/lib/stream/client.js
CHANGED
|
@@ -42,20 +42,36 @@ class OpenSeaStreamClient {
|
|
|
42
42
|
});
|
|
43
43
|
this.transport.onError(onError ?? (error => this.error(error)));
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
if (this.logLevel
|
|
47
|
-
|
|
45
|
+
log(level, message) {
|
|
46
|
+
if (this.logLevel > level) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
switch (level) {
|
|
50
|
+
case types_1.LogLevel.DEBUG:
|
|
51
|
+
console.debug("[DEBUG]:", message);
|
|
52
|
+
break;
|
|
53
|
+
case types_1.LogLevel.INFO:
|
|
54
|
+
console.info("[INFO]:", message);
|
|
55
|
+
break;
|
|
56
|
+
case types_1.LogLevel.WARN:
|
|
57
|
+
console.warn("[WARN]:", message);
|
|
58
|
+
break;
|
|
59
|
+
case types_1.LogLevel.ERROR:
|
|
60
|
+
console.error("[ERROR]:", message);
|
|
61
|
+
break;
|
|
48
62
|
}
|
|
49
63
|
}
|
|
64
|
+
debug(message) {
|
|
65
|
+
this.log(types_1.LogLevel.DEBUG, message);
|
|
66
|
+
}
|
|
50
67
|
info(message) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
68
|
+
this.log(types_1.LogLevel.INFO, message);
|
|
69
|
+
}
|
|
70
|
+
warn(message) {
|
|
71
|
+
this.log(types_1.LogLevel.WARN, message);
|
|
54
72
|
}
|
|
55
73
|
error(message) {
|
|
56
|
-
|
|
57
|
-
console.error("[ERROR]:", message);
|
|
58
|
-
}
|
|
74
|
+
this.log(types_1.LogLevel.ERROR, message);
|
|
59
75
|
}
|
|
60
76
|
connect = () => {
|
|
61
77
|
this.debug("Connecting to socket");
|
|
@@ -92,47 +108,48 @@ class OpenSeaStreamClient {
|
|
|
92
108
|
};
|
|
93
109
|
};
|
|
94
110
|
onItemMetadataUpdated = (collectionSlug, callback) => {
|
|
95
|
-
this.debug(`Listening for item metadata updates on "${collectionSlug}"`);
|
|
96
111
|
return this.on(types_1.EventType.ITEM_METADATA_UPDATED, collectionSlug, callback);
|
|
97
112
|
};
|
|
98
113
|
onItemCancelled = (collectionSlug, callback) => {
|
|
99
|
-
this.debug(`Listening for item cancellations on "${collectionSlug}"`);
|
|
100
114
|
return this.on(types_1.EventType.ITEM_CANCELLED, collectionSlug, callback);
|
|
101
115
|
};
|
|
102
116
|
onItemListed = (collectionSlug, callback) => {
|
|
103
|
-
this.debug(`Listening for item listings on "${collectionSlug}"`);
|
|
104
117
|
return this.on(types_1.EventType.ITEM_LISTED, collectionSlug, callback);
|
|
105
118
|
};
|
|
106
119
|
onItemSold = (collectionSlug, callback) => {
|
|
107
|
-
this.debug(`Listening for item sales on "${collectionSlug}"`);
|
|
108
120
|
return this.on(types_1.EventType.ITEM_SOLD, collectionSlug, callback);
|
|
109
121
|
};
|
|
110
122
|
onItemTransferred = (collectionSlug, callback) => {
|
|
111
|
-
this.debug(`Listening for item transfers on "${collectionSlug}"`);
|
|
112
123
|
return this.on(types_1.EventType.ITEM_TRANSFERRED, collectionSlug, callback);
|
|
113
124
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
/**
|
|
126
|
+
* No-op. The Stream API does not emit `item_received_offer` and never has, so
|
|
127
|
+
* this only ever registered a handler that could not fire. Item-level offers
|
|
128
|
+
* arrive as `item_received_bid`, so use {@link onItemReceivedBid} instead.
|
|
129
|
+
*
|
|
130
|
+
* Kept callable, and kept from opening a connection for a topic that yields
|
|
131
|
+
* nothing, so existing call sites keep compiling and running unchanged.
|
|
132
|
+
*
|
|
133
|
+
* @deprecated Use {@link onItemReceivedBid}. This does nothing.
|
|
134
|
+
* @hidden
|
|
135
|
+
*/
|
|
136
|
+
onItemReceivedOffer = (_collectionSlug, _callback) => {
|
|
137
|
+
this.warn("onItemReceivedOffer does nothing: the Stream API does not emit item_received_offer. Item-level offers arrive as item_received_bid, via onItemReceivedBid.");
|
|
138
|
+
return () => { };
|
|
117
139
|
};
|
|
118
140
|
onItemReceivedBid = (collectionSlug, callback) => {
|
|
119
|
-
this.debug(`Listening for item bids on "${collectionSlug}"`);
|
|
120
141
|
return this.on(types_1.EventType.ITEM_RECEIVED_BID, collectionSlug, callback);
|
|
121
142
|
};
|
|
122
143
|
onCollectionOffer = (collectionSlug, callback) => {
|
|
123
|
-
this.debug(`Listening for collection offers on "${collectionSlug}"`);
|
|
124
144
|
return this.on(types_1.EventType.COLLECTION_OFFER, collectionSlug, callback);
|
|
125
145
|
};
|
|
126
146
|
onTraitOffer = (collectionSlug, callback) => {
|
|
127
|
-
this.debug(`Listening for trait offers on "${collectionSlug}"`);
|
|
128
147
|
return this.on(types_1.EventType.TRAIT_OFFER, collectionSlug, callback);
|
|
129
148
|
};
|
|
130
149
|
onOrderInvalidate = (collectionSlug, callback) => {
|
|
131
|
-
this.debug(`Listening for order invalidation events on "${collectionSlug}"`);
|
|
132
150
|
return this.on(types_1.EventType.ORDER_INVALIDATE, collectionSlug, callback);
|
|
133
151
|
};
|
|
134
152
|
onOrderRevalidate = (collectionSlug, callback) => {
|
|
135
|
-
this.debug(`Listening for order revalidation events on "${collectionSlug}"`);
|
|
136
153
|
return this.on(types_1.EventType.ORDER_REVALIDATE, collectionSlug, callback);
|
|
137
154
|
};
|
|
138
155
|
/**
|
package/lib/stream/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/stream/client.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AACvC,uCAA2C;AAC3C,iDAA8D;AAE9D,mCAkBgB;AAEhB;;;;;;;;;;;;;;;GAeG;AACH,MAAa,mBAAmB;IACtB,SAAS,CAAiB;IAC1B,QAAQ,CAAU;IAClB,OAAO,CAAe;IAE9B,YAAY,EACV,OAAO,GAAG,eAAO,CAAC,OAAO,EACzB,MAAM,EACN,KAAK,EACL,MAAM,EACN,cAAc,EACd,QAAQ,GAAG,gBAAQ,CAAC,IAAI,EACxB,OAAO,EACP,OAAO,GAAG,GAAG,EAAE,CAAC,IAAI,GACP;QACb,MAAM,GAAG,GAAG,MAAM,IAAI,KAAK,CAAA;QAC3B,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAA;QACH,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,MAAM,QAAQ,GAAG,MAAM,IAAI,qBAAS,CAAC,OAAO,CAAC,CAAA;QAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,GAAG,cAAc,IAAI,EAAE,CAAA;QAE5D,IAAI,CAAC,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,CAAC,SAAS,CAAC,EAAE,CAC/C,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,CAAC,CACzD,CAAA;QAED,OAAO,GAAG,EAAE;YACV,KAAK,MAAM,WAAW,IAAI,aAAa,EAAE,CAAC;gBACxC,WAAW,EAAE,CAAA;YACf,CAAC;QACH,CAAC,CAAA;IACH,CAAC,CAAA;CACF;AAlQD,kDAkQC"}
|
package/lib/stream/types.d.ts
CHANGED
|
@@ -61,6 +61,13 @@ export declare enum EventType {
|
|
|
61
61
|
ITEM_LISTED = "item_listed",
|
|
62
62
|
ITEM_SOLD = "item_sold",
|
|
63
63
|
ITEM_TRANSFERRED = "item_transferred",
|
|
64
|
+
/**
|
|
65
|
+
* Never emitted by the Stream API. Item-level offers arrive as
|
|
66
|
+
* {@link EventType.ITEM_RECEIVED_BID}. Kept so existing references compile.
|
|
67
|
+
*
|
|
68
|
+
* @deprecated Use {@link EventType.ITEM_RECEIVED_BID}.
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
64
71
|
ITEM_RECEIVED_OFFER = "item_received_offer",
|
|
65
72
|
ITEM_RECEIVED_BID = "item_received_bid",
|
|
66
73
|
ITEM_CANCELLED = "item_cancelled",
|
|
@@ -133,36 +140,34 @@ export type AssetContractCriteria = {
|
|
|
133
140
|
export type CollectionIdentifier = {
|
|
134
141
|
slug: string;
|
|
135
142
|
};
|
|
136
|
-
|
|
143
|
+
interface BaseOrderEventPayload extends Payload {
|
|
137
144
|
quantity: number;
|
|
138
|
-
listing_type: string;
|
|
139
|
-
listing_date: string;
|
|
140
|
-
expiration_date: string;
|
|
141
145
|
maker: Account;
|
|
142
146
|
taker: Account;
|
|
143
|
-
base_price: string;
|
|
144
|
-
payment_token: PaymentToken;
|
|
145
|
-
is_private: boolean;
|
|
146
147
|
order_hash: string;
|
|
148
|
+
payment_token: PaymentToken;
|
|
147
149
|
event_timestamp: string;
|
|
148
150
|
}
|
|
151
|
+
interface BasePricedOrderEventPayload extends BaseOrderEventPayload {
|
|
152
|
+
base_price: string;
|
|
153
|
+
expiration_date: string;
|
|
154
|
+
}
|
|
155
|
+
export interface ItemListedEventPayload extends BasePricedOrderEventPayload {
|
|
156
|
+
listing_type: string;
|
|
157
|
+
listing_date: string;
|
|
158
|
+
is_private: boolean;
|
|
159
|
+
}
|
|
149
160
|
export type ItemListedEvent = BaseStreamMessage<ItemListedEventPayload>;
|
|
150
161
|
export type Transaction = {
|
|
151
162
|
hash: string;
|
|
152
163
|
timestamp: string;
|
|
153
164
|
};
|
|
154
|
-
export interface ItemSoldEventPayload extends
|
|
155
|
-
quantity: number;
|
|
165
|
+
export interface ItemSoldEventPayload extends BaseOrderEventPayload {
|
|
156
166
|
listing_type: string;
|
|
157
167
|
closing_date: string;
|
|
158
168
|
transaction: Transaction;
|
|
159
|
-
maker: Account;
|
|
160
|
-
taker: Account;
|
|
161
|
-
order_hash: string;
|
|
162
169
|
sale_price: string;
|
|
163
|
-
payment_token: PaymentToken;
|
|
164
170
|
is_private: boolean;
|
|
165
|
-
event_timestamp: string;
|
|
166
171
|
}
|
|
167
172
|
export type ItemSoldEvent = BaseStreamMessage<ItemSoldEventPayload>;
|
|
168
173
|
export interface ItemTransferredEventPayload extends Payload {
|
|
@@ -173,77 +178,41 @@ export interface ItemTransferredEventPayload extends Payload {
|
|
|
173
178
|
event_timestamp: string;
|
|
174
179
|
}
|
|
175
180
|
export type ItemTransferredEvent = BaseStreamMessage<ItemTransferredEventPayload>;
|
|
176
|
-
export interface ItemReceivedBidEventPayload extends
|
|
177
|
-
quantity: number;
|
|
181
|
+
export interface ItemReceivedBidEventPayload extends BasePricedOrderEventPayload {
|
|
178
182
|
created_date: string;
|
|
179
|
-
expiration_date: string;
|
|
180
|
-
maker: Account;
|
|
181
|
-
taker: Account;
|
|
182
|
-
order_hash: string;
|
|
183
|
-
base_price: string;
|
|
184
|
-
payment_token: PaymentToken;
|
|
185
|
-
event_timestamp: string;
|
|
186
183
|
}
|
|
187
184
|
export type ItemReceivedBidEvent = BaseStreamMessage<ItemReceivedBidEventPayload>;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
taker: Account;
|
|
194
|
-
order_hash: string;
|
|
195
|
-
base_price: string;
|
|
196
|
-
payment_token: PaymentToken;
|
|
197
|
-
event_timestamp: string;
|
|
185
|
+
/**
|
|
186
|
+
* @deprecated Never emitted. Use {@link ItemReceivedBidEventPayload}.
|
|
187
|
+
* @hidden
|
|
188
|
+
*/
|
|
189
|
+
export interface ItemReceivedOfferEventPayload extends ItemReceivedBidEventPayload {
|
|
198
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* @deprecated Never emitted. Use {@link ItemReceivedBidEvent}.
|
|
193
|
+
* @hidden
|
|
194
|
+
*/
|
|
199
195
|
export type ItemReceivedOfferEvent = BaseStreamMessage<ItemReceivedOfferEventPayload>;
|
|
200
|
-
export interface ItemCancelledEventPayload extends
|
|
201
|
-
quantity: number;
|
|
202
|
-
base_price: string;
|
|
203
|
-
expiration_date: string;
|
|
204
|
-
maker: Account;
|
|
205
|
-
taker: Account;
|
|
196
|
+
export interface ItemCancelledEventPayload extends BasePricedOrderEventPayload {
|
|
206
197
|
listing_type: string;
|
|
207
198
|
listing_date: string;
|
|
208
199
|
transaction: Transaction;
|
|
209
|
-
payment_token: PaymentToken;
|
|
210
|
-
order_hash: string;
|
|
211
200
|
is_private: boolean;
|
|
212
|
-
event_timestamp: string;
|
|
213
201
|
}
|
|
214
202
|
export type ItemCancelledEvent = BaseStreamMessage<ItemCancelledEventPayload>;
|
|
215
|
-
export interface CollectionOfferEventPayload extends
|
|
216
|
-
quantity: number;
|
|
203
|
+
export interface CollectionOfferEventPayload extends BasePricedOrderEventPayload {
|
|
217
204
|
created_date: string;
|
|
218
|
-
expiration_date: string;
|
|
219
|
-
maker: Account;
|
|
220
|
-
taker: Account;
|
|
221
|
-
base_price: string;
|
|
222
|
-
order_hash: string;
|
|
223
|
-
payment_token: PaymentToken;
|
|
224
205
|
collection_criteria: CollectionIdentifier;
|
|
225
206
|
asset_contract_criteria: AssetContractCriteria;
|
|
226
|
-
event_timestamp: string;
|
|
227
207
|
}
|
|
228
208
|
export type CollectionOfferEvent = BaseStreamMessage<CollectionOfferEventPayload>;
|
|
229
209
|
export type TraitCriteria = {
|
|
230
210
|
trait_type: string;
|
|
231
211
|
trait_name: string;
|
|
232
212
|
};
|
|
233
|
-
export interface TraitOfferEventPayload extends
|
|
234
|
-
quantity: number;
|
|
235
|
-
created_date: string;
|
|
236
|
-
expiration_date: string;
|
|
237
|
-
maker: Account;
|
|
238
|
-
taker: Account;
|
|
239
|
-
base_price: string;
|
|
240
|
-
order_hash: string;
|
|
241
|
-
payment_token: PaymentToken;
|
|
242
|
-
collection_criteria: CollectionIdentifier;
|
|
243
|
-
asset_contract_criteria: AssetContractCriteria;
|
|
213
|
+
export interface TraitOfferEventPayload extends CollectionOfferEventPayload {
|
|
244
214
|
trait_criteria?: TraitCriteria;
|
|
245
215
|
trait_criteria_list?: TraitCriteria[];
|
|
246
|
-
event_timestamp: string;
|
|
247
216
|
}
|
|
248
217
|
export type TraitOfferEvent = BaseStreamMessage<TraitOfferEventPayload>;
|
|
249
218
|
export interface OrderValidationEventPayload {
|
package/lib/stream/types.js
CHANGED
|
@@ -11,6 +11,13 @@ var EventType;
|
|
|
11
11
|
EventType["ITEM_LISTED"] = "item_listed";
|
|
12
12
|
EventType["ITEM_SOLD"] = "item_sold";
|
|
13
13
|
EventType["ITEM_TRANSFERRED"] = "item_transferred";
|
|
14
|
+
/**
|
|
15
|
+
* Never emitted by the Stream API. Item-level offers arrive as
|
|
16
|
+
* {@link EventType.ITEM_RECEIVED_BID}. Kept so existing references compile.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Use {@link EventType.ITEM_RECEIVED_BID}.
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
14
21
|
EventType["ITEM_RECEIVED_OFFER"] = "item_received_offer";
|
|
15
22
|
EventType["ITEM_RECEIVED_BID"] = "item_received_bid";
|
|
16
23
|
EventType["ITEM_CANCELLED"] = "item_cancelled";
|
package/lib/stream/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/stream/types.ts"],"names":[],"mappings":";;;AA+DA,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,8BAAmB,CAAA;AACrB,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB;AAED,IAAY,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/stream/types.ts"],"names":[],"mappings":";;;AA+DA,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,8BAAmB,CAAA;AACrB,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB;AAED,IAAY,SAmBX;AAnBD,WAAY,SAAS;IACnB,4DAA+C,CAAA;IAC/C,wCAA2B,CAAA;IAC3B,oCAAuB,CAAA;IACvB,kDAAqC,CAAA;IACrC;;;;;;OAMG;IACH,wDAA2C,CAAA;IAC3C,oDAAuC,CAAA;IACvC,8CAAiC,CAAA;IACjC,kDAAqC,CAAA;IACrC,wCAA2B,CAAA;IAC3B,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;AACvC,CAAC,EAnBW,SAAS,yBAAT,SAAS,QAmBpB;AAqMD,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,0CAAU,CAAA;IACV,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,0CAAU,CAAA;AACZ,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensea/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "TypeScript SDK for the OpenSea marketplace helps developers build new experiences using NFTs, tokens, and our marketplace data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "OpenSea Developers",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"types": "lib/index.d.ts",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@noble/hashes": "^2.0.1",
|
|
50
|
-
"@opensea/api-types": "^0.8.
|
|
50
|
+
"@opensea/api-types": "^0.8.10",
|
|
51
51
|
"@opensea/seaport-js": "^4.2.0",
|
|
52
52
|
"ethers": "^6.16.0"
|
|
53
53
|
},
|
package/src/api/types.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
AccountResolveResponse,
|
|
2
3
|
AccountSearchResponse as ApiAccountSearchResponse,
|
|
3
4
|
AgentProfileRelationshipsResponse as ApiAgentProfileRelationshipsResponse,
|
|
4
5
|
BuildOfferResponse as ApiBuildOfferResponse,
|
|
5
6
|
CancelResponse as ApiCancelResponse,
|
|
6
7
|
CollectionSearchResponse as ApiCollectionSearchResponse,
|
|
8
|
+
DropMintRequest as ApiDropMintRequest,
|
|
9
|
+
DropMintResponse as ApiDropMintResponse,
|
|
7
10
|
Listing as ApiListing,
|
|
8
11
|
Nft as ApiNft,
|
|
9
12
|
NftSearchResponse as ApiNftSearchResponse,
|
|
@@ -28,8 +31,10 @@ import type {
|
|
|
28
31
|
Trait as ApiTrait,
|
|
29
32
|
TransactionReceiptRequest as ApiTransactionReceiptRequest,
|
|
30
33
|
TransactionReceiptResponse as ApiTransactionReceiptResponse,
|
|
34
|
+
ValidateMetadataResponse as ApiValidateMetadataResponse,
|
|
31
35
|
WalletVisibilityResponse as ApiWalletVisibilityResponse,
|
|
32
36
|
AssetMetadataResponse,
|
|
37
|
+
ChainListResponse,
|
|
33
38
|
ChainResponse,
|
|
34
39
|
ContractResponse,
|
|
35
40
|
DropDetailedResponse,
|
|
@@ -354,11 +359,25 @@ export type SvmTransactionDetailsResponse =
|
|
|
354
359
|
export type WalletVisibilityResponse = Camelize<ApiWalletVisibilityResponse>
|
|
355
360
|
|
|
356
361
|
/**
|
|
357
|
-
* Public agent profile relationships for an account.
|
|
362
|
+
* Public agent profile relationships for an account. Only relationships both
|
|
363
|
+
* accounts confirmed appear here; a pending proposal is visible to the two
|
|
364
|
+
* parties alone, through `listOwnAgentRelationships`.
|
|
365
|
+
*
|
|
366
|
+
* `agentOwner` is the account confirmed to own this one, and is null when
|
|
367
|
+
* there is none. That is ordinary rather than exceptional: an agent nobody
|
|
368
|
+
* declared is a valid agent account. `agents` holds the accounts this one is
|
|
369
|
+
* the confirmed owner of, newest first.
|
|
370
|
+
*
|
|
371
|
+
* The wire response also carries `agent_owner_profile` and
|
|
372
|
+
* `public_agent_wallets`. Both read the retired wallet-level designation, are
|
|
373
|
+
* permanently null and empty, and are removed by AGE-51, so they are omitted
|
|
374
|
+
* here rather than offered as fields a caller might reasonably read.
|
|
358
375
|
* @category API Response Types
|
|
359
376
|
*/
|
|
360
|
-
export type AgentProfileRelationshipsResponse =
|
|
361
|
-
Camelize<ApiAgentProfileRelationshipsResponse
|
|
377
|
+
export type AgentProfileRelationshipsResponse = Omit<
|
|
378
|
+
Camelize<ApiAgentProfileRelationshipsResponse>,
|
|
379
|
+
"agentOwnerProfile" | "publicAgentWallets"
|
|
380
|
+
>
|
|
362
381
|
|
|
363
382
|
/**
|
|
364
383
|
* Request body for fetching a transaction receipt.
|
|
@@ -971,10 +990,7 @@ export type ChainInfo = Camelize<ChainResponse>
|
|
|
971
990
|
* Response from OpenSea API for listing supported chains.
|
|
972
991
|
* @category API Response Types
|
|
973
992
|
*/
|
|
974
|
-
export type GetChainsResponse =
|
|
975
|
-
/** List of supported chains */
|
|
976
|
-
chains: ChainInfo[]
|
|
977
|
-
}
|
|
993
|
+
export type GetChainsResponse = Camelize<ChainListResponse>
|
|
978
994
|
|
|
979
995
|
/**
|
|
980
996
|
* Token balance for a wallet address. Sourced from `@opensea/api-types`
|
|
@@ -1075,27 +1091,13 @@ export interface GetDropsArgs {
|
|
|
1075
1091
|
* Request body for building a drop mint transaction.
|
|
1076
1092
|
* @category API Request Types
|
|
1077
1093
|
*/
|
|
1078
|
-
export type DropMintRequest =
|
|
1079
|
-
/** Wallet address that will receive the minted tokens */
|
|
1080
|
-
minter: string
|
|
1081
|
-
/** Number of tokens to mint (1-100) */
|
|
1082
|
-
quantity: number
|
|
1083
|
-
}
|
|
1094
|
+
export type DropMintRequest = Camelize<ApiDropMintRequest>
|
|
1084
1095
|
|
|
1085
1096
|
/**
|
|
1086
1097
|
* Response from OpenSea API for building a drop mint transaction.
|
|
1087
1098
|
* @category API Response Types
|
|
1088
1099
|
*/
|
|
1089
|
-
export type DropMintResponse =
|
|
1090
|
-
/** Transaction target contract address */
|
|
1091
|
-
to: string
|
|
1092
|
-
/** Encoded transaction data (hex) */
|
|
1093
|
-
data: string
|
|
1094
|
-
/** Transaction value in wei (hex) */
|
|
1095
|
-
value: string
|
|
1096
|
-
/** Chain identifier */
|
|
1097
|
-
chain: string
|
|
1098
|
-
}
|
|
1100
|
+
export type DropMintResponse = Camelize<ApiDropMintResponse>
|
|
1099
1101
|
|
|
1100
1102
|
/**
|
|
1101
1103
|
* Query args for Get Trending Collections endpoint.
|
|
@@ -1143,52 +1145,13 @@ export type GetCollectionsPaginatedResponse = QueryCursorsV2 & {
|
|
|
1143
1145
|
* Response from OpenSea API for resolving an account identifier.
|
|
1144
1146
|
* @category API Response Types
|
|
1145
1147
|
*/
|
|
1146
|
-
export type ResolveAccountResponse =
|
|
1147
|
-
/** The resolved wallet address */
|
|
1148
|
-
address: string
|
|
1149
|
-
/** OpenSea username, if available */
|
|
1150
|
-
username?: string
|
|
1151
|
-
/** Primary ENS name, if available */
|
|
1152
|
-
ensName?: string
|
|
1153
|
-
}
|
|
1148
|
+
export type ResolveAccountResponse = Camelize<AccountResolveResponse>
|
|
1154
1149
|
|
|
1155
1150
|
/**
|
|
1156
1151
|
* Response from OpenSea API for validating NFT metadata.
|
|
1157
1152
|
* @category API Response Types
|
|
1158
1153
|
*/
|
|
1159
|
-
export type ValidateMetadataResponse =
|
|
1160
|
-
/** The asset being validated */
|
|
1161
|
-
assetIdentifier: {
|
|
1162
|
-
chain: string
|
|
1163
|
-
contractAddress: string
|
|
1164
|
-
tokenId: string
|
|
1165
|
-
}
|
|
1166
|
-
/** The token URI */
|
|
1167
|
-
tokenUri?: string
|
|
1168
|
-
/** Parsed metadata details */
|
|
1169
|
-
metadata?: {
|
|
1170
|
-
name?: string
|
|
1171
|
-
description?: string
|
|
1172
|
-
originalImageUrl?: string
|
|
1173
|
-
processedImageUrl?: string
|
|
1174
|
-
originalAnimationUrl?: string
|
|
1175
|
-
processedAnimationUrl?: string
|
|
1176
|
-
externalUrl?: string
|
|
1177
|
-
backgroundColor?: string
|
|
1178
|
-
attributes: {
|
|
1179
|
-
traitType: string
|
|
1180
|
-
value: string
|
|
1181
|
-
displayType?: string
|
|
1182
|
-
}[]
|
|
1183
|
-
}
|
|
1184
|
-
/** Error encountered during metadata ingestion */
|
|
1185
|
-
error?: {
|
|
1186
|
-
errorType: string
|
|
1187
|
-
message: string
|
|
1188
|
-
url?: string
|
|
1189
|
-
statusCode?: number
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1154
|
+
export type ValidateMetadataResponse = Camelize<ApiValidateMetadataResponse>
|
|
1192
1155
|
|
|
1193
1156
|
/**
|
|
1194
1157
|
* Response from OpenSea API for fetching raw NFT metadata.
|
package/src/api/walletAuth.ts
CHANGED
|
@@ -424,19 +424,6 @@ export class WalletAuthAPI {
|
|
|
424
424
|
)
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
-
markWalletAsAgent(wallet: string) {
|
|
428
|
-
return this.fetcher.request<OperationResponse<"mark_wallet_as_agent">>(
|
|
429
|
-
"PUT",
|
|
430
|
-
`/api/v2/accounts/wallets/${segment(wallet)}/agent`,
|
|
431
|
-
)
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
removeWalletAgentDesignation(wallet: string) {
|
|
435
|
-
return this.fetcher.request<
|
|
436
|
-
OperationResponse<"remove_wallet_agent_designation">
|
|
437
|
-
>("DELETE", `/api/v2/accounts/wallets/${segment(wallet)}/agent`)
|
|
438
|
-
}
|
|
439
|
-
|
|
440
427
|
makeWalletPrivate(wallet: string) {
|
|
441
428
|
return this.fetcher.request<OperationResponse<"make_wallet_private">>(
|
|
442
429
|
"PUT",
|
|
@@ -450,4 +437,104 @@ export class WalletAuthAPI {
|
|
|
450
437
|
`/api/v2/accounts/wallets/${segment(wallet)}/private`,
|
|
451
438
|
)
|
|
452
439
|
}
|
|
440
|
+
|
|
441
|
+
// ── Agent accounts ────────────────────────────────────────────────
|
|
442
|
+
//
|
|
443
|
+
// An agent is an account, not a flag on a wallet, and ownership is a
|
|
444
|
+
// relationship between two accounts that both sides confirm. It is a
|
|
445
|
+
// declaration, not an authorization: naming an account as your agent
|
|
446
|
+
// grants it nothing. It is self-reported and OpenSea does not verify it.
|
|
447
|
+
//
|
|
448
|
+
// The five writes below need `write:wallets`. `listOwnAgentRelationships`
|
|
449
|
+
// needs `read:wallets`. A client driving the whole handshake needs both, or
|
|
450
|
+
// the list call fails with "Insufficient permissions".
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Declare the authenticated account an agent. Requires `write:wallets`.
|
|
454
|
+
*
|
|
455
|
+
* Independent of ownership: an agent nobody owns is valid. `changed` is
|
|
456
|
+
* false when the account was already an agent, so a retry is
|
|
457
|
+
* distinguishable from a real change.
|
|
458
|
+
*/
|
|
459
|
+
declareAgentAccount() {
|
|
460
|
+
return this.fetcher.request<OperationResponse<"declare_agent_account">>(
|
|
461
|
+
"PUT",
|
|
462
|
+
"/api/v2/accounts/agent",
|
|
463
|
+
)
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Withdraw the authenticated account's agent declaration. Requires
|
|
468
|
+
* `write:wallets`.
|
|
469
|
+
*/
|
|
470
|
+
withdrawAgentAccountDeclaration() {
|
|
471
|
+
return this.fetcher.request<
|
|
472
|
+
OperationResponse<"withdraw_agent_account_declaration">
|
|
473
|
+
>("DELETE", "/api/v2/accounts/agent")
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Propose an agent ownership relationship. Requires `write:wallets`.
|
|
478
|
+
*
|
|
479
|
+
* `callerRole` says which side the caller is on: `AGENT` means "I am an
|
|
480
|
+
* agent and the counterparty owns me". The caller's own account is never in
|
|
481
|
+
* the body; it comes from the bearer token.
|
|
482
|
+
*
|
|
483
|
+
* Proposing a relationship that is already awaiting you confirms it, so a
|
|
484
|
+
* client that cannot tell who moved first can just propose.
|
|
485
|
+
*/
|
|
486
|
+
proposeAgentRelationship(
|
|
487
|
+
body: WalletAuthRequest<"propose_agent_relationship">,
|
|
488
|
+
) {
|
|
489
|
+
return this.fetcher.request<
|
|
490
|
+
OperationResponse<"propose_agent_relationship">
|
|
491
|
+
>("POST", "/api/v2/accounts/agent-relationships", body)
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Confirm a relationship proposed to the authenticated account. Requires
|
|
496
|
+
* `write:wallets`. An agent ends up with at most one confirmed owner.
|
|
497
|
+
*/
|
|
498
|
+
confirmAgentRelationship(
|
|
499
|
+
body: WalletAuthRequest<"confirm_agent_relationship">,
|
|
500
|
+
) {
|
|
501
|
+
return this.fetcher.request<
|
|
502
|
+
OperationResponse<"confirm_agent_relationship">
|
|
503
|
+
>("POST", "/api/v2/accounts/agent-relationships/confirm", body)
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Withdraw a proposal or revoke a confirmed relationship. Requires
|
|
508
|
+
* `write:wallets`. Either side may do this at any point, and it deletes the
|
|
509
|
+
* relationship rather than marking it inactive.
|
|
510
|
+
*
|
|
511
|
+
* `removed` is false when no such relationship existed, which covers both a
|
|
512
|
+
* counterparty you never proposed to and someone else's relationship.
|
|
513
|
+
*
|
|
514
|
+
* Sent as query parameters rather than a body on purpose: fetch, OkHttp and
|
|
515
|
+
* urllib all drop DELETE bodies by default, and proxies may strip them.
|
|
516
|
+
*/
|
|
517
|
+
revokeAgentRelationship(query: WalletAuthQuery<"revoke_agent_relationship">) {
|
|
518
|
+
const params = new URLSearchParams({
|
|
519
|
+
counterparty_address: query.counterpartyAddress,
|
|
520
|
+
caller_role: query.callerRole,
|
|
521
|
+
})
|
|
522
|
+
return this.fetcher.request<OperationResponse<"revoke_agent_relationship">>(
|
|
523
|
+
"DELETE",
|
|
524
|
+
`/api/v2/accounts/agent-relationships?${params}`,
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* List the authenticated account's own relationships. Requires
|
|
530
|
+
* `read:wallets`, not `write:wallets`.
|
|
531
|
+
*
|
|
532
|
+
* Includes proposals still awaiting either side. Pending relationships show
|
|
533
|
+
* up here only; a public profile shows confirmed ones alone.
|
|
534
|
+
*/
|
|
535
|
+
listOwnAgentRelationships() {
|
|
536
|
+
return this.fetcher.get<OperationResponse<"list_own_agent_relationships">>(
|
|
537
|
+
"/api/v2/accounts/agent-relationships",
|
|
538
|
+
)
|
|
539
|
+
}
|
|
453
540
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A 4-byte hex string, the only shape the attribution suffix takes. */
|
|
2
|
+
const CALLDATA_SUFFIX_PATTERN = /^0x[0-9a-f]{8}$/i
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Append the OpenSea attribution suffix to ABI-encoded calldata.
|
|
6
|
+
*
|
|
7
|
+
* The fulfillment endpoints return `calldata_suffix` alongside the transaction
|
|
8
|
+
* they describe: the first four bytes of `keccak256("api.opensea.io")`, which
|
|
9
|
+
* OpenSea's own fills carry as trailing calldata. Seaport reads its arguments
|
|
10
|
+
* from offsets and ignores trailing bytes, so the suffix attributes the fill
|
|
11
|
+
* without affecting execution.
|
|
12
|
+
*
|
|
13
|
+
* This matters because the SDK does not submit the API's calldata. It re-encodes
|
|
14
|
+
* the call from `input_data` and signs that, which drops anything the API had
|
|
15
|
+
* appended, so the suffix has to be re-attached here or the fill lands
|
|
16
|
+
* unattributed.
|
|
17
|
+
*
|
|
18
|
+
* A missing or malformed suffix is ignored rather than raised. Attribution is
|
|
19
|
+
* optional by design and must never be the reason a fill fails.
|
|
20
|
+
*/
|
|
21
|
+
export function appendCalldataSuffix(
|
|
22
|
+
calldata: string,
|
|
23
|
+
suffix: string | undefined,
|
|
24
|
+
): string {
|
|
25
|
+
if (!suffix || !CALLDATA_SUFFIX_PATTERN.test(suffix)) {
|
|
26
|
+
return calldata
|
|
27
|
+
}
|
|
28
|
+
return calldata + suffix.slice(2)
|
|
29
|
+
}
|