@hypercerts-org/marketplace-sdk 0.3.21 → 0.3.23

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
@@ -5702,6 +5702,76 @@ const getFractionsById = async (fractionId, client) => {
5702
5702
  }
5703
5703
  return data?.fractions.data;
5704
5704
  };
5705
+ const ordersQuery = e$1(`
5706
+ query OrdersQuery($chainId: BigInt, $signer: String) {
5707
+ orders(where: { chainId: { eq: $chainId }, signer: { eq: $signer } }) {
5708
+ count
5709
+ data {
5710
+ id
5711
+ hypercert {
5712
+ hypercert_id
5713
+ creator_address
5714
+ contracts_id
5715
+ creation_block_number
5716
+ creation_block_timestamp
5717
+ id
5718
+ last_update_block_number
5719
+ last_update_block_timestamp
5720
+ metadata {
5721
+ allow_list_uri
5722
+ contributors
5723
+ description
5724
+ external_url
5725
+ id
5726
+ impact_scope
5727
+ impact_timeframe_from
5728
+ impact_timeframe_to
5729
+ name
5730
+ properties
5731
+ rights
5732
+ uri
5733
+ work_scope
5734
+ work_timeframe_from
5735
+ work_timeframe_to
5736
+ }
5737
+ token_id
5738
+ units
5739
+ uri
5740
+ }
5741
+ additionalParameters
5742
+ amounts
5743
+ chainId
5744
+ collection
5745
+ collectionType
5746
+ createdAt
5747
+ currency
5748
+ endTime
5749
+ globalNonce
5750
+ itemIds
5751
+ orderNonce
5752
+ price
5753
+ quoteType
5754
+ signature
5755
+ signer
5756
+ startTime
5757
+ strategyId
5758
+ subsetNonce
5759
+ }
5760
+ }
5761
+ }
5762
+ `);
5763
+ const getOrders = async ({ chainId, signer }, client) => {
5764
+ const { data, error } = await client
5765
+ .query(ordersQuery, {
5766
+ chainId,
5767
+ signer,
5768
+ })
5769
+ .toPromise();
5770
+ if (error) {
5771
+ throw new Error(error.message);
5772
+ }
5773
+ return data?.orders.data;
5774
+ };
5705
5775
 
5706
5776
  var teardownPlaceholder = () => {};
5707
5777
 
@@ -7502,7 +7572,7 @@ class ApiClient {
7502
7572
  if (strategy) {
7503
7573
  baseQuery.eq("strategyId", strategy);
7504
7574
  }
7505
- return baseQuery.throwOnError();
7575
+ return await getOrders({ signer, chainId: chainId ? BigInt(chainId) : undefined }, this._urqlClient);
7506
7576
  };
