@tradeport/sui-trading-sdk 0.4.65 → 0.4.66

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
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.ts
@@ -178,16 +168,6 @@ var TRADEPORT_NFT_STRATEGY_PACKAGE_ID = "0xb7386fc8c6e64ea2b0079e293592b57e98498
178
168
  var TRADEPORT_NFT_STRATEGY_MANAGER_ID = "0xfb58ee62b3a62a8150f871da950dfdf923cd0d97b153caf99b5219cd4ddda5bd";
179
169
  var TRADEPORT_POOL_REGISTRY_ID = "0xcd0a614c4cbbf173f59dee2602c43a1717f283215ed7a0bb1d55d786af16fbcd";
180
170
  var TRADEPORT_POOL_VERSIONED_ID = "0x0309b66202e9aaf470081fffee7ffc0fbd50e3b7400d4f56fd06502e4dbbd676";
181
- var DexConstants = {
182
- commission: "0x24f5f2258ef80c0a3243088199faeb95ad50516ca1517dbd93be398d759057bb",
183
- commissionManager: "0xd19a03d4ec3d12b0ce407b54eb676cc0f8e1403621deda77d9677bfcb9d738c1",
184
- poolsToExclude: [
185
- "0x3addbbc82866c0bbd93e51b6e2d75c0a4faaf270cc0e281d8f4de5df48bebfa4",
186
- "0x19d614f421046cae90f5a3a976816063478f648087a12adc74e90ebd54dfaf19",
187
- "0x514c74e28a9720366abc4a65a5688f47c72e784dbf035844d3f59059bfaed056",
188
- "0x0854de4e9d64716b757b2f6f22258467f59cc1b4bc0cc64c70086549faaddedf"
189
- ]
190
- };
191
171
  var USDC_COIN_TYPE = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
