@tradeport/sui-trading-sdk 0.4.3 → 0.4.4

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.mjs CHANGED
@@ -1616,8 +1616,9 @@ var getObjectType = async ({
1616
1616
  suiClient,
1617
1617
  objectId
1618
1618
  }) => {
1619
- if (isValidSuiObjectId(objectId)) {
1620
- const res = await suiClient.getObject({ id: objectId, options: { showType: true } });
1619
+ const normalizedObjectId = objectId.startsWith("0x") ? addLeadingZerosAfter0x(objectId) : objectId;
1620
+ if (isValidSuiObjectId(normalizedObjectId)) {
1621
+ const res = await suiClient.getObject({ id: normalizedObjectId, options: { showType: true } });
1621
1622
  return res.data.type;
1622
1623
  }
1623
1624
  return "";
@@ -4518,7 +4519,9 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
4518
4519
  variables: { ownerAddress: addLeadingZerosAfter0x(walletAddress) }
4519
4520
  });
4520
4521
  const walletAddressKiosks = kiosksByOwnerRes?.kiosks;
4522
+ let globalKioskTx;
4521
4523
  for (const nft of res.nfts) {
4524
+ let existingKioskTx;
4522
4525
  if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(nft?.token_id)) {
4523
4526
  throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
4524
4527
  }
@@ -4567,9 +4570,11 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
4567
4570
  kioskOwner: txData?.claimer,
4568
4571
  kioskOwnerKiosks: walletAddressKiosks,
4569
4572
  kiosk: txData?.sellerKiosk,
4573
+ kioskTx: globalKioskTx,
4570
4574
  shouldConvertToPersonalKiosk: true,
4571
4575
  shouldAllowNftUnsharedKiosk: true,
4572
4576
  async runCommands(kioskTx) {
4577
+ existingKioskTx = kioskTx;
4573
4578
  await addBluemoveClaimAcceptedBidNft({
4574
4579
  ...txData,
4575
4580
  suiClient: context.suiClient,
@@ -4586,9 +4591,11 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
4586
4591
  kioskOwner: txData?.claimer,
4587
4592
  kioskOwnerKiosks: walletAddressKiosks,
4588
4593
  kiosk: txData?.sellerKiosk,
4594
+ kioskTx: globalKioskTx,
4589
4595
  shouldConvertToPersonalKiosk: true,
4590
4596
  shouldAllowNftUnsharedKiosk: true,
4591
4597
  async runCommands(kioskTx) {
4598
+ existingKioskTx = kioskTx;
4592
4599
  await addClaimAcceptedBidNftTx({ ...txData, kioskTx });
4593
4600
  }
4594
4601
  });
@@ -4599,9 +4606,11 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
4599
4606
  kioskOwner: txData?.claimer,
4600
4607
  kioskOwnerKiosks: walletAddressKiosks,
4601
4608
  kiosk: txData?.sellerKiosk,
4609
+ kioskTx: globalKioskTx,
4602
4610
  shouldConvertToPersonalKiosk: true,
4603
4611
  shouldAssertNftInSharedKiosk: true,
4604
4612
  async runCommands(kioskTx) {
4613
+ existingKioskTx = kioskTx;
4605
4614
  await addClaimAcceptedBidNftWithPurchaseCapTx({ ...txData, kioskTx });
4606
4615
  }
4607
4616
  });
@@ -4627,9 +4636,11 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
4627
4636
  kiosk: txData?.sellerKiosk,
4628
4637
  kioskOwnerKiosks: walletAddressKiosks,
4629
4638
  kioskStrategy: "exclude",
4639
+ kioskTx: globalKioskTx,
4630
4640
  shouldConvertToPersonalKiosk: true,
4631
4641
  shouldAllowNftUnsharedKiosk: true,
4632
4642
  async runCommands(kioskTx) {
4643
+ existingKioskTx = kioskTx;
4633
4644
  await addClaimTransferredNftTx({ ...txData, kioskTx });
4634
4645
  }
4635
4646
  });
@@ -4641,15 +4652,19 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
4641
4652
  kiosk: txData?.sellerKiosk,
4642
4653
  kioskOwnerKiosks: walletAddressKiosks,
4643
4654
  kioskStrategy: "exclude",
4655
+ kioskTx: globalKioskTx,
4644
4656
  shouldConvertToPersonalKiosk: true,
4645
4657
  shouldAllowNftUnsharedKiosk: true,
4646
4658
  async runCommands(kioskTx) {
4659
+ existingKioskTx = kioskTx;
4647
4660
  await addClaimTransferredNftWithPurchaseCapTx({ ...txData, kioskTx });
4648
4661
  }
4649
4662
  });
4650
4663
  }
4651
4664
  }
4665
+ globalKioskTx = existingKioskTx;
4652
4666
  }
4667
+ globalKioskTx?.finalize();
4653
4668
  return Transaction13.from(tx);
4654
4669
  };
4655
4670
 
@@ -5443,7 +5458,6 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }
5443
5458
  }
5444
5459
  }
5445
5460
  const unsharedNativeKiosks = res?.kiosks?.filter((k) => !k.is_shared && !k.is_origin_byte)?.map((k) => k.id);
5446
- let globalKioskTx;
5447
5461
  const allNfts = await gqlChainRequest({
5448
5462
  chain: "sui",
5449
5463
  query: fetchBulkNftsByKioskId,
@@ -5473,12 +5487,13 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }
5473
5487
  return acc;
5474
5488
  }, []);
5475
5489
  const transferPolicies = await Promise.all(
5476
- allNftTypes.map((type) => getKioskTransferPolicies(type))
5490
+ allNftTypes.map(async (type) => getKioskTransferPolicies(type))
5477
5491
  );
5478
5492
  const mappedTrasferPolicies = {};
5479
5493
  transferPolicies.forEach((tp) => {
5480
5494
  mappedTrasferPolicies[tp.transfer_policies_by_type?.[0]?.type] = tp.transfer_policies_by_type;
5481
5495
  });
5496
+ let globalKioskTx;
5482
5497
  for (const unsharedNativeKiosk of unsharedNativeKiosks) {
5483
5498
  if (currentMigrationCount >= max) {
5484
5499
  continue;