@tradeport/sui-trading-sdk 0.4.25 → 0.4.26

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.js CHANGED
@@ -5568,6 +5568,10 @@ async function relistNft({
5568
5568
  transferPolicies,
5569
5569
  walletAddress
5570
5570
  }) {
5571
+ const firstListedOrExpiredListing = (nft?.listings).find((l) => l.listed || l.nonce);
5572
+ if (!firstListedOrExpiredListing) {
5573
+ throw new Error("No listing found for NFT");
5574
+ }
5571
5575
  const txData = {
5572
5576
  tx,
5573
5577
  suiClient,
@@ -5580,13 +5584,13 @@ async function relistNft({
5580
5584
  collectionChainState: nft?.collection?.chain_state,
5581
5585
  nft
5582
5586
  }),
5583
- listingNonce: nft?.listings?.[0]?.nonce,
5584
- price: nft?.listings?.[0]?.price,
5587
+ listingNonce: firstListedOrExpiredListing.nonce,
5588
+ price: firstListedOrExpiredListing.price,
5585
5589
  sellerKiosk: nft?.chain_state?.kiosk_id,
5586
5590
  collectionId: nft?.collection_id,
5587
5591
  seller: walletAddress
5588
5592
  };
5589
- switch (nft?.listings?.[0]?.market_name) {
5593
+ switch (firstListedOrExpiredListing.market_name) {
5590
5594
  case "tradeport":
5591
5595
  if ((!isOriginByteCollection(txData?.transferPolicies) || ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) && txData?.listingNonce && await isNonKioskListing({
5592
5596
  suiClient: txData?.suiClient,