@hypercerts-org/marketplace-sdk 0.0.1

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 (172) hide show
  1. package/LICENSE +4 -0
  2. package/LICENSE-APACHE +10 -0
  3. package/LICENSE-MIT +21 -0
  4. package/README.md +101 -0
  5. package/dist/LooksRare.d.ts +223 -0
  6. package/dist/abis/IERC1155.json +276 -0
  7. package/dist/abis/IERC20.json +185 -0
  8. package/dist/abis/IERC721.json +268 -0
  9. package/dist/abis/ILooksRareProtocol.json +677 -0
  10. package/dist/abis/ITransferManager.json +91 -0
  11. package/dist/abis/IWETH.json +46 -0
  12. package/dist/abis/LooksRareProtocol.json +1924 -0
  13. package/dist/abis/OrderValidatorV2A.json +410 -0
  14. package/dist/abis/ProtocolHelpers.json +366 -0
  15. package/dist/abis/TransferManager.json +492 -0
  16. package/dist/abis/WETH.json +361 -0
  17. package/dist/abis/index.d.ts +7 -0
  18. package/dist/abis/index.ts +7 -0
  19. package/dist/constants/addresses.d.ts +7 -0
  20. package/dist/constants/chains.d.ts +4 -0
  21. package/dist/constants/eip712.d.ts +10 -0
  22. package/dist/constants/index.d.ts +14 -0
  23. package/dist/errors.d.ts +30 -0
  24. package/dist/index.cjs.js +5251 -0
  25. package/dist/index.d.ts +45 -0
  26. package/dist/index.esm.js +5229 -0
  27. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/AffiliateManager.d.ts +210 -0
  28. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/BatchOrderTypehashRegistry.d.ts +35 -0
  29. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/CreatorFeeManagerWithRoyalties.d.ts +47 -0
  30. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/CurrencyManager.d.ts +247 -0
  31. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/ExecutionManager.d.ts +616 -0
  32. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/LooksRareProtocol.d.ts +1005 -0
  33. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/NonceManager.d.ts +148 -0
  34. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/StrategyManager.d.ts +401 -0
  35. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/TransferManager.d.ts +324 -0
  36. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/TransferSelectorNFT.d.ts +620 -0
  37. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/executionStrategies/BaseStrategy.d.ts +97 -0
  38. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/executionStrategies/StrategyCollectionOffer.d.ts +176 -0
  39. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/executionStrategies/index.d.ts +2 -0
  40. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/helpers/OrderValidatorV2A.d.ts +172 -0
  41. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/helpers/ProtocolHelpers.d.ts +148 -0
  42. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/helpers/index.d.ts +2 -0
  43. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/index.d.ts +16 -0
  44. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/IAffiliateManager.d.ts +65 -0
  45. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/ICreatorFeeManager.d.ts +47 -0
  46. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/ICurrencyManager.d.ts +37 -0
  47. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/IExecutionManager.d.ts +64 -0
  48. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/ILooksRareProtocol.d.ts +343 -0
  49. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/INonceManager.d.ts +72 -0
  50. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/IRoyaltyFeeRegistry.d.ts +41 -0
  51. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/IStrategy.d.ts +97 -0
  52. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/IStrategyManager.d.ts +85 -0
  53. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/ITransferManager.d.ts +80 -0
  54. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/interfaces/index.d.ts +10 -0
  55. package/dist/typechain/@looksrare/contracts-exchange-v2/index.d.ts +4 -0
  56. package/dist/typechain/@looksrare/contracts-exchange-v2/test/index.d.ts +2 -0
  57. package/dist/typechain/@looksrare/contracts-exchange-v2/test/mock/MockRoyaltyFeeRegistry.d.ts +222 -0
  58. package/dist/typechain/@looksrare/contracts-exchange-v2/test/mock/index.d.ts +1 -0
  59. package/dist/typechain/@looksrare/contracts-libs/contracts/OwnableTwoSteps.d.ts +121 -0
  60. package/dist/typechain/@looksrare/contracts-libs/contracts/PackableReentrancyGuard.d.ts +20 -0
  61. package/dist/typechain/@looksrare/contracts-libs/contracts/index.d.ts +4 -0
  62. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/IOwnableTwoSteps.d.ts +80 -0
  63. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/IReentrancyGuard.d.ts +20 -0
  64. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/generic/IERC1155.d.ts +224 -0
  65. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/generic/IERC1271.d.ts +35 -0
  66. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/generic/IERC165.d.ts +29 -0
  67. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/generic/IERC20.d.ts +129 -0
  68. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/generic/IERC2981.d.ts +49 -0
  69. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/generic/IERC721.d.ts +191 -0
  70. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/generic/IWETH.d.ts +43 -0
  71. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/generic/index.d.ts +7 -0
  72. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/index.d.ts +4 -0
  73. package/dist/typechain/@looksrare/contracts-libs/index.d.ts +2 -0
  74. package/dist/typechain/@looksrare/index.d.ts +4 -0
  75. package/dist/typechain/common.d.ts +50 -0
  76. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/AffiliateManager__factory.d.ts +264 -0
  77. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/BatchOrderTypehashRegistry__factory.d.ts +48 -0
  78. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/CreatorFeeManagerWithRoyalties__factory.d.ts +74 -0
  79. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/CurrencyManager__factory.d.ts +307 -0
  80. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/ExecutionManager__factory.d.ts +748 -0
  81. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/LooksRareProtocol__factory.d.ts +1527 -0
  82. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/NonceManager__factory.d.ts +174 -0
  83. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/StrategyManager__factory.d.ts +478 -0
  84. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/TransferManager__factory.d.ts +406 -0
  85. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/TransferSelectorNFT__factory.d.ts +766 -0
  86. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/executionStrategies/BaseStrategy__factory.d.ts +100 -0
  87. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/executionStrategies/StrategyCollectionOffer__factory.d.ts +323 -0
  88. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/executionStrategies/index.d.ts +2 -0
  89. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/helpers/OrderValidatorV2A__factory.d.ts +338 -0
  90. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/helpers/ProtocolHelpers__factory.d.ts +302 -0
  91. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/helpers/index.d.ts +2 -0
  92. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/index.d.ts +13 -0
  93. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/IAffiliateManager__factory.d.ts +50 -0
  94. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/ICreatorFeeManager__factory.d.ts +51 -0
  95. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/ICurrencyManager__factory.d.ts +22 -0
  96. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/IExecutionManager__factory.d.ts +61 -0
  97. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/ILooksRareProtocol__factory.d.ts +540 -0
  98. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/INonceManager__factory.d.ts +57 -0
  99. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/IRoyaltyFeeRegistry__factory.d.ts +29 -0
  100. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/IStrategyManager__factory.d.ts +88 -0
  101. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/IStrategy__factory.d.ts +100 -0
  102. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/ITransferManager__factory.d.ts +77 -0
  103. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/interfaces/index.d.ts +10 -0
  104. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/index.d.ts +2 -0
  105. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/test/index.d.ts +1 -0
  106. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/test/mock/MockRoyaltyFeeRegistry__factory.d.ts +278 -0
  107. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/test/mock/index.d.ts +1 -0
  108. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/OwnableTwoSteps__factory.d.ts +130 -0
  109. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/PackableReentrancyGuard__factory.d.ts +11 -0
  110. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/index.d.ts +3 -0
  111. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/IOwnableTwoSteps__factory.d.ts +66 -0
  112. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/IReentrancyGuard__factory.d.ts +11 -0
  113. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/generic/IERC1155__factory.d.ts +222 -0
  114. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/generic/IERC1271__factory.d.ts +25 -0
  115. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/generic/IERC165__factory.d.ts +21 -0
  116. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/generic/IERC20__factory.d.ts +147 -0
  117. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/generic/IERC2981__factory.d.ts +43 -0
  118. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/generic/IERC721__factory.d.ts +213 -0
  119. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/generic/IWETH__factory.d.ts +41 -0
  120. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/generic/index.d.ts +7 -0
  121. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/index.d.ts +3 -0
  122. package/dist/typechain/factories/@looksrare/contracts-libs/index.d.ts +1 -0
  123. package/dist/typechain/factories/@looksrare/index.d.ts +2 -0
  124. package/dist/typechain/factories/index.d.ts +3 -0
  125. package/dist/typechain/factories/solmate/index.d.ts +1 -0
  126. package/dist/typechain/factories/solmate/src/index.d.ts +1 -0
  127. package/dist/typechain/factories/solmate/src/tokens/ERC1155.sol/ERC1155TokenReceiver__factory.d.ts +67 -0
  128. package/dist/typechain/factories/solmate/src/tokens/ERC1155.sol/ERC1155__factory.d.ts +250 -0
  129. package/dist/typechain/factories/solmate/src/tokens/ERC1155.sol/index.d.ts +2 -0
  130. package/dist/typechain/factories/solmate/src/tokens/ERC20__factory.d.ts +235 -0
  131. package/dist/typechain/factories/solmate/src/tokens/ERC721.sol/ERC721TokenReceiver__factory.d.ts +33 -0
  132. package/dist/typechain/factories/solmate/src/tokens/ERC721.sol/ERC721__factory.d.ts +261 -0
  133. package/dist/typechain/factories/solmate/src/tokens/ERC721.sol/index.d.ts +2 -0
  134. package/dist/typechain/factories/solmate/src/tokens/WETH__factory.d.ts +299 -0
  135. package/dist/typechain/factories/solmate/src/tokens/index.d.ts +4 -0
  136. package/dist/typechain/factories/src/contracts/index.d.ts +1 -0
  137. package/dist/typechain/factories/src/contracts/tests/MockERC1155__factory.d.ts +283 -0
  138. package/dist/typechain/factories/src/contracts/tests/MockERC721__factory.d.ts +308 -0
  139. package/dist/typechain/factories/src/contracts/tests/Verifier__factory.d.ts +462 -0
  140. package/dist/typechain/factories/src/contracts/tests/index.d.ts +3 -0
  141. package/dist/typechain/factories/src/index.d.ts +1 -0
  142. package/dist/typechain/index.d.ts +97 -0
  143. package/dist/typechain/solmate/index.d.ts +2 -0
  144. package/dist/typechain/solmate/src/index.d.ts +2 -0
  145. package/dist/typechain/solmate/src/tokens/ERC1155.sol/ERC1155.d.ts +236 -0
  146. package/dist/typechain/solmate/src/tokens/ERC1155.sol/ERC1155TokenReceiver.d.ts +67 -0
  147. package/dist/typechain/solmate/src/tokens/ERC1155.sol/index.d.ts +2 -0
  148. package/dist/typechain/solmate/src/tokens/ERC20.d.ts +181 -0
  149. package/dist/typechain/solmate/src/tokens/ERC721.sol/ERC721.d.ts +211 -0
  150. package/dist/typechain/solmate/src/tokens/ERC721.sol/ERC721TokenReceiver.d.ts +39 -0
  151. package/dist/typechain/solmate/src/tokens/ERC721.sol/index.d.ts +2 -0
  152. package/dist/typechain/solmate/src/tokens/WETH.d.ts +219 -0
  153. package/dist/typechain/solmate/src/tokens/index.d.ts +6 -0
  154. package/dist/typechain/src/contracts/index.d.ts +2 -0
  155. package/dist/typechain/src/contracts/tests/MockERC1155.d.ts +252 -0
  156. package/dist/typechain/src/contracts/tests/MockERC721.d.ts +219 -0
  157. package/dist/typechain/src/contracts/tests/Verifier.d.ts +174 -0
  158. package/dist/typechain/src/contracts/tests/index.d.ts +3 -0
  159. package/dist/typechain/src/index.d.ts +2 -0
  160. package/dist/types.d.ts +242 -0
  161. package/dist/utils/Eip712MakerMerkleTree.d.ts +10 -0
  162. package/dist/utils/Eip712MerkleTree.d.ts +40 -0
  163. package/dist/utils/calls/exchange.d.ts +10 -0
  164. package/dist/utils/calls/nonces.d.ts +9 -0
  165. package/dist/utils/calls/orderValidator.d.ts +3 -0
  166. package/dist/utils/calls/strategies.d.ts +3 -0
  167. package/dist/utils/calls/tokens.d.ts +6 -0
  168. package/dist/utils/calls/transferManager.d.ts +6 -0
  169. package/dist/utils/eip712.d.ts +12 -0
  170. package/dist/utils/encodeOrderParams.d.ts +22 -0
  171. package/dist/utils/signMakerOrders.d.ts +18 -0
  172. package/package.json +94 -0
