@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/CHANGELOG.md +6 -0
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/helpers/rpc/getObjectType.ts +6 -2
- package/src/methods/claimNfts/claimNfts.ts +14 -0
- package/src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts +2 -3
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1642,8 +1642,9 @@ var getObjectType = async ({
|
|
|
1642
1642
|
suiClient,
|
|
1643
1643
|
objectId
|
|
1644
1644
|
}) => {
|
|
1645
|
-
|
|
1646
|
-
|
|
1645
|
+
const normalizedObjectId = objectId.startsWith("0x") ? addLeadingZerosAfter0x(objectId) : objectId;
|
|
1646
|
+
if ((0, import_utils.isValidSuiObjectId)(normalizedObjectId)) {
|
|
1647
|
+
const res = await suiClient.getObject({ id: normalizedObjectId, options: { showType: true } });
|
|
1647
1648
|
return res.data.type;
|
|
1648
1649
|
}
|
|
1649
1650
|
return "";
|
|
@@ -4542,7 +4543,9 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
4542
4543
|
variables: { ownerAddress: addLeadingZerosAfter0x(walletAddress) }
|
|
4543
4544
|
});
|
|
4544
4545
|
const walletAddressKiosks = kiosksByOwnerRes?.kiosks;
|
|
4546
|
+
let globalKioskTx;
|
|
4545
4547
|
for (const nft of res.nfts) {
|
|
4548
|
+
let existingKioskTx;
|
|
4546
4549
|
if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(nft?.token_id)) {
|
|
4547
4550
|
throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
|
|
4548
4551
|
}
|
|
@@ -4591,9 +4594,11 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
4591
4594
|
kioskOwner: txData?.claimer,
|
|
4592
4595
|
kioskOwnerKiosks: walletAddressKiosks,
|
|
4593
4596
|
kiosk: txData?.sellerKiosk,
|
|
4597
|
+
kioskTx: globalKioskTx,
|
|
4594
4598
|
shouldConvertToPersonalKiosk: true,
|
|
4595
4599
|
shouldAllowNftUnsharedKiosk: true,
|
|
4596
4600
|
async runCommands(kioskTx) {
|
|
4601
|
+
existingKioskTx = kioskTx;
|
|
4597
4602
|
await addBluemoveClaimAcceptedBidNft({
|
|
4598
4603
|
...txData,
|
|
4599
4604
|
suiClient: context.suiClient,
|
|
@@ -4610,9 +4615,11 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
4610
4615
|
kioskOwner: txData?.claimer,
|
|
4611
4616
|
kioskOwnerKiosks: walletAddressKiosks,
|
|
4612
4617
|
kiosk: txData?.sellerKiosk,
|
|
4618
|
+
kioskTx: globalKioskTx,
|
|
4613
4619
|
shouldConvertToPersonalKiosk: true,
|
|
4614
4620
|
shouldAllowNftUnsharedKiosk: true,
|
|
4615
4621
|
async runCommands(kioskTx) {
|
|
4622
|
+
existingKioskTx = kioskTx;
|
|
4616
4623
|
await addClaimAcceptedBidNftTx({ ...txData, kioskTx });
|
|
4617
4624
|
}
|
|
4618
4625
|
});
|
|
@@ -4623,9 +4630,11 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
4623
4630
|
kioskOwner: txData?.claimer,
|
|
4624
4631
|
kioskOwnerKiosks: walletAddressKiosks,
|
|
4625
4632
|
kiosk: txData?.sellerKiosk,
|
|
4633
|
+
kioskTx: globalKioskTx,
|
|
4626
4634
|
shouldConvertToPersonalKiosk: true,
|
|
4627
4635
|
shouldAssertNftInSharedKiosk: true,
|
|
4628
4636
|
async runCommands(kioskTx) {
|
|
4637
|
+
existingKioskTx = kioskTx;
|
|
4629
4638
|
await addClaimAcceptedBidNftWithPurchaseCapTx({ ...txData, kioskTx });
|
|
4630
4639
|
}
|
|
4631
4640
|
});
|
|
@@ -4651,9 +4660,11 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
4651
4660
|
kiosk: txData?.sellerKiosk,
|
|
4652
4661
|
kioskOwnerKiosks: walletAddressKiosks,
|
|
4653
4662
|
kioskStrategy: "exclude",
|
|
4663
|
+
kioskTx: globalKioskTx,
|
|
4654
4664
|
shouldConvertToPersonalKiosk: true,
|
|
4655
4665
|
shouldAllowNftUnsharedKiosk: true,
|
|
4656
4666
|
async runCommands(kioskTx) {
|
|
4667
|
+
existingKioskTx = kioskTx;
|
|
4657
4668
|
await addClaimTransferredNftTx({ ...txData, kioskTx });
|
|
4658
4669
|
}
|
|
4659
4670
|
});
|
|
@@ -4665,15 +4676,19 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
|
|
|
4665
4676
|
kiosk: txData?.sellerKiosk,
|
|
4666
4677
|
kioskOwnerKiosks: walletAddressKiosks,
|
|
4667
4678
|
kioskStrategy: "exclude",
|
|
4679
|
+
kioskTx: globalKioskTx,
|
|
4668
4680
|
shouldConvertToPersonalKiosk: true,
|
|
4669
4681
|
shouldAllowNftUnsharedKiosk: true,
|
|
4670
4682
|
async runCommands(kioskTx) {
|
|
4683
|
+
existingKioskTx = kioskTx;
|
|
4671
4684
|
await addClaimTransferredNftWithPurchaseCapTx({ ...txData, kioskTx });
|
|
4672
4685
|
}
|
|
4673
4686
|
});
|
|
4674
4687
|
}
|
|
4675
4688
|
}
|
|
4689
|
+
globalKioskTx = existingKioskTx;
|
|
4676
4690
|
}
|
|
4691
|
+
globalKioskTx?.finalize();
|
|
4677
4692
|
return import_transactions13.Transaction.from(tx);
|
|
4678
4693
|
};
|
|
4679
4694
|
|
|
@@ -5467,7 +5482,6 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }
|
|
|
5467
5482
|
}
|
|
5468
5483
|
}
|
|
5469
5484
|
const unsharedNativeKiosks = res?.kiosks?.filter((k) => !k.is_shared && !k.is_origin_byte)?.map((k) => k.id);
|
|
5470
|
-
let globalKioskTx;
|
|
5471
5485
|
const allNfts = await gqlChainRequest({
|
|
5472
5486
|
chain: "sui",
|
|
5473
5487
|
query: fetchBulkNftsByKioskId,
|
|
@@ -5497,12 +5511,13 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }
|
|
|
5497
5511
|
return acc;
|
|
5498
5512
|
}, []);
|
|
5499
5513
|
const transferPolicies = await Promise.all(
|
|
5500
|
-
allNftTypes.map((type) => getKioskTransferPolicies(type))
|
|
5514
|
+
allNftTypes.map(async (type) => getKioskTransferPolicies(type))
|
|
5501
5515
|
);
|
|
5502
5516
|
const mappedTrasferPolicies = {};
|
|
5503
5517
|
transferPolicies.forEach((tp) => {
|
|
5504
5518
|
mappedTrasferPolicies[tp.transfer_policies_by_type?.[0]?.type] = tp.transfer_policies_by_type;
|
|
5505
5519
|
});
|
|
5520
|
+
let globalKioskTx;
|
|
5506
5521
|
for (const unsharedNativeKiosk of unsharedNativeKiosks) {
|
|
5507
5522
|
if (currentMigrationCount >= max) {
|
|
5508
5523
|
continue;
|