@hypercerts-org/marketplace-sdk 0.4.0 → 0.4.1
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/{LICENSE → LICENSE.md} +1 -0
- package/README.md +117 -85
- package/dist/HypercertExchangeClient.d.ts +17 -85
- package/dist/index.cjs.js +25 -182
- package/dist/index.d.ts +0 -2
- package/dist/index.esm.js +25 -182
- package/dist/types.d.ts +34 -28
- package/dist/utils/api.d.ts +5 -3
- package/dist/utils/calls/nonces.d.ts +0 -1
- package/dist/utils/calls/transferManager.d.ts +1 -2
- package/package.json +7 -5
package/dist/index.cjs.js
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
var ethers = require('ethers');
|
4
4
|
var contracts = require('@hypercerts-org/contracts');
|
5
5
|
var merkletreejs = require('merkletreejs');
|
6
|
-
var jsSha3 = require('js-sha3');
|
7
6
|
var sdk = require('@hypercerts-org/sdk');
|
8
7
|
|
9
8
|
var abiIERC721 = [
|
@@ -594,14 +593,6 @@ const cancelOrderNonces = (signer, address, nonces, overrides) => {
|
|
594
593
|
callStatic: (additionalOverrides) => contract.cancelOrderNonces.staticCall(nonces, { ...overrides, ...additionalOverrides }),
|
595
594
|
};
|
596
595
|
};
|
597
|
-
const cancelSubsetNonces = (signer, address, nonces, overrides) => {
|
598
|
-
const contract = new ethers.Contract(address, contracts.HypercertExchangeAbi).connect(signer);
|
599
|
-
return {
|
600
|
-
call: (additionalOverrides) => contract.cancelSubsetNonces.send(nonces, { ...overrides, ...additionalOverrides }),
|
601
|
-
estimateGas: (additionalOverrides) => contract.cancelSubsetNonces.estimateGas(nonces, { ...overrides, ...additionalOverrides }),
|
602
|
-
callStatic: (additionalOverrides) => contract.cancelSubsetNonces.staticCall(nonces, { ...overrides, ...additionalOverrides }),
|
603
|
-
};
|
604
|
-
};
|
605
596
|
const incrementBidAskNonces = (signer, address, bid, ask, overrides) => {
|
606
597
|
const contract = new ethers.Contract(address, contracts.HypercertExchangeAbi).connect(signer);
|
607
598
|
return {
|
@@ -614,7 +605,6 @@ const incrementBidAskNonces = (signer, address, bid, ask, overrides) => {
|
|
614
605
|
var nonces = /*#__PURE__*/Object.freeze({
|
615
606
|
__proto__: null,
|
616
607
|
cancelOrderNonces: cancelOrderNonces,
|
617
|
-
cancelSubsetNonces: cancelSubsetNonces,
|
618
608
|
incrementBidAskNonces: incrementBidAskNonces,
|
619
609
|
viewUserBidAskNonces: viewUserBidAskNonces
|
620
610
|
});
|
@@ -640,30 +630,12 @@ const revokeApprovals = (signer, address, operators, overrides) => {
|
|
640
630
|
callStatic: (additionalOverrides) => contract.revokeApprovals.staticCall(operators, { ...overrides, ...additionalOverrides }),
|
641
631
|
};
|
642
632
|
};
|
643
|
-
const transferBatchItemsAcrossCollections = (signer, address, items, from, to, overrides) => {
|
644
|
-
const contract = new ethers.Contract(address, contracts.TransferManagerAbi).connect(signer);
|
645
|
-
return {
|
646
|
-
call: (additionalOverrides) => contract.transferBatchItemsAcrossCollections.send(items, from, to, {
|
647
|
-
...overrides,
|
648
|
-
...additionalOverrides,
|
649
|
-
}),
|
650
|
-
estimateGas: (additionalOverrides) => contract.transferBatchItemsAcrossCollections.estimateGas(items, from, to, {
|
651
|
-
...overrides,
|
652
|
-
...additionalOverrides,
|
653
|
-
}),
|
654
|
-
callStatic: (additionalOverrides) => contract.transferBatchItemsAcrossCollections.staticCall(items, from, to, {
|
655
|
-
...overrides,
|
656
|
-
...additionalOverrides,
|
657
|
-
}),
|
658
|
-
};
|
659
|
-
};
|
660
633
|
|
661
634
|
var transferManager = /*#__PURE__*/Object.freeze({
|
662
635
|
__proto__: null,
|
663
636
|
grantApprovals: grantApprovals,
|
664
637
|
hasUserApprovedOperator: hasUserApprovedOperator,
|
665
|
-
revokeApprovals: revokeApprovals
|
666
|
-
transferBatchItemsAcrossCollections: transferBatchItemsAcrossCollections
|
638
|
+
revokeApprovals: revokeApprovals
|
667
639
|
});
|
668
640
|
|
669
641
|
const verifyMakerOrders = async (signerOrProvider, address, makerOrders, signatures, merkleTrees, overrides) => {
|
@@ -716,22 +688,13 @@ exports.CollectionType = void 0;
|
|
716
688
|
CollectionType[CollectionType["ERC721"] = 0] = "ERC721";
|
717
689
|
CollectionType[CollectionType["ERC1155"] = 1] = "ERC1155";
|
718
690
|
CollectionType[CollectionType["HYPERCERT"] = 2] = "HYPERCERT";
|
719
|
-
CollectionType[CollectionType["HYPERBOARD"] = 3] = "HYPERBOARD";
|
720
691
|
})(exports.CollectionType || (exports.CollectionType = {}));
|
721
692
|
/** List of trading strategies */
|
722
693
|
exports.StrategyType = void 0;
|
723
694
|
(function (StrategyType) {
|
724
695
|
StrategyType[StrategyType["standard"] = 0] = "standard";
|
725
|
-
StrategyType[StrategyType["collection"] = 10] = "collection";
|
726
|
-
StrategyType[StrategyType["collectionWithMerkleTree"] = 2] = "collectionWithMerkleTree";
|
727
|
-
StrategyType[StrategyType["dutchAuction"] = 4] = "dutchAuction";
|
728
|
-
StrategyType[StrategyType["itemIdsRange"] = 5] = "itemIdsRange";
|
729
|
-
StrategyType[StrategyType["hypercertCollectionOffer"] = 6] = "hypercertCollectionOffer";
|
730
|
-
StrategyType[StrategyType["hypercertCollectionOfferWithProof"] = 7] = "hypercertCollectionOfferWithProof";
|
731
|
-
StrategyType[StrategyType["hypercertCollectionOfferWithAllowlist"] = 8] = "hypercertCollectionOfferWithAllowlist";
|
732
|
-
StrategyType[StrategyType["hypercertDutchAuction"] = 9] = "hypercertDutchAuction";
|
733
696
|
StrategyType[StrategyType["hypercertFractionOffer"] = 1] = "hypercertFractionOffer";
|
734
|
-
StrategyType[StrategyType["hypercertFractionOfferWithAllowlist"] =
|
697
|
+
StrategyType[StrategyType["hypercertFractionOfferWithAllowlist"] = 2] = "hypercertFractionOfferWithAllowlist";
|
735
698
|
})(exports.StrategyType || (exports.StrategyType = {}));
|
736
699
|
/** Type for maker order */
|
737
700
|
exports.QuoteType = void 0;
|
@@ -808,12 +771,9 @@ exports.OrderValidatorCode = void 0;
|
|
808
771
|
* @returns Array of solidity types for encoding
|
809
772
|
*/
|
810
773
|
const getMakerParamsTypes = (strategy) => {
|
811
|
-
if (strategy === exports.StrategyType.standard
|
774
|
+
if (strategy === exports.StrategyType.standard) {
|
812
775
|
return [];
|
813
776
|
}
|
814
|
-
if (strategy === exports.StrategyType.collectionWithMerkleTree) {
|
815
|
-
return ["bytes32"]; // Merkle tree root
|
816
|
-
}
|
817
777
|
if (strategy === exports.StrategyType.hypercertFractionOffer) {
|
818
778
|
return ["uint256", "uint256", "uint256", "bool"]; // minUnitAmount, maxUnitAmount, minUnitsToKeep, sellLeftoverFraction
|
819
779
|
}
|
@@ -831,12 +791,6 @@ const getTakerParamsTypes = (strategy) => {
|
|
831
791
|
if (strategy === exports.StrategyType.standard) {
|
832
792
|
return [];
|
833
793
|
}
|
834
|
-
if (strategy === exports.StrategyType.collection) {
|
835
|
-
return ["uint256"]; // Item id
|
836
|
-
}
|
837
|
-
if (strategy === exports.StrategyType.collectionWithMerkleTree) {
|
838
|
-
return ["uint256", "bytes32[]"]; // Item id, merkle proof
|
839
|
-
}
|
840
794
|
if (strategy === exports.StrategyType.hypercertFractionOffer) {
|
841
795
|
return ["uint256", "uint256"]; // unitAmount, pricePerUnit
|
842
796
|
}
|
@@ -7605,7 +7559,7 @@ class ApiClient {
|
|
7605
7559
|
constructor(indexerEnvironment, baseUrl) {
|
7606
7560
|
this.baseUrl = baseUrl;
|
7607
7561
|
/**
|
7608
|
-
* Fetches order nonce from
|
7562
|
+
* Fetches order nonce from API
|
7609
7563
|
* @param address Address
|
7610
7564
|
* @param chainId Chain ID
|
7611
7565
|
*/
|
@@ -7624,7 +7578,7 @@ class ApiClient {
|
|
7624
7578
|
.then((res) => res.data);
|
7625
7579
|
};
|
7626
7580
|
/**
|
7627
|
-
* Registers order in
|
7581
|
+
* Registers order in the marketplace API
|
7628
7582
|
* @param order Order
|
7629
7583
|
* @param signer Signer
|
7630
7584
|
* @param signature Signature
|
@@ -7650,6 +7604,7 @@ class ApiClient {
|
|
7650
7604
|
}).then((res) => this.handleResponse(res));
|
7651
7605
|
};
|
7652
7606
|
/**
|
7607
|
+
* @deprecated use GraphQL API instead
|
7653
7608
|
* Fetch existing open orders from the marketplace API
|
7654
7609
|
* @param signer address of the user that created the order
|
7655
7610
|
* @param claimTokenIds a list of claimTokenIds - will return any order that is for one or more of these claimTokenIds
|
@@ -7660,7 +7615,8 @@ class ApiClient {
|
|
7660
7615
|
return await getOrders({ signer, chainId: chainId ? BigInt(chainId) : undefined }, this._urqlClient);
|
7661
7616
|
};
|
7662
7617
|
/**
|
7663
|
-
*
|
7618
|
+
* @deprecated use the GraphQL API instead
|
7619
|
+
* Fetches orders from API by hypercert ID
|
7664
7620
|
* @param hypercertId Hypercert ID
|
7665
7621
|
* @param chainId Chain ID
|
7666
7622
|
*/
|
@@ -7725,10 +7681,10 @@ const ACCEPTED_ERROR_CODES = [
|
|
7725
7681
|
class HypercertExchangeClient {
|
7726
7682
|
/**
|
7727
7683
|
* HypercertExchange protocol main class
|
7728
|
-
* @param chainId
|
7684
|
+
* @param chainId Chain id for contract interactions
|
7729
7685
|
* @param provider Ethers provider
|
7730
7686
|
* @param signer Ethers signer
|
7731
|
-
* @param overrides Override contract addresses or
|
7687
|
+
* @param overrides Override contract addresses or API endpoint used
|
7732
7688
|
*/
|
7733
7689
|
constructor(chainId, provider, signer, overrides) {
|
7734
7690
|
const deployment = sdk.CONSTANTS.DEPLOYMENTS[contracts.asDeployedChain(chainId)];
|
@@ -7778,7 +7734,7 @@ class HypercertExchangeClient {
|
|
7778
7734
|
* @param CreateMakerInput
|
7779
7735
|
* @returns the maker object, isTransferManagerApproved, and isTransferManagerApproved
|
7780
7736
|
*/
|
7781
|
-
async createMakerAsk({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds,
|
7737
|
+
async createMakerAsk({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, currency = ethers.ZeroAddress, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
|
7782
7738
|
const signer = this.getSigner();
|
7783
7739
|
if (!this.isTimestampValid(startTime) || !this.isTimestampValid(endTime)) {
|
7784
7740
|
throw new ErrorTimestamp();
|
@@ -7805,7 +7761,7 @@ class HypercertExchangeClient {
|
|
7805
7761
|
endTime: endTime,
|
7806
7762
|
price: price,
|
7807
7763
|
itemIds: itemIds,
|
7808
|
-
amounts:
|
7764
|
+
amounts: itemIds.map(_ => 1n),
|
7809
7765
|
additionalParameters: encodeParams(additionalParameters, getMakerParamsTypes(strategyId)),
|
7810
7766
|
};
|
7811
7767
|
return {
|
@@ -7819,7 +7775,7 @@ class HypercertExchangeClient {
|
|
7819
7775
|
* @param CreateMakerInput
|
7820
7776
|
* @returns the maker object, isCurrencyApproved, and isBalanceSufficient
|
7821
7777
|
*/
|
7822
|
-
async createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds,
|
7778
|
+
async createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, currency, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
|
7823
7779
|
const signer = this.getSigner();
|
7824
7780
|
if (!this.isTimestampValid(startTime) || !this.isTimestampValid(endTime)) {
|
7825
7781
|
throw new ErrorTimestamp();
|
@@ -7849,7 +7805,7 @@ class HypercertExchangeClient {
|
|
7849
7805
|
endTime: endTime,
|
7850
7806
|
price: price,
|
7851
7807
|
itemIds: itemIds,
|
7852
|
-
amounts:
|
7808
|
+
amounts: itemIds.map(_ => 1n),
|
7853
7809
|
additionalParameters: encodeParams(additionalParameters, getMakerParamsTypes(strategyId)),
|
7854
7810
|
};
|
7855
7811
|
return {
|
@@ -7858,36 +7814,6 @@ class HypercertExchangeClient {
|
|
7858
7814
|
isBalanceSufficient: BigInt(balance) >= BigInt(price),
|
7859
7815
|
};
|
7860
7816
|
}
|
7861
|
-
/**
|
7862
|
-
* Create a maker bid for collection offer.
|
7863
|
-
* @see this.createMakerBid
|
7864
|
-
* @param orderInputs Order data
|
7865
|
-
* @returns CreateMakerBidOutput
|
7866
|
-
*/
|
7867
|
-
createMakerCollectionOffer(orderInputs) {
|
7868
|
-
return this.createMakerBid({ ...orderInputs, strategyId: exports.StrategyType.collection, itemIds: [] });
|
7869
|
-
}
|
7870
|
-
/**
|
7871
|
-
* Create a maker bid for collection, with a list of item id that can be used for the taker order
|
7872
|
-
* @see this.createMakerBid
|
7873
|
-
* @param orderInputs Order data
|
7874
|
-
* @returns CreateMakerBidOutput
|
7875
|
-
*/
|
7876
|
-
async createMakerCollectionOfferWithProof(orderInputs) {
|
7877
|
-
const { itemIds, ...otherInputs } = orderInputs;
|
7878
|
-
const leaves = itemIds.map((itemId) => {
|
7879
|
-
const hash = ethers.solidityPackedKeccak256(["uint256"], [itemId]);
|
7880
|
-
return Buffer.from(hash.slice(2), "hex");
|
7881
|
-
});
|
7882
|
-
const tree = new merkletreejs.MerkleTree(leaves, jsSha3.keccak256, { sortPairs: true });
|
7883
|
-
const root = tree.getHexRoot();
|
7884
|
-
return this.createMakerBid({
|
7885
|
-
...otherInputs,
|
7886
|
-
strategyId: exports.StrategyType.collectionWithMerkleTree,
|
7887
|
-
additionalParameters: [root],
|
7888
|
-
itemIds: [],
|
7889
|
-
});
|
7890
|
-
}
|
7891
7817
|
/**
|
7892
7818
|
* Create a taker ask ready to be executed against a maker bid
|
7893
7819
|
* @param maker Maker order that will be used as counterparty for the taker
|
@@ -7901,53 +7827,6 @@ class HypercertExchangeClient {
|
|
7901
7827
|
additionalParameters: encodeParams(additionalParameters, getTakerParamsTypes(maker.strategyId)),
|
7902
7828
|
};
|
7903
7829
|
}
|
7904
|
-
/**
|
7905
|
-
* Create a taker ask order for collection order.
|
7906
|
-
* @see this.createTaker
|
7907
|
-
* @see this.createMakerCollectionOffer
|
7908
|
-
* @param maker Maker bid that will be used as counterparty for the taker
|
7909
|
-
* @param itemId Token id to use as a counterparty for the collection order
|
7910
|
-
* @param recipient Recipient address of the taker (if none, it will use the sender)
|
7911
|
-
* @returns Taker object
|
7912
|
-
*/
|
7913
|
-
createTakerCollectionOffer(maker, itemId, recipient) {
|
7914
|
-
if (maker.quoteType !== exports.QuoteType.Bid) {
|
7915
|
-
throw new ErrorQuoteType();
|
7916
|
-
}
|
7917
|
-
if (maker.strategyId !== exports.StrategyType.collection) {
|
7918
|
-
throw new ErrorStrategyType();
|
7919
|
-
}
|
7920
|
-
return this.createTaker(maker, recipient, [itemId]);
|
7921
|
-
}
|
7922
|
-
/**
|
7923
|
-
* Create a taker ask to fulfill a collection order (maker bid) created with a whitelist of item ids
|
7924
|
-
* @see this.createTaker
|
7925
|
-
* @see this.createMakerCollectionOfferWithMerkleTree
|
7926
|
-
* @param maker Maker bid that will be used as counterparty for the taker
|
7927
|
-
* @param itemId Token id to use as a counterparty for the collection order
|
7928
|
-
* @param itemIds List of token ids used during the maker creation
|
7929
|
-
* @param recipient Recipient address of the taker (if none, it will use the sender)
|
7930
|
-
* @returns Taker object
|
7931
|
-
*/
|
7932
|
-
createTakerCollectionOfferWithProof(maker, itemId, itemIds, recipient) {
|
7933
|
-
if (maker.quoteType !== exports.QuoteType.Bid) {
|
7934
|
-
throw new ErrorQuoteType();
|
7935
|
-
}
|
7936
|
-
if (maker.strategyId !== exports.StrategyType.collectionWithMerkleTree) {
|
7937
|
-
throw new ErrorStrategyType();
|
7938
|
-
}
|
7939
|
-
const index = itemIds.findIndex((id) => BigInt(id) === BigInt(itemId));
|
7940
|
-
if (index === -1) {
|
7941
|
-
throw new ErrorItemId();
|
7942
|
-
}
|
7943
|
-
const leaves = itemIds.map((id) => {
|
7944
|
-
const hash = ethers.solidityPackedKeccak256(["uint256"], [id]);
|
7945
|
-
return Buffer.from(hash.slice(2), "hex");
|
7946
|
-
});
|
7947
|
-
const tree = new merkletreejs.MerkleTree(leaves, jsSha3.keccak256, { sortPairs: true });
|
7948
|
-
const proof = tree.getHexProof(leaves[index]);
|
7949
|
-
return this.createTaker(maker, recipient, [itemId, proof]);
|
7950
|
-
}
|
7951
7830
|
/**
|
7952
7831
|
* Sign a maker order using the signer provided in the constructor
|
7953
7832
|
* @param maker Order to be signed by the user
|
@@ -7976,7 +7855,7 @@ class HypercertExchangeClient {
|
|
7976
7855
|
* @param maker Maker order
|
7977
7856
|
* @param taker Taker order
|
7978
7857
|
* @param signature Signature of the maker order
|
7979
|
-
* @param merkleTree
|
7858
|
+
* @param merkleTree Optional merkle tree
|
7980
7859
|
* @returns ContractMethods
|
7981
7860
|
*/
|
7982
7861
|
executeOrder(maker, taker, signature, merkleTree = defaultMerkleTree, overrides) {
|
@@ -8019,7 +7898,7 @@ class HypercertExchangeClient {
|
|
8019
7898
|
return incrementBidAskNonces(signer, this.addresses.EXCHANGE_V2, bid, ask, overrides);
|
8020
7899
|
}
|
8021
7900
|
/**
|
8022
|
-
* Cancel a list of
|
7901
|
+
* Cancel a list of orders by nonce
|
8023
7902
|
* @param nonces List of nonces to be cancelled
|
8024
7903
|
* @returns ContractMethods
|
8025
7904
|
*/
|
@@ -8028,16 +7907,7 @@ class HypercertExchangeClient {
|
|
8028
7907
|
return cancelOrderNonces(signer, this.addresses.EXCHANGE_V2, nonces, overrides);
|
8029
7908
|
}
|
8030
7909
|
/**
|
8031
|
-
*
|
8032
|
-
* @param nonces List of nonces to be cancelled
|
8033
|
-
* @returns ContractMethods
|
8034
|
-
*/
|
8035
|
-
cancelSubsetOrders(nonces, overrides) {
|
8036
|
-
const signer = this.getSigner();
|
8037
|
-
return cancelSubsetNonces(signer, this.addresses.EXCHANGE_V2, nonces, overrides);
|
8038
|
-
}
|
8039
|
-
/**
|
8040
|
-
* Approve all the items of a collection, to eventually be traded on HypercertExchange
|
7910
|
+
* Approve all the items of a collection, to eventually be traded on the Hypercert Exchange
|
8041
7911
|
* The spender is the TransferManager.
|
8042
7912
|
* @param collectionAddress Address of the collection to be approved.
|
8043
7913
|
* @param approved true to approve, false to revoke the approval (default to true)
|
@@ -8049,7 +7919,7 @@ class HypercertExchangeClient {
|
|
8049
7919
|
return setApprovalForAll(signer, collectionAddress, spenderAddress, approved, overrides);
|
8050
7920
|
}
|
8051
7921
|
/**
|
8052
|
-
* Approve an ERC20 to be used as a currency on
|
7922
|
+
* Approve an ERC20 to be used as a currency on the Hypercert Exchange.
|
8053
7923
|
* The spender is the HypercertExchangeProtocol contract.
|
8054
7924
|
* @param tokenAddress Address of the ERC20 to approve
|
8055
7925
|
* @param amount Amount to be approved (default to MaxUint256)
|
@@ -8090,17 +7960,6 @@ class HypercertExchangeClient {
|
|
8090
7960
|
const signer = this.getSigner();
|
8091
7961
|
return revokeApprovals(signer, this.addresses.TRANSFER_MANAGER_V2, operators, overrides);
|
8092
7962
|
}
|
8093
|
-
/**
|
8094
|
-
* Transfer a list of items across different collections
|
8095
|
-
* @param to Recipient address
|
8096
|
-
* @param collectionItems Each object in the array represent a list of items for a specific collection
|
8097
|
-
* @returns ContractMethods
|
8098
|
-
*/
|
8099
|
-
async transferItemsAcrossCollection(to, collectionItems, overrides) {
|
8100
|
-
const signer = this.getSigner();
|
8101
|
-
const from = await signer.getAddress();
|
8102
|
-
return transferBatchItemsAcrossCollections(signer, this.addresses.TRANSFER_MANAGER_V2, collectionItems, from, to, overrides);
|
8103
|
-
}
|
8104
7963
|
/**
|
8105
7964
|
* Verify if a set of orders can be executed (i.e are valid)
|
8106
7965
|
* @param makerOrders List of maker orders
|
@@ -8163,12 +8022,7 @@ class HypercertExchangeClient {
|
|
8163
8022
|
}
|
8164
8023
|
/**
|
8165
8024
|
* Create a maker ask for a collection or singular offer of fractions
|
8166
|
-
* @param
|
8167
|
-
* @param price Price of the fractions in wei
|
8168
|
-
* @param startTime Timestamp in seconds when the order becomes valid
|
8169
|
-
* @param endTime Timestamp in seconds when the order becomes invalid
|
8170
|
-
* @param currency Currency used to buy the fractions (default to WETH)
|
8171
|
-
* @param additionalParameters Additional parameters used to support complex orders
|
8025
|
+
* @param CreateDirectFractionsSaleMakerAskInput
|
8172
8026
|
*/
|
8173
8027
|
async createDirectFractionsSaleMakerAsk({ itemIds, price, startTime, endTime, currency, additionalParameters = [], }) {
|
8174
8028
|
const address = await this.signer?.getAddress();
|
@@ -8183,7 +8037,6 @@ class HypercertExchangeClient {
|
|
8183
8037
|
address,
|
8184
8038
|
chainId,
|
8185
8039
|
});
|
8186
|
-
const amounts = Array.from({ length: itemIds.length }, () => 1);
|
8187
8040
|
return this.createMakerAsk({
|
8188
8041
|
// Defaults
|
8189
8042
|
strategyId: exports.StrategyType.standard,
|
@@ -8191,7 +8044,6 @@ class HypercertExchangeClient {
|
|
8191
8044
|
collection: this.addresses.MINTER,
|
8192
8045
|
subsetNonce: 0,
|
8193
8046
|
currency,
|
8194
|
-
amounts,
|
8195
8047
|
orderNonce: nonce_counter.toString(),
|
8196
8048
|
// User specified
|
8197
8049
|
itemIds,
|
@@ -8202,17 +8054,8 @@ class HypercertExchangeClient {
|
|
8202
8054
|
});
|
8203
8055
|
}
|
8204
8056
|
/**
|
8205
|
-
* Create a maker ask to let the buyer decide how much of
|
8206
|
-
* @param
|
8207
|
-
* @param price Price of one unit in wei
|
8208
|
-
* @param startTime Timestamp in seconds when the order becomes valid
|
8209
|
-
* @param endTime Timestamp in seconds when the order becomes invalid
|
8210
|
-
* @param currency Currency used to buy the fractions (default to WETH)
|
8211
|
-
* @param maxUnitAmount Maximum amount of units that can be bought in a single transaction
|
8212
|
-
* @param minUnitAmount Minimum amount of units that can be bought in a single transaction
|
8213
|
-
* @param minUnitsToKeep Minimum amount of units that the seller wants to keep
|
8214
|
-
* @param sellLeftoverFraction Whether or not the seller wants to sell the leftover units
|
8215
|
-
* @param root Merkle tree root (optional)
|
8057
|
+
* Create a maker ask to let the buyer decide how much of a fraction they want to buy
|
8058
|
+
* @param CreateFractionalSaleMakerInput
|
8216
8059
|
*/
|
8217
8060
|
async createFractionalSaleMakerAsk({ itemIds, price, startTime, endTime, currency, maxUnitAmount, minUnitAmount, minUnitsToKeep, sellLeftoverFraction, root, }) {
|
8218
8061
|
const address = await this.signer?.getAddress();
|
@@ -8230,7 +8073,7 @@ class HypercertExchangeClient {
|
|
8230
8073
|
const amounts = Array.from({ length: itemIds.length }, () => 1);
|
8231
8074
|
const sharedArgs = {
|
8232
8075
|
// Defaults
|
8233
|
-
collectionType:
|
8076
|
+
collectionType: exports.CollectionType.HYPERCERT,
|
8234
8077
|
collection: this.addresses.MINTER,
|
8235
8078
|
subsetNonce: 0,
|
8236
8079
|
currency,
|
@@ -8256,7 +8099,7 @@ class HypercertExchangeClient {
|
|
8256
8099
|
});
|
8257
8100
|
}
|
8258
8101
|
/**
|
8259
|
-
* Create a taker bid for buying
|
8102
|
+
* Create a taker bid for buying part of a fraction
|
8260
8103
|
* @param maker Maker order
|
8261
8104
|
* @param recipient Recipient address of the taker (if none, it will use the sender)
|
8262
8105
|
* @param unitAmount Amount of units to buy
|
@@ -8269,7 +8112,7 @@ class HypercertExchangeClient {
|
|
8269
8112
|
};
|
8270
8113
|
}
|
8271
8114
|
/**
|
8272
|
-
* Register the order with hypercerts marketplace API
|
8115
|
+
* Register the order with the hypercerts marketplace API
|
8273
8116
|
* @param order Maker order
|
8274
8117
|
* @param signature Signature of the maker order
|
8275
8118
|
*/
|
@@ -8288,7 +8131,7 @@ class HypercertExchangeClient {
|
|
8288
8131
|
});
|
8289
8132
|
}
|
8290
8133
|
/**
|
8291
|
-
* Delete the order
|
8134
|
+
* Delete the order from the hypercerts marketplace API
|
8292
8135
|
* @param orderId Order ID
|
8293
8136
|
*/
|
8294
8137
|
async deleteOrder(orderId) {
|
package/dist/index.d.ts
CHANGED
@@ -15,13 +15,11 @@ declare const utils: {
|
|
15
15
|
hasUserApprovedOperator: (signerOrProvider: import("ethers").Signer | import("ethers").Provider, address: string, user: string, operator: string, overrides?: import("ethers").Overrides | undefined) => Promise<boolean>;
|
16
16
|
grantApprovals: (signer: import("ethers").Signer, address: string, operators: string[], overrides?: import("ethers").Overrides | undefined) => import("./types").ContractMethods;
|
17
17
|
revokeApprovals: (signer: import("ethers").Signer, address: string, operators: string[], overrides?: import("ethers").Overrides | undefined) => import("./types").ContractMethods;
|
18
|
-
transferBatchItemsAcrossCollections: (signer: import("ethers").Signer, address: string, items: import("./types").BatchTransferItem[], from: string, to: string, overrides?: import("ethers").Overrides | undefined) => import("./types").ContractMethods;
|
19
18
|
viewUserBidAskNonces: (signerOrProvider: import("ethers").Signer | import("ethers").Provider, address: string, account: string, overrides?: import("ethers").Overrides | undefined) => Promise<{
|
20
19
|
bidNonce: bigint;
|
21
20
|
askNonce: bigint;
|
22
21
|
}>;
|
23
22
|
cancelOrderNonces: (signer: import("ethers").Signer, address: string, nonces: import("ethers").BigNumberish[], overrides?: import("ethers").Overrides | undefined) => import("./types").ContractMethods;
|
24
|
-
cancelSubsetNonces: (signer: import("ethers").Signer, address: string, nonces: import("ethers").BigNumberish[], overrides?: import("ethers").Overrides | undefined) => import("./types").ContractMethods;
|
25
23
|
incrementBidAskNonces: (signer: import("ethers").Signer, address: string, bid: boolean, ask: boolean, overrides?: import("ethers").Overrides | undefined) => import("./types").ContractMethods;
|
26
24
|
executeTakerBid: (signer: import("ethers").Signer, address: string, taker: import("./types").Taker, maker: import("./types").Maker, makerSignature: string, merkleTree: import("./types").MerkleTree, overrides?: import("./typechain/common").PayableOverrides | undefined) => import("./types").ContractMethods;
|
27
25
|
executeTakerAsk: (signer: import("ethers").Signer, address: string, taker: import("./types").Taker, maker: import("./types").Maker, makerSignature: string, merkleTree: import("./types").MerkleTree, overrides?: import("./typechain/common").PayableOverrides | undefined) => import("./types").ContractMethods;
|