@opensea/seaport-js 1.0.0 → 1.0.1-beta.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.
Files changed (79) hide show
  1. package/lib/abi/ERC1155.d.ts +29 -29
  2. package/lib/abi/ERC20.d.ts +29 -29
  3. package/lib/abi/ERC721.d.ts +29 -29
  4. package/lib/abi/Seaport.d.ts +112 -112
  5. package/lib/constants.d.ts +49 -49
  6. package/lib/index.d.ts +2 -2
  7. package/lib/index.esm.mjs +2 -0
  8. package/lib/index.esm.mjs.map +1 -0
  9. package/lib/index.js +2 -6
  10. package/lib/index.js.map +1 -1
  11. package/lib/index.modern.mjs +2 -0
  12. package/lib/index.modern.mjs.map +1 -0
  13. package/lib/index.umd.js +2 -0
  14. package/lib/index.umd.js.map +1 -0
  15. package/lib/seaport.d.ts +181 -181
  16. package/lib/types.d.ts +207 -207
  17. package/lib/utils/approval.d.ts +9 -9
  18. package/lib/utils/balance.d.ts +4 -4
  19. package/lib/utils/balanceAndApprovalCheck.d.ts +108 -108
  20. package/lib/utils/criteria.d.ts +13 -14
  21. package/lib/utils/fulfill.d.ts +84 -84
  22. package/lib/utils/gcd.d.ts +3 -3
  23. package/lib/utils/item.d.ts +30 -29
  24. package/lib/utils/match.d.ts +49 -49
  25. package/lib/utils/merkletree.d.ts +11 -11
  26. package/lib/utils/order.d.ts +37 -37
  27. package/lib/utils/usecase.d.ts +4 -4
  28. package/package.json +4 -2
  29. package/lib/abi/ERC1155.js +0 -319
  30. package/lib/abi/ERC1155.js.map +0 -1
  31. package/lib/abi/ERC20.js +0 -317
  32. package/lib/abi/ERC20.js.map +0 -1
  33. package/lib/abi/ERC721.js +0 -337
  34. package/lib/abi/ERC721.js.map +0 -1
  35. package/lib/abi/Seaport.js +0 -2585
  36. package/lib/abi/Seaport.js.map +0 -1
  37. package/lib/constants.js +0 -73
  38. package/lib/constants.js.map +0 -1
  39. package/lib/seaport.js +0 -720
  40. package/lib/seaport.js.map +0 -1
  41. package/lib/typechain/ERC1155.d.ts +0 -189
  42. package/lib/typechain/ERC1155.js +0 -3
  43. package/lib/typechain/ERC1155.js.map +0 -1
  44. package/lib/typechain/ERC20.d.ts +0 -209
  45. package/lib/typechain/ERC20.js +0 -3
  46. package/lib/typechain/ERC20.js.map +0 -1
  47. package/lib/typechain/ERC721.d.ts +0 -220
  48. package/lib/typechain/ERC721.js +0 -3
  49. package/lib/typechain/ERC721.js.map +0 -1
  50. package/lib/typechain/Seaport.d.ts +0 -686
  51. package/lib/typechain/Seaport.js +0 -3
  52. package/lib/typechain/Seaport.js.map +0 -1
  53. package/lib/typechain/common.d.ts +0 -21
  54. package/lib/typechain/common.js +0 -3
  55. package/lib/typechain/common.js.map +0 -1
  56. package/lib/types.js +0 -3
  57. package/lib/types.js.map +0 -1
  58. package/lib/utils/approval.js +0 -108
  59. package/lib/utils/approval.js.map +0 -1
  60. package/lib/utils/balance.js +0 -86
  61. package/lib/utils/balance.js.map +0 -1
  62. package/lib/utils/balanceAndApprovalCheck.js +0 -322
  63. package/lib/utils/balanceAndApprovalCheck.js.map +0 -1
  64. package/lib/utils/criteria.js +0 -91
  65. package/lib/utils/criteria.js.map +0 -1
  66. package/lib/utils/fulfill.js +0 -573
  67. package/lib/utils/fulfill.js.map +0 -1
  68. package/lib/utils/gcd.js +0 -25
  69. package/lib/utils/gcd.js.map +0 -1
  70. package/lib/utils/item.js +0 -136
  71. package/lib/utils/item.js.map +0 -1
  72. package/lib/utils/match.js +0 -56
  73. package/lib/utils/match.js.map +0 -1
  74. package/lib/utils/merkletree.js +0 -32
  75. package/lib/utils/merkletree.js.map +0 -1
  76. package/lib/utils/order.js +0 -224
  77. package/lib/utils/order.js.map +0 -1
  78. package/lib/utils/usecase.js +0 -158
  79. package/lib/utils/usecase.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"Seaport.js","sourceRoot":"","sources":["../../src/typechain/Seaport.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- import type { Listener } from "@ethersproject/providers";
2
- import type { Event, EventFilter } from "ethers";
3
- export interface TypedEvent<TArgsArray extends Array<any> = any, TArgsObject = any> extends Event {
4
- args: TArgsArray & TArgsObject;
5
- }
6
- export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {
7
- }
8
- export interface TypedListener<TEvent extends TypedEvent> {
9
- (...listenerArg: [...__TypechainArgsArray<TEvent>, TEvent]): void;
10
- }
11
- declare type __TypechainArgsArray<T> = T extends TypedEvent<infer U> ? U : never;
12
- export interface OnEvent<TRes> {
13
- <TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>, listener: TypedListener<TEvent>): TRes;
14
- (eventName: string, listener: Listener): TRes;
15
- }
16
- export declare type MinEthersFactory<C, ARGS> = {
17
- deploy(...a: ARGS[]): Promise<C>;
18
- };
19
- export declare type GetContractTypeFromFactory<F> = F extends MinEthersFactory<infer C, any> ? C : never;
20
- export declare type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F["deploy"]> : never;
21
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/typechain/common.ts"],"names":[],"mappings":""}
package/lib/types.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
package/lib/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -1,108 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getApprovalActions = exports.approvedItemAmount = void 0;
40
- var ethers_1 = require("ethers");
41
- var ERC20_1 = require("../abi/ERC20");
42
- var ERC721_1 = require("../abi/ERC721");
43
- var constants_1 = require("../constants");
44
- var item_1 = require("./item");
45
- var usecase_1 = require("./usecase");
46
- var approvedItemAmount = function (owner, item, operator, multicallProvider) { return __awaiter(void 0, void 0, void 0, function () {
47
- var contract, contract;
48
- return __generator(this, function (_a) {
49
- if ((0, item_1.isErc721Item)(item.itemType) || (0, item_1.isErc1155Item)(item.itemType)) {
50
- contract = new ethers_1.Contract(item.token, ERC721_1.ERC721ABI, multicallProvider);
51
- return [2 /*return*/, contract.isApprovedForAll(owner, operator).then(function (isApprovedForAll) {
52
- // Setting to the max int to consolidate types and simplify
53
- return isApprovedForAll ? constants_1.MAX_INT : ethers_1.BigNumber.from(0);
54
- })];
55
- }
56
- else if (item.itemType === constants_1.ItemType.ERC20) {
57
- contract = new ethers_1.Contract(item.token, ERC20_1.ERC20ABI, multicallProvider);
58
- return [2 /*return*/, contract.allowance(owner, operator)];
59
- }
60
- // We don't need to check approvals for native tokens
61
- return [2 /*return*/, constants_1.MAX_INT];
62
- });
63
- }); };
64
- exports.approvedItemAmount = approvedItemAmount;
65
- /**
66
- * Get approval actions given a list of insufficent approvals.
67
- */
68
- function getApprovalActions(insufficientApprovals, signer) {
69
- var _this = this;
70
- return Promise.all(insufficientApprovals
71
- .filter(function (approval, index) {
72
- return index === insufficientApprovals.length - 1 ||
73
- insufficientApprovals[index + 1].token !== approval.token;
74
- })
75
- .map(function (_a) {
76
- var token = _a.token, operator = _a.operator, itemType = _a.itemType, identifierOrCriteria = _a.identifierOrCriteria;
77
- return __awaiter(_this, void 0, void 0, function () {
78
- var contract, contract;
79
- return __generator(this, function (_b) {
80
- if ((0, item_1.isErc721Item)(itemType) || (0, item_1.isErc1155Item)(itemType)) {
81
- contract = new ethers_1.Contract(token, ERC721_1.ERC721ABI, signer);
82
- return [2 /*return*/, {
83
- type: "approval",
84
- token: token,
85
- identifierOrCriteria: identifierOrCriteria,
86
- itemType: itemType,
87
- operator: operator,
88
- transactionMethods: (0, usecase_1.getTransactionMethods)(contract.connect(signer), "setApprovalForAll", [operator, true]),
89
- }];
90
- }
91
- else {
92
- contract = new ethers_1.Contract(token, ERC20_1.ERC20ABI, signer);
93
- return [2 /*return*/, {
94
- type: "approval",
95
- token: token,
96
- identifierOrCriteria: identifierOrCriteria,
97
- itemType: itemType,
98
- transactionMethods: (0, usecase_1.getTransactionMethods)(contract.connect(signer), "approve", [operator, constants_1.MAX_INT]),
99
- operator: operator,
100
- }];
101
- }
102
- return [2 /*return*/];
103
- });
104
- });
105
- }));
106
- }
107
- exports.getApprovalActions = getApprovalActions;
108
- //# sourceMappingURL=approval.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"approval.js","sourceRoot":"","sources":["../../src/utils/approval.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAAwD;AACxD,sCAAwC;AACxC,wCAA0C;AAC1C,0CAAiD;AAKjD,+BAAqD;AACrD,qCAAkD;AAE3C,IAAM,kBAAkB,GAAG,UAChC,KAAa,EACb,IAAU,EACV,QAAgB,EAChB,iBAAuD;;;QAEvD,IAAI,IAAA,mBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAA,oBAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAEzD,QAAQ,GAAG,IAAI,iBAAQ,CAC3B,IAAI,CAAC,KAAK,EACV,kBAAS,EACT,iBAAiB,CACR,CAAC;YACZ,sBAAO,QAAQ,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,gBAAgB;oBACtE,2DAA2D;oBAC3D,OAAA,gBAAgB,CAAC,CAAC,CAAC,mBAAO,CAAC,CAAC,CAAC,kBAAS,CAAC,IAAI,CAAC,CAAC,CAAC;gBAA9C,CAA8C,CAC/C,EAAC;SACH;aAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,oBAAQ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EAAE,MAAM,CAAU,CAAC;oBAEhE,sBAAO;4BACL,IAAI,EAAE,UAAU;4BAChB,KAAK,OAAA;4BACL,oBAAoB,sBAAA;4BACpB,QAAQ,UAAA;4BACR,kBAAkB,EAAE,IAAA,+BAAqB,EACvC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EACxB,SAAS,EACT,CAAC,QAAQ,EAAE,mBAAO,CAAC,CACpB;4BACD,QAAQ,UAAA;yBACT,EAAC;iBACH;;;;KACF,CAAC,CACL,CAAC;AACJ,CAAC;AA9CD,gDA8CC"}
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.balanceOf = void 0;
40
- var ethers_1 = require("ethers");
41
- var ERC1155_1 = require("../abi/ERC1155");
42
- var ERC20_1 = require("../abi/ERC20");
43
- var ERC721_1 = require("../abi/ERC721");
44
- var constants_1 = require("../constants");
45
- var item_1 = require("./item");
46
- var balanceOf = function (owner, item, multicallProvider, criteria) { return __awaiter(void 0, void 0, void 0, function () {
47
- var contract, contract, startAmount, endAmount, contract;
48
- return __generator(this, function (_a) {
49
- if ((0, item_1.isErc721Item)(item.itemType)) {
50
- contract = new ethers_1.Contract(item.token, ERC721_1.ERC721ABI, multicallProvider);
51
- if (item.itemType === constants_1.ItemType.ERC721_WITH_CRITERIA) {
52
- return [2 /*return*/, criteria
53
- ? contract
54
- .ownerOf(criteria.identifier)
55
- .then(function (ownerOf) {
56
- return ethers_1.BigNumber.from(Number(ownerOf.toLowerCase() === owner.toLowerCase()));
57
- })
58
- : contract.balanceOf(owner)];
59
- }
60
- return [2 /*return*/, contract
61
- .ownerOf(item.identifierOrCriteria)
62
- .then(function (ownerOf) {
63
- return ethers_1.BigNumber.from(Number(ownerOf.toLowerCase() === owner.toLowerCase()));
64
- })];
65
- }
66
- else if ((0, item_1.isErc1155Item)(item.itemType)) {
67
- contract = new ethers_1.Contract(item.token, ERC1155_1.ERC1155ABI, multicallProvider);
68
- if (item.itemType === constants_1.ItemType.ERC1155_WITH_CRITERIA) {
69
- if (!criteria) {
70
- startAmount = ethers_1.BigNumber.from(item.startAmount);
71
- endAmount = ethers_1.BigNumber.from(item.endAmount);
72
- return [2 /*return*/, startAmount.gt(endAmount) ? startAmount : endAmount];
73
- }
74
- return [2 /*return*/, contract.balanceOf(owner, criteria.identifier)];
75
- }
76
- return [2 /*return*/, contract.balanceOf(owner, item.identifierOrCriteria)];
77
- }
78
- if ((0, item_1.isErc20Item)(item.itemType)) {
79
- contract = new ethers_1.Contract(item.token, ERC20_1.ERC20ABI, multicallProvider);
80
- return [2 /*return*/, contract.balanceOf(owner)];
81
- }
82
- return [2 /*return*/, multicallProvider.getBalance(owner)];
83
- });
84
- }); };
85
- exports.balanceOf = balanceOf;
86
- //# sourceMappingURL=balance.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/utils/balance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAA6C;AAC7C,0CAA4C;AAC5C,sCAAwC;AACxC,wCAA0C;AAC1C,0CAAwC;AAKxC,+BAAkE;AAE3D,IAAM,SAAS,GAAG,UACvB,KAAa,EACb,IAAU,EACV,iBAAuD,EACvD,QAAwB;;;QAExB,IAAI,IAAA,mBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACzB,QAAQ,GAAG,IAAI,iBAAQ,CAC3B,IAAI,CAAC,KAAK,EACV,kBAAS,EACT,iBAAiB,CACR,CAAC;YAEZ,IAAI,IAAI,CAAC,QAAQ,KAAK,oBAAQ,CAAC,oBAAoB,EAAE;gBACnD,sBAAO,QAAQ;wBACb,CAAC,CAAC,QAAQ;6BACL,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;6BAC5B,IAAI,CAAC,UAAC,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IAAI,iBAAQ,CAC3B,IAAI,CAAC,KAAK,EACV,gBAAQ,EACR,iBAAiB,CACT,CAAC;YACX,sBAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAC;SAClC;QAED,sBAAO,iBAAiB,CAAC,UAAU,CAAC,KAAK,CAAC,EAAC;;KAC5C,CAAC;AA9DW,QAAA,SAAS,aA8DpB"}
@@ -1,322 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __read = (this && this.__read) || function (o, n) {
50
- var m = typeof Symbol === "function" && o[Symbol.iterator];
51
- if (!m) return o;
52
- var i = m.call(o), r, ar = [], e;
53
- try {
54
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
55
- }
56
- catch (error) { e = { error: error }; }
57
- finally {
58
- try {
59
- if (r && !r.done && (m = i["return"])) m.call(i);
60
- }
61
- finally { if (e) throw e.error; }
62
- }
63
- return ar;
64
- };
65
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
66
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
67
- if (ar || !(i in from)) {
68
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
69
- ar[i] = from[i];
70
- }
71
- }
72
- return to.concat(ar || Array.prototype.slice.call(from));
73
- };
74
- Object.defineProperty(exports, "__esModule", { value: true });
75
- exports.validateStandardFulfillBalancesAndApprovals = exports.validateBasicFulfillBalancesAndApprovals = exports.validateOfferBalancesAndApprovals = exports.getInsufficientBalanceAndApprovalAmounts = exports.getBalancesAndApprovals = void 0;
76
- var ethers_1 = require("ethers");
77
- var constants_1 = require("../constants");
78
- var approval_1 = require("./approval");
79
- var balance_1 = require("./balance");
80
- var criteria_1 = require("./criteria");
81
- var item_1 = require("./item");
82
- var findBalanceAndApproval = function (balancesAndApprovals, token, identifierOrCriteria) {
83
- var balanceAndApproval = balancesAndApprovals.find(function (_a) {
84
- var checkedToken = _a.token, checkedIdentifierOrCriteria = _a.identifierOrCriteria;
85
- return token.toLowerCase() === checkedToken.toLowerCase() &&
86
- checkedIdentifierOrCriteria.toLowerCase() ===
87
- identifierOrCriteria.toLowerCase();
88
- });
89
- if (!balanceAndApproval) {
90
- throw new Error("Balances and approvals didn't contain all tokens and identifiers");
91
- }
92
- return balanceAndApproval;
93
- };
94
- var getBalancesAndApprovals = function (_a) {
95
- var owner = _a.owner, items = _a.items, criterias = _a.criterias, operator = _a.operator, multicallProvider = _a.multicallProvider;
96
- return __awaiter(void 0, void 0, void 0, function () {
97
- var itemToCriteria;
98
- return __generator(this, function (_b) {
99
- itemToCriteria = (0, criteria_1.getItemToCriteriaMap)(items, criterias);
100
- return [2 /*return*/, Promise.all(items.map(function (item) { return __awaiter(void 0, void 0, void 0, function () {
101
- var approvedAmountPromise;
102
- var _a;
103
- var _b, _c;
104
- return __generator(this, function (_d) {
105
- switch (_d.label) {
106
- case 0:
107
- approvedAmountPromise = Promise.resolve(ethers_1.BigNumber.from(0));
108
- if ((0, item_1.isErc721Item)(item.itemType) || (0, item_1.isErc1155Item)(item.itemType)) {
109
- approvedAmountPromise = (0, approval_1.approvedItemAmount)(owner, item, operator, multicallProvider);
110
- }
111
- else if ((0, item_1.isErc20Item)(item.itemType)) {
112
- approvedAmountPromise = (0, approval_1.approvedItemAmount)(owner, item, operator, multicallProvider);
113
- }
114
- // If native token, we don't need to check for approvals
115
- else {
116
- approvedAmountPromise = Promise.resolve(constants_1.MAX_INT);
117
- }
118
- _a = {
119
- token: item.token,
120
- identifierOrCriteria: (_c = (_b = itemToCriteria.get(item)) === null || _b === void 0 ? void 0 : _b.identifier) !== null && _c !== void 0 ? _c : item.identifierOrCriteria
121
- };
122
- return [4 /*yield*/, (0, balance_1.balanceOf)(owner, item, multicallProvider, itemToCriteria.get(item))];
123
- case 1:
124
- _a.balance = _d.sent();
125
- return [4 /*yield*/, approvedAmountPromise];
126
- case 2: return [2 /*return*/, (_a.approvedAmount = _d.sent(),
127
- _a.itemType = item.itemType,
128
- _a)];
129
- }
130
- });
131
- }); }))];
132
- });
133
- });
134
- };
135
- exports.getBalancesAndApprovals = getBalancesAndApprovals;
136
- var getInsufficientBalanceAndApprovalAmounts = function (_a) {
137
- var balancesAndApprovals = _a.balancesAndApprovals, tokenAndIdentifierAmounts = _a.tokenAndIdentifierAmounts, operator = _a.operator;
138
- var tokenAndIdentifierAndAmountNeeded = __spreadArray([], __read(Object.entries(tokenAndIdentifierAmounts).map(function (_a) {
139
- var _b = __read(_a, 2), token = _b[0], identifierToAmount = _b[1];
140
- return Object.entries(identifierToAmount).map(function (_a) {
141
- var _b = __read(_a, 2), identifierOrCriteria = _b[0], amountNeeded = _b[1];
142
- return [token, identifierOrCriteria, amountNeeded];
143
- });
144
- })), false).flat();
145
- var filterBalancesOrApprovals = function (filterKey) {
146
- return tokenAndIdentifierAndAmountNeeded
147
- .filter(function (_a) {
148
- var _b = __read(_a, 3), token = _b[0], identifierOrCriteria = _b[1], amountNeeded = _b[2];
149
- return findBalanceAndApproval(balancesAndApprovals, token, identifierOrCriteria)[filterKey].lt(amountNeeded);
150
- })
151
- .map(function (_a) {
152
- var _b = __read(_a, 3), token = _b[0], identifierOrCriteria = _b[1], amount = _b[2];
153
- var balanceAndApproval = findBalanceAndApproval(balancesAndApprovals, token, identifierOrCriteria);
154
- return {
155
- token: token,
156
- identifierOrCriteria: identifierOrCriteria,
157
- requiredAmount: amount,
158
- amountHave: balanceAndApproval[filterKey],
159
- itemType: balanceAndApproval.itemType,
160
- };
161
- });
162
- };
163
- var mapToApproval = function (insufficientBalance) { return ({
164
- token: insufficientBalance.token,
165
- identifierOrCriteria: insufficientBalance.identifierOrCriteria,
166
- approvedAmount: insufficientBalance.amountHave,
167
- requiredApprovedAmount: insufficientBalance.requiredAmount,
168
- itemType: insufficientBalance.itemType,
169
- operator: operator,
170
- }); };
171
- var _b = __read([
172
- filterBalancesOrApprovals("balance"),
173
- filterBalancesOrApprovals("approvedAmount").map(mapToApproval),
174
- ], 2), insufficientBalances = _b[0], insufficientApprovals = _b[1];
175
- return {
176
- insufficientBalances: insufficientBalances,
177
- insufficientApprovals: insufficientApprovals,
178
- };
179
- };
180
- exports.getInsufficientBalanceAndApprovalAmounts = getInsufficientBalanceAndApprovalAmounts;
181
- /**
182
- * 1. The offerer should have sufficient balance of all offered items.
183
- * 2. If the order does not indicate proxy utilization, the offerer should have sufficient approvals set
184
- * for the Seaport contract for all offered ERC20, ERC721, and ERC1155 items.
185
- * 3. If the order does indicate proxy utilization, the offerer should have sufficient approvals set
186
- * for their respective proxy contract for all offered ERC20, ERC721, and ERC1155 items.
187
- */
188
- var validateOfferBalancesAndApprovals = function (_a) {
189
- var offer = _a.offer, criterias = _a.criterias, balancesAndApprovals = _a.balancesAndApprovals, timeBasedItemParams = _a.timeBasedItemParams, _b = _a.throwOnInsufficientBalances, throwOnInsufficientBalances = _b === void 0 ? true : _b, throwOnInsufficientApprovals = _a.throwOnInsufficientApprovals, operator = _a.operator;
190
- var _c = (0, exports.getInsufficientBalanceAndApprovalAmounts)({
191
- balancesAndApprovals: balancesAndApprovals,
192
- tokenAndIdentifierAmounts: (0, item_1.getSummedTokenAndIdentifierAmounts)({
193
- items: offer,
194
- criterias: criterias,
195
- timeBasedItemParams: timeBasedItemParams
196
- ? __assign(__assign({}, timeBasedItemParams), { isConsiderationItem: false }) : undefined,
197
- }),
198
- operator: operator,
199
- }), insufficientBalances = _c.insufficientBalances, insufficientApprovals = _c.insufficientApprovals;
200
- if (throwOnInsufficientBalances && insufficientBalances.length > 0) {
201
- throw new Error("The offerer does not have the amount needed to create or fulfill.");
202
- }
203
- if (throwOnInsufficientApprovals && insufficientApprovals.length > 0) {
204
- throw new Error("The offerer does not have the sufficient approvals.");
205
- }
206
- return insufficientApprovals;
207
- };
208
- exports.validateOfferBalancesAndApprovals = validateOfferBalancesAndApprovals;
209
- /**
210
- * When fulfilling a basic order, the following requirements need to be checked to ensure that the order will be fulfillable:
211
- * 1. Offer checks need to be performed to ensure that the offerer still has sufficient balance and approvals
212
- * 2. The fulfiller should have sufficient balance of all consideration items except for those with an
213
- * item type that matches the order's offered item type — by way of example, if the fulfilled order offers
214
- * an ERC20 item and requires an ERC721 item to the offerer and the same ERC20 item to another recipient,
215
- * the fulfiller needs to own the ERC721 item but does not need to own the ERC20 item as it will be sourced from the offerer.
216
- * 3. If the fulfiller does not elect to utilize a proxy, they need to have sufficient approvals set for the
217
- * Seaport contract for all ERC20, ERC721, and ERC1155 consideration items on the fulfilled order except
218
- * for ERC20 items with an item type that matches the order's offered item type.
219
- * 4. If the fulfiller does elect to utilize a proxy, they need to have sufficient approvals set for their
220
- * respective proxy contract for all ERC20, ERC721, and ERC1155 consideration items on the fulfilled order
221
- * except for ERC20 items with an item type that matches the order's offered item type.
222
- * 5. If the fulfilled order specifies Ether (or other native tokens) as consideration items, the fulfiller must
223
- * be able to supply the sum total of those items as msg.value.
224
- *
225
- * @returns the list of insufficient owner and proxy approvals
226
- */
227
- var validateBasicFulfillBalancesAndApprovals = function (_a) {
228
- var offer = _a.offer, consideration = _a.consideration, offererBalancesAndApprovals = _a.offererBalancesAndApprovals, fulfillerBalancesAndApprovals = _a.fulfillerBalancesAndApprovals, timeBasedItemParams = _a.timeBasedItemParams, offererOperator = _a.offererOperator, fulfillerOperator = _a.fulfillerOperator;
229
- (0, exports.validateOfferBalancesAndApprovals)({
230
- offer: offer,
231
- criterias: [],
232
- balancesAndApprovals: offererBalancesAndApprovals,
233
- timeBasedItemParams: timeBasedItemParams,
234
- throwOnInsufficientApprovals: true,
235
- operator: offererOperator,
236
- });
237
- var considerationWithoutOfferItemType = consideration.filter(function (item) { return item.itemType !== offer[0].itemType; });
238
- var _b = (0, exports.getInsufficientBalanceAndApprovalAmounts)({
239
- balancesAndApprovals: fulfillerBalancesAndApprovals,
240
- tokenAndIdentifierAmounts: (0, item_1.getSummedTokenAndIdentifierAmounts)({
241
- items: considerationWithoutOfferItemType,
242
- criterias: [],
243
- timeBasedItemParams: __assign(__assign({}, timeBasedItemParams), { isConsiderationItem: true }),
244
- }),
245
- operator: fulfillerOperator,
246
- }), insufficientBalances = _b.insufficientBalances, insufficientApprovals = _b.insufficientApprovals;
247
- if (insufficientBalances.length > 0) {
248
- throw new Error("The fulfiller does not have the balances needed to fulfill.");
249
- }
250
- return insufficientApprovals;
251
- };
252
- exports.validateBasicFulfillBalancesAndApprovals = validateBasicFulfillBalancesAndApprovals;
253
- /**
254
- * When fulfilling a standard order, the following requirements need to be checked to ensure that the order will be fulfillable:
255
- * 1. Offer checks need to be performed to ensure that the offerer still has sufficient balance and approvals
256
- * 2. The fulfiller should have sufficient balance of all consideration items after receiving all offered items
257
- * — by way of example, if the fulfilled order offers an ERC20 item and requires an ERC721 item to the offerer
258
- * and the same ERC20 item to another recipient with an amount less than or equal to the offered amount,
259
- * the fulfiller does not need to own the ERC20 item as it will first be received from the offerer.
260
- * 3. If the fulfiller does not elect to utilize a proxy, they need to have sufficient approvals set for the
261
- * Seaport contract for all ERC20, ERC721, and ERC1155 consideration items on the fulfilled order.
262
- * 4. If the fulfiller does elect to utilize a proxy, they need to have sufficient approvals set for their
263
- * respective proxy contract for all ERC20, ERC721, and ERC1155 consideration items on the fulfilled order.
264
- * 5. If the fulfilled order specifies Ether (or other native tokens) as consideration items, the fulfiller must
265
- * be able to supply the sum total of those items as msg.value.
266
- *
267
- * @returns the list of insufficient owner and proxy approvals
268
- */
269
- var validateStandardFulfillBalancesAndApprovals = function (_a) {
270
- var offer = _a.offer, consideration = _a.consideration, offerCriteria = _a.offerCriteria, considerationCriteria = _a.considerationCriteria, offererBalancesAndApprovals = _a.offererBalancesAndApprovals, fulfillerBalancesAndApprovals = _a.fulfillerBalancesAndApprovals, timeBasedItemParams = _a.timeBasedItemParams, offererOperator = _a.offererOperator, fulfillerOperator = _a.fulfillerOperator;
271
- (0, exports.validateOfferBalancesAndApprovals)({
272
- offer: offer,
273
- criterias: offerCriteria,
274
- balancesAndApprovals: offererBalancesAndApprovals,
275
- timeBasedItemParams: timeBasedItemParams,
276
- throwOnInsufficientApprovals: true,
277
- operator: offererOperator,
278
- });
279
- var fulfillerBalancesAndApprovalsAfterReceivingOfferedItems = addToExistingBalances({
280
- items: offer,
281
- criterias: offerCriteria,
282
- balancesAndApprovals: fulfillerBalancesAndApprovals,
283
- timeBasedItemParams: timeBasedItemParams,
284
- });
285
- var _b = (0, exports.getInsufficientBalanceAndApprovalAmounts)({
286
- balancesAndApprovals: fulfillerBalancesAndApprovalsAfterReceivingOfferedItems,
287
- tokenAndIdentifierAmounts: (0, item_1.getSummedTokenAndIdentifierAmounts)({
288
- items: consideration,
289
- criterias: considerationCriteria,
290
- timeBasedItemParams: __assign(__assign({}, timeBasedItemParams), { isConsiderationItem: true }),
291
- }),
292
- operator: fulfillerOperator,
293
- }), insufficientBalances = _b.insufficientBalances, insufficientApprovals = _b.insufficientApprovals;
294
- if (insufficientBalances.length > 0) {
295
- throw new Error("The fulfiller does not have the balances needed to fulfill.");
296
- }
297
- return insufficientApprovals;
298
- };
299
- exports.validateStandardFulfillBalancesAndApprovals = validateStandardFulfillBalancesAndApprovals;
300
- var addToExistingBalances = function (_a) {
301
- var items = _a.items, criterias = _a.criterias, timeBasedItemParams = _a.timeBasedItemParams, balancesAndApprovals = _a.balancesAndApprovals;
302
- var summedItemAmounts = (0, item_1.getSummedTokenAndIdentifierAmounts)({
303
- items: items,
304
- criterias: criterias,
305
- timeBasedItemParams: __assign(__assign({}, timeBasedItemParams), { isConsiderationItem: false }),
306
- });
307
- // Deep clone existing balances
308
- var balancesAndApprovalsAfterReceivingItems = balancesAndApprovals.map(function (item) { return (__assign({}, item)); });
309
- // Add each summed item amount to the existing balances as we may want tocheck balances after receiving all items
310
- Object.entries(summedItemAmounts).forEach(function (_a) {
311
- var _b = __read(_a, 2), token = _b[0], identifierOrCriteriaToAmount = _b[1];
312
- return Object.entries(identifierOrCriteriaToAmount).forEach(function (_a) {
313
- var _b = __read(_a, 2), identifierOrCriteria = _b[0], amount = _b[1];
314
- var balanceAndApproval = findBalanceAndApproval(balancesAndApprovalsAfterReceivingItems, token, identifierOrCriteria);
315
- var balanceAndApprovalIndex = balancesAndApprovalsAfterReceivingItems.indexOf(balanceAndApproval);
316
- balancesAndApprovalsAfterReceivingItems[balanceAndApprovalIndex].balance =
317
- balancesAndApprovalsAfterReceivingItems[balanceAndApprovalIndex].balance.add(amount);
318
- });
319
- });
320
- return balancesAndApprovalsAfterReceivingItems;
321
- };
322
- //# sourceMappingURL=balanceAndApprovalCheck.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"balanceAndApprovalCheck.js","sourceRoot":"","sources":["../../src/utils/balanceAndApprovalCheck.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAAmC;AACnC,0CAAiD;AAEjD,uCAAgD;AAChD,qCAAsC;AACtC,uCAAkD;AAClD,+BAMgB;AA2BhB,IAAM,sBAAsB,GAAG,UAC7B,oBAA0C,EAC1C,KAAa,EACb,oBAA4B;IAE5B,IAAM,kBAAkB,GAAG,oBAAoB,CAAC,IAAI,CAClD,UAAC,EAGA;YAFQ,YAAY,WAAA,EACG,2BAA2B,0BAAA;QAEjD,OAAA,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,WAAW,EAAE;YAClD,2BAA2B,CAAC,WAAW,EAAE;gBACvC,oBAAoB,CAAC,WAAW,EAAE;IAFpC,CAEoC,CACvC,CAAC;IAEF,IAAI,CAAC,kBAAkB,EAAE;QACvB,MA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