@hypercerts-org/marketplace-sdk 0.3.17 → 0.3.18

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, BatchTransferItem, ChainId, ContractMethods, CreateMakerAskOutput, CreateMakerBidOutput, CreateMakerCollectionOfferInput, CreateMakerCollectionOfferWithProofInput, CreateMakerInput, Currencies, Maker, MerkleTree, OrderValidatorCode, SignMerkleTreeOrdersOutput, StrategyInfo, StrategyType, Taker } from "./types";
3
3
  import { ApiClient } from "./utils/api";
4
+ import { Database } from "./utils/hypercerts-database-types";
4
5
  /**
5
6
  * HypercertExchange
6
7
  * This class provides helpers to interact with the HypercertExchange V2 contracts
@@ -218,12 +219,11 @@ export declare class HypercertExchangeClient {
218
219
  verifyMakerOrders(makerOrders: Maker[], signatures: string[], merkleTrees?: MerkleTree[], overrides?: Overrides): Promise<OrderValidatorCode[][]>;
219
220
  /**
220
221
  * Utility function to check if a list of orders are valid, according to logic specific for hypercerts using order validation codes.
221
- * @param makers List of maker orders
222
- * @param signatures List of signatures
223
- * @param merkleTrees List of merkle trees (optional)
222
+ * @param orders List of orders to be checked
224
223
  * @param overrides Call overrides (optional)
225
224
  */
226
- checkOrdersValidity(makers: Maker[], signatures: string[], merkleTrees?: MerkleTree[], overrides?: Overrides): Promise<{
225
+ checkOrdersValidity(orders: Database["public"]["Tables"]["marketplace_orders"]["Row"][], overrides?: Overrides): Promise<{
226
+ id: string;
227
227
  valid: boolean;
228
228
  validatorCodes: OrderValidatorCode[];
229
229
  }[]>;
package/dist/index.cjs.js CHANGED
@@ -7948,16 +7948,26 @@ class HypercertExchangeClient {
7948
7948
  }
7949
7949
  /**
7950
7950
  * Utility function to check if a list of orders are valid, according to logic specific for hypercerts using order validation codes.
7951
- * @param makers List of maker orders
7952
- * @param signatures List of signatures
7953
- * @param merkleTrees List of merkle trees (optional)
7951
+ * @param orders List of orders to be checked
7954
7952
  * @param overrides Call overrides (optional)
7955
7953
  */
7956
- async checkOrdersValidity(makers, signatures, merkleTrees, overrides) {
7957
- const result = await this.verifyMakerOrders(makers, signatures, merkleTrees, overrides);
7958
- return result.map((res) => {
7954
+ async checkOrdersValidity(orders, overrides) {
7955
+ // Prepare matching orders for validation
7956
+ const signatures = [];
7957
+ const makers = [];
7958
+ for (const order of orders) {
7959
+ const { signature, chainId, id: __, ...orderWithoutSignature } = order;
7960
+ if (chainId !== this.chainId) {
7961
+ throw new Error("Chain ID mismatch when checking order validity");
7962
+ }
7963
+ signatures.push(signature);
7964
+ makers.push(orderWithoutSignature);
7965
+ }
7966
+ const result = await this.verifyMakerOrders(makers, signatures, undefined, overrides);
7967
+ return result.map((res, index) => {
7968
+ const order = orders[index];
7959
7969
  const valid = res.every((code) => ACCEPTED_ERROR_CODES.includes(code));
7960
- return { valid, validatorCodes: res };
7970
+ return { id: order.id, valid, validatorCodes: res };
7961
7971
  });
7962
7972
  }
7963
7973
  /**
package/dist/index.esm.js CHANGED
@@ -7946,16 +7946,26 @@ class HypercertExchangeClient {
7946
7946
  }
7947
7947
  /**
7948
7948
  * Utility function to check if a list of orders are valid, according to logic specific for hypercerts using order validation codes.
7949
- * @param makers List of maker orders
7950
- * @param signatures List of signatures
7951
- * @param merkleTrees List of merkle trees (optional)
7949
+ * @param orders List of orders to be checked
7952
7950
  * @param overrides Call overrides (optional)
7953
7951
  */
7954
- async checkOrdersValidity(makers, signatures, merkleTrees, overrides) {
7955
- const result = await this.verifyMakerOrders(makers, signatures, merkleTrees, overrides);
7956
- return result.map((res) => {
7952
+ async checkOrdersValidity(orders, overrides) {
7953
+ // Prepare matching orders for validation
7954
+ const signatures = [];
7955
+ const makers = [];
7956
+ for (const order of orders) {
7957
+ const { signature, chainId, id: __, ...orderWithoutSignature } = order;
7958
+ if (chainId !== this.chainId) {
7959
+ throw new Error("Chain ID mismatch when checking order validity");
7960
+ }
7961
+ signatures.push(signature);
7962
+ makers.push(orderWithoutSignature);
7963
+ }
7964
+ const result = await this.verifyMakerOrders(makers, signatures, undefined, overrides);
7965
+ return result.map((res, index) => {
7966
+ const order = orders[index];
7957
7967
  const valid = res.every((code) => ACCEPTED_ERROR_CODES.includes(code));
7958
- return { valid, validatorCodes: res };
7968
+ return { id: order.id, valid, validatorCodes: res };
7959
7969
  });
7960
7970
  }
7961
7971
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypercerts-org/marketplace-sdk",
3
- "version": "0.3.17",
3
+ "version": "0.3.18",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",