@opensea/seaport-js 1.0.7 → 1.0.9

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