@hypercerts-org/marketplace-sdk 0.3.0 → 0.3.2
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 +14 -13
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +14 -14
- package/dist/utils/api.d.ts +2 -6
- package/package.json +16 -16
package/dist/index.cjs.js
CHANGED
@@ -1098,14 +1098,14 @@ const sepoliaAddresses = {
|
|
1098
1098
|
TRANSFER_MANAGER_V2: contracts.deployments[11155111].TransferManager,
|
1099
1099
|
ORDER_VALIDATOR_V2: contracts.deployments[11155111].OrderValidatorV2A,
|
1100
1100
|
WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
|
1101
|
-
MINTER: contracts.deployments[11155111].HypercertMinterUUPS
|
1101
|
+
MINTER: contracts.deployments[11155111].HypercertMinterUUPS,
|
1102
1102
|
};
|
1103
1103
|
/**
|
1104
1104
|
* List of useful contract addresses
|
1105
1105
|
*/
|
1106
1106
|
const addressesByNetwork = {
|
1107
1107
|
[exports.ChainId.SEPOLIA]: sepoliaAddresses,
|
1108
|
-
[exports.ChainId.HARDHAT]: sepoliaAddresses
|
1108
|
+
[exports.ChainId.HARDHAT]: sepoliaAddresses,
|
1109
1109
|
};
|
1110
1110
|
|
1111
1111
|
const chainInfo = {
|
@@ -4804,9 +4804,9 @@ const contractName = "LooksRareProtocol";
|
|
4804
4804
|
*/
|
4805
4805
|
const version = 2;
|
4806
4806
|
|
4807
|
-
const HYPERCERTS_MARKETPLACE_API_URL =
|
4808
|
-
const SUPABASE_HYPERCERTS_URL =
|
4809
|
-
const SUPABASE_HYPERCERTS_ANON_KEY =
|
4807
|
+
const HYPERCERTS_MARKETPLACE_API_URL = "https://staging-api.hypercerts.org/v1";
|
4808
|
+
const SUPABASE_HYPERCERTS_URL = "https://zgvoyckkistexkfdmjqc.supabase.co";
|
4809
|
+
const SUPABASE_HYPERCERTS_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inpndm95Y2traXN0ZXhrZmRtanFjIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTc4ODM1MjAsImV4cCI6MjAxMzQ1OTUyMH0.6FWDhwP3ZOM1O3ObvyRKtOsvwhJjbrZL2B1N-0MSpFg";
|
4810
4810
|
const supabaseHypercerts = supabaseJs.createClient(SUPABASE_HYPERCERTS_URL, SUPABASE_HYPERCERTS_ANON_KEY);
|
4811
4811
|
class ApiClient {
|
4812
4812
|
constructor(baseUrl) {
|
@@ -4820,12 +4820,12 @@ class ApiClient {
|
|
4820
4820
|
return fetch(`${this._baseUrl}/marketplace/order-nonce/`, {
|
4821
4821
|
method: "POST",
|
4822
4822
|
headers: {
|
4823
|
-
"Content-Type": "application/json"
|
4823
|
+
"Content-Type": "application/json",
|
4824
4824
|
},
|
4825
4825
|
body: JSON.stringify({
|
4826
4826
|
address,
|
4827
|
-
chainId
|
4828
|
-
})
|
4827
|
+
chainId,
|
4828
|
+
}),
|
4829
4829
|
})
|
4830
4830
|
.then((res) => this.handleResponse(res))
|
4831
4831
|
.then((res) => res.data);
|
@@ -4838,12 +4838,12 @@ class ApiClient {
|
|
4838
4838
|
* @param quoteType Quote type
|
4839
4839
|
* @param chainId Chain ID
|
4840
4840
|
*/
|
4841
|
-
this.registerOrder = async ({ order, signer, signature, quoteType, chainId }) => {
|
4841
|
+
this.registerOrder = async ({ order, signer, signature, quoteType, chainId, }) => {
|
4842
4842
|
const { globalNonce, ...orderWithoutGlobalNonce } = order;
|
4843
4843
|
return fetch(`${this._baseUrl}/marketplace/orders/`, {
|
4844
4844
|
method: "POST",
|
4845
4845
|
headers: {
|
4846
|
-
"Content-Type": "application/json"
|
4846
|
+
"Content-Type": "application/json",
|
4847
4847
|
},
|
4848
4848
|
body: JSON.stringify({
|
4849
4849
|
...orderWithoutGlobalNonce,
|
@@ -4852,8 +4852,8 @@ class ApiClient {
|
|
4852
4852
|
quoteType,
|
4853
4853
|
signer,
|
4854
4854
|
signature,
|
4855
|
-
chainId
|
4856
|
-
})
|
4855
|
+
chainId,
|
4856
|
+
}),
|
4857
4857
|
}).then((res) => this.handleResponse(res));
|
4858
4858
|
};
|
4859
4859
|
/**
|
@@ -4886,7 +4886,7 @@ class ApiClient {
|
|
4886
4886
|
*/
|
4887
4887
|
this.fetchOrdersByHypercertId = async ({ hypercertId, chainId }) => {
|
4888
4888
|
const hypercertsClient = new sdk.HypercertClient({
|
4889
|
-
chain: { id: chainId }
|
4889
|
+
chain: { id: chainId },
|
4890
4890
|
});
|
4891
4891
|
const fractions = await hypercertsClient.indexer.fractionsByHypercert({ hypercertId });
|
4892
4892
|
const tokenIds = fractions?.hypercerts.data?.flatMap((hypercert) => hypercert.fractions?.data?.map((fraction) => fraction.hypercert_id)) || [];
|
@@ -5435,6 +5435,7 @@ const utils = {
|
|
5435
5435
|
...asDeployedChain$1,
|
5436
5436
|
};
|
5437
5437
|
|
5438
|
+
exports.ApiClient = ApiClient;
|
5438
5439
|
exports.Eip712MakerMerkleTree = Eip712MakerMerkleTree;
|
5439
5440
|
exports.Eip712MerkleTree = Eip712MerkleTree;
|
5440
5441
|
exports.ErrorItemId = ErrorItemId;
|
package/dist/index.d.ts
CHANGED
@@ -44,3 +44,4 @@ export * from "./abis";
|
|
44
44
|
export { Eip712MakerMerkleTree } from "./utils/Eip712MakerMerkleTree";
|
45
45
|
export { Eip712MerkleTree } from "./utils/Eip712MerkleTree";
|
46
46
|
export { HypercertExchangeClient } from "./HypercertExchangeClient";
|
47
|
+
export { ApiClient } from "./utils/api";
|
package/dist/index.esm.js
CHANGED
@@ -1096,14 +1096,14 @@ const sepoliaAddresses = {
|
|
1096
1096
|
TRANSFER_MANAGER_V2: deployments[11155111].TransferManager,
|
1097
1097
|
ORDER_VALIDATOR_V2: deployments[11155111].OrderValidatorV2A,
|
1098
1098
|
WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
|
1099
|
-
MINTER: deployments[11155111].HypercertMinterUUPS
|
1099
|
+
MINTER: deployments[11155111].HypercertMinterUUPS,
|
1100
1100
|
};
|
1101
1101
|
/**
|
1102
1102
|
* List of useful contract addresses
|
1103
1103
|
*/
|
1104
1104
|
const addressesByNetwork = {
|
1105
1105
|
[ChainId.SEPOLIA]: sepoliaAddresses,
|
1106
|
-
[ChainId.HARDHAT]: sepoliaAddresses
|
1106
|
+
[ChainId.HARDHAT]: sepoliaAddresses,
|
1107
1107
|
};
|
1108
1108
|
|
1109
1109
|
const chainInfo = {
|
@@ -4802,9 +4802,9 @@ const contractName = "LooksRareProtocol";
|
|
4802
4802
|
*/
|
4803
4803
|
const version = 2;
|
4804
4804
|
|
4805
|
-
const HYPERCERTS_MARKETPLACE_API_URL =
|
4806
|
-
const SUPABASE_HYPERCERTS_URL =
|
4807
|
-
const SUPABASE_HYPERCERTS_ANON_KEY =
|
4805
|
+
const HYPERCERTS_MARKETPLACE_API_URL = "https://staging-api.hypercerts.org/v1";
|
4806
|
+
const SUPABASE_HYPERCERTS_URL = "https://zgvoyckkistexkfdmjqc.supabase.co";
|
4807
|
+
const SUPABASE_HYPERCERTS_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inpndm95Y2traXN0ZXhrZmRtanFjIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTc4ODM1MjAsImV4cCI6MjAxMzQ1OTUyMH0.6FWDhwP3ZOM1O3ObvyRKtOsvwhJjbrZL2B1N-0MSpFg";
|
4808
4808
|
const supabaseHypercerts = createClient(SUPABASE_HYPERCERTS_URL, SUPABASE_HYPERCERTS_ANON_KEY);
|
4809
4809
|
class ApiClient {
|
4810
4810
|
constructor(baseUrl) {
|
@@ -4818,12 +4818,12 @@ class ApiClient {
|
|
4818
4818
|
return fetch(`${this._baseUrl}/marketplace/order-nonce/`, {
|
4819
4819
|
method: "POST",
|
4820
4820
|
headers: {
|
4821
|
-
"Content-Type": "application/json"
|
4821
|
+
"Content-Type": "application/json",
|
4822
4822
|
},
|
4823
4823
|
body: JSON.stringify({
|
4824
4824
|
address,
|
4825
|
-
chainId
|
4826
|
-
})
|
4825
|
+
chainId,
|
4826
|
+
}),
|
4827
4827
|
})
|
4828
4828
|
.then((res) => this.handleResponse(res))
|
4829
4829
|
.then((res) => res.data);
|
@@ -4836,12 +4836,12 @@ class ApiClient {
|
|
4836
4836
|
* @param quoteType Quote type
|
4837
4837
|
* @param chainId Chain ID
|
4838
4838
|
*/
|
4839
|
-
this.registerOrder = async ({ order, signer, signature, quoteType, chainId }) => {
|
4839
|
+
this.registerOrder = async ({ order, signer, signature, quoteType, chainId, }) => {
|
4840
4840
|
const { globalNonce, ...orderWithoutGlobalNonce } = order;
|
4841
4841
|
return fetch(`${this._baseUrl}/marketplace/orders/`, {
|
4842
4842
|
method: "POST",
|
4843
4843
|
headers: {
|
4844
|
-
"Content-Type": "application/json"
|
4844
|
+
"Content-Type": "application/json",
|
4845
4845
|
},
|
4846
4846
|
body: JSON.stringify({
|
4847
4847
|
...orderWithoutGlobalNonce,
|
@@ -4850,8 +4850,8 @@ class ApiClient {
|
|
4850
4850
|
quoteType,
|
4851
4851
|
signer,
|
4852
4852
|
signature,
|
4853
|
-
chainId
|
4854
|
-
})
|
4853
|
+
chainId,
|
4854
|
+
}),
|
4855
4855
|
}).then((res) => this.handleResponse(res));
|
4856
4856
|
};
|
4857
4857
|
/**
|
@@ -4884,7 +4884,7 @@ class ApiClient {
|
|
4884
4884
|
*/
|
4885
4885
|
this.fetchOrdersByHypercertId = async ({ hypercertId, chainId }) => {
|
4886
4886
|
const hypercertsClient = new HypercertClient({
|
4887
|
-
chain: { id: chainId }
|
4887
|
+
chain: { id: chainId },
|
4888
4888
|
});
|
4889
4889
|
const fractions = await hypercertsClient.indexer.fractionsByHypercert({ hypercertId });
|
4890
4890
|
const tokenIds = fractions?.hypercerts.data?.flatMap((hypercert) => hypercert.fractions?.data?.map((fraction) => fraction.hypercert_id)) || [];
|
@@ -5433,4 +5433,4 @@ const utils = {
|
|
5433
5433
|
...asDeployedChain$1,
|
5434
5434
|
};
|
5435
5435
|
|
5436
|
-
export { ChainId, CollectionType, Eip712MakerMerkleTree, Eip712MerkleTree, ErrorItemId, ErrorMerkleTreeDepth, ErrorQuoteType, ErrorSigner, ErrorStrategyType, ErrorTimestamp, HypercertExchangeClient, IERC1155 as IERC1155Abi, abiIERC20 as IERC20Abi, abiIERC721 as IERC721Abi, LooksRareProtocol as LooksRareProtocolAbi, MAX_ORDERS_PER_TREE, MerkleTreeNodePosition, OrderValidatorCode, OrderValidatorV2A as OrderValidatorV2AAbi, QuoteType, StrategyType, TransferManager as TransferManagerAbi, WETH as WETHAbi, addressesByNetwork, chainInfo, defaultMerkleTree, utils };
|
5436
|
+
export { ApiClient, ChainId, CollectionType, Eip712MakerMerkleTree, Eip712MerkleTree, ErrorItemId, ErrorMerkleTreeDepth, ErrorQuoteType, ErrorSigner, ErrorStrategyType, ErrorTimestamp, HypercertExchangeClient, IERC1155 as IERC1155Abi, abiIERC20 as IERC20Abi, abiIERC721 as IERC721Abi, LooksRareProtocol as LooksRareProtocolAbi, MAX_ORDERS_PER_TREE, MerkleTreeNodePosition, OrderValidatorCode, OrderValidatorV2A as OrderValidatorV2AAbi, QuoteType, StrategyType, TransferManager as TransferManagerAbi, WETH as WETHAbi, addressesByNetwork, chainInfo, defaultMerkleTree, utils };
|
package/dist/utils/api.d.ts
CHANGED
@@ -119,11 +119,7 @@ export declare const supabaseHypercerts: import("@supabase/supabase-js").Supabas
|
|
119
119
|
claimId: string | null;
|
120
120
|
created_at: string | null;
|
121
121
|
fractionCounter: number | null;
|
122
|
-
hidden: boolean;
|
123
|
-
* Fetches orders from api by hypercert ID
|
124
|
-
* @param hypercertId Hypercert ID
|
125
|
-
* @param chainId Chain ID
|
126
|
-
*/
|
122
|
+
hidden: boolean;
|
127
123
|
id: number;
|
128
124
|
};
|
129
125
|
Insert: {
|
@@ -753,7 +749,7 @@ export declare class ApiClient {
|
|
753
749
|
* @param quoteType Quote type
|
754
750
|
* @param chainId Chain ID
|
755
751
|
*/
|
756
|
-
registerOrder: ({ order, signer, signature, quoteType, chainId }: {
|
752
|
+
registerOrder: ({ order, signer, signature, quoteType, chainId, }: {
|
757
753
|
order: Maker;
|
758
754
|
signer: string;
|
759
755
|
signature: string;
|
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.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "dist/index.cjs.js",
|
6
6
|
"module": "dist/index.esm.js",
|
@@ -24,6 +24,20 @@
|
|
24
24
|
"engines": {
|
25
25
|
"node": ">= 16.15.1 <= 20.x"
|
26
26
|
},
|
27
|
+
"scripts": {
|
28
|
+
"prebuild": "rm -rf ./src/typechain ./src/artifacts cache dist",
|
29
|
+
"dev": "rollup -c --bundleConfigAsCjs -w",
|
30
|
+
"build:ts": "rollup -c --bundleConfigAsCjs",
|
31
|
+
"build:sc": "hardhat compile",
|
32
|
+
"build": "yarn build:sc && yarn build:ts",
|
33
|
+
"test": "nyc hardhat test",
|
34
|
+
"doc": "typedoc --plugin typedoc-plugin-markdown --tsconfig tsconfig.build.json",
|
35
|
+
"lint": "eslint --max-warnings 0 'src/**/*.{js,ts}'",
|
36
|
+
"format:check": "prettier --check 'src/**/*.{js,ts,json,yaml,yml,md}'",
|
37
|
+
"format:write": "prettier --write 'src/**/*.{js,ts,json,yaml,yml,md}'",
|
38
|
+
"release": "release-it --only-version --set-upstream",
|
39
|
+
"supabase:types:hypercerts": "npx supabase gen types typescript --project-id clagjjfinooizoqdkvqc --schema public > src/utils/hypercerts-database-types.ts"
|
40
|
+
},
|
27
41
|
"lint-staged": {
|
28
42
|
"*.{js,jsx,ts,tsx,json,yaml,yml}": "yarn format:write"
|
29
43
|
},
|
@@ -81,19 +95,5 @@
|
|
81
95
|
"@supabase/supabase-js": "^2.39.2",
|
82
96
|
"ethers": "^6.6.2",
|
83
97
|
"merkletreejs": "^0.3.9"
|
84
|
-
},
|
85
|
-
"scripts": {
|
86
|
-
"prebuild": "rm -rf ./src/typechain ./src/artifacts cache dist",
|
87
|
-
"dev": "rollup -c --bundleConfigAsCjs -w",
|
88
|
-
"build:ts": "rollup -c --bundleConfigAsCjs",
|
89
|
-
"build:sc": "hardhat compile",
|
90
|
-
"build": "yarn build:sc && yarn build:ts",
|
91
|
-
"test": "nyc hardhat test",
|
92
|
-
"doc": "typedoc --plugin typedoc-plugin-markdown --tsconfig tsconfig.build.json",
|
93
|
-
"lint": "eslint --max-warnings 0 'src/**/*.{js,ts}'",
|
94
|
-
"format:check": "prettier --check 'src/**/*.{js,ts,json,yaml,yml,md}'",
|
95
|
-
"format:write": "prettier --write 'src/**/*.{js,ts,json,yaml,yml,md}'",
|
96
|
-
"release": "release-it --only-version --set-upstream",
|
97
|
-
"supabase:types:hypercerts": "npx supabase gen types typescript --project-id clagjjfinooizoqdkvqc --schema public > src/utils/hypercerts-database-types.ts"
|
98
98
|
}
|
99
|
-
}
|
99
|
+
}
|