@tradeport/sui-trading-sdk 0.1.88 → 0.1.90

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.89
4
+
5
+ ### Patch Changes
6
+
7
+ - 48aa876: Added handling for placing kumo solo bids
8
+
3
9
  ## 0.1.87
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -55,8 +55,7 @@ function createChainGQLQuery({ chain, query }) {
55
55
  throw new Error("Invalid query string format");
56
56
  }
57
57
  const [, queryName, argsString, bodyString] = matches;
58
- if (!argsString || !bodyString)
59
- return "";
58
+ if (!argsString || !bodyString) return "";
60
59
  const args = argsString.trim().length ? `(${argsString.trim()})` : "";
61
60
  const body = bodyString.trim();
62
61
  const wrappedBody = `${chain} {
@@ -212,8 +211,7 @@ var getNftType = ({
212
211
  if (collectionId === "a6fabb11-4713-4203-bce8-a3c4f673b5a7") {
213
212
  return nft?.properties?.nft_type;
214
213
  }
215
- if (collectionChainState?.nft_type)
216
- return collectionChainState.nft_type;
214
+ if (collectionChainState?.nft_type) return collectionChainState.nft_type;
217
215
  let nftType = nft?.properties?.nft_type;
218
216
  if (!nftType || nftType?.split("::")?.length <= 1) {
219
217
  nftType = nft?.contract?.properties?.nft_type;
@@ -300,16 +298,14 @@ var addLeadingZerosAfter0x = (str) => `0x${str?.replace("0x", "").padStart(64, "
300
298
  // src/helpers/getSharedObjects.ts
301
299
  var getSharedObjects = async (nftType) => {
302
300
  const nftTypeSplit = nftType?.split("::");
303
- if (nftTypeSplit?.[0])
304
- nftTypeSplit[0] = addLeadingZerosAfter0x(nftTypeSplit[0]);
301
+ if (nftTypeSplit?.[0]) nftTypeSplit[0] = addLeadingZerosAfter0x(nftTypeSplit[0]);
305
302
  const res = await gqlChainRequest({
306
303
  chain: "sui",
307
304
  query: fetchSharedObjectsByType,
308
305
  variables: { type: nftTypeSplit?.join("::") }
309
306
  });
310
307
  let allowList = res?.sharedObjects?.filter((object) => object?.module === "allowlist")?.[0]?.id;
311
- if (!allowList)
312
- allowList = ORIGIN_BYTE_ALLOW_LIST_OBJECT;
308
+ if (!allowList) allowList = ORIGIN_BYTE_ALLOW_LIST_OBJECT;
313
309
  if (nftType === "0x5f1fa51a6d5c52df7dfe0ff7efaab7cc769d81e51cf208a424e455575aa1ed7a::stork::Stork") {
314
310
  allowList = STORKS_ORIGIN_BYTE_ALLOW_LIST;
315
311
  }
@@ -361,8 +357,7 @@ var getSharedObjects = async (nftType) => {
361
357
  // src/utils/normalizeNftType.ts
362
358
  var normalizedNftType = (nftType) => {
363
359
  const nftTypeSplit = nftType?.split("::");
364
- if (nftTypeSplit?.[0])
365
- nftTypeSplit[0] = addLeadingZerosAfter0x(nftTypeSplit[0]);
360
+ if (nftTypeSplit?.[0]) nftTypeSplit[0] = addLeadingZerosAfter0x(nftTypeSplit[0]);
366
361
  return nftTypeSplit?.join("::");
367
362
  };
368
363
 
@@ -740,8 +735,7 @@ var lockNftInsideKioskIfNotLocked = async ({
740
735
  const res = await kioskClient.getKiosk({ id: sellerKiosk });
741
736
  isLocked = res?.items?.find((i) => i.objectId === nftTokenId)?.isLocked;
742
737
  }
743
- if (isLocked)
744
- return;
738
+ if (isLocked) return;
745
739
  const item = kioskTx.take({
746
740
  itemId: nftTokenId,
747
741
  itemType: nftType
@@ -785,11 +779,9 @@ function resolveKioskLockRule({
785
779
  kioskItem,
786
780
  shouldSkipLocking
787
781
  }) {
788
- if (!kiosk || !kioskCap)
789
- throw new Error("Missing Owned Kiosk or Owned Kiosk Cap");
782
+ if (!kiosk || !kioskCap) throw new Error("Missing Owned Kiosk or Owned Kiosk Cap");
790
783
  if (!shouldSkipLocking) {
791
- if (!kioskItem)
792
- throw new Error("Missing Kiosk Item");
784
+ if (!kioskItem) throw new Error("Missing Kiosk Item");
793
785
  tx.moveCall({
794
786
  target: "0x2::kiosk::lock",
795
787
  typeArguments: [nftType],
@@ -805,8 +797,7 @@ function resolveKioskLockRule({
805
797
 
806
798
  // src/helpers/kiosk/resolvePersonalKioskRule.ts
807
799
  function resolvePersonalKioskRule({ tx, packageId, nftType, kiosk, transferRequest }) {
808
- if (!kiosk)
809
- throw new Error("Missing owned Kiosk.");
800
+ if (!kiosk) throw new Error("Missing owned Kiosk.");
810
801
  tx.moveCall({
811
802
  target: `${packageId}::personal_kiosk_rule::prove`,
812
803
  typeArguments: [nftType],
@@ -956,8 +947,7 @@ var resolveTransferPolicies = async ({
956
947
  break;
957
948
  case "royalty_rule":
958
949
  case "kiosk_royalty_rule":
959
- if (shouldSkipResolvingRoyaltyRule)
960
- break;
950
+ if (shouldSkipResolvingRoyaltyRule) break;
961
951
  resolveRoyaltyRule({
962
952
  tx,
963
953
  packageId: rulePackageId,
@@ -1060,7 +1050,7 @@ async function addTradeportKioskAcceptNftBidTx({
1060
1050
  const transferPolicyId = (await getKioskTransferPolicies(nftType))?.at(0)?.id;
1061
1051
  if (beforeResolveKioskTransferRequest) {
1062
1052
  const [feeCoin, transferRequest] = tx.moveCall({
1063
- target: "0x6468e232af988cd8be608b1901863f0d7dbaa16764c1834daa39b023cb3b2fc8::kiosk_biddings::accept_bid_with_price_lock",
1053
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_biddings::accept_bid_with_price_lock",
1064
1054
  arguments: [
1065
1055
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
1066
1056
  tx.pure.address(bidNonce),
@@ -1093,7 +1083,7 @@ async function addTradeportKioskAcceptNftBidTx({
1093
1083
  transferPolicyId
1094
1084
  });
1095
1085
  const [feeCoin, transferRequest] = tx.moveCall({
1096
- target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_biddings::accept_bid_with_purchase_cap",
1086
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_biddings::accept_bid_with_purchase_cap",
1097
1087
  arguments: [
1098
1088
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
1099
1089
  tx.pure.address(bidNonce),
@@ -1259,7 +1249,7 @@ async function addTradePortKioskUnlistTx({
1259
1249
  nftType
1260
1250
  }) {
1261
1251
  tx.moveCall({
1262
- target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_listings::unlist",
1252
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_listings::unlist",
1263
1253
  arguments: [
1264
1254
  tx.object(TRADEPORT_KIOSK_LISTING_STORE),
1265
1255
  tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
@@ -2213,6 +2203,13 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
2213
2203
  });
2214
2204
  };
2215
2205
  switch (bid.type) {
2206
+ // case 'solo': {
2207
+ // await acceptNftBids(
2208
+ // { bidIds: [bidId], tx, kioskTx, beforeResolveKioskTransferRequest },
2209
+ // context,
2210
+ // );
2211
+ // break;
2212
+ // }
2216
2213
  case "collection": {
2217
2214
  await acceptCollectionBid(
2218
2215
  {
@@ -2368,8 +2365,7 @@ var splitCoins = ({ tx, amounts }) => {
2368
2365
  // src/methods/buyListings/addBuyListingTxs.ts
2369
2366
  function addTradePortBuyTx({ tx, nftType, listingNonce, price, sharedObjects }) {
2370
2367
  const [coin] = splitCoins({ tx, amounts: [tx.pure.u64(price)] });
2371
- if (!coin)
2372
- throw new Error("Coin could not be split");
2368
+ if (!coin) throw new Error("Coin could not be split");
2373
2369
  const { collection, royaltyStrategy } = sharedObjects;
2374
2370
  if (collection && royaltyStrategy) {
2375
2371
  tx.moveCall({
@@ -2420,10 +2416,9 @@ var addTradeportKioskBuyTx = async ({
2420
2416
  const coin = tx.splitCoins(coinToSplit ? coinToSplit : tx.gas, [
2421
2417
  tx.pure.u64(price + Number(response.data.content.fields.commission))
2422
2418
  ]);
2423
- if (!coin)
2424
- throw new Error("Coin could not be split");
2419
+ if (!coin) throw new Error("Coin could not be split");
2425
2420
  const [kioskItem, transferRequest, kioskPrice] = tx.moveCall({
2426
- target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_listings::buy",
2421
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_listings::buy",
2427
2422
  arguments: [
2428
2423
  tx.object(TRADEPORT_KIOSK_LISTING_STORE),
2429
2424
  tx.object(sellerKiosk),
@@ -2464,8 +2459,7 @@ async function addOriginByteBuyTx({
2464
2459
  address: buyer
2465
2460
  });
2466
2461
  const [coin] = splitCoins({ tx, amounts: [tx.pure.u64(price)] });
2467
- if (!coin)
2468
- throw new Error("Coin could not be split");
2462
+ if (!coin) throw new Error("Coin could not be split");
2469
2463
  const transferRequest = tx.moveCall({
2470
2464
  target: "0x8534e4cdfd28709c94330a9783c3d5fe6f5daba0bffb69102ce303c5b38aed5a::orderbook::buy_nft",
2471
2465
  arguments: [
@@ -2497,8 +2491,7 @@ var addHyperspaceKioskBuyTx = async ({
2497
2491
  }) => {
2498
2492
  await assertNftInSharedKiosk({ kioskId: sellerKiosk, walletAddress: seller });
2499
2493
  const [coin] = splitCoins({ tx, amounts: [tx.pure.u64(price)] });
2500
- if (!coin)
2501
- throw new Error("Coin could not be split");
2494
+ if (!coin) throw new Error("Coin could not be split");
2502
2495
  const [kioskItem, transferRequest, hyperspaceTransferRequest, hyperspaceMpTransferRequest] = tx.moveCall({
2503
2496
  target: "0x6ea97b03c441edd54ae89224bf9560e583ee66c37e6c246f5db35258e580ba94::hyperspace::purchase",
2504
2497
  arguments: [tx.object(sellerKiosk), tx.pure.address(nftTokenId), tx.object(coin)],
@@ -2528,8 +2521,7 @@ var addHyperspaceKioskBuyTx = async ({
2528
2521
  };
2529
2522
  function addBluemoveBuyTx({ tx, nftTokenId, nftType, price }) {
2530
2523
  const [coin] = splitCoins({ tx, amounts: [tx.pure.u64(price)] });
2531
- if (!coin)
2532
- throw new Error("Coin could not be split");
2524
+ if (!coin) throw new Error("Coin could not be split");
2533
2525
  tx.moveCall({
2534
2526
  target: "0xd5dd28cc24009752905689b2ba2bf90bfc8de4549b9123f93519bb8ba9bf9981::marketplace::buy_and_take",
2535
2527
  arguments: [
@@ -2560,8 +2552,7 @@ async function addBluemoveKioskBuyTx({
2560
2552
  tx,
2561
2553
  amounts: [tx.pure.u64(price), tx.pure.u64(price * 0.025)]
2562
2554
  });
2563
- if (!coin1 || !coin2)
2564
- throw new Error("Coin could not be split");
2555
+ if (!coin1 || !coin2) throw new Error("Coin could not be split");
2565
2556
  tx.mergeCoins(tx.object(coin1), [tx.object(coin2)]);
2566
2557
  const [kioskItem, transferRequest] = tx.moveCall({
2567
2558
  target: "0xcc97b74ed95c8e8a3ed88050a898727dee37896da579fc400d482b64db6149ff::kiosk_trade::kiosk_buy_v2",
@@ -2623,8 +2614,7 @@ async function addSouffl3BuyTx({ tx, nftType, price, listingNonce, collectionId
2623
2614
  }
2624
2615
  function addSomisBuyTx({ tx, sharedObjects, nftTokenId, nftType, price }) {
2625
2616
  const [coin] = splitCoins({ tx, amounts: [tx.pure.u64(price)] });
2626
- if (!coin)
2627
- throw new Error("Coin could not be split");
2617
+ if (!coin) throw new Error("Coin could not be split");
2628
2618
  tx.moveCall({
2629
2619
  target: "0xf0b0beb956e26bde50dbd6ac393026c4525aee3b194a9478f09748f7211b5a02::marketplace::buy_nft",
2630
2620
  arguments: [
@@ -2653,15 +2643,13 @@ async function addKeepsakeBuyTx({
2653
2643
  tx.pure.u64(price * Number(royalty) / 100 + price * Number(royalty) * 5e-5)
2654
2644
  ]
2655
2645
  });
2656
- if (!coin1 || !coin2)
2657
- throw new Error("Coin could not be split");
2646
+ if (!coin1 || !coin2) throw new Error("Coin could not be split");
2658
2647
  const [balance] = tx.moveCall({
2659
2648
  target: "0x2::coin::into_balance",
2660
2649
  arguments: [tx.object(coin2)],
2661
2650
  typeArguments: ["0x2::sui::SUI"]
2662
2651
  });
2663
- if (!balance)
2664
- throw new Error("Coin into_balance failed");
2652
+ if (!balance) throw new Error("Coin into_balance failed");
2665
2653
  const [transferRequest] = tx.moveCall({
2666
2654
  target: "0x02be8c4a1a3cea4d3255d870d367c87838a8cc2bfe4f216a6b67b153027087a7::keepsake_marketplace::buy",
2667
2655
  arguments: [
@@ -2672,8 +2660,7 @@ async function addKeepsakeBuyTx({
2672
2660
  ],
2673
2661
  typeArguments: [nftType]
2674
2662
  });
2675
- if (!transferRequest)
2676
- throw new Error("Transfer request could not be created");
2663
+ if (!transferRequest) throw new Error("Transfer request could not be created");
2677
2664
  tx.moveCall({
2678
2665
  target: "0x02be8c4a1a3cea4d3255d870d367c87838a8cc2bfe4f216a6b67b153027087a7::keepsake_royalties::confirm_transfer_with_balance",
2679
2666
  arguments: [tx.object(keepsakeRoyaltyStrategy), tx.object(transferRequest), tx.object(balance)],
@@ -2689,8 +2676,7 @@ async function addKeepsakeBuyTx({
2689
2676
  arguments: [tx.object(balance)],
2690
2677
  typeArguments: ["0x2::sui::SUI"]
2691
2678
  });
2692
- if (!balanceToTransfer)
2693
- throw new Error("Coin from_balance failed");
2679
+ if (!balanceToTransfer) throw new Error("Coin from_balance failed");
2694
2680
  tx.transferObjects(
2695
2681
  [tx.object(balanceToTransfer)],
2696
2682
  tx.pure.address(addLeadingZerosAfter0x(buyer))
@@ -2698,8 +2684,7 @@ async function addKeepsakeBuyTx({
2698
2684
  }
2699
2685
  var addTocenBuyTx = ({ tx, nftTokenIds, nftType, price }) => {
2700
2686
  const [coin] = splitCoins({ tx, amounts: [tx.pure.u64(price)] });
2701
- if (!coin)
2702
- throw new Error("Coin could not be split");
2687
+ if (!coin) throw new Error("Coin could not be split");
2703
2688
  tx.moveCall({
2704
2689
  target: "0x3605d91c559e80cf8fdeabae9abaccb0bc38f96eac0b32bf47e95a9159a5277f::tocen_marketplace::buy_cart",
2705
2690
  arguments: [
@@ -3232,7 +3217,7 @@ var addClaimAcceptedBidNftTx = async ({
3232
3217
  }) => {
3233
3218
  const transferPolicyId = (await getKioskTransferPolicies(nftType))?.at(0)?.id;
3234
3219
  const [transferRequest] = tx.moveCall({
3235
- target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_biddings::claim_bid",
3220
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_biddings::claim_bid",
3236
3221
  arguments: [
3237
3222
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
3238
3223
  tx.object(TRADEPORT_KIOSK_BIDDING_ESCROW_KIOSK),
@@ -3263,7 +3248,7 @@ var addClaimAcceptedBidNftWithPurchaseCapTx = async ({
3263
3248
  }) => {
3264
3249
  const transferPolicyId = (await getKioskTransferPolicies(nftType))?.at(0)?.id;
3265
3250
  const [transferRequest] = tx.moveCall({
3266
- target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_biddings::claim_bid_with_purchase_cap",
3251
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_biddings::claim_bid_with_purchase_cap",
3267
3252
  arguments: [
3268
3253
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
3269
3254
  tx.object(sellerKiosk),
@@ -3740,7 +3725,7 @@ async function addTradePortKioskListTx({
3740
3725
  }
3741
3726
  const marketFeePrice = getMarketFeePrice({ price: listPrice, collectionId });
3742
3727
  tx.moveCall({
3743
- target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_listings::list",
3728
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_listings::list",
3744
3729
  arguments: [
3745
3730
  tx.object(TRADEPORT_KIOSK_LISTING_STORE),
3746
3731
  tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
@@ -4287,6 +4272,40 @@ var hasRoyaltyRule = async (nftType) => {
4287
4272
  );
4288
4273
  };
4289
4274
 
4275
+ // src/helpers/kiosk/getKioskPlaceBidCoin.ts
4276
+ async function getKioskPlaceBidCoin({
4277
+ tx,
4278
+ nftType,
4279
+ bidAmount,
4280
+ marketFeePrice,
4281
+ royaltyRulePackageId,
4282
+ royaltyRuleModule,
4283
+ transferPolicyId
4284
+ }) {
4285
+ let coin;
4286
+ if (royaltyRulePackageId && royaltyRuleModule) {
4287
+ const fee = tx.moveCall({
4288
+ target: `${royaltyRulePackageId}::${royaltyRuleModule}::fee_amount`,
4289
+ arguments: [tx.object(transferPolicyId), tx.pure.u64(bidAmount)],
4290
+ typeArguments: [nftType]
4291
+ });
4292
+ const [coin1, coin2] = splitCoins({
4293
+ tx,
4294
+ amounts: [tx.pure.u64(bidAmount + marketFeePrice), tx.object(fee)]
4295
+ });
4296
+ coin = coin1;
4297
+ if (!coin1 || !coin2) throw new Error("Coin could not be split");
4298
+ tx.mergeCoins(tx.object(coin1), [tx.object(coin2)]);
4299
+ } else {
4300
+ const [coin1] = splitCoins({
4301
+ tx,
4302
+ amounts: [tx.pure.u64(bidAmount + marketFeePrice)]
4303
+ });
4304
+ coin = coin1;
4305
+ }
4306
+ return coin;
4307
+ }
4308
+
4290
4309
  // src/methods/placeCollectionBids/addPlaceCollectionBidTxs.ts
4291
4310
  function addTradePortCollectionBidTx({
4292
4311
  tx,
@@ -4323,30 +4342,17 @@ async function addTradePortKioskCollectionBidTx({
4323
4342
  price: bidAmount,
4324
4343
  collectionId
4325
4344
  });
4326
- let coin;
4327
- if (royaltyRulePackageId && royaltyRuleModule) {
4328
- const fee = tx.moveCall({
4329
- target: `${royaltyRulePackageId}::${royaltyRuleModule}::fee_amount`,
4330
- arguments: [tx.object(transferPolicyId), tx.pure.u64(bidAmount)],
4331
- typeArguments: [nftType]
4332
- });
4333
- const [coin1, coin2] = splitCoins({
4334
- tx,
4335
- amounts: [tx.pure.u64(bidAmount + marketFeePrice), tx.object(fee)]
4336
- });
4337
- coin = coin1;
4338
- if (!coin1 || !coin2)
4339
- throw new Error("Coin could not be split");
4340
- tx.mergeCoins(tx.object(coin1), [tx.object(coin2)]);
4341
- } else {
4342
- const [coin1] = splitCoins({
4343
- tx,
4344
- amounts: [tx.pure.u64(bidAmount + marketFeePrice)]
4345
- });
4346
- coin = coin1;
4347
- }
4345
+ const coin = await getKioskPlaceBidCoin({
4346
+ tx,
4347
+ nftType,
4348
+ bidAmount,
4349
+ marketFeePrice,
4350
+ royaltyRulePackageId,
4351
+ royaltyRuleModule,
4352
+ transferPolicyId
4353
+ });
4348
4354
  tx.moveCall({
4349
- target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_biddings::collection_bid",
4355
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_biddings::collection_bid",
4350
4356
  arguments: [
4351
4357
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
4352
4358
  tx.pure.u64(bidAmount),
@@ -4496,7 +4502,6 @@ function addTradePortPlaceNftBidTx({
4496
4502
  }
4497
4503
  async function addTradePortKioskPlaceNftBidTx({
4498
4504
  tx,
4499
- sharedObjects,
4500
4505
  collectionId,
4501
4506
  nftTokenId,
4502
4507
  nftType,
@@ -4504,31 +4509,72 @@ async function addTradePortKioskPlaceNftBidTx({
4504
4509
  royaltyRulePackageId,
4505
4510
  royaltyRuleModule
4506
4511
  }) {
4507
- const transferPolicyId = (await getKioskTransferPolicies(nftType))?.at(0)?.id;
4512
+ const transferPolicyId = await getKioskTransferPolicies(nftType).then(
4513
+ (policies) => policies?.[0]?.id
4514
+ );
4508
4515
  const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
4509
- const royaltyCoin = tx.moveCall({
4510
- target: `${royaltyRulePackageId}::${royaltyRuleModule}::fee_amount`,
4511
- arguments: [tx.object(transferPolicyId), tx.pure.u64(bidAmount?.toString())],
4516
+ const coin = await getKioskPlaceBidCoin({
4517
+ tx,
4518
+ nftType,
4519
+ bidAmount,
4520
+ marketFeePrice,
4521
+ royaltyRulePackageId,
4522
+ royaltyRuleModule,
4523
+ transferPolicyId
4524
+ });
4525
+ tx.moveCall({
4526
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_biddings::bid",
4527
+ arguments: [
4528
+ tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
4529
+ tx.pure.address(nftTokenId),
4530
+ tx.pure.u64(bidAmount),
4531
+ tx.object(coin),
4532
+ tx.pure.u64(marketFeePrice),
4533
+ tx.pure.address(TRADEPORT_BENEFICIARY_ADDRESS)
4534
+ ],
4512
4535
  typeArguments: [nftType]
4513
4536
  });
4514
- const [coin1, coin2] = splitCoins({
4537
+ destroyZeroCoin({ tx, coin });
4538
+ }
4539
+ async function addKumoTradePortKioskPlaceNftBidTx({
4540
+ tx,
4541
+ suiClient,
4542
+ collectionId,
4543
+ nftTokenId,
4544
+ nftType,
4545
+ bidAmount,
4546
+ royaltyRulePackageId,
4547
+ royaltyRuleModule
4548
+ }) {
4549
+ const transferPolicyId = await getKioskTransferPolicies(nftType).then(
4550
+ (policies) => policies?.[0]?.id
4551
+ );
4552
+ const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
4553
+ const coin = await getKioskPlaceBidCoin({
4515
4554
  tx,
4516
- amounts: [tx.pure.u64(bidAmount + marketFeePrice), tx.object(royaltyCoin)]
4555
+ nftType,
4556
+ bidAmount,
4557
+ marketFeePrice,
4558
+ royaltyRulePackageId,
4559
+ royaltyRuleModule,
4560
+ transferPolicyId
4517
4561
  });
4518
- tx.mergeCoins(tx.object(coin1), [tx.object(coin2)]);
4562
+ const kumoAttributes = await fetchKumoNftAttributes(suiClient, nftTokenId);
4563
+ const normalizedAttributes = normalizeKumoAttributes(kumoAttributes);
4519
4564
  tx.moveCall({
4520
- target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_biddings::bid",
4565
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_biddings::kumo_bid",
4521
4566
  arguments: [
4522
4567
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
4523
4568
  tx.pure.address(nftTokenId),
4524
4569
  tx.pure.u64(bidAmount),
4525
- tx.object(coin1),
4570
+ tx.object(coin),
4526
4571
  tx.pure.u64(marketFeePrice),
4527
- tx.pure.address(TRADEPORT_BENEFICIARY_ADDRESS)
4572
+ tx.pure.address(TRADEPORT_BENEFICIARY_ADDRESS),
4573
+ ...Object.values(normalizedAttributes).map((attr) => tx.pure.option("string", attr))
4528
4574
  ],
4529
4575
  typeArguments: [nftType]
4530
4576
  });
4531
- destroyZeroCoin({ tx, coin: coin1 });
4577
+ destroyZeroCoin({ tx, coin });
4532
4578
  }
4533
4579
  async function addTradePortPlaceNftBidTxHandler(txData) {
4534
4580
  if (isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
@@ -4541,11 +4587,49 @@ async function addTradePortPlaceNftBidTxHandler(txData) {
4541
4587
  ruleType: royaltyRuleModule,
4542
4588
  kioskClient: txData?.kioskClient
4543
4589
  });
4590
+ if (txData?.collectionId === "67aca668-31b0-4713-91cf-079d392b041a") {
4591
+ await addKumoTradePortKioskPlaceNftBidTx({
4592
+ ...txData,
4593
+ royaltyRulePackageId,
4594
+ royaltyRuleModule
4595
+ });
4596
+ return;
4597
+ }
4544
4598
  await addTradePortKioskPlaceNftBidTx({ ...txData, royaltyRulePackageId, royaltyRuleModule });
4545
4599
  return;
4546
4600
  }
4547
4601
  addTradePortPlaceNftBidTx(txData);
4548
4602
  }
4603
+ async function fetchKumoNftAttributes(suiClient, nftTokenId) {
4604
+ if (!nftTokenId) {
4605
+ throw new Error("NFT Token ID is required to fetch Kumo attributes");
4606
+ }
4607
+ let res;
4608
+ try {
4609
+ res = await suiClient.getObject({
4610
+ id: nftTokenId,
4611
+ options: { showContent: true }
4612
+ });
4613
+ } catch (error) {
4614
+ throw new Error(
4615
+ `Failed to fetch Kumo token object data: ${error instanceof Error ? error.message : "Unknown error"}`
4616
+ );
4617
+ }
4618
+ if (!res.data) {
4619
+ throw new Error(`NFT object data not found: ${nftTokenId}`);
4620
+ }
4621
+ if (res.data?.content?.dataType !== "moveObject") {
4622
+ throw new Error("Invalid NFT Token ID - not a move object");
4623
+ }
4624
+ const { accessory, background, eyes, fur_colour, mouth, tail, one_of_one } = res.data?.content?.fields || {};
4625
+ return { accessory, background, eyes, fur_colour, mouth, tail, one_of_one };
4626
+ }
4627
+ function normalizeKumoAttributes(attributes) {
4628
+ const normalizeAttribute = (attr) => !attr || attr === "Default" || attr === "None" ? null : attr;
4629
+ return Object.fromEntries(
4630
+ Object.entries(attributes).map(([key, value]) => [key, normalizeAttribute(value)])
4631
+ );
4632
+ }
4549
4633
 
4550
4634
  // src/methods/placeNftBids/placeNftBids.ts
4551
4635
  var placeNftBids = async ({ nfts, walletAddress }, context) => {
@@ -4568,6 +4652,7 @@ var placeNftBids = async ({ nfts, walletAddress }, context) => {
4568
4652
  const sharedObjects = await getSharedObjects(nftType);
4569
4653
  const txData = {
4570
4654
  tx,
4655
+ suiClient: context.suiClient,
4571
4656
  kioskClient: context.kioskClient,
4572
4657
  sharedObjects,
4573
4658
  bidder: walletAddress,
@@ -4601,7 +4686,7 @@ function addTradeportRemoveNftBidTx({ tx, bidNonce, nftType }) {
4601
4686
  }
4602
4687
  function addTradeportKioskRemoveNftBidTx({ tx, bidNonce, nftType }) {
4603
4688
  tx.moveCall({
4604
- target: "0xf527efa4c02d079f15389fb596b04688cd5767948d953942e494ff455f11aa7b::kiosk_biddings::cancel_bid",
4689
+ target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_biddings::cancel_bid",
4605
4690
  arguments: [tx.object(TRADEPORT_KIOSK_BIDDING_STORE), tx.pure.address(bidNonce)],
4606
4691
  typeArguments: [nftType]
4607
4692
  });