@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,914 @@
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 multicall_1 = require("@0xsequence/multicall");
93
+ var chai_1 = require("chai");
94
+ var ethers_1 = require("ethers");
95
+ var utils_1 = require("ethers/lib/utils");
96
+ var hardhat_1 = require("hardhat");
97
+ var sinon_1 = __importDefault(require("sinon"));
98
+ var constants_1 = require("../constants");
99
+ var fulfill = __importStar(require("../utils/fulfill"));
100
+ var balance_1 = require("./utils/balance");
101
+ var setup_1 = require("./utils/setup");
102
+ (0, setup_1.describeWithFixture)("As a user I want to buy now or accept an offer", function (fixture) {
103
+ var offerer;
104
+ var zone;
105
+ var fulfiller;
106
+ var standardCreateOrderInput;
107
+ var multicallProvider;
108
+ var fulfillBasicOrderSpy;
109
+ var nftId = "1";
110
+ var erc1155Amount = "3";
111
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
112
+ var _a;
113
+ return __generator(this, function (_b) {
114
+ switch (_b.label) {
115
+ case 0:
116
+ fulfillBasicOrderSpy = sinon_1.default.spy(fulfill, "fulfillBasicOrder");
117
+ return [4 /*yield*/, hardhat_1.ethers.getSigners()];
118
+ case 1:
119
+ _a = __read.apply(void 0, [_b.sent(), 3]), offerer = _a[0], zone = _a[1], fulfiller = _a[2];
120
+ multicallProvider = new multicall_1.providers.MulticallProvider(hardhat_1.ethers.provider);
121
+ return [2 /*return*/];
122
+ }
123
+ });
124
+ }); });
125
+ afterEach(function () {
126
+ fulfillBasicOrderSpy.restore();
127
+ });
128
+ describe("A single ERC721 is to be transferred", function () { return __awaiter(void 0, void 0, void 0, function () {
129
+ return __generator(this, function (_a) {
130
+ describe("[Buy now] I want to buy a single ERC721", function () { return __awaiter(void 0, void 0, void 0, function () {
131
+ return __generator(this, function (_a) {
132
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
133
+ var testErc721;
134
+ return __generator(this, function (_a) {
135
+ switch (_a.label) {
136
+ case 0:
137
+ testErc721 = fixture.testErc721;
138
+ return [4 /*yield*/, testErc721.mint(offerer.address, nftId)];
139
+ case 1:
140
+ _a.sent();
141
+ standardCreateOrderInput = {
142
+ startTime: "0",
143
+ offer: [
144
+ {
145
+ itemType: constants_1.ItemType.ERC721,
146
+ token: testErc721.address,
147
+ identifier: nftId,
148
+ },
149
+ ],
150
+ consideration: [
151
+ {
152
+ amount: (0, utils_1.parseEther)("10").toString(),
153
+ recipient: offerer.address,
154
+ },
155
+ ],
156
+ // 2.5% fee
157
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
158
+ };
159
+ return [2 /*return*/];
160
+ }
161
+ });
162
+ }); });
163
+ describe("with ETH", function () {
164
+ it("ERC721 <=> ETH", function () { return __awaiter(void 0, void 0, void 0, function () {
165
+ var seaport, executeAllActions, order, ownerToTokenToIdentifierBalances, actions, action, transaction, receipt;
166
+ return __generator(this, function (_a) {
167
+ switch (_a.label) {
168
+ case 0:
169
+ seaport = fixture.seaport;
170
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
171
+ case 1:
172
+ executeAllActions = (_a.sent()).executeAllActions;
173
+ return [4 /*yield*/, executeAllActions()];
174
+ case 2:
175
+ order = _a.sent();
176
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
177
+ case 3:
178
+ ownerToTokenToIdentifierBalances = _a.sent();
179
+ return [4 /*yield*/, seaport.fulfillOrder({
180
+ order: order,
181
+ accountAddress: fulfiller.address,
182
+ })];
183
+ case 4:
184
+ actions = (_a.sent()).actions;
185
+ (0, chai_1.expect)(actions.length).to.eq(1);
186
+ action = actions[0];
187
+ (0, chai_1.expect)(action.type).eq("exchange");
188
+ return [4 /*yield*/, action.transactionMethods.transact()];
189
+ case 5:
190
+ transaction = _a.sent();
191
+ return [4 /*yield*/, transaction.wait()];
192
+ case 6:
193
+ receipt = _a.sent();
194
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
195
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
196
+ order: order,
197
+ fulfillerAddress: fulfiller.address,
198
+ multicallProvider: multicallProvider,
199
+ fulfillReceipt: receipt,
200
+ })];
201
+ case 7:
202
+ _a.sent();
203
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
204
+ return [2 /*return*/];
205
+ }
206
+ });
207
+ }); });
208
+ it("ERC721 <=> ETH (already validated order)", function () { return __awaiter(void 0, void 0, void 0, function () {
209
+ var seaport, executeAllActions, order, actions, action, ownerToTokenToIdentifierBalances, transaction, receipt;
210
+ return __generator(this, function (_a) {
211
+ switch (_a.label) {
212
+ case 0:
213
+ seaport = fixture.seaport;
214
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
215
+ case 1:
216
+ executeAllActions = (_a.sent()).executeAllActions;
217
+ return [4 /*yield*/, executeAllActions()];
218
+ case 2:
219
+ order = _a.sent();
220
+ // Remove signature
221
+ order.signature = "0x";
222
+ return [4 /*yield*/, seaport.fulfillOrder({
223
+ order: order,
224
+ accountAddress: fulfiller.address,
225
+ })];
226
+ case 3:
227
+ actions = (_a.sent()).actions;
228
+ action = actions[0];
229
+ // Should revert because signature is empty
230
+ return [4 /*yield*/, (0, chai_1.expect)(action.transactionMethods.transact()).to.be.revertedWith("InvalidSigner")];
231
+ case 4:
232
+ // Should revert because signature is empty
233
+ _a.sent();
234
+ return [4 /*yield*/, seaport.validate([order], offerer.address).transact()];
235
+ case 5:
236
+ _a.sent();
237
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
238
+ case 6:
239
+ ownerToTokenToIdentifierBalances = _a.sent();
240
+ return [4 /*yield*/, action.transactionMethods.transact()];
241
+ case 7:
242
+ transaction = _a.sent();
243
+ return [4 /*yield*/, transaction.wait()];
244
+ case 8:
245
+ receipt = _a.sent();
246
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
247
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
248
+ order: order,
249
+ fulfillerAddress: fulfiller.address,
250
+ multicallProvider: multicallProvider,
251
+ fulfillReceipt: receipt,
252
+ })];
253
+ case 9:
254
+ _a.sent();
255
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
256
+ return [2 /*return*/];
257
+ }
258
+ });
259
+ }); });
260
+ });
261
+ describe("with ERC20", function () {
262
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
263
+ var testErc20;
264
+ return __generator(this, function (_a) {
265
+ testErc20 = fixture.testErc20;
266
+ // Use ERC20 instead of eth
267
+ standardCreateOrderInput = __assign(__assign({}, standardCreateOrderInput), { consideration: standardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
268
+ testErc20.mint(fulfiller.address, ethers_1.BigNumber.from(standardCreateOrderInput.consideration[0]
269
+ .amount));
270
+ return [2 /*return*/];
271
+ });
272
+ }); });
273
+ it("ERC721 <=> ERC20", function () { return __awaiter(void 0, void 0, void 0, function () {
274
+ var seaport, testErc20, executeAllActions, order, ownerToTokenToIdentifierBalances, actions, approvalAction, _a, fulfillAction, transaction, receipt;
275
+ return __generator(this, function (_b) {
276
+ switch (_b.label) {
277
+ case 0:
278
+ seaport = fixture.seaport, testErc20 = fixture.testErc20;
279
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
280
+ case 1:
281
+ executeAllActions = (_b.sent()).executeAllActions;
282
+ return [4 /*yield*/, executeAllActions()];
283
+ case 2:
284
+ order = _b.sent();
285
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
286
+ case 3:
287
+ ownerToTokenToIdentifierBalances = _b.sent();
288
+ return [4 /*yield*/, seaport.fulfillOrder({
289
+ order: order,
290
+ accountAddress: fulfiller.address,
291
+ })];
292
+ case 4:
293
+ actions = (_b.sent()).actions;
294
+ approvalAction = actions[0];
295
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
296
+ type: "approval",
297
+ token: testErc20.address,
298
+ identifierOrCriteria: "0",
299
+ itemType: constants_1.ItemType.ERC20,
300
+ transactionMethods: approvalAction.transactionMethods,
301
+ operator: seaport.contract.address,
302
+ });
303
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
304
+ case 5:
305
+ _b.sent();
306
+ _a = chai_1.expect;
307
+ return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
308
+ case 6:
309
+ _a.apply(void 0, [_b.sent()]).to.equal(constants_1.MAX_INT);
310
+ fulfillAction = actions[1];
311
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
312
+ type: "exchange",
313
+ transactionMethods: fulfillAction.transactionMethods,
314
+ });
315
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
316
+ case 7:
317
+ transaction = _b.sent();
318
+ return [4 /*yield*/, transaction.wait()];
319
+ case 8:
320
+ receipt = _b.sent();
321
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
322
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
323
+ order: order,
324
+ fulfillerAddress: fulfiller.address,
325
+ multicallProvider: multicallProvider,
326
+ fulfillReceipt: receipt,
327
+ })];
328
+ case 9:
329
+ _b.sent();
330
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
331
+ return [2 /*return*/];
332
+ }
333
+ });
334
+ }); });
335
+ it("ERC721 <=> ERC20 (already validated order)", function () { return __awaiter(void 0, void 0, void 0, function () {
336
+ var seaport, testErc20, executeAllActions, order, ownerToTokenToIdentifierBalances, revertedUseCase, actions, approvalAction, _a, fulfillAction, transaction, receipt;
337
+ return __generator(this, function (_b) {
338
+ switch (_b.label) {
339
+ case 0:
340
+ seaport = fixture.seaport, testErc20 = fixture.testErc20;
341
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
342
+ case 1:
343
+ executeAllActions = (_b.sent()).executeAllActions;
344
+ return [4 /*yield*/, executeAllActions()];
345
+ case 2:
346
+ order = _b.sent();
347
+ // Remove signature
348
+ order.signature = "0x";
349
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
350
+ case 3:
351
+ ownerToTokenToIdentifierBalances = _b.sent();
352
+ return [4 /*yield*/, seaport.fulfillOrder({
353
+ order: order,
354
+ accountAddress: fulfiller.address,
355
+ })];
356
+ case 4:
357
+ revertedUseCase = _b.sent();
358
+ actions = revertedUseCase.actions;
359
+ approvalAction = actions[0];
360
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
361
+ type: "approval",
362
+ token: testErc20.address,
363
+ identifierOrCriteria: "0",
364
+ itemType: constants_1.ItemType.ERC20,
365
+ transactionMethods: approvalAction.transactionMethods,
366
+ operator: seaport.contract.address,
367
+ });
368
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
369
+ case 5:
370
+ _b.sent();
371
+ _a = chai_1.expect;
372
+ return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
373
+ case 6:
374
+ _a.apply(void 0, [_b.sent()]).to.equal(constants_1.MAX_INT);
375
+ fulfillAction = actions[1];
376
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
377
+ type: "exchange",
378
+ transactionMethods: fulfillAction.transactionMethods,
379
+ });
380
+ return [4 /*yield*/, (0, chai_1.expect)(fulfillAction.transactionMethods.transact()).to.be.revertedWith("InvalidSigner")];
381
+ case 7:
382
+ _b.sent();
383
+ return [4 /*yield*/, seaport.validate([order], offerer.address).transact()];
384
+ case 8:
385
+ _b.sent();
386
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
387
+ case 9:
388
+ transaction = _b.sent();
389
+ return [4 /*yield*/, transaction.wait()];
390
+ case 10:
391
+ receipt = _b.sent();
392
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
393
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
394
+ order: order,
395
+ fulfillerAddress: fulfiller.address,
396
+ multicallProvider: multicallProvider,
397
+ fulfillReceipt: receipt,
398
+ })];
399
+ case 11:
400
+ _b.sent();
401
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
402
+ return [2 /*return*/];
403
+ }
404
+ });
405
+ }); });
406
+ });
407
+ return [2 /*return*/];
408
+ });
409
+ }); });
410
+ describe("[Accept offer] I want to accept an offer for my single ERC721", function () { return __awaiter(void 0, void 0, void 0, function () {
411
+ return __generator(this, function (_a) {
412
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
413
+ var testErc721, testErc20;
414
+ return __generator(this, function (_a) {
415
+ switch (_a.label) {
416
+ case 0:
417
+ testErc721 = fixture.testErc721, testErc20 = fixture.testErc20;
418
+ return [4 /*yield*/, testErc721.mint(fulfiller.address, nftId)];
419
+ case 1:
420
+ _a.sent();
421
+ return [4 /*yield*/, testErc20.mint(offerer.address, (0, utils_1.parseEther)("10").toString())];
422
+ case 2:
423
+ _a.sent();
424
+ standardCreateOrderInput = {
425
+ offer: [
426
+ {
427
+ amount: (0, utils_1.parseEther)("10").toString(),
428
+ token: testErc20.address,
429
+ },
430
+ ],
431
+ consideration: [
432
+ {
433
+ itemType: constants_1.ItemType.ERC721,
434
+ token: testErc721.address,
435
+ identifier: nftId,
436
+ recipient: offerer.address,
437
+ },
438
+ ],
439
+ // 2.5% fee
440
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
441
+ };
442
+ return [2 /*return*/];
443
+ }
444
+ });
445
+ }); });
446
+ it("ERC20 <=> ERC721", function () { return __awaiter(void 0, void 0, void 0, function () {
447
+ var seaport, testErc721, executeAllActions, order, ownerToTokenToIdentifierBalances, actions, approvalAction, _a, fulfillAction, transaction, receipt;
448
+ return __generator(this, function (_b) {
449
+ switch (_b.label) {
450
+ case 0:
451
+ seaport = fixture.seaport, testErc721 = fixture.testErc721;
452
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput, offerer.address)];
453
+ case 1:
454
+ executeAllActions = (_b.sent()).executeAllActions;
455
+ return [4 /*yield*/, executeAllActions()];
456
+ case 2:
457
+ order = _b.sent();
458
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
459
+ case 3:
460
+ ownerToTokenToIdentifierBalances = _b.sent();
461
+ return [4 /*yield*/, seaport.fulfillOrder({
462
+ order: order,
463
+ accountAddress: fulfiller.address,
464
+ })];
465
+ case 4:
466
+ actions = (_b.sent()).actions;
467
+ approvalAction = actions[0];
468
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
469
+ type: "approval",
470
+ token: testErc721.address,
471
+ identifierOrCriteria: nftId,
472
+ itemType: constants_1.ItemType.ERC721,
473
+ transactionMethods: approvalAction.transactionMethods,
474
+ operator: seaport.contract.address,
475
+ });
476
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
477
+ case 5:
478
+ _b.sent();
479
+ _a = chai_1.expect;
480
+ return [4 /*yield*/, testErc721.isApprovedForAll(fulfiller.address, seaport.contract.address)];
481
+ case 6:
482
+ _a.apply(void 0, [_b.sent()]).to.be.true;
483
+ fulfillAction = actions[1];
484
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
485
+ type: "exchange",
486
+ transactionMethods: fulfillAction.transactionMethods,
487
+ });
488
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
489
+ case 7:
490
+ transaction = _b.sent();
491
+ return [4 /*yield*/, transaction.wait()];
492
+ case 8:
493
+ receipt = _b.sent();
494
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
495
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
496
+ order: order,
497
+ fulfillerAddress: fulfiller.address,
498
+ multicallProvider: multicallProvider,
499
+ fulfillReceipt: receipt,
500
+ })];
501
+ case 9:
502
+ _b.sent();
503
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
504
+ return [2 /*return*/];
505
+ }
506
+ });
507
+ }); });
508
+ return [2 /*return*/];
509
+ });
510
+ }); });
511
+ return [2 /*return*/];
512
+ });
513
+ }); });
514
+ describe("A single ERC1155 is to be transferred", function () { return __awaiter(void 0, void 0, void 0, function () {
515
+ return __generator(this, function (_a) {
516
+ describe("[Buy now] I want to buy a single ERC1155", function () { return __awaiter(void 0, void 0, void 0, function () {
517
+ return __generator(this, function (_a) {
518
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
519
+ var testErc1155;
520
+ return __generator(this, function (_a) {
521
+ switch (_a.label) {
522
+ case 0:
523
+ testErc1155 = fixture.testErc1155;
524
+ return [4 /*yield*/, testErc1155.mint(offerer.address, nftId, erc1155Amount)];
525
+ case 1:
526
+ _a.sent();
527
+ standardCreateOrderInput = {
528
+ offer: [
529
+ {
530
+ itemType: constants_1.ItemType.ERC1155,
531
+ token: testErc1155.address,
532
+ identifier: nftId,
533
+ amount: erc1155Amount,
534
+ },
535
+ ],
536
+ consideration: [
537
+ {
538
+ amount: (0, utils_1.parseEther)("10").toString(),
539
+ recipient: offerer.address,
540
+ },
541
+ ],
542
+ // 2.5% fee
543
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
544
+ };
545
+ return [2 /*return*/];
546
+ }
547
+ });
548
+ }); });
549
+ describe("with ETH", function () {
550
+ it("ERC1155 <=> ETH", function () { return __awaiter(void 0, void 0, void 0, function () {
551
+ var seaport, executeAllActions, order, ownerToTokenToIdentifierBalances, actions, fulfillAction, transaction, receipt;
552
+ return __generator(this, function (_a) {
553
+ switch (_a.label) {
554
+ case 0:
555
+ seaport = fixture.seaport;
556
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput, offerer.address)];
557
+ case 1:
558
+ executeAllActions = (_a.sent()).executeAllActions;
559
+ return [4 /*yield*/, executeAllActions()];
560
+ case 2:
561
+ order = _a.sent();
562
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
563
+ case 3:
564
+ ownerToTokenToIdentifierBalances = _a.sent();
565
+ return [4 /*yield*/, seaport.fulfillOrder({
566
+ order: order,
567
+ accountAddress: fulfiller.address,
568
+ })];
569
+ case 4:
570
+ actions = (_a.sent()).actions;
571
+ fulfillAction = actions[0];
572
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
573
+ type: "exchange",
574
+ transactionMethods: fulfillAction.transactionMethods,
575
+ });
576
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
577
+ case 5:
578
+ transaction = _a.sent();
579
+ return [4 /*yield*/, transaction.wait()];
580
+ case 6:
581
+ receipt = _a.sent();
582
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
583
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
584
+ order: order,
585
+ fulfillerAddress: fulfiller.address,
586
+ multicallProvider: multicallProvider,
587
+ fulfillReceipt: receipt,
588
+ })];
589
+ case 7:
590
+ _a.sent();
591
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
592
+ return [2 /*return*/];
593
+ }
594
+ });
595
+ }); });
596
+ it("ERC1155 <=> ETH (already validated order)", function () { return __awaiter(void 0, void 0, void 0, function () {
597
+ var seaport, executeAllActions, order, actions, fulfillAction, ownerToTokenToIdentifierBalances, transaction, receipt;
598
+ return __generator(this, function (_a) {
599
+ switch (_a.label) {
600
+ case 0:
601
+ seaport = fixture.seaport;
602
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
603
+ case 1:
604
+ executeAllActions = (_a.sent()).executeAllActions;
605
+ return [4 /*yield*/, executeAllActions()];
606
+ case 2:
607
+ order = _a.sent();
608
+ // Remove signature
609
+ order.signature = "0x";
610
+ return [4 /*yield*/, seaport.fulfillOrder({
611
+ order: order,
612
+ accountAddress: fulfiller.address,
613
+ })];
614
+ case 3:
615
+ actions = (_a.sent()).actions;
616
+ fulfillAction = actions[0];
617
+ // Should revert because signature is empty
618
+ return [4 /*yield*/, (0, chai_1.expect)(fulfillAction.transactionMethods.transact()).to.be.revertedWith("InvalidSigner")];
619
+ case 4:
620
+ // Should revert because signature is empty
621
+ _a.sent();
622
+ return [4 /*yield*/, seaport.validate([order], offerer.address).transact()];
623
+ case 5:
624
+ _a.sent();
625
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
626
+ case 6:
627
+ ownerToTokenToIdentifierBalances = _a.sent();
628
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
629
+ type: "exchange",
630
+ transactionMethods: fulfillAction.transactionMethods,
631
+ });
632
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
633
+ case 7:
634
+ transaction = _a.sent();
635
+ return [4 /*yield*/, transaction.wait()];
636
+ case 8:
637
+ receipt = _a.sent();
638
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
639
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
640
+ order: order,
641
+ fulfillerAddress: fulfiller.address,
642
+ multicallProvider: multicallProvider,
643
+ fulfillReceipt: receipt,
644
+ })];
645
+ case 9:
646
+ _a.sent();
647
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
648
+ return [2 /*return*/];
649
+ }
650
+ });
651
+ }); });
652
+ });
653
+ describe("with ERC20", function () {
654
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
655
+ var testErc20;
656
+ return __generator(this, function (_a) {
657
+ testErc20 = fixture.testErc20;
658
+ // Use ERC20 instead of eth
659
+ standardCreateOrderInput = __assign(__assign({}, standardCreateOrderInput), { consideration: standardCreateOrderInput.consideration.map(function (item) { return (__assign(__assign({}, item), { token: testErc20.address })); }) });
660
+ testErc20.mint(fulfiller.address, ethers_1.BigNumber.from(standardCreateOrderInput.consideration[0]
661
+ .amount));
662
+ return [2 /*return*/];
663
+ });
664
+ }); });
665
+ it("ERC1155 <=> ERC20", function () { return __awaiter(void 0, void 0, void 0, function () {
666
+ var seaport, testErc20, executeAllActions, order, ownerToTokenToIdentifierBalances, actions, approvalAction, _a, fulfillAction, transaction, receipt;
667
+ return __generator(this, function (_b) {
668
+ switch (_b.label) {
669
+ case 0:
670
+ seaport = fixture.seaport, testErc20 = fixture.testErc20;
671
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
672
+ case 1:
673
+ executeAllActions = (_b.sent()).executeAllActions;
674
+ return [4 /*yield*/, executeAllActions()];
675
+ case 2:
676
+ order = _b.sent();
677
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
678
+ case 3:
679
+ ownerToTokenToIdentifierBalances = _b.sent();
680
+ return [4 /*yield*/, seaport.fulfillOrder({
681
+ order: order,
682
+ accountAddress: fulfiller.address,
683
+ })];
684
+ case 4:
685
+ actions = (_b.sent()).actions;
686
+ approvalAction = actions[0];
687
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
688
+ type: "approval",
689
+ token: testErc20.address,
690
+ identifierOrCriteria: "0",
691
+ itemType: constants_1.ItemType.ERC20,
692
+ transactionMethods: approvalAction.transactionMethods,
693
+ operator: seaport.contract.address,
694
+ });
695
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
696
+ case 5:
697
+ _b.sent();
698
+ _a = chai_1.expect;
699
+ return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
700
+ case 6:
701
+ _a.apply(void 0, [_b.sent()]).to.equal(constants_1.MAX_INT);
702
+ fulfillAction = actions[1];
703
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
704
+ type: "exchange",
705
+ transactionMethods: fulfillAction.transactionMethods,
706
+ });
707
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
708
+ case 7:
709
+ transaction = _b.sent();
710
+ return [4 /*yield*/, transaction.wait()];
711
+ case 8:
712
+ receipt = _b.sent();
713
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
714
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
715
+ order: order,
716
+ fulfillerAddress: fulfiller.address,
717
+ multicallProvider: multicallProvider,
718
+ fulfillReceipt: receipt,
719
+ })];
720
+ case 9:
721
+ _b.sent();
722
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
723
+ return [2 /*return*/];
724
+ }
725
+ });
726
+ }); });
727
+ it("ERC1155 <=> ERC20 (already validated order)", function () { return __awaiter(void 0, void 0, void 0, function () {
728
+ var seaport, testErc20, executeAllActions, order, ownerToTokenToIdentifierBalances, actions, approvalAction, _a, fulfillAction, transaction, receipt;
729
+ return __generator(this, function (_b) {
730
+ switch (_b.label) {
731
+ case 0:
732
+ seaport = fixture.seaport, testErc20 = fixture.testErc20;
733
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput)];
734
+ case 1:
735
+ executeAllActions = (_b.sent()).executeAllActions;
736
+ return [4 /*yield*/, executeAllActions()];
737
+ case 2:
738
+ order = _b.sent();
739
+ // Remove signature
740
+ order.signature = "0x";
741
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
742
+ case 3:
743
+ ownerToTokenToIdentifierBalances = _b.sent();
744
+ return [4 /*yield*/, seaport.fulfillOrder({
745
+ order: order,
746
+ accountAddress: fulfiller.address,
747
+ })];
748
+ case 4:
749
+ actions = (_b.sent()).actions;
750
+ approvalAction = actions[0];
751
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
752
+ type: "approval",
753
+ token: testErc20.address,
754
+ identifierOrCriteria: "0",
755
+ itemType: constants_1.ItemType.ERC20,
756
+ transactionMethods: approvalAction.transactionMethods,
757
+ operator: seaport.contract.address,
758
+ });
759
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
760
+ case 5:
761
+ _b.sent();
762
+ _a = chai_1.expect;
763
+ return [4 /*yield*/, testErc20.allowance(fulfiller.address, seaport.contract.address)];
764
+ case 6:
765
+ _a.apply(void 0, [_b.sent()]).to.equal(constants_1.MAX_INT);
766
+ fulfillAction = actions[1];
767
+ return [4 /*yield*/, (0, chai_1.expect)(fulfillAction.transactionMethods.transact()).to.be.revertedWith("InvalidSigner")];
768
+ case 7:
769
+ _b.sent();
770
+ return [4 /*yield*/, seaport.validate([order], offerer.address).transact()];
771
+ case 8:
772
+ _b.sent();
773
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
774
+ type: "exchange",
775
+ transactionMethods: fulfillAction.transactionMethods,
776
+ });
777
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
778
+ case 9:
779
+ transaction = _b.sent();
780
+ return [4 /*yield*/, transaction.wait()];
781
+ case 10:
782
+ receipt = _b.sent();
783
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
784
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
785
+ order: order,
786
+ fulfillerAddress: fulfiller.address,
787
+ multicallProvider: multicallProvider,
788
+ fulfillReceipt: receipt,
789
+ })];
790
+ case 11:
791
+ _b.sent();
792
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
793
+ return [2 /*return*/];
794
+ }
795
+ });
796
+ }); });
797
+ });
798
+ return [2 /*return*/];
799
+ });
800
+ }); });
801
+ describe("[Accept offer] I want to accept an offer for my single ERC1155", function () { return __awaiter(void 0, void 0, void 0, function () {
802
+ return __generator(this, function (_a) {
803
+ beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
804
+ var testErc1155, seaportContract, testErc20;
805
+ return __generator(this, function (_a) {
806
+ switch (_a.label) {
807
+ case 0:
808
+ testErc1155 = fixture.testErc1155, seaportContract = fixture.seaportContract, testErc20 = fixture.testErc20;
809
+ return [4 /*yield*/, testErc1155.mint(fulfiller.address, nftId, erc1155Amount)];
810
+ case 1:
811
+ _a.sent();
812
+ return [4 /*yield*/, testErc20.mint(offerer.address, (0, utils_1.parseEther)("10").toString())];
813
+ case 2:
814
+ _a.sent();
815
+ // Approving offerer amount for convenience
816
+ return [4 /*yield*/, testErc20
817
+ .connect(offerer)
818
+ .approve(seaportContract.address, constants_1.MAX_INT)];
819
+ case 3:
820
+ // Approving offerer amount for convenience
821
+ _a.sent();
822
+ standardCreateOrderInput = {
823
+ offer: [
824
+ {
825
+ amount: (0, utils_1.parseEther)("10").toString(),
826
+ token: testErc20.address,
827
+ },
828
+ ],
829
+ consideration: [
830
+ {
831
+ itemType: constants_1.ItemType.ERC1155,
832
+ token: testErc1155.address,
833
+ identifier: nftId,
834
+ recipient: offerer.address,
835
+ amount: erc1155Amount,
836
+ },
837
+ ],
838
+ // 2.5% fee
839
+ fees: [{ recipient: zone.address, basisPoints: 250 }],
840
+ };
841
+ return [2 /*return*/];
842
+ }
843
+ });
844
+ }); });
845
+ it("ERC20 <=> ERC1155", function () { return __awaiter(void 0, void 0, void 0, function () {
846
+ var seaport, testErc1155, executeAllActions, order, ownerToTokenToIdentifierBalances, actions, approvalAction, _a, fulfillAction, transaction, receipt;
847
+ return __generator(this, function (_b) {
848
+ switch (_b.label) {
849
+ case 0:
850
+ seaport = fixture.seaport, testErc1155 = fixture.testErc1155;
851
+ return [4 /*yield*/, seaport.createOrder(standardCreateOrderInput, offerer.address)];
852
+ case 1:
853
+ executeAllActions = (_b.sent()).executeAllActions;
854
+ return [4 /*yield*/, executeAllActions()];
855
+ case 2:
856
+ order = _b.sent();
857
+ return [4 /*yield*/, (0, balance_1.getBalancesForFulfillOrder)(order, fulfiller.address, multicallProvider)];
858
+ case 3:
859
+ ownerToTokenToIdentifierBalances = _b.sent();
860
+ return [4 /*yield*/, seaport.fulfillOrder({
861
+ order: order,
862
+ accountAddress: fulfiller.address,
863
+ })];
864
+ case 4:
865
+ actions = (_b.sent()).actions;
866
+ approvalAction = actions[0];
867
+ (0, chai_1.expect)(approvalAction).to.deep.equal({
868
+ type: "approval",
869
+ token: testErc1155.address,
870
+ identifierOrCriteria: nftId,
871
+ itemType: constants_1.ItemType.ERC1155,
872
+ transactionMethods: approvalAction.transactionMethods,
873
+ operator: seaport.contract.address,
874
+ });
875
+ return [4 /*yield*/, approvalAction.transactionMethods.transact()];
876
+ case 5:
877
+ _b.sent();
878
+ _a = chai_1.expect;
879
+ return [4 /*yield*/, testErc1155.isApprovedForAll(fulfiller.address, seaport.contract.address)];
880
+ case 6:
881
+ _a.apply(void 0, [_b.sent()]).to.be.true;
882
+ fulfillAction = actions[1];
883
+ (0, chai_1.expect)(fulfillAction).to.be.deep.equal({
884
+ type: "exchange",
885
+ transactionMethods: fulfillAction.transactionMethods,
886
+ });
887
+ return [4 /*yield*/, fulfillAction.transactionMethods.transact()];
888
+ case 7:
889
+ transaction = _b.sent();
890
+ return [4 /*yield*/, transaction.wait()];
891
+ case 8:
892
+ receipt = _b.sent();
893
+ return [4 /*yield*/, (0, balance_1.verifyBalancesAfterFulfill)({
894
+ ownerToTokenToIdentifierBalances: ownerToTokenToIdentifierBalances,
895
+ order: order,
896
+ fulfillerAddress: fulfiller.address,
897
+ multicallProvider: multicallProvider,
898
+ fulfillReceipt: receipt,
899
+ })];
900
+ case 9:
901
+ _b.sent();
902
+ (0, chai_1.expect)(fulfillBasicOrderSpy).calledOnce;
903
+ return [2 /*return*/];
904
+ }
905
+ });
906
+ }); });
907
+ return [2 /*return*/];
908
+ });
909
+ }); });
910
+ return [2 /*return*/];
911
+ });
912
+ }); });
913
+ });
914
+ //# sourceMappingURL=basic-fulfill.spec.js.map