@hypercerts-org/marketplace-sdk 0.3.37 → 0.4.1-alpha.0

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 (28) hide show
  1. package/{LICENSE → LICENSE.md} +1 -0
  2. package/README.md +117 -85
  3. package/dist/HypercertExchangeClient.d.ts +19 -88
  4. package/dist/abis/IERC20.json +13 -0
  5. package/dist/abis/OrderValidatorV2A.json +13 -0
  6. package/dist/index.cjs.js +274 -399
  7. package/dist/index.d.ts +0 -2
  8. package/dist/index.esm.js +275 -400
  9. package/dist/typechain/@looksrare/contracts-exchange-v2/contracts/helpers/OrderValidatorV2A.d.ts +5 -1
  10. package/dist/typechain/@looksrare/contracts-libs/contracts/interfaces/generic/IERC20.d.ts +5 -1
  11. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/ExecutionManager__factory.d.ts +1 -1
  12. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/LooksRareProtocol__factory.d.ts +1 -1
  13. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/StrategyManager__factory.d.ts +1 -1
  14. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/TransferSelectorNFT__factory.d.ts +1 -1
  15. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/helpers/OrderValidatorV2A__factory.d.ts +11 -1
  16. package/dist/typechain/factories/@looksrare/contracts-exchange-v2/contracts/helpers/ProtocolHelpers__factory.d.ts +1 -1
  17. package/dist/typechain/factories/@looksrare/contracts-libs/contracts/interfaces/generic/IERC20__factory.d.ts +10 -0
  18. package/dist/typechain/factories/solmate/src/tokens/WETH__factory.d.ts +1 -1
  19. package/dist/typechain/factories/src/contracts/tests/Verifier__factory.d.ts +1 -1
  20. package/dist/types.d.ts +57 -28
  21. package/dist/utils/api.d.ts +55 -26
  22. package/dist/utils/calls/nonces.d.ts +0 -1
  23. package/dist/utils/calls/transferManager.d.ts +1 -2
  24. package/dist/utils/graphl.d.ts +4 -3
  25. package/package.json +9 -9
  26. package/LICENSE-APACHE +0 -10
  27. package/LICENSE-MIT +0 -21
  28. package/dist/utils/hypercerts-database-types.d.ts +0 -568
package/dist/index.esm.js CHANGED
@@ -1,9 +1,7 @@
1
1
  import { Contract, ZeroAddress, AbiCoder, TypedDataEncoder, keccak256, solidityPackedKeccak256, ethers, getAddress, ZeroHash, MaxUint256 } from 'ethers';
2
2
  import { HypercertExchangeAbi, TransferManagerAbi, OrderValidatorV2AAbi, deployments, asDeployedChain as asDeployedChain$2 } from '@hypercerts-org/contracts';
3
3
  import { MerkleTree } from 'merkletreejs';
4
- import { keccak256 as keccak256$1 } from 'js-sha3';
5
- import { createClient } from '@supabase/supabase-js';
6
- import { parseClaimOrFractionId, CONSTANTS } from '@hypercerts-org/sdk';
4
+ import { CONSTANTS } from '@hypercerts-org/sdk';
7
5
 