package/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ This project is dual licensed under MIT and Apache-2.0.
2
+
3
+ MIT: https://www.opensource.org/licenses/mit
4
+ Apache-2.0: https://www.apache.org/licenses/license-2.0
package/LICENSE-APACHE ADDED
@@ -0,0 +1,10 @@
1
+ Copyright 2023 Hypercerts Foundation
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
4
+ License. You may obtain a copy of the License at
5
+
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
9
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
10
+ language governing permissions and limitations under the License.
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Hypercerts Foundation
4
+
5
+ Copyright (c) 2022 LooksRare for portions of marketplace: https://github.com/LooksRare/contracts-exchange-v2 commit:
6
+ 7fca565
7
+
8
+ Copyright (c) 2022 Paul Razvan Berg for inital template: https://github.com/paulrberg/foundry-template
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
11
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
12
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
13
+ persons to whom the Software is furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
16
+ Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
19
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # @looksrare/sdk-v2
2
+
3
+ ![GitHub package.json version](https://img.shields.io/github/package-json/v/LooksRare/sdk-v2) ![GitHub](https://img.shields.io/github/license/LooksRare/sdk-v2) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/LooksRare/sdk-v2/build.yml) ![npm](https://img.shields.io/npm/dt/@looksrare/sdk-v2)
4
+
5
+ A collection of typescript tools to interact with LooksRare protocol V2 smart contracts 👀💎
6
+
7
+ ## Install
8
+
9
+ This package has a peer dependency on [etherjs V5](https://docs.ethers.io/v5/).
10
+
11
+ ```bash
12
+ yarn add @looksrare/sdk-v2 ethers
13
+ ```
14
+
15
+ ```bash
16
+ npm install @looksrare/sdk-v2 ethers --save
17
+ ```
18
+
19
+ ## Getting Started
20
+
21
+ The SDK expose a main class used to perform all the onchain operations:
22
+
23
+ ```ts
24
+ import { ChainId } from "@looksrare/sdk-v2";
25
+ const looksrare = new LooksRare(ChainId.MAINNET, provider, signer);
26
+ ```
27
+
28
+ The signer is optional if you need access to read only data (:warning: Calls to function that need a signer will throw a `Signer is undefined` exception):
29
+
30
+ ```ts
31
+ import { ChainId } from "@looksrare/sdk-v2";
32
+ const looksrare = new LooksRare(ChainId.MAINNET, provider);
33
+ ```
34
+
35
+ If you work on a hardhat setup, you can override the addresses as follow:
36
+
37
+ ```ts
38
+ import { Addresses } from "@looksrare/sdk-v2";
39
+ const addresses: Addresses = {...};
40
+ const looksrare = new LooksRare(ChainId.HARDHAT, provider, signer, addresses);
41
+ ```
42
+
43
+ :information_source: Use [`JsonRpcProvider`](https://docs.ethers.org/v6/api/providers/jsonrpc/#JsonRpcApiProviderOptions) from `ethers v6` if you want to make batched RPC calls.
44
+
45
+ ```ts
46
+ import { JsonRpcProvider, Network } from "ethers";
47
+
48
+ // Create a HTTP/HTTPS batch call provider
49
+ const provider = new JsonRpcProvider(RPC_URL, CHAIN_ID, { staticNetwork: Network.from(CHAIN_ID) });
50
+
51
+ // Create LooksRare instance using this provider
52
+ const looksrare = new LooksRare(ChainId.HARDHAT, provider, signer, addresses);
53
+ ```
54
+
55
+ Prior to [`@looksrare/sdk-v2@0.9.2`](https://www.npmjs.com/package/@looksrare/sdk-v2/v/0.9.2?activeTab=readme), LooksRareSDK was making batched calls using `0xsequence/multicall`. But this is not natively supported since `@looksrare/sdk-v2@1.0.0`.
56
+
57
+ ## Documentation
58
+
59
+ Read the [guides](./guides) if you need help with the implementation.
60
+
61
+ You can also read the detailed [api documentation](./doc).
62
+
63
+ ## FAQ
64
+
65
+ ### ❓ How to use ABIs
66
+
67
+ The SDK exposes most of the LooksRare contract [ABIs](https://github.com/LooksRare/sdk-v2/tree/master/src/abis). For convenience, some commonly used ABIs are also exported.
68
+
69
+ ```js
70
+ import LooksRareProtocolABI from "@looksrare/sdk-v2/dist/abis/LooksRareProtocol.json";
71
+ ```
72
+
73
+ ### ❓ How to retrieve order nonce ?
74
+
75
+ Call the public api endpoint [/orders/nonce](https://looksrare.dev/reference/getordernonce), and use this nonce directly.
76
+
77
+ ### ❓ What to do when the order is created and signed ?
78
+
79
+ Use the public api endpoint [/orders](https://looksrare.dev/reference/createorder) to push the order to the database. After that, the order will be visible by everyone using the API (looksrare.org, aggregators, etc..).
80
+
81
+ ### ❓ When should I use merkle tree orders ?
82
+
83
+ Merkle tree orders are used to create several orders with a single signature. You shouldn't use them when using a bot. Their main purpose is to facilitate orders creation using a user interface.
84
+
85
+ ### ❓ Why do I need to call grantTransferManagerApproval ?
86
+
87
+ When you approve a collection to be traded on LooksRare, you approve the TransferManager instead of the exchange. Calling `grantTransferManagerApproval` gives the exchange contract the right to call the transfer function on the TransferManager. You need to call this function only once, the first time you use the V2.
88
+
89
+ ### ❓ What are subset nonces and how to use them ?
90
+
91
+ tl;dr subset nonces allow you to cancel all the orders sharing the same subset nonce.
92
+ Subset nonces allow you to group some orders together according to arbitrary rules (for example all your orders for a specific collection, all your orders above a certain threshold, etc). You can then cancel them all with a single call to `cancelSubsetOrders`.
93
+ :information_source: Unlike order nonces, executing an order with a specific subset nonce doesn't invalidate other orders sharing the same subset nonce.
94
+
95
+ ## Resources
96
+
97
+ 🔗 [Developer documentation](https://docs.looksrare.org/developers/welcome)
98
+
99
+ 🔗 [Public API documentation](https://looksrare.dev/reference/important-information)
100
+
101
+ 🔗 [Developer discord](https://discord.gg/jJA4qM5dXz)
@@ -0,0 +1,223 @@
1
+ import { BigNumberish, ContractTransactionResponse, Overrides, TypedDataDomain, Provider, Signer } from "ethers";
2
+ import { Addresses, Maker, Taker, ChainId, CreateMakerInput, CreateMakerAskOutput, CreateMakerBidOutput, CreateMakerCollectionOfferInput, CreateMakerCollectionOfferWithProofInput, MerkleTree, ContractMethods, OrderValidatorCode, BatchTransferItem, SignMerkleTreeOrdersOutput, StrategyType, StrategyInfo } from "./types";
3
+ /**
4
+ * LooksRare
5
+ * This class provides helpers to interact with the LooksRare V2 contracts
6
+ */
7
+ export declare class LooksRare {
8
+ /** Current app chain ID */
9
+ readonly chainId: ChainId;
10
+ /** Mapping of LooksRare protocol addresses for the current chain */
11
+ readonly addresses: Addresses;
12
+ /**
13
+ * Ethers signer
14
+ * @see {@link https://docs.ethers.org/v6/api/providers/#Signer Ethers signer doc}
15
+ */
16
+ readonly signer?: Signer;
17
+ /**
18
+ * Ethers provider. If you want a batch functionality, use JsonRpcProvider.
19
+ * @see {@link https://docs.ethers.org/v6/api/providers/#Provider Ethers provider doc}
20
+ */
21
+ readonly provider: Provider;
22
+ /**
23
+ * LooksRare protocol main class
24
+ * @param chainId Current app chain id
25
+ * @param provider Ethers provider
26
+ * @param signer Ethers signer
27
+ * @param override Overrides contract addresses for hardhat setup
28
+ */
29
+ constructor(chainId: ChainId, provider: Provider, signer?: Signer, override?: Addresses);
30
+ /**
31
+ * Return the signer it it's set, throw an exception otherwise
32
+ * @returns Signer
33
+ */
34
+ private getSigner;
35
+ /**
36
+ * Validate a timestamp format (seconds)
37
+ * @param timestamp
38
+ * @returns boolean
39
+ */
40
+ private isTimestampValid;
41
+ /**
42
+ * Retrieve EIP-712 domain
43
+ * @returns TypedDataDomain
44
+ */
45
+ getTypedDataDomain(): TypedDataDomain;
46
+ /**
47
+ * Create a maker ask object ready to be signed
48
+ * @param CreateMakerInput
49
+ * @returns the maker object, isTransferManagerApproved, and isTransferManagerApproved
50
+ */
51
+ createMakerAsk({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts, currency, startTime, additionalParameters, }: CreateMakerInput): Promise<CreateMakerAskOutput>;
52
+ /**
53
+ * Create a maker bid object ready to be signed
54
+ * @param CreateMakerInput
55
+ * @returns the maker object, isCurrencyApproved, and isBalanceSufficient
56
+ */
57
+ createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts, currency, startTime, additionalParameters, }: CreateMakerInput): Promise<CreateMakerBidOutput>;
58
+ /**
59
+ * Create a maker bid for collection offer.
60
+ * @see this.createMakerBid
61
+ * @param orderInputs Order data
62
+ * @returns CreateMakerBidOutput
63
+ */
64
+ createMakerCollectionOffer(orderInputs: CreateMakerCollectionOfferInput): Promise<CreateMakerBidOutput>;
65
+ /**
66
+ * Create a maker bid for collection, with a list of item id that can be used for the taker order
67
+ * @see this.createMakerBid
68
+ * @param orderInputs Order data
69
+ * @returns CreateMakerBidOutput
70
+ */
71
+ createMakerCollectionOfferWithProof(orderInputs: CreateMakerCollectionOfferWithProofInput): Promise<CreateMakerBidOutput>;
72
+ /**
73
+ * Create a taker ask ready to be executed against a maker bid
74
+ * @param maker Maker order that will be used as counterparty for the taker
75
+ * @param recipient Recipient address of the taker (if none, it will use the sender)
76
+ * @param additionalParameters Additional parameters used to support complex orders
77
+ * @returns Taker object
78
+ */
79
+ createTaker(maker: Maker, recipient?: string, additionalParameters?: any[]): Taker;
80
+ /**
81
+ * Create a taker ask order for collection order.
82
+ * @see this.createTaker
83
+ * @see this.createMakerCollectionOffer
84
+ * @param makerBid Maker bid that will be used as counterparty for the taker
85
+ * @param itemId Token id to use as a counterparty for the collection order
86
+ * @param recipient Recipient address of the taker (if none, it will use the sender)
87
+ * @returns Taker object
88
+ */
89
+ createTakerCollectionOffer(maker: Maker, itemId: BigNumberish, recipient?: string): Taker;
90
+ /**
91
+ * Create a taker ask to fulfill a collection order (maker bid) created with a whitelist of item ids
92
+ * @see this.createTaker
93
+ * @see this.createMakerCollectionOfferWithMerkleTree
94
+ * @param makerBid Maker bid that will be used as counterparty for the taker
95
+ * @param itemId Token id to use as a counterparty for the collection order
96
+ * @param itemIds List of token ids used during the maker creation
97
+ * @param recipient Recipient address of the taker (if none, it will use the sender)
98
+ * @returns Taker object
99
+ */
100
+ createTakerCollectionOfferWithProof(maker: Maker, itemId: BigNumberish, itemIds: BigNumberish[], recipient?: string): Taker;
101
+ /**
102
+ * Sign a maker order using the signer provided in the constructor
103
+ * @param maker Order to be signed by the user
104
+ * @returns Signature
105
+ */
106
+ signMakerOrder(maker: Maker): Promise<string>;
107
+ /**
108
+ * Sign multiple maker orders with a single signature
109
+ * /!\ Use this function for UI implementation only
110
+ * @param makerOrders Array of maker orders
111
+ * @returns Signature, proofs, and Merkletree object
112
+ */
113
+ signMultipleMakerOrders(makerOrders: Maker[]): Promise<SignMerkleTreeOrdersOutput>;
114
+ /**
115
+ * Execute a trade
116
+ * @param makerBid Maker order
117
+ * @param taker Taker order
118
+ * @param signature Signature of the maker order
119
+ * @param merkleTree If the maker has been signed with a merkle tree
120
+ * @param affiliate Affiliate address if applicable
121
+ * @returns ContractMethods
122
+ */
123
+ executeOrder(maker: Maker, taker: Taker, signature: string, merkleTree?: MerkleTree, affiliate?: string, overrides?: Overrides): ContractMethods;
124
+ /**
125
+ * Execute several orders
126
+ * @param orders List of orders data
127
+ * @param isAtomic Should the transaction revert or not if a trade fails
128
+ * @param affiliate Affiliate address
129
+ * @param overrides Call overrides
130
+ * @returns ContractMethods
131
+ */
132
+ executeMultipleOrders(orders: {
133
+ maker: Maker;
134
+ taker: Taker;
135
+ signature: string;
136
+ merkleTree?: MerkleTree;
137
+ }[], isAtomic: boolean, affiliate?: string, overrides?: Overrides): {
138
+ /**
139
+ * Validate a timestamp format (seconds)
140
+ * @param timestamp
141
+ * @returns boolean
142
+ */
143
+ call: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => Promise<ContractTransactionResponse>;
144
+ estimateGas: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => Promise<bigint>;
145
+ callStatic: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => Promise<void>;
146
+ };
147
+ /**
148
+ * Cancell all maker bid and/or ask orders for the current user
149
+ * @param bid Cancel all bids
150
+ * @param ask Cancel all asks
151
+ * @returns ContractMethods
152
+ */
153
+ cancelAllOrders(bid: boolean, ask: boolean, overrides?: Overrides): ContractMethods;
154
+ /**
155
+ * Cancel a list of specific orders
156
+ * @param nonces List of nonces to be cancelled
157
+ * @returns ContractMethods
158
+ */
159
+ cancelOrders(nonces: BigNumberish[], overrides?: Overrides): ContractMethods;
160
+ /**
161
+ * Cancel a list of specific subset orders
162
+ * @param nonces List of nonces to be cancelled
163
+ * @returns ContractMethods
164
+ */
165
+ cancelSubsetOrders(nonces: BigNumberish[], overrides?: Overrides): ContractMethods;
166
+ /**
167
+ * Approve all the items of a collection, to eventually be traded on LooksRare
168
+ * The spender is the TransferManager.
169
+ * @param collectionAddress Address of the collection to be approved.
170
+ * @param approved true to approve, false to revoke the approval (default to true)
171
+ * @returns ContractTransaction
172
+ */
173
+ approveAllCollectionItems(collectionAddress: string, approved?: boolean, overrides?: Overrides): Promise<ContractTransactionResponse>;
174
+ /**
175
+ * Approve an ERC20 to be used as a currency on LooksRare.
176
+ * The spender is the LooksRareProtocol contract.
177
+ * @param tokenAddress Address of the ERC20 to approve
178
+ * @param amount Amount to be approved (default to MaxUint256)
179
+ * @returns ContractTransaction
180
+ */
181
+ approveErc20(tokenAddress: string, amount?: bigint, overrides?: Overrides): Promise<ContractTransactionResponse>;
182
+ /**
183
+ * Check whether or not an operator has been approved by the user
184
+ * @param operator Operator address (default to the exchange address)
185
+ * @returns true if the operator is approved, false otherwise
186
+ */
187
+ isTransferManagerApproved(operator?: string, overrides?: Overrides): Promise<boolean>;
188
+ /**
189
+ * Grant a list of operators the rights to transfer user's assets using the transfer manager
190
+ * @param operators List of operators (default to the exchange address)
191
+ * @defaultValue Exchange address
192
+ * @returns ContractMethods
193
+ */
194
+ grantTransferManagerApproval(operators?: string[], overrides?: Overrides): ContractMethods;
195
+ /**
196
+ * Revoke a list of operators the rights to transfer user's assets using the transfer manager
197
+ * @param operators List of operators
198
+ * @defaultValue Exchange address
199
+ * @returns ContractMethods
200
+ */
201
+ revokeTransferManagerApproval(operators?: string[], overrides?: Overrides): ContractMethods;
202
+ /**
203
+ * Transfer a list of items across different collections
204
+ * @param to Recipient address
205
+ * @param collectionItems Each object in the array represent a list of items for a specific collection
206
+ * @returns ContractMethods
207
+ */
208
+ transferItemsAcrossCollection(to: string, collectionItems: BatchTransferItem[], overrides?: Overrides): Promise<ContractMethods>;
209
+ /**
210
+ * Verify if a set of orders can be executed (i.e are valid)
211
+ * @param makerOrders List of maker orders
212
+ * @param signatures List of signatures
213
+ * @param merkleTrees List of merkle trees (optional)
214
+ * @returns A list of OrderValidatorCode for each order (code 0 being valid)
215
+ */
216
+ verifyMakerOrders(makerOrders: Maker[], signatures: string[], merkleTrees?: MerkleTree[], overrides?: Overrides): Promise<OrderValidatorCode[][]>;
217
+ /**
218
+ * Retrieve strategy info
219
+ * @param strategyId use the enum StrategyType
220
+ * @returns StrategyInfo
221
+ */
222
+ strategyInfo(strategyId: StrategyType, overrides?: Overrides): Promise<StrategyInfo>;
223
+ }
@@ -0,0 +1,276 @@
1
+ [
2
+ {
3
+ "anonymous": false,
4
+ "inputs": [
5
+ {
6
+ "indexed": true,
7
+ "internalType": "address",
8
+ "name": "account",
9
+ "type": "address"
10
+ },
11
+ {
12
+ "indexed": true,
13
+ "internalType": "address",
14
+ "name": "operator",
15
+ "type": "address"
16
+ },
17
+ {
18
+ "indexed": false,
19
+ "internalType": "bool",
20
+ "name": "approved",
21
+ "type": "bool"
22
+ }
23
+ ],
24
+ "name": "ApprovalForAll",
25
+ "type": "event"
26
+ },
27
+ {
28
+ "anonymous": false,
29
+ "inputs": [
30
+ {
31
+ "indexed": true,
32
+ "internalType": "address",
33
+ "name": "operator",
34
+ "type": "address"
35
+ },
36
+ {
37
+ "indexed": true,
38
+ "internalType": "address",
39
+ "name": "from",
40
+ "type": "address"
41
+ },
42
+ {
43
+ "indexed": true,
44
+ "internalType": "address",
45
+ "name": "to",
46
+ "type": "address"
47
+ },
48
+ {
49
+ "indexed": false,
50
+ "internalType": "uint256[]",
51
+ "name": "ids",
52
+ "type": "uint256[]"
53
+ },
54
+ {
55
+ "indexed": false,
56
+ "internalType": "uint256[]",
57
+ "name": "values",
58
+ "type": "uint256[]"
59
+ }
60
+ ],
61
+ "name": "TransferBatch",
62
+ "type": "event"
63
+ },
64
+ {
65
+ "anonymous": false,
66
+ "inputs": [
67
+ {
68
+ "indexed": true,
69
+ "internalType": "address",
70
+ "name": "operator",
71
+ "type": "address"
72
+ },
73
+ {
74
+ "indexed": true,
75
+ "internalType": "address",
76
+ "name": "from",
77
+ "type": "address"
78
+ },
79
+ {
80
+ "indexed": true,
81
+ "internalType": "address",
82
+ "name": "to",
83
+ "type": "address"
84
+ },
85
+ {
86
+ "indexed": false,
87
+ "internalType": "uint256",
88
+ "name": "id",
89
+ "type": "uint256"
90
+ },
91
+ {
92
+ "indexed": false,
93
+ "internalType": "uint256",
94
+ "name": "value",
95
+ "type": "uint256"
96
+ }
97
+ ],
98
+ "name": "TransferSingle",
99
+ "type": "event"
100
+ },
101
+ {
102
+ "anonymous": false,
103
+ "inputs": [
104
+ {
105
+ "indexed": false,
106
+ "internalType": "string",
107
+ "name": "value",
108
+ "type": "string"
109
+ },
110
+ {
111
+ "indexed": true,
112
+ "internalType": "uint256",
113
+ "name": "id",
114
+ "type": "uint256"
115
+ }
116
+ ],
117
+ "name": "URI",
118
+ "type": "event"
119
+ },
120
+ {
121
+ "inputs": [
122
+ {
123
+ "internalType": "address",
124
+ "name": "account",
125
+ "type": "address"
126
+ },
127
+ {
128
+ "internalType": "uint256",
129
+ "name": "id",
130
+ "type": "uint256"
131
+ }
132
+ ],
133
+ "name": "balanceOf",
134
+ "outputs": [
135
+ {
136
+ "internalType": "uint256",
137
+ "name": "",
138
+ "type": "uint256"
139
+ }
140
+ ],
141
+ "stateMutability": "view",
142
+ "type": "function"
143
+ },
144
+ {
145
+ "inputs": [
146
+ {
147
+ "internalType": "address[]",
148
+ "name": "accounts",
149
+ "type": "address[]"
150
+ },
151
+ {
152
+ "internalType": "uint256[]",
153
+ "name": "ids",
154
+ "type": "uint256[]"
155
+ }
156
+ ],
157
+ "name": "balanceOfBatch",
158
+ "outputs": [
159
+ {
160
+ "internalType": "uint256[]",
161
+ "name": "",
162
+ "type": "uint256[]"
163
+ }
164
+ ],
165
+ "stateMutability": "view",
166
+ "type": "function"
167
+ },
168
+ {
169
+ "inputs": [
170
+ {
171
+ "internalType": "address",
172
+ "name": "account",
173
+ "type": "address"
174
+ },
175
+ {
176
+ "internalType": "address",
177
+ "name": "operator",
178
+ "type": "address"
179
+ }
180
+ ],
181
+ "name": "isApprovedForAll",
182
+ "outputs": [
183
+ {
184
+ "internalType": "bool",
185
+ "name": "",
186
+ "type": "bool"
187
+ }
188
+ ],
189
+ "stateMutability": "view",
190
+ "type": "function"
191
+ },
192
+ {
193
+ "inputs": [
194
+ {
195
+ "internalType": "address",
196
+ "name": "from",
197
+ "type": "address"
198
+ },
199
+ {
200
+ "internalType": "address",
201
+ "name": "to",
202
+ "type": "address"
203
+ },
204
+ {
205
+ "internalType": "uint256[]",
206
+ "name": "ids",
207
+ "type": "uint256[]"
208
+ },
209
+ {
210
+ "internalType": "uint256[]",
211
+ "name": "amounts",
212
+ "type": "uint256[]"
213
+ },
214
+ {
215
+ "internalType": "bytes",
216
+ "name": "data",
217
+ "type": "bytes"
218
+ }
219
+ ],
220
+ "name": "safeBatchTransferFrom",
221
+ "outputs": [],
222
+ "stateMutability": "nonpayable",
223
+ "type": "function"
224
+ },
225
+ {
226
+ "inputs": [
227
+ {
228
+ "internalType": "address",
229
+ "name": "from",
230
+ "type": "address"
231
+ },
232
+ {
233
+ "internalType": "address",
234
+ "name": "to",
235
+ "type": "address"
236
+ },
237
+ {
238
+ "internalType": "uint256",
239
+ "name": "id",
240
+ "type": "uint256"
241
+ },
242
+ {
243
+ "internalType": "uint256",
244
+ "name": "amount",
245
+ "type": "uint256"
246
+ },
247
+ {
248
+ "internalType": "bytes",
249
+ "name": "data",
250
+ "type": "bytes"
251
+ }
252
+ ],
253
+ "name": "safeTransferFrom",
254
+ "outputs": [],
255
+ "stateMutability": "nonpayable",
256
+ "type": "function"
257
+ },
258
+ {
259
+ "inputs": [
260
+ {
261
+ "internalType": "address",
262
+ "name": "operator",
263
+ "type": "address"
264
+ },
265
+ {
266
+ "internalType": "bool",
267
+ "name": "approved",
268
+ "type": "bool"
269
+ }
270
+ ],
271
+ "name": "setApprovalForAll",
272
+ "outputs": [],
273
+ "stateMutability": "nonpayable",
274
+ "type": "function"
275
+ }
276
+ ]