@hypercerts-org/marketplace-sdk 0.4.2 → 0.5.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.
@@ -1,6 +1,7 @@
1
1
  import { BigNumberish, ContractTransactionResponse, Overrides, Provider, Signer, TypedDataDomain } from "ethers";
2
2
  import { Addresses, ChainId, ContractMethods, CreateDirectFractionsSaleMakerAskInput, CreateFractionalSaleMakerAskInput, CreateMakerAskOutput, CreateMakerBidOutput, CreateMakerInput, Currencies, Maker, MerkleTree, Order, OrderValidatorCode, SignMerkleTreeOrdersOutput, StrategyInfo, StrategyType, Taker } from "./types";
3
3
  import { ApiClient } from "./utils/api";
4
+ import { WalletClient } from "viem";
4
5
  /**
5
6
  * HypercertExchange
6
7
  * This class provides helpers to interact with the HypercertExchange V2 contracts
@@ -24,18 +25,23 @@ export declare class HypercertExchangeClient {
24
25
  * @see {@link https://docs.ethers.org/v6/api/providers/#Provider Ethers provider doc}
25
26
  */
26
27
  readonly provider: Provider;
28
+ /**
29
+ * Wallet client
30
+ */
31
+ readonly walletClient?: WalletClient;
27
32
  /**
28
33
  * HypercertExchange protocol main class
29
34
  * @param chainId Chain id for contract interactions
30
35
  * @param provider Ethers provider
31
36
  * @param signer Ethers signer
32
37
  * @param overrides Override contract addresses or API endpoint used
38
+ * @param walletClient Wallet client, necessary for Safe transactions
33
39
  */
34
40
  constructor(chainId: ChainId, provider: Provider, signer?: Signer, overrides?: {
35
41
  addresses: Addresses;
36
42
  currencies: Currencies;
37
43
  apiEndpoint?: string;
38
- });
44
+ }, walletClient?: WalletClient);
39
45
  /**
40
46
  * Return the signer if it's set, throw an exception otherwise
41
47
  * @returns Signer
@@ -94,6 +100,15 @@ export declare class HypercertExchangeClient {
94
100
  * @returns ContractMethods
95
101
  */
96
102
  executeOrder(maker: Maker, taker: Taker, signature: string, merkleTree?: MerkleTree, overrides?: Overrides): ContractMethods;
103
+ /**
104
+ * Execute a trade using Safe
105
+ * @param maker Maker order
106
+ * @param taker Taker order
107
+ * @param signature Signature of the maker order
108
+ * @param merkleTree Optional merkle tree
109
+ * @returns Safe transaction hash
110
+ */
111
+ executeOrderSafe(safeAddress: string, maker: Maker, taker: Taker, signature: string, overrides?: Overrides): Promise<string>;
97
112
  /**
98
113
  * Execute several orders
99
114
  * @param orders List of orders data
@@ -107,9 +122,9 @@ export declare class HypercertExchangeClient {
107
122
  signature: string;
108
123
  merkleTree?: MerkleTree;
109
124
  }[], isAtomic: boolean, overrides?: Overrides): {
110
- call: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => any;
111
- estimateGas: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => any;
112
- callStatic: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => any;
125
+ call: (additionalOverrides?: import("./typechain/common").PayableOverrides) => any;
126
+ estimateGas: (additionalOverrides?: import("./typechain/common").PayableOverrides) => any;
127
+ callStatic: (additionalOverrides?: import("./typechain/common").PayableOverrides) => any;
113
128
  };
114
129
  /**
115
130
  * Cancell all maker bid and/or ask orders for the current user
@@ -140,12 +155,27 @@ export declare class HypercertExchangeClient {
140
155
  * @returns ContractTransaction
141
156
  */
142
157
  approveErc20(tokenAddress: string, amount?: bigint, overrides?: Overrides): Promise<ContractTransactionResponse>;
