@tradeport/sui-trading-sdk 0.3.3 → 0.3.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
@@ -1471,9 +1471,6 @@ var kioskTxWrapper = async ({
1471
1471
  version: ""
1472
1472
  }
1473
1473
  });
1474
- if (shouldConvertToPersonalKiosk) {
1475
- kioskTx.convertToPersonal(true);
1476
- }
1477
1474
  } else {
1478
1475
  kioskTx = new KioskTransaction({ transactionBlock: tx, kioskClient });
1479
1476
  kioskTx.createPersonal(true);
@@ -5140,22 +5137,29 @@ function getTransferPolicyForDirectTransfer(collectionChainState) {
5140
5137
  }
5141
5138
 
5142
5139
  // src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts
5143
- async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress }, context) {
5140
+ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max }, context) {
5144
5141
  const tx = new Transaction16();
5145
5142
  const res = await gqlChainRequest({
5146
5143
  chain: "sui",
5147
5144
  query: fetchKiosksByOwner,
5148
5145
  variables: { ownerAddress: addLeadingZerosAfter0x(walletAddress) }
5149
5146
  });
5150
- const unsharedOBKiosks = res?.kiosks?.filter((k) => !k.is_shared && k.is_origin_byte)?.map((k) => k.id);
5147
+ const unsharedOBKiosks = res?.kiosks?.filter((k) => !k.is_shared && k.is_origin_byte)?.map((k) => k.id)?.slice(0, 5);
5148
+ let currentMigrationCount = 0;
5151
5149
  const sharedOBKiosk = res?.kiosks?.filter((k) => k.is_shared && k.is_origin_byte)?.[0]?.id;
5152
5150
  for (const unsharedOBKiosk of unsharedOBKiosks) {
5151
+ if (currentMigrationCount >= (max ?? 5)) {
5152
+ continue;
5153
+ }
5153
5154
  const res2 = await gqlChainRequest({
5154
5155
  chain: "sui",
5155
5156
  query: fetchNftsByKioskId,
5156
5157
  variables: { jsonFilter: { kiosk_id: unsharedOBKiosk } }
5157
5158
  });
5158
5159
  const nfts = res2?.nfts;
5160
+ if (nfts.length > 0) {
5161
+ currentMigrationCount++;
5162
+ }
5159
5163
  for (const nft of nfts) {
5160
5164
  if (nft?.chain_state?.claimable_trade_id) {
5161
5165
  continue;
@@ -5189,14 +5193,20 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress }, context)
5189
5193
  }
5190
5194
  }
5191
5195
  }
5192
- const unsharedNativeKiosks = res?.kiosks?.filter((k) => !k.is_shared && !k.is_origin_byte)?.map((k) => k.id);
5196
+ const unsharedNativeKiosks = res?.kiosks?.filter((k) => !k.is_shared && !k.is_origin_byte)?.map((k) => k.id)?.slice(0, 5);
5193
5197
  for (const unsharedNativeKiosk of unsharedNativeKiosks) {
5198
+ if (currentMigrationCount >= 5) {
5199
+ continue;
5200
+ }
5194
5201
  const res2 = await gqlChainRequest({
5195
5202
  chain: "sui",
5196
5203
  query: fetchNftsByKioskId,
5197
5204
  variables: { jsonFilter: { kiosk_id: unsharedNativeKiosk } }
5198
5205
  });
5199
5206
  const nfts = res2?.nfts;
5207
+ if (nfts?.length > 0) {
5208
+ currentMigrationCount++;
5209
+ }
5200
5210
  for (const nft of nfts) {
5201
5211
  if (nft?.claimable_reason === "offer-transfer") {
5202
5212
  continue;