@tradeport/sui-trading-sdk 0.4.13 → 0.4.15

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
@@ -1280,7 +1280,7 @@ var getSharedObjects = async (nftType) => {
1280
1280
  };
1281
1281
 
1282
1282
  // src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts
1283
- var import_utils3 = require("@mysten/sui/utils");
1283
+ var import_utils4 = require("@mysten/sui/utils");
1284
1284
 
1285
1285
  // src/utils/normalizeNftType.ts
1286
1286
  var normalizedNftType = (nftType) => {
@@ -1319,10 +1319,7 @@ var hasPersonalKioskRule = (transferPolicies) => getNativeKioskTransferPolicies(
1319
1319
  );
1320
1320
 
1321
1321
  // src/helpers/hasTransferPolicyRules.ts
1322
- var hasNativeKioskTransferPolicyRules = (transferPolicies) => {
1323
- const nativeKioskTransferPolicies = getNativeKioskTransferPolicies(transferPolicies);
1324
- return nativeKioskTransferPolicies?.some((policy) => policy?.rules?.length > 0);
1325
- };
1322
+ var hasNativeKioskTransferPolicyRules = (transferPolicies) => getNativeKioskTransferPolicies(transferPolicies)?.length > 0;
1326
1323
 
1327
1324
  // src/helpers/isSIngleBid.ts
1328
1325
  var isSingleBid = (bidType) => {
@@ -1382,16 +1379,52 @@ function addHexPrefix(input) {
1382
1379
  return "0x" + input;
1383
1380
  }
1384
1381
 
1382
+ // src/helpers/getTransferPolicyRuleNamesFromSuiObject.ts
1383
+ var import_utils = require("@mysten/sui/utils");
1384
+ var getTransferPolicyRuleNamesFromSuiObject = async ({
1385
+ suiClient,
1386
+ transferPolicyId
1387
+ }) => {
1388
+ const { data, error } = await suiClient.getObject({
1389
+ id: (0, import_utils.normalizeSuiObjectId)(transferPolicyId),
1390
+ options: {
1391
+ showContent: true
1392
+ }
1393
+ });
1394
+ if (error) {
1395
+ throw new Error(`Error on getting SUI object ${transferPolicyId}: ${error.code}`);
1396
+ }
1397
+ const content = data.content;
1398
+ const ruleNames = content.fields.rules.fields.contents.map(
1399
+ (rule) => (0, import_utils.normalizeStructTag)(rule.fields.name)
1400
+ );
1401
+ return ruleNames;
1402
+ };
1403
+
1385
1404
  // src/helpers/kiosk/getRulePackageId.ts
1386
1405
  var getRulePackageId = async ({
1406
+ transferPolicies,
1387
1407
  nftType,
1388
1408
  ruleType,
1389
- kioskClient
1409
+ kioskClient,
1410
+ suiClient
1390
1411
  }) => {
1391
- const transferPolicies = await kioskClient.getTransferPolicies({
1412
+ const transferPoliciesFromMystenSdk = await kioskClient.getTransferPolicies({
1392
1413
  type: normalizedNftType(nftType)
1393
1414
  });
1394
- const rule = transferPolicies.flatMap((policy) => policy.rules).filter((rule2) => rule2?.split("::")?.[1] === ruleType)?.[0];
1415
+ let rule;
1416
+ if (transferPoliciesFromMystenSdk.length > 0) {
1417
+ rule = transferPoliciesFromMystenSdk.flatMap((policy) => policy.rules).filter((rule2) => rule2?.split("::")?.[1] === ruleType)?.[0];
1418
+ } else if (transferPolicies.length > 0) {
1419
+ const transferPolicyId = getNativeKioskTransferPolicies(transferPolicies)?.at(0)?.id;
1420
+ const ruleNames = await getTransferPolicyRuleNamesFromSuiObject({
1421
+ suiClient,
1422
+ transferPolicyId
1423
+ });
1424
+ rule = ruleNames.filter((ruleName) => ruleName?.split("::")?.[1] === ruleType)?.[0];
1425
+ } else {
1426
+ throw new Error(`No transfer policy found for ${nftType}`);
1427
+ }
1395
1428
  const ruleDefinition = kioskClient.rules.find(
1396
1429
  (x) => (0, import_kiosk2.getNormalizedRuleType)(x.rule) === (0, import_kiosk2.getNormalizedRuleType)(rule)
1397
1430
  );
@@ -1640,13 +1673,13 @@ var shareOriginByteKiosk = async ({ tx, kiosk }) => {
1640
1673
  };
1641
1674
 
1642
1675
  // src/helpers/rpc/getObjectType.ts
1643
- var import_utils = require("@mysten/sui/utils");
1676
+ var import_utils2 = require("@mysten/sui/utils");
1644
1677
  var getObjectType = async ({
1645
1678
  suiClient,
1646
1679
  objectId
1647
1680
  }) => {
1648
1681
  const normalizedObjectId = objectId.startsWith("0x") ? addLeadingZerosAfter0x(objectId) : objectId;
1649
- if ((0, import_utils.isValidSuiObjectId)(normalizedObjectId)) {
1682
+ if ((0, import_utils2.isValidSuiObjectId)(normalizedObjectId)) {
1650
1683
  const res = await suiClient.getObject({ id: normalizedObjectId, options: { showType: true } });
1651
1684
  return res.data.type;
1652
1685
  }
@@ -1654,7 +1687,7 @@ var getObjectType = async ({
1654
1687
  };
1655
1688
 
1656
1689
  // src/methods/acceptNftBids/addAcceptNftBidTxs.ts
1657
- var import_utils2 = require("@mysten/sui/utils");
1690
+ var import_utils3 = require("@mysten/sui/utils");
1658
1691
 
1659
1692
  // src/graphql/queries/fetchMultibidById.ts
1660
1693
  var import_graphql_request11 = require("graphql-request");
@@ -1867,6 +1900,7 @@ async function resolveRoyaltyRule({
1867
1900
  var originByteRuleModules = ["royalty_strategy_bps", "transfer_allowlist"];
1868
1901
  var resolveTransferPolicies = async ({
1869
1902
  tx,
1903
+ transferPolicies,
1870
1904
  suiClient,
1871
1905
  walletAddress,
1872
1906
  kioskClient,
@@ -1882,35 +1916,51 @@ var resolveTransferPolicies = async ({
1882
1916
  coinToSplit,
1883
1917
  beforeResolveKioskTransferRequest
1884
1918
  }) => {
1885
- const transferPolicies = await kioskClient.getTransferPolicies({
1919
+ const transferPoliciesFromMystenSdk = await kioskClient.getTransferPolicies({
1886
1920
  type: normalizedNftType(nftType)
1887
1921
  });
1888
- if (transferPolicies.length === 0 && (customTransferPolicies ?? []).every(
1889
- (p) => p.transferRequest !== transferRequest
1890
- )) {
1891
- throw new Error(
1892
- `Missing transfer policy of ${nftType}. No way to resolve the transfer request.`
1893
- );
1894
- }
1895
- let policies = transferPolicies.length > 0 ? [
1896
- {
1897
- data: transferPolicies?.filter(
1898
- (policy) => policy?.rules?.filter(
1899
- (rule) => rule?.includes("royalty_rule") || rule?.includes("kiosk_lock_rule") || rule?.includes("personal_kiosk_rule") || rule?.includes("floor_price_rule")
1900
- )?.length > 0
1901
- )?.[0],
1902
- transferRequest,
1903
- isCustom: false
1904
- }
1905
- ] : [];
1906
- if (!policies?.[0]?.data && transferPolicies.length > 0) {
1922
+ let policies = [];
1923
+ if (transferPoliciesFromMystenSdk.length > 0) {
1907
1924
  policies = [
1908
1925
  {
1909
- data: transferPolicies?.[0],
1926
+ data: (
1927
+ // Find first policy with relevant rules, or fall back to first policy
1928
+ transferPoliciesFromMystenSdk.find(
1929
+ (policy) => policy?.rules?.some(
1930
+ (rule) => knownTransferPolicyRules.some((ruleType) => rule?.includes(ruleType))
1931
+ )
1932
+ ) ?? transferPoliciesFromMystenSdk[0]
1933
+ ),
1910
1934
  transferRequest,
1911
1935
  isCustom: false
1912
1936
  }
1913
1937
  ];
1938
+ } else if (transferPolicies.length > 0) {
1939
+ const transferPolicyId = getNativeKioskTransferPolicies(transferPolicies)?.at(0)?.id;
1940
+ if (transferPolicyId) {
1941
+ const ruleNames = await getTransferPolicyRuleNamesFromSuiObject({
1942
+ suiClient,
1943
+ transferPolicyId
1944
+ });
1945
+ if (ruleNames.length > 0) {
1946
+ policies = [
1947
+ {
1948
+ data: {
1949
+ id: transferPolicyId,
1950
+ rules: ruleNames
1951
+ },
1952
+ transferRequest,
1953
+ isCustom: false
1954
+ }
1955
+ ];
1956
+ }
1957
+ }
1958
+ } else if ((customTransferPolicies ?? []).every(
1959
+ (p) => p.transferRequest !== transferRequest
1960
+ )) {
1961
+ throw new Error(
1962
+ `Missing transfer policy of ${nftType}. No way to resolve the transfer request.`
1963
+ );
1914
1964
  }
1915
1965
  if (customTransferPolicies) {
1916
1966
  for (const customTransferPolicy of customTransferPolicies) {
@@ -2104,6 +2154,7 @@ async function addTradeportKioskAcceptNftBidTx({
2104
2154
  await beforeResolveKioskTransferRequest?.(feeCoin, transferRequest);
2105
2155
  await resolveTransferPolicies({
2106
2156
  tx,
2157
+ transferPolicies,
2107
2158
  suiClient,
2108
2159
  walletAddress: seller,
2109
2160
  kioskTx,
@@ -2136,6 +2187,7 @@ async function addTradeportKioskAcceptNftBidTx({
2136
2187
  }
2137
2188
  await resolveTransferPolicies({
2138
2189
  tx,
2190
+ transferPolicies,
2139
2191
  suiClient,
2140
2192
  walletAddress: seller,
2141
2193
  kioskTx,
@@ -2218,7 +2270,7 @@ function addBluemoveAcceptNftBidTx({
2218
2270
  });
2219
2271
  }
2220
2272
  async function addSingleBidAcceptNftBidTx(txData) {
2221
- const { nftType, tx, bidNonce, multiBidId, kioskClient, nftTokenId } = txData;
2273
+ const { nftType, tx, bidNonce, multiBidId, kioskClient, nftTokenId, suiClient } = txData;
2222
2274
  const transferPolicies = getNativeKioskTransferPolicies(txData?.transferPolicies);
2223
2275
  const transferPolicy = transferPolicies?.find(
2224
2276
  (policy) => policy?.rules?.length > 0
@@ -2233,9 +2285,15 @@ async function addSingleBidAcceptNftBidTx(txData) {
2233
2285
  }
2234
2286
  if (transferPolicy) {
2235
2287
  const transferPolicies2 = await kioskClient.getTransferPolicies({
2236
- type: (0, import_utils2.normalizeStructTag)(nftType)
2288
+ type: (0, import_utils3.normalizeStructTag)(nftType)
2237
2289
  });
2238
- const { rules: allRules } = transferPolicies2.find((p) => p.id === transferPolicy.id);
2290
+ let { rules: allRules } = transferPolicies2.find((p) => p.id === transferPolicy.id);
2291
+ if (allRules.length === 0) {
2292
+ allRules = await getTransferPolicyRuleNamesFromSuiObject({
2293
+ suiClient,
2294
+ transferPolicyId: transferPolicy.id
2295
+ });
2296
+ }
2239
2297
  const unsupportedRule = allRules.find(
2240
2298
  (r) => !knownTransferPolicyRules.includes(r.split("::").at(1))
2241
2299
  );
@@ -2255,9 +2313,9 @@ async function addSingleBidAcceptNftBidTx(txData) {
2255
2313
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::accept_bid_with_transfer_policy`,
2256
2314
  typeArguments: [nftType],
2257
2315
  arguments: [
2258
- tx.object(import_utils2.SUI_CLOCK_OBJECT_ID),
2316
+ tx.object(import_utils3.SUI_CLOCK_OBJECT_ID),
2259
2317
  tx.object(TRADEPORT_MULTI_BID_STORE),
2260
- tx.pure.id((0, import_utils2.normalizeSuiObjectId)(bidNonce)),
2318
+ tx.pure.id((0, import_utils3.normalizeSuiObjectId)(bidNonce)),
2261
2319
  tx.pure.option("id", multiBidChainId),
2262
2320
  tx.object(kioskTx.getKiosk()),
2263
2321
  tx.object(kioskTx.getKioskCap()),
@@ -2277,7 +2335,7 @@ async function addSingleBidAcceptNftBidTx(txData) {
2277
2335
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::accept_bid_without_transfer_policy`,
2278
2336
  typeArguments: [nftType],
2279
2337
  arguments: [
2280
- tx.object(import_utils2.SUI_CLOCK_OBJECT_ID),
2338
+ tx.object(import_utils3.SUI_CLOCK_OBJECT_ID),
2281
2339
  tx.object(TRADEPORT_MULTI_BID_STORE),
2282
2340
  tx.pure.id(bidNonce),
2283
2341
  tx.pure.option("id", multiBidChainId),
@@ -2288,7 +2346,7 @@ async function addSingleBidAcceptNftBidTx(txData) {
2288
2346
  async function addTradePortAcceptNftBidTxHandler(txData) {
2289
2347
  const bidType = await getObjectType({
2290
2348
  suiClient: txData?.suiClient,
2291
- objectId: (0, import_utils2.normalizeSuiObjectId)(txData?.bidNonce)
2349
+ objectId: (0, import_utils3.normalizeSuiObjectId)(txData?.bidNonce)
2292
2350
  });
2293
2351
  if (isSingleBid(bidType)) {
2294
2352
  await addSingleBidAcceptNftBidTx(txData);
@@ -2308,6 +2366,8 @@ async function addTradePortAcceptNftBidTxHandler(txData) {
2308
2366
  if (txData?.sellerKiosk) {
2309
2367
  const royaltyRuleModule = getRoyaltyRuleModule(txData?.nftType);
2310
2368
  const royaltyRulePackageId = await getRulePackageId({
2369
+ transferPolicies: txData?.transferPolicies,
2370
+ suiClient: txData?.suiClient,
2311
2371
  nftType: txData?.nftType,
2312
2372
  ruleType: "royalty_rule",
2313
2373
  kioskClient: txData?.kioskClient
@@ -2733,7 +2793,7 @@ function addTocenAcceptCollectionBidTx({
2733
2793
  async function addTradePortAcceptCollectionBidTxHandler(txData) {
2734
2794
  const bidType = await getObjectType({
2735
2795
  suiClient: txData?.suiClient,
2736
- objectId: (0, import_utils3.normalizeSuiObjectId)(txData?.bidNonce)
2796
+ objectId: (0, import_utils4.normalizeSuiObjectId)(txData?.bidNonce)
2737
2797
  });
2738
2798
  if (isSingleBid(bidType)) {
2739
2799
  await addSingleBidAcceptNftBidTx(txData);
@@ -2769,6 +2829,8 @@ async function addTradePortAcceptCollectionBidTxHandler(txData) {
2769
2829
  if (isTradePortKioskBid(bidType)) {
2770
2830
  const royaltyRuleModule = getRoyaltyRuleModule(txData?.nftType);
2771
2831
  const royaltyRulePackageId = await getRulePackageId({
2832
+ transferPolicies: txData?.transferPolicies,
2833
+ suiClient: txData?.suiClient,
2772
2834
  nftType: txData?.nftType,
2773
2835
  ruleType: "royalty_rule",
2774
2836
  kioskClient: txData?.kioskClient
@@ -3078,7 +3140,7 @@ var acceptNftBids = async ({
3078
3140
  var import_transactions6 = require("@mysten/sui/transactions");
3079
3141
 
3080
3142
  // src/methods/buyLocks/buyLocks.ts
3081
- var import_utils4 = require("@mysten/sui.js/utils");
3143
+ var import_utils5 = require("@mysten/sui.js/utils");
3082
3144
  var import_transactions4 = require("@mysten/sui/transactions");
3083
3145
 
3084
3146
  // src/helpers/calculatePremium.ts
@@ -3244,7 +3306,7 @@ async function buyLocks({ lockIds, transaction }, context) {
3244
3306
  typeArguments: [lock.nft_type],
3245
3307
  arguments: [
3246
3308
  tx.object(TRADEPORT_PRICE_LOCK_STORE),
3247
- tx.object(import_utils4.SUI_CLOCK_OBJECT_ID),
3309
+ tx.object(import_utils5.SUI_CLOCK_OBJECT_ID),
3248
3310
  tx.pure.id(lock.lock_id),
3249
3311
  tx.pure.u64(lock.maker_price),
3250
3312
  tx.pure.u64(marketplaceFee),
@@ -3258,7 +3320,7 @@ async function buyLocks({ lockIds, transaction }, context) {
3258
3320
  }
3259
3321
 
3260
3322
  // src/methods/exerciseLongLocks/exerciseLongLocks.ts
3261
- var import_utils5 = require("@mysten/sui.js/utils");
3323
+ var import_utils6 = require("@mysten/sui.js/utils");
3262
3324
  var import_transactions5 = require("@mysten/sui/transactions");
3263
3325
  async function exerciseLongLocks({ walletAddress, transaction, locks }, context) {
3264
3326
  const tx = transaction ?? new import_transactions5.Transaction();
@@ -3316,7 +3378,7 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
3316
3378
  typeArguments: [lock.nft_type],
3317
3379
  arguments: [
3318
3380
  tx.object(TRADEPORT_PRICE_LOCK_STORE),
3319
- tx.object(import_utils5.SUI_CLOCK_OBJECT_ID),
3381
+ tx.object(import_utils6.SUI_CLOCK_OBJECT_ID),
3320
3382
  tx.pure.id(lock.lock_id),
3321
3383
  tx.object(lock.chain_state.makerKioskId),
3322
3384
  tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
@@ -3326,6 +3388,7 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
3326
3388
  });
3327
3389
  await resolveTransferPolicies({
3328
3390
  tx,
3391
+ transferPolicies,
3329
3392
  suiClient: context.suiClient,
3330
3393
  walletAddress,
3331
3394
  kioskTx,
@@ -3393,6 +3456,7 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
3393
3456
  });
3394
3457
  await resolveTransferPolicies({
3395
3458
  tx,
3459
+ transferPolicies,
3396
3460
  suiClient: context.suiClient,
3397
3461
  walletAddress,
3398
3462
  kioskTx,
@@ -3421,7 +3485,7 @@ async function buyAndExerciseLongLocks({ walletAddress, locks, tx: existingTx },
3421
3485
  var import_transactions9 = require("@mysten/sui/transactions");
3422
3486
 
3423
3487
  // src/methods/exerciseShortLocks/exerciseShortLocks.ts
3424
- var import_utils6 = require("@mysten/sui.js/utils");
3488
+ var import_utils7 = require("@mysten/sui.js/utils");
3425
3489
  var import_transactions8 = require("@mysten/sui/transactions");
3426
3490
 
3427
3491
  // src/graphql/queries/fetchListingsById.ts
@@ -3545,6 +3609,7 @@ function addTradePortBuyTx({ tx, nftType, listingNonce, price, sharedObjects })
3545
3609
  }
3546
3610
  var addTradeportKioskBuyTx = async ({
3547
3611
  tx,
3612
+ transferPolicies,
3548
3613
  kioskTx,
3549
3614
  suiClient,
3550
3615
  kioskClient,
@@ -3581,6 +3646,7 @@ var addTradeportKioskBuyTx = async ({
3581
3646
  });
3582
3647
  await resolveTransferPolicies({
3583
3648
  tx,
3649
+ transferPolicies,
3584
3650
  suiClient,
3585
3651
  walletAddress: seller,
3586
3652
  kioskTx,
@@ -3633,6 +3699,7 @@ async function addOriginByteBuyTx({
3633
3699
  }
3634
3700
  var addHyperspaceKioskBuyTx = async ({
3635
3701
  tx,
3702
+ transferPolicies,
3636
3703
  suiClient,
3637
3704
  kioskTx,
3638
3705
  kioskClient,
@@ -3664,6 +3731,7 @@ var addHyperspaceKioskBuyTx = async ({
3664
3731
  await beforeResolveKioskTransferRequest?.(transferRequest);
3665
3732
  await resolveTransferPolicies({
3666
3733
  tx,
3734
+ transferPolicies,
3667
3735
  suiClient,
3668
3736
  walletAddress: seller,
3669
3737
  kioskTx,
@@ -3728,6 +3796,7 @@ async function addBluemoveKioskBuyTx({
3728
3796
  await beforeResolveKioskTransferRequest?.(transferRequest);
3729
3797
  await resolveTransferPolicies({
3730
3798
  tx,
3799
+ transferPolicies,
3731
3800
  suiClient,
3732
3801
  walletAddress: seller,
3733
3802
  kioskTx,
@@ -4144,7 +4213,7 @@ async function exerciseShortLocks({ walletAddress, transaction, locks }, context
4144
4213
  typeArguments: [lock.nft_type],
4145
4214
  arguments: [
4146
4215
  tx.object(TRADEPORT_PRICE_LOCK_STORE),
4147
- tx.object(import_utils6.SUI_CLOCK_OBJECT_ID),
4216
+ tx.object(import_utils7.SUI_CLOCK_OBJECT_ID),
4148
4217
  tx.pure.id(lock.lock_id)
4149
4218
  ]
4150
4219
  });
@@ -4195,6 +4264,7 @@ async function exerciseShortLocks({ walletAddress, transaction, locks }, context
4195
4264
  });
4196
4265
  await resolveTransferPolicies({
4197
4266
  tx,
4267
+ transferPolicies,
4198
4268
  suiClient: context.suiClient,
4199
4269
  walletAddress,
4200
4270
  kioskTx,
@@ -4225,7 +4295,7 @@ async function buyAndExerciseShortLocks({ walletAddress, locks, tx: existingTx }
4225
4295
  }
4226
4296
 
4227
4297
  // src/methods/cancelLocks/cancelLocks.ts
4228
- var import_utils7 = require("@mysten/sui.js/utils");
4298
+ var import_utils8 = require("@mysten/sui.js/utils");
4229
4299
  var import_transactions10 = require("@mysten/sui/transactions");
4230
4300
  async function cancelLocks({ lockIds, walletAddress, tx: existingTx }, context) {
4231
4301
  const tx = existingTx ?? new import_transactions10.Transaction();
@@ -4248,7 +4318,7 @@ async function cancelLocks({ lockIds, walletAddress, tx: existingTx }, context)
4248
4318
  typeArguments: [lock.nft_type],
4249
4319
  arguments: [
4250
4320
  tx.object(TRADEPORT_PRICE_LOCK_STORE),
4251
- tx.object(import_utils7.SUI_CLOCK_OBJECT_ID),
4321
+ tx.object(import_utils8.SUI_CLOCK_OBJECT_ID),
4252
4322
  tx.pure.id(lock.lock_id),
4253
4323
  tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk)
4254
4324
  ]
@@ -4426,6 +4496,7 @@ var addClaimAcceptedBidNftTx = async ({
4426
4496
  });
4427
4497
  await resolveTransferPolicies({
4428
4498
  tx,
4499
+ transferPolicies,
4429
4500
  suiClient,
4430
4501
  walletAddress: claimer,
4431
4502
  kioskTx,
@@ -4462,6 +4533,7 @@ var addClaimAcceptedBidNftWithPurchaseCapTx = async ({
4462
4533
  });
4463
4534
  await resolveTransferPolicies({
4464
4535
  tx,
4536
+ transferPolicies,
4465
4537
  suiClient,
4466
4538
  walletAddress: claimer,
4467
4539
  kioskTx,
@@ -4497,6 +4569,7 @@ var addClaimTransferredNftTx = async ({
4497
4569
  });
4498
4570
  await resolveTransferPolicies({
4499
4571
  tx,
4572
+ transferPolicies,
4500
4573
  suiClient,
4501
4574
  walletAddress: claimer,
4502
4575
  kioskTx,
@@ -4534,6 +4607,7 @@ var addClaimTransferredNftWithPurchaseCapTx = async ({
4534
4607
  });
4535
4608
  await resolveTransferPolicies({
4536
4609
  tx,
4610
+ transferPolicies,
4537
4611
  suiClient,
4538
4612
  walletAddress: claimer,
4539
4613
  kioskTx,
@@ -5363,7 +5437,6 @@ var fetchBulkNftsByKioskId = import_graphql_request19.gql`
5363
5437
  `;
5364
5438
 
5365
5439
  // src/methods/transferNfts/addTransferNftTx.ts
5366
- var import_utils8 = require("@mysten/sui/utils");
5367
5440
  async function addOriginByteTransferNftTx({
5368
5441
  tx,
5369
5442
  nftTokenId,
@@ -5502,19 +5575,10 @@ async function getTransferPolicyForDirectTransfer(suiClient, collectionChainStat
5502
5575
  ).length === 0
5503
5576
  );
5504
5577
  if (validateRules && candidatePolicy) {
5505
- const { data, error } = await suiClient.getObject({
5506
- id: (0, import_utils8.normalizeSuiObjectId)(candidatePolicy.id),
5507
- options: {
5508
- showContent: true
5509
- }
5578
+ const ruleNames = await getTransferPolicyRuleNamesFromSuiObject({
5579
+ suiClient,
5580
+ transferPolicyId: candidatePolicy.id
5510
5581
  });
5511
- if (error) {
5512
- throw new Error(`Error on getting SUI object ${candidatePolicy.id}: ${error.code}`);
5513
- }
5514
- const content = data.content;
5515
- const ruleNames = content.fields.rules.fields.contents.map(
5516
- (rule) => (0, import_utils8.normalizeStructTag)(rule.fields.name)
5517
- );
5518
5582
  if (!ruleNames.every((name) => name.startsWith(MYSTEN_TRANFER_POLICY_RULES_PACKAGE_ID))) {
5519
5583
  return void 0;
5520
5584
  }