@tradeport/sui-trading-sdk 0.3.2 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tradeport/sui-trading-sdk
2
2
 
3
+ ## 0.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - b1a7516: Fixed unshared kiosk migration
8
+
9
+ ## 0.3.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 272b549: Fixed remove bids
14
+
3
15
  ## 0.3.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -109,6 +109,7 @@ type ListNfts = {
109
109
 
110
110
  type MigrateNftsFromUnsharedToSharedKiosks = {
111
111
  walletAddress: string;
112
+ max: number;
112
113
  };
113
114
 
114
115
  type PlaceCollectionBid = {
package/dist/index.d.ts CHANGED
@@ -109,6 +109,7 @@ type ListNfts = {
109
109
 
110
110
  type MigrateNftsFromUnsharedToSharedKiosks = {
111
111
  walletAddress: string;
112
+ max: number;
112
113
  };
113
114
 
114
115
  type PlaceCollectionBid = {
package/dist/index.js CHANGED
@@ -1497,9 +1497,6 @@ var kioskTxWrapper = async ({
1497
1497
  version: ""
1498
1498
  }
1499
1499
  });
1500
- if (shouldConvertToPersonalKiosk) {
1501
- kioskTx.convertToPersonal(true);
1502
- }
1503
1500
  } else {
1504
1501
  kioskTx = new import_kiosk3.KioskTransaction({ transactionBlock: tx, kioskClient });
1505
1502
  kioskTx.createPersonal(true);
@@ -5164,22 +5161,29 @@ function getTransferPolicyForDirectTransfer(collectionChainState) {
5164
5161
  }
5165
5162
 
5166
5163
  // src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts
5167
- async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress }, context) {
5164
+ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max }, context) {
5168
5165
  const tx = new import_transactions16.Transaction();
5169
5166
  const res = await gqlChainRequest({
5170
5167
  chain: "sui",
5171
5168
  query: fetchKiosksByOwner,
5172
5169
  variables: { ownerAddress: addLeadingZerosAfter0x(walletAddress) }
5173
5170
  });
5174
- const unsharedOBKiosks = res?.kiosks?.filter((k) => !k.is_shared && k.is_origin_byte)?.map((k) => k.id);
5171
+ const unsharedOBKiosks = res?.kiosks?.filter((k) => !k.is_shared && k.is_origin_byte)?.map((k) => k.id)?.slice(0, 5);
5172
+ let currentMigrationCount = 0;
5175
5173
  const sharedOBKiosk = res?.kiosks?.filter((k) => k.is_shared && k.is_origin_byte)?.[0]?.id;
5176
5174
  for (const unsharedOBKiosk of unsharedOBKiosks) {
5175
+ if (currentMigrationCount >= (max ?? 5)) {
5176
+ continue;
5177
+ }
5177
5178
  const res2 = await gqlChainRequest({
5178
5179
  chain: "sui",
5179
5180
  query: fetchNftsByKioskId,
5180
5181
  variables: { jsonFilter: { kiosk_id: unsharedOBKiosk } }
5181
5182
  });
5182
5183
  const nfts = res2?.nfts;
5184
+ if (nfts.length > 0) {
5185
+ currentMigrationCount++;
5186
+ }
5183
5187
  for (const nft of nfts) {
5184
5188
  if (nft?.chain_state?.claimable_trade_id) {
5185
5189
  continue;
@@ -5213,14 +5217,20 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress }, context)
5213
5217
  }
5214
5218
  }
5215
5219
  }
5216
- const unsharedNativeKiosks = res?.kiosks?.filter((k) => !k.is_shared && !k.is_origin_byte)?.map((k) => k.id);
5220
+ const unsharedNativeKiosks = res?.kiosks?.filter((k) => !k.is_shared && !k.is_origin_byte)?.map((k) => k.id)?.slice(0, 5);
5217
5221
  for (const unsharedNativeKiosk of unsharedNativeKiosks) {
5222
+ if (currentMigrationCount >= 5) {
5223
+ continue;
5224
+ }
5218
5225
  const res2 = await gqlChainRequest({
5219
5226
  chain: "sui",
5220
5227
  query: fetchNftsByKioskId,
5221
5228
  variables: { jsonFilter: { kiosk_id: unsharedNativeKiosk } }
5222
5229
  });
5223
5230
  const nfts = res2?.nfts;
5231
+ if (nfts?.length > 0) {
5232
+ currentMigrationCount++;
5233
+ }
5224
5234
  for (const nft of nfts) {
5225
5235
  if (nft?.claimable_reason === "offer-transfer") {
5226
5236
  continue;
@@ -5941,7 +5951,7 @@ var removeCollectionBids = async ({ bidIds, tx: existingTx }, context) => {
5941
5951
  throw new Error("No bids found");
5942
5952
  }
5943
5953
  const bidsForTracking = [];
5944
- const tx = import_transactions19.Transaction.from(existingTx) ?? new import_transactions19.Transaction();
5954
+ const tx = existingTx ? import_transactions19.Transaction.from(existingTx) : new import_transactions19.Transaction();
5945
5955
  for (const bid of res.bids) {
5946
5956
  if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
5947
5957
  throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
@@ -6003,7 +6013,7 @@ var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
6003
6013
  throw new Error("No bids found");
6004
6014
  }
6005
6015
  const bidsForTracking = [];
6006
- const tx = import_transactions20.Transaction.from(existingTx) ?? new import_transactions20.Transaction();
6016
+ const tx = existingTx ? import_transactions20.Transaction.from(existingTx) : new import_transactions20.Transaction();
6007
6017
  for (const bid of res.bids) {
6008
6018
  if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
6009
6019
  throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);