@hypercerts-org/marketplace-sdk 0.0.6 → 0.0.8

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.
@@ -136,6 +136,11 @@ export declare class LooksRare {
136
136
  merkleTree?: MerkleTree;
137
137
  }[], isAtomic: boolean, overrides?: Overrides): {
138
138
  call: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => any;
139
+ /**
140
+ * Validate a timestamp format (seconds)
141
+ * @param timestamp
142
+ * @returns boolean
143
+ */
139
144
  estimateGas: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => any;
140
145
  callStatic: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => any;
141
146
  };
package/dist/index.cjs.js CHANGED
@@ -504,7 +504,6 @@ const executeTakerBid = (signer, address, taker, maker, makerSignature, merkleTr
504
504
  ...(maker.currency === ethers.ZeroAddress && { value: maker.price }),
505
505
  };
506
506
  const contract = new ethers.Contract(address, contracts.HypercertExchangeAbi).connect(signer);
507
- console.log(taker, maker);
508
507
  return {
509
508
  call: (additionalOverrides) => contract.executeTakerBid.send(taker, maker, makerSignature, merkleTree, {
510
509
  ...overridesWithValue,
@@ -657,6 +656,8 @@ const verifyMakerOrders = async (signerOrProvider, address, makerOrders, signatu
657
656
  const orders = await contract.checkMultipleMakerOrderValidities(makerOrders, signatures, merkleTrees, {
658
657
  ...overrides,
659
658
  });
659
+ // TODO: Fix types
660
+ // @ts-ignore
660
661
  return orders.map((order) => order.map((code) => Number(code)));
661
662
  };
662
663
 
@@ -1059,6 +1060,18 @@ var signMakerOrders = /*#__PURE__*/Object.freeze({
1059
1060
  signMerkleTreeOrders: signMerkleTreeOrders
1060
1061
  });
1061
1062
 
1063
+ const asDeployedChain = (chainId) => {
1064
+ if (!Object.values(exports.ChainId).includes(chainId)) {
1065
+ throw new Error(`Invalid chainId: ${chainId}`);
1066
+ }
1067
+ return chainId;
1068
+ };
1069
+
1070
+ var asDeployedChain$1 = /*#__PURE__*/Object.freeze({
1071
+ __proto__: null,
1072
+ asDeployedChain: asDeployedChain
1073
+ });
1074
+
1062
1075
  const goerliAddresses = {
1063
1076
  EXCHANGE_V2: contracts.deployments[5].HypercertExchange,
1064
1077
  TRANSFER_MANAGER_V2: contracts.deployments[5].TransferManager,
@@ -4791,8 +4804,6 @@ class LooksRare {
4791
4804
  constructor(chainId, provider, signer, override) {
4792
4805
  this.chainId = chainId;
4793
4806
  this.addresses = override ?? addressesByNetwork[this.chainId];
4794
- console.log(contracts.deployments);
4795
- console.log("addresses", override, chainId, this.addresses);
4796
4807
  this.signer = signer;
4797
4808
  this.provider = provider;
4798
4809
  }
@@ -5033,7 +5044,6 @@ class LooksRare {
5033
5044
  executeOrder(maker, taker, signature, merkleTree = defaultMerkleTree, overrides) {
5034
5045
  const signer = this.getSigner();
5035
5046
  const execute = maker.quoteType === exports.QuoteType.Ask ? executeTakerBid : executeTakerAsk;
5036
- console.log("got this far", maker.quoteType === exports.QuoteType.Ask);
5037
5047
  return execute(signer, this.addresses.EXCHANGE_V2, taker, maker, signature, merkleTree, overrides);
5038
5048
  }
5039
5049
  /**
@@ -5185,6 +5195,7 @@ const utils = {
5185
5195
  ...encode,
5186
5196
  ...signMakerOrders,
5187
5197
  ...eip712,
5198
+ ...asDeployedChain$1,
5188
5199
  };
5189
5200
 
5190
5201
  exports.Eip712MakerMerkleTree = Eip712MakerMerkleTree;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  declare const utils: {
2
+ asDeployedChain: (chainId: number) => import("./types").ChainId;
2
3
  MAKER_HASH: "0x003c1bce41a2de73dfe64d6eeb2b3d7f15f1c0c382d9d963c2c6daeb75f0e539";
3
4
  hashingMakerTypes: string[];
4
5
  makerTypes: import("./types").EIP712TypedData;
package/dist/index.esm.js CHANGED
@@ -502,7 +502,6 @@ const executeTakerBid = (signer, address, taker, maker, makerSignature, merkleTr
502
502
  ...(maker.currency === ZeroAddress && { value: maker.price }),
503
503
  };
504
504
  const contract = new Contract(address, HypercertExchangeAbi).connect(signer);
505
- console.log(taker, maker);
506
505
  return {
507
506
  call: (additionalOverrides) => contract.executeTakerBid.send(taker, maker, makerSignature, merkleTree, {
508
507
  ...overridesWithValue,
@@ -655,6 +654,8 @@ const verifyMakerOrders = async (signerOrProvider, address, makerOrders, signatu
655
654
  const orders = await contract.checkMultipleMakerOrderValidities(makerOrders, signatures, merkleTrees, {
656
655
  ...overrides,
657
656
  });
657
+ // TODO: Fix types
658
+ // @ts-ignore
658
659
  return orders.map((order) => order.map((code) => Number(code)));
659
660
  };
660
661
 
@@ -1057,6 +1058,18 @@ var signMakerOrders = /*#__PURE__*/Object.freeze({
1057
1058
  signMerkleTreeOrders: signMerkleTreeOrders
1058
1059
  });
1059
1060
 
1061
+ const asDeployedChain = (chainId) => {
1062
+ if (!Object.values(ChainId).includes(chainId)) {
1063
+ throw new Error(`Invalid chainId: ${chainId}`);
1064
+ }
1065
+ return chainId;
1066
+ };
1067
+
1068
+ var asDeployedChain$1 = /*#__PURE__*/Object.freeze({
1069
+ __proto__: null,
1070
+ asDeployedChain: asDeployedChain
1071
+ });
1072
+
1060
1073
  const goerliAddresses = {
1061
1074
  EXCHANGE_V2: deployments[5].HypercertExchange,
1062
1075
  TRANSFER_MANAGER_V2: deployments[5].TransferManager,
@@ -4789,8 +4802,6 @@ class LooksRare {
4789
4802
  constructor(chainId, provider, signer, override) {
4790
4803
  this.chainId = chainId;
4791
4804
  this.addresses = override ?? addressesByNetwork[this.chainId];
4792
- console.log(deployments);
4793
- console.log("addresses", override, chainId, this.addresses);
4794
4805
  this.signer = signer;
4795
4806
  this.provider = provider;
4796
4807
  }
@@ -5031,7 +5042,6 @@ class LooksRare {
5031
5042
  executeOrder(maker, taker, signature, merkleTree = defaultMerkleTree, overrides) {
5032
5043
  const signer = this.getSigner();
5033
5044
  const execute = maker.quoteType === QuoteType.Ask ? executeTakerBid : executeTakerAsk;
5034
- console.log("got this far", maker.quoteType === QuoteType.Ask);
5035
5045
  return execute(signer, this.addresses.EXCHANGE_V2, taker, maker, signature, merkleTree, overrides);
5036
5046
  }
5037
5047
  /**
@@ -5183,6 +5193,7 @@ const utils = {
5183
5193
  ...encode,
5184
5194
  ...signMakerOrders,
5185
5195
  ...eip712,
5196
+ ...asDeployedChain$1,
5186
5197
  };
5187
5198
 
5188
5199
  export { ChainId, CollectionType, Eip712MakerMerkleTree, Eip712MerkleTree, ErrorItemId, ErrorMerkleTreeDepth, ErrorQuoteType, ErrorSigner, ErrorStrategyType, ErrorTimestamp, IERC1155 as IERC1155Abi, abiIERC20 as IERC20Abi, abiIERC721 as IERC721Abi, LooksRare, LooksRareProtocol as LooksRareProtocolAbi, MAX_ORDERS_PER_TREE, MerkleTreeNodePosition, OrderValidatorCode, OrderValidatorV2A as OrderValidatorV2AAbi, QuoteType, StrategyType, TransferManager as TransferManagerAbi, WETH as WETHAbi, addressesByNetwork, chainInfo, defaultMerkleTree, utils };
@@ -0,0 +1,2 @@
1
+ import { ChainId } from "../types";
2
+ export declare const asDeployedChain: (chainId: number) => ChainId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypercerts-org/marketplace-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",