@hypercerts-org/marketplace-sdk 0.0.17 → 0.0.18
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/HypercertExchangeClient.d.ts +8 -0
- package/dist/index.cjs.js +68 -1
- package/dist/index.esm.js +68 -1
- package/dist/types.d.ts +9 -1
- package/package.json +2 -2
@@ -226,6 +226,14 @@ export declare class HypercertExchangeClient {
|
|
226
226
|
* @param additionalParameters Additional parameters used to support complex orders
|
227
227
|
*/
|
228
228
|
createDirectFractionsSaleMakerAsk({ itemIds, price, startTime, endTime, additionalParameters, }: Omit<CreateMakerInput, "strategyId" | "collectionType" | "collection" | "subsetNonce" | "orderNonce" | "amounts" | "currency">): Promise<CreateMakerAskOutput>;
|
229
|
+
createFractionalSaleMakerAsk({ itemIds, price, startTime, endTime, maxUnitAmount, minUnitAmount, minUnitsToKeep, sellLeftoverFraction, root, }: Omit<CreateMakerInput, "strategyId" | "collectionType" | "collection" | "subsetNonce" | "orderNonce" | "amounts" | "currency" | "additionalParameters"> & {
|
230
|
+
minUnitAmount: BigNumberish;
|
231
|
+
maxUnitAmount: BigNumberish;
|
232
|
+
minUnitsToKeep: BigNumberish;
|
233
|
+
sellLeftoverFraction: boolean;
|
234
|
+
root?: string;
|
235
|
+
}): Promise<CreateMakerAskOutput>;
|
236
|
+
createFractionalSaleTakerBid(maker: Maker, recipient: string | undefined, unitAmount: BigNumberish, pricePerUnit: BigNumberish): Taker;
|
229
237
|
/**
|
230
238
|
* Register the order with hypercerts marketplace API.
|
231
239
|
* @param order Maker order
|
package/dist/index.cjs.js
CHANGED
@@ -704,6 +704,14 @@ exports.StrategyType = void 0;
|
|
704
704
|
StrategyType[StrategyType["standard"] = 0] = "standard";
|
705
705
|
StrategyType[StrategyType["collection"] = 1] = "collection";
|
706
706
|
StrategyType[StrategyType["collectionWithMerkleTree"] = 2] = "collectionWithMerkleTree";
|
707
|
+
StrategyType[StrategyType["dutchAuction"] = 4] = "dutchAuction";
|
708
|
+
StrategyType[StrategyType["itemIdsRange"] = 5] = "itemIdsRange";
|
709
|
+
StrategyType[StrategyType["hypercertCollectionOffer"] = 6] = "hypercertCollectionOffer";
|
710
|
+
StrategyType[StrategyType["hypercertCollectionOfferWithProof"] = 7] = "hypercertCollectionOfferWithProof";
|
711
|
+
StrategyType[StrategyType["hypercertCollectionOfferWithAllowlist"] = 8] = "hypercertCollectionOfferWithAllowlist";
|
712
|
+
StrategyType[StrategyType["hypercertDutchAuction"] = 9] = "hypercertDutchAuction";
|
713
|
+
StrategyType[StrategyType["hypercertFractionOffer"] = 10] = "hypercertFractionOffer";
|
714
|
+
StrategyType[StrategyType["hypercertFractionOfferWithAllowlist"] = 11] = "hypercertFractionOfferWithAllowlist";
|
707
715
|
})(exports.StrategyType || (exports.StrategyType = {}));
|
708
716
|
/** Type for maker order */
|
709
717
|
exports.QuoteType = void 0;
|
@@ -786,6 +794,12 @@ const getMakerParamsTypes = (strategy) => {
|
|
786
794
|
if (strategy === exports.StrategyType.collectionWithMerkleTree) {
|
787
795
|
return ["bytes32"]; // Merkle tree root
|
788
796
|
}
|
797
|
+
if (strategy === exports.StrategyType.hypercertFractionOffer) {
|
798
|
+
return ["uint256", "uint256", "uint256", "bool"]; // minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction
|
799
|
+
}
|
800
|
+
if (strategy === exports.StrategyType.hypercertFractionOfferWithAllowlist) {
|
801
|
+
return ["uint256", "uint256", "uint256", "bool", "bytes32"]; // minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction, root
|
802
|
+
}
|
789
803
|
return [];
|
790
804
|
};
|
791
805
|
/**
|
@@ -803,6 +817,12 @@ const getTakerParamsTypes = (strategy) => {
|
|
803
817
|
if (strategy === exports.StrategyType.collectionWithMerkleTree) {
|
804
818
|
return ["uint256", "bytes32[]"]; // Item id, merkle proof
|
805
819
|
}
|
820
|
+
if (strategy === exports.StrategyType.hypercertFractionOffer) {
|
821
|
+
return ["uint256", "uint256"]; // unitAmount, pricePerUnit
|
822
|
+
}
|
823
|
+
if (strategy === exports.StrategyType.hypercertFractionOfferWithAllowlist) {
|
824
|
+
return ["uint256", "uint256", "bytes32[]"]; // unitAmount, pricePerUnit, proof
|
825
|
+
}
|
806
826
|
return [];
|
807
827
|
};
|
808
828
|
/**
|
@@ -4784,7 +4804,7 @@ const contractName = "LooksRareProtocol";
|
|
4784
4804
|
*/
|
4785
4805
|
const version = 2;
|
4786
4806
|
|
4787
|
-
const HYPERCERTS_MARKETPLACE_API_URL = "
|
4807
|
+
const HYPERCERTS_MARKETPLACE_API_URL = "http://localhost:3000/api";
|
4788
4808
|
const SUPABASE_HYPERCERTS_URL = "https://clagjjfinooizoqdkvqc.supabase.co";
|
4789
4809
|
const SUPABASE_HYPERCERTS_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNsYWdqamZpbm9vaXpvcWRrdnFjIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NzY5NTAxNDAsImV4cCI6MTk5MjUyNjE0MH0.LOIW3NcYEfF7w893PS3Ne1VrntACE3OPeSRFkspvyqw";
|
4790
4810
|
const supabaseHypercerts = supabaseJs.createClient(SUPABASE_HYPERCERTS_URL, SUPABASE_HYPERCERTS_ANON_KEY);
|
@@ -4870,6 +4890,7 @@ class HypercertExchangeClient {
|
|
4870
4890
|
constructor(chainId, provider, signer, override) {
|
4871
4891
|
this.chainId = chainId;
|
4872
4892
|
this.addresses = override ?? addressesByNetwork[this.chainId];
|
4893
|
+
console.log("Addresses", this.addresses);
|
4873
4894
|
this.signer = signer;
|
4874
4895
|
this.provider = provider;
|
4875
4896
|
this.api = api;
|
@@ -5084,6 +5105,7 @@ class HypercertExchangeClient {
|
|
5084
5105
|
*/
|
5085
5106
|
async signMakerOrder(maker) {
|
5086
5107
|
const signer = this.getSigner();
|
5108
|
+
console.log("signing against", this.getTypedDataDomain(), maker);
|
5087
5109
|
return await signMakerOrder(signer, this.getTypedDataDomain(), maker);
|
5088
5110
|
}
|
5089
5111
|
/**
|
@@ -5286,6 +5308,51 @@ class HypercertExchangeClient {
|
|
5286
5308
|
additionalParameters,
|
5287
5309
|
});
|
5288
5310
|
}
|
5311
|
+
async createFractionalSaleMakerAsk({ itemIds, price, startTime, endTime, maxUnitAmount, minUnitAmount, minUnitsToKeep, sellLeftoverFraction, root, }) {
|
5312
|
+
const address = await this.signer?.getAddress();
|
5313
|
+
if (!address) {
|
5314
|
+
throw new Error("No signer address could be determined");
|
5315
|
+
}
|
5316
|
+
const chainId = this.chainId;
|
5317
|
+
const { nonce_counter } = await fetchOrderNonce({
|
5318
|
+
address,
|
5319
|
+
chainId,
|
5320
|
+
});
|
5321
|
+
const amounts = Array.from({ length: itemIds.length }, () => 1);
|
5322
|
+
const sharedArgs = {
|
5323
|
+
// Defaults
|
5324
|
+
collectionType: 2,
|
5325
|
+
collection: this.addresses.MINTER,
|
5326
|
+
subsetNonce: 0,
|
5327
|
+
currency: this.addresses.WETH,
|
5328
|
+
amounts,
|
5329
|
+
orderNonce: nonce_counter.toString(),
|
5330
|
+
// User specified
|
5331
|
+
itemIds,
|
5332
|
+
price,
|
5333
|
+
startTime,
|
5334
|
+
endTime,
|
5335
|
+
};
|
5336
|
+
if (root) {
|
5337
|
+
return this.createMakerAsk({
|
5338
|
+
...sharedArgs,
|
5339
|
+
strategyId: exports.StrategyType.hypercertFractionOfferWithAllowlist,
|
5340
|
+
additionalParameters: [minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction, root],
|
5341
|
+
});
|
5342
|
+
}
|
5343
|
+
return this.createMakerAsk({
|
5344
|
+
...sharedArgs,
|
5345
|
+
strategyId: exports.StrategyType.hypercertFractionOffer,
|
5346
|
+
additionalParameters: [minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction],
|
5347
|
+
});
|
5348
|
+
}
|
5349
|
+
createFractionalSaleTakerBid(maker, recipient = ethers.ZeroAddress, unitAmount, pricePerUnit) {
|
5350
|
+
const order = {
|
5351
|
+
recipient: recipient,
|
5352
|
+
additionalParameters: encodeParams([unitAmount, pricePerUnit], getTakerParamsTypes(maker.strategyId)),
|
5353
|
+
};
|
5354
|
+
return order;
|
5355
|
+
}
|
5289
5356
|
/**
|
5290
5357
|
* Register the order with hypercerts marketplace API.
|
5291
5358
|
* @param order Maker order
|
package/dist/index.esm.js
CHANGED
@@ -702,6 +702,14 @@ var StrategyType;
|
|
702
702
|
StrategyType[StrategyType["standard"] = 0] = "standard";
|
703
703
|
StrategyType[StrategyType["collection"] = 1] = "collection";
|
704
704
|
StrategyType[StrategyType["collectionWithMerkleTree"] = 2] = "collectionWithMerkleTree";
|
705
|
+
StrategyType[StrategyType["dutchAuction"] = 4] = "dutchAuction";
|
706
|
+
StrategyType[StrategyType["itemIdsRange"] = 5] = "itemIdsRange";
|
707
|
+
StrategyType[StrategyType["hypercertCollectionOffer"] = 6] = "hypercertCollectionOffer";
|
708
|
+
StrategyType[StrategyType["hypercertCollectionOfferWithProof"] = 7] = "hypercertCollectionOfferWithProof";
|
709
|
+
StrategyType[StrategyType["hypercertCollectionOfferWithAllowlist"] = 8] = "hypercertCollectionOfferWithAllowlist";
|
710
|
+
StrategyType[StrategyType["hypercertDutchAuction"] = 9] = "hypercertDutchAuction";
|
711
|
+
StrategyType[StrategyType["hypercertFractionOffer"] = 10] = "hypercertFractionOffer";
|
712
|
+
StrategyType[StrategyType["hypercertFractionOfferWithAllowlist"] = 11] = "hypercertFractionOfferWithAllowlist";
|
705
713
|
})(StrategyType || (StrategyType = {}));
|
706
714
|
/** Type for maker order */
|
707
715
|
var QuoteType;
|
@@ -784,6 +792,12 @@ const getMakerParamsTypes = (strategy) => {
|
|
784
792
|
if (strategy === StrategyType.collectionWithMerkleTree) {
|
785
793
|
return ["bytes32"]; // Merkle tree root
|
786
794
|
}
|
795
|
+
if (strategy === StrategyType.hypercertFractionOffer) {
|
796
|
+
return ["uint256", "uint256", "uint256", "bool"]; // minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction
|
797
|
+
}
|
798
|
+
if (strategy === StrategyType.hypercertFractionOfferWithAllowlist) {
|
799
|
+
return ["uint256", "uint256", "uint256", "bool", "bytes32"]; // minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction, root
|
800
|
+
}
|
787
801
|
return [];
|
788
802
|
};
|
789
803
|
/**
|
@@ -801,6 +815,12 @@ const getTakerParamsTypes = (strategy) => {
|
|
801
815
|
if (strategy === StrategyType.collectionWithMerkleTree) {
|
802
816
|
return ["uint256", "bytes32[]"]; // Item id, merkle proof
|
803
817
|
}
|
818
|
+
if (strategy === StrategyType.hypercertFractionOffer) {
|
819
|
+
return ["uint256", "uint256"]; // unitAmount, pricePerUnit
|
820
|
+
}
|
821
|
+
if (strategy === StrategyType.hypercertFractionOfferWithAllowlist) {
|
822
|
+
return ["uint256", "uint256", "bytes32[]"]; // unitAmount, pricePerUnit, proof
|
823
|
+
}
|
804
824
|
return [];
|
805
825
|
};
|
806
826
|
/**
|
@@ -4782,7 +4802,7 @@ const contractName = "LooksRareProtocol";
|
|
4782
4802
|
*/
|
4783
4803
|
const version = 2;
|
4784
4804
|
|
4785
|
-
const HYPERCERTS_MARKETPLACE_API_URL = "
|
4805
|
+
const HYPERCERTS_MARKETPLACE_API_URL = "http://localhost:3000/api";
|
4786
4806
|
const SUPABASE_HYPERCERTS_URL = "https://clagjjfinooizoqdkvqc.supabase.co";
|
4787
4807
|
const SUPABASE_HYPERCERTS_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNsYWdqamZpbm9vaXpvcWRrdnFjIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NzY5NTAxNDAsImV4cCI6MTk5MjUyNjE0MH0.LOIW3NcYEfF7w893PS3Ne1VrntACE3OPeSRFkspvyqw";
|
4788
4808
|
const supabaseHypercerts = createClient(SUPABASE_HYPERCERTS_URL, SUPABASE_HYPERCERTS_ANON_KEY);
|
@@ -4868,6 +4888,7 @@ class HypercertExchangeClient {
|
|
4868
4888
|
constructor(chainId, provider, signer, override) {
|
4869
4889
|
this.chainId = chainId;
|
4870
4890
|
this.addresses = override ?? addressesByNetwork[this.chainId];
|
4891
|
+
console.log("Addresses", this.addresses);
|
4871
4892
|
this.signer = signer;
|
4872
4893
|
this.provider = provider;
|
4873
4894
|
this.api = api;
|
@@ -5082,6 +5103,7 @@ class HypercertExchangeClient {
|
|
5082
5103
|
*/
|
5083
5104
|
async signMakerOrder(maker) {
|
5084
5105
|
const signer = this.getSigner();
|
5106
|
+
console.log("signing against", this.getTypedDataDomain(), maker);
|
5085
5107
|
return await signMakerOrder(signer, this.getTypedDataDomain(), maker);
|
5086
5108
|
}
|
5087
5109
|
/**
|
@@ -5284,6 +5306,51 @@ class HypercertExchangeClient {
|
|
5284
5306
|
additionalParameters,
|
5285
5307
|
});
|
5286
5308
|
}
|
5309
|
+
async createFractionalSaleMakerAsk({ itemIds, price, startTime, endTime, maxUnitAmount, minUnitAmount, minUnitsToKeep, sellLeftoverFraction, root, }) {
|
5310
|
+
const address = await this.signer?.getAddress();
|
5311
|
+
if (!address) {
|
5312
|
+
throw new Error("No signer address could be determined");
|
5313
|
+
}
|
5314
|
+
const chainId = this.chainId;
|
5315
|
+
const { nonce_counter } = await fetchOrderNonce({
|
5316
|
+
address,
|
5317
|
+
chainId,
|
5318
|
+
});
|
5319
|
+
const amounts = Array.from({ length: itemIds.length }, () => 1);
|
5320
|
+
const sharedArgs = {
|
5321
|
+
// Defaults
|
5322
|
+
collectionType: 2,
|
5323
|
+
collection: this.addresses.MINTER,
|
5324
|
+
subsetNonce: 0,
|
5325
|
+
currency: this.addresses.WETH,
|
5326
|
+
amounts,
|
5327
|
+
orderNonce: nonce_counter.toString(),
|
5328
|
+
// User specified
|
5329
|
+
itemIds,
|
5330
|
+
price,
|
5331
|
+
startTime,
|
5332
|
+
endTime,
|
5333
|
+
};
|
5334
|
+
if (root) {
|
5335
|
+
return this.createMakerAsk({
|
5336
|
+
...sharedArgs,
|
5337
|
+
strategyId: StrategyType.hypercertFractionOfferWithAllowlist,
|
5338
|
+
additionalParameters: [minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction, root],
|
5339
|
+
});
|
5340
|
+
}
|
5341
|
+
return this.createMakerAsk({
|
5342
|
+
...sharedArgs,
|
5343
|
+
strategyId: StrategyType.hypercertFractionOffer,
|
5344
|
+
additionalParameters: [minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction],
|
5345
|
+
});
|
5346
|
+
}
|
5347
|
+
createFractionalSaleTakerBid(maker, recipient = ZeroAddress, unitAmount, pricePerUnit) {
|
5348
|
+
const order = {
|
5349
|
+
recipient: recipient,
|
5350
|
+
additionalParameters: encodeParams([unitAmount, pricePerUnit], getTakerParamsTypes(maker.strategyId)),
|
5351
|
+
};
|
5352
|
+
return order;
|
5353
|
+
}
|
5287
5354
|
/**
|
5288
5355
|
* Register the order with hypercerts marketplace API.
|
5289
5356
|
* @param order Maker order
|
package/dist/types.d.ts
CHANGED
@@ -33,7 +33,15 @@ export declare enum CollectionType {
|
|
33
33
|
export declare enum StrategyType {
|
34
34
|
standard = 0,
|
35
35
|
collection = 1,
|
36
|
-
collectionWithMerkleTree = 2
|
36
|
+
collectionWithMerkleTree = 2,
|
37
|
+
dutchAuction = 4,
|
38
|
+
itemIdsRange = 5,
|
39
|
+
hypercertCollectionOffer = 6,
|
40
|
+
hypercertCollectionOfferWithProof = 7,
|
41
|
+
hypercertCollectionOfferWithAllowlist = 8,
|
42
|
+
hypercertDutchAuction = 9,
|
43
|
+
hypercertFractionOffer = 10,
|
44
|
+
hypercertFractionOfferWithAllowlist = 11
|
37
45
|
}
|
38
46
|
/** Type for maker order */
|
39
47
|
export declare enum QuoteType {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hypercerts-org/marketplace-sdk",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.18",
|
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": "1.4.2-alpha.2",
|
95
95
|
"@supabase/supabase-js": "^2.39.2",
|
96
96
|
"ethers": "^6.6.2",
|
97
97
|
"merkletreejs": "^0.3.9"
|