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