@hypercerts-org/marketplace-sdk 0.3.6 → 0.3.7
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 +33 -5
- package/dist/index.esm.js +34 -6
- package/dist/utils/graphl.d.ts +9 -0
- package/package.json +5 -2
package/dist/index.cjs.js
CHANGED
@@ -6,6 +6,8 @@ var merkletreejs = require('merkletreejs');
|
|
6
6
|
var jsSha3 = require('js-sha3');
|
7
7
|
var supabaseJs = require('@supabase/supabase-js');
|
8
8
|
var sdk = require('@hypercerts-org/sdk');
|
9
|
+
var core = require('@urql/core');
|
10
|
+
var gql_tada = require('gql.tada');
|
9
11
|
|
10
12
|
var abiIERC721 = [
|
11
13
|
{
|
@@ -4804,6 +4806,35 @@ const contractName = "LooksRareProtocol";
|
|
4804
4806
|
*/
|
4805
4807
|
const version = 2;
|
4806
4808
|
|
4809
|
+
const urqlClient = new core.Client({
|
4810
|
+
url: sdk.CONSTANTS.ENDPOINTS["test"],
|
4811
|
+
exchanges: [core.cacheExchange, core.fetchExchange],
|
4812
|
+
});
|
4813
|
+
const fractionsByIdQuery = gql_tada.graphql(`
|
4814
|
+
query fractionsById($fraction_id: String!) {
|
4815
|
+
fractions(where: { hypercert_id: { eq: $fraction_id } }) {
|
4816
|
+
data {
|
4817
|
+
creation_block_timestamp
|
4818
|
+
fraction_id
|
4819
|
+
last_block_update_timestamp
|
4820
|
+
owner_address
|
4821
|
+
units
|
4822
|
+
}
|
4823
|
+
}
|
4824
|
+
}
|
4825
|
+
`);
|
4826
|
+
const getFractionsById = async (fractionId) => {
|
4827
|
+
const { data, error } = await urqlClient
|
4828
|
+
.query(fractionsByIdQuery, {
|
4829
|
+
fraction_id: fractionId,
|
4830
|
+
})
|
4831
|
+
.toPromise();
|
4832
|
+
if (error) {
|
4833
|
+
throw new Error(error.message);
|
4834
|
+
}
|
4835
|
+
return data?.fractions.data;
|
4836
|
+
};
|
4837
|
+
|
4807
4838
|
const HYPERCERTS_MARKETPLACE_API_URL = "https://staging-api.hypercerts.org/v1";
|
4808
4839
|
const SUPABASE_HYPERCERTS_URL = "https://zgvoyckkistexkfdmjqc.supabase.co";
|
4809
4840
|
const SUPABASE_HYPERCERTS_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inpndm95Y2traXN0ZXhrZmRtanFjIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTc4ODM1MjAsImV4cCI6MjAxMzQ1OTUyMH0.6FWDhwP3ZOM1O3ObvyRKtOsvwhJjbrZL2B1N-0MSpFg";
|
@@ -4885,11 +4916,8 @@ class ApiClient {
|
|
4885
4916
|
* @param chainId Chain ID
|
4886
4917
|
*/
|
4887
4918
|
this.fetchOrdersByHypercertId = async ({ hypercertId }) => {
|
4888
|
-
const
|
4889
|
-
|
4890
|
-
});
|
4891
|
-
const fractions = await hypercertsClient.indexer.fractionsByHypercert({ hypercertId });
|
4892
|
-
const tokenIds = fractions?.hypercerts.data?.flatMap((hypercert) => hypercert.fractions?.data?.map((fraction) => sdk.parseClaimOrFractionId(fraction.fraction_id).id)) || [];
|
4919
|
+
const fractions = await getFractionsById(hypercertId);
|
4920
|
+
const tokenIds = fractions?.flatMap(() => fractions.map((fraction) => sdk.parseClaimOrFractionId(fraction.fraction_id).id)) || [];
|
4893
4921
|
const result = await supabaseHypercerts.from("marketplace_orders").select("*").overlaps("itemIds", tokenIds);
|
4894
4922
|
return result;
|
4895
4923
|
};
|
package/dist/index.esm.js
CHANGED
@@ -3,7 +3,9 @@ import { HypercertExchangeAbi, TransferManagerAbi, OrderValidatorV2AAbi, deploym
|
|
3
3
|
import { MerkleTree } from 'merkletreejs';
|
4
4
|
import { keccak256 as keccak256$1 } from 'js-sha3';
|
5
5
|
import { createClient } from '@supabase/supabase-js';
|
6
|
-
import {
|
6
|
+
import { CONSTANTS, parseClaimOrFractionId } from '@hypercerts-org/sdk';
|
7
|
+
import { Client, cacheExchange, fetchExchange } from '@urql/core';
|
8
|
+
import { graphql } from 'gql.tada';
|
7
9
|
|
8
10
|
var abiIERC721 = [
|
9
11
|
{
|
@@ -4802,6 +4804,35 @@ const contractName = "LooksRareProtocol";
|
|
4802
4804
|
*/
|
4803
4805
|
const version = 2;
|
4804
4806
|
|
4807
|
+
const urqlClient = new Client({
|
4808
|
+
url: CONSTANTS.ENDPOINTS["test"],
|
4809
|
+
exchanges: [cacheExchange, fetchExchange],
|
4810
|
+
});
|
4811
|
+
const fractionsByIdQuery = graphql(`
|
4812
|
+
query fractionsById($fraction_id: String!) {
|
4813
|
+
fractions(where: { hypercert_id: { eq: $fraction_id } }) {
|
4814
|
+
data {
|
4815
|
+
creation_block_timestamp
|
4816
|
+
fraction_id
|
4817
|
+
last_block_update_timestamp
|
4818
|
+
owner_address
|
4819
|
+
units
|
4820
|
+
}
|
4821
|
+
}
|
4822
|
+
}
|
4823
|
+
`);
|
4824
|
+
const getFractionsById = async (fractionId) => {
|
4825
|
+
const { data, error } = await urqlClient
|
4826
|
+
.query(fractionsByIdQuery, {
|
4827
|
+
fraction_id: fractionId,
|
4828
|
+
})
|
4829
|
+
.toPromise();
|
4830
|
+
if (error) {
|
4831
|
+
throw new Error(error.message);
|
4832
|
+
}
|
4833
|
+
return data?.fractions.data;
|
4834
|
+
};
|
4835
|
+
|
4805
4836
|
const HYPERCERTS_MARKETPLACE_API_URL = "https://staging-api.hypercerts.org/v1";
|
4806
4837
|
const SUPABASE_HYPERCERTS_URL = "https://zgvoyckkistexkfdmjqc.supabase.co";
|
4807
4838
|
const SUPABASE_HYPERCERTS_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inpndm95Y2traXN0ZXhrZmRtanFjIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTc4ODM1MjAsImV4cCI6MjAxMzQ1OTUyMH0.6FWDhwP3ZOM1O3ObvyRKtOsvwhJjbrZL2B1N-0MSpFg";
|
@@ -4883,11 +4914,8 @@ class ApiClient {
|
|
4883
4914
|
* @param chainId Chain ID
|
4884
4915
|
*/
|
4885
4916
|
this.fetchOrdersByHypercertId = async ({ hypercertId }) => {
|
4886
|
-
const
|
4887
|
-
|
4888
|
-
});
|
4889
|
-
const fractions = await hypercertsClient.indexer.fractionsByHypercert({ hypercertId });
|
4890
|
-
const tokenIds = fractions?.hypercerts.data?.flatMap((hypercert) => hypercert.fractions?.data?.map((fraction) => parseClaimOrFractionId(fraction.fraction_id).id)) || [];
|
4917
|
+
const fractions = await getFractionsById(hypercertId);
|
4918
|
+
const tokenIds = fractions?.flatMap(() => fractions.map((fraction) => parseClaimOrFractionId(fraction.fraction_id).id)) || [];
|
4891
4919
|
const result = await supabaseHypercerts.from("marketplace_orders").select("*").overlaps("itemIds", tokenIds);
|
4892
4920
|
return result;
|
4893
4921
|
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Client } from "@urql/core";
|
2
|
+
export declare const urqlClient: Client;
|
3
|
+
export declare const getFractionsById: (fractionId: string) => Promise<{
|
4
|
+
units: unknown;
|
5
|
+
owner_address: string | null;
|
6
|
+
last_block_update_timestamp: unknown;
|
7
|
+
fraction_id: string | null;
|
8
|
+
creation_block_timestamp: unknown;
|
9
|
+
}[] | null | undefined>;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hypercerts-org/marketplace-sdk",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.7",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "dist/index.cjs.js",
|
6
6
|
"module": "dist/index.esm.js",
|
@@ -45,6 +45,7 @@
|
|
45
45
|
"ethers": "^6.6.2"
|
46
46
|
},
|
47
47
|
"devDependencies": {
|
48
|
+
"@0no-co/graphqlsp": "^1.12.8",
|
48
49
|
"@commitlint/cli": "^17.0.2",
|
49
50
|
"@commitlint/config-conventional": "^17.0.2",
|
50
51
|
"@hypercerts-org/contracts": "2.0.0-alpha.0",
|
@@ -91,9 +92,11 @@
|
|
91
92
|
"typescript": "^5.3.3"
|
92
93
|
},
|
93
94
|
"dependencies": {
|
94
|
-
"@hypercerts-org/sdk": "2.0.0-alpha.
|
95
|
+
"@hypercerts-org/sdk": "2.0.0-alpha.26",
|
95
96
|
"@supabase/supabase-js": "^2.39.2",
|
97
|
+
"@urql/core": "^5.0.4",
|
96
98
|
"ethers": "^6.6.2",
|
99
|
+
"gql.tada": "^1.7.6",
|
97
100
|
"merkletreejs": "^0.3.9"
|
98
101
|
}
|
99
102
|
}
|