8
6
  var abiIERC721 = [
9
7
  {
@@ -397,6 +395,20 @@ var abiIERC20 = [
397
395
  stateMutability: "view",
398
396
  type: "function"
399
397
  },
398
+ {
399
+ inputs: [
400
+ ],
401
+ name: "decimals",
402
+ outputs: [
403
+ {
404
+ internalType: "uint8",
405
+ name: "",
406
+ type: "uint8"
407
+ }
408
+ ],
409
+ stateMutability: "view",
410
+ type: "function"
411
+ },
400
412
  {
401
413
  inputs: [
402
414
  ],
@@ -579,14 +591,6 @@ const cancelOrderNonces = (signer, address, nonces, overrides) => {
579
591
  callStatic: (additionalOverrides) => contract.cancelOrderNonces.staticCall(nonces, { ...overrides, ...additionalOverrides }),
580
592
  };
581
593
  };
582
- const cancelSubsetNonces = (signer, address, nonces, overrides) => {
583
- const contract = new Contract(address, HypercertExchangeAbi).connect(signer);
584
- return {
585
- call: (additionalOverrides) => contract.cancelSubsetNonces.send(nonces, { ...overrides, ...additionalOverrides }),
586
- estimateGas: (additionalOverrides) => contract.cancelSubsetNonces.estimateGas(nonces, { ...overrides, ...additionalOverrides }),
587
- callStatic: (additionalOverrides) => contract.cancelSubsetNonces.staticCall(nonces, { ...overrides, ...additionalOverrides }),
588
- };
589
- };
590
594
  const incrementBidAskNonces = (signer, address, bid, ask, overrides) => {
591
595
  const contract = new Contract(address, HypercertExchangeAbi).connect(signer);
592
596
  return {
@@ -599,7 +603,6 @@ const incrementBidAskNonces = (signer, address, bid, ask, overrides) => {
599
603
  var nonces = /*#__PURE__*/Object.freeze({
600
604
  __proto__: null,
601
605
  cancelOrderNonces: cancelOrderNonces,
602
- cancelSubsetNonces: cancelSubsetNonces,
603
606
  incrementBidAskNonces: incrementBidAskNonces,
604
607
  viewUserBidAskNonces: viewUserBidAskNonces
605
608
  });
@@ -625,30 +628,12 @@ const revokeApprovals = (signer, address, operators, overrides) => {
625
628
  callStatic: (additionalOverrides) => contract.revokeApprovals.staticCall(operators, { ...overrides, ...additionalOverrides }),
626
629
  };
627
630
  };
628
- const transferBatchItemsAcrossCollections = (signer, address, items, from, to, overrides) => {
629
- const contract = new Contract(address, TransferManagerAbi).connect(signer);
630
- return {
631
- call: (additionalOverrides) => contract.transferBatchItemsAcrossCollections.send(items, from, to, {
632
- ...overrides,
633
- ...additionalOverrides,
634
- }),
635
- estimateGas: (additionalOverrides) => contract.transferBatchItemsAcrossCollections.estimateGas(items, from, to, {
636
- ...overrides,
637
- ...additionalOverrides,
638
- }),
639
- callStatic: (additionalOverrides) => contract.transferBatchItemsAcrossCollections.staticCall(items, from, to, {
640
- ...overrides,
641
- ...additionalOverrides,
642
- }),
643
- };
644
- };
645
631
 
646
632
  var transferManager = /*#__PURE__*/Object.freeze({
647
633
  __proto__: null,
648
634
  grantApprovals: grantApprovals,
649
635
  hasUserApprovedOperator: hasUserApprovedOperator,
650
- revokeApprovals: revokeApprovals,
651
- transferBatchItemsAcrossCollections: transferBatchItemsAcrossCollections
636
+ revokeApprovals: revokeApprovals
652
637
  });
653
638
 
654
639
  const verifyMakerOrders = async (signerOrProvider, address, makerOrders, signatures, merkleTrees, overrides) => {
@@ -701,22 +686,13 @@ var CollectionType;
701
686
  CollectionType[CollectionType["ERC721"] = 0] = "ERC721";
702
687
  CollectionType[CollectionType["ERC1155"] = 1] = "ERC1155";
703
688
  CollectionType[CollectionType["HYPERCERT"] = 2] = "HYPERCERT";
704
- CollectionType[CollectionType["HYPERBOARD"] = 3] = "HYPERBOARD";
705
689
  })(CollectionType || (CollectionType = {}));
706
690
  /** List of trading strategies */
707
691
  var StrategyType;
708
692
  (function (StrategyType) {
709
693
  StrategyType[StrategyType["standard"] = 0] = "standard";
710
- StrategyType[StrategyType["collection"] = 10] = "collection";
711
- StrategyType[StrategyType["collectionWithMerkleTree"] = 2] = "collectionWithMerkleTree";
712
- StrategyType[StrategyType["dutchAuction"] = 4] = "dutchAuction";
713
- StrategyType[StrategyType["itemIdsRange"] = 5] = "itemIdsRange";
714
- StrategyType[StrategyType["hypercertCollectionOffer"] = 6] = "hypercertCollectionOffer";
715
- StrategyType[StrategyType["hypercertCollectionOfferWithProof"] = 7] = "hypercertCollectionOfferWithProof";
716
- StrategyType[StrategyType["hypercertCollectionOfferWithAllowlist"] = 8] = "hypercertCollectionOfferWithAllowlist";
717
- StrategyType[StrategyType["hypercertDutchAuction"] = 9] = "hypercertDutchAuction";
718
694
  StrategyType[StrategyType["hypercertFractionOffer"] = 1] = "hypercertFractionOffer";
719
- StrategyType[StrategyType["hypercertFractionOfferWithAllowlist"] = 11] = "hypercertFractionOfferWithAllowlist";
695
+ StrategyType[StrategyType["hypercertFractionOfferWithAllowlist"] = 2] = "hypercertFractionOfferWithAllowlist";
720
696
  })(StrategyType || (StrategyType = {}));
721
697
  /** Type for maker order */
722
698
  var QuoteType;
@@ -793,12 +769,9 @@ var OrderValidatorCode;
793
769
  * @returns Array of solidity types for encoding
794
770
  */
795
771
  const getMakerParamsTypes = (strategy) => {
796
- if (strategy === StrategyType.standard || strategy === StrategyType.collection) {
772
+ if (strategy === StrategyType.standard) {
797
773
  return [];
798
774
  }
799
- if (strategy === StrategyType.collectionWithMerkleTree) {
800
- return ["bytes32"]; // Merkle tree root
801
- }
802
775
  if (strategy === StrategyType.hypercertFractionOffer) {
803
776
  return ["uint256", "uint256", "uint256", "bool"]; // minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction
804
777
  }
@@ -816,12 +789,6 @@ const getTakerParamsTypes = (strategy) => {
816
789
  if (strategy === StrategyType.standard) {
817
790
  return [];
818
791
  }
819
- if (strategy === StrategyType.collection) {
820
- return ["uint256"]; // Item id
821
- }
822
- if (strategy === StrategyType.collectionWithMerkleTree) {
823
- return ["uint256", "bytes32[]"]; // Item id, merkle proof
824
- }
825
792
  if (strategy === StrategyType.hypercertFractionOffer) {
826
793
  return ["uint256", "uint256"]; // unitAmount, pricePerUnit
827
794
  }
@@ -4580,6 +4547,20 @@ var OrderValidatorV2A = [
4580
4547
  stateMutability: "view",
4581
4548
  type: "function"
4582
4549
  },
4550
+ {
4551
+ inputs: [
4552
+ ],
4553
+ name: "royaltyFeeRegistry",
4554
+ outputs: [
4555
+ {
4556
+ internalType: "contract IRoyaltyFeeRegistry",
4557
+ name: "",
4558
+ type: "address"
4559
+ }
4560
+ ],
4561
+ stateMutability: "view",
4562
+ type: "function"
4563
+ },
4583
4564
  {
4584
4565
  inputs: [
4585
4566
  ],
@@ -5006,28 +4987,28 @@ var e$2 = {
5006
4987
  };
5007
4988
 
5008
4989
  class GraphQLError extends Error {
5009
- constructor(e, r, i, n, a, t, l) {
4990
+ constructor(e, r, n, i, t, a, l) {
5010
4991
  super(e);
5011
4992
  this.name = "GraphQLError";
5012
4993
  this.message = e;
5013
- if (a) {
5014
- this.path = a;
4994
+ if (t) {
4995
+ this.path = t;
5015
4996
  }
5016
4997
  if (r) {
5017
4998
  this.nodes = Array.isArray(r) ? r : [ r ];
5018
4999
  }
5019
- if (i) {
5020
- this.source = i;
5021
- }
5022
5000
  if (n) {
5023
- this.positions = n;
5001
+ this.source = n;
5024
5002
  }
5025
- if (t) {
5026
- this.originalError = t;
5003
+ if (i) {
5004
+ this.positions = i;
5005
+ }
5006
+ if (a) {
5007
+ this.originalError = a;
5027
5008
  }
5028
5009
  var o = l;
5029
- if (!o && t) {
5030
- var u = t.extensions;
5010
+ if (!o && a) {
5011
+ var u = a.extensions;
5031
5012
  if (u && "object" == typeof u) {
5032
5013
  o = u;
5033
5014
  }
@@ -5048,60 +5029,60 @@ class GraphQLError extends Error {
5048
5029
  }
5049
5030
  }
5050
5031
 
5051
- var i$1;
5052
-
5053
5032
  var n;
5054
5033
 
5034
+ var i$1;
5035
+
5055
5036
  function error(e) {
5056
- return new GraphQLError(`Syntax Error: Unexpected token at ${n} in ${e}`);
5037
+ return new GraphQLError(`Syntax Error: Unexpected token at ${i$1} in ${e}`);
5057
5038
  }
5058
5039
 
5059
5040
  function advance(e) {
5060
- e.lastIndex = n;
5061
- if (e.test(i$1)) {
5062
- return i$1.slice(n, n = e.lastIndex);
5041
+ e.lastIndex = i$1;
5042
+ if (e.test(n)) {
5043
+ return n.slice(i$1, i$1 = e.lastIndex);
5063
5044
  }
5064
5045
  }
5065
5046
 
5066
- var a = / +(?=[^\s])/y;
5047
+ var t = / +(?=[^\s])/y;
5067
5048
 
5068
5049
  function blockString(e) {
5069
5050
  var r = e.split("\n");
5070
- var i = "";
5071
- var n = 0;
5072
- var t = 0;
5051
+ var n = "";
5052
+ var i = 0;
5053
+ var a = 0;
5073
5054
  var l = r.length - 1;
5074
5055
  for (var o = 0; o < r.length; o++) {
5075
- a.lastIndex = 0;
5076
- if (a.test(r[o])) {
5077
- if (o && (!n || a.lastIndex < n)) {
5078
- n = a.lastIndex;
5056
+ t.lastIndex = 0;
5057
+ if (t.test(r[o])) {
5058
+ if (o && (!i || t.lastIndex < i)) {
5059
+ i = t.lastIndex;
5079
5060
  }
5080
- t = t || o;
5061
+ a = a || o;
5081
5062
  l = o;
5082
5063
  }
5083
5064
  }
5084
- for (var u = t; u <= l; u++) {
5085
- if (u !== t) {
5086
- i += "\n";
5065
+ for (var u = a; u <= l; u++) {
5066
+ if (u !== a) {
5067
+ n += "\n";
5087
5068
  }
5088
- i += r[u].slice(n).replace(/\\"""/g, '"""');
5069
+ n += r[u].slice(i).replace(/\\"""/g, '"""');
5089
5070
  }
5090
- return i;
5071
+ return n;
5091
5072
  }
5092
5073
 
5093
5074
  function ignored() {
5094
- for (var e = 0 | i$1.charCodeAt(n++); 9 === e || 10 === e || 13 === e || 32 === e || 35 === e || 44 === e || 65279 === e; e = 0 | i$1.charCodeAt(n++)) {
5075
+ for (var e = 0 | n.charCodeAt(i$1++); 9 === e || 10 === e || 13 === e || 32 === e || 35 === e || 44 === e || 65279 === e; e = 0 | n.charCodeAt(i$1++)) {
5095
5076
  if (35 === e) {
5096
- while (10 !== (e = i$1.charCodeAt(n++)) && 13 !== e) {}
5077
+ while (10 !== (e = n.charCodeAt(i$1++)) && 13 !== e) {}
5097
5078
  }
5098
5079
  }
5099
- n--;
5080
+ i$1--;
5100
5081
  }
5101
5082
 
5102
- var t = /[_A-Za-z]\w*/y;
5083
+ var a = /[_A-Za-z]\w*/y;
5103
5084
 
5104
- var l$1 = new RegExp("(?:(null|true|false)|\\$(" + t.source + ')|(-?\\d+)((?:\\.\\d+)?[eE][+-]?\\d+|\\.\\d+)?|("""(?:"""|(?:[\\s\\S]*?[^\\\\])"""))|("(?:"|[^\\r\\n]*?[^\\\\]"))|(' + t.source + "))", "y");
5085
+ var l$1 = new RegExp("(?:(null|true|false)|\\$(" + a.source + ')|(-?\\d+)((?:\\.\\d+)?[eE][+-]?\\d+|\\.\\d+)?|("""(?:"""|(?:[\\s\\S]*?[^\\\\])"""))|("(?:"|[^\\r\\n]*?[^\\\\]"))|(' + a.source + "))", "y");
5105
5086
 
5106
5087
  var o = function(e) {
5107
5088
  e[e.Const = 1] = "Const";
@@ -5114,39 +5095,39 @@ var o = function(e) {
5114
5095
  return e;
5115
5096
  }(o || {});
5116
5097
 
5117
- var u$1 = /\\/g;
5098
+ var u$1 = /\\/;
5118
5099
 
5119
5100
  function value(e) {
5120
5101
  var r;
5121
- var a;
5122
- l$1.lastIndex = n;
5123
- if (91 === i$1.charCodeAt(n)) {
5124
- n++;
5102
+ var t;
5103
+ l$1.lastIndex = i$1;
5104
+ if (91 === n.charCodeAt(i$1)) {
5105
+ i$1++;
5125
5106
  ignored();
5126
5107
  var d = [];
5127
- while (93 !== i$1.charCodeAt(n)) {
5108
+ while (93 !== n.charCodeAt(i$1)) {
5128
5109
  d.push(value(e));
5129
5110
  }
5130
- n++;
5111
+ i$1++;
5131
5112
  ignored();
5132
5113
  return {
5133
5114
  kind: "ListValue",
5134
5115
  values: d
5135
5116
  };
5136
- } else if (123 === i$1.charCodeAt(n)) {
5137
- n++;
5117
+ } else if (123 === n.charCodeAt(i$1)) {
5118
+ i$1++;
5138
5119
  ignored();
5139
- var v = [];
5140
- while (125 !== i$1.charCodeAt(n)) {
5141
- if (null == (r = advance(t))) {
5120
+ var s = [];
5121
+ while (125 !== n.charCodeAt(i$1)) {
5122
+ if (null == (r = advance(a))) {
5142
5123
  throw error("ObjectField");
5143
5124
  }
5144
5125
  ignored();
5145
- if (58 !== i$1.charCodeAt(n++)) {
5126
+ if (58 !== n.charCodeAt(i$1++)) {
5146
5127
  throw error("ObjectField");
5147
5128
  }
5148
5129
  ignored();
5149
- v.push({
5130
+ s.push({
5150
5131
  kind: "ObjectField",
5151
5132
  name: {
5152
5133
  kind: "Name",
@@ -5155,23 +5136,23 @@ function value(e) {
5155
5136
  value: value(e)
5156
5137
  });
5157
5138
  }
5158
- n++;
5139
+ i$1++;
5159
5140
  ignored();
5160
5141
  return {
5161
5142
  kind: "ObjectValue",
5162
- fields: v
5143
+ fields: s
5163
5144
  };
5164
- } else if (null != (a = l$1.exec(i$1))) {
5165
- n = l$1.lastIndex;
5145
+ } else if (null != (t = l$1.exec(n))) {
5146
+ i$1 = l$1.lastIndex;
5166
5147
  ignored();
5167
- if (null != (r = a[o.Const])) {
5148
+ if (null != (r = t[o.Const])) {
5168
5149
  return "null" === r ? {
5169
5150
  kind: "NullValue"
5170
5151
  } : {
5171
5152
  kind: "BooleanValue",
5172
5153
  value: "true" === r
5173
5154
  };
5174
- } else if (null != (r = a[o.Var])) {
5155
+ } else if (null != (r = t[o.Var])) {
5175
5156
  if (e) {
5176
5157
  throw error("Variable");
5177
5158
  } else {
@@ -5183,12 +5164,12 @@ function value(e) {
5183
5164
  }
5184
5165
  };
5185
5166
  }
5186
- } else if (null != (r = a[o.Int])) {
5187
- var s;
5188
- if (null != (s = a[o.Float])) {
5167
+ } else if (null != (r = t[o.Int])) {
5168
+ var v;
5169
+ if (null != (v = t[o.Float])) {
5189
5170
  return {
5190
5171
  kind: "FloatValue",
5191
- value: r + s
5172
+ value: r + v
5192
5173
  };
5193
5174
  } else {
5194
5175
  return {
@@ -5196,19 +5177,19 @@ function value(e) {
5196
5177
  value: r
5197
5178
  };
5198
5179
  }
5199
- } else if (null != (r = a[o.BlockString])) {
5180
+ } else if (null != (r = t[o.BlockString])) {
5200
5181
  return {
5201
5182
  kind: "StringValue",
5202
5183
  value: blockString(r.slice(3, -3)),
5203
5184
  block: !0
5204
5185
  };
5205
- } else if (null != (r = a[o.String])) {
5186
+ } else if (null != (r = t[o.String])) {
5206
5187
  return {
5207
5188
  kind: "StringValue",
5208
5189
  value: u$1.test(r) ? JSON.parse(r) : r.slice(1, -1),
5209
5190
  block: !1
5210
5191
  };
5211
- } else if (null != (r = a[o.Enum])) {
5192
+ } else if (null != (r = t[o.Enum])) {
5212
5193
  return {
5213
5194
  kind: "EnumValue",
5214
5195
  value: r
@@ -5219,17 +5200,17 @@ function value(e) {
5219
5200
  }
5220
5201
 
5221
5202
  function arguments_(e) {
5222
- if (40 === i$1.charCodeAt(n)) {
5203
+ if (40 === n.charCodeAt(i$1)) {
5223
5204
  var r = [];
5224
- n++;
5205
+ i$1++;
5225
5206
  ignored();
5226
- var a;
5207
+ var t;
5227
5208
  do {
5228
- if (null == (a = advance(t))) {
5209
+ if (null == (t = advance(a))) {
5229
5210
  throw error("Argument");
5230
5211
  }
5231
5212
  ignored();
5232
- if (58 !== i$1.charCodeAt(n++)) {
5213
+ if (58 !== n.charCodeAt(i$1++)) {
5233
5214
  throw error("Argument");
5234
5215
  }
5235
5216
  ignored();
@@ -5237,24 +5218,24 @@ function arguments_(e) {
5237
5218
  kind: "Argument",
5238
5219
  name: {
5239
5220
  kind: "Name",
5240
- value: a
5221
+ value: t
5241
5222
  },
5242
5223
  value: value(e)
5243
5224
  });
5244
- } while (41 !== i$1.charCodeAt(n));
5245
- n++;
5225
+ } while (41 !== n.charCodeAt(i$1));
5226
+ i$1++;
5246
5227
  ignored();
5247
5228
  return r;
5248
5229
  }
5249
5230
  }
5250
5231
 
5251
5232
  function directives(e) {
5252
- if (64 === i$1.charCodeAt(n)) {
5233
+ if (64 === n.charCodeAt(i$1)) {
5253
5234
  var r = [];
5254
- var a;
5235
+ var t;
5255
5236
  do {
5256
- n++;
5257
- if (null == (a = advance(t))) {
5237
+ i$1++;
5238
+ if (null == (t = advance(a))) {
5258
5239
  throw error("Directive");
5259
5240
  }
5260
5241
  ignored();
@@ -5262,11 +5243,11 @@ function directives(e) {
5262
5243
  kind: "Directive",
5263
5244
  name: {
5264
5245
  kind: "Name",
5265
- value: a
5246
+ value: t
5266
5247
  },
5267
5248
  arguments: arguments_(e)
5268
5249
  });
5269
- } while (64 === i$1.charCodeAt(n));
5250
+ } while (64 === n.charCodeAt(i$1));
5270
5251
  return r;
5271
5252
  }
5272
5253
  }
@@ -5274,16 +5255,16 @@ function directives(e) {
5274
5255
  function type() {
5275
5256
  var e;
5276
5257
  var r = 0;
5277
- while (91 === i$1.charCodeAt(n)) {
5258
+ while (91 === n.charCodeAt(i$1)) {
5278
5259
  r++;
5279
- n++;
5260
+ i$1++;
5280
5261
  ignored();
5281
5262
  }
5282
- if (null == (e = advance(t))) {
5263
+ if (null == (e = advance(a))) {
5283
5264
  throw error("NamedType");
5284
5265
  }
5285
5266
  ignored();
5286
- var a = {
5267
+ var t = {
5287
5268
  kind: "NamedType",
5288
5269
  name: {
5289
5270
  kind: "Name",
@@ -5291,47 +5272,47 @@ function type() {
5291
5272
  }
5292
5273
  };
5293
5274
  do {
5294
- if (33 === i$1.charCodeAt(n)) {
5295
- n++;
5275
+ if (33 === n.charCodeAt(i$1)) {
5276
+ i$1++;
5296
5277
  ignored();
5297
- a = {
5278
+ t = {
5298
5279
  kind: "NonNullType",
5299
- type: a
5280
+ type: t
5300
5281
  };
5301
5282
  }
5302
5283
  if (r) {
5303
- if (93 !== i$1.charCodeAt(n++)) {
5284
+ if (93 !== n.charCodeAt(i$1++)) {
5304
5285
  throw error("NamedType");
5305
5286
  }
5306
5287
  ignored();
5307
- a = {
5288
+ t = {
5308
5289
  kind: "ListType",
5309
- type: a
5290
+ type: t
5310
5291
  };
5311
5292
  }
5312
5293
  } while (r--);
5313
- return a;
5294
+ return t;
5314
5295
  }
5315
5296
 
5316
- var d$1 = new RegExp("(?:(\\.{3})|(" + t.source + "))", "y");
5297
+ var d$1 = new RegExp("(?:(\\.{3})|(" + a.source + "))", "y");
5317
5298
 
5318
- var v$1 = function(e) {
5299
+ var s = function(e) {
5319
5300
  e[e.Spread = 1] = "Spread";
5320
5301
  e[e.Name = 2] = "Name";
5321
5302
  return e;
5322
- }(v$1 || {});
5303
+ }(s || {});
5323
5304
 
5324
5305
  function selectionSet() {
5325
5306
  var e = [];
5326
5307
  var r;
5327
- var a;
5308
+ var t;
5328
5309
  do {
5329
- d$1.lastIndex = n;
5330
- if (null != (a = d$1.exec(i$1))) {
5331
- n = d$1.lastIndex;
5332
- if (null != a[v$1.Spread]) {
5310
+ d$1.lastIndex = i$1;
5311
+ if (null != (t = d$1.exec(n))) {
5312
+ i$1 = d$1.lastIndex;
5313
+ if (null != t[s.Spread]) {
5333
5314
  ignored();
5334
- var l = advance(t);
5315
+ var l = advance(a);
5335
5316
  if (null != l && "on" !== l) {
5336
5317
  ignored();
5337
5318
  e.push({
@@ -5345,13 +5326,13 @@ function selectionSet() {
5345
5326
  } else {
5346
5327
  ignored();
5347
5328
  if ("on" === l) {
5348
- if (null == (l = advance(t))) {
5329
+ if (null == (l = advance(a))) {
5349
5330
  throw error("NamedType");
5350
5331
  }
5351
5332
  ignored();
5352
5333
  }
5353
5334
  var o = directives(!1);
5354
- if (123 !== i$1.charCodeAt(n++)) {
5335
+ if (123 !== n.charCodeAt(i$1++)) {
5355
5336
  throw error("InlineFragment");
5356
5337
  }
5357
5338
  ignored();
@@ -5368,24 +5349,24 @@ function selectionSet() {
5368
5349
  selectionSet: selectionSet()
5369
5350
  });
5370
5351
  }
5371
- } else if (null != (r = a[v$1.Name])) {
5352
+ } else if (null != (r = t[s.Name])) {
5372
5353
  var u = void 0;
5373
5354
  ignored();
5374
- if (58 === i$1.charCodeAt(n)) {
5375
- n++;
5355
+ if (58 === n.charCodeAt(i$1)) {
5356
+ i$1++;
5376
5357
  ignored();
5377
5358
  u = r;
5378
- if (null == (r = advance(t))) {
5359
+ if (null == (r = advance(a))) {
5379
5360
  throw error("Field");
5380
5361
  }
5381
5362
  ignored();
5382
5363
  }
5383
- var s = arguments_(!1);
5364
+ var v = arguments_(!1);
5384
5365
  ignored();
5385
5366
  var c = directives(!1);
5386
5367
  var f = void 0;
5387
- if (123 === i$1.charCodeAt(n)) {
5388
- n++;
5368
+ if (123 === n.charCodeAt(i$1)) {
5369
+ i$1++;
5389
5370
  ignored();
5390
5371
  f = selectionSet();
5391
5372
  }
@@ -5399,7 +5380,7 @@ function selectionSet() {
5399
5380
  kind: "Name",
5400
5381
  value: r
5401
5382
  },
5402
- arguments: s,
5383
+ arguments: v,
5403
5384
  directives: c,
5404
5385
  selectionSet: f
5405
5386
  });
@@ -5407,8 +5388,8 @@ function selectionSet() {
5407
5388
  } else {
5408
5389
  throw error("SelectionSet");
5409
5390
  }
5410
- } while (125 !== i$1.charCodeAt(n));
5411
- n++;
5391
+ } while (125 !== n.charCodeAt(i$1));
5392
+ i$1++;
5412
5393
  ignored();
5413
5394
  return {
5414
5395
  kind: "SelectionSet",
@@ -5419,20 +5400,20 @@ function selectionSet() {
5419
5400
  function fragmentDefinition() {
5420
5401
  var e;
5421
5402
  var r;
5422
- if (null == (e = advance(t))) {
5403
+ if (null == (e = advance(a))) {
5423
5404
  throw error("FragmentDefinition");
5424
5405
  }
5425
5406
  ignored();
5426
- if ("on" !== advance(t)) {
5407
+ if ("on" !== advance(a)) {
5427
5408
  throw error("FragmentDefinition");
5428
5409
  }
5429
5410
  ignored();
5430
- if (null == (r = advance(t))) {
5411
+ if (null == (r = advance(a))) {
5431
5412
  throw error("FragmentDefinition");
5432
5413
  }
5433
5414
  ignored();
5434
- var a = directives(!1);
5435
- if (123 !== i$1.charCodeAt(n++)) {
5415
+ var t = directives(!1);
5416
+ if (123 !== n.charCodeAt(i$1++)) {
5436
5417
  throw error("FragmentDefinition");
5437
5418
  }
5438
5419
  ignored();
@@ -5449,43 +5430,43 @@ function fragmentDefinition() {
5449
5430
  value: r
5450
5431
  }
5451
5432
  },
5452
- directives: a,
5433
+ directives: t,
5453
5434
  selectionSet: selectionSet()
5454
5435
  };
5455
5436
  }
5456
5437
 
5457
- var s = /(?:query|mutation|subscription|fragment)/y;
5438
+ var v$1 = /(?:query|mutation|subscription|fragment)/y;
5458
5439
 
5459
5440
  function operationDefinition(e) {
5460
5441
  var r;
5461
- var a;
5442
+ var t;
5462
5443
  var l;
5463
5444
  if (e) {
5464
5445
  ignored();
5465
- r = advance(t);
5466
- a = function variableDefinitions() {
5446
+ r = advance(a);
5447
+ t = function variableDefinitions() {
5467
5448
  ignored();
5468
- if (40 === i$1.charCodeAt(n)) {
5449
+ if (40 === n.charCodeAt(i$1)) {
5469
5450
  var e = [];
5470
- n++;
5451
+ i$1++;
5471
5452
  ignored();
5472
5453
  var r;
5473
5454
  do {
5474
- if (36 !== i$1.charCodeAt(n++)) {
5455
+ if (36 !== n.charCodeAt(i$1++)) {
5475
5456
  throw error("Variable");
5476
5457
  }
5477
- if (null == (r = advance(t))) {
5458
+ if (null == (r = advance(a))) {
5478
5459
  throw error("Variable");
5479
5460
  }
5480
5461
  ignored();
5481
- if (58 !== i$1.charCodeAt(n++)) {
5462
+ if (58 !== n.charCodeAt(i$1++)) {
5482
5463
  throw error("VariableDefinition");
5483
5464
  }
5484
5465
  ignored();
5485
- var a = type();
5466
+ var t = type();
5486
5467
  var l = void 0;
5487
- if (61 === i$1.charCodeAt(n)) {
5488
- n++;
5468
+ if (61 === n.charCodeAt(i$1)) {
5469
+ i$1++;
5489
5470
  ignored();
5490
5471
  l = value(!0);
5491
5472
  }
@@ -5499,20 +5480,20 @@ function operationDefinition(e) {
5499
5480
  value: r
5500
5481
  }
5501
5482
  },
5502
- type: a,
5483
+ type: t,
5503
5484
  defaultValue: l,
5504
5485
  directives: directives(!0)
5505
5486
  });
5506
- } while (41 !== i$1.charCodeAt(n));
5507
- n++;
5487
+ } while (41 !== n.charCodeAt(i$1));
5488
+ i$1++;
5508
5489
  ignored();
5509
5490
  return e;
5510
5491
  }
5511
5492
  }();
5512
5493
  l = directives(!1);
5513
5494
  }
5514
- if (123 === i$1.charCodeAt(n)) {
5515
- n++;
5495
+ if (123 === n.charCodeAt(i$1)) {
5496
+ i$1++;
5516
5497
  ignored();
5517
5498
  return {
5518
5499
  kind: "OperationDefinition",
@@ -5521,7 +5502,7 @@ function operationDefinition(e) {
5521
5502
  kind: "Name",
5522
5503
  value: r
5523
5504
  } : void 0,
5524
- variableDefinitions: a,
5505
+ variableDefinitions: t,
5525
5506
  directives: l,
5526
5507
  selectionSet: selectionSet()
5527
5508
  };
@@ -5529,39 +5510,67 @@ function operationDefinition(e) {
5529
5510
  }
5530
5511
 
5531
5512
  function parse(e, r) {
5532
- i$1 = "string" == typeof e.body ? e.body : e;
5533
- n = 0;
5534
- return function document() {
5535
- var e;
5536
- var r;
5513
+ i$1 = 0;
5514
+ return function document(e, r) {
5515
+ var n;
5516
+ var t;
5537
5517
  ignored();
5538
5518
  var a = [];
5539
5519
  do {
5540
- if ("fragment" === (e = advance(s))) {
5520
+ if ("fragment" === (n = advance(v$1))) {
5541
5521
  ignored();
5542
5522
  a.push(fragmentDefinition());
5543
- } else if (null != (r = operationDefinition(e))) {
5544
- a.push(r);
5523
+ } else if (null != (t = operationDefinition(n))) {
5524
+ a.push(t);
5545
5525
  } else {
5546
5526
  throw error("Document");
5547
5527
  }
5548
- } while (n < i$1.length);
5528
+ } while (i$1 < e.length);
5529
+ if (!r) {
5530
+ var l;
5531
+ return {
5532
+ kind: "Document",
5533
+ definitions: a,
5534
+ set loc(e) {
5535
+ l = e;
5536
+ },
5537
+ get loc() {
5538
+ if (!l) {
5539
+ l = {
5540
+ start: 0,
5541
+ end: e.length,
5542
+ startToken: void 0,
5543
+ endToken: void 0,
5544
+ source: {
5545
+ body: e,
5546
+ name: "graphql.web",
5547
+ locationOffset: {
5548
+ line: 1,
5549
+ column: 1
5550
+ }
5551
+ }
5552
+ };
5553
+ }
5554
+ return l;
5555
+ }
5556
+ };
5557
+ }
5549
5558
  return {
5550
5559
  kind: "Document",
5551
5560
  definitions: a
5552
5561
  };
5553
- }();
5562
+ }(n = "string" == typeof e.body ? e.body : e, r && r.noLocation);
5554
5563
  }
5555
5564
 
5556
- function mapJoin(e, r, i) {
5557
- var n = "";
5558
- for (var a = 0; a < e.length; a++) {
5559
- if (a) {
5560
- n += r;
5565
+ function mapJoin(e, r, n) {
5566
+ var i = "";
5567
+ for (var t = 0; t < e.length; t++) {
5568
+ if (t) {
5569
+ i += r;
5561
5570
  }
5562
- n += i(e[a]);
5571
+ i += n(e[t]);
5563
5572
  }
5564
- return n;
5573
+ return i;
5565
5574
  }
5566
5575
 
5567
5576
  function printString(e) {
@@ -5574,7 +5583,7 @@ function printBlockString(e) {
5574
5583
 
5575
5584
  var f$1 = "\n";
5576
5585
 
5577
- var m$1 = {
5586
+ var g = {
5578
5587
  OperationDefinition(e) {
5579
5588
  var r = e.operation;
5580
5589
  if (e.name) {
@@ -5584,38 +5593,38 @@ var m$1 = {
5584
5593
  if (!e.name) {
5585
5594
  r += " ";
5586
5595
  }
5587
- r += "(" + mapJoin(e.variableDefinitions, ", ", m$1.VariableDefinition) + ")";
5596
+ r += "(" + mapJoin(e.variableDefinitions, ", ", g.VariableDefinition) + ")";
5588
5597
  }
5589
5598
  if (e.directives && e.directives.length) {
5590
- r += " " + mapJoin(e.directives, " ", m$1.Directive);
5599
+ r += " " + mapJoin(e.directives, " ", g.Directive);
5591
5600
  }
5592
- return "query" !== r ? r + " " + m$1.SelectionSet(e.selectionSet) : m$1.SelectionSet(e.selectionSet);
5601
+ return "query" !== r ? r + " " + g.SelectionSet(e.selectionSet) : g.SelectionSet(e.selectionSet);
5593
5602
  },
5594
5603
  VariableDefinition(e) {
5595
- var r = m$1.Variable(e.variable) + ": " + _print(e.type);
5604
+ var r = g.Variable(e.variable) + ": " + _print(e.type);
5596
5605
  if (e.defaultValue) {
5597
5606
  r += " = " + _print(e.defaultValue);
5598
5607
  }
5599
5608
  if (e.directives && e.directives.length) {
5600
- r += " " + mapJoin(e.directives, " ", m$1.Directive);
5609
+ r += " " + mapJoin(e.directives, " ", g.Directive);
5601
5610
  }
5602
5611
  return r;
5603
5612
  },
5604
5613
  Field(e) {
5605
5614
  var r = e.alias ? e.alias.value + ": " + e.name.value : e.name.value;
5606
5615
  if (e.arguments && e.arguments.length) {
5607
- var i = mapJoin(e.arguments, ", ", m$1.Argument);
5608
- if (r.length + i.length + 2 > 80) {
5609
- r += "(" + (f$1 += " ") + mapJoin(e.arguments, f$1, m$1.Argument) + (f$1 = f$1.slice(0, -2)) + ")";
5616
+ var n = mapJoin(e.arguments, ", ", g.Argument);
5617
+ if (r.length + n.length + 2 > 80) {
5618
+ r += "(" + (f$1 += " ") + mapJoin(e.arguments, f$1, g.Argument) + (f$1 = f$1.slice(0, -2)) + ")";
5610
5619
  } else {
5611
- r += "(" + i + ")";
5620
+ r += "(" + n + ")";
5612
5621
  }
5613
5622
  }
5614
5623
  if (e.directives && e.directives.length) {
5615
- r += " " + mapJoin(e.directives, " ", m$1.Directive);
5624
+ r += " " + mapJoin(e.directives, " ", g.Directive);
5616
5625
  }
5617
- if (e.selectionSet) {
5618
- r += " " + m$1.SelectionSet(e.selectionSet);
5626
+ if (e.selectionSet && e.selectionSet.selections.length) {
5627
+ r += " " + g.SelectionSet(e.selectionSet);
5619
5628
  }
5620
5629
  return r;
5621
5630
  },
@@ -5634,7 +5643,7 @@ var m$1 = {
5634
5643
  Name: e => e.value,
5635
5644
  Variable: e => "$" + e.name.value,
5636
5645
  ListValue: e => "[" + mapJoin(e.values, ", ", _print) + "]",
5637
- ObjectValue: e => "{" + mapJoin(e.fields, ", ", m$1.ObjectField) + "}",
5646
+ ObjectValue: e => "{" + mapJoin(e.fields, ", ", g.ObjectField) + "}",
5638
5647
  ObjectField: e => e.name.value + ": " + _print(e.value),
5639
5648
  Document(e) {
5640
5649
  if (!e.definitions || !e.definitions.length) {
@@ -5647,7 +5656,7 @@ var m$1 = {
5647
5656
  FragmentSpread(e) {
5648
5657
  var r = "..." + e.name.value;
5649
5658
  if (e.directives && e.directives.length) {
5650
- r += " " + mapJoin(e.directives, " ", m$1.Directive);
5659
+ r += " " + mapJoin(e.directives, " ", g.Directive);
5651
5660
  }
5652
5661
  return r;
5653
5662
  },
@@ -5657,22 +5666,22 @@ var m$1 = {
5657
5666
  r += " on " + e.typeCondition.name.value;
5658
5667
  }
5659
5668
  if (e.directives && e.directives.length) {
5660
- r += " " + mapJoin(e.directives, " ", m$1.Directive);
5669
+ r += " " + mapJoin(e.directives, " ", g.Directive);
5661
5670
  }
5662
- return r += " " + m$1.SelectionSet(e.selectionSet);
5671
+ return r += " " + g.SelectionSet(e.selectionSet);
5663
5672
  },
5664
5673
  FragmentDefinition(e) {
5665
5674
  var r = "fragment " + e.name.value;
5666
5675
  r += " on " + e.typeCondition.name.value;
5667
5676
  if (e.directives && e.directives.length) {
5668
- r += " " + mapJoin(e.directives, " ", m$1.Directive);
5677
+ r += " " + mapJoin(e.directives, " ", g.Directive);
5669
5678
  }
5670
- return r + " " + m$1.SelectionSet(e.selectionSet);
5679
+ return r + " " + g.SelectionSet(e.selectionSet);
5671
5680
  },
5672
5681
  Directive(e) {
5673
5682
  var r = "@" + e.name.value;
5674
5683
  if (e.arguments && e.arguments.length) {
5675
- r += "(" + mapJoin(e.arguments, ", ", m$1.Argument) + ")";
5684
+ r += "(" + mapJoin(e.arguments, ", ", g.Argument) + ")";
5676
5685
  }
5677
5686
  return r;
5678
5687
  },
@@ -5681,11 +5690,11 @@ var m$1 = {
5681
5690
  NonNullType: e => _print(e.type) + "!"
5682
5691
  };
5683
5692
 
5684
- var _print = e => m$1[e.kind](e);
5693
+ var _print = e => g[e.kind](e);
5685
5694
 
5686
5695
  function print(e) {
5687
5696
  f$1 = "\n";
5688
- return m$1[e.kind] ? m$1[e.kind](e) : "";
5697
+ return g[e.kind] ? g[e.kind](e) : "";
5689
5698
  }
5690
5699
 
5691
5700
  function initGraphQLTada() {
@@ -5723,7 +5732,7 @@ function initGraphQLTada() {
5723
5732
 
5724
5733
  var e$1 = initGraphQLTada();
5725
5734
 
5726
- const fractionsByIdQuery = e$1(`
5735
+ e$1(`
5727
5736
  query fractionsById($fraction_id: String!) {
5728
5737
  fractions(where: { hypercert_id: { eq: $fraction_id } }) {
5729
5738
  data {
@@ -5736,20 +5745,9 @@ const fractionsByIdQuery = e$1(`
5736
5745
  }
5737
5746
  }
5738
5747
  `);
5739
- const getFractionsById = async (fractionId, client) => {
5740
- const { data, error } = await client
5741
- .query(fractionsByIdQuery, {
5742
- fraction_id: fractionId,
5743
- })
5744
- .toPromise();
5745
- if (error) {
5746
- throw new Error(error.message);
5747
- }
5748
- return data?.fractions.data;
5749
- };
5750
5748
  const ordersQuery = e$1(`
5751
- query OrdersQuery($chainId: BigInt, $signer: String) {
5752
- orders(where: { chainId: { eq: $chainId }, signer: { eq: $signer } }) {
5749
+ query OrdersQuery($where: OrderWhereInput) {
5750
+ orders(where: $where) {
5753
5751
  count
5754
5752
  data {
5755
5753
  id
@@ -5805,11 +5803,20 @@ const ordersQuery = e$1(`
5805
5803
  }
5806
5804
  }
5807
5805
  `);
5808
- const getOrders = async ({ chainId, signer }, client) => {
5806
+ const getOrders = async (filter, client) => {
5807
+ const where = {};
5808
+ if (filter?.chainId) {
5809
+ where.chainId = { eq: filter.chainId.toString() };
5810
+ }
5811
+ if (filter?.signer) {
5812
+ where.signer = { eq: filter.signer };
5813
+ }
5814
+ if (filter?.hypercertId) {
5815
+ where.hypercert_id = { eq: filter.hypercertId };
5816
+ }
5809
5817
  const { data, error } = await client
5810
5818
  .query(ordersQuery, {
5811
- chainId,
5812
- signer,
5819
+ where,
5813
5820
  })
5814
5821
  .toPromise();
5815
5822
  if (error) {
@@ -6616,7 +6623,9 @@ var keyDocument = e => {
6616
6623
  var a;
6617
6624
  if ("string" == typeof e) {
6618
6625
  r = hashDocument(e);
6619
- a = u.get(r) || parse(e);
6626
+ a = u.get(r) || parse(e, {
6627
+ noLocation: !0
6628
+ });
6620
6629
  } else {
6621
6630
  r = e.__key || hashDocument(e);
6622
6631
  a = u.get(r) || e;
@@ -7544,15 +7553,11 @@ var C = function Client(e) {
7544
7553
  return p;
7545
7554
  };
7546
7555
 
7547
- const SUPABASE_HYPERCERTS_DATA_STAGING_URL = "https://zgvoyckkistexkfdmjqc.supabase.co";
7548
- const SUPABASE_HYPERCERTS_DATA_STAGING_ANON_KEY_STAGING = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inpndm95Y2traXN0ZXhrZmRtanFjIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTc4ODM1MjAsImV4cCI6MjAxMzQ1OTUyMH0.6FWDhwP3ZOM1O3ObvyRKtOsvwhJjbrZL2B1N-0MSpFg";
7549
- const SUPABASE_HYPERCERTS_DATA_PRODUCTION_URL = "https://ueebbafxdbglaqtyslwv.supabase.co";
7550
- const SUPABASE_HYPERCERTS_DATA_PRODUCTION_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InVlZWJiYWZ4ZGJnbGFxdHlzbHd2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTc1NTA1MzUsImV4cCI6MjAxMzEyNjUzNX0.mhClRFe8QL6IQLMvTXjdprR6agr_OXF9g2CUJBww4mE";
7551
7556
  class ApiClient {
7552
7557
  constructor(indexerEnvironment, baseUrl) {
7553
7558
  this.baseUrl = baseUrl;
7554
7559
  /**
7555
- * Fetches order nonce from api
7560
+ * Fetches order nonce from API
7556
7561
  * @param address Address
7557
7562
  * @param chainId Chain ID
7558
7563
  */
@@ -7571,7 +7576,7 @@ class ApiClient {
7571
7576
  .then((res) => res.data);
7572
7577
  };
7573
7578
  /**
7574
- * Registers order in api
7579
+ * Registers order in the marketplace API
7575
7580
  * @param order Order
7576
7581
  * @param signer Signer
7577
7582
  * @param signature Signature
@@ -7597,38 +7602,24 @@ class ApiClient {
7597
7602
  }).then((res) => this.handleResponse(res));
7598
7603
  };
7599
7604
  /**
7605
+ * @deprecated use GraphQL API instead
7600
7606
  * Fetch existing open orders from the marketplace API
7601
7607
  * @param signer address of the user that created the order
7602
7608
  * @param claimTokenIds a list of claimTokenIds - will return any order that is for one or more of these claimTokenIds
7603
7609
  * @param chainId chain id for the order
7604
7610
  * @param strategy strategy for the order
7605
7611
  */
7606
- this.fetchOrders = async ({ signer, claimTokenIds, chainId, strategy }) => {
7607
- let baseQuery = this._supabaseHypercerts.from("marketplace_orders").select("*");
7608
- if (signer) {
7609
- baseQuery.eq("signer", signer);
7610
- }
7611
- if (claimTokenIds) {
7612
- baseQuery = baseQuery.overlaps("itemIds", claimTokenIds);
7613
- }
7614
- if (chainId) {
7615
- baseQuery.eq("chainId", chainId);
7616
- }
7617
- if (strategy) {
7618
- baseQuery.eq("strategyId", strategy);
7619
- }
7612
+ this.fetchOrders = async ({ signer, chainId }) => {
7620
7613
  return await getOrders({ signer, chainId: chainId ? BigInt(chainId) : undefined }, this._urqlClient);
7621
7614
  };
7622
7615
  /**
7623
- * Fetches orders from api by hypercert ID
7616
+ * @deprecated use the GraphQL API instead
7617
+ * Fetches orders from API by hypercert ID
7624
7618
  * @param hypercertId Hypercert ID
7625
7619
  * @param chainId Chain ID
7626
7620
  */
7627
7621
  this.fetchOrdersByHypercertId = async ({ hypercertId }) => {
7628
- const fractions = await getFractionsById(hypercertId, this._urqlClient);
7629
- const tokenIds = fractions?.flatMap(() => fractions.map((fraction) => parseClaimOrFractionId(fraction.fraction_id).id)) || [];
7630
- const result = await this._supabaseHypercerts.from("marketplace_orders").select("*").overlaps("itemIds", tokenIds);
7631
- return result;
7622
+ return getOrders({ hypercertId }, this._urqlClient);
7632
7623
  };
7633
7624
  this.handleResponse = async (res) => {
7634
7625
  if (!res.ok) {
@@ -7674,9 +7665,6 @@ class ApiClient {
7674
7665
  url: `${CONSTANTS.ENDPOINTS[indexerEnvironment]}/v1/graphql`,
7675
7666
  exchanges: [cacheExchange, fetchExchange],
7676
7667
  });
7677
- this._supabaseHypercerts = createClient(indexerEnvironment === "test" ? SUPABASE_HYPERCERTS_DATA_STAGING_URL : SUPABASE_HYPERCERTS_DATA_PRODUCTION_URL, indexerEnvironment === "test"
7678
- ? SUPABASE_HYPERCERTS_DATA_STAGING_ANON_KEY_STAGING
7679
- : SUPABASE_HYPERCERTS_DATA_PRODUCTION_ANON_KEY);
7680
7668
  }
7681
7669
  }
7682
7670
 
@@ -7691,10 +7679,10 @@ const ACCEPTED_ERROR_CODES = [
7691
7679
  class HypercertExchangeClient {
7692
7680
  /**
7693
7681
  * HypercertExchange protocol main class
7694
- * @param chainId Current app chain id
7682
+ * @param chainId Chain id for contract interactions
7695
7683
  * @param provider Ethers provider
7696
7684
  * @param signer Ethers signer
7697
- * @param overrides Override contract addresses or api endpoint used
7685
+ * @param overrides Override contract addresses or API endpoint used
7698
7686
  */
7699
7687
  constructor(chainId, provider, signer, overrides) {
7700
7688
  const deployment = CONSTANTS.DEPLOYMENTS[asDeployedChain$2(chainId)];
@@ -7744,7 +7732,7 @@ class HypercertExchangeClient {
7744
7732
  * @param CreateMakerInput
7745
7733
  * @returns the maker object, isTransferManagerApproved, and isTransferManagerApproved
7746
7734
  */
7747
- async createMakerAsk({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts = [1], currency = ZeroAddress, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
7735
+ async createMakerAsk({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, currency = ZeroAddress, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
7748
7736
  const signer = this.getSigner();
7749
7737
  if (!this.isTimestampValid(startTime) || !this.isTimestampValid(endTime)) {
7750
7738
  throw new ErrorTimestamp();
@@ -7771,7 +7759,7 @@ class HypercertExchangeClient {
7771
7759
  endTime: endTime,
7772
7760
  price: price,
7773
7761
  itemIds: itemIds,
7774
- amounts: amounts,
7762
+ amounts: itemIds.map(_ => 1n),
7775
7763
  additionalParameters: encodeParams(additionalParameters, getMakerParamsTypes(strategyId)),
7776
7764
  };
7777
7765
  return {
@@ -7785,7 +7773,7 @@ class HypercertExchangeClient {
7785
7773
  * @param CreateMakerInput
7786
7774
  * @returns the maker object, isCurrencyApproved, and isBalanceSufficient
7787
7775
  */
7788
- async createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts = [1], currency, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
7776
+ async createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, currency, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
7789
7777
  const signer = this.getSigner();
7790
7778
  if (!this.isTimestampValid(startTime) || !this.isTimestampValid(endTime)) {
7791
7779
  throw new ErrorTimestamp();
@@ -7815,7 +7803,7 @@ class HypercertExchangeClient {
7815
7803
  endTime: endTime,
7816
7804
  price: price,
7817
7805
  itemIds: itemIds,
7818
- amounts: amounts,
7806
+ amounts: itemIds.map(_ => 1n),
7819
7807
  additionalParameters: encodeParams(additionalParameters, getMakerParamsTypes(strategyId)),
7820
7808
  };
7821
7809
  return {
@@ -7824,36 +7812,6 @@ class HypercertExchangeClient {
7824
7812
  isBalanceSufficient: BigInt(balance) >= BigInt(price),
7825
7813
  };
7826
7814
  }
7827
- /**
7828
- * Create a maker bid for collection offer.
7829
- * @see this.createMakerBid
7830
- * @param orderInputs Order data
7831
- * @returns CreateMakerBidOutput
7832
- */
7833
- createMakerCollectionOffer(orderInputs) {
7834
- return this.createMakerBid({ ...orderInputs, strategyId: StrategyType.collection, itemIds: [] });
7835
- }
7836
- /**
7837
- * Create a maker bid for collection, with a list of item id that can be used for the taker order
7838
- * @see this.createMakerBid
7839
- * @param orderInputs Order data
7840
- * @returns CreateMakerBidOutput
7841
- */
7842
- async createMakerCollectionOfferWithProof(orderInputs) {
7843
- const { itemIds, ...otherInputs } = orderInputs;
7844
- const leaves = itemIds.map((itemId) => {
7845
- const hash = solidityPackedKeccak256(["uint256"], [itemId]);
7846
- return Buffer.from(hash.slice(2), "hex");
7847
- });
7848
- const tree = new MerkleTree(leaves, keccak256$1, { sortPairs: true });
7849
- const root = tree.getHexRoot();
7850
- return this.createMakerBid({
7851
- ...otherInputs,
7852
- strategyId: StrategyType.collectionWithMerkleTree,
7853
- additionalParameters: [root],
7854
- itemIds: [],
7855
- });
7856
- }
7857
7815
  /**
7858
7816
  * Create a taker ask ready to be executed against a maker bid
7859
7817
  * @param maker Maker order that will be used as counterparty for the taker
@@ -7867,53 +7825,6 @@ class HypercertExchangeClient {
7867
7825
  additionalParameters: encodeParams(additionalParameters, getTakerParamsTypes(maker.strategyId)),
7868
7826
  };
7869
7827
  }
7870
- /**
7871
- * Create a taker ask order for collection order.
7872
- * @see this.createTaker
7873
- * @see this.createMakerCollectionOffer
7874
- * @param maker Maker bid that will be used as counterparty for the taker
7875
- * @param itemId Token id to use as a counterparty for the collection order
7876
- * @param recipient Recipient address of the taker (if none, it will use the sender)
7877
- * @returns Taker object
7878
- */
7879
- createTakerCollectionOffer(maker, itemId, recipient) {
7880
- if (maker.quoteType !== QuoteType.Bid) {
7881
- throw new ErrorQuoteType();
7882
- }
7883
- if (maker.strategyId !== StrategyType.collection) {
7884
- throw new ErrorStrategyType();
7885
- }
7886
- return this.createTaker(maker, recipient, [itemId]);
7887
- }
7888
- /**
7889
- * Create a taker ask to fulfill a collection order (maker bid) created with a whitelist of item ids
7890
- * @see this.createTaker
7891
- * @see this.createMakerCollectionOfferWithMerkleTree
7892
- * @param maker Maker bid that will be used as counterparty for the taker
7893
- * @param itemId Token id to use as a counterparty for the collection order
7894
- * @param itemIds List of token ids used during the maker creation
7895
- * @param recipient Recipient address of the taker (if none, it will use the sender)
7896
- * @returns Taker object
7897
- */
7898
- createTakerCollectionOfferWithProof(maker, itemId, itemIds, recipient) {
7899
- if (maker.quoteType !== QuoteType.Bid) {
7900
- throw new ErrorQuoteType();
7901
- }
7902
- if (maker.strategyId !== StrategyType.collectionWithMerkleTree) {
7903
- throw new ErrorStrategyType();
7904
- }
7905
- const index = itemIds.findIndex((id) => BigInt(id) === BigInt(itemId));
7906
- if (index === -1) {
7907
- throw new ErrorItemId();
7908
- }
7909
- const leaves = itemIds.map((id) => {
7910
- const hash = solidityPackedKeccak256(["uint256"], [id]);
7911
- return Buffer.from(hash.slice(2), "hex");
7912
- });
7913
- const tree = new MerkleTree(leaves, keccak256$1, { sortPairs: true });
7914
- const proof = tree.getHexProof(leaves[index]);
7915
- return this.createTaker(maker, recipient, [itemId, proof]);
7916
- }
7917
7828
  /**
7918
7829
  * Sign a maker order using the signer provided in the constructor
7919
7830
  * @param maker Order to be signed by the user
@@ -7942,7 +7853,7 @@ class HypercertExchangeClient {
7942
7853
  * @param maker Maker order
7943
7854
  * @param taker Taker order
7944
7855
  * @param signature Signature of the maker order
7945
- * @param merkleTree If the maker has been signed with a merkle tree
7856
+ * @param merkleTree Optional merkle tree
7946
7857
  * @returns ContractMethods
7947
7858
  */
7948
7859
  executeOrder(maker, taker, signature, merkleTree = defaultMerkleTree, overrides) {
@@ -7985,7 +7896,7 @@ class HypercertExchangeClient {
7985
7896
  return incrementBidAskNonces(signer, this.addresses.EXCHANGE_V2, bid, ask, overrides);
7986
7897
  }
7987
7898
  /**
7988
- * Cancel a list of specific orders
7899
+ * Cancel a list of orders by nonce
7989
7900
  * @param nonces List of nonces to be cancelled
7990
7901
  * @returns ContractMethods
7991
7902
  */
@@ -7994,16 +7905,7 @@ class HypercertExchangeClient {
7994
7905
  return cancelOrderNonces(signer, this.addresses.EXCHANGE_V2, nonces, overrides);
7995
7906
  }
7996
7907
  /**
7997
- * Cancel a list of specific subset orders
7998
- * @param nonces List of nonces to be cancelled
7999
- * @returns ContractMethods
8000
- */
8001
- cancelSubsetOrders(nonces, overrides) {
8002
- const signer = this.getSigner();
8003
- return cancelSubsetNonces(signer, this.addresses.EXCHANGE_V2, nonces, overrides);
8004
- }
8005
- /**
8006
- * Approve all the items of a collection, to eventually be traded on HypercertExchange
7908
+ * Approve all the items of a collection, to eventually be traded on the Hypercert Exchange
8007
7909
  * The spender is the TransferManager.
8008
7910
  * @param collectionAddress Address of the collection to be approved.
8009
7911
  * @param approved true to approve, false to revoke the approval (default to true)
@@ -8015,7 +7917,7 @@ class HypercertExchangeClient {
8015
7917
  return setApprovalForAll(signer, collectionAddress, spenderAddress, approved, overrides);
8016
7918
  }
8017
7919
  /**
8018
- * Approve an ERC20 to be used as a currency on HypercertExchange.
7920
+ * Approve an ERC20 to be used as a currency on the Hypercert Exchange.
8019
7921
  * The spender is the HypercertExchangeProtocol contract.
8020
7922
  * @param tokenAddress Address of the ERC20 to approve
8021
7923
  * @param amount Amount to be approved (default to MaxUint256)
@@ -8056,17 +7958,6 @@ class HypercertExchangeClient {
8056
7958
  const signer = this.getSigner();
8057
7959
  return revokeApprovals(signer, this.addresses.TRANSFER_MANAGER_V2, operators, overrides);
8058
7960
  }
8059
- /**
8060
- * Transfer a list of items across different collections
8061
- * @param to Recipient address
8062
- * @param collectionItems Each object in the array represent a list of items for a specific collection
8063
- * @returns ContractMethods
8064
- */
8065
- async transferItemsAcrossCollection(to, collectionItems, overrides) {
8066
- const signer = this.getSigner();
8067
- const from = await signer.getAddress();
8068
- return transferBatchItemsAcrossCollections(signer, this.addresses.TRANSFER_MANAGER_V2, collectionItems, from, to, overrides);
8069
- }
8070
7961
  /**
8071
7962
  * Verify if a set of orders can be executed (i.e are valid)
8072
7963
  * @param makerOrders List of maker orders
@@ -8129,12 +8020,7 @@ class HypercertExchangeClient {
8129
8020
  }
8130
8021
  /**
8131
8022
  * Create a maker ask for a collection or singular offer of fractions
8132
- * @param itemIds Token IDs of the fractions to be sold
8133
- * @param price Price of the fractions in wei
8134
- * @param startTime Timestamp in seconds when the order becomes valid
8135
- * @param endTime Timestamp in seconds when the order becomes invalid
8136
- * @param currency Currency used to buy the fractions (default to WETH)
8137
- * @param additionalParameters Additional parameters used to support complex orders
8023
+ * @param CreateDirectFractionsSaleMakerAskInput
8138
8024
  */
8139
8025
  async createDirectFractionsSaleMakerAsk({ itemIds, price, startTime, endTime, currency, additionalParameters = [], }) {
8140
8026
  const address = await this.signer?.getAddress();
@@ -8149,7 +8035,6 @@ class HypercertExchangeClient {
8149
8035
  address,
8150
8036
  chainId,
8151
8037
  });
8152
- const amounts = Array.from({ length: itemIds.length }, () => 1);
8153
8038
  return this.createMakerAsk({
8154
8039
  // Defaults
8155
8040
  strategyId: StrategyType.standard,
@@ -8157,7 +8042,6 @@ class HypercertExchangeClient {
8157
8042
  collection: this.addresses.MINTER,
8158
8043
  subsetNonce: 0,
8159
8044
  currency,
8160
- amounts,
8161
8045
  orderNonce: nonce_counter.toString(),
8162
8046
  // User specified
8163
8047
  itemIds,
@@ -8168,17 +8052,8 @@ class HypercertExchangeClient {
8168
8052
  });
8169
8053
  }
8170
8054
  /**
8171
- * Create a maker ask to let the buyer decide how much of the fraction they want to buy
8172
- * @param itemIds Token IDs of the fractions to be sold
8173
- * @param price Price of one unit in wei
8174
- * @param startTime Timestamp in seconds when the order becomes valid
8175
- * @param endTime Timestamp in seconds when the order becomes invalid
8176
- * @param currency Currency used to buy the fractions (default to WETH)
8177
- * @param maxUnitAmount Maximum amount of units that can be bought in a single transaction
8178
- * @param minUnitAmount Minimum amount of units that can be bought in a single transaction
8179
- * @param minUnitsToKeep Minimum amount of units that the seller wants to keep
8180
- * @param sellLeftoverFraction Whether or not the seller wants to sell the leftover units
8181
- * @param root Merkle tree root (optional)
8055
+ * Create a maker ask to let the buyer decide how much of a fraction they want to buy
8056
+ * @param CreateFractionalSaleMakerInput
8182
8057
  */
8183
8058
  async createFractionalSaleMakerAsk({ itemIds, price, startTime, endTime, currency, maxUnitAmount, minUnitAmount, minUnitsToKeep, sellLeftoverFraction, root, }) {
8184
8059
  const address = await this.signer?.getAddress();
@@ -8196,7 +8071,7 @@ class HypercertExchangeClient {
8196
8071
  const amounts = Array.from({ length: itemIds.length }, () => 1);
8197
8072
  const sharedArgs = {
8198
8073
  // Defaults
8199
- collectionType: 2,
8074
+ collectionType: CollectionType.HYPERCERT,
8200
8075
  collection: this.addresses.MINTER,
8201
8076
  subsetNonce: 0,
8202
8077
  currency,
@@ -8222,7 +8097,7 @@ class HypercertExchangeClient {
8222
8097
  });
8223
8098
  }
8224
8099
  /**
8225
- * Create a taker bid for buying a fraction of an open fractional sale
8100
+ * Create a taker bid for buying part of a fraction
8226
8101
  * @param maker Maker order
8227
8102
  * @param recipient Recipient address of the taker (if none, it will use the sender)
8228
8103
  * @param unitAmount Amount of units to buy
@@ -8235,7 +8110,7 @@ class HypercertExchangeClient {
8235
8110
  };
8236
8111
  }
8237
8112
  /**
8238
- * Register the order with hypercerts marketplace API.
8113
+ * Register the order with the hypercerts marketplace API
8239
8114
  * @param order Maker order
8240
8115
  * @param signature Signature of the maker order
8241
8116
  */
@@ -8254,7 +8129,7 @@ class HypercertExchangeClient {
8254
8129
  });
8255
8130
  }
8256
8131
  /**
8257
- * Delete the order
8132
+ * Delete the order from the hypercerts marketplace API
8258
8133
  * @param orderId Order ID
8259
8134
  */
8260
8135
  async deleteOrder(orderId) {