@opensea/seaport-js 1.0.6 → 1.0.7

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 (316) hide show
  1. package/lib/__tests__/ascending-descending-amounts.spec.d.ts +1 -0
  2. package/lib/__tests__/ascending-descending-amounts.spec.js +1016 -0
  3. package/lib/__tests__/ascending-descending-amounts.spec.js.map +1 -0
  4. package/lib/__tests__/basic-fulfill.spec.d.ts +1 -0
  5. package/lib/__tests__/basic-fulfill.spec.js +914 -0
  6. package/lib/__tests__/basic-fulfill.spec.js.map +1 -0
  7. package/lib/__tests__/bundle.spec.d.ts +1 -0
  8. package/lib/__tests__/bundle.spec.js +1226 -0
  9. package/lib/__tests__/bundle.spec.js.map +1 -0
  10. package/lib/__tests__/cancel.spec.d.ts +1 -0
  11. package/lib/__tests__/cancel.spec.js +194 -0
  12. package/lib/__tests__/cancel.spec.js.map +1 -0
  13. package/lib/__tests__/create-order.spec.d.ts +1 -0
  14. package/lib/__tests__/create-order.spec.js +1043 -0
  15. package/lib/__tests__/create-order.spec.js.map +1 -0
  16. package/lib/__tests__/criteria-based.spec.d.ts +1 -0
  17. package/lib/__tests__/criteria-based.spec.js +1593 -0
  18. package/lib/__tests__/criteria-based.spec.js.map +1 -0
  19. package/lib/__tests__/fulfill-orders.spec.d.ts +1 -0
  20. package/lib/__tests__/fulfill-orders.spec.js +1010 -0
  21. package/lib/__tests__/fulfill-orders.spec.js.map +1 -0
  22. package/lib/__tests__/gifting.spec.d.ts +1 -0
  23. package/lib/__tests__/gifting.spec.js +374 -0
  24. package/lib/__tests__/gifting.spec.js.map +1 -0
  25. package/lib/__tests__/match-orders.spec.d.ts +1 -0
  26. package/lib/__tests__/match-orders.spec.js +425 -0
  27. package/lib/__tests__/match-orders.spec.js.map +1 -0
  28. package/lib/__tests__/partial-fulfill.spec.d.ts +1 -0
  29. package/lib/__tests__/partial-fulfill.spec.js +849 -0
  30. package/lib/__tests__/partial-fulfill.spec.js.map +1 -0
  31. package/lib/__tests__/sign-order.spec.d.ts +1 -0
  32. package/lib/__tests__/sign-order.spec.js +147 -0
  33. package/lib/__tests__/sign-order.spec.js.map +1 -0
  34. package/lib/__tests__/swap.spec.d.ts +1 -0
  35. package/lib/__tests__/swap.spec.js +594 -0
  36. package/lib/__tests__/swap.spec.js.map +1 -0
  37. package/lib/__tests__/utils/balance.d.ts +22 -0
  38. package/lib/__tests__/utils/balance.js +271 -0
  39. package/lib/__tests__/utils/balance.js.map +1 -0
  40. package/lib/__tests__/utils/examples/privateListings.d.ts +3 -0
  41. package/lib/__tests__/utils/examples/privateListings.js +139 -0
  42. package/lib/__tests__/utils/examples/privateListings.js.map +1 -0
  43. package/lib/__tests__/utils/setup.d.ts +11 -0
  44. package/lib/__tests__/utils/setup.js +119 -0
  45. package/lib/__tests__/utils/setup.js.map +1 -0
  46. package/lib/seaport.d.ts +15 -6
  47. package/lib/seaport.js +29 -28
  48. package/lib/seaport.js.map +1 -1
  49. package/lib/typechain/AmountDerivationErrors.d.ts +29 -0
  50. package/lib/typechain/AmountDerivationErrors.js +3 -0
  51. package/lib/typechain/AmountDerivationErrors.js.map +1 -0
  52. package/lib/typechain/AmountDeriver.d.ts +29 -0
  53. package/lib/typechain/AmountDeriver.js +3 -0
  54. package/lib/typechain/AmountDeriver.js.map +1 -0
  55. package/lib/typechain/Assertions.d.ts +124 -0
  56. package/lib/typechain/Assertions.js +3 -0
  57. package/lib/typechain/Assertions.js.map +1 -0
  58. package/lib/typechain/BasicOrderFulfiller.d.ts +124 -0
  59. package/lib/typechain/BasicOrderFulfiller.js +3 -0
  60. package/lib/typechain/BasicOrderFulfiller.js.map +1 -0
  61. package/lib/typechain/Conduit.d.ts +156 -0
  62. package/lib/typechain/Conduit.js +3 -0
  63. package/lib/typechain/Conduit.js.map +1 -0
  64. package/lib/typechain/ConduitController.d.ts +266 -0
  65. package/lib/typechain/ConduitController.js +3 -0
  66. package/lib/typechain/ConduitController.js.map +1 -0
  67. package/lib/typechain/ConduitControllerInterface.d.ts +266 -0
  68. package/lib/typechain/ConduitControllerInterface.js +3 -0
  69. package/lib/typechain/ConduitControllerInterface.js.map +1 -0
  70. package/lib/typechain/ConduitInterface.d.ts +156 -0
  71. package/lib/typechain/ConduitInterface.js +3 -0
  72. package/lib/typechain/ConduitInterface.js.map +1 -0
  73. package/lib/typechain/Consideration.d.ts +686 -0
  74. package/lib/typechain/Consideration.js +3 -0
  75. package/lib/typechain/Consideration.js.map +1 -0
  76. package/lib/typechain/ConsiderationBase.d.ts +124 -0
  77. package/lib/typechain/ConsiderationBase.js +3 -0
  78. package/lib/typechain/ConsiderationBase.js.map +1 -0
  79. package/lib/typechain/ConsiderationEventsAndErrors.d.ts +124 -0
  80. package/lib/typechain/ConsiderationEventsAndErrors.js +3 -0
  81. package/lib/typechain/ConsiderationEventsAndErrors.js.map +1 -0
  82. package/lib/typechain/ConsiderationInterface.d.ts +612 -0
  83. package/lib/typechain/ConsiderationInterface.js +3 -0
  84. package/lib/typechain/ConsiderationInterface.js.map +1 -0
  85. package/lib/typechain/CounterManager.d.ts +124 -0
  86. package/lib/typechain/CounterManager.js +3 -0
  87. package/lib/typechain/CounterManager.js.map +1 -0
  88. package/lib/typechain/CriteriaResolution.d.ts +29 -0
  89. package/lib/typechain/CriteriaResolution.js +3 -0
  90. package/lib/typechain/CriteriaResolution.js.map +1 -0
  91. package/lib/typechain/CriteriaResolutionErrors.d.ts +29 -0
  92. package/lib/typechain/CriteriaResolutionErrors.js +3 -0
  93. package/lib/typechain/CriteriaResolutionErrors.js.map +1 -0
  94. package/lib/typechain/EIP1271Interface.d.ts +43 -0
  95. package/lib/typechain/EIP1271Interface.js +3 -0
  96. package/lib/typechain/EIP1271Interface.js.map +1 -0
  97. package/lib/typechain/ERC1155Interface.d.ts +67 -0
  98. package/lib/typechain/ERC1155Interface.js +3 -0
  99. package/lib/typechain/ERC1155Interface.js.map +1 -0
  100. package/lib/typechain/ERC1155TokenReceiver.d.ts +67 -0
  101. package/lib/typechain/ERC1155TokenReceiver.js +3 -0
  102. package/lib/typechain/ERC1155TokenReceiver.js.map +1 -0
  103. package/lib/typechain/ERC20Interface.d.ts +51 -0
  104. package/lib/typechain/ERC20Interface.js +3 -0
  105. package/lib/typechain/ERC20Interface.js.map +1 -0
  106. package/lib/typechain/ERC721Interface.d.ts +51 -0
  107. package/lib/typechain/ERC721Interface.js +3 -0
  108. package/lib/typechain/ERC721Interface.js.map +1 -0
  109. package/lib/typechain/ERC721TokenReceiver.d.ts +51 -0
  110. package/lib/typechain/ERC721TokenReceiver.js +3 -0
  111. package/lib/typechain/ERC721TokenReceiver.js.map +1 -0
  112. package/lib/typechain/Executor.d.ts +124 -0
  113. package/lib/typechain/Executor.js +3 -0
  114. package/lib/typechain/Executor.js.map +1 -0
  115. package/lib/typechain/FulfillmentApplicationErrors.d.ts +29 -0
  116. package/lib/typechain/FulfillmentApplicationErrors.js +3 -0
  117. package/lib/typechain/FulfillmentApplicationErrors.js.map +1 -0
  118. package/lib/typechain/FulfillmentApplier.d.ts +29 -0
  119. package/lib/typechain/FulfillmentApplier.js +3 -0
  120. package/lib/typechain/FulfillmentApplier.js.map +1 -0
  121. package/lib/typechain/GettersAndDerivers.d.ts +124 -0
  122. package/lib/typechain/GettersAndDerivers.js +3 -0
  123. package/lib/typechain/GettersAndDerivers.js.map +1 -0
  124. package/lib/typechain/OrderCombiner.d.ts +124 -0
  125. package/lib/typechain/OrderCombiner.js +3 -0
  126. package/lib/typechain/OrderCombiner.js.map +1 -0
  127. package/lib/typechain/OrderFulfiller.d.ts +124 -0
  128. package/lib/typechain/OrderFulfiller.js +3 -0
  129. package/lib/typechain/OrderFulfiller.js.map +1 -0
  130. package/lib/typechain/OrderValidator.d.ts +124 -0
  131. package/lib/typechain/OrderValidator.js +3 -0
  132. package/lib/typechain/OrderValidator.js.map +1 -0
  133. package/lib/typechain/ReentrancyErrors.d.ts +29 -0
  134. package/lib/typechain/ReentrancyErrors.js +3 -0
  135. package/lib/typechain/ReentrancyErrors.js.map +1 -0
  136. package/lib/typechain/ReentrancyGuard.d.ts +29 -0
  137. package/lib/typechain/ReentrancyGuard.js +3 -0
  138. package/lib/typechain/ReentrancyGuard.js.map +1 -0
  139. package/lib/typechain/SignatureVerification.d.ts +29 -0
  140. package/lib/typechain/SignatureVerification.js +3 -0
  141. package/lib/typechain/SignatureVerification.js.map +1 -0
  142. package/lib/typechain/SignatureVerificationErrors.d.ts +29 -0
  143. package/lib/typechain/SignatureVerificationErrors.js +3 -0
  144. package/lib/typechain/SignatureVerificationErrors.js.map +1 -0
  145. package/lib/typechain/TestERC1155.d.ts +205 -0
  146. package/lib/typechain/TestERC1155.js +3 -0
  147. package/lib/typechain/TestERC1155.js.map +1 -0
  148. package/lib/typechain/TestERC20.d.ts +249 -0
  149. package/lib/typechain/TestERC20.js +3 -0
  150. package/lib/typechain/TestERC20.js.map +1 -0
  151. package/lib/typechain/TestERC721.d.ts +236 -0
  152. package/lib/typechain/TestERC721.js +3 -0
  153. package/lib/typechain/TestERC721.js.map +1 -0
  154. package/lib/typechain/TokenTransferrer.d.ts +29 -0
  155. package/lib/typechain/TokenTransferrer.js +3 -0
  156. package/lib/typechain/TokenTransferrer.js.map +1 -0
  157. package/lib/typechain/TokenTransferrerErrors.d.ts +29 -0
  158. package/lib/typechain/TokenTransferrerErrors.js +3 -0
  159. package/lib/typechain/TokenTransferrerErrors.js.map +1 -0
  160. package/lib/typechain/Verifiers.d.ts +124 -0
  161. package/lib/typechain/Verifiers.js +3 -0
  162. package/lib/typechain/Verifiers.js.map +1 -0
  163. package/lib/typechain/ZoneInteraction.d.ts +29 -0
  164. package/lib/typechain/ZoneInteraction.js +3 -0
  165. package/lib/typechain/ZoneInteraction.js.map +1 -0
  166. package/lib/typechain/ZoneInteractionErrors.d.ts +29 -0
  167. package/lib/typechain/ZoneInteractionErrors.js +3 -0
  168. package/lib/typechain/ZoneInteractionErrors.js.map +1 -0
  169. package/lib/typechain/ZoneInterface.d.ts +182 -0
  170. package/lib/typechain/ZoneInterface.js +3 -0
  171. package/lib/typechain/ZoneInterface.js.map +1 -0
  172. package/lib/typechain/factories/AmountDerivationErrors__factory.d.ts +12 -0
  173. package/lib/typechain/factories/AmountDerivationErrors__factory.js +28 -0
  174. package/lib/typechain/factories/AmountDerivationErrors__factory.js.map +1 -0
  175. package/lib/typechain/factories/AmountDeriver__factory.d.ts +26 -0
  176. package/lib/typechain/factories/AmountDeriver__factory.js +97 -0
  177. package/lib/typechain/factories/AmountDeriver__factory.js.map +1 -0
  178. package/lib/typechain/factories/Assertions__factory.d.ts +64 -0
  179. package/lib/typechain/factories/Assertions__factory.js +526 -0
  180. package/lib/typechain/factories/Assertions__factory.js.map +1 -0
  181. package/lib/typechain/factories/BasicOrderFulfiller__factory.d.ts +64 -0
  182. package/lib/typechain/factories/BasicOrderFulfiller__factory.js +563 -0
  183. package/lib/typechain/factories/BasicOrderFulfiller__factory.js.map +1 -0
  184. package/lib/typechain/factories/ConduitControllerInterface__factory.d.ts +46 -0
  185. package/lib/typechain/factories/ConduitControllerInterface__factory.js +453 -0
  186. package/lib/typechain/factories/ConduitControllerInterface__factory.js.map +1 -0
  187. package/lib/typechain/factories/ConduitController__factory.d.ts +67 -0
  188. package/lib/typechain/factories/ConduitController__factory.js +527 -0
  189. package/lib/typechain/factories/ConduitController__factory.js.map +1 -0
  190. package/lib/typechain/factories/ConduitInterface__factory.d.ts +62 -0
  191. package/lib/typechain/factories/ConduitInterface__factory.js +282 -0
  192. package/lib/typechain/factories/ConduitInterface__factory.js.map +1 -0
  193. package/lib/typechain/factories/Conduit__factory.d.ts +83 -0
  194. package/lib/typechain/factories/Conduit__factory.js +465 -0
  195. package/lib/typechain/factories/Conduit__factory.js.map +1 -0
  196. package/lib/typechain/factories/ConsiderationBase__factory.d.ts +64 -0
  197. package/lib/typechain/factories/ConsiderationBase__factory.js +412 -0
  198. package/lib/typechain/factories/ConsiderationBase__factory.js.map +1 -0
  199. package/lib/typechain/factories/ConsiderationEventsAndErrors__factory.d.ts +38 -0
  200. package/lib/typechain/factories/ConsiderationEventsAndErrors__factory.js +332 -0
  201. package/lib/typechain/factories/ConsiderationEventsAndErrors__factory.js.map +1 -0
  202. package/lib/typechain/factories/ConsiderationInterface__factory.d.ts +72 -0
  203. package/lib/typechain/factories/ConsiderationInterface__factory.js +2064 -0
  204. package/lib/typechain/factories/ConsiderationInterface__factory.js.map +1 -0
  205. package/lib/typechain/factories/Consideration__factory.d.ts +132 -0
  206. package/lib/typechain/factories/Consideration__factory.js +2670 -0
  207. package/lib/typechain/factories/Consideration__factory.js.map +1 -0
  208. package/lib/typechain/factories/CounterManager__factory.d.ts +52 -0
  209. package/lib/typechain/factories/CounterManager__factory.js +406 -0
  210. package/lib/typechain/factories/CounterManager__factory.js.map +1 -0
  211. package/lib/typechain/factories/CriteriaResolutionErrors__factory.d.ts +12 -0
  212. package/lib/typechain/factories/CriteriaResolutionErrors__factory.js +58 -0
  213. package/lib/typechain/factories/CriteriaResolutionErrors__factory.js.map +1 -0
  214. package/lib/typechain/factories/CriteriaResolution__factory.d.ts +26 -0
  215. package/lib/typechain/factories/CriteriaResolution__factory.js +127 -0
  216. package/lib/typechain/factories/CriteriaResolution__factory.js.map +1 -0
  217. package/lib/typechain/factories/EIP1271Interface__factory.d.ts +22 -0
  218. package/lib/typechain/factories/EIP1271Interface__factory.js +47 -0
  219. package/lib/typechain/factories/EIP1271Interface__factory.js.map +1 -0
  220. package/lib/typechain/factories/ERC1155Interface__factory.d.ts +18 -0
  221. package/lib/typechain/factories/ERC1155Interface__factory.js +89 -0
  222. package/lib/typechain/factories/ERC1155Interface__factory.js.map +1 -0
  223. package/lib/typechain/factories/ERC1155TokenReceiver__factory.d.ts +22 -0
  224. package/lib/typechain/factories/ERC1155TokenReceiver__factory.js +101 -0
  225. package/lib/typechain/factories/ERC1155TokenReceiver__factory.js.map +1 -0
  226. package/lib/typechain/factories/ERC1155__factory.d.ts +35 -0
  227. package/lib/typechain/factories/ERC1155__factory.js +335 -0
  228. package/lib/typechain/factories/ERC1155__factory.js.map +1 -0
  229. package/lib/typechain/factories/ERC20Interface__factory.d.ts +22 -0
  230. package/lib/typechain/factories/ERC20Interface__factory.js +52 -0
  231. package/lib/typechain/factories/ERC20Interface__factory.js.map +1 -0
  232. package/lib/typechain/factories/ERC20__factory.d.ts +35 -0
  233. package/lib/typechain/factories/ERC20__factory.js +333 -0
  234. package/lib/typechain/factories/ERC20__factory.js.map +1 -0
  235. package/lib/typechain/factories/ERC721Interface__factory.d.ts +18 -0
  236. package/lib/typechain/factories/ERC721Interface__factory.js +46 -0
  237. package/lib/typechain/factories/ERC721Interface__factory.js.map +1 -0
  238. package/lib/typechain/factories/ERC721TokenReceiver__factory.d.ts +22 -0
  239. package/lib/typechain/factories/ERC721TokenReceiver__factory.js +57 -0
  240. package/lib/typechain/factories/ERC721TokenReceiver__factory.js.map +1 -0
  241. package/lib/typechain/factories/ERC721__factory.d.ts +35 -0
  242. package/lib/typechain/factories/ERC721__factory.js +353 -0
  243. package/lib/typechain/factories/ERC721__factory.js.map +1 -0
  244. package/lib/typechain/factories/Executor__factory.d.ts +64 -0
  245. package/lib/typechain/factories/Executor__factory.js +552 -0
  246. package/lib/typechain/factories/Executor__factory.js.map +1 -0
  247. package/lib/typechain/factories/FulfillmentApplicationErrors__factory.d.ts +16 -0
  248. package/lib/typechain/factories/FulfillmentApplicationErrors__factory.js +49 -0
  249. package/lib/typechain/factories/FulfillmentApplicationErrors__factory.js.map +1 -0
  250. package/lib/typechain/factories/FulfillmentApplier__factory.d.ts +30 -0
  251. package/lib/typechain/factories/FulfillmentApplier__factory.js +118 -0
  252. package/lib/typechain/factories/FulfillmentApplier__factory.js.map +1 -0
  253. package/lib/typechain/factories/GettersAndDerivers__factory.d.ts +64 -0
  254. package/lib/typechain/factories/GettersAndDerivers__factory.js +412 -0
  255. package/lib/typechain/factories/GettersAndDerivers__factory.js.map +1 -0
  256. package/lib/typechain/factories/OrderCombiner__factory.d.ts +64 -0
  257. package/lib/typechain/factories/OrderCombiner__factory.js +629 -0
  258. package/lib/typechain/factories/OrderCombiner__factory.js.map +1 -0
  259. package/lib/typechain/factories/OrderFulfiller__factory.d.ts +64 -0
  260. package/lib/typechain/factories/OrderFulfiller__factory.js +603 -0
  261. package/lib/typechain/factories/OrderFulfiller__factory.js.map +1 -0
  262. package/lib/typechain/factories/OrderValidator__factory.d.ts +64 -0
  263. package/lib/typechain/factories/OrderValidator__factory.js +563 -0
  264. package/lib/typechain/factories/OrderValidator__factory.js.map +1 -0
  265. package/lib/typechain/factories/ReentrancyErrors__factory.d.ts +12 -0
  266. package/lib/typechain/factories/ReentrancyErrors__factory.js +28 -0
  267. package/lib/typechain/factories/ReentrancyErrors__factory.js.map +1 -0
  268. package/lib/typechain/factories/ReentrancyGuard__factory.d.ts +32 -0
  269. package/lib/typechain/factories/ReentrancyGuard__factory.js +102 -0
  270. package/lib/typechain/factories/ReentrancyGuard__factory.js.map +1 -0
  271. package/lib/typechain/factories/Seaport__factory.d.ts +132 -0
  272. package/lib/typechain/factories/Seaport__factory.js +2670 -0
  273. package/lib/typechain/factories/Seaport__factory.js.map +1 -0
  274. package/lib/typechain/factories/SignatureVerificationErrors__factory.d.ts +16 -0
  275. package/lib/typechain/factories/SignatureVerificationErrors__factory.js +49 -0
  276. package/lib/typechain/factories/SignatureVerificationErrors__factory.js.map +1 -0
  277. package/lib/typechain/factories/SignatureVerification__factory.d.ts +30 -0
  278. package/lib/typechain/factories/SignatureVerification__factory.js +118 -0
  279. package/lib/typechain/factories/SignatureVerification__factory.js.map +1 -0
  280. package/lib/typechain/factories/TestERC1155__factory.d.ts +49 -0
  281. package/lib/typechain/factories/TestERC1155__factory.js +433 -0
  282. package/lib/typechain/factories/TestERC1155__factory.js.map +1 -0
  283. package/lib/typechain/factories/TestERC20__factory.d.ts +56 -0
  284. package/lib/typechain/factories/TestERC20__factory.js +457 -0
  285. package/lib/typechain/factories/TestERC20__factory.js.map +1 -0
  286. package/lib/typechain/factories/TestERC721__factory.d.ts +49 -0
  287. package/lib/typechain/factories/TestERC721__factory.js +446 -0
  288. package/lib/typechain/factories/TestERC721__factory.js.map +1 -0
  289. package/lib/typechain/factories/TokenTransferrerErrors__factory.d.ts +16 -0
  290. package/lib/typechain/factories/TokenTransferrerErrors__factory.js +132 -0
  291. package/lib/typechain/factories/TokenTransferrerErrors__factory.js.map +1 -0
  292. package/lib/typechain/factories/TokenTransferrer__factory.d.ts +30 -0
  293. package/lib/typechain/factories/TokenTransferrer__factory.js +201 -0
  294. package/lib/typechain/factories/TokenTransferrer__factory.js.map +1 -0
  295. package/lib/typechain/factories/Verifiers__factory.d.ts +64 -0
  296. package/lib/typechain/factories/Verifiers__factory.js +552 -0
  297. package/lib/typechain/factories/Verifiers__factory.js.map +1 -0
  298. package/lib/typechain/factories/ZoneInteractionErrors__factory.d.ts +16 -0
  299. package/lib/typechain/factories/ZoneInteractionErrors__factory.js +34 -0
  300. package/lib/typechain/factories/ZoneInteractionErrors__factory.js.map +1 -0
  301. package/lib/typechain/factories/ZoneInteraction__factory.d.ts +30 -0
  302. package/lib/typechain/factories/ZoneInteraction__factory.js +103 -0
  303. package/lib/typechain/factories/ZoneInteraction__factory.js.map +1 -0
  304. package/lib/typechain/factories/ZoneInterface__factory.d.ts +52 -0
  305. package/lib/typechain/factories/ZoneInterface__factory.js +266 -0
  306. package/lib/typechain/factories/ZoneInterface__factory.js.map +1 -0
  307. package/lib/typechain/index.d.ts +90 -0
  308. package/lib/typechain/index.js +94 -0
  309. package/lib/typechain/index.js.map +1 -0
  310. package/lib/utils/fulfill.d.ts +6 -3
  311. package/lib/utils/fulfill.js +7 -11
  312. package/lib/utils/fulfill.js.map +1 -1
  313. package/lib/utils/usecase.d.ts +2 -1
  314. package/lib/utils/usecase.js +38 -11
  315. package/lib/utils/usecase.js.map +1 -1
  316. package/package.json +1 -1
