@tradeport/sui-trading-sdk 0.1.81 → 0.1.82

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @tradeport/sui-trading-sdk
2
2
 
3
+ ## 0.1.82
4
+
5
+ ### Patch Changes
6
+
7
+ - 506f1f9: Converts kiosks to personal kiosks in accept bids if has personal kiosk rule
8
+ - 5e654f0: Converts kiosks to personal kiosks in accept bids if has personal kiosk rule
9
+
3
10
  ## 0.1.81
4
11
 
5
12
  ### Patch Changes
package/dist/index.js CHANGED
@@ -402,6 +402,14 @@ var getKioskTransferPolicies = async (nftType) => {
402
402
  return transferPolicies;
403
403
  };
404
404
 
405
+ // src/helpers/hasPersonalKioskRule.ts
406
+ var hasPersonalKioskRule = async (nftType) => {
407
+ const transferPolicies = await getKioskTransferPolicies(nftType);
408
+ return transferPolicies?.some(
409
+ (policy) => policy?.rules?.filter((rule) => rule?.type?.includes("personal_kiosk_rule"))?.length > 0
410
+ );
411
+ };
412
+
405
413
  // src/helpers/hasTransferPolicyRules.ts
406
414
  var hasTransferPolicyRules = async (nftType) => {
407
415
  const transferPolicies = await getKioskTransferPolicies(nftType);
@@ -964,11 +972,6 @@ var getOBBidderKiosk = async ({
964
972
  return bidObject.data?.content?.fields?.kiosk;
965
973
  };
966
974
 
967
- // src/utils/printTxBlockTxs.ts
968
- var printTxBlockTxs = async (tx) => {
969
- console.log(JSON.stringify(tx?.getData(), null, 2));
970
- };
971
-
972
975
  // src/methods/acceptNftBids/addAcceptNftBidTxs.ts
973
976
  function addTradeportAcceptNftBidTx({
974
977
  tx,
@@ -1017,7 +1020,6 @@ async function addTradeportKioskAcceptNftBidTx({
1017
1020
  beforeResolveKioskTransferRequest
1018
1021
  }) {
1019
1022
  const transferPolicyId = (await getKioskTransferPolicies(nftType))?.at(0)?.id;
1020
- console.log("transferPolicyId", transferPolicyId);
1021
1023
  if (beforeResolveKioskTransferRequest) {
1022
1024
  const [feeCoin, transferRequest] = tx.moveCall({
1023
1025
  target: "0x6468e232af988cd8be608b1901863f0d7dbaa16764c1834daa39b023cb3b2fc8::kiosk_biddings::accept_bid_with_price_lock",
@@ -1054,7 +1056,6 @@ async function addTradeportKioskAcceptNftBidTx({
1054
1056
  ],
1055
1057
  typeArguments: [nftType]
1056
1058
  });
1057
- console.log("1");
1058
1059
  if (!shouldSplitRoyaltyFromUserGasCoins) {
1059
1060
  tx.moveCall({
1060
1061
  target: `${royaltyRulePackageId}::${royaltyRuleModule}::pay`,
@@ -1072,11 +1073,9 @@ async function addTradeportKioskAcceptNftBidTx({
1072
1073
  shouldSkipKioskLocking: true,
1073
1074
  shouldSkipResolvingRoyaltyRule: !shouldSplitRoyaltyFromUserGasCoins
1074
1075
  });
1075
- console.log("2");
1076
1076
  if (shouldSplitRoyaltyFromUserGasCoins) {
1077
1077
  tx.transferObjects([tx.object(feeCoin)], tx.pure.address(addLeadingZerosAfter0x(seller)));
1078
1078
  }
1079
- await printTxBlockTxs(tx);
1080
1079
  }
1081
1080
  }
1082
1081
  async function addOriginByteAcceptNftBidTx({
@@ -1170,6 +1169,7 @@ async function addTradePortAcceptNftBidTxHandler(txData) {
1170
1169
  kioskTx: txData?.kioskTx,
1171
1170
  kioskOwner: txData?.itemOwner,
1172
1171
  kiosk: txData?.sellerKiosk,
1172
+ shouldConvertToPersonalKiosk: Boolean(await hasPersonalKioskRule(txData?.nftType)),
1173
1173
  shouldAssertNftInSharedKiosk: true,
1174
1174
  async runCommands(kioskTx) {
1175
1175
  await addTradeportKioskAcceptNftBidTx({
@@ -1609,9 +1609,7 @@ async function addTradePortAcceptCollectionBidTxHandler(txData) {
1609
1609
  }
1610
1610
  });
1611
1611
  }
1612
- console.log("bidType", bidType);
1613
1612
  if (isTradePortKioskBid(bidType)) {
1614
- console.log("1");
1615
1613
  if (txData?.sellerKiosk) {
1616
1614
  const royaltyRuleModule = getRoyaltyRuleModule(txData?.nftType);
1617
1615
  const royaltyRulePackageId = await getRulePackageId({
@@ -1619,13 +1617,13 @@ async function addTradePortAcceptCollectionBidTxHandler(txData) {
1619
1617
  ruleType: "royalty_rule",
1620
1618
  kioskClient: txData?.kioskClient
1621
1619
  });
1622
- console.log("2");
1623
1620
  return kioskTxWrapper({
1624
1621
  tx: txData?.tx,
1625
1622
  kioskClient: txData?.kioskClient,
1626
1623
  kioskTx: txData?.kioskTx,
1627
1624
  kioskOwner: txData?.itemOwner,
1628
1625
  kiosk: txData?.sellerKiosk,
1626
+ shouldConvertToPersonalKiosk: Boolean(await hasPersonalKioskRule(txData?.nftType)),
1629
1627
  shouldAssertNftInSharedKiosk: true,
1630
1628
  async runCommands(kioskTx) {
1631
1629
  await addTradeportKioskAcceptCollectionBidTx({
@@ -1650,6 +1648,7 @@ async function addTradePortAcceptCollectionBidTxHandler(txData) {
1650
1648
  kioskTx: txData?.kioskTx,
1651
1649
  kioskOwner: txData?.seller,
1652
1650
  kiosk: txData?.sellerKiosk,
1651
+ shouldConvertToPersonalKiosk: Boolean(await hasPersonalKioskRule(txData?.nftType)),
1653
1652
  async runCommands(kioskTx) {
1654
1653
  kioskTx.place({
1655
1654
  item: txData?.nftTokenId,