158
+ /**
159
+ * Approve an ERC20 to be used as a currency on the Hypercert Exchange using Safe
160
+ * @param tokenAddress Address of the ERC20 to approve
161
+ * @param amount Amount to be approved (default to MaxUint256)
162
+ * @param safeAddress Address of the Safe to use
163
+ * @returns Safe transaction hash
164
+ */
165
+ approveErc20Safe(safeAddress: string, tokenAddress: string, amount?: bigint, overrides?: Overrides): Promise<string>;
143
166
  /**
144
167
  * Check whether or not an operator has been approved by the user
145
168
  * @param operator Operator address (default to the exchange address)
146
169
  * @returns true if the operator is approved, false otherwise
147
170
  */
148
171
  isTransferManagerApproved(operator?: string, overrides?: Overrides): Promise<boolean>;
172
+ /**
173
+ * Check whether or not an operator has been approved by the Safe
174
+ * @param safeAddress Address of the Safe to check
175
+ * @param operator Operator address (default to the exchange address)
176
+ * @returns true if the operator is approved, false otherwise
177
+ */
178
+ isTransferManagerApprovedSafe(safeAddress: string, operator?: string, overrides?: Overrides): Promise<boolean>;
149
179
  /**
150
180
  * Grant a list of operators the rights to transfer user's assets using the transfer manager
151
181
  * @param operators List of operators (default to the exchange address)
@@ -153,6 +183,13 @@ export declare class HypercertExchangeClient {
153
183
  * @returns ContractMethods
154
184
  */
155
185
  grantTransferManagerApproval(operators?: string[], overrides?: Overrides): ContractMethods;
186
+ /**
187
+ * Grant a list of operators the rights to transfer user's assets using the transfer manager using Safe
188
+ * @param operators List of operators
189
+ * @param safeAddress Address of the Safe to use
190
+ * @returns Safe transaction hash
191
+ */
192
+ grantTransferManagerApprovalSafe(safeAddress: string, operators?: string[], overrides?: Overrides): Promise<string>;
156
193
  /**
157
194
  * Revoke a list of operators the rights to transfer user's assets using the transfer manager
158
195
  * @param operators List of operators
@@ -219,4 +256,11 @@ export declare class HypercertExchangeClient {
219
256
  * @param orderId Order ID
220
257
  */
221
258
  deleteOrder(orderId: string): Promise<boolean>;
259
+ /**
260
+ * Bundle approval operations into a single Safe transaction
261
+ * @param safeAddress The address of the Safe contract
262
+ * @param collectionAddress Address of the collection to approve
263
+ * @returns Transaction hash
264
+ */
265
+ bundleApprovalsForSafe(safeAddress: string, walletClient: WalletClient, collectionAddress: string): Promise<string>;
222
266
  }
@@ -394,19 +394,6 @@
394
394
  "stateMutability": "view",
395
395
  "type": "function"
396
396
  },
397
- {
398
- "inputs": [],
399
- "name": "royaltyFeeRegistry",
400
- "outputs": [
401
- {
402
- "internalType": "contract IRoyaltyFeeRegistry",
403
- "name": "",
404
- "type": "address"
405
- }
406
- ],
407
- "stateMutability": "view",
408
- "type": "function"
409
- },
410
397
  {
411
398
  "inputs": [],
412
399
  "name": "transferManager",
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Name of the LooksRare contract. Used for EIP712 domain separator.
2
+ * EIP712 domain name.
3
3
  * @see {@link https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator EIP712 doc}
4
4
  */
5
- export declare const contractName = "LooksRareProtocol";
5
+ export declare const DOMAIN_NAME = "LooksRareProtocol";
6
6
  /**
7
- * Protocol version. Used for EIP712 domain separator.
7
+ * EIP712 domain version.
8
8
  * @see {@link https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator EIP712 doc}
9
9
  */
10
- export declare const version = 2;
10
+ export declare const DOMAIN_VERSION = 2;