@tradeport/sui-trading-sdk 0.1.82 → 0.1.83
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/CHANGELOG.md +6 -0
- package/dist/index.js +40 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/helpers/kiosk/lockNftInsideKioskIfNotLocked.ts +41 -0
- package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +0 -2
- package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +12 -0
- package/src/methods/removeCollectionBid/addRemoveCollectionBidTxs.ts +0 -2
- package/src/methods/removeCollectionBid/removeCollectionBid.ts +0 -2
- package/src/methods/unlistListings/unlistListings.ts +0 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -724,6 +724,36 @@ var getObjectType = async ({
|
|
|
724
724
|
}
|
|
725
725
|
};
|
|
726
726
|
|
|
727
|
+
// src/helpers/kiosk/lockNftInsideKioskIfNotLocked.ts
|
|
728
|
+
var lockNftInsideKioskIfNotLocked = async ({
|
|
729
|
+
tx,
|
|
730
|
+
kioskClient,
|
|
731
|
+
kioskTx,
|
|
732
|
+
sellerKiosk,
|
|
733
|
+
nftTokenId,
|
|
734
|
+
nftType,
|
|
735
|
+
transferPolicyId
|
|
736
|
+
}) => {
|
|
737
|
+
const res = await kioskClient.getKiosk({ id: sellerKiosk });
|
|
738
|
+
const isLocked = res?.items?.find((i) => i.objectId === nftTokenId)?.isLocked;
|
|
739
|
+
if (!isLocked) {
|
|
740
|
+
const item = kioskTx.take({
|
|
741
|
+
itemId: nftTokenId,
|
|
742
|
+
itemType: nftType
|
|
743
|
+
});
|
|
744
|
+
tx.moveCall({
|
|
745
|
+
target: "0x2::kiosk::lock",
|
|
746
|
+
typeArguments: [nftType],
|
|
747
|
+
arguments: [
|
|
748
|
+
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
749
|
+
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
750
|
+
tx.object(transferPolicyId),
|
|
751
|
+
tx.object(item)
|
|
752
|
+
]
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
|
|
727
757
|
// src/helpers/kiosk/resolveTransferPolicies.ts
|
|
728
758
|
var import_kiosk4 = require("@mysten/kiosk");
|
|
729
759
|
|
|
@@ -1016,6 +1046,7 @@ async function addTradeportKioskAcceptNftBidTx({
|
|
|
1016
1046
|
royaltyRulePackageId,
|
|
1017
1047
|
royaltyRuleModule,
|
|
1018
1048
|
bidAmount,
|
|
1049
|
+
sellerKiosk,
|
|
1019
1050
|
shouldSplitRoyaltyFromUserGasCoins,
|
|
1020
1051
|
beforeResolveKioskTransferRequest
|
|
1021
1052
|
}) {
|
|
@@ -1045,6 +1076,15 @@ async function addTradeportKioskAcceptNftBidTx({
|
|
|
1045
1076
|
});
|
|
1046
1077
|
tx.transferObjects([tx.object(feeCoin)], tx.pure.address(addLeadingZerosAfter0x(seller)));
|
|
1047
1078
|
} else {
|
|
1079
|
+
await lockNftInsideKioskIfNotLocked({
|
|
1080
|
+
tx,
|
|
1081
|
+
kioskClient,
|
|
1082
|
+
kioskTx,
|
|
1083
|
+
sellerKiosk,
|
|
1084
|
+
nftTokenId,
|
|
1085
|
+
nftType,
|
|
1086
|
+
transferPolicyId
|
|
1087
|
+
});
|
|
1048
1088
|
const [feeCoin, transferRequest] = tx.moveCall({
|
|
1049
1089
|
target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_biddings::accept_bid_with_purchase_cap",
|
|
1050
1090
|
arguments: [
|
|
@@ -1773,7 +1813,6 @@ var acceptCollectionBid = async ({
|
|
|
1773
1813
|
shouldSplitRoyaltyFromUserGasCoins,
|
|
1774
1814
|
beforeResolveKioskTransferRequest
|
|
1775
1815
|
};
|
|
1776
|
-
console.log("txData", txData);
|
|
1777
1816
|
switch (txData.bidMarketName) {
|
|
1778
1817
|
case "tradeport":
|
|
1779
1818
|
if (txData?.listingPrice && txData?.listingPrice > 0) {
|
|
@@ -4665,7 +4704,6 @@ async function addTradePortRemoveCollectionBidTxHandler(txData) {
|
|
|
4665
4704
|
suiClient: txData?.suiClient,
|
|
4666
4705
|
objectId: txData?.bidNonce
|
|
4667
4706
|
});
|
|
4668
|
-
console.log("bidType", bidType);
|
|
4669
4707
|
if (isOriginByteBid(bidType)) {
|
|
4670
4708
|
addOriginByteRemoveCollectionBidTx(txData);
|
|
4671
4709
|
return;
|
|
@@ -4728,7 +4766,6 @@ var removeCollectionBid = async ({ bidId }, context) => {
|
|
|
4728
4766
|
sellerKiosk: bid?.nft?.chain_state?.kiosk_id,
|
|
4729
4767
|
bidMarketName: bid?.market_contract?.name
|
|
4730
4768
|
};
|
|
4731
|
-
console.log("txData", txData);
|
|
4732
4769
|
switch (txData.bidMarketName) {
|
|
4733
4770
|
case "tradeport":
|
|
4734
4771
|
await addTradePortRemoveCollectionBidTxHandler(txData);
|
|
@@ -4976,7 +5013,6 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
|
|
|
4976
5013
|
collectionId: listing?.nft?.collection_id,
|
|
4977
5014
|
seller: walletAddress
|
|
4978
5015
|
};
|
|
4979
|
-
console.log("txData", txData);
|
|
4980
5016
|
switch (listing?.market_name) {
|
|
4981
5017
|
case "tradeport":
|
|
4982
5018
|
await addTradePortUnlistTxHandler(txData);
|