@@ -0,0 +1,1010 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (_) try {
52
+ 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;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
72
+ var __read = (this && this.__read) || function (o, n) {
73
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
74
+ if (!m) return o;
75
+ var i = m.call(o), r, ar = [], e;
76
+ try {
77
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
78
+ }
79
+ catch (error) { e = { error: error }; }
80
+ finally {
81
+ try {
82
+ if (r && !r.done && (m = i["return"])) m.call(i);
83
+ }
84
+ finally { if (e) throw e.error; }
85
+ }
86
+ return ar;
87
+ };
88
+ var __importDefault = (this && this.__importDefault) || function (mod) {
89
+ return (mod && mod.__esModule) ? mod : { "default": mod };
90
+ };
91
+ Object.defineProperty(exports, "__esModule", { value: true });
92
+ var chai_1 = require("chai");
93
+ var ethers_1 = require("ethers");
94
+ var utils_1 = require("ethers/lib/utils");
95
+ var hardhat_1 = require("hardhat");
96
+ var sinon_1 = __importDefault(require("sinon"));
97
+ var constants_1 = require("../constants");
98
+ var fulfill = __importStar(require("../utils/fulfill"));
99
+ var setup_1 = require("./utils/setup");
100
+ (0, setup_1.describeWithFixture)("As a user I want to buy multiple listings or accept multiple offers", function (fixture) {
101
+ var offerer;
102
+ var secondOfferer;
103
+ var zone;
104
+ var fulfiller;
105
+ var firstStandardCreateOrderInput;
106
+ var secondStandardCreateOrderInput;
107
+ var thirdStandardCreateOrderInput;
108
+ var fulfillAvailableOrdersSpy;
109
+ var secondTestErc721;
110
+ var secondTestErc1155;
111
+ var nftId = "1";
112
+ var nftId2 = "2";
113
+ var erc1155Amount = "3";
114
+ var erc1155Amount2 = "7";
115
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
116
+ var TestERC721, TestERC1155;
117
+ var _a;
118
+ return __generator(this, function (_b) {
119
+ switch (_b.label) {
120
+ case 0:
121
+ fulfillAvailableOrdersSpy = sinon_1.default.spy(fulfill, "fulfillAvailableOrders");
122
+ return [4 /*yield*/, hardhat_1.ethers.getSigners()];
123
+ case 1:
124
+ _a = __read.apply(void 0, [_b.sent(), 4]), offerer = _a[0], secondOfferer = _a[1], zone = _a[2], fulfiller = _a[3];
125
+ return [4 /*yield*/, hardhat_1.ethers.getContractFactory("TestERC721")];
126
+ case 2:
127
+ TestERC721 = _b.sent();
128
+ return [4 /*yield*/, TestERC721.deploy()];
129
+ case 3:
130
+ secondTestErc721 = _b.sent();
131
+ return [4 /*yield*/, secondTestErc721.deployed()];
132
+ case 4:
133
+ _b.sent();
134
+ return [4 /*yield*/, hardhat_1.ethers.getContractFactory("TestERC1155")];
135
+ case 5:
136
+ TestERC1155 = _b.sent();
137
+ return [4 /*yield*/, TestERC1155.deploy()];
138
+ case 6:
139
+ secondTestErc1155 = _b.sent();
140
+ return [4 /*yield*/, secondTestErc1155.deployed()];
141
+ case 7:
142
+ _b.sent();
143
+ return [2 /*return*/];
144
+ }
145
+ });
146
+ }); });
147
+ afterEach(function () {
148
+ fulfillAvailableOrdersSpy.restore();
149
+ });
150
+ describe("Multiple ERC721s are to be transferred from separate orders", function () { return __awaiter(void 0, void 0, void 0, function () {
151
+ return __generator(this, function (_a) {
152
+ describe("[Buy now] I want to buy three ERC721 listings", function () { return __awaiter(void 0, void 0, void 0, function () {
153
+ return __generator(this, function (_a) {
154
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
155
+ var testErc721;
156
+ return __generator(this, function (_a) {
157
+ switch (_a.label) {
158
+ case 0:
159
+ testErc721 = fixture.testErc721;
160
+ // These will be used in 3 separate orders
161
+ return [4 /*yield*/, testErc721.mint(offerer.address, nftId)];
162
+ case 1:
163
+ // These will be used in 3 separate orders
164
+ _a.sent();
165
+ return [4 /*yield*/, testErc721.mint(offerer.address, nftId2)];
166
+ case 2:
167
+ _a.sent();
168
+ return [4 /*yield*/, secondTestErc721.mint(secondOfferer.address, nftId)];
169
+ case 3:
170
+ _a.sent();
171
+ firstStandardCreateOrderInput = {
172
+ offer: [
173
+ {
174
+ itemType: constants_1.ItemType.ERC721,
175
+ token: testErc721.address,
176
+ identifier: nftId,
177
+ },
178
+ ],
179
+ consideration: [
180
+ {
181
+ amount: (0, utils_1.parseEther)("10").toString(),
182
+ recipient: offerer.address,
183
+ },
184
+ ],
185
+ // 2.5% fee
186
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
187
+ };
188
+ secondStandardCreateOrderInput = {
189
+ offer: [
190
+ {
191
+ itemType: constants_1.ItemType.ERC721,
192
+ token: testErc721.address,
193
+ identifier: nftId2,
194
+ },
195
+ ],
196
+ consideration: [
197
+ {
198
+ amount: (0, utils_1.parseEther)("10").toString(),
199
+ recipient: offerer.address,
200
+ },
201
+ ],
202
+ // 2.5% fee
203
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
204
+ };
205
+ thirdStandardCreateOrderInput = {
206
+ offer: [
207
+ {
208
+ itemType: constants_1.ItemType.ERC721,
209
+ token: secondTestErc721.address,
210
+ identifier: nftId,
211
+ },
212
+ ],
213
+ consideration: [
214
+ {
215
+ amount: (0, utils_1.parseEther)("10").toString(),
216
+ recipient: secondOfferer.address,
217
+ },
218
+ ],
219
+ // 2.5% fee
220
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
221
+ };
222
+ return [2 /*return*/];
223
+ }
224
+ });
225
+ }); });
226
+ describe("with ETH", function () {
227
+ it("3 ERC721 <=> ETH", function () { return __awaiter(void 0, void 0, void 0, function () {
228
+ var seaport, testErc721, firstOrderUseCase, firstOrder, secondOrderUseCase, secondOrder, thirdOrderUseCase, thirdOrder, actions, action, owners;
229
+ return __generator(this, function (_a) {
230
+ switch (_a.label) {
231
+ case 0:
232
+ seaport = fixture.seaport, testErc721 = fixture.testErc721;
233
+ return [4 /*yield*/, seaport.createOrder(firstStandardCreateOrderInput)];
234
+ case 1:
235
+ firstOrderUseCase = _a.sent();
236
+ return [4 /*yield*/, firstOrderUseCase.executeAllActions()];
237
+ case 2:
238
+ firstOrder = _a.sent();
239
+ return [4 /*yield*/, seaport.createOrder(secondStandardCreateOrderInput)];
240
+ case 3:
241
+ secondOrderUseCase = _a.sent();
242
+ return [4 /*yield*/, secondOrderUseCase.executeAllActions()];
243
+ case 4:
244
+ secondOrder = _a.sent();
245
+ return [4 /*yield*/, seaport.createOrder(thirdStandardCreateOrderInput, secondOfferer.address)];
246
+ case 5:
247
+ thirdOrderUseCase = _a.sent();
248
+ return [4 /*yield*/, thirdOrderUseCase.executeAllActions()];
249
+ case 6:
250
+ thirdOrder = _a.sent();
251
+ return [4 /*yield*/, seaport.fulfillOrders({
252
+ fulfillOrderDetails: [
253
+ { order: firstOrder },
254
+ { order: secondOrder },
255
+ { order: thirdOrder },
256
+ ],
257
+ accountAddress: fulfiller.address,
258
+ })];
259
+ case 7:
260
+ actions = (_a.sent()).actions;
261
+ (0, chai_1.expect)(actions.length).to.eq(1);
262
+ action = actions[0];
263
+ (0, chai_1.expect)(action.type).eq("exchange");
264
+ return [4 /*yield*/, action.transactionMethods.transact()];
265
+ case 8:
266
+ _a.sent();
267
+ return [4 /*yield*/, Promise.all([
268
+ testErc721.ownerOf(nftId),
269
+ testErc721.ownerOf(nftId2),
270
+ secondTestErc721.ownerOf(nftId),
271
+ ])];
272
+ case 9:
273
+ owners = _a.sent();
274
+ (0, chai_1.expect)(owners.every(function (owner) { return owner === fulfiller.address; })).to.be
275
+ .true;
276
+ (0, chai_1.expect)(fulfillAvailableOrdersSpy).calledOnce;
277
+ return [2 /*return*/];
278
+ }
279
+ });
280
+ }); });
281
+ });
282
+ describe("with ERC20", function () {
283
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
284
+ var testErc20;
285
+ return __generator(this, function (_a) {
286
+ testErc20 = fixture.testErc20;
287
+ // Use ERC20 instead of eth
288
+ firstStandardCreateOrderInput = __assign(__assign({}, firstStandardCreateOrderInput), { consideration: firstStandardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
289
+ secondStandardCreateOrderInput = __assign(__assign({}, secondStandardCreateOrderInput), { consideration: secondStandardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
290
+ thirdStandardCreateOrderInput = __assign(__assign({}, thirdStandardCreateOrderInput), { consideration: thirdStandardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
291
+ [
292
+ firstStandardCreateOrderInput,
293
+ secondStandardCreateOrderInput,
294
+ thirdStandardCreateOrderInput,
295
+ ].forEach(function (createOrderInput) { return __awaiter(void 0, void 0, void 0, function () {
296
+ return __generator(this, function (_a) {
297
+ switch (_a.label) {
298
+ case 0: return [4 /*yield*/, testErc20.mint(fulfiller.address, ethers_1.BigNumber.from(createOrderInput.consideration[0].amount))];
299
+ case 1:
300
+ _a.sent();
301
+ return [2 /*return*/];
302
+ }
303
+ });
304
+ }); });
305
+ return [2 /*return*/];
306
+ });
307
+ }); });
308
+ it("3 ERC721 <=> ERC20", function () { return __awaiter(void 0, void 0, void 0, function () {
309
+ var seaport, testErc20, testErc721, firstOrderUseCase, firstOrder, secondOrderUseCase, secondOrder, thirdOrderUseCase, thirdOrder, actions, approvalAction, _a, fulfillAction, owners;
310
+ return __generator(this, function (_b) {
311
+ switch (_b.label) {
312
+ case 0:
313
+ seaport = fixture.seaport, testErc20 = fixture.testErc20, testErc721 = fixture.testErc721;
314
+ return [4 /*yield*/, seaport.createOrder(firstStandardCreateOrderInput)];
315
+ case 1:
316
+ firstOrderUseCase = _b.sent();
317
+ return [4 /*yield*/, firstOrderUseCase.executeAllActions()];
318
+ case 2:
319
+ firstOrder = _b.sent();
320
+ return [4 /*yield*/, seaport.createOrder(secondStandardCreateOrderInput)];
321
+ case 3:
322
+ secondOrderUseCase = _b.sent();
323
+ return [4 /*yield*/, secondOrderUseCase.executeAllActions()];
324
+ case 4:
325
+ secondOrder = _b.sent();
326
+ return [4 /*yield*/, seaport.createOrder(thirdStandardCreateOrderInput, secondOfferer.address)];
327
+ case 5:
328
+ thirdOrderUseCase = _b.sent();
329
+ return [4 /*yield*/, thirdOrderUseCase.executeAllActions()];
330
+ case 6:
331
+ thirdOrder = _b.sent();
332
+ return [4 /*yield*/, seaport.fulfillOrders({
333
+ fulfillOrderDetails: [
334
+ { order: firstOrder },
335
+ { order: secondOrder },
336
+ { order: thirdOrder },
337
+ ],
338
+ accountAddress: fulfiller.address,
339
+ })];
340
+ case 7:
341
+ actions = (_b.sent()).actions;
342
+ (0, chai_1.expect)(actions.length).to.eq(2);
343
+ approvalAction = actions[0];
344
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
345
+ type: "approval",
346
+ token: testErc20.address,
347
+ identifierOrCriteria: "0",
348
+ itemType: constants_1.ItemType.ERC20,
349
+ transactionMethods: approvalAction.transactionMethods,
350
+ operator: seaport.contract.address,
351
+ });
352
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
353
+ case 8:
354
+ _b.sent();
355
+ _a = chai_1.expect;
356
+ return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
357
+ case 9:
358
+ _a.apply(void 0, [_b.sent()]).to.equal(constants_1.MAX_INT);
359
+ fulfillAction = actions[1];
360
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
361
+ case 10:
362
+ _b.sent();
363
+ return [4 /*yield*/, Promise.all([
364
+ testErc721.ownerOf(nftId),
365
+ testErc721.ownerOf(nftId2),
366
+ secondTestErc721.ownerOf(nftId),
367
+ ])];
368
+ case 11:
369
+ owners = _b.sent();
370
+ (0, chai_1.expect)(owners.every(function (owner) { return owner === fulfiller.address; })).to.be
371
+ .true;
372
+ (0, chai_1.expect)(fulfillAvailableOrdersSpy).calledOnce;
373
+ return [2 /*return*/];
374
+ }
375
+ });
376
+ }); });
377
+ });
378
+ return [2 /*return*/];
379
+ });
380
+ }); });
381
+ describe("[Accept offer] I want to accept three ERC721 offers", function () { return __awaiter(void 0, void 0, void 0, function () {
382
+ return __generator(this, function (_a) {
383
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
384
+ var testErc721, testErc20;
385
+ return __generator(this, function (_a) {
386
+ switch (_a.label) {
387
+ case 0:
388
+ testErc721 = fixture.testErc721, testErc20 = fixture.testErc20;
389
+ return [4 /*yield*/, testErc721.mint(fulfiller.address, nftId)];
390
+ case 1:
391
+ _a.sent();
392
+ return [4 /*yield*/, testErc721.mint(fulfiller.address, nftId2)];
393
+ case 2:
394
+ _a.sent();
395
+ return [4 /*yield*/, secondTestErc721.mint(fulfiller.address, nftId)];
396
+ case 3:
397
+ _a.sent();
398
+ return [4 /*yield*/, testErc20.mint(offerer.address, (0, utils_1.parseEther)("20").toString())];
399
+ case 4:
400
+ _a.sent();
401
+ return [4 /*yield*/, testErc20.mint(secondOfferer.address, (0, utils_1.parseEther)("10").toString())];
402
+ case 5:
403
+ _a.sent();
404
+ firstStandardCreateOrderInput = {
405
+ offer: [
406
+ {
407
+ amount: (0, utils_1.parseEther)("10").toString(),
408
+ token: testErc20.address,
409
+ },
410
+ ],
411
+ consideration: [
412
+ {
413
+ itemType: constants_1.ItemType.ERC721,
414
+ token: testErc721.address,
415
+ identifier: nftId,
416
+ recipient: offerer.address,
417
+ },
418
+ ],
419
+ // 2.5% fee
420
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
421
+ };
422
+ secondStandardCreateOrderInput = {
423
+ offer: [
424
+ {
425
+ amount: (0, utils_1.parseEther)("10").toString(),
426
+ token: testErc20.address,
427
+ },
428
+ ],
429
+ consideration: [
430
+ {
431
+ itemType: constants_1.ItemType.ERC721,
432
+ token: testErc721.address,
433
+ identifier: nftId2,
434
+ recipient: offerer.address,
435
+ },
436
+ ],
437
+ // 2.5% fee
438
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
439
+ };
440
+ thirdStandardCreateOrderInput = {
441
+ offer: [
442
+ {
443
+ amount: (0, utils_1.parseEther)("10").toString(),
444
+ token: testErc20.address,
445
+ },
446
+ ],
447
+ consideration: [
448
+ {
449
+ itemType: constants_1.ItemType.ERC721,
450
+ token: secondTestErc721.address,
451
+ identifier: nftId,
452
+ recipient: secondOfferer.address,
453
+ },
454
+ ],
455
+ // 2.5% fee
456
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
457
+ };
458
+ return [2 /*return*/];
459
+ }
460
+ });
461
+ }); });
462
+ it("ERC20 <=> ERC721", function () { return __awaiter(void 0, void 0, void 0, function () {
463
+ var seaport, testErc721, testErc20, firstOrderUseCase, firstOrder, secondOrderUseCase, secondOrder, thirdOrderUseCase, thirdOrder, actions, approvalAction, _a, secondApprovalAction, _b, thirdApprovalAction, _c, fulfillAction, owners;
464
+ return __generator(this, function (_d) {
465
+ switch (_d.label) {
466
+ case 0:
467
+ seaport = fixture.seaport, testErc721 = fixture.testErc721, testErc20 = fixture.testErc20;
468
+ return [4 /*yield*/, seaport.createOrder(firstStandardCreateOrderInput)];
469
+ case 1:
470
+ firstOrderUseCase = _d.sent();
471
+ return [4 /*yield*/, firstOrderUseCase.executeAllActions()];
472
+ case 2:
473
+ firstOrder = _d.sent();
474
+ return [4 /*yield*/, seaport.createOrder(secondStandardCreateOrderInput)];
475
+ case 3:
476
+ secondOrderUseCase = _d.sent();
477
+ return [4 /*yield*/, secondOrderUseCase.executeAllActions()];
478
+ case 4:
479
+ secondOrder = _d.sent();
480
+ return [4 /*yield*/, seaport.createOrder(thirdStandardCreateOrderInput, secondOfferer.address)];
481
+ case 5:
482
+ thirdOrderUseCase = _d.sent();
483
+ return [4 /*yield*/, thirdOrderUseCase.executeAllActions()];
484
+ case 6:
485
+ thirdOrder = _d.sent();
486
+ return [4 /*yield*/, seaport.fulfillOrders({
487
+ fulfillOrderDetails: [
488
+ { order: firstOrder },
489
+ { order: secondOrder },
490
+ { order: thirdOrder },
491
+ ],
492
+ accountAddress: fulfiller.address,
493
+ })];
494
+ case 7:
495
+ actions = (_d.sent()).actions;
496
+ approvalAction = actions[0];
497
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
498
+ type: "approval",
499
+ token: testErc721.address,
500
+ identifierOrCriteria: nftId,
501
+ itemType: constants_1.ItemType.ERC721,
502
+ transactionMethods: approvalAction.transactionMethods,
503
+ operator: seaport.contract.address,
504
+ });
505
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
506
+ case 8:
507
+ _d.sent();
508
+ _a = chai_1.expect;
509
+ return [4 /*yield*/, testErc721.isApprovedForAll(fulfiller.address, seaport.contract.address)];
510
+ case 9:
511
+ _a.apply(void 0, [_d.sent()]).to.be.true;
512
+ secondApprovalAction = actions[1];
513
+ (0, chai_1.expect)(secondApprovalAction).to.deep.equal({
514
+ type: "approval",
515
+ token: testErc20.address,
516
+ identifierOrCriteria: "0",
517
+ itemType: constants_1.ItemType.ERC20,
518
+ transactionMethods: secondApprovalAction.transactionMethods,
519
+ operator: seaport.contract.address,
520
+ });
521
+ return [4 /*yield*/, secondApprovalAction.transactionMethods.transact()];
522
+ case 10:
523
+ _d.sent();
524
+ _b = chai_1.expect;
525
+ return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
526
+ case 11:
527
+ _b.apply(void 0, [_d.sent()]).eq(constants_1.MAX_INT);
528
+ thirdApprovalAction = actions[2];
529
+ (0, chai_1.expect)(thirdApprovalAction).to.deep.equal({
530
+ type: "approval",
531
+ token: secondTestErc721.address,
532
+ identifierOrCriteria: nftId,
533
+ itemType: constants_1.ItemType.ERC721,
534
+ transactionMethods: thirdApprovalAction.transactionMethods,
535
+ operator: seaport.contract.address,
536
+ });
537
+ return [4 /*yield*/, thirdApprovalAction.transactionMethods.transact()];
538
+ case 12:
539
+ _d.sent();
540
+ _c = chai_1.expect;
541
+ return [4 /*yield*/, secondTestErc721.isApprovedForAll(fulfiller.address, seaport.contract.address)];
542
+ case 13:
543
+ _c.apply(void 0, [_d.sent()]).to.be.true;
544
+ fulfillAction = actions[3];
545
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
546
+ type: "exchange",
547
+ transactionMethods: fulfillAction.transactionMethods,
548
+ });
549
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
550
+ case 14:
551
+ _d.sent();
552
+ return [4 /*yield*/, Promise.all([
553
+ testErc721.ownerOf(nftId),
554
+ testErc721.ownerOf(nftId2),
555
+ secondTestErc721.ownerOf(nftId),
556
+ ])];
557
+ case 15:
558
+ owners = _d.sent();
559
+ (0, chai_1.expect)(owners).deep.equal([
560
+ offerer.address,
561
+ offerer.address,
562
+ secondOfferer.address,
563
+ ]);
564
+ (0, chai_1.expect)(fulfillAvailableOrdersSpy).calledOnce;
565
+ return [2 /*return*/];
566
+ }
567
+ });
568
+ }); });
569
+ return [2 /*return*/];
570
+ });
571
+ }); });
572
+ return [2 /*return*/];
573
+ });
574
+ }); });
575
+ describe("Multiple ERC1155s are to be transferred from separate orders", function () { return __awaiter(void 0, void 0, void 0, function () {
576
+ return __generator(this, function (_a) {
577
+ describe("[Buy now] I want to buy three ERC1155 listings", function () { return __awaiter(void 0, void 0, void 0, function () {
578
+ return __generator(this, function (_a) {
579
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
580
+ var testErc1155;
581
+ return __generator(this, function (_a) {
582
+ switch (_a.label) {
583
+ case 0:
584
+ testErc1155 = fixture.testErc1155;
585
+ // These will be used in 3 separate orders
586
+ return [4 /*yield*/, testErc1155.mint(offerer.address, nftId, erc1155Amount)];
587
+ case 1:
588
+ // These will be used in 3 separate orders
589
+ _a.sent();
590
+ return [4 /*yield*/, testErc1155.mint(offerer.address, nftId, erc1155Amount2)];
591
+ case 2:
592
+ _a.sent();
593
+ return [4 /*yield*/, secondTestErc1155.mint(secondOfferer.address, nftId, erc1155Amount)];
594
+ case 3:
595
+ _a.sent();
596
+ firstStandardCreateOrderInput = {
597
+ offer: [
598
+ {
599
+ itemType: constants_1.ItemType.ERC1155,
600
+ token: testErc1155.address,
601
+ amount: erc1155Amount,
602
+ identifier: nftId,
603
+ },
604
+ ],
605
+ consideration: [
606
+ {
607
+ amount: (0, utils_1.parseEther)("10").toString(),
608
+ recipient: offerer.address,
609
+ },
610
+ ],
611
+ // 2.5% fee
612
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
613
+ };
614
+ secondStandardCreateOrderInput = {
615
+ offer: [
616
+ {
617
+ itemType: constants_1.ItemType.ERC1155,
618
+ token: testErc1155.address,
619
+ amount: erc1155Amount2,
620
+ identifier: nftId,
621
+ },
622
+ ],
623
+ consideration: [
624
+ {
625
+ amount: (0, utils_1.parseEther)("10").toString(),
626
+ recipient: offerer.address,
627
+ },
628
+ ],
629
+ // 2.5% fee
630
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
631
+ };
632
+ thirdStandardCreateOrderInput = {
633
+ offer: [
634
+ {
635
+ itemType: constants_1.ItemType.ERC1155,
636
+ token: secondTestErc1155.address,
637
+ amount: erc1155Amount,
638
+ identifier: nftId,
639
+ },
640
+ ],
641
+ consideration: [
642
+ {
643
+ amount: (0, utils_1.parseEther)("10").toString(),
644
+ recipient: secondOfferer.address,
645
+ },
646
+ ],
647
+ // 2.5% fee
648
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
649
+ };
650
+ return [2 /*return*/];
651
+ }
652
+ });
653
+ }); });
654
+ describe("with ETH", function () {
655
+ it("3 ERC1155 <=> ETH", function () { return __awaiter(void 0, void 0, void 0, function () {
656
+ var seaport, testErc1155, firstOrderUseCase, firstOrder, secondOrderUseCase, secondOrder, thirdOrderUseCase, thirdOrder, actions, action, balances;
657
+ return __generator(this, function (_a) {
658
+ switch (_a.label) {
659
+ case 0:
660
+ seaport = fixture.seaport, testErc1155 = fixture.testErc1155;
661
+ return [4 /*yield*/, seaport.createOrder(firstStandardCreateOrderInput)];
662
+ case 1:
663
+ firstOrderUseCase = _a.sent();
664
+ return [4 /*yield*/, firstOrderUseCase.executeAllActions()];
665
+ case 2:
666
+ firstOrder = _a.sent();
667
+ return [4 /*yield*/, seaport.createOrder(secondStandardCreateOrderInput)];
668
+ case 3:
669
+ secondOrderUseCase = _a.sent();
670
+ return [4 /*yield*/, secondOrderUseCase.executeAllActions()];
671
+ case 4:
672
+ secondOrder = _a.sent();
673
+ return [4 /*yield*/, seaport.createOrder(thirdStandardCreateOrderInput, secondOfferer.address)];
674
+ case 5:
675
+ thirdOrderUseCase = _a.sent();
676
+ return [4 /*yield*/, thirdOrderUseCase.executeAllActions()];
677
+ case 6:
678
+ thirdOrder = _a.sent();
679
+ return [4 /*yield*/, seaport.fulfillOrders({
680
+ fulfillOrderDetails: [
681
+ { order: firstOrder },
682
+ { order: secondOrder },
683
+ { order: thirdOrder },
684
+ ],
685
+ accountAddress: fulfiller.address,
686
+ })];
687
+ case 7:
688
+ actions = (_a.sent()).actions;
689
+ (0, chai_1.expect)(actions.length).to.eq(1);
690
+ action = actions[0];
691
+ (0, chai_1.expect)(action.type).eq("exchange");
692
+ return [4 /*yield*/, action.transactionMethods.transact()];
693
+ case 8:
694
+ _a.sent();
695
+ return [4 /*yield*/, Promise.all([
696
+ testErc1155.balanceOf(fulfiller.address, nftId),
697
+ secondTestErc1155.balanceOf(fulfiller.address, nftId),
698
+ ])];
699
+ case 9:
700
+ balances = _a.sent();
701
+ (0, chai_1.expect)(balances[0]).to.equal(ethers_1.BigNumber.from(10));
702
+ (0, chai_1.expect)(balances[1]).to.equal(ethers_1.BigNumber.from(erc1155Amount));
703
+ (0, chai_1.expect)(fulfillAvailableOrdersSpy).calledOnce;
704
+ return [2 /*return*/];
705
+ }
706
+ });
707
+ }); });
708
+ });
709
+ describe("with ERC20", function () {
710
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
711
+ var testErc20;
712
+ return __generator(this, function (_a) {
713
+ testErc20 = fixture.testErc20;
714
+ // Use ERC20 instead of eth
715
+ firstStandardCreateOrderInput = __assign(__assign({}, firstStandardCreateOrderInput), { consideration: firstStandardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
716
+ secondStandardCreateOrderInput = __assign(__assign({}, secondStandardCreateOrderInput), { consideration: secondStandardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
717
+ thirdStandardCreateOrderInput = __assign(__assign({}, thirdStandardCreateOrderInput), { consideration: thirdStandardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
718
+ [
719
+ firstStandardCreateOrderInput,
720
+ secondStandardCreateOrderInput,
721
+ thirdStandardCreateOrderInput,
722
+ ].forEach(function (createOrderInput) { return __awaiter(void 0, void 0, void 0, function () {
723
+ return __generator(this, function (_a) {
724
+ switch (_a.label) {
725
+ case 0: return [4 /*yield*/, testErc20.mint(fulfiller.address, ethers_1.BigNumber.from(createOrderInput.consideration[0].amount))];
726
+ case 1:
727
+ _a.sent();
728
+ return [2 /*return*/];
729
+ }
730
+ });
731
+ }); });
732
+ return [2 /*return*/];
733
+ });
734
+ }); });
735
+ it("3 ERC1155 <=> ERC20", function () { return __awaiter(void 0, void 0, void 0, function () {
736
+ var seaport, testErc20, testErc1155, firstOrderUseCase, firstOrder, secondOrderUseCase, secondOrder, thirdOrderUseCase, thirdOrder, actions, approvalAction, _a, fulfillAction, balances;
737
+ return __generator(this, function (_b) {
738
+ switch (_b.label) {
739
+ case 0:
740
+ seaport = fixture.seaport, testErc20 = fixture.testErc20, testErc1155 = fixture.testErc1155;
741
+ return [4 /*yield*/, seaport.createOrder(firstStandardCreateOrderInput)];
742
+ case 1:
743
+ firstOrderUseCase = _b.sent();
744
+ return [4 /*yield*/, firstOrderUseCase.executeAllActions()];
745
+ case 2:
746
+ firstOrder = _b.sent();
747
+ return [4 /*yield*/, seaport.createOrder(secondStandardCreateOrderInput)];
748
+ case 3:
749
+ secondOrderUseCase = _b.sent();
750
+ return [4 /*yield*/, secondOrderUseCase.executeAllActions()];
751
+ case 4:
752
+ secondOrder = _b.sent();
753
+ return [4 /*yield*/, seaport.createOrder(thirdStandardCreateOrderInput, secondOfferer.address)];
754
+ case 5:
755
+ thirdOrderUseCase = _b.sent();
756
+ return [4 /*yield*/, thirdOrderUseCase.executeAllActions()];
757
+ case 6:
758
+ thirdOrder = _b.sent();
759
+ return [4 /*yield*/, seaport.fulfillOrders({
760
+ fulfillOrderDetails: [
761
+ { order: firstOrder },
762
+ { order: secondOrder },
763
+ { order: thirdOrder },
764
+ ],
765
+ accountAddress: fulfiller.address,
766
+ })];
767
+ case 7:
768
+ actions = (_b.sent()).actions;
769
+ (0, chai_1.expect)(actions.length).to.eq(2);
770
+ approvalAction = actions[0];
771
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
772
+ type: "approval",
773
+ token: testErc20.address,
774
+ identifierOrCriteria: "0",
775
+ itemType: constants_1.ItemType.ERC20,
776
+ transactionMethods: approvalAction.transactionMethods,
777
+ operator: seaport.contract.address,
778
+ });
779
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
780
+ case 8:
781
+ _b.sent();
782
+ _a = chai_1.expect;
783
+ return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
784
+ case 9:
785
+ _a.apply(void 0, [_b.sent()]).to.equal(constants_1.MAX_INT);
786
+ fulfillAction = actions[1];
787
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
788
+ case 10:
789
+ _b.sent();
790
+ return [4 /*yield*/, Promise.all([
791
+ testErc1155.balanceOf(fulfiller.address, nftId),
792
+ secondTestErc1155.balanceOf(fulfiller.address, nftId),
793
+ ])];
794
+ case 11:
795
+ balances = _b.sent();
796
+ (0, chai_1.expect)(balances[0]).to.equal(ethers_1.BigNumber.from(10));
797
+ (0, chai_1.expect)(balances[1]).to.equal(ethers_1.BigNumber.from(erc1155Amount));
798
+ (0, chai_1.expect)(fulfillAvailableOrdersSpy).calledOnce;
799
+ return [2 /*return*/];
800
+ }
801
+ });
802
+ }); });
803
+ });
804
+ return [2 /*return*/];
805
+ });
806
+ }); });
807
+ describe("[Accept offer] I want to accept three ERC1155 offers", function () { return __awaiter(void 0, void 0, void 0, function () {
808
+ return __generator(this, function (_a) {
809
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
810
+ var testErc1155, testErc20;
811
+ return __generator(this, function (_a) {
812
+ switch (_a.label) {
813
+ case 0:
814
+ testErc1155 = fixture.testErc1155, testErc20 = fixture.testErc20;
815
+ return [4 /*yield*/, testErc1155.mint(fulfiller.address, nftId, erc1155Amount)];
816
+ case 1:
817
+ _a.sent();
818
+ return [4 /*yield*/, testErc1155.mint(fulfiller.address, nftId, erc1155Amount2)];
819
+ case 2:
820
+ _a.sent();
821
+ return [4 /*yield*/, secondTestErc1155.mint(fulfiller.address, nftId, erc1155Amount)];
822
+ case 3:
823
+ _a.sent();
824
+ return [4 /*yield*/, testErc20.mint(offerer.address, (0, utils_1.parseEther)("20").toString())];
825
+ case 4:
826
+ _a.sent();
827
+ return [4 /*yield*/, testErc20.mint(secondOfferer.address, (0, utils_1.parseEther)("10").toString())];
828
+ case 5:
829
+ _a.sent();
830
+ firstStandardCreateOrderInput = {
831
+ offer: [
832
+ {
833
+ amount: (0, utils_1.parseEther)("10").toString(),
834
+ token: testErc20.address,
835
+ },
836
+ ],
837
+ consideration: [
838
+ {
839
+ itemType: constants_1.ItemType.ERC1155,
840
+ token: testErc1155.address,
841
+ amount: erc1155Amount,
842
+ identifier: nftId,
843
+ recipient: offerer.address,
844
+ },
845
+ ],
846
+ // 2.5% fee
847
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
848
+ };
849
+ secondStandardCreateOrderInput = {
850
+ offer: [
851
+ {
852
+ amount: (0, utils_1.parseEther)("10").toString(),
853
+ token: testErc20.address,
854
+ },
855
+ ],
856
+ consideration: [
857
+ {
858
+ itemType: constants_1.ItemType.ERC1155,
859
+ token: testErc1155.address,
860
+ amount: erc1155Amount2,
861
+ identifier: nftId,
862
+ recipient: offerer.address,
863
+ },
864
+ ],
865
+ // 2.5% fee
866
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
867
+ };
868
+ thirdStandardCreateOrderInput = {
869
+ offer: [
870
+ {
871
+ amount: (0, utils_1.parseEther)("10").toString(),
872
+ token: testErc20.address,
873
+ },
874
+ ],
875
+ consideration: [
876
+ {
877
+ itemType: constants_1.ItemType.ERC1155,
878
+ token: secondTestErc1155.address,
879
+ amount: erc1155Amount,
880
+ identifier: nftId,
881
+ recipient: secondOfferer.address,
882
+ },
883
+ ],
884
+ // 2.5% fee
885
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
886
+ };
887
+ return [2 /*return*/];
888
+ }
889
+ });
890
+ }); });
891
+ it("ERC20 <=> ERC1155", function () { return __awaiter(void 0, void 0, void 0, function () {
892
+ var seaport, testErc1155, testErc20, firstOrderUseCase, firstOrder, secondOrderUseCase, secondOrder, thirdOrderUseCase, thirdOrder, actions, approvalAction, _a, secondApprovalAction, _b, thirdApprovalAction, _c, fulfillAction, balances;
893
+ return __generator(this, function (_d) {
894
+ switch (_d.label) {
895
+ case 0:
896
+ seaport = fixture.seaport, testErc1155 = fixture.testErc1155, testErc20 = fixture.testErc20;
897
+ return [4 /*yield*/, seaport.createOrder(firstStandardCreateOrderInput)];
898
+ case 1:
899
+ firstOrderUseCase = _d.sent();
900
+ return [4 /*yield*/, firstOrderUseCase.executeAllActions()];
901
+ case 2:
902
+ firstOrder = _d.sent();
903
+ return [4 /*yield*/, seaport.createOrder(secondStandardCreateOrderInput)];
904
+ case 3:
905
+ secondOrderUseCase = _d.sent();
906
+ return [4 /*yield*/, secondOrderUseCase.executeAllActions()];
907
+ case 4:
908
+ secondOrder = _d.sent();
909
+ return [4 /*yield*/, seaport.createOrder(thirdStandardCreateOrderInput, secondOfferer.address)];
910
+ case 5:
911
+ thirdOrderUseCase = _d.sent();
912
+ return [4 /*yield*/, thirdOrderUseCase.executeAllActions()];
913
+ case 6:
914
+ thirdOrder = _d.sent();
915
+ return [4 /*yield*/, seaport.fulfillOrders({
916
+ fulfillOrderDetails: [
917
+ { order: firstOrder },
918
+ { order: secondOrder },
919
+ { order: thirdOrder },
920
+ ],
921
+ accountAddress: fulfiller.address,
922
+ })];
923
+ case 7:
924
+ actions = (_d.sent()).actions;
925
+ approvalAction = actions[0];
926
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
927
+ type: "approval",
928
+ token: testErc1155.address,
929
+ identifierOrCriteria: nftId,
930
+ itemType: constants_1.ItemType.ERC1155,
931
+ transactionMethods: approvalAction.transactionMethods,
932
+ operator: seaport.contract.address,
933
+ });
934
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
935
+ case 8:
936
+ _d.sent();
937
+ _a = chai_1.expect;
938
+ return [4 /*yield*/, testErc1155.isApprovedForAll(fulfiller.address, seaport.contract.address)];
939
+ case 9:
940
+ _a.apply(void 0, [_d.sent()]).to.be.true;
941
+ secondApprovalAction = actions[1];
942
+ (0, chai_1.expect)(secondApprovalAction).to.deep.equal({
943
+ type: "approval",
944
+ token: testErc20.address,
945
+ identifierOrCriteria: "0",
946
+ itemType: constants_1.ItemType.ERC20,
947
+ transactionMethods: secondApprovalAction.transactionMethods,
948
+ operator: seaport.contract.address,
949
+ });
950
+ return [4 /*yield*/, secondApprovalAction.transactionMethods.transact()];
951
+ case 10:
952
+ _d.sent();
953
+ _b = chai_1.expect;
954
+ return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
955
+ case 11:
956
+ _b.apply(void 0, [_d.sent()]).eq(constants_1.MAX_INT);
957
+ thirdApprovalAction = actions[2];
958
+ (0, chai_1.expect)(thirdApprovalAction).to.deep.equal({
959
+ type: "approval",
960
+ token: secondTestErc1155.address,
961
+ identifierOrCriteria: nftId,
962
+ itemType: constants_1.ItemType.ERC1155,
963
+ transactionMethods: thirdApprovalAction.transactionMethods,
964
+ operator: seaport.contract.address,
965
+ });
966
+ return [4 /*yield*/, thirdApprovalAction.transactionMethods.transact()];
967
+ case 12:
968
+ _d.sent();
969
+ _c = chai_1.expect;
970
+ return [4 /*yield*/, secondTestErc1155.isApprovedForAll(fulfiller.address, seaport.contract.address)];
971
+ case 13:
972
+ _c.apply(void 0, [_d.sent()]).to.be.true;
973
+ fulfillAction = actions[3];
974
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
975
+ type: "exchange",
976
+ transactionMethods: fulfillAction.transactionMethods,
977
+ });
978
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
979
+ case 14:
980
+ _d.sent();
981
+ return [4 /*yield*/, Promise.all([
982
+ testErc1155.balanceOf(offerer.address, nftId),
983
+ secondTestErc1155.balanceOf(secondOfferer.address, nftId),
984
+ ])];
985
+ case 15:
986
+ balances = _d.sent();
987
+ (0, chai_1.expect)(balances[0]).to.equal(ethers_1.BigNumber.from(10));
988
+ (0, chai_1.expect)(balances[1]).to.equal(ethers_1.BigNumber.from(erc1155Amount));
989
+ (0, chai_1.expect)(fulfillAvailableOrdersSpy).calledOnce;
990
+ return [2 /*return*/];
991
+ }
992
+ });
993
+ }); });
994
+ return [2 /*return*/];
995
+ });
996
+ }); });
997
+ return [2 /*return*/];
998
+ });
999
+ }); });
1000
+ // TODO
1001
+ describe("Special use cases", function () {
1002
+ it("Can fulfill dutch auction orders", function () { });
1003
+ it("Can fulfill criteria based orders", function () { });
1004
+ it("Can fulfill a single order", function () { });
1005
+ it("Can fulfill bundle orders", function () { });
1006
+ it("Can fulfill swap orders", function () { });
1007
+ it("Can partially fulfill orders", function () { });
1008
+ });
1009
+ });
1010
+ //# sourceMappingURL=fulfill-orders.spec.js.map