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