@opensea/seaport-js 2.0.4 → 2.0.6
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 +4 -4
- package/lib/bundle.js +10 -5
- package/lib/seaport.js +10 -5
- package/lib/seaport.js.map +1 -1
- package/lib/typechain-types/seaport-core/src/lib/Assertions.d.ts +4 -4
- package/lib/typechain-types/seaport-core/src/lib/BasicOrderFulfiller.d.ts +4 -4
- package/lib/typechain-types/seaport-core/src/lib/Consideration.d.ts +6 -6
- package/lib/typechain-types/seaport-core/src/lib/ConsiderationBase.d.ts +4 -4
- package/lib/typechain-types/seaport-core/src/lib/CounterManager.d.ts +4 -4
- package/lib/typechain-types/seaport-core/src/lib/Executor.d.ts +4 -4
- package/lib/typechain-types/seaport-core/src/lib/GettersAndDerivers.d.ts +4 -4
- package/lib/typechain-types/seaport-core/src/lib/OrderCombiner.d.ts +4 -4
- package/lib/typechain-types/seaport-core/src/lib/OrderFulfiller.d.ts +4 -4
- package/lib/typechain-types/seaport-core/src/lib/OrderValidator.d.ts +4 -4
- package/lib/typechain-types/seaport-core/src/lib/Verifiers.d.ts +4 -4
- package/lib/typechain-types/seaport-types/src/interfaces/ConsiderationEventsAndErrors.d.ts +4 -4
- package/lib/typechain-types/seaport-types/src/interfaces/ConsiderationInterface.d.ts +2 -2
- package/lib/typechain-types/seaport_v1_4/contracts/Seaport.d.ts +6 -6
- package/lib/typechain-types/seaport_v1_5/contracts/Seaport.d.ts +6 -6
- package/lib/types.d.ts +1 -0
- package/lib/utils/criteria.js.map +1 -1
- package/package.json +6 -6
- package/src/constants.ts +1 -1
- package/src/seaport.ts +66 -59
- package/src/typechain-types/seaport-core/src/lib/Assertions.ts +4 -4
- package/src/typechain-types/seaport-core/src/lib/BasicOrderFulfiller.ts +4 -4
- package/src/typechain-types/seaport-core/src/lib/Consideration.ts +6 -6
- package/src/typechain-types/seaport-core/src/lib/ConsiderationBase.ts +4 -4
- package/src/typechain-types/seaport-core/src/lib/CounterManager.ts +4 -4
- package/src/typechain-types/seaport-core/src/lib/Executor.ts +4 -4
- package/src/typechain-types/seaport-core/src/lib/GettersAndDerivers.ts +4 -4
- package/src/typechain-types/seaport-core/src/lib/OrderCombiner.ts +4 -4
- package/src/typechain-types/seaport-core/src/lib/OrderFulfiller.ts +4 -4
- package/src/typechain-types/seaport-core/src/lib/OrderValidator.ts +4 -4
- package/src/typechain-types/seaport-core/src/lib/Verifiers.ts +4 -4
- package/src/typechain-types/seaport-types/src/interfaces/ConsiderationEventsAndErrors.ts +4 -4
- package/src/typechain-types/seaport-types/src/interfaces/ConsiderationInterface.ts +2 -2
- package/src/typechain-types/seaport_v1_4/contracts/Seaport.ts +6 -6
- package/src/typechain-types/seaport_v1_5/contracts/Seaport.ts +6 -6
- package/src/types.ts +13 -12
- package/src/utils/approval.ts +9 -9
- package/src/utils/balance.ts +7 -7
- package/src/utils/balanceAndApprovalCheck.ts +22 -22
- package/src/utils/criteria.ts +7 -7
- package/src/utils/eip712/Eip712MerkleTree.ts +2 -2
- package/src/utils/eip712/bulk-orders.ts +2 -2
- package/src/utils/eip712/defaults.ts +5 -5
- package/src/utils/eip712/utils.ts +1 -1
- package/src/utils/fulfill.ts +44 -44
- package/src/utils/item.ts +3 -3
- package/src/utils/merkletree.ts +2 -2
- package/src/utils/order.ts +15 -15
- package/src/utils/usecase.ts +8 -8
package/src/utils/order.ts
CHANGED
|
@@ -42,7 +42,7 @@ export const feeToConsiderationItem = ({
|
|
|
42
42
|
|
|
43
43
|
export const deductFees = <T extends Item>(
|
|
44
44
|
items: T[],
|
|
45
|
-
fees?: readonly Fee[]
|
|
45
|
+
fees?: readonly Fee[],
|
|
46
46
|
): T[] => {
|
|
47
47
|
if (!fees) {
|
|
48
48
|
return items;
|
|
@@ -50,7 +50,7 @@ export const deductFees = <T extends Item>(
|
|
|
50
50
|
|
|
51
51
|
const totalBasisPoints = fees.reduce(
|
|
52
52
|
(accBasisPoints, fee) => accBasisPoints + fee.basisPoints,
|
|
53
|
-
0
|
|
53
|
+
0,
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
return items.map((item) => ({
|
|
@@ -134,7 +134,7 @@ export const areAllCurrenciesSame = ({
|
|
|
134
134
|
return currencies.every(
|
|
135
135
|
({ itemType, token }) =>
|
|
136
136
|
itemType === currencies[0].itemType &&
|
|
137
|
-
token.toLowerCase() === currencies[0].token.toLowerCase()
|
|
137
|
+
token.toLowerCase() === currencies[0].token.toLowerCase(),
|
|
138
138
|
);
|
|
139
139
|
};
|
|
140
140
|
|
|
@@ -152,7 +152,7 @@ export const totalItemsAmount = <T extends OfferItem>(items: T[]) => {
|
|
|
152
152
|
.reduce<typeof initialValues>(
|
|
153
153
|
(
|
|
154
154
|
{ startAmount: totalStartAmount, endAmount: totalEndAmount },
|
|
155
|
-
{ startAmount, endAmount }
|
|
155
|
+
{ startAmount, endAmount },
|
|
156
156
|
) => ({
|
|
157
157
|
startAmount: totalStartAmount.add(startAmount),
|
|
158
158
|
endAmount: totalEndAmount.add(endAmount),
|
|
@@ -160,7 +160,7 @@ export const totalItemsAmount = <T extends OfferItem>(items: T[]) => {
|
|
|
160
160
|
{
|
|
161
161
|
startAmount: BigNumber.from(0),
|
|
162
162
|
endAmount: BigNumber.from(0),
|
|
163
|
-
}
|
|
163
|
+
},
|
|
164
164
|
);
|
|
165
165
|
};
|
|
166
166
|
|
|
@@ -171,7 +171,7 @@ export const totalItemsAmount = <T extends OfferItem>(items: T[]) => {
|
|
|
171
171
|
*/
|
|
172
172
|
export const mapOrderAmountsFromFilledStatus = (
|
|
173
173
|
order: Order,
|
|
174
|
-
{ totalFilled, totalSize }: { totalFilled: BigNumber; totalSize: BigNumber }
|
|
174
|
+
{ totalFilled, totalSize }: { totalFilled: BigNumber; totalSize: BigNumber },
|
|
175
175
|
): Order => {
|
|
176
176
|
if (totalFilled.eq(0) || totalSize.eq(0)) {
|
|
177
177
|
return order;
|
|
@@ -190,7 +190,7 @@ export const mapOrderAmountsFromFilledStatus = (
|
|
|
190
190
|
...item,
|
|
191
191
|
startAmount: multiplyBasisPoints(
|
|
192
192
|
item.startAmount,
|
|
193
|
-
basisPoints
|
|
193
|
+
basisPoints,
|
|
194
194
|
).toString(),
|
|
195
195
|
endAmount: multiplyBasisPoints(item.endAmount, basisPoints).toString(),
|
|
196
196
|
})),
|
|
@@ -198,7 +198,7 @@ export const mapOrderAmountsFromFilledStatus = (
|
|
|
198
198
|
...item,
|
|
199
199
|
startAmount: multiplyBasisPoints(
|
|
200
200
|
item.startAmount,
|
|
201
|
-
basisPoints
|
|
201
|
+
basisPoints,
|
|
202
202
|
).toString(),
|
|
203
203
|
endAmount: multiplyBasisPoints(item.endAmount, basisPoints).toString(),
|
|
204
204
|
})),
|
|
@@ -210,7 +210,7 @@ export const mapOrderAmountsFromFilledStatus = (
|
|
|
210
210
|
const multiplyDivision = (
|
|
211
211
|
amount: BigNumberish,
|
|
212
212
|
numerator: BigNumberish,
|
|
213
|
-
denominator: BigNumberish
|
|
213
|
+
denominator: BigNumberish,
|
|
214
214
|
) => BigNumber.from(amount).mul(BigNumber.from(numerator)).div(denominator);
|
|
215
215
|
|
|
216
216
|
/**
|
|
@@ -224,7 +224,7 @@ export const mapOrderAmountsFromUnitsToFill = (
|
|
|
224
224
|
{
|
|
225
225
|
unitsToFill,
|
|
226
226
|
totalSize,
|
|
227
|
-
}: { unitsToFill: BigNumberish; totalSize: BigNumber }
|
|
227
|
+
}: { unitsToFill: BigNumberish; totalSize: BigNumber },
|
|
228
228
|
): Order => {
|
|
229
229
|
const unitsToFillBn = BigNumber.from(unitsToFill);
|
|
230
230
|
|
|
@@ -246,12 +246,12 @@ export const mapOrderAmountsFromUnitsToFill = (
|
|
|
246
246
|
startAmount: multiplyDivision(
|
|
247
247
|
item.startAmount,
|
|
248
248
|
unitsToFillBn,
|
|
249
|
-
totalSize
|
|
249
|
+
totalSize,
|
|
250
250
|
).toString(),
|
|
251
251
|
endAmount: multiplyDivision(
|
|
252
252
|
item.endAmount,
|
|
253
253
|
unitsToFillBn,
|
|
254
|
-
totalSize
|
|
254
|
+
totalSize,
|
|
255
255
|
).toString(),
|
|
256
256
|
})),
|
|
257
257
|
consideration: order.parameters.consideration.map((item) => ({
|
|
@@ -259,12 +259,12 @@ export const mapOrderAmountsFromUnitsToFill = (
|
|
|
259
259
|
startAmount: multiplyDivision(
|
|
260
260
|
item.startAmount,
|
|
261
261
|
unitsToFillBn,
|
|
262
|
-
totalSize
|
|
262
|
+
totalSize,
|
|
263
263
|
).toString(),
|
|
264
264
|
endAmount: multiplyDivision(
|
|
265
265
|
item.endAmount,
|
|
266
266
|
unitsToFillBn,
|
|
267
|
-
totalSize
|
|
267
|
+
totalSize,
|
|
268
268
|
).toString(),
|
|
269
269
|
})),
|
|
270
270
|
},
|
|
@@ -279,7 +279,7 @@ export const generateRandomSalt = (domain?: string) => {
|
|
|
279
279
|
keccak256(toUtf8Bytes(domain)).slice(0, 10),
|
|
280
280
|
Uint8Array.from(Array(20).fill(0)),
|
|
281
281
|
randomBytes(8),
|
|
282
|
-
])
|
|
282
|
+
]),
|
|
283
283
|
).toString("hex")}`;
|
|
284
284
|
}
|
|
285
285
|
return `0x${Buffer.from(randomBytes(8)).toString("hex").padStart(64, "0")}`;
|
package/src/utils/usecase.ts
CHANGED
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
} from "../types";
|
|
12
12
|
|
|
13
13
|
export const executeAllActions = async <
|
|
14
|
-
T extends CreateOrderAction | CreateBulkOrdersAction | ExchangeAction
|
|
14
|
+
T extends CreateOrderAction | CreateBulkOrdersAction | ExchangeAction,
|
|
15
15
|
>(
|
|
16
|
-
actions: OrderUseCase<T>["actions"]
|
|
16
|
+
actions: OrderUseCase<T>["actions"],
|
|
17
17
|
) => {
|
|
18
18
|
for (let i = 0; i < actions.length - 1; i++) {
|
|
19
19
|
const action = actions[i];
|
|
@@ -36,9 +36,9 @@ export const executeAllActions = async <
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const instanceOfOverrides = <
|
|
39
|
-
T extends Overrides | PayableOverrides | CallOverrides
|
|
39
|
+
T extends Overrides | PayableOverrides | CallOverrides,
|
|
40
40
|
>(
|
|
41
|
-
obj: Object | undefined
|
|
41
|
+
obj: Object | undefined,
|
|
42
42
|
): obj is T => {
|
|
43
43
|
const validKeys = [
|
|
44
44
|
"gasLimit",
|
|
@@ -63,12 +63,12 @@ const instanceOfOverrides = <
|
|
|
63
63
|
|
|
64
64
|
export const getTransactionMethods = <
|
|
65
65
|
T extends Contract,
|
|
66
|
-
U extends keyof T["functions"]
|
|
66
|
+
U extends keyof T["functions"],
|
|
67
67
|
>(
|
|
68
68
|
contract: T,
|
|
69
69
|
method: U,
|
|
70
70
|
args: Parameters<T["functions"][U]>,
|
|
71
|
-
domain?: string
|
|
71
|
+
domain?: string,
|
|
72
72
|
): TransactionMethods<ContractMethodReturnType<T, U>> => {
|
|
73
73
|
const lastArg = args[args.length - 1];
|
|
74
74
|
|
|
@@ -98,14 +98,14 @@ export const getTransactionMethods = <
|
|
|
98
98
|
const mergedOverrides = { ...initialOverrides, ...overrides };
|
|
99
99
|
|
|
100
100
|
return contract.callStatic[method as string](
|
|
101
|
-
...[...args, mergedOverrides]
|
|
101
|
+
...[...args, mergedOverrides],
|
|
102
102
|
);
|
|
103
103
|
},
|
|
104
104
|
estimateGas: (overrides?: Overrides) => {
|
|
105
105
|
const mergedOverrides = { ...initialOverrides, ...overrides };
|
|
106
106
|
|
|
107
107
|
return contract.estimateGas[method as string](
|
|
108
|
-
...[...args, mergedOverrides]
|
|
108
|
+
...[...args, mergedOverrides],
|
|
109
109
|
);
|
|
110
110
|
},
|
|
111
111
|
transact: async (overrides?: Overrides) => {
|