7507
7577
  /**
7508
7578
  * Fetches orders from api by hypercert ID
@@ -7956,12 +8026,29 @@ class HypercertExchangeClient {
7956
8026
  const signatures = [];
7957
8027
  const makers = [];
7958
8028
  for (const order of orders) {
7959
- const { signature, chainId, id: __, ...orderWithoutSignature } = order;
8029
+ const { signature, chainId } = order;
7960
8030
  if (chainId !== this.chainId) {
7961
8031
  throw new Error("Chain ID mismatch when checking order validity");
7962
8032
  }
7963
8033
  signatures.push(signature);
7964
- makers.push(orderWithoutSignature);
8034
+ const maker = {
8035
+ quoteType: order.quoteType,
8036
+ globalNonce: order.globalNonce,
8037
+ subsetNonce: order.subsetNonce,
8038
+ strategyId: order.strategyId,
8039
+ collectionType: order.collectionType,
8040
+ orderNonce: order.orderNonce,
8041
+ collection: order.collection,
8042
+ currency: order.currency,
8043
+ signer: order.signer,
8044
+ startTime: order.startTime,
8045
+ endTime: order.endTime,
8046
+ price: order.price,
8047
+ itemIds: order.itemIds,
8048
+ amounts: order.amounts,
8049
+ additionalParameters: order.additionalParameters,
8050
+ };
8051
+ makers.push(maker);
7965
8052
  }
7966
8053
  const result = await this.verifyMakerOrders(makers, signatures, undefined, overrides);
7967
8054
  return result.map((res, index) => {
package/dist/index.esm.js CHANGED
@@ -5700,6 +5700,76 @@ const getFractionsById = async (fractionId, client) => {
5700
5700
  }
5701
5701
  return data?.fractions.data;
5702
5702
  };
5703
+ const ordersQuery = e$1(`
5704
+ query OrdersQuery($chainId: BigInt, $signer: String) {
5705
+ orders(where: { chainId: { eq: $chainId }, signer: { eq: $signer } }) {
5706
+ count
5707
+ data {
5708
+ id
5709
+ hypercert {
5710
+ hypercert_id
5711
+ creator_address
5712
+ contracts_id
5713
+ creation_block_number
5714
+ creation_block_timestamp
5715
+ id
5716
+ last_update_block_number
5717
+ last_update_block_timestamp
5718
+ metadata {
5719
+ allow_list_uri
5720
+ contributors
5721
+ description
5722
+ external_url
5723
+ id
5724
+ impact_scope
5725
+ impact_timeframe_from
5726
+ impact_timeframe_to
5727
+ name
5728
+ properties
5729
+ rights
5730
+ uri
5731
+ work_scope
5732
+ work_timeframe_from
5733
+ work_timeframe_to
5734
+ }
5735
+ token_id
5736
+ units
5737
+ uri
5738
+ }
5739
+ additionalParameters
5740
+ amounts
5741
+ chainId
5742
+ collection
5743
+ collectionType
5744
+ createdAt
5745
+ currency
5746
+ endTime
5747
+ globalNonce
5748
+ itemIds
5749
+ orderNonce
5750
+ price
5751
+ quoteType
5752
+ signature
5753
+ signer
5754
+ startTime
5755
+ strategyId
5756
+ subsetNonce
5757
+ }
5758
+ }
5759
+ }
5760
+ `);
5761
+ const getOrders = async ({ chainId, signer }, client) => {
5762
+ const { data, error } = await client
5763
+ .query(ordersQuery, {
5764
+ chainId,
5765
+ signer,
5766
+ })
5767
+ .toPromise();
5768
+ if (error) {
5769
+ throw new Error(error.message);
5770
+ }
5771
+ return data?.orders.data;
5772
+ };
5703
5773
 
5704
5774
  var teardownPlaceholder = () => {};
5705
5775
 
@@ -7500,7 +7570,7 @@ class ApiClient {
7500
7570
  if (strategy) {
7501
7571
  baseQuery.eq("strategyId", strategy);
7502
7572
  }
7503
- return baseQuery.throwOnError();
7573
+ return await getOrders({ signer, chainId: chainId ? BigInt(chainId) : undefined }, this._urqlClient);
7504
7574
  };
7505
7575
  /**
7506
7576
  * Fetches orders from api by hypercert ID
@@ -7954,12 +8024,29 @@ class HypercertExchangeClient {
7954
8024
  const signatures = [];
7955
8025
  const makers = [];
7956
8026
  for (const order of orders) {
7957
- const { signature, chainId, id: __, ...orderWithoutSignature } = order;
8027
+ const { signature, chainId } = order;
7958
8028
  if (chainId !== this.chainId) {
7959
8029
  throw new Error("Chain ID mismatch when checking order validity");
7960
8030
  }
7961
8031
  signatures.push(signature);
7962
- makers.push(orderWithoutSignature);
8032
+ const maker = {
8033
+ quoteType: order.quoteType,
8034
+ globalNonce: order.globalNonce,
8035
+ subsetNonce: order.subsetNonce,
8036
+ strategyId: order.strategyId,
8037
+ collectionType: order.collectionType,
8038
+ orderNonce: order.orderNonce,
8039
+ collection: order.collection,
8040
+ currency: order.currency,
8041
+ signer: order.signer,
8042
+ startTime: order.startTime,
8043
+ endTime: order.endTime,
8044
+ price: order.price,
8045
+ itemIds: order.itemIds,
8046
+ amounts: order.amounts,
8047
+ additionalParameters: order.additionalParameters,
8048
+ };
8049
+ makers.push(maker);
7963
8050
  }
7964
8051
  const result = await this.verifyMakerOrders(makers, signatures, undefined, overrides);
7965
8052
  return result.map((res, index) => {
@@ -2,7 +2,7 @@ import { Maker, OrderValidatorCode, QuoteType, StrategyType } from "../types";
2
2
  export declare class ApiClient {
3
3
  private readonly baseUrl?;
4
4
  private _baseUrl;
5
- private _urqlClient;
5
+ private readonly _urqlClient;
6
6
  private _supabaseHypercerts;
7
7
  constructor(indexerEnvironment: "test" | "production", baseUrl?: string | undefined);
8
8
  /**
@@ -42,29 +42,28 @@ export declare class ApiClient {
42
42
  * @param chainId chain id for the order
43
43
  * @param strategy strategy for the order
44
44
  */
