@tradeport/sui-trading-sdk 0.1.0 → 0.1.1

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,11 @@
1
1
  # @tradeport/sui-trading-sdk
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 6ef2c2b: Fixed Goats of Sui collection trading
8
+
3
9
  ## 0.1.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.js CHANGED
@@ -243,6 +243,9 @@ var BASC_ROYALTY_DECIMAL_PERCENT = 0.055;
243
243
  var DSL_LEGACY_ROYALTY_DECIMAL_PERCENT = 0.05;
244
244
  var PREMIUM_NOMINATOR = 300n;
245
245
  var PREMIUM_FEE_NOMINATOR = 2500n;
246
+ var ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK = [
247
+ "0xc4fc5b341858ac6fff4859d8105e345b195847cd230e8538d61a2f319ae8093c::bluemove_launchpad::GOATsOfSui"
248
+ ];
246
249
 
247
250
  // src/graphql/queries/fetchSharedObjectsByType.ts
248
251
  var import_graphql_request6 = require("graphql-request");
@@ -296,18 +299,15 @@ var getSharedObjects = async (nftType) => {
296
299
  if (nftType === "0x5fe8e884960f6977f813d871a3d43049d72d19d4ad07819b979c06434f60af4d::mint::SuiEcosystemNFT") {
297
300
  allowList = SUI_ECOSYSTEM_ORIGIN_BYTE_ALLOW_LIST_OBJECT;
298
301
  }
299
- let transferPolicy = res?.sharedObjects?.filter(
302
+ const transferPolicy = res?.sharedObjects?.filter(
300
303
  (object) => object?.module === "transfer_policy"
301
304
  )?.[0]?.id;
305
+ let orderbook = res?.sharedObjects?.filter((object) => object?.module === "orderbook")?.[0]?.id;
302
306
  if (nftTypeSplit?.join("::")?.includes("keepsake_nft::KEEPSAKE")) {
303
- transferPolicy = res?.sharedObjects?.filter(
304
- (object) => object?.type?.includes(
305
- "0x02be8c4a1a3cea4d3255d870d367c87838a8cc2bfe4f216a6b67b153027087a7::transfer_policy::TransferPolicy"
306
- )
307
- )?.[0]?.id;
307
+ orderbook = null;
308
308
  }
309
309
  return {
310
- orderbook: res?.sharedObjects?.filter((object) => object?.module === "orderbook")?.[0]?.id,
310
+ orderbook,
311
311
  collection: res?.sharedObjects?.filter((object) => object?.module === "collection")?.[0]?.id,
312
312
  marketplace: res?.sharedObjects?.filter((object) => object?.module === "marketplace")?.[0]?.id,
313
313
  royaltyStrategy: res?.sharedObjects?.filter(
@@ -1130,7 +1130,7 @@ function addSomisUnlistTx({
1130
1130
  });
1131
1131
  }
1132
1132
  async function addTradePortUnlistTxHandler(txData) {
1133
- if (txData?.listingNonce && isOriginByteTx(txData?.sharedObjects)) {
1133
+ if (txData?.listingNonce && isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
1134
1134
  addOriginByteUnlistTx(txData);
1135
1135
  return;
1136
1136
  }
@@ -1154,7 +1154,7 @@ async function addTradePortUnlistTxHandler(txData) {
1154
1154
  addTradePortUnlistTx(txData);
1155
1155
  }
1156
1156
  async function addHyperspaceUnlistTxHandler(txData) {
1157
- if (txData?.listingNonce && isOriginByteTx(txData?.sharedObjects)) {
1157
+ if (txData?.listingNonce && isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
1158
1158
  addOriginByteUnlistTx(txData);
1159
1159
  return;
1160
1160
  }
@@ -1171,7 +1171,7 @@ async function addHyperspaceUnlistTxHandler(txData) {
1171
1171
  });
1172
1172
  }
1173
1173
  async function addBluemoveUnlistTxHandler(txData) {
1174
- if (txData?.listingNonce && isOriginByteTx(txData?.sharedObjects)) {
1174
+ if (txData?.listingNonce && isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
1175
1175
  addOriginByteUnlistTx(txData);
1176
1176
  return;
1177
1177
  }
@@ -2521,7 +2521,7 @@ async function addTradePortKioskListTx({
2521
2521
  });
2522
2522
  }
2523
2523
  async function addTradePortListTxHandler(txData) {
2524
- if (isOriginByteTx(txData?.sharedObjects)) {
2524
+ if (isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
2525
2525
  await addOriginByteListTx(txData);
2526
2526
  return;
2527
2527
  }
@@ -2627,7 +2627,7 @@ async function relistNft({ tx, nft, listPrice, sharedObjects, walletAddress }) {
2627
2627
  };
2628
2628
  switch (nft?.listings?.[0]?.market_name) {
2629
2629
  case "tradeport":
2630
- if (!isOriginByteTx(txData?.sharedObjects) && txData?.listingNonce && await isNonKioskListing(txData?.listingNonce)) {
2630
+ if ((!isOriginByteTx(txData?.sharedObjects) || ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) && txData?.listingNonce && await isNonKioskListing(txData?.listingNonce)) {
2631
2631
  addTradePortRelistTx({ ...txData, listPrice });
2632
2632
  } else {
2633
2633
  return kioskTxWrapper({
@@ -2653,7 +2653,7 @@ async function relistNft({ tx, nft, listPrice, sharedObjects, walletAddress }) {
2653
2653
  await addTradePortListTxHandler({ ...txData, listPrice });
2654
2654
  break;
2655
2655
  case "bluemove":
2656
- if (!isOriginByteTx(txData?.sharedObjects) && !txData?.sellerKiosk) {
2656
+ if (!isOriginByteTx(txData?.sharedObjects) || ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType)) && !txData?.sellerKiosk) {
2657
2657
  addBlueMoveRelistTx({ ...txData, listPrice });
2658
2658
  } else {
2659
2659
  await addBluemoveUnlistTxHandler(txData);
@@ -2929,7 +2929,7 @@ var placeCollectionBids = async ({
2929
2929
  bidAmount: collections?.find((c) => c.id === collection?.id)?.bidAmountInMist
2930
2930
  };
2931
2931
  const numOfBids = collections?.find((c) => c.id === collection?.id)?.numOfBids;
2932
- if (isOriginByteTx(txData?.sharedObjects)) {
2932
+ if (isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
2933
2933
  const { kiosk: bidderKiosk, isNewKiosk: isNewBidderKiosk } = await getOrCreateOBKiosk({
2934
2934
  tx,
2935
2935
  address: txData.bidder
@@ -3041,7 +3041,7 @@ async function addOriginBytePlaceNftBidTx({
3041
3041
  destroyZeroCoin({ tx, coin });
3042
3042
  }
3043
3043
  async function addTradePortPlaceNftBidTxHandler(txData) {
3044
- if (isOriginByteTx(txData?.sharedObjects)) {
3044
+ if (isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
3045
3045
  await addOriginBytePlaceNftBidTx(txData);
3046
3046
  return;
3047
3047
  }