@hypercerts-org/marketplace-sdk 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -3,9 +3,9 @@
3
3
  var ethers = require('ethers');
4
4
  var contracts = require('@hypercerts-org/contracts');
5
5
  var merkletreejs = require('merkletreejs');
6
- var sdk = require('@hypercerts-org/sdk');
7
6
  var jsSha3 = require('js-sha3');
8
7
  var supabaseJs = require('@supabase/supabase-js');
8
+ var sdk = require('@hypercerts-org/sdk');
9
9
 
10
10
  var abiIERC721 = [
11
11
  {
@@ -1094,11 +1094,11 @@ var asDeployedChain$1 = /*#__PURE__*/Object.freeze({
1094
1094
  });
1095
1095
 
1096
1096
  const sepoliaAddresses = {
1097
- EXCHANGE_V2: sdk.deployments[11155111].addresses?.HypercertExchange,
1098
- TRANSFER_MANAGER_V2: sdk.deployments[11155111].addresses?.TransferManager,
1099
- ORDER_VALIDATOR_V2: sdk.deployments[11155111].addresses?.OrderValidator,
1097
+ EXCHANGE_V2: contracts.deployments[11155111].HypercertExchange,
1098
+ TRANSFER_MANAGER_V2: contracts.deployments[11155111].TransferManager,
1099
+ ORDER_VALIDATOR_V2: contracts.deployments[11155111].OrderValidatorV2A,
1100
1100
  WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
1101
- MINTER: sdk.deployments[11155111].addresses?.HypercertMinterUUPS,
1101
+ MINTER: contracts.deployments[11155111].HypercertMinterUUPS,
1102
1102
  };
1103
1103
  /**
1104
1104
  * List of useful contract addresses
@@ -4884,13 +4884,14 @@ class ApiClient {
4884
4884
  * @param hypercertId Hypercert ID
4885
4885
  * @param chainId Chain ID
4886
4886
  */
4887
- this.fetchOrdersByHypercertId = async ({ hypercertId, chainId }) => {
4887
+ this.fetchOrdersByHypercertId = async ({ hypercertId }) => {
4888
4888
  const hypercertsClient = new sdk.HypercertClient({
4889
- chain: { id: chainId },
4889
+ environment: "test",
4890
4890
  });
4891
- const fractions = await hypercertsClient.indexer.fractionsByClaim(hypercertId);
4892
- const tokenIds = fractions?.claimTokens.map((fraction) => fraction.tokenID) || [];
4893
- return supabaseHypercerts.from("marketplace_orders").select("*").containedBy("itemIds", tokenIds).throwOnError();
4891
+ const fractions = await hypercertsClient.indexer.fractionsByHypercert({ hypercertId });
4892
+ const tokenIds = fractions?.hypercerts.data?.flatMap((hypercert) => hypercert.fractions?.data?.map((fraction) => sdk.parseClaimOrFractionId(fraction.hypercert_id).id)) || [];
4893
+ const result = await supabaseHypercerts.from("marketplace_orders").select("*").overlaps("itemIds", tokenIds);
4894
+ return result;
4894
4895
  };
4895
4896
  this.handleResponse = async (res) => {
4896
4897
  if (!res.ok) {
package/dist/index.esm.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Contract, ZeroAddress, AbiCoder, TypedDataEncoder, keccak256, solidityPackedKeccak256, ethers, ZeroHash, MaxUint256 } from 'ethers';
2
- import { HypercertExchangeAbi, TransferManagerAbi, OrderValidatorV2A as OrderValidatorV2A$1 } from '@hypercerts-org/contracts';
2
+ import { HypercertExchangeAbi, TransferManagerAbi, OrderValidatorV2A as OrderValidatorV2A$1, deployments } from '@hypercerts-org/contracts';
3
3
  import { MerkleTree } from 'merkletreejs';
4
- import { deployments, HypercertClient } from '@hypercerts-org/sdk';
5
4
  import { keccak256 as keccak256$1 } from 'js-sha3';
6
5
  import { createClient } from '@supabase/supabase-js';
6
+ import { HypercertClient, parseClaimOrFractionId } from '@hypercerts-org/sdk';
7
7
 
8
8
  var abiIERC721 = [
9
9
  {
@@ -1092,11 +1092,11 @@ var asDeployedChain$1 = /*#__PURE__*/Object.freeze({
1092
1092
  });
1093
1093
 
1094
1094
  const sepoliaAddresses = {
1095
- EXCHANGE_V2: deployments[11155111].addresses?.HypercertExchange,
1096
- TRANSFER_MANAGER_V2: deployments[11155111].addresses?.TransferManager,
1097
- ORDER_VALIDATOR_V2: deployments[11155111].addresses?.OrderValidator,
1095
+ EXCHANGE_V2: deployments[11155111].HypercertExchange,
1096
+ TRANSFER_MANAGER_V2: deployments[11155111].TransferManager,
1097
+ ORDER_VALIDATOR_V2: deployments[11155111].OrderValidatorV2A,
1098
1098
  WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
1099
- MINTER: deployments[11155111].addresses?.HypercertMinterUUPS,
1099
+ MINTER: deployments[11155111].HypercertMinterUUPS,
1100
1100
  };
1101
1101
  /**
1102
1102
  * List of useful contract addresses
@@ -4882,13 +4882,14 @@ class ApiClient {
4882
4882
  * @param hypercertId Hypercert ID
4883
4883
  * @param chainId Chain ID
4884
4884
  */
4885
- this.fetchOrdersByHypercertId = async ({ hypercertId, chainId }) => {
4885
+ this.fetchOrdersByHypercertId = async ({ hypercertId }) => {
4886
4886
  const hypercertsClient = new HypercertClient({
4887
- chain: { id: chainId },
4887
+ environment: "test",
4888
4888
  });
4889
- const fractions = await hypercertsClient.indexer.fractionsByClaim(hypercertId);
4890
- const tokenIds = fractions?.claimTokens.map((fraction) => fraction.tokenID) || [];
4891
- return supabaseHypercerts.from("marketplace_orders").select("*").containedBy("itemIds", tokenIds).throwOnError();
4889
+ const fractions = await hypercertsClient.indexer.fractionsByHypercert({ hypercertId });
4890
+ const tokenIds = fractions?.hypercerts.data?.flatMap((hypercert) => hypercert.fractions?.data?.map((fraction) => parseClaimOrFractionId(fraction.hypercert_id).id)) || [];
4891
+ const result = await supabaseHypercerts.from("marketplace_orders").select("*").overlaps("itemIds", tokenIds);
4892
+ return result;
4892
4893
  };
4893
4894
  this.handleResponse = async (res) => {
4894
4895
  if (!res.ok) {