192
172
  var COLLECTION_IDS_WITH_ZERO_COMMISSION = [
193
173
  ""
@@ -1336,7 +1316,7 @@ var getSharedObjects = async (nftType) => {
1336
1316
  };
1337
1317
 
1338
1318
  // src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts
1339
- var import_utils4 = require("@mysten/sui/utils");
1319
+ var import_utils5 = require("@mysten/sui/utils");
1340
1320
 
1341
1321
  // src/utils/normalizeNftType.ts
1342
1322
  var normalizedNftType = (nftType) => {
@@ -1461,6 +1441,14 @@ var getTransferPolicyRuleNamesFromSuiObject = async ({
1461
1441
  return ruleNames;
1462
1442
  };
1463
1443
 
1444
+ // src/helpers/kiosk/upgradeKioskRulesPackageId.ts
1445
+ var import_utils2 = require("@mysten/sui/utils");
1446
+ var KIOSK_RULES_ORIGINAL_PACKAGE_ID = (0, import_utils2.normalizeSuiAddress)(
1447
+ "0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879"
1448
+ );
1449
+ var KIOSK_RULES_UPGRADED_PACKAGE_ID = "0xdfb4f1d4e43e0c3ad834dcd369f0d39005c872e118c9dc1c5da9765bb93ee5f3";
1450
+ var upgradeKioskRulesPackageId = (packageId) => (0, import_utils2.normalizeSuiAddress)(packageId) === KIOSK_RULES_ORIGINAL_PACKAGE_ID ? KIOSK_RULES_UPGRADED_PACKAGE_ID : packageId;
1451
+
1464
1452
  // src/helpers/kiosk/getRulePackageId.ts
1465
1453
  var getRulePackageId = async ({
1466
1454
  transferPolicies,
@@ -1494,7 +1482,7 @@ var getRulePackageId = async ({
1494
1482
  if (!rulePackageId) {
1495
1483
  rulePackageId = rule?.split("::")?.[0];
1496
1484
  }
1497
- return addHexPrefix(rulePackageId);
1485
+ return upgradeKioskRulesPackageId(addHexPrefix(rulePackageId));
1498
1486
  };
1499
1487
 
1500
1488
  // src/helpers/kiosk/isBluemoveKioskBid.ts
@@ -1731,6 +1719,7 @@ var getTransferPoliciesToResolve = async ({
1731
1719
  if (!rulePackageId) {
1732
1720
  rulePackageId = ruleData?.rule?.split("::")?.[0];
1733
1721
  }
1722
+ rulePackageId = upgradeKioskRulesPackageId(rulePackageId);
1734
1723
  const moduleName = ruleData?.rule?.split("::")?.[1];
1735
1724
  if (originByteRuleModules.includes(moduleName)) {
1736
1725
  throw new Error(
@@ -2261,13 +2250,13 @@ var shareOriginByteKiosk = ({ tx, kiosk }) => {
2261
2250
  };
2262
2251
 
2263
2252
  // src/helpers/rpc/getObjectType.ts
2264
- var import_utils2 = require("@mysten/sui/utils");
2253
+ var import_utils3 = require("@mysten/sui/utils");
2265
2254
  var getObjectType = async ({
2266
2255
  suiClient,
2267
2256
  objectId
2268
2257
  }) => {
2269
2258
  const normalizedObjectId = objectId.startsWith("0x") ? addLeadingZerosAfter0x(objectId) : objectId;
2270
- if ((0, import_utils2.isValidSuiObjectId)(normalizedObjectId)) {
2259
+ if ((0, import_utils3.isValidSuiObjectId)(normalizedObjectId)) {
2271
2260
  const res = await suiClient.getObject({ id: normalizedObjectId, options: { showType: true } });
2272
2261
  return res.data.type;
2273
2262
  }
@@ -2275,7 +2264,7 @@ var getObjectType = async ({
2275
2264
  };
2276
2265
 
2277
2266
  // src/methods/acceptNftBids/addAcceptNftBidTxs.ts
2278
- var import_utils3 = require("@mysten/sui/utils");
2267
+ var import_utils4 = require("@mysten/sui/utils");
2279
2268
 
2280
2269
  // src/graphql/queries/fetchMultibidById.ts
2281
2270
  var import_graphql_request10 = require("graphql-request");
@@ -2620,9 +2609,9 @@ async function addSingleBidAcceptNftBidTx(txData) {
2620
2609
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::accept_bid_with_transfer_policy`,
2621
2610
  typeArguments: [nftType],
2622
2611
  arguments: [
2623
- tx.object(import_utils3.SUI_CLOCK_OBJECT_ID),
2612
+ tx.object(import_utils4.SUI_CLOCK_OBJECT_ID),
2624
2613
  tx.object(TRADEPORT_MULTI_BID_STORE),
2625
- tx.pure.id((0, import_utils3.normalizeSuiObjectId)(bidNonce)),
2614
+ tx.pure.id((0, import_utils4.normalizeSuiObjectId)(bidNonce)),
2626
2615
  tx.pure.option("id", multiBidChainId),
2627
2616
  tx.object(kioskTx.getKiosk()),
2628
2617
  tx.object(kioskTx.getKioskCap()),
@@ -2659,7 +2648,7 @@ async function addSingleBidAcceptNftBidTx(txData) {
2659
2648
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::accept_bid_without_transfer_policy`,
2660
2649
  typeArguments: [nftType],
2661
2650
  arguments: [
2662
- tx.object(import_utils3.SUI_CLOCK_OBJECT_ID),
2651
+ tx.object(import_utils4.SUI_CLOCK_OBJECT_ID),
2663
2652
  tx.object(TRADEPORT_MULTI_BID_STORE),
2664
2653
  tx.pure.id(bidNonce),
2665
2654
  tx.pure.option("id", multiBidChainId),
@@ -2670,7 +2659,7 @@ async function addSingleBidAcceptNftBidTx(txData) {
2670
2659
  async function addTradePortAcceptNftBidTxHandler(txData) {
2671
2660
  const bidType = await getObjectType({
2672
2661
  suiClient: txData?.suiClient,
2673
- objectId: (0, import_utils3.normalizeSuiObjectId)(txData?.bidNonce)
2662
+ objectId: (0, import_utils4.normalizeSuiObjectId)(txData?.bidNonce)
2674
2663
  });
2675
2664
  if (isSingleBid(bidType)) {
2676
2665
  await addSingleBidAcceptNftBidTx(txData);
@@ -3216,7 +3205,7 @@ function addTocenAcceptCollectionBidTx({
3216
3205
  async function addTradePortAcceptCollectionBidTxHandler(txData) {
3217
3206
  const bidType = await getObjectType({
3218
3207
  suiClient: txData?.suiClient,
3219
- objectId: (0, import_utils4.normalizeSuiObjectId)(txData?.bidNonce)
3208
+ objectId: (0, import_utils5.normalizeSuiObjectId)(txData?.bidNonce)
3220
3209
  });
3221
3210
  if (isSingleBid(bidType)) {
3222
3211
  await addSingleBidAcceptNftBidTx(txData);
@@ -3616,16 +3605,6 @@ var getCollectionChainState = async (collectionId) => {
3616
3605
  });
3617
3606
  return res?.collections?.[0]?.chain_state;
3618
3607
  };
3619
- var getCollectionChainStateByFtType = async (ftType) => {
3620
- const res = await gqlChainRequest({
3621
- chain: "sui",
3622
- query: fetchCollectionChainStateByFtType,
3623
- variables: {
3624
- ftType
3625
- }
3626
- });
3627
- return res?.collections_by_ft_type?.[0]?.chain_state;
3628
- };
3629
3608
 
3630
3609
  // src/methods/applyFtStrategy/applyFtStrategy.ts
3631
3610
  async function applyFtStrategy({
@@ -3660,12 +3639,105 @@ async function applyFtStrategy({
3660
3639
  return tx;
3661
3640
  }
3662
3641
 
3642
+ // src/methods/applyNftStrategy/applyNftStrategy.ts
3643
+ var import_transactions5 = require("@mysten/sui/transactions");
3644
+
3645
+ // src/graphql/queries/fetchCollectionFloorListingForMarket.ts
3646
+ var import_graphql_request13 = require("graphql-request");
3647
+ var fetchCollectionFloorListingsForMarket = import_graphql_request13.gql`
3648
+ query fetchCollectionFloorListingsForMarket(
3649
+ $collectionId: uuid!
3650
+ $marketAddress: String!
3651
+ $totalPrice: numeric
3652
+ ) {
3653
+ listings(
3654
+ where: {
3655
+ collection_id: { _eq: $collectionId }
3656
+ listed: { _eq: true }
3657
+ market_name: { _eq: "tradeport" }
3658
+ seller: { _neq: $marketAddress }
3659
+ nonce: { _like: "1::0x%" }
3660
+ price: { _lte: $totalPrice }
3661
+ }
3662
+ order_by: [{ price: asc_nulls_last }, { block_height: asc }, { tx_index: asc }]
3663
+ ) {
3664
+ id
3665
+ price
3666
+ nft {
3667
+ token_id
3668
+ delegated_owner
3669
+ }
3670
+ }
3671
+ }
3672
+ `;
3673
+
3674
+ // src/methods/applyNftStrategy/applyNftStrategy.ts
3675
+ async function applyTradeportNftStrategy({
3676
+ collectionId,
3677
+ strategyFtType,
3678
+ tx: existingTx
3679
+ }) {
3680
+ const tx = existingTx ?? new import_transactions5.Transaction();
3681
+ const chainState = await getCollectionChainState(collectionId);
3682
+ const nftStrategies = chainState?.nft_strategies ?? {};
3683
+ const nftStrategyKeys = Object.keys(nftStrategies);
3684
+ if (nftStrategyKeys.length === 0) {
3685
+ throw new Error("No NFT strategies found for collection");
3686
+ }
3687
+ strategyFtType = strategyFtType ?? nftStrategyKeys[0];
3688
+ if (!nftStrategyKeys.includes(strategyFtType)) {
3689
+ throw new Error(`Specified FT type ${strategyFtType} is not supported for this collection`);
3690
+ }
3691
+ const transferPolicy = getNativeKioskTransferPolicies(chainState?.transfer_policies ?? [])?.at(0);
3692
+ if (!transferPolicy) {
3693
+ throw new Error("No transfer policy found for collection");
3694
+ }
3695
+ const nftType = chainState?.nft_type;
3696
+ let suiBalance = BigInt(
3697
+ nftStrategies[strategyFtType].sui_balance ?? 0n
3698
+ );
3699
+ const result = await gqlChainRequest({
3700
+ chain: "sui",
3701
+ query: fetchCollectionFloorListingsForMarket,
3702
+ variables: {
3703
+ collectionId,
3704
+ marketAddress: TRADEPORT_NFT_STRATEGY_MANAGER_ID,
3705
+ totalPrice: suiBalance.toString()
3706
+ }
3707
+ });
3708
+ if ((result?.listings?.length ?? 0) === 0) {
3709
+ throw new Error(
3710
+ `No floor listing found for collection with price bellow or equal to ${suiBalance} MIST`
3711
+ );
3712
+ }
3713
+ for (const floorListing of result.listings) {
3714
+ suiBalance -= BigInt(floorListing.price);
3715
+ if (suiBalance < 0n) {
3716
+ break;
3717
+ }
3718
+ tx.moveCall({
3719
+ target: `${TRADEPORT_NFT_STRATEGY_PACKAGE_ID}::tradeport_nft_strategy::apply_tradeport_nft_strategy_confirm_request`,
3720
+ typeArguments: [nftType, strategyFtType],
3721
+ arguments: [
3722
+ tx.object(TRADEPORT_NFT_STRATEGY_MANAGER_ID),
3723
+ tx.object(nftStrategies[strategyFtType].kiosk_id),
3724
+ tx.object(TRADEPORT_LISTINGS_STORE),
3725
+ tx.object(TRADEPORT_ORDERBOOK_STORE),
3726
+ tx.object(floorListing.nft.delegated_owner),
3727
+ tx.object(floorListing.nft.token_id),
3728
+ tx.object(transferPolicy.id)
3729
+ ]
3730
+ });
3731
+ }
3732
+ return tx;
3733
+ }
3734
+
3663
3735
  // src/methods/buyListings/buyListings.ts
3664
3736
  var import_transactions7 = require("@mysten/sui/transactions");
3665
3737
 
3666
3738
  // src/graphql/queries/fetchListingsById.ts
3667
- var import_graphql_request13 = require("graphql-request");
3668
- var fetchListingsById = import_graphql_request13.gql`
3739
+ var import_graphql_request14 = require("graphql-request");
3740
+ var fetchListingsById = import_graphql_request14.gql`
3669
3741
  query fetchListingsById($listingIds: [uuid!]) {
3670
3742
  listings(where: { id: { _in: $listingIds } }) {
3671
3743
  id
@@ -3704,29 +3776,6 @@ var addThirdPartyTxFee = async (tx, price) => {
3704
3776
  );
3705
3777
  };
3706
3778
 
3707
- // src/helpers/deserializeOrCreateTxBlock.ts
3708
- var import_transactions5 = require("@mysten/sui/transactions");
3709
- var deserializeOrCreateTxBlock = ({
3710
- existingTx
3711
- }) => {
3712
- if (typeof existingTx === "string") {
3713
- return import_transactions5.Transaction.from(existingTx);
3714
- }
3715
- return existingTx ?? new import_transactions5.Transaction();
3716
- };
3717
-
3718
- // src/helpers/extractSwapResultCoin.ts
3719
- var extractSwapResultCoinFromTxBlock = (txBlock) => {
3720
- if (!txBlock) return void 0;
3721
- const tx = typeof txBlock === "string" ? JSON.parse(txBlock) : txBlock?.getData();
3722
- const commands = tx.commands ?? [];
3723
- const index = commands.findIndex(
3724
- (cmd) => cmd?.MoveCall?.module === "universal_router" && cmd?.MoveCall?.function === "settle"
3725
- );
3726
- if (index === -1) return void 0;
3727
- return { $kind: "Result", Result: index };
3728
- };
3729
-
3730
3779
  // src/helpers/kiosk/preProcessSharedBulkBuyingData.ts
3731
3780
  var import_bcs2 = require("@mysten/sui/bcs");
3732
3781
  var import_transactions6 = require("@mysten/sui/transactions");
@@ -3832,8 +3881,8 @@ var preProcessSharedBulkBuyingData = async ({
3832
3881
  var import_bcs3 = require("@mysten/sui/bcs");
3833
3882
 
3834
3883
  // src/graphql/queries/fetchCommissionByListingId.ts
3835
- var import_graphql_request14 = require("graphql-request");
3836
- var fetchCommissionByNftContractId = import_graphql_request14.gql`
3884
+ var import_graphql_request15 = require("graphql-request");
3885
+ var fetchCommissionByNftContractId = import_graphql_request15.gql`
3837
3886
  query fetchCommissionByNftContractId($nftContractId: uuid!) {
3838
3887
  commissions(where: { contract_id: { _eq: $nftContractId } }) {
3839
3888
  is_custodial
@@ -3950,7 +3999,7 @@ function calculateRoyaltyFee(transferPolicyRules, price) {
3950
3999
  }
3951
4000
 
3952
4001
  // src/methods/buyListings/addBuyListingTxs.ts
3953
- var import_utils5 = require("@mysten/sui/utils");
4002
+ var import_utils6 = require("@mysten/sui/utils");
3954
4003
  function addLegacyTradePortBuyTx({
3955
4004
  tx,
3956
4005
  nftType,
@@ -4448,10 +4497,10 @@ async function addTradePortBuyTxHandler(txData) {
4448
4497
  });
4449
4498
  const chainState = await getCollectionChainState(txData.collectionId);
4450
4499
  const nftStrategies = chainState?.nft_strategies ?? {};
4451
- const normalizedSellerKiosk = (0, import_utils5.normalizeSuiObjectId)(txData.sellerKiosk);
4500
+ const normalizedSellerKiosk = (0, import_utils6.normalizeSuiObjectId)(txData.sellerKiosk);
4452
4501
  for (const [strategyFtType, strategyData] of Object.entries(nftStrategies)) {
4453
4502
  const strategyKioskId = strategyData.kiosk_id ?? "0x0";
4454
- if ((0, import_utils5.normalizeSuiObjectId)(strategyKioskId) === normalizedSellerKiosk) {
4503
+ if ((0, import_utils6.normalizeSuiObjectId)(strategyKioskId) === normalizedSellerKiosk) {
4455
4504
  await applyFtStrategy({
4456
4505
  collectionId: txData.collectionId,
4457
4506
  strategyFtType,
@@ -4583,8 +4632,7 @@ var buyListings = async ({
4583
4632
  throw new Error("No listings found");
4584
4633
  }
4585
4634
  const listingsForTracking = [];
4586
- const tx = deserializeOrCreateTxBlock({ existingTx });
4587
- const swapResultCoin = extractSwapResultCoinFromTxBlock(tx);
4635
+ const tx = existingTx ?? new import_transactions7.Transaction();
4588
4636
  const tocenTokenIds = [];
4589
4637
  let tocenNftType = "";
4590
4638
  let tocenTotalPrice = 0;
@@ -4629,7 +4677,7 @@ var buyListings = async ({
4629
4677
  sellerKiosk: listing.nft?.chain_state?.kiosk_id,
4630
4678
  collectionId: listing?.nft?.collection_id,
4631
4679
  nftContractId: listing?.nft?.contract_id,
4632
- coinToSplit: swapResultCoin ? swapResultCoin : coinToSplit,
4680
+ coinToSplit,
4633
4681
  marketFeeDecimalPercent,
4634
4682
  beforeResolveKioskTransferRequest,
4635
4683
  sharedKioskState,
@@ -4678,9 +4726,6 @@ var buyListings = async ({
4678
4726
  });
4679
4727
  }
4680
4728
  sharedKioskState?.kioskTx?.finalize();
4681
- if (swapResultCoin) {
4682
- tx.transferObjects([swapResultCoin], walletAddress);
4683
- }
4684
4729
  if (tocenTokenIds?.length > 0) {
4685
4730
  addTocenBuyTxHandler({
4686
4731
  tx,
@@ -4689,14 +4734,14 @@ var buyListings = async ({
4689
4734
  price: tocenTotalPrice
4690
4735
  });
4691
4736
  }
4692
- return import_transactions7.Transaction.from(tx);
4737
+ return tx;
4693
4738
  };
4694
4739
 
4695
4740
  // src/methods/cancelMultiBid/cancelMultiBid.ts
4696
4741
  var import_transactions8 = require("@mysten/sui/transactions");
4697
4742
 
4698
4743
  // src/methods/removeNftBids/addRemoveNftBidTxs.ts
4699
- var import_utils6 = require("@mysten/sui/utils");
4744
+ var import_utils7 = require("@mysten/sui/utils");
4700
4745
  function addTradeportRemoveNftBidTx({ tx, bidNonce, nftType }) {
4701
4746
  tx.moveCall({
4702
4747
  target: "0xb42dbb7413b79394e1a0175af6ae22b69a5c7cc5df259cd78072b6818217c027::biddings::cancel_bid",
@@ -4753,7 +4798,7 @@ function addCancelSingleBidForMultibidChainId(tx, bidNonce, multiBidChainId) {
4753
4798
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::cancel_bid`,
4754
4799
  arguments: [
4755
4800
  tx.object(TRADEPORT_MULTI_BID_STORE),
4756
- tx.pure.id((0, import_utils6.normalizeSuiObjectId)(bidNonce)),
4801
+ tx.pure.id((0, import_utils7.normalizeSuiObjectId)(bidNonce)),
4757
4802
  tx.pure.option("id", multiBidChainId)
4758
4803
  ]
4759
4804
  });
@@ -4761,7 +4806,7 @@ function addCancelSingleBidForMultibidChainId(tx, bidNonce, multiBidChainId) {
4761
4806
  async function addTradePortRemoveNftBidTxHandler(txData) {
4762
4807
  const bidType = await getObjectType({
4763
4808
  suiClient: txData?.suiClient,
4764
- objectId: (0, import_utils6.normalizeSuiObjectId)(txData?.bidNonce)
4809
+ objectId: (0, import_utils7.normalizeSuiObjectId)(txData?.bidNonce)
4765
4810
  });
4766
4811
  if (isSingleBid(bidType)) {
4767
4812
  await addSingleBidRemoveNftBidTx(txData);
@@ -4813,8 +4858,8 @@ async function cancelMultiBid({ multiBidId }) {
4813
4858
  var import_transactions9 = require("@mysten/sui/transactions");
4814
4859
 
4815
4860
  // src/graphql/queries/fetchAccountKiosks.ts
4816
- var import_graphql_request15 = require("graphql-request");
4817
- var fetchAccountKiosks = import_graphql_request15.gql`
4861
+ var import_graphql_request16 = require("graphql-request");
4862
+ var fetchAccountKiosks = import_graphql_request16.gql`
4818
4863
  query fetchAccountKiosks($accountAddress: String!) {
4819
4864
  kiosks: kiosks_by_owner_address(owner_address: $accountAddress) {
4820
4865
  id
@@ -5283,17 +5328,22 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
5283
5328
  return import_transactions10.Transaction.from(tx);
5284
5329
  };
5285
5330
 
5331
+ // src/methods/createMultiBid/createMultiBid.ts
5332
+ var import_transactions12 = require("@mysten/sui/transactions");
5333
+
5286
5334
  // src/methods/updateMultiBid/updateMultiBid.ts
5335
+ var import_transactions11 = require("@mysten/sui/transactions");
5287
5336
  async function updateMultiBid({
5337
+ walletAddress,
5288
5338
  multiBidId,
5289
5339
  name,
5290
5340
  amount,
5291
5341
  amountToWithdraw,
5292
5342
  tx: existingTx,
5293
- multiBidChainId
5294
- }) {
5295
- const tx = deserializeOrCreateTxBlock({ existingTx });
5296
- const swapResultCoin = extractSwapResultCoinFromTxBlock(tx);
5343
+ multiBidChainId,
5344
+ coinToSplit
5345
+ }, context) {
5346
+ const tx = existingTx ?? new import_transactions11.Transaction();
5297
5347
  if (!multiBidChainId) {
5298
5348
  const { chain_id: chainId, cancelled_at } = (await gqlChainRequest({
5299
5349
  chain: "sui",
@@ -5308,7 +5358,7 @@ async function updateMultiBid({
5308
5358
  }
5309
5359
  multiBidChainId = chainId;
5310
5360
  }
5311
- const [coin] = tx.splitCoins(swapResultCoin ? swapResultCoin : tx.gas, [amount ?? 0n]);
5361
+ const [coin] = tx.splitCoins(coinToSplit ? coinToSplit : tx.gas, [amount ?? 0n]);
5312
5362
  tx.moveCall({
5313
5363
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::update_multi_bid`,
5314
5364
  arguments: [
@@ -5329,7 +5379,7 @@ async function createMultiBid({
5329
5379
  amount,
5330
5380
  tx: existingTx
5331
5381
  }) {
5332
- const tx = deserializeOrCreateTxBlock({ existingTx });
5382
+ const tx = existingTx ?? new import_transactions12.Transaction();
5333
5383
  const multiBidChainId = tx.moveCall({
5334
5384
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::create_multi_bid`,
5335
5385
  arguments: [tx.object(TRADEPORT_MULTI_BID_STORE), tx.pure.option("string", name)]
@@ -5347,7 +5397,11 @@ async function createMultiBid({
5347
5397
  }
5348
5398
 
5349
5399
  // src/methods/listNfts/listNfts.ts
5350
- var import_transactions12 = require("@mysten/sui/transactions");
5400
+ var import_transactions14 = require("@mysten/sui/transactions");
5401
+
5402
+ // src/helpers/isExpiredListing.ts
5403
+ var import_utils8 = require("@mysten/sui/utils");
5404
+ var isExpiredListing = (listing, walletAddress) => listing.nonce && listing.seller && (0, import_utils8.normalizeSuiAddress)(listing.seller) === (0, import_utils8.normalizeSuiAddress)(walletAddress);
5351
5405
 
5352
5406
  // src/helpers/validateMinFloorPrice.ts
5353
5407
  function validateMinFloorPrice({ transferPolicies, listPrice }) {
@@ -5676,323 +5730,16 @@ async function relistNft({
5676
5730
  }
5677
5731
  }
5678
5732
 
5679
- // src/methods/swapCoins/swapCoins.ts
5680
- var import_sdk = require("@flowx-finance/sdk");
5681
- var import_transactions11 = require("@mysten/sui/transactions");
5682
- var import_utils7 = require("@mysten/sui/utils");
5683
- var import_ms = __toESM(require("ms"));
5684
-
5685
- // src/utils/pureValues.ts
5686
- var toDecimalValue = (value, decimals) => {
5687
- if (!value || decimals === void 0) return new bigNumberConfig_default(0);
5688
- return new bigNumberConfig_default(value).div(10 ** decimals);
5689
- };
5690
- var toPureValue = (value, decimals) => {
5691
- if (!value || decimals === void 0) return new bigNumberConfig_default(0);
5692
- return new bigNumberConfig_default(new bigNumberConfig_default(value).multipliedBy(10 ** decimals).toFixed(0));
5693
- };
5694
-
5695
- // src/methods/swapCoins/swapCoins.ts
5696
- async function swapCoins({
5697
- walletAddress,
5698
- coinInType,
5699
- coinInAmount,
5700
- coinOutType,
5701
- slippage = 1e3,
5702
- // 0.1%
5703
- ttl = "5m",
5704
- excludeSources = [import_sdk.Protocol.STEAMM, import_sdk.Protocol.BOLT],
5705
- routes,
5706
- commission,
5707
- tx: existingTx
5708
- }, { suiClient, defiRouterUrl }) {
5709
- const inAmount = BigInt(coinInAmount);
5710
- const tx = existingTx ?? new import_transactions11.Transaction();
5711
- coinInType = (0, import_utils7.normalizeStructTag)(coinInType);
5712
- coinOutType = (0, import_utils7.normalizeStructTag)(coinOutType);
5713
- walletAddress = (0, import_utils7.normalizeSuiAddress)(walletAddress);
5714
- tx.setSenderIfNotSet((0, import_utils7.normalizeSuiAddress)(walletAddress));
5715
- if (inAmount === 0n) {
5716
- const zeroCoin = tx.moveCall({
5717
- target: "0x2::coin::zero",
5718
- typeArguments: [coinOutType]
5719
- });
5720
- return {
5721
- tx,
5722
- coinOut: zeroCoin
5723
- };
5724
- }
5725
- if (coinInType === coinOutType) {
5726
- const getCoin = (0, import_transactions11.coinWithBalance)({
5727
- type: coinInType,
5728
- balance: inAmount
5729
- });
5730
- return {
5731
- tx,
5732
- coinOut: getCoin(tx)
5733
- };
5734
- }
5735
- const types = await getAffectedNftAndFtTypes(coinInType, coinOutType);
5736
- const { feeAndReward, amountToSwap } = calculateSwapAmounts(types.length, inAmount);
5737
- if (!routes) {
5738
- routes = (await buildSwapRoutes(
5739
- {
5740
- walletAddress,
5741
- coinInType,
5742
- coinOutType,
5743
- amountToSwap,
5744
- excludeSources,
5745
- commission
5746
- },
5747
- { defiRouterUrl }
5748
- )).routes;
5749
- }
5750
- const tradeBuilder = new import_sdk.TradeBuilder("mainnet", routes);
5751
- if (commission) {
5752
- tradeBuilder.commission(commission);
5753
- }
5754
- const trade = tradeBuilder.sender(walletAddress).slippage(slippage).deadline(Date.now() + (0, import_ms.default)(ttl)).build();
5755
- const coinOut = await trade.swap({ client: suiClient, tx });
5756
- let suiFeeAndRewardCoin;
5757
- if (coinInType === (0, import_utils7.normalizeStructTag)(import_utils7.SUI_TYPE_ARG)) {
5758
- suiFeeAndRewardCoin = tx.splitCoins(tx.gas, [
5759
- tx.pure.u64(feeAndReward)
5760
- ])[0];
5761
- } else {
5762
- const suiFeeAndRewardRoutes = await buildSwapRoutes(
5763
- {
5764
- walletAddress,
5765
- coinInType,
5766
- coinOutType: import_utils7.SUI_TYPE_ARG,
5767
- amountToSwap: feeAndReward,
5768
- excludeSources
5769
- },
5770
- { defiRouterUrl }
5771
- );
5772
- const suiFeeTradeBuilder = new import_sdk.TradeBuilder("mainnet", suiFeeAndRewardRoutes.routes);
5773
- const suiFeeTrade = suiFeeTradeBuilder.sender(walletAddress).slippage(slippage).deadline(Date.now() + (0, import_ms.default)(ttl)).build();
5774
- suiFeeAndRewardCoin = await suiFeeTrade.swap({ client: suiClient, tx });
5775
- }
5776
- if (types.length > 0) {
5777
- if (types.length > 2) {
5778
- throw new Error("Unexpected affected types count greater than 2");
5779
- }
5780
- let usedSuiCoin = suiFeeAndRewardCoin;
5781
- if (types.length === 2) {
5782
- const suiFeeAndRewardCoinBalance = tx.moveCall({
5783
- target: "0x2::coin::value",
5784
- typeArguments: [import_utils7.SUI_TYPE_ARG],
5785
- arguments: [suiFeeAndRewardCoin]
5786
- });
5787
- const halfSuiCoinAmount = tx.moveCall({
5788
- target: "0x2::math::divide_and_round_up",
5789
- arguments: [suiFeeAndRewardCoinBalance, tx.pure.u64(2)]
5790
- });
5791
- const [coin] = tx.splitCoins(usedSuiCoin, [halfSuiCoinAmount]);
5792
- usedSuiCoin = coin;
5793
- }
5794
- for (const data of types) {
5795
- const { nftType, ftType, type } = data;
5796
- switch (type) {
5797
- case "liquidNft": {
5798
- tx.moveCall({
5799
- target: `${DexConstants.commission}::commission::pay`,
5800
- arguments: [
5801
- tx.object(DexConstants.commissionManager),
5802
- tx.pure.string("swap"),
5803
- usedSuiCoin,
5804
- tx.pure.option("string", nftType)
5805
- ],
5806
- typeArguments: [import_utils7.SUI_TYPE_ARG]
5807
- });
5808
- break;
5809
- }
5810
- case "nftStrategy": {
5811
- const suiFeeAndRewardCoinBalance = tx.moveCall({
5812
- target: "0x2::coin::value",
5813
- typeArguments: [import_utils7.SUI_TYPE_ARG],
5814
- arguments: [usedSuiCoin]
5815
- });
5816
- const feeAmount = tx.moveCall({
5817
- target: "0x2::math::divide_and_round_up",
5818
- arguments: [suiFeeAndRewardCoinBalance, tx.pure.u64(4)]
5819
- });
5820
- const [feeCoin] = tx.splitCoins(usedSuiCoin, [feeAmount]);
5821
- tx.moveCall({
5822
- target: `${DexConstants.commission}::commission::pay`,
5823
- arguments: [
5824
- tx.object(DexConstants.commissionManager),
5825
- tx.pure.string("swap"),
5826
- feeCoin,
5827
- tx.pure.option("string", void 0)
5828
- ],
5829
- typeArguments: [import_utils7.SUI_TYPE_ARG]
5830
- });
5831
- tx.moveCall({
5832
- target: `${TRADEPORT_NFT_STRATEGY_PACKAGE_ID}::tradeport_nft_strategy::reward_strategy`,
5833
- arguments: [
5834
- tx.object(TRADEPORT_NFT_STRATEGY_MANAGER_ID),
5835
- usedSuiCoin
5836
- // 3/4 retained coin for reward
5837
- ],
5838
- typeArguments: [nftType, ftType]
5839
- });
5840
- break;
5841
- }
5842
- default: {
5843
- throw new Error(`Unexpected type ${type}`);
5844
- }
5845
- }
5846
- usedSuiCoin = suiFeeAndRewardCoin;
5847
- }
5848
- } else {
5849
- tx.moveCall({
5850
- target: `${DexConstants.commission}::commission::pay`,
5851
- arguments: [
5852
- tx.object(DexConstants.commissionManager),
5853
- tx.pure.string("swap"),
5854
- suiFeeAndRewardCoin,
5855
- tx.pure.option("string", void 0)
5856
- ],
5857
- typeArguments: [import_utils7.SUI_TYPE_ARG]
5858
- });
5859
- }
5860
- return {
5861
- tx,
5862
- coinOut
5863
- };
5864
- }
5865
- async function calculateAmountToSwap({
5866
- coinInType,
5867
- coinOutType,
5868
- coinInAmount
5869
- }) {
5870
- const types = await getAffectedNftAndFtTypes(coinInType, coinOutType);
5871
- const { amountToSwap } = calculateSwapAmounts(types.length, BigInt(coinInAmount));
5872
- return amountToSwap;
5873
- }
5874
- async function calculateSwapInputAmountWithSlippage({
5875
- coinInType,
5876
- coinOutType,
5877
- coinOutAmount,
5878
- slippage = 0
5879
- }) {
5880
- if (coinInType === coinOutType) {
5881
- return new bigNumberConfig_default(coinOutAmount);
5882
- }
5883
- const provider = new import_sdk.CoinProvider("mainnet");
5884
- const coinQueryResult = await provider.getCoins({
5885
- limit: 2,
5886
- coinTypes: [coinInType, coinOutType]
5887
- });
5888
- const coinIn = coinQueryResult?.find(
5889
- (coin) => (0, import_utils7.normalizeStructTag)(coin.coinType) === (0, import_utils7.normalizeStructTag)(coinInType)
5890
- );
5891
- const coinOut = coinQueryResult?.find(
5892
- (coin) => (0, import_utils7.normalizeStructTag)(coin.coinType) === (0, import_utils7.normalizeStructTag)(coinOutType)
5893
- );
5894
- const exchangeRate = new bigNumberConfig_default(coinOut.derivedPriceInUSD ?? 0)?.gt(0) ? new bigNumberConfig_default(coinIn?.derivedPriceInUSD ?? 1)?.div(coinOut?.derivedPriceInUSD ?? 1) : new bigNumberConfig_default(0);
5895
- const amountSell = toDecimalValue(coinOutAmount.toString(), coinOut?.decimals).div(exchangeRate);
5896
- const slippageMultiplier = 1 + parseInt(slippage.toString() || "0", 10) / 1e6;
5897
- const amountWithSlippage = amountSell.times(slippageMultiplier);
5898
- const coinInAmount = toPureValue(amountWithSlippage, coinIn?.decimals);
5899
- return coinInAmount;
5900
- }
5901
- async function buildSwapRoutes(options, { defiRouterUrl }) {
5902
- const aggregatorQuoter = new import_sdk.AggregatorQuoter("mainnet");
5903
- const routes = await aggregatorQuoter.getRoutes({
5904
- tokenIn: options.coinInType,
5905
- tokenOut: options.coinOutType,
5906
- amountIn: options.amountToSwap.toString(),
5907
- commission: options.commission,
5908
- excludeSources: options.excludeSources
5909
- });
5910
- if (defiRouterUrl && options.walletAddress) {
5911
- await makeDefiRouterRequest(`${defiRouterUrl}/start`, {
5912
- walletId: options.walletAddress,
5913
- coinTypeIn: options.coinInType,
5914
- coinTypeOut: options.coinOutType,
5915
- amountIn: options.amountToSwap.toString()
5916
- });
5917
- }
5918
- return routes;
5919
- }
5920
- function calculateSwapAmounts(affectedTypesCount, inAmount) {
5921
- const feeAndReward = affectedTypesCount > 0 ? BigInt(affectedTypesCount) * inAmount / 25n : inAmount / 100n;
5922
- const amountToSwap = inAmount - feeAndReward;
5923
- if (amountToSwap <= 0n) {
5924
- throw new Error("Amount to swap is too small");
5925
- }
5926
- return { feeAndReward, amountToSwap };
5927
- }
5928
- async function getAffectedNftAndFtTypes(coinInType, coinOutType) {
5929
- const normalizedSuiType = (0, import_utils7.normalizeStructTag)(import_utils7.SUI_TYPE_ARG);
5930
- const coinTypes = [coinInType, coinOutType].filter((type) => type !== normalizedSuiType);
5931
- const types = await Promise.all(
5932
- coinTypes.map(async (type) => {
5933
- const chainState = await getCollectionChainStateByFtType(type);
5934
- return chainState ? {
5935
- nftType: chainState.nft_type,
5936
- ftType: type,
5937
- type: chainState.ft_type ? "liquidNft" : "nftStrategy"
5938
- } : void 0;
5939
- })
5940
- );
5941
- return types.filter(Boolean);
5942
- }
5943
- async function makeDefiRouterRequest(url, body, defaultResponse = void 0) {
5944
- try {
5945
- const response = await fetch(url, {
5946
- method: "POST",
5947
- headers: { "Content-Type": "application/json" },
5948
- body: JSON.stringify(body)
5949
- });
5950
- if (!response.ok) {
5951
- console.warn(`DeFi router request failed with status ${response.status}`);
5952
- return defaultResponse;
5953
- }
5954
- if (response.headers.get("Content-Type")?.includes("application/json")) {
5955
- return await response.json();
5956
- }
5957
- return defaultResponse;
5958
- } catch (error) {
5959
- console.warn(`DeFi router request error: ${error.message}`);
5960
- return defaultResponse;
5961
- }
5962
- }
5963
-
5964
5733
  // src/methods/sponsorNftListing/addSponsorNftListingTx.ts
5734
+ var import_transactions13 = require("@mysten/sui/transactions");
5965
5735
  var addSponsorListingTx = async ({
5966
5736
  tx,
5967
5737
  nftTokenId,
5968
5738
  nftType,
5969
- suiClient,
5970
- walletAddress,
5971
- sponsorOptions,
5972
- defiRouterUrl
5739
+ sponsorOptions
5973
5740
  }) => {
5974
- const coinInAmount = sponsorOptions?.coinInAmount ?? await calculateSwapInputAmountWithSlippage({
5975
- coinInType: sponsorOptions?.coinInType,
5976
- coinOutType: USDC_COIN_TYPE,
5977
- coinOutAmount: new bigNumberConfig_default(sponsorOptions?.usdcFeeAmountPerPeriod)?.times(sponsorOptions?.numOfPeriods).toString(),
5978
- slippage: sponsorOptions?.slippage
5979
- });
5980
- const { coinOut } = await swapCoins(
5981
- {
5982
- walletAddress,
5983
- coinInType: sponsorOptions?.coinInType,
5984
- coinInAmount: coinInAmount.toString(),
5985
- coinOutType: USDC_COIN_TYPE,
5986
- slippage: sponsorOptions?.slippage,
5987
- tx
5988
- },
5989
- { suiClient, defiRouterUrl }
5990
- );
5991
- const [sponsorFeeCoin] = tx.splitCoins(coinOut, [
5992
- tx.pure.u64(
5993
- new bigNumberConfig_default(sponsorOptions?.usdcFeeAmountPerPeriod)?.times(sponsorOptions?.numOfPeriods).toString()
5994
- )
5995
- ]);
5741
+ const totalFee = new bigNumberConfig_default(sponsorOptions?.usdcFeeAmountPerPeriod)?.times(sponsorOptions?.numOfPeriods).toString();
5742
+ const sponsorCoin = sponsorOptions.coinToSplit ? tx.splitCoins(sponsorOptions.coinToSplit, [tx.pure.u64(totalFee)])[0] : (0, import_transactions13.coinWithBalance)({ type: USDC_COIN_TYPE, balance: BigInt(totalFee) });
5996
5743
  tx.moveCall({
5997
5744
  target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::add_sponsored_listing`,
5998
5745
  arguments: [
@@ -6000,19 +5747,14 @@ var addSponsorListingTx = async ({
6000
5747
  tx.object.clock(),
6001
5748
  tx.pure.id(nftTokenId),
6002
5749
  tx.pure.u64(sponsorOptions?.numOfPeriods),
6003
- tx.object(sponsorFeeCoin)
5750
+ tx.object(sponsorCoin)
6004
5751
  ],
6005
5752
  typeArguments: [nftType]
6006
5753
  });
6007
- tx.transferObjects([coinOut], walletAddress);
6008
5754
  };
6009
5755
 
6010
- // src/helpers/isExpiredListing.ts
6011
- var import_utils8 = require("@mysten/sui/utils");
6012
- var isExpiredListing = (listing, walletAddress) => listing.nonce && listing.seller && (0, import_utils8.normalizeSuiAddress)(listing.seller) === (0, import_utils8.normalizeSuiAddress)(walletAddress);
6013
-
6014
5756
  // src/methods/listNfts/listNfts.ts
6015
- var listNfts = async ({ nfts, walletAddress }, context) => {
5757
+ var listNfts = async ({ nfts, walletAddress, tx: existingTx }, context) => {
6016
5758
  const res = await gqlChainRequest({
6017
5759
  chain: "sui",
6018
5760
  query: fetchNftsWithListingsById,
@@ -6022,7 +5764,7 @@ var listNfts = async ({ nfts, walletAddress }, context) => {
6022
5764
  throw new Error("No nfts found");
6023
5765
  }
6024
5766
  const nftsForTracking = [];
6025
- const tx = new import_transactions12.Transaction();
5767
+ const tx = existingTx ?? new import_transactions14.Transaction();
6026
5768
  const sharedKioskState = {
6027
5769
  kioskTx: void 0
6028
5770
  };
@@ -6072,12 +5814,9 @@ var listNfts = async ({ nfts, walletAddress }, context) => {
6072
5814
  if (inputNft?.sponsorOptions?.shouldSponsor) {
6073
5815
  await addSponsorListingTx({
6074
5816
  tx,
6075
- suiClient: context.suiClient,
6076
5817
  nftTokenId: nft?.token_id,
6077
5818
  nftType,
6078
- walletAddress,
6079
- sponsorOptions: inputNft?.sponsorOptions,
6080
- defiRouterUrl: context.defiRouterUrl
5819
+ sponsorOptions: inputNft?.sponsorOptions
6081
5820
  });
6082
5821
  }
6083
5822
  nftsForTracking.push({
@@ -6090,15 +5829,15 @@ var listNfts = async ({ nfts, walletAddress }, context) => {
6090
5829
  });
6091
5830
  }
6092
5831
  sharedKioskState?.kioskTx?.finalize();
6093
- return tx instanceof import_transactions12.Transaction ? tx : import_transactions12.Transaction.from(tx);
5832
+ return tx;
6094
5833
  };
6095
5834
 
6096
5835
  // src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts
6097
- var import_transactions13 = require("@mysten/sui/transactions");
5836
+ var import_transactions15 = require("@mysten/sui/transactions");
6098
5837
 
6099
5838
  // src/graphql/queries/fetchNftsByKioskId.ts
6100
- var import_graphql_request16 = require("graphql-request");
6101
- var fetchNftsByKioskId = import_graphql_request16.gql`
5839
+ var import_graphql_request17 = require("graphql-request");
5840
+ var fetchNftsByKioskId = import_graphql_request17.gql`
6102
5841
  query fetchNftsByKioskId($jsonFilter: jsonb) {
6103
5842
  nfts(where: { chain_state: { _contains: $jsonFilter } }) {
6104
5843
  id
@@ -6119,7 +5858,7 @@ var fetchNftsByKioskId = import_graphql_request16.gql`
6119
5858
  }
6120
5859
  }
6121
5860
  `;
6122
- var fetchBulkNftsByKioskId = import_graphql_request16.gql`
5861
+ var fetchBulkNftsByKioskId = import_graphql_request17.gql`
6123
5862
  query fetchNftsByKioskId($where: nfts_bool_exp) {
6124
5863
  nfts(where: $where) {
6125
5864
  id
@@ -6142,8 +5881,8 @@ var fetchBulkNftsByKioskId = import_graphql_request16.gql`
6142
5881
  `;
6143
5882
 
6144
5883
  // src/graphql/queries/fetchTransferPoliciesByType.ts
6145
- var import_graphql_request17 = require("graphql-request");
6146
- var fetchTransferPoliciesByType = import_graphql_request17.gql`
5884
+ var import_graphql_request18 = require("graphql-request");
5885
+ var fetchTransferPoliciesByType = import_graphql_request18.gql`
6147
5886
  query fetchTransferPoliciesByType($type: String!) {
6148
5887
  transfer_policies_by_type(type: $type) {
6149
5888
  id
@@ -6302,7 +6041,7 @@ async function getTransferPolicyForDirectTransfer(suiClient, collectionChainStat
6302
6041
 
6303
6042
  // src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts
6304
6043
  async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }, context) {
6305
- const tx = new import_transactions13.Transaction();
6044
+ const tx = new import_transactions15.Transaction();
6306
6045
  const res = await gqlChainRequest({
6307
6046
  chain: "sui",
6308
6047
  query: fetchKiosksByOwner,
@@ -6468,15 +6207,15 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }
6468
6207
  }
6469
6208
  }
6470
6209
  sharedKioskState?.kioskTx?.finalize();
6471
- return import_transactions13.Transaction.from(tx);
6210
+ return import_transactions15.Transaction.from(tx);
6472
6211
  }
6473
6212
 
6474
6213
  // src/methods/placeCollectionBids/placeCollectionBids.ts
6475
- var import_transactions14 = require("@mysten/sui/transactions");
6214
+ var import_transactions16 = require("@mysten/sui/transactions");
6476
6215
 
6477
6216
  // src/graphql/queries/fetchCollectionsById.ts
6478
- var import_graphql_request18 = require("graphql-request");
6479
- var fetchCollectionsById = import_graphql_request18.gql`
6217
+ var import_graphql_request19 = require("graphql-request");
6218
+ var fetchCollectionsById = import_graphql_request19.gql`
6480
6219
  query fetchCollectionsById($collectionIds: [uuid!]) {
6481
6220
  collections(where: { id: { _in: $collectionIds } }) {
6482
6221
  id
@@ -6486,7 +6225,7 @@ var fetchCollectionsById = import_graphql_request18.gql`
6486
6225
  }
6487
6226
  }
6488
6227
  `;
6489
- var fetchCollectionsByIdWithOneNft = import_graphql_request18.gql`
6228
+ var fetchCollectionsByIdWithOneNft = import_graphql_request19.gql`
6490
6229
  query fetchCollectionsByIdWithOneNft($collectionIds: [uuid!]) {
6491
6230
  collections(where: { id: { _in: $collectionIds } }) {
6492
6231
  id
@@ -6504,7 +6243,7 @@ var fetchCollectionsByIdWithOneNft = import_graphql_request18.gql`
6504
6243
  }
6505
6244
  }
6506
6245
  `;
6507
- var fetchCollectionsBySlug = import_graphql_request18.gql`
6246
+ var fetchCollectionsBySlug = import_graphql_request19.gql`
6508
6247
  query fetchCollectionsBySlug($slug: String!) {
6509
6248
  collections(where: { slug: { _eq: $slug } }) {
6510
6249
  id
@@ -6626,8 +6365,8 @@ function isDynamicCollection(collectionId) {
6626
6365
  }
6627
6366
 
6628
6367
  // src/graphql/queries/fetchCollectionFloorListings.ts
6629
- var import_graphql_request19 = require("graphql-request");
6630
- var fetchCollectionFloorListings = import_graphql_request19.gql`
6368
+ var import_graphql_request20 = require("graphql-request");
6369
+ var fetchCollectionFloorListings = import_graphql_request20.gql`
6631
6370
  query fetchCollectionFloorListings($collectionId: uuid!) {
6632
6371
  listings(
6633
6372
  where: { collection_id: { _eq: $collectionId }, listed: { _eq: true }, nft: {} }
@@ -6686,7 +6425,14 @@ async function addOriginByteCollectionBidTx({
6686
6425
  }
6687
6426
 
6688
6427
  // src/methods/placeCollectionBids/placeCollectionBids.ts
6689
- var placeCollectionBids = async ({ collections, walletAddress, multiBidId, multiBidChainId, tx: existingTx }, context) => {
6428
+ var placeCollectionBids = async ({
6429
+ collections,
6430
+ walletAddress,
6431
+ multiBidId,
6432
+ multiBidChainId,
6433
+ tx: existingTx,
6434
+ coinToSplit
6435
+ }, context) => {
6690
6436
  const res = await gqlChainRequest({
6691
6437
  chain: "sui",
6692
6438
  query: fetchCollectionsByIdWithOneNft,
@@ -6696,8 +6442,7 @@ var placeCollectionBids = async ({ collections, walletAddress, multiBidId, multi
6696
6442
  throw new Error("No collection found");
6697
6443
  }
6698
6444
  const collectionsForTracking = [];
6699
- const tx = deserializeOrCreateTxBlock({ existingTx });
6700
- const swapResultCoin = extractSwapResultCoinFromTxBlock(tx);
6445
+ const tx = existingTx ?? new import_transactions16.Transaction();
6701
6446
  for (const collection of res.collections) {
6702
6447
  const nftType = getNftType({
6703
6448
  collectionId: collection?.id,
@@ -6717,7 +6462,7 @@ var placeCollectionBids = async ({ collections, walletAddress, multiBidId, multi
6717
6462
  multiBidId,
6718
6463
  multiBidChainId,
6719
6464
  expireAt: collections?.find((c) => c.id === collection?.id)?.expireAt,
6720
- coinToSplit: swapResultCoin
6465
+ coinToSplit
6721
6466
  };
6722
6467
  const numOfBids = collections?.find((c) => c.id === collection?.id)?.numOfBids;
6723
6468
  if (isOriginByteCollection(txData?.transferPolicies) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
@@ -6744,17 +6489,13 @@ var placeCollectionBids = async ({ collections, walletAddress, multiBidId, multi
6744
6489
  bidder: walletAddress
6745
6490
  });
6746
6491
  }
6747
- if (swapResultCoin) {
6748
- tx.transferObjects([swapResultCoin], walletAddress);
6749
- }
6750
- return import_transactions14.Transaction.from(tx);
6492
+ return tx;
6751
6493
  };
6752
6494
 
6753
6495
  // src/methods/placeNftBids/placeNftBids.ts
6754
- var import_transactions15 = require("@mysten/sui/transactions");
6755
- var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx: existingTx }, context) => {
6756
- const tx = deserializeOrCreateTxBlock({ existingTx });
6757
- const swapResultCoin = extractSwapResultCoinFromTxBlock(tx);
6496
+ var import_transactions17 = require("@mysten/sui/transactions");
6497
+ var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx: existingTx, coinToSplit }, context) => {
6498
+ const tx = existingTx ?? new import_transactions17.Transaction();
6758
6499
  const res = await gqlChainRequest({
6759
6500
  chain: "sui",
6760
6501
  query: fetchNftsById,
@@ -6788,7 +6529,7 @@ var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx
6788
6529
  multiBidId,
6789
6530
  multiBidChainId,
6790
6531
  expireAt: bid?.expireAt,
6791
- coinToSplit: swapResultCoin
6532
+ coinToSplit
6792
6533
  };
6793
6534
  await addTradePortPlaceNftBidTxHandler(txData);
6794
6535
  nftsForTracking.push({
@@ -6798,14 +6539,11 @@ var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx
6798
6539
  bidder: walletAddress
6799
6540
  });
6800
6541
  }
6801
- if (swapResultCoin) {
6802
- tx.transferObjects([swapResultCoin], walletAddress);
6803
- }
6804
- return import_transactions15.Transaction.from(tx);
6542
+ return tx;
6805
6543
  };
6806
6544
 
6807
6545
  // src/methods/removeCollectionBids/removeCollectionBids.ts
6808
- var import_transactions16 = require("@mysten/sui/transactions");
6546
+ var import_transactions18 = require("@mysten/sui/transactions");
6809
6547
 
6810
6548
  // src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts
6811
6549
  var import_utils10 = require("@mysten/sui/utils");
@@ -6913,7 +6651,7 @@ var removeCollectionBids = async ({ bidIds, tx: existingTx }, context) => {
6913
6651
  throw new Error("No bids found");
6914
6652
  }
6915
6653
  const bidsForTracking = [];
6916
- const tx = existingTx ? import_transactions16.Transaction.from(existingTx) : new import_transactions16.Transaction();
6654
+ const tx = existingTx ? import_transactions18.Transaction.from(existingTx) : new import_transactions18.Transaction();
6917
6655
  for (const bid of res.bids) {
6918
6656
  if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
6919
6657
  throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
@@ -6961,11 +6699,11 @@ var removeCollectionBids = async ({ bidIds, tx: existingTx }, context) => {
6961
6699
  bidder: bid?.bidder
6962
6700
  });
6963
6701
  }
6964
- return import_transactions16.Transaction.from(tx);
6702
+ return import_transactions18.Transaction.from(tx);
6965
6703
  };
6966
6704
 
6967
6705
  // src/methods/removeNftBids/removeNftBids.ts
6968
- var import_transactions17 = require("@mysten/sui/transactions");
6706
+ var import_transactions19 = require("@mysten/sui/transactions");
6969
6707
  var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
6970
6708
  const res = await gqlChainRequest({
6971
6709
  chain: "sui",
@@ -6976,7 +6714,7 @@ var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
6976
6714
  throw new Error("No bids found");
6977
6715
  }
6978
6716
  const bidsForTracking = [];
6979
- const tx = existingTx ? import_transactions17.Transaction.from(existingTx) : new import_transactions17.Transaction();
6717
+ const tx = existingTx ? import_transactions19.Transaction.from(existingTx) : new import_transactions19.Transaction();
6980
6718
  for (const bid of res.bids) {
6981
6719
  if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
6982
6720
  throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
@@ -7021,11 +6759,61 @@ var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
7021
6759
  bidder: bid?.bidder
7022
6760
  });
7023
6761
  }
7024
- return import_transactions17.Transaction.from(tx);
6762
+ return import_transactions19.Transaction.from(tx);
6763
+ };
6764
+
6765
+ // src/methods/sponsorNftListing/sponsorNftListing.ts
6766
+ var import_transactions20 = require("@mysten/sui/transactions");
6767
+
6768
+ // src/graphql/queries/fetchNftCollectionChainState.ts
6769
+ var import_graphql_request21 = require("graphql-request");
6770
+ var fetchNftCollectionChainState = import_graphql_request21.gql`
6771
+ query fetchNftCollectionChainState($nftTokenId: String!) {
6772
+ nfts(where: { token_id: { _eq: $nftTokenId } }) {
6773
+ collection {
6774
+ id
6775
+ chain_state
6776
+ }
6777
+ }
6778
+ }
6779
+ `;
6780
+
6781
+ // src/methods/sponsorNftListing/sponsorNftListing.ts
6782
+ var sponsorNftListing = async ({
6783
+ tx: existingTx,
6784
+ nftTokenId,
6785
+ options
6786
+ }) => {
6787
+ const res = await gqlChainRequest({
6788
+ chain: "sui",
6789
+ query: fetchNftCollectionChainState,
6790
+ variables: { nftTokenId }
6791
+ });
6792
+ if (res?.nfts?.length === 0) {
6793
+ throw new Error(`No nft found with token id ${nftTokenId}`);
6794
+ }
6795
+ const nft = res?.nfts?.[0];
6796
+ const nftType = getNftType({
6797
+ collectionId: nft?.collection?.id,
6798
+ collectionChainState: nft?.collection?.chain_state,
6799
+ nft
6800
+ });
6801
+ const transferPolicies = nft?.collection?.chain_state?.transfer_policies;
6802
+ if (isOriginByteCollection(transferPolicies)) {
6803
+ throw new Error(`You cannot sponsor an Origin Byte NFT. Nft Token Id: ${nftTokenId}`);
6804
+ }
6805
+ const tx = existingTx ?? new import_transactions20.Transaction();
6806
+ await addSponsorListingTx({
6807
+ tx,
6808
+ nftTokenId,
6809
+ nftType,
6810
+ sponsorOptions: options
6811
+ });
6812
+ return tx;
7025
6813
  };
7026
6814
 
7027
6815
  // src/methods/transferNfts/transferNfts.ts
7028
- var import_transactions18 = require("@mysten/sui/transactions");
6816
+ var import_transactions21 = require("@mysten/sui/transactions");
7029
6817
  var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context) => {
7030
6818
  if (addLeadingZerosAfter0x(recipientAddress) === addLeadingZerosAfter0x(walletAddress)) {
7031
6819
  throw new Error("Cannot transfer to self");
@@ -7043,7 +6831,7 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
7043
6831
  }
7044
6832
  const nftsForTracking = [];
7045
6833
  const nftsToTransferDirectly = [];
7046
- const tx = new import_transactions18.Transaction();
6834
+ const tx = new import_transactions21.Transaction();
7047
6835
  const sharedKioskState = {
7048
6836
  kioskTx: void 0
7049
6837
  };
@@ -7146,11 +6934,11 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
7146
6934
  context.suiClient
7147
6935
  );
7148
6936
  sharedKioskState?.kioskTx?.finalize();
7149
- return import_transactions18.Transaction.from(tx);
6937
+ return import_transactions21.Transaction.from(tx);
7150
6938
  };
7151
6939
 
7152
6940
  // src/methods/unlistListings/unlistListings.ts
7153
- var import_transactions19 = require("@mysten/sui/transactions");
6941
+ var import_transactions22 = require("@mysten/sui/transactions");
7154
6942
  var unlistListings = async ({ listingIds, walletAddress }, context) => {
7155
6943
  const res = await gqlChainRequest({
7156
6944
  chain: "sui",
@@ -7161,7 +6949,7 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
7161
6949
  throw new Error("No listings found");
7162
6950
  }
7163
6951
  const listingsForTracking = [];
7164
- const tx = new import_transactions19.Transaction();
6952
+ const tx = new import_transactions22.Transaction();
7165
6953
  const sharedKioskState = {
7166
6954
  kioskTx: void 0
7167
6955
  };
@@ -7230,12 +7018,12 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
7230
7018
  });
7231
7019
  }
7232
7020
  sharedKioskState?.kioskTx?.finalize();
7233
- return import_transactions19.Transaction.from(tx);
7021
+ return import_transactions22.Transaction.from(tx);
7234
7022
  };
7235
7023
 
7236
7024
  // src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts
7237
7025
  var import_kiosk5 = require("@mysten/kiosk");
7238
- var import_transactions20 = require("@mysten/sui/transactions");
7026
+ var import_transactions23 = require("@mysten/sui/transactions");
7239
7027
  async function withdrawProfitsFromKiosks({ walletAddress }, context) {
7240
7028
  const res = await gqlChainRequest({
7241
7029
  chain: "sui",
@@ -7255,7 +7043,7 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
7255
7043
  if (kiosksWithProfit.length === 0) {
7256
7044
  throw new Error(`No kiosks with profit to withdraw found for ${walletAddress}`);
7257
7045
  }
7258
- const tx = new import_transactions20.Transaction();
7046
+ const tx = new import_transactions23.Transaction();
7259
7047
  try {
7260
7048
  for (const kiosk of kiosksWithProfit) {
7261
7049
  let kioskTx;
@@ -7301,149 +7089,7 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
7301
7089
  } catch (err) {
7302
7090
  console.log("err", err);
7303
7091
  }
7304
- return import_transactions20.Transaction.from(tx);
7305
- }
7306
-
7307
- // src/methods/sponsorNftListing/sponsorNftListing.ts
7308
- var import_transactions21 = require("@mysten/sui/transactions");
7309
-
7310
- // src/graphql/queries/fetchNftCollectionChainState.ts
7311
- var import_graphql_request20 = require("graphql-request");
7312
- var fetchNftCollectionChainState = import_graphql_request20.gql`
7313
- query fetchNftCollectionChainState($nftTokenId: String!) {
7314
- nfts(where: { token_id: { _eq: $nftTokenId } }) {
7315
- collection {
7316
- id
7317
- chain_state
7318
- }
7319
- }
7320
- }
7321
- `;
7322
-
7323
- // src/methods/sponsorNftListing/sponsorNftListing.ts
7324
- var sponsorNftListing = async ({ nftTokenId, walletAddress, options }, context) => {
7325
- const res = await gqlChainRequest({
7326
- chain: "sui",
7327
- query: fetchNftCollectionChainState,
7328
- variables: { nftTokenId }
7329
- });
7330
- if (res?.nfts?.length === 0) {
7331
- throw new Error(`No nft found with token id ${nftTokenId}`);
7332
- }
7333
- const nft = res?.nfts?.[0];
7334
- const nftType = getNftType({
7335
- collectionId: nft?.collection?.id,
7336
- collectionChainState: nft?.collection?.chain_state,
7337
- nft
7338
- });
7339
- const transferPolicies = nft?.collection?.chain_state?.transfer_policies;
7340
- if (isOriginByteCollection(transferPolicies)) {
7341
- throw new Error(`You cannot sponsor an Origin Byte NFT. Nft Token Id: ${nftTokenId}`);
7342
- }
7343
- const tx = new import_transactions21.Transaction();
7344
- await addSponsorListingTx({
7345
- tx,
7346
- suiClient: context.suiClient,
7347
- nftTokenId,
7348
- nftType,
7349
- walletAddress,
7350
- sponsorOptions: options,
7351
- defiRouterUrl: context.defiRouterUrl
7352
- });
7353
- return tx instanceof import_transactions21.Transaction ? tx : import_transactions21.Transaction.from(tx);
7354
- };
7355
-
7356
- // src/methods/applyNftStrategy/applyNftStrategy.ts
7357
- var import_transactions22 = require("@mysten/sui/transactions");
7358
-
7359
- // src/graphql/queries/fetchCollectionFloorListingForMarket.ts
7360
- var import_graphql_request21 = require("graphql-request");
7361
- var fetchCollectionFloorListingsForMarket = import_graphql_request21.gql`
7362
- query fetchCollectionFloorListingsForMarket(
7363
- $collectionId: uuid!
7364
- $marketAddress: String!
7365
- $totalPrice: numeric
7366
- ) {
7367
- listings(
7368
- where: {
7369
- collection_id: { _eq: $collectionId }
7370
- listed: { _eq: true }
7371
- market_name: { _eq: "tradeport" }
7372
- seller: { _neq: $marketAddress }
7373
- nonce: { _like: "1::0x%" }
7374
- price: { _lte: $totalPrice }
7375
- }
7376
- order_by: [{ price: asc_nulls_last }, { block_height: asc }, { tx_index: asc }]
7377
- ) {
7378
- id
7379
- price
7380
- nft {
7381
- token_id
7382
- delegated_owner
7383
- }
7384
- }
7385
- }
7386
- `;
7387
-
7388
- // src/methods/applyNftStrategy/applyNftStrategy.ts
7389
- async function applyTradeportNftStrategy({
7390
- collectionId,
7391
- strategyFtType,
7392
- tx: existingTx
7393
- }) {
7394
- const tx = existingTx ?? new import_transactions22.Transaction();
7395
- const chainState = await getCollectionChainState(collectionId);
7396
- const nftStrategies = chainState?.nft_strategies ?? {};
7397
- const nftStrategyKeys = Object.keys(nftStrategies);
7398
- if (nftStrategyKeys.length === 0) {
7399
- throw new Error("No NFT strategies found for collection");
7400
- }
7401
- strategyFtType = strategyFtType ?? nftStrategyKeys[0];
7402
- if (!nftStrategyKeys.includes(strategyFtType)) {
7403
- throw new Error(`Specified FT type ${strategyFtType} is not supported for this collection`);
7404
- }
7405
- const transferPolicy = getNativeKioskTransferPolicies(chainState?.transfer_policies ?? [])?.at(0);
7406
- if (!transferPolicy) {
7407
- throw new Error("No transfer policy found for collection");
7408
- }
7409
- const nftType = chainState?.nft_type;
7410
- let suiBalance = BigInt(
7411
- nftStrategies[strategyFtType].sui_balance ?? 0n
7412
- );
7413
- const result = await gqlChainRequest({
7414
- chain: "sui",
7415
- query: fetchCollectionFloorListingsForMarket,
7416
- variables: {
7417
- collectionId,
7418
- marketAddress: TRADEPORT_NFT_STRATEGY_MANAGER_ID,
7419
- totalPrice: suiBalance.toString()
7420
- }
7421
- });
7422
- if ((result?.listings?.length ?? 0) === 0) {
7423
- throw new Error(
7424
- `No floor listing found for collection with price bellow or equal to ${suiBalance} MIST`
7425
- );
7426
- }
7427
- for (const floorListing of result.listings) {
7428
- suiBalance -= BigInt(floorListing.price);
7429
- if (suiBalance < 0n) {
7430
- break;
7431
- }
7432
- tx.moveCall({
7433
- target: `${TRADEPORT_NFT_STRATEGY_PACKAGE_ID}::tradeport_nft_strategy::apply_tradeport_nft_strategy_confirm_request`,
7434
- typeArguments: [nftType, strategyFtType],
7435
- arguments: [
7436
- tx.object(TRADEPORT_NFT_STRATEGY_MANAGER_ID),
7437
- tx.object(nftStrategies[strategyFtType].kiosk_id),
7438
- tx.object(TRADEPORT_LISTINGS_STORE),
7439
- tx.object(TRADEPORT_ORDERBOOK_STORE),
7440
- tx.object(floorListing.nft.delegated_owner),
7441
- tx.object(floorListing.nft.token_id),
7442
- tx.object(transferPolicy.id)
7443
- ]
7444
- });
7445
- }
7446
- return tx;
7092
+ return import_transactions23.Transaction.from(tx);
7447
7093
  }
7448
7094
 
7449
7095
  // src/SuiTradingClient.ts
@@ -7453,14 +7099,14 @@ var SuiTradingClient = class {
7453
7099
  apiKey,
7454
7100
  apiVercelId,
7455
7101
  apiUrl,
7456
- defiRouterUrl,
7102
+ tradeportRouterUrl,
7457
7103
  suiNodeUrl,
7458
7104
  graphQLClient
7459
7105
  }) {
7460
7106
  this.allowedApiUsersForUnsharedKiosksMigration = ["tradeport.xyz", "mercato.xyz"];
7461
7107
  this.apiUser = apiUser;
7462
7108
  this.apiKey = apiKey;
7463
- this.defiRouterUrl = defiRouterUrl ?? "https://api.indexer.xyz/router";
7109
+ this.tradeportRouterUrl = tradeportRouterUrl;
7464
7110
  this.suiClient = createSuiClient_default(suiNodeUrl ?? (0, import_client2.getFullnodeUrl)("mainnet"));
7465
7111
  this.kioskClient = createKioskClient_default(this.suiClient);
7466
7112
  if (graphQLClient) {
@@ -7474,31 +7120,31 @@ var SuiTradingClient = class {
7474
7120
  ...apiVercelId && { "x-vercel-id": apiVercelId }
7475
7121
  });
7476
7122
  }
7477
- async buyListings({ listingIds, walletAddress, tx }) {
7123
+ async buyListings(args) {
7478
7124
  const context = {
7479
7125
  apiUser: this.apiUser,
7480
7126
  apiKey: this.apiKey,
7481
- defiRouterUrl: this.defiRouterUrl,
7127
+ tradeportRouterUrl: this.tradeportRouterUrl,
7482
7128
  suiClient: this.suiClient,
7483
7129
  kioskClient: this.kioskClient
7484
7130
  };
7485
- return buyListings({ listingIds, walletAddress, tx }, context);
7131
+ return buyListings(args, context);
7486
7132
  }
7487
- async listNfts({ nfts, walletAddress }) {
7133
+ async listNfts({ nfts, walletAddress, tx }) {
7488
7134
  const context = {
7489
7135
  apiUser: this.apiUser,
7490
7136
  apiKey: this.apiKey,
7491
- defiRouterUrl: this.defiRouterUrl,
7137
+ tradeportRouterUrl: this.tradeportRouterUrl,
7492
7138
  suiClient: this.suiClient,
7493
7139
  kioskClient: this.kioskClient
7494
7140
  };
7495
- return listNfts({ nfts, walletAddress }, context);
7141
+ return listNfts({ nfts, walletAddress, tx }, context);
7496
7142
  }
7497
7143
  async unlistListings({ listingIds, walletAddress }) {
7498
7144
  const context = {
7499
7145
  apiUser: this.apiUser,
7500
7146
  apiKey: this.apiKey,
7501
- defiRouterUrl: this.defiRouterUrl,
7147
+ tradeportRouterUrl: this.tradeportRouterUrl,
7502
7148
  suiClient: this.suiClient,
7503
7149
  kioskClient: this.kioskClient
7504
7150
  };
@@ -7508,7 +7154,7 @@ var SuiTradingClient = class {
7508
7154
  const context = {
7509
7155
  apiUser: this.apiUser,
7510
7156
  apiKey: this.apiKey,
7511
- defiRouterUrl: this.defiRouterUrl,
7157
+ tradeportRouterUrl: this.tradeportRouterUrl,
7512
7158
  suiClient: this.suiClient,
7513
7159
  kioskClient: this.kioskClient
7514
7160
  };
@@ -7517,7 +7163,7 @@ var SuiTradingClient = class {
7517
7163
  async removeNftBids({ bidIds, tx }) {
7518
7164
  const context = {
7519
7165
  apiUser: this.apiUser,
7520
- defiRouterUrl: this.defiRouterUrl,
7166
+ tradeportRouterUrl: this.tradeportRouterUrl,
7521
7167
  apiKey: this.apiKey,
7522
7168
  suiClient: this.suiClient,
7523
7169
  kioskClient: this.kioskClient
@@ -7528,7 +7174,7 @@ var SuiTradingClient = class {
7528
7174
  const context = {
7529
7175
  apiUser: this.apiUser,
7530
7176
  apiKey: this.apiKey,
7531
- defiRouterUrl: this.defiRouterUrl,
7177
+ tradeportRouterUrl: this.tradeportRouterUrl,
7532
7178
  suiClient: this.suiClient,
7533
7179
  kioskClient: this.kioskClient
7534
7180
  };
@@ -7547,7 +7193,7 @@ var SuiTradingClient = class {
7547
7193
  const context = {
7548
7194
  apiUser: this.apiUser,
7549
7195
  apiKey: this.apiKey,
7550
- defiRouterUrl: this.defiRouterUrl,
7196
+ tradeportRouterUrl: this.tradeportRouterUrl,
7551
7197
  suiClient: this.suiClient,
7552
7198
  kioskClient: this.kioskClient
7553
7199
  };
@@ -7573,7 +7219,7 @@ var SuiTradingClient = class {
7573
7219
  const context = {
7574
7220
  apiUser: this.apiUser,
7575
7221
  apiKey: this.apiKey,
7576
- defiRouterUrl: this.defiRouterUrl,
7222
+ tradeportRouterUrl: this.tradeportRouterUrl,
7577
7223
  suiClient: this.suiClient,
7578
7224
  kioskClient: this.kioskClient
7579
7225
  };
@@ -7649,7 +7295,7 @@ var SuiTradingClient = class {
7649
7295
  const context = {
7650
7296
  apiUser: this.apiUser,
7651
7297
  apiKey: this.apiKey,
7652
- defiRouterUrl: this.defiRouterUrl,
7298
+ tradeportRouterUrl: this.tradeportRouterUrl,
7653
7299
  suiClient: this.suiClient,
7654
7300
  kioskClient: this.kioskClient
7655
7301
  };
@@ -7659,7 +7305,7 @@ var SuiTradingClient = class {
7659
7305
  const context = {
7660
7306
  apiUser: this.apiUser,
7661
7307
  apiKey: this.apiKey,
7662
- defiRouterUrl: this.defiRouterUrl,
7308
+ tradeportRouterUrl: this.tradeportRouterUrl,
7663
7309
  suiClient: this.suiClient,
7664
7310
  kioskClient: this.kioskClient
7665
7311
  };
@@ -7669,7 +7315,7 @@ var SuiTradingClient = class {
7669
7315
  const context = {
7670
7316
  apiUser: this.apiUser,
7671
7317
  apiKey: this.apiKey,
7672
- defiRouterUrl: this.defiRouterUrl,
7318
+ tradeportRouterUrl: this.tradeportRouterUrl,
7673
7319
  suiClient: this.suiClient,
7674
7320
  kioskClient: this.kioskClient
7675
7321
  };
@@ -7685,7 +7331,7 @@ var SuiTradingClient = class {
7685
7331
  const context = {
7686
7332
  apiUser: this.apiUser,
7687
7333
  apiKey: this.apiKey,
7688
- defiRouterUrl: this.defiRouterUrl,
7334
+ tradeportRouterUrl: this.tradeportRouterUrl,
7689
7335
  suiClient: this.suiClient,
7690
7336
  kioskClient: this.kioskClient
7691
7337
  };
@@ -7705,7 +7351,7 @@ var SuiTradingClient = class {
7705
7351
  const context = {
7706
7352
  apiUser: this.apiUser,
7707
7353
  apiKey: this.apiKey,
7708
- defiRouterUrl: this.defiRouterUrl,
7354
+ tradeportRouterUrl: this.tradeportRouterUrl,
7709
7355
  suiClient: this.suiClient,
7710
7356
  kioskClient: this.kioskClient
7711
7357
  };
@@ -7718,7 +7364,7 @@ var SuiTradingClient = class {
7718
7364
  const context = {
7719
7365
  apiUser: this.apiUser,
7720
7366
  apiKey: this.apiKey,
7721
- defiRouterUrl: this.defiRouterUrl,
7367
+ tradeportRouterUrl: this.tradeportRouterUrl,
7722
7368
  suiClient: this.suiClient,
7723
7369
  kioskClient: this.kioskClient
7724
7370
  };
@@ -7731,17 +7377,13 @@ var SuiTradingClient = class {
7731
7377
  return cancelMultiBid(args);
7732
7378
  }
7733
7379
  async updateMultiBid(args) {
7734
- return updateMultiBid(args);
7380
+ return updateMultiBid(args, {
7381
+ suiClient: this.suiClient,
7382
+ tradeportRouterUrl: this.tradeportRouterUrl
7383
+ });
7735
7384
  }
7736
7385
  async sponsorNftListing(args) {
7737
- const context = {
7738
- apiUser: this.apiUser,
7739
- apiKey: this.apiKey,
7740
- defiRouterUrl: this.defiRouterUrl,
7741
- suiClient: this.suiClient,
7742
- kioskClient: this.kioskClient
7743
- };
7744
- return sponsorNftListing(args, context);
7386
+ return sponsorNftListing(args);
7745
7387
  }
7746
7388
  async applyFtStrategy(args) {
7747
7389
  return applyFtStrategy(args);
@@ -7749,15 +7391,6 @@ var SuiTradingClient = class {
7749
7391
  async applyTradeportNftStrategy(args) {
7750
7392
  return applyTradeportNftStrategy(args);
7751
7393
  }
7752
- async swapCoins(args) {
7753
- return swapCoins(args, { suiClient: this.suiClient, defiRouterUrl: this.defiRouterUrl });
7754
- }
7755
- async buildSwapRoutes(args) {
7756
- return buildSwapRoutes(args, { defiRouterUrl: this.defiRouterUrl });
7757
- }
7758
- async calculateAmountToSwap(args) {
7759
- return calculateAmountToSwap(args);
7760
- }
7761
7394
  };
7762
7395
  var SuiTradingClient_default = SuiTradingClient;
7763
7396
  // Annotate the CommonJS export names for ESM import in node: