@hypercerts-org/marketplace-sdk 0.1.3 → 0.1.5
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 +10 -3
- package/dist/index.esm.js +10 -3
- package/dist/utils/api.d.ts +6 -7
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
@@ -4827,7 +4827,7 @@ class ApiClient {
|
|
4827
4827
|
chainId,
|
4828
4828
|
}),
|
4829
4829
|
})
|
4830
|
-
.then((res) =>
|
4830
|
+
.then((res) => this.handleResponse(res))
|
4831
4831
|
.then((res) => res.data);
|
4832
4832
|
};
|
4833
4833
|
/**
|
@@ -4854,7 +4854,7 @@ class ApiClient {
|
|
4854
4854
|
signature,
|
4855
4855
|
chainId,
|
4856
4856
|
}),
|
4857
|
-
}).then((res) =>
|
4857
|
+
}).then((res) => this.handleResponse(res));
|
4858
4858
|
};
|
4859
4859
|
/**
|
4860
4860
|
* Fetch existing open orders from the marketplace API
|
@@ -4889,9 +4889,16 @@ class ApiClient {
|
|
4889
4889
|
chain: { id: chainId },
|
4890
4890
|
});
|
4891
4891
|
const fractions = await hypercertsClient.indexer.fractionsByClaim(hypercertId);
|
4892
|
-
const tokenIds = fractions
|
4892
|
+
const tokenIds = fractions?.claimTokens.map((fraction) => fraction.tokenID) || [];
|
4893
4893
|
return supabaseHypercerts.from("marketplace-orders").select("*").containedBy("itemIds", tokenIds).throwOnError();
|
4894
4894
|
};
|
4895
|
+
this.handleResponse = async (res) => {
|
4896
|
+
if (!res.ok) {
|
4897
|
+
const error = await res.json();
|
4898
|
+
throw new Error(error.message);
|
4899
|
+
}
|
4900
|
+
return (await res.json());
|
4901
|
+
};
|
4895
4902
|
const url = baseUrl || HYPERCERTS_MARKETPLACE_API_URL;
|
4896
4903
|
if (!url) {
|
4897
4904
|
throw new Error("No API URL provided");
|
package/dist/index.esm.js
CHANGED
@@ -4825,7 +4825,7 @@ class ApiClient {
|
|
4825
4825
|
chainId,
|
4826
4826
|
}),
|
4827
4827
|
})
|
4828
|
-
.then((res) =>
|
4828
|
+
.then((res) => this.handleResponse(res))
|
4829
4829
|
.then((res) => res.data);
|
4830
4830
|
};
|
4831
4831
|
/**
|
@@ -4852,7 +4852,7 @@ class ApiClient {
|
|
4852
4852
|
signature,
|
4853
4853
|
chainId,
|
4854
4854
|
}),
|
4855
|
-
}).then((res) =>
|
4855
|
+
}).then((res) => this.handleResponse(res));
|
4856
4856
|
};
|
4857
4857
|
/**
|
4858
4858
|
* Fetch existing open orders from the marketplace API
|
@@ -4887,9 +4887,16 @@ class ApiClient {
|
|
4887
4887
|
chain: { id: chainId },
|
4888
4888
|
});
|
4889
4889
|
const fractions = await hypercertsClient.indexer.fractionsByClaim(hypercertId);
|
4890
|
-
const tokenIds = fractions
|
4890
|
+
const tokenIds = fractions?.claimTokens.map((fraction) => fraction.tokenID) || [];
|
4891
4891
|
return supabaseHypercerts.from("marketplace-orders").select("*").containedBy("itemIds", tokenIds).throwOnError();
|
4892
4892
|
};
|
4893
|
+
this.handleResponse = async (res) => {
|
4894
|
+
if (!res.ok) {
|
4895
|
+
const error = await res.json();
|
4896
|
+
throw new Error(error.message);
|
4897
|
+
}
|
4898
|
+
return (await res.json());
|
4899
|
+
};
|
4893
4900
|
const url = baseUrl || HYPERCERTS_MARKETPLACE_API_URL;
|
4894
4901
|
if (!url) {
|
4895
4902
|
throw new Error("No API URL provided");
|
package/dist/utils/api.d.ts
CHANGED
@@ -86,13 +86,6 @@ export declare const supabaseHypercerts: import("@supabase/supabase-js").Supabas
|
|
86
86
|
};
|
87
87
|
Relationships: [];
|
88
88
|
};
|
89
|
-
/**
|
90
|
-
* Fetch existing open orders from the marketplace API
|
91
|
-
* @param signer address of the user that created the order
|
92
|
-
* @param claimTokenIds a list of claimTokenIds - will return any order that is for one or more of these claimTokenIds
|
93
|
-
* @param chainId chain id for the order
|
94
|
-
* @param strategy strategy for the order
|
95
|
-
*/
|
96
89
|
"allowlistCache-optimism": {
|
97
90
|
Row: {
|
98
91
|
address: string | null;
|
@@ -123,6 +116,11 @@ export declare const supabaseHypercerts: import("@supabase/supabase-js").Supabas
|
|
123
116
|
"allowlistCache-sepolia": {
|
124
117
|
Row: {
|
125
118
|
address: string | null;
|
119
|
+
/**
|
120
|
+
* Fetches orders from api by hypercert ID
|
121
|
+
* @param hypercertId Hypercert ID
|
122
|
+
* @param chainId Chain ID
|
123
|
+
*/
|
126
124
|
claimId: string | null;
|
127
125
|
created_at: string | null;
|
128
126
|
fractionCounter: number | null;
|
@@ -822,6 +820,7 @@ export declare class ApiClient {
|
|
822
820
|
strategyId: number;
|
823
821
|
subsetNonce: number;
|
824
822
|
}[]>>;
|
823
|
+
handleResponse: <T>(res: Response) => Promise<T>;
|
825
824
|
}
|
826
825
|
interface FetchOrderArgs {
|
827
826
|
signer: `0x${string}`;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hypercerts-org/marketplace-sdk",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.5",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "dist/index.cjs.js",
|
6
6
|
"module": "dist/index.esm.js",
|
@@ -91,7 +91,7 @@
|
|
91
91
|
"typescript": "^5.3.3"
|
92
92
|
},
|
93
93
|
"dependencies": {
|
94
|
-
"@hypercerts-org/sdk": "
|
94
|
+
"@hypercerts-org/sdk": "2.0.0-alpha.4",
|
95
95
|
"@supabase/supabase-js": "^2.39.2",
|
96
96
|
"ethers": "^6.6.2",
|
97
97
|
"merkletreejs": "^0.3.9"
|