45
- fetchOrders: ({ signer, claimTokenIds, chainId, strategy }: Partial<FetchOrderArgs>) => Promise<import("@supabase/supabase-js").PostgrestSingleResponse<{
46
- additionalParameters: string;
47
- amounts: number[];
48
- chainId: number;
49
- collection: string;
50
- collectionType: number;
51
- createdAt: string;
52
- currency: string;
53
- endTime: number;
45
+ fetchOrders: ({ signer, claimTokenIds, chainId, strategy }: Partial<FetchOrderArgs>) => Promise<{
46
+ subsetNonce: number;
47
+ strategyId: number;
48
+ startTime: number;
49
+ signer: string;
50
+ signature: string;
51
+ quoteType: number;
52
+ price: string;
53
+ orderNonce: string;
54
+ itemIds: string[];
54
55
  globalNonce: string;
56
+ endTime: number;
57
+ currency: string;
58
+ createdAt: string;
59
+ collectionType: number;
60
+ collection: string;
61
+ chainId: unknown;
62
+ amounts: number[];
63
+ additionalParameters: string;
64
+ hypercert: unknown;
55
65
  id: string;
56
- invalidated: boolean;
57
- itemIds: string[];
58
- orderNonce: string;
59
- price: string;
60
- quoteType: number;
61
- signature: string;
62
- signer: string;
63
- startTime: number;
64
- strategyId: number;
65
- subsetNonce: number;
66
- validator_codes: number[] | null;
67
- }[]>>;
66
+ }[] | null | undefined>;
68
67
  /**
69
68
  * Fetches orders from api by hypercert ID
70
69
  * @param hypercertId Hypercert ID
@@ -6,3 +6,28 @@ export declare const getFractionsById: (fractionId: string, client: Client) => P
6
6
  fraction_id: string | null;
7
7
  creation_block_timestamp: unknown;
8
8
  }[] | null | undefined>;
9
+ export declare const getOrders: ({ chainId, signer }: {
10
+ chainId?: BigInt | undefined;
11
+ signer?: `0x${string}` | undefined;
12
+ }, client: Client) => Promise<{
13
+ subsetNonce: number;
14
+ strategyId: number;
15
+ startTime: number;
16
+ signer: string;
17
+ signature: string;
18
+ quoteType: number;
19
+ price: string;
20
+ orderNonce: string;
21
+ itemIds: string[];
22
+ globalNonce: string;
23
+ endTime: number;
24
+ currency: string;
25
+ createdAt: string;
26
+ collectionType: number;
27
+ collection: string;
28
+ chainId: unknown;
29
+ amounts: number[];
30
+ additionalParameters: string;
31
+ hypercert: unknown;
32
+ id: string;
33
+ }[] | null | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypercerts-org/marketplace-sdk",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -48,7 +48,7 @@
48
48
  "@0no-co/graphqlsp": "^1.12.8",
49
49
  "@commitlint/cli": "^17.0.2",
50
50
  "@commitlint/config-conventional": "^17.0.2",
51
- "@hypercerts-org/contracts": "2.0.0-alpha.0",
51
+ "@hypercerts-org/contracts": "2.0.0-alpha.1",
52
52
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
53
53
  "@looksrare/contracts-exchange-v1": "^1.2.0",
54
54
  "@looksrare/contracts-exchange-v2": "^0.1.2",
@@ -93,7 +93,7 @@
93
93
  "typescript": "^5.3.3"
94
94
  },
95
95
  "dependencies": {
96
- "@hypercerts-org/sdk": "2.0.0-alpha.27",
96
+ "@hypercerts-org/sdk": "2.0.0-alpha.30",
97
97
  "@supabase/supabase-js": "^2.39.2",
98
98
  "@urql/core": "^5.0.4",
99
99
  "ethers": "^6.6.2",