@hypercerts-org/marketplace-sdk 0.0.22 → 0.0.24

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.
package/dist/index.cjs.js CHANGED
@@ -654,7 +654,7 @@ var transferManager = /*#__PURE__*/Object.freeze({
654
654
  });
655
655
 
656
656
  const verifyMakerOrders = async (signerOrProvider, address, makerOrders, signatures, merkleTrees, overrides) => {
657
- const contract = new ethers.Contract(address, contracts.OrderValidatorV2A).connect(signerOrProvider);
657
+ const contract = new ethers.Contract(address, contracts.OrderValidatorV2AAbi).connect(signerOrProvider);
658
658
  const orders = await contract.checkMultipleMakerOrderValidities(makerOrders, signatures, merkleTrees, {
659
659
  ...overrides,
660
660
  });
@@ -4866,10 +4866,34 @@ const fetchOrdersByHypercertId = async ({ hypercertId, chainId }) => {
4866
4866
  const tokenIds = fractions.claimTokens.map((fraction) => fraction.tokenID);
4867
4867
  return supabaseHypercerts.from("marketplace-orders").select("*").containedBy("itemIds", tokenIds).throwOnError();
4868
4868
  };
4869
+ /**
4870
+ * Fetch existing open orders from the marketplace API
4871
+ * @param signer address of the user that created the order
4872
+ * @param claimTokenIds a list of claimTokenIds - will return any order that is for one or more of these claimTokenIds
4873
+ * @param chainId chain id for the order
4874
+ * @param strategy strategy for the order
4875
+ */
4876
+ const fetchOrders = async ({ signer, claimTokenIds, chainId, strategy }) => {
4877
+ let baseQuery = supabaseHypercerts.from("marketplace-orders").select("*");
4878
+ if (signer) {
4879
+ baseQuery.eq("signer", signer);
4880
+ }
4881
+ if (claimTokenIds) {
4882
+ baseQuery = baseQuery.overlaps("itemIds", claimTokenIds);
4883
+ }
4884
+ if (chainId) {
4885
+ baseQuery.eq("chainId", chainId);
4886
+ }
4887
+ if (strategy) {
4888
+ baseQuery.eq("strategyId", strategy);
4889
+ }
4890
+ return baseQuery.throwOnError();
4891
+ };
4869
4892
 
4870
4893
  var api = /*#__PURE__*/Object.freeze({
4871
4894
  __proto__: null,
4872
4895
  fetchOrderNonce: fetchOrderNonce,
4896
+ fetchOrders: fetchOrders,
4873
4897
  fetchOrdersByHypercertId: fetchOrdersByHypercertId,
4874
4898
  registerOrder: registerOrder,
4875
4899
  supabaseHypercerts: supabaseHypercerts
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Contract, ZeroAddress, AbiCoder, TypedDataEncoder, keccak256, solidityPackedKeccak256, ethers, ZeroHash, MaxUint256 } from 'ethers';
2
- import { HypercertExchangeAbi, TransferManagerAbi, OrderValidatorV2A as OrderValidatorV2A$1 } from '@hypercerts-org/contracts';
2
+ import { HypercertExchangeAbi, TransferManagerAbi, OrderValidatorV2AAbi } from '@hypercerts-org/contracts';
3
3
  import { MerkleTree } from 'merkletreejs';
4
4
  import { deployments, HypercertClient } from '@hypercerts-org/sdk';
5
5
  import { keccak256 as keccak256$1 } from 'js-sha3';
@@ -652,7 +652,7 @@ var transferManager = /*#__PURE__*/Object.freeze({
652
652
  });
653
653
 
654
654
  const verifyMakerOrders = async (signerOrProvider, address, makerOrders, signatures, merkleTrees, overrides) => {
655
- const contract = new Contract(address, OrderValidatorV2A$1).connect(signerOrProvider);
655
+ const contract = new Contract(address, OrderValidatorV2AAbi).connect(signerOrProvider);
656
656
  const orders = await contract.checkMultipleMakerOrderValidities(makerOrders, signatures, merkleTrees, {
657
657
  ...overrides,
658
658
  });
@@ -4864,10 +4864,34 @@ const fetchOrdersByHypercertId = async ({ hypercertId, chainId }) => {
4864
4864
  const tokenIds = fractions.claimTokens.map((fraction) => fraction.tokenID);
4865
4865
  return supabaseHypercerts.from("marketplace-orders").select("*").containedBy("itemIds", tokenIds).throwOnError();
4866
4866
  };
4867
+ /**
4868
+ * Fetch existing open orders from the marketplace API
4869
+ * @param signer address of the user that created the order
4870
+ * @param claimTokenIds a list of claimTokenIds - will return any order that is for one or more of these claimTokenIds
4871
+ * @param chainId chain id for the order
4872
+ * @param strategy strategy for the order
4873
+ */
4874
+ const fetchOrders = async ({ signer, claimTokenIds, chainId, strategy }) => {
4875
+ let baseQuery = supabaseHypercerts.from("marketplace-orders").select("*");
4876
+ if (signer) {
4877
+ baseQuery.eq("signer", signer);
4878
+ }
4879
+ if (claimTokenIds) {
4880
+ baseQuery = baseQuery.overlaps("itemIds", claimTokenIds);
4881
+ }
4882
+ if (chainId) {
4883
+ baseQuery.eq("chainId", chainId);
4884
+ }
4885
+ if (strategy) {
4886
+ baseQuery.eq("strategyId", strategy);
4887
+ }
4888
+ return baseQuery.throwOnError();
4889
+ };
4867
4890
 
4868
4891
  var api = /*#__PURE__*/Object.freeze({
4869
4892
  __proto__: null,
4870
4893
  fetchOrderNonce: fetchOrderNonce,
4894
+ fetchOrders: fetchOrders,
4871
4895
  fetchOrdersByHypercertId: fetchOrdersByHypercertId,
4872
4896
  registerOrder: registerOrder,
4873
4897
  supabaseHypercerts: supabaseHypercerts
@@ -1,4 +1,4 @@
1
- import { Maker, QuoteType } from "../types";
1
+ import { Maker, QuoteType, StrategyType } from "../types";
2
2
  import { Database as HypercertsDatabase } from "./hypercerts-database-types";
3
3
  export declare const supabaseHypercerts: import("@supabase/supabase-js").SupabaseClient<HypercertsDatabase, "public", {
4
4
  Tables: {
@@ -74,6 +74,11 @@ export declare const supabaseHypercerts: import("@supabase/supabase-js").Supabas
74
74
  created_at?: string | null | undefined;
75
75
  fractionCounter?: number | null | undefined;
76
76
  hidden?: boolean | undefined;
77
+ /**
78
+ * Fetches orders from api by hypercert ID
79
+ * @param hypercertId Hypercert ID
80
+ * @param chainId Chain ID
81
+ */
77
82
  id?: number | undefined;
78
83
  };
79
84
  Update: {
@@ -100,7 +105,13 @@ export declare const supabaseHypercerts: import("@supabase/supabase-js").Supabas
100
105
  claimId?: string | null | undefined;
101
106
  created_at?: string | null | undefined;
102
107
  fractionCounter?: number | null | undefined;
103
- hidden?: boolean | undefined;
108
+ hidden?: boolean | undefined; /**
109
+ * Fetch existing open orders from the marketplace API
110
+ * @param signer address of the user that created the order
111
+ * @param claimTokenIds a list of claimTokenIds - will return any order that is for one or more of these claimTokenIds
112
+ * @param chainId chain id for the order
113
+ * @param strategy strategy for the order
114
+ */
104
115
  id?: number | undefined;
105
116
  };
106
117
  Update: {
@@ -783,3 +794,38 @@ export declare const fetchOrdersByHypercertId: ({ hypercertId, chainId }: {
783
794
  strategyId: number;
784
795
  subsetNonce: number;
785
796
  }[]>>;
797
+ interface FetchOrderArgs {
798
+ signer: `0x${string}`;
799
+ claimTokenIds: string[];
800
+ chainId: number;
801
+ strategy: StrategyType;
802
+ }
803
+ /**
804
+ * Fetch existing open orders from the marketplace API
805
+ * @param signer address of the user that created the order
806
+ * @param claimTokenIds a list of claimTokenIds - will return any order that is for one or more of these claimTokenIds
807
+ * @param chainId chain id for the order
808
+ * @param strategy strategy for the order
809
+ */
810
+ export declare const fetchOrders: ({ signer, claimTokenIds, chainId, strategy }: Partial<FetchOrderArgs>) => Promise<import("@supabase/supabase-js").PostgrestSingleResponse<{
811
+ additionalParameters: string;
812
+ amounts: number[];
813
+ chainId: number;
814
+ collection: string;
815
+ collectionType: number;
816
+ createdAt: string;
817
+ currency: string;
818
+ endTime: number;
819
+ globalNonce: string;
820
+ id: string;
821
+ itemIds: string[];
822
+ orderNonce: string;
823
+ price: string;
824
+ quoteType: number;
825
+ signature: string;
826
+ signer: string;
827
+ startTime: number;
828
+ strategyId: number;
829
+ subsetNonce: number;
830
+ }[]>>;
831
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypercerts-org/marketplace-sdk",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -91,7 +91,7 @@
91
91
  "typescript": "^5.3.3"
92
92
  },
93
93
  "dependencies": {
94
- "@hypercerts-org/sdk": "1.4.2-alpha.2",
94
+ "@hypercerts-org/sdk": "1.4.3",
95
95
  "@supabase/supabase-js": "^2.39.2",
96
96
  "ethers": "^6.6.2",
97
97
  "merkletreejs": "^0.3.9"