@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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/helpers/kiosk/kioskTxWrapper.ts +0 -4
- package/src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts +24 -3
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
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;
|