@opensea/sdk 10.3.1 → 10.4.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/lib/api/api.d.ts +28 -41
- package/lib/api/api.js +35 -48
- package/lib/api/api.js.map +1 -1
- package/lib/api/apiPaths.d.ts +7 -2
- package/lib/api/apiPaths.js +25 -6
- package/lib/api/apiPaths.js.map +1 -1
- package/lib/api/listings.d.ts +9 -14
- package/lib/api/listings.js +12 -30
- package/lib/api/listings.js.map +1 -1
- package/lib/api/offers.d.ts +2 -2
- package/lib/api/offers.js +2 -9
- package/lib/api/offers.js.map +1 -1
- package/lib/api/orders.d.ts +4 -21
- package/lib/api/orders.js +15 -96
- package/lib/api/orders.js.map +1 -1
- package/lib/api/tokens.d.ts +6 -1
- package/lib/api/tokens.js +7 -0
- package/lib/api/tokens.js.map +1 -1
- package/lib/api/transactions.d.ts +16 -0
- package/lib/api/transactions.js +24 -0
- package/lib/api/transactions.js.map +1 -0
- package/lib/api/types.d.ts +32 -10
- package/lib/api/types.js.map +1 -1
- package/lib/orders/types.d.ts +0 -67
- package/lib/orders/types.js.map +1 -1
- package/lib/orders/utils.d.ts +1 -19
- package/lib/orders/utils.js +1 -62
- package/lib/orders/utils.js.map +1 -1
- package/lib/sdk/base.d.ts +6 -6
- package/lib/sdk/base.js +2 -2
- package/lib/sdk/orders.d.ts +13 -10
- package/lib/sdk/orders.js +6 -22
- package/lib/sdk/orders.js.map +1 -1
- package/lib/types.d.ts +0 -6
- package/package.json +2 -2
- package/src/api/api.ts +54 -86
- package/src/api/apiPaths.ts +26 -8
- package/src/api/listings.ts +19 -41
- package/src/api/offers.ts +8 -16
- package/src/api/orders.ts +40 -177
- package/src/api/tokens.ts +11 -0
- package/src/api/transactions.ts +28 -0
- package/src/api/types.ts +43 -15
- package/src/orders/types.ts +0 -74
- package/src/orders/utils.ts +2 -73
- package/src/sdk/base.ts +6 -6
- package/src/sdk/orders.ts +31 -32
- package/src/types.ts +0 -6
package/lib/api/offers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offers.js","sourceRoot":"","sources":["../../src/api/offers.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"offers.js","sourceRoot":"","sources":["../../src/api/offers.ts"],"names":[],"mappings":";;;AACA,2CAGwB;AAExB,yCAQmB;AASnB;;;GAGG;AACH,SAAS,mBAAmB,CAC1B,SAAkB,EAClB,UAAmB,EACnB,MAA+C,EAC/C,aAAmE;IAEnE,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CACb,kHAAkH,CACnH,CAAA;IACH,CAAC;IACD,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QAC5B,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,kEAAkE,CACnE,CAAA;QACH,CAAC;IACH,CAAC;IACD,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gBAChC,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9C,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;YAClC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;gBAChB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;YACpE,CAAC;YACD,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,CAAC,GAAG,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AU,EACV,MAAM,EACN,aAAa,CACd,CAAA;QACD,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAC5B,IAAA,qCAA0B,GAAE,EAC5B,OAAO,CACR,CAAA;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAClB,cAAsB,EACtB,UAA2B,EAC3B,KAAc,EACd,IAAa;QAEb,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CACrB,IAAA,6BAAkB,EAAC,cAAc,EAAE,UAAU,CAAC,EAC9C,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CAAA;IACH,CAAC;CACF;AAzJD,8BAyJC"}
|
package/lib/api/orders.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { FulfillmentDataResponse,
|
|
1
|
+
import type { FulfillmentDataResponse, ProtocolData } from "../orders/types";
|
|
2
2
|
import { type Chain, OrderSide } from "../types";
|
|
3
3
|
import type { Fetcher } from "./fetcher";
|
|
4
|
-
import type { CancelOrderResponse, GetOrderByHashResponse,
|
|
4
|
+
import type { CancelOrderResponse, GetOrderByHashResponse, Listing, Offer } from "./types";
|
|
5
5
|
/**
|
|
6
6
|
* Order-related API operations
|
|
7
7
|
*/
|
|
@@ -9,38 +9,21 @@ export declare class OrdersAPI {
|
|
|
9
9
|
private fetcher;
|
|
10
10
|
private chain;
|
|
11
11
|
constructor(fetcher: Fetcher, chain: Chain);
|
|
12
|
-
/**
|
|
13
|
-
* Gets an order from API based on query options.
|
|
14
|
-
* @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
|
|
15
|
-
*/
|
|
16
|
-
getOrder({ side, protocol, orderDirection, orderBy, ...restOptions }: Omit<OrdersQueryOptions, "limit">): Promise<OrderV2>;
|
|
17
12
|
/**
|
|
18
13
|
* Gets a single order by its order hash.
|
|
19
14
|
* Returns the raw API response which can be either an Offer or Listing.
|
|
20
15
|
*/
|
|
21
16
|
getOrderByHash(orderHash: string, protocolAddress: string, chain?: Chain): Promise<GetOrderByHashResponse>;
|
|
22
|
-
/**
|
|
23
|
-
* Gets a list of orders from API based on query options.
|
|
24
|
-
* @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
|
|
25
|
-
*/
|
|
26
|
-
getOrders({ side, protocol, orderDirection, orderBy, pageSize, ...restOptions }: Omit<OrdersQueryOptions, "limit"> & {
|
|
27
|
-
pageSize?: number;
|
|
28
|
-
}): Promise<GetOrdersResponse>;
|
|
29
17
|
/**
|
|
30
18
|
* Generate the data needed to fulfill a listing or an offer onchain.
|
|
31
19
|
*/
|
|
32
20
|
generateFulfillmentData(fulfillerAddress: string, orderHash: string, protocolAddress: string, side: OrderSide, assetContractAddress?: string, tokenId?: string, unitsToFill?: string, recipientAddress?: string, includeOptionalCreatorFees?: boolean): Promise<FulfillmentDataResponse>;
|
|
33
21
|
/**
|
|
34
|
-
* Post
|
|
35
|
-
* @deprecated Use postListing or postOffer instead.
|
|
36
|
-
*/
|
|
37
|
-
postOrder(order: ProtocolData, apiOptions: OrderAPIOptions): Promise<OrderV2>;
|
|
38
|
-
/**
|
|
39
|
-
* Post a listing to OpenSea. Returns the new Listing response format.
|
|
22
|
+
* Post a listing to OpenSea.
|
|
40
23
|
*/
|
|
41
24
|
postListing(order: ProtocolData, protocolAddress: string): Promise<Listing>;
|
|
42
25
|
/**
|
|
43
|
-
* Post an offer to OpenSea.
|
|
26
|
+
* Post an offer to OpenSea.
|
|
44
27
|
*/
|
|
45
28
|
postOffer(order: ProtocolData, protocolAddress: string): Promise<Offer>;
|
|
46
29
|
/**
|
package/lib/api/orders.js
CHANGED
|
@@ -14,30 +14,6 @@ class OrdersAPI {
|
|
|
14
14
|
this.fetcher = fetcher;
|
|
15
15
|
this.chain = chain;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Gets an order from API based on query options.
|
|
19
|
-
* @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
|
|
20
|
-
*/
|
|
21
|
-
async getOrder({ side, protocol = "seaport", orderDirection = "desc", orderBy = "created_date", ...restOptions }) {
|
|
22
|
-
// Validate eth_price orderBy requires additional parameters
|
|
23
|
-
if (orderBy === "eth_price") {
|
|
24
|
-
const hasTokenId = (restOptions.tokenIds?.length ?? 0) > 0 ||
|
|
25
|
-
restOptions.tokenId !== undefined;
|
|
26
|
-
if (!restOptions.assetContractAddress || !hasTokenId) {
|
|
27
|
-
throw new Error('When using orderBy: "eth_price", you must provide both assetContractAddress and tokenIds (or tokenId) parameters');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const { orders } = await this.fetcher.get((0, apiPaths_1.getOrdersAPIPath)(this.chain, protocol, side), (0, utils_1.serializeOrdersQueryOptions)({
|
|
31
|
-
limit: 1,
|
|
32
|
-
orderBy,
|
|
33
|
-
orderDirection,
|
|
34
|
-
...restOptions,
|
|
35
|
-
}));
|
|
36
|
-
if (orders.length === 0) {
|
|
37
|
-
throw new Error("Not found: no matching order found");
|
|
38
|
-
}
|
|
39
|
-
return (0, utils_1.deserializeOrder)(orders[0]);
|
|
40
|
-
}
|
|
41
17
|
/**
|
|
42
18
|
* Gets a single order by its order hash.
|
|
43
19
|
* Returns the raw API response which can be either an Offer or Listing.
|
|
@@ -46,77 +22,17 @@ class OrdersAPI {
|
|
|
46
22
|
const response = await this.fetcher.get((0, apiPaths_1.getOrderByHashPath)(chain, protocolAddress, orderHash));
|
|
47
23
|
return response.order;
|
|
48
24
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Gets a list of orders from API based on query options.
|
|
51
|
-
* @deprecated Use collection-based endpoints instead: getAllOffers, getAllListings, getBestOffer, getBestListing.
|
|
52
|
-
*/
|
|
53
|
-
async getOrders({ side, protocol = "seaport", orderDirection = "desc", orderBy = "created_date", pageSize = 20, ...restOptions }) {
|
|
54
|
-
// Validate eth_price orderBy requires additional parameters
|
|
55
|
-
if (orderBy === "eth_price") {
|
|
56
|
-
const hasTokenId = (restOptions.tokenIds?.length ?? 0) > 0 ||
|
|
57
|
-
restOptions.tokenId !== undefined;
|
|
58
|
-
if (!restOptions.assetContractAddress || !hasTokenId) {
|
|
59
|
-
throw new Error('When using orderBy: "eth_price", you must provide both assetContractAddress and tokenIds (or tokenId) parameters');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const response = await this.fetcher.get((0, apiPaths_1.getOrdersAPIPath)(this.chain, protocol, side), (0, utils_1.serializeOrdersQueryOptions)({
|
|
63
|
-
limit: pageSize,
|
|
64
|
-
orderBy,
|
|
65
|
-
orderDirection,
|
|
66
|
-
...restOptions,
|
|
67
|
-
}));
|
|
68
|
-
return {
|
|
69
|
-
...response,
|
|
70
|
-
orders: response.orders.map(utils_1.deserializeOrder),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
25
|
/**
|
|
74
26
|
* Generate the data needed to fulfill a listing or an offer onchain.
|
|
75
27
|
*/
|
|
76
28
|
async generateFulfillmentData(fulfillerAddress, orderHash, protocolAddress, side, assetContractAddress, tokenId, unitsToFill, recipientAddress, includeOptionalCreatorFees = false) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
else {
|
|
82
|
-
payload = (0, utils_1.getFulfillOfferPayload)(fulfillerAddress, orderHash, protocolAddress, this.chain, assetContractAddress, tokenId, unitsToFill, includeOptionalCreatorFees);
|
|
83
|
-
}
|
|
84
|
-
const response = await this.fetcher.post((0, utils_1.getFulfillmentDataPath)(side), payload);
|
|
85
|
-
return response;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Post an order to OpenSea.
|
|
89
|
-
* @deprecated Use postListing or postOffer instead.
|
|
90
|
-
*/
|
|
91
|
-
async postOrder(order, apiOptions) {
|
|
92
|
-
const { protocol = "seaport", side, protocolAddress } = apiOptions;
|
|
93
|
-
// Validate required fields
|
|
94
|
-
if (!side) {
|
|
95
|
-
throw new Error("apiOptions.side is required");
|
|
96
|
-
}
|
|
97
|
-
if (!protocolAddress) {
|
|
98
|
-
throw new Error("apiOptions.protocolAddress is required");
|
|
99
|
-
}
|
|
100
|
-
if (!order) {
|
|
101
|
-
throw new Error("order data is required");
|
|
102
|
-
}
|
|
103
|
-
// Validate protocol value
|
|
104
|
-
if (protocol !== "seaport") {
|
|
105
|
-
throw new Error("Currently only 'seaport' protocol is supported");
|
|
106
|
-
}
|
|
107
|
-
// Validate side value
|
|
108
|
-
if (side !== "listing" && side !== "offer") {
|
|
109
|
-
throw new Error("side must be either 'listing' or 'offer'");
|
|
110
|
-
}
|
|
111
|
-
// Validate protocolAddress format
|
|
112
|
-
if (!/^0x[a-fA-F0-9]{40}$/.test(protocolAddress)) {
|
|
113
|
-
throw new Error("Invalid protocol address format");
|
|
114
|
-
}
|
|
115
|
-
const response = await this.fetcher.post((0, apiPaths_1.getOrdersAPIPath)(this.chain, protocol, side), { ...order, protocol_address: protocolAddress });
|
|
116
|
-
return (0, utils_1.deserializeOrder)(response.order);
|
|
29
|
+
const payload = side === types_1.OrderSide.LISTING
|
|
30
|
+
? (0, utils_1.getFulfillListingPayload)(fulfillerAddress, orderHash, protocolAddress, this.chain, assetContractAddress, tokenId, unitsToFill, recipientAddress, includeOptionalCreatorFees)
|
|
31
|
+
: (0, utils_1.getFulfillOfferPayload)(fulfillerAddress, orderHash, protocolAddress, this.chain, assetContractAddress, tokenId, unitsToFill, includeOptionalCreatorFees);
|
|
32
|
+
return this.fetcher.post((0, utils_1.getFulfillmentDataPath)(side), payload);
|
|
117
33
|
}
|
|
118
34
|
/**
|
|
119
|
-
* Post a listing to OpenSea.
|
|
35
|
+
* Post a listing to OpenSea.
|
|
120
36
|
*/
|
|
121
37
|
async postListing(order, protocolAddress) {
|
|
122
38
|
if (!order) {
|
|
@@ -125,11 +41,13 @@ class OrdersAPI {
|
|
|
125
41
|
if (!protocolAddress || !/^0x[a-fA-F0-9]{40}$/.test(protocolAddress)) {
|
|
126
42
|
throw new Error("Invalid protocol address format");
|
|
127
43
|
}
|
|
128
|
-
|
|
129
|
-
|
|
44
|
+
return this.fetcher.post((0, apiPaths_1.getPostListingPath)(this.chain, "seaport"), {
|
|
45
|
+
...order,
|
|
46
|
+
protocol_address: protocolAddress,
|
|
47
|
+
});
|
|
130
48
|
}
|
|
131
49
|
/**
|
|
132
|
-
* Post an offer to OpenSea.
|
|
50
|
+
* Post an offer to OpenSea.
|
|
133
51
|
*/
|
|
134
52
|
async postOffer(order, protocolAddress) {
|
|
135
53
|
if (!order) {
|
|
@@ -138,15 +56,16 @@ class OrdersAPI {
|
|
|
138
56
|
if (!protocolAddress || !/^0x[a-fA-F0-9]{40}$/.test(protocolAddress)) {
|
|
139
57
|
throw new Error("Invalid protocol address format");
|
|
140
58
|
}
|
|
141
|
-
|
|
142
|
-
|
|
59
|
+
return this.fetcher.post((0, apiPaths_1.getPostOfferPath)(this.chain, "seaport"), {
|
|
60
|
+
...order,
|
|
61
|
+
protocol_address: protocolAddress,
|
|
62
|
+
});
|
|
143
63
|
}
|
|
144
64
|
/**
|
|
145
65
|
* Offchain cancel an order, offer or listing, by its order hash when protected by the SignedZone.
|
|
146
66
|
*/
|
|
147
67
|
async offchainCancelOrder(protocolAddress, orderHash, chain = this.chain, offererSignature) {
|
|
148
|
-
|
|
149
|
-
return response;
|
|
68
|
+
return this.fetcher.post((0, apiPaths_1.getCancelOrderPath)(chain, protocolAddress, orderHash), { offererSignature });
|
|
150
69
|
}
|
|
151
70
|
}
|
|
152
71
|
exports.OrdersAPI = OrdersAPI;
|
package/lib/api/orders.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/api/orders.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/api/orders.ts"],"names":[],"mappings":";;;AACA,2CAIwB;AACxB,oCAAgD;AAChD,yCAKmB;AASnB;;GAEG;AACH,MAAa,SAAS;IAEV;IACA;IAFV,YACU,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CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;QACpD,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,IAAA,6BAAkB,EAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,EACzC;YACE,GAAG,KAAK;YACR,gBAAgB,EAAE,eAAe;SAClC,CACF,CAAA;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CACb,KAAmB,EACnB,eAAuB;QAEvB,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAC3C,CAAC;QACD,IAAI,CAAC,eAAe,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;QACpD,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAQ,IAAA,2BAAgB,EAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE;YACvE,GAAG,KAAK;YACR,gBAAgB,EAAE,eAAe;SAClC,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CACvB,eAAuB,EACvB,SAAiB,EACjB,QAAe,IAAI,CAAC,KAAK,EACzB,gBAAyB;QAEzB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,IAAA,6BAAkB,EAAC,KAAK,EAAE,eAAe,EAAE,SAAS,CAAC,EACrD,EAAE,gBAAgB,EAAE,CACrB,CAAA;IACH,CAAC;CACF;AAzHD,8BAyHC"}
|
package/lib/api/tokens.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fetcher } from "./fetcher";
|
|
2
|
-
import type { GetSwapQuoteArgs, GetSwapQuoteResponse, GetTokenGroupResponse, GetTokenGroupsArgs, GetTokenGroupsResponse, GetTokenResponse, GetTokensArgs, GetTopTokensResponse, GetTrendingTokensResponse } from "./types";
|
|
2
|
+
import type { GetSwapQuoteArgs, GetSwapQuoteResponse, GetTokenGroupResponse, GetTokenGroupsArgs, GetTokenGroupsResponse, GetTokenResponse, GetTokensArgs, GetTopTokensResponse, GetTrendingTokensResponse, SwapExecuteRequest, SwapExecuteResponse } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* Token-related API operations
|
|
5
5
|
*/
|
|
@@ -18,6 +18,11 @@ export declare class TokensAPI {
|
|
|
18
18
|
* Gets a swap quote.
|
|
19
19
|
*/
|
|
20
20
|
getSwapQuote(args: GetSwapQuoteArgs): Promise<GetSwapQuoteResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Get executable transactions for a token swap.
|
|
23
|
+
* Supports same-chain and cross-chain swaps with multiple from/to assets.
|
|
24
|
+
*/
|
|
25
|
+
executeSwap(request: SwapExecuteRequest): Promise<SwapExecuteResponse>;
|
|
21
26
|
/**
|
|
22
27
|
* Gets details for a specific token.
|
|
23
28
|
*/
|
package/lib/api/tokens.js
CHANGED
|
@@ -31,6 +31,13 @@ class TokensAPI {
|
|
|
31
31
|
const response = await this.fetcher.get((0, apiPaths_1.getSwapQuotePath)(), args);
|
|
32
32
|
return response;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Get executable transactions for a token swap.
|
|
36
|
+
* Supports same-chain and cross-chain swaps with multiple from/to assets.
|
|
37
|
+
*/
|
|
38
|
+
async executeSwap(request) {
|
|
39
|
+
return this.fetcher.post((0, apiPaths_1.getSwapExecutePath)(), request);
|
|
40
|
+
}
|
|
34
41
|
/**
|
|
35
42
|
* Gets details for a specific token.
|
|
36
43
|
*/
|
package/lib/api/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/api/tokens.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"tokens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B,IAAA,6BAAkB,GAAE,EAAE,IAAI,CAAC,CAAA;IAC7E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAwB,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAC,CAAA;IACzE,CAAC;CACF;AAvED,8BAuEC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Fetcher } from "./fetcher";
|
|
2
|
+
import type { TransactionReceiptRequest, TransactionReceiptResponse } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Transaction-related API operations
|
|
5
|
+
*/
|
|
6
|
+
export declare class TransactionsAPI {
|
|
7
|
+
private fetcher;
|
|
8
|
+
constructor(fetcher: Fetcher);
|
|
9
|
+
/**
|
|
10
|
+
* Get the receipt/status for a submitted transaction.
|
|
11
|
+
* Works for all transaction types: listing fulfillments, cross-chain buys,
|
|
12
|
+
* sweeps, offer fulfillments, and token swaps. Poll this endpoint to check
|
|
13
|
+
* completion status.
|
|
14
|
+
*/
|
|
15
|
+
getTransactionReceipt(request: TransactionReceiptRequest): Promise<TransactionReceiptResponse>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionsAPI = void 0;
|
|
4
|
+
const apiPaths_1 = require("./apiPaths");
|
|
5
|
+
/**
|
|
6
|
+
* Transaction-related API operations
|
|
7
|
+
*/
|
|
8
|
+
class TransactionsAPI {
|
|
9
|
+
fetcher;
|
|
10
|
+
constructor(fetcher) {
|
|
11
|
+
this.fetcher = fetcher;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get the receipt/status for a submitted transaction.
|
|
15
|
+
* Works for all transaction types: listing fulfillments, cross-chain buys,
|
|
16
|
+
* sweeps, offer fulfillments, and token swaps. Poll this endpoint to check
|
|
17
|
+
* completion status.
|
|
18
|
+
*/
|
|
19
|
+
async getTransactionReceipt(request) {
|
|
20
|
+
return this.fetcher.post((0, apiPaths_1.getTransactionReceiptPath)(), request);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.TransactionsAPI = TransactionsAPI;
|
|
24
|
+
//# sourceMappingURL=transactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.js","sourceRoot":"","sources":["../../src/api/transactions.ts"],"names":[],"mappings":";;;AAAA,yCAAsD;AAOtD;;GAEG;AACH,MAAa,eAAe;IACN;IAApB,YAAoB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAExC;;;;;OAKG;IACH,KAAK,CAAC,qBAAqB,CACzB,OAAkC;QAElC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,IAAA,oCAAyB,GAAE,EAC3B,OAAO,CACR,CAAA;IACH,CAAC;CACF;AAjBD,0CAiBC"}
|
package/lib/api/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AssetMetadataResponse, InstantApiKeyResponse, TokenGroupPaginatedResponse, TokenGroupResponse } from "@opensea/api-types";
|
|
1
|
+
import type { SwapExecuteRequest as ApiSwapExecuteRequest, SwapExecuteResponse as ApiSwapExecuteResponse, SweepCollectionRequest as ApiSweepCollectionRequest, SweepCollectionResponse as ApiSweepCollectionResponse, TransactionReceiptRequest as ApiTransactionReceiptRequest, TransactionReceiptResponse as ApiTransactionReceiptResponse, AssetMetadataResponse, InstantApiKeyResponse, TokenGroupPaginatedResponse, TokenGroupResponse } from "@opensea/api-types";
|
|
2
2
|
import type { ConsiderationItem } from "@opensea/seaport-js/lib/types";
|
|
3
|
-
import type { OrderType,
|
|
3
|
+
import type { OrderType, ProtocolData } from "../orders/types";
|
|
4
4
|
import type { OpenSeaCollection } from "../types";
|
|
5
5
|
/**
|
|
6
6
|
* A single trait filter used by collection-scoped read endpoints (NFTs by
|
|
@@ -222,14 +222,6 @@ export type GetNFTResponse = {
|
|
|
222
222
|
/** See {@link NFT} */
|
|
223
223
|
nft: NFT;
|
|
224
224
|
};
|
|
225
|
-
/**
|
|
226
|
-
* Response from OpenSea API for fetching Orders.
|
|
227
|
-
* @category API Response Types
|
|
228
|
-
*/
|
|
229
|
-
export type GetOrdersResponse = QueryCursors & {
|
|
230
|
-
/** List of {@link OrderV2} */
|
|
231
|
-
orders: OrderV2[];
|
|
232
|
-
};
|
|
233
225
|
/**
|
|
234
226
|
* Base query cursors response from OpenSea API.
|
|
235
227
|
* @category API Response Types
|
|
@@ -274,6 +266,36 @@ export type GetOrderByHashResponse = Offer | Listing;
|
|
|
274
266
|
export type CancelOrderResponse = {
|
|
275
267
|
last_signature_issued_valid_until: string | null;
|
|
276
268
|
};
|
|
269
|
+
/**
|
|
270
|
+
* Request body for sweeping (bulk-buying) items from a collection.
|
|
271
|
+
* @category API Query Args
|
|
272
|
+
*/
|
|
273
|
+
export type SweepCollectionRequest = ApiSweepCollectionRequest;
|
|
274
|
+
/**
|
|
275
|
+
* Response from sweeping a collection.
|
|
276
|
+
* @category API Response Types
|
|
277
|
+
*/
|
|
278
|
+
export type SweepCollectionResponse = ApiSweepCollectionResponse;
|
|
279
|
+
/**
|
|
280
|
+
* Request body for executing a token swap.
|
|
281
|
+
* @category API Query Args
|
|
282
|
+
*/
|
|
283
|
+
export type SwapExecuteRequest = ApiSwapExecuteRequest;
|
|
284
|
+
/**
|
|
285
|
+
* Response from executing a token swap.
|
|
286
|
+
* @category API Response Types
|
|
287
|
+
*/
|
|
288
|
+
export type SwapExecuteResponse = ApiSwapExecuteResponse;
|
|
289
|
+
/**
|
|
290
|
+
* Request body for fetching a transaction receipt.
|
|
291
|
+
* @category API Query Args
|
|
292
|
+
*/
|
|
293
|
+
export type TransactionReceiptRequest = ApiTransactionReceiptRequest;
|
|
294
|
+
/**
|
|
295
|
+
* Response from fetching a transaction receipt.
|
|
296
|
+
* @category API Response Types
|
|
297
|
+
*/
|
|
298
|
+
export type TransactionReceiptResponse = ApiTransactionReceiptResponse;
|
|
277
299
|
/**
|
|
278
300
|
* NFT type returned by OpenSea API.
|
|
279
301
|
* @category API Models
|
package/lib/api/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":";;;AAwCA,8CAIC;AAVD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,MAAiC;IAEjC,OAAO,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACzE,CAAC;AA4GD,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,wDAA6B,CAAA;IAC7B,4DAAiC,CAAA;IACjC,gEAAqC,CAAA;IACrC,gEAAqC,CAAA;IACrC,oDAAyB,CAAA;IACzB,oDAAyB,CAAA;AAC3B,CAAC,EAPW,uBAAuB,uCAAvB,uBAAuB,QAOlC;AAED;;;GAGG;AACH,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;AACzB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAuPD;;;GAGG;AACH,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,yDAAqC,CAAA;IACrC,iDAA6B,CAAA;IAC7B,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,uCAAuC;IACvC,iCAAa,CAAA;AACf,CAAC,EARW,gBAAgB,gCAAhB,gBAAgB,QAQ3B;AAED;;;GAGG;AACH,IAAY,cASX;AATD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,uCAAqB,CAAA;IACrB,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,iCAAe,CAAA;IACf,iCAAe,CAAA;IACf,6CAA2B,CAAA;IAC3B,uDAAqC,CAAA;AACvC,CAAC,EATW,cAAc,8BAAd,cAAc,QASzB;AAED;;;GAGG;AACH,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,2CAAyB,CAAA;IACzB,uDAAqC,CAAA;IACrC,6CAA2B,CAAA;AAC7B,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB"}
|
package/lib/orders/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { BasicOrderParametersStruct } from "@opensea/seaport-js/lib/typechain-types/seaport/contracts/Seaport";
|
|
2
2
|
import type { AdvancedOrder, OrderWithCounter } from "@opensea/seaport-js/lib/types";
|
|
3
|
-
import type { Listing, Offer } from "../api/types";
|
|
4
3
|
import type { OpenSeaAccount, OrderSide } from "../types";
|
|
5
4
|
type OrderProtocolToProtocolData = {
|
|
6
5
|
seaport: OrderWithCounter;
|
|
@@ -87,74 +86,8 @@ type Transaction = {
|
|
|
87
86
|
orders: OrderWithCounter[] | AdvancedOrder[] | BasicOrderParametersStruct[];
|
|
88
87
|
};
|
|
89
88
|
};
|
|
90
|
-
type OpenOrderOrderingOption = "created_date" | "eth_price";
|
|
91
|
-
type OrderByDirection = "asc" | "desc";
|
|
92
|
-
export type OrderAPIOptions = {
|
|
93
|
-
protocol?: OrderProtocol;
|
|
94
|
-
protocolAddress?: string;
|
|
95
|
-
side: OrderSide;
|
|
96
|
-
};
|
|
97
|
-
export type OrdersQueryOptions = OrderAPIOptions & {
|
|
98
|
-
limit?: number;
|
|
99
|
-
cursor?: string;
|
|
100
|
-
next?: string;
|
|
101
|
-
paymentTokenAddress?: string;
|
|
102
|
-
maker?: string;
|
|
103
|
-
taker?: string;
|
|
104
|
-
owner?: string;
|
|
105
|
-
listedAfter?: number | string;
|
|
106
|
-
listedBefore?: number | string;
|
|
107
|
-
tokenId?: string;
|
|
108
|
-
tokenIds?: string[];
|
|
109
|
-
assetContractAddress?: string;
|
|
110
|
-
orderBy?: OpenOrderOrderingOption;
|
|
111
|
-
orderDirection?: OrderByDirection;
|
|
112
|
-
onlyEnglish?: boolean;
|
|
113
|
-
};
|
|
114
|
-
export type SerializedOrderV2 = {
|
|
115
|
-
created_date: string;
|
|
116
|
-
closing_date: string | null;
|
|
117
|
-
listing_time: number;
|
|
118
|
-
expiration_time: number;
|
|
119
|
-
order_hash: string | null;
|
|
120
|
-
maker: unknown;
|
|
121
|
-
taker: unknown | null;
|
|
122
|
-
protocol_data: ProtocolData;
|
|
123
|
-
protocol_address: string;
|
|
124
|
-
current_price: string;
|
|
125
|
-
maker_fees: {
|
|
126
|
-
account: unknown;
|
|
127
|
-
basis_points: string;
|
|
128
|
-
}[];
|
|
129
|
-
taker_fees: {
|
|
130
|
-
account: unknown;
|
|
131
|
-
basis_points: string;
|
|
132
|
-
}[];
|
|
133
|
-
side: OrderSide;
|
|
134
|
-
order_type: OrderType;
|
|
135
|
-
cancelled: boolean;
|
|
136
|
-
finalized: boolean;
|
|
137
|
-
marked_invalid: boolean;
|
|
138
|
-
client_signature: string | null;
|
|
139
|
-
remaining_quantity: number;
|
|
140
|
-
};
|
|
141
89
|
export type QueryCursors = {
|
|
142
90
|
next: string | null;
|
|
143
91
|
previous: string | null;
|
|
144
92
|
};
|
|
145
|
-
export type OrdersQueryResponse = QueryCursors & {
|
|
146
|
-
orders: SerializedOrderV2[];
|
|
147
|
-
};
|
|
148
|
-
/** @deprecated Use ListingPostQueryResponse or OfferPostQueryResponse instead. */
|
|
149
|
-
export type OrdersPostQueryResponse = {
|
|
150
|
-
order: SerializedOrderV2;
|
|
151
|
-
};
|
|
152
|
-
export type ListingPostQueryResponse = {
|
|
153
|
-
order: SerializedOrderV2;
|
|
154
|
-
listing: Listing;
|
|
155
|
-
};
|
|
156
|
-
export type OfferPostQueryResponse = {
|
|
157
|
-
order: SerializedOrderV2;
|
|
158
|
-
offer: Offer;
|
|
159
|
-
};
|
|
160
93
|
export {};
|
package/lib/orders/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/orders/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/orders/types.ts"],"names":[],"mappings":";;;AAeA,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,gCAAmB,CAAA;IACnB,kCAAqB,CAAA;AACvB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
|
package/lib/orders/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Chain, OrderSide } from "../types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ProtocolData } from "./types";
|
|
3
3
|
export declare const DEFAULT_SEAPORT_CONTRACT_ADDRESS = "0x0000000000000068F116a894984e2DB1123eB395";
|
|
4
4
|
export declare const getPostCollectionOfferPayload: (collectionSlug: string, protocol_data: ProtocolData, chain: Chain, traitType?: string, traitValue?: string, traits?: Array<{
|
|
5
5
|
type: string;
|
|
@@ -69,21 +69,3 @@ export declare const getFulfillOfferPayload: (fulfillerAddress: string, order_ha
|
|
|
69
69
|
units_to_fill: string;
|
|
70
70
|
include_optional_creator_fees: boolean;
|
|
71
71
|
};
|
|
72
|
-
type OrdersQueryPathOptions = "protocol" | "side";
|
|
73
|
-
export declare const serializeOrdersQueryOptions: (options: Omit<OrdersQueryOptions, OrdersQueryPathOptions>) => {
|
|
74
|
-
limit: number | undefined;
|
|
75
|
-
cursor: string | undefined;
|
|
76
|
-
payment_token_address: string | undefined;
|
|
77
|
-
maker: string | undefined;
|
|
78
|
-
taker: string | undefined;
|
|
79
|
-
owner: string | undefined;
|
|
80
|
-
listed_after: string | number | undefined;
|
|
81
|
-
listed_before: string | number | undefined;
|
|
82
|
-
token_ids: string[] | undefined;
|
|
83
|
-
asset_contract_address: string | undefined;
|
|
84
|
-
order_by: ("created_date" | "eth_price") | undefined;
|
|
85
|
-
order_direction: ("asc" | "desc") | undefined;
|
|
86
|
-
only_english: boolean | undefined;
|
|
87
|
-
};
|
|
88
|
-
export declare const deserializeOrder: (order: SerializedOrderV2) => OrderV2;
|
|
89
|
-
export {};
|
package/lib/orders/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getFulfillOfferPayload = exports.getFulfillListingPayload = exports.getFulfillmentDataPath = exports.getBuildCollectionOfferPayload = exports.getPostCollectionOfferPayload = exports.DEFAULT_SEAPORT_CONTRACT_ADDRESS = void 0;
|
|
4
4
|
const constants_1 = require("@opensea/seaport-js/lib/constants");
|
|
5
5
|
const apiPaths_1 = require("../api/apiPaths");
|
|
6
6
|
const types_1 = require("../types");
|
|
@@ -121,65 +121,4 @@ const getFulfillOfferPayload = (fulfillerAddress, order_hash, protocolAddress, c
|
|
|
121
121
|
return payload;
|
|
122
122
|
};
|
|
123
123
|
exports.getFulfillOfferPayload = getFulfillOfferPayload;
|
|
124
|
-
const serializeOrdersQueryOptions = (options) => {
|
|
125
|
-
const tokenIds = options.tokenIds && options.tokenIds.length > 0
|
|
126
|
-
? options.tokenIds
|
|
127
|
-
: options.tokenId !== undefined
|
|
128
|
-
? [options.tokenId]
|
|
129
|
-
: options.tokenIds;
|
|
130
|
-
return {
|
|
131
|
-
limit: options.limit,
|
|
132
|
-
cursor: options.cursor ?? options.next,
|
|
133
|
-
payment_token_address: options.paymentTokenAddress,
|
|
134
|
-
maker: options.maker,
|
|
135
|
-
taker: options.taker,
|
|
136
|
-
owner: options.owner,
|
|
137
|
-
listed_after: options.listedAfter,
|
|
138
|
-
listed_before: options.listedBefore,
|
|
139
|
-
token_ids: tokenIds,
|
|
140
|
-
asset_contract_address: options.assetContractAddress,
|
|
141
|
-
order_by: options.orderBy,
|
|
142
|
-
order_direction: options.orderDirection,
|
|
143
|
-
only_english: options.onlyEnglish,
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
exports.serializeOrdersQueryOptions = serializeOrdersQueryOptions;
|
|
147
|
-
/** Map API side values ("ask"/"bid") to SDK OrderSide enum values */
|
|
148
|
-
const mapApiSide = (side) => {
|
|
149
|
-
if (side === "ask" || side === types_1.OrderSide.LISTING)
|
|
150
|
-
return types_1.OrderSide.LISTING;
|
|
151
|
-
if (side === "bid" || side === types_1.OrderSide.OFFER)
|
|
152
|
-
return types_1.OrderSide.OFFER;
|
|
153
|
-
return side;
|
|
154
|
-
};
|
|
155
|
-
const deserializeOrder = (order) => {
|
|
156
|
-
return {
|
|
157
|
-
createdDate: order.created_date,
|
|
158
|
-
closingDate: order.closing_date,
|
|
159
|
-
listingTime: order.listing_time,
|
|
160
|
-
expirationTime: order.expiration_time,
|
|
161
|
-
orderHash: order.order_hash,
|
|
162
|
-
maker: (0, utils_1.accountFromJSON)(order.maker),
|
|
163
|
-
taker: order.taker ? (0, utils_1.accountFromJSON)(order.taker) : null,
|
|
164
|
-
protocolData: order.protocol_data,
|
|
165
|
-
protocolAddress: order.protocol_address,
|
|
166
|
-
currentPrice: BigInt(order.current_price),
|
|
167
|
-
makerFees: (order.maker_fees ?? []).map(({ account, basis_points }) => ({
|
|
168
|
-
account: (0, utils_1.accountFromJSON)(account),
|
|
169
|
-
basisPoints: basis_points,
|
|
170
|
-
})),
|
|
171
|
-
takerFees: (order.taker_fees ?? []).map(({ account, basis_points }) => ({
|
|
172
|
-
account: (0, utils_1.accountFromJSON)(account),
|
|
173
|
-
basisPoints: basis_points,
|
|
174
|
-
})),
|
|
175
|
-
side: mapApiSide(order.side),
|
|
176
|
-
orderType: order.order_type,
|
|
177
|
-
cancelled: order.cancelled,
|
|
178
|
-
finalized: order.finalized,
|
|
179
|
-
markedInvalid: order.marked_invalid,
|
|
180
|
-
clientSignature: order.client_signature,
|
|
181
|
-
remainingQuantity: order.remaining_quantity,
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
exports.deserializeOrder = deserializeOrder;
|
|
185
124
|
//# sourceMappingURL=utils.js.map
|
package/lib/orders/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/orders/utils.ts"],"names":[],"mappings":";;;AAAA,iEAAoF;AACpF,8CAA+C;AAC/C,oCAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/orders/utils.ts"],"names":[],"mappings":";;;AAAA,iEAAoF;AACpF,8CAA+C;AAC/C,oCAAgD;AAChD,oCAA4C;AAG/B,QAAA,gCAAgC,GAAG,4CAAgC,CAAA;AAEzE,MAAM,6BAA6B,GAAG,CAC3C,cAAsB,EACtB,aAA2B,EAC3B,KAAY,EACZ,SAAkB,EAClB,UAAmB,EACnB,MAA+C,EAC/C,aAAmE,EACnE,EAAE;IACF,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE;YACR,UAAU,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;SACrC;QACD,aAAa;QACb,gBAAgB,EAAE,IAAA,yBAAiB,EAAC,KAAK,CAAC;KAC3C,CAAA;IAED,sCAAsC;IACtC,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,CAAC;QAAC,OAAO,CAAC,QAAgB,CAAC,MAAM,GAAG,MAAM,CAAA;IAC5C,CAAC;SAAM,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,sDAAsD;QACtD,CAAC;QAAC,OAAO,CAAC,QAAgB,CAAC,KAAK,GAAG;YACjC,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,UAAU;SAClB,CAAA;IACH,CAAC;IACD,IAAI,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC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