@tradeport/sui-trading-sdk 0.4.66 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/index.d.ts +2 -1
  3. package/dist/index.js +330 -329
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +16 -5
  6. package/dist/index.mjs.map +1 -1
  7. package/jest.config.js +6 -2
  8. package/package.json +66 -65
  9. package/src/SuiTradingClient.ts +24 -14
  10. package/src/apiClients/createKioskClient.ts +5 -6
  11. package/src/apiClients/createSuiClient.ts +2 -2
  12. package/src/helpers/getTransferPolicyRuleNamesFromSuiObject.ts +9 -21
  13. package/src/helpers/isNonKioskListing.ts +2 -2
  14. package/src/helpers/kiosk/getKioskCollectionRoyaltyFeeAmount.ts +10 -10
  15. package/src/helpers/kiosk/getKioskIdFromKioskTx.ts +15 -7
  16. package/src/helpers/kiosk/getKioskPlaceBidCoin.ts +2 -2
  17. package/src/helpers/kiosk/getRulePackageId.ts +2 -2
  18. package/src/helpers/kiosk/getTransferPoliciesToResolve.ts +2 -2
  19. package/src/helpers/kiosk/kioskListingBcs.ts +19 -0
  20. package/src/helpers/kiosk/kioskTxWrapper.ts +3 -3
  21. package/src/helpers/kiosk/lockNftInsideKioskIfNotLocked.ts +9 -9
  22. package/src/helpers/kiosk/preProcessSharedBulkBuyingData.ts +33 -21
  23. package/src/helpers/kiosk/resolveRoyaltyRule.ts +2 -2
  24. package/src/helpers/kiosk/resolveTransferPolicies.ts +2 -2
  25. package/src/helpers/kiosk/takeAndBorrowNftFromKiosk.ts +2 -2
  26. package/src/helpers/kiosk/takeLockedNftFromKiosk.ts +5 -9
  27. package/src/helpers/originByte/getOBBidderKiosk.ts +4 -7
  28. package/src/helpers/rpc/getAcountBalance.ts +3 -3
  29. package/src/helpers/rpc/getObjectType.ts +8 -4
  30. package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +2 -2
  31. package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +3 -3
  32. package/src/methods/acceptNftBids/acceptNftBids.ts +2 -2
  33. package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +4 -4
  34. package/src/methods/buyListings/addBuyListingTxs.ts +16 -18
  35. package/src/methods/buyListings/buyListings.ts +2 -2
  36. package/src/methods/cancelNftTransfers/addCancelNftTransfersTx.ts +1 -1
  37. package/src/methods/claimNfts/addClaimNftsTxs.ts +8 -8
  38. package/src/methods/claimNfts/claimNfts.ts +3 -3
  39. package/src/methods/listNfts/addListTxs.ts +2 -2
  40. package/src/methods/listNfts/addRelistTxs.ts +4 -4
  41. package/src/methods/listNfts/listNfts.ts +2 -2
  42. package/src/methods/placeCollectionBids/placeCollectionBids.ts +2 -2
  43. package/src/methods/placeNftBids/addPlaceNftBidTxs.ts +5 -10
  44. package/src/methods/placeNftBids/placeNftBids.ts +2 -2
  45. package/src/methods/relistNft/relistNft.ts +2 -2
  46. package/src/methods/removeCollectionBids/removeCollectionBids.ts +2 -2
  47. package/src/methods/removeNftBids/removeNftBids.ts +2 -2
  48. package/src/methods/transferNfts/addTransferNftTx.ts +16 -7
  49. package/src/methods/transferNfts/transferNfts.ts +2 -2
  50. package/src/methods/unlistListings/addUnlistListingTxs.ts +6 -10
  51. package/src/methods/unlistListings/unlistListings.ts +2 -2
  52. package/src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts +2 -2
  53. package/src/tests/SuiWallet.ts +19 -15
  54. package/tsconfig.json +2 -1
  55. package/.claude/settings.local.json +0 -5
package/dist/index.js CHANGED
@@ -1,45 +1,18 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- SuiTradingClient: () => SuiTradingClient_default
24
- });
25
- module.exports = __toCommonJS(index_exports);
26
-
27
1
  // src/SuiTradingClient.ts
28
- var import_client2 = require("@mysten/sui/client");
29
- var import_graphql_request22 = require("graphql-request");
2
+ import { GraphQLClient } from "graphql-request";
30
3
 
31
4
  // src/apiClients/createKioskClient.ts
32
- var import_kiosk = require("@mysten/kiosk");
33
- var createKioskClient = (suiClient) => new import_kiosk.KioskClient({
34
- // @ts-ignore
35
- client: suiClient,
36
- network: import_kiosk.Network.MAINNET
5
+ import { KioskClient } from "@mysten/kiosk";
6
+ import { SuiGraphQLClient } from "@mysten/sui/graphql";
7
+ var createKioskClient = (graphqlUrl) => new KioskClient({
8
+ client: new SuiGraphQLClient({ url: graphqlUrl, network: "mainnet" }),
9
+ network: "mainnet"
37
10
  });
38
11
  var createKioskClient_default = createKioskClient;
39
12
 
40
13
  // src/apiClients/createSuiClient.ts
41
- var import_client = require("@mysten/sui/client");
42
- var createSuiClient = (url) => new import_client.SuiClient({ url });
14
+ import { SuiGrpcClient } from "@mysten/sui/grpc";
15
+ var createSuiClient = (baseUrl) => new SuiGrpcClient({ network: "mainnet", baseUrl });
43
16
  var createSuiClient_default = createSuiClient;
44
17
 
45
18
  // src/apiClients/graphqlClient.ts
@@ -57,7 +30,7 @@ function setGraphqlClient(client) {
57
30
  }
58
31
 
59
32
  // src/graphql/createChainGQLQuery.ts
60
- var import_graphql_request = require("graphql-request");
33
+ import { gql } from "graphql-request";
61
34
  function createChainGQLQuery({ chain, query }) {
62
35
  const regex = /query\s+(\w+)\s*\(([\s\S]*?)\)\s*((?:@\w+(?:\([^)]*\))?\s*)*){([\s\S]*)}/;
63
36
  const matches = regex.exec(query);
@@ -73,7 +46,7 @@ function createChainGQLQuery({ chain, query }) {
73
46
  const wrappedBody = `${chain} {
74
47
  ${body}
75
48
  }`;
76
- return import_graphql_request.gql`query ${queryName}${args}${directivesPart} {\n${wrappedBody}\n}`;
49
+ return gql`query ${queryName}${args}${directivesPart} {\n${wrappedBody}\n}`;
77
50
  }
78
51
 
79
52
  // src/graphql/gqlChainRequest.ts
@@ -89,8 +62,8 @@ var gqlChainRequest = async ({ chain, query, variables }) => {
89
62
  };
90
63
 
91
64
  // src/graphql/queries/fetchCollectionBidById.ts
92
- var import_graphql_request2 = require("graphql-request");
93
- var fetchCollectionBidsById = import_graphql_request2.gql`
65
+ import { gql as gql2 } from "graphql-request";
66
+ var fetchCollectionBidsById = gql2`
94
67
  query fetchCollectionBidsById($bidIds: [uuid!]) {
95
68
  bids(where: { id: { _in: $bidIds } }) {
96
69
  nonce
@@ -111,8 +84,8 @@ var fetchCollectionBidsById = import_graphql_request2.gql`
111
84
  `;
112
85
 
113
86
  // src/graphql/queries/fetchCollectionBidsAtSamePrice.ts
114
- var import_graphql_request3 = require("graphql-request");
115
- var fetchCollectionBidsAtSamePrice = import_graphql_request3.gql`
87
+ import { gql as gql3 } from "graphql-request";
88
+ var fetchCollectionBidsAtSamePrice = gql3`
116
89
  query fetchCollectionBidsAtSamePrice($collectionId: uuid!, $price: numeric) {
117
90
  bids(
118
91
  where: {
@@ -141,7 +114,7 @@ var fetchCollectionBidsAtSamePrice = import_graphql_request3.gql`
141
114
  `;
142
115
 
143
116
  // src/methods/acceptCollectionBid/acceptCollectionBid.ts
144
- var import_transactions2 = require("@mysten/sui/transactions");
117
+ import { Transaction as Transaction2 } from "@mysten/sui/transactions";
145
118
 
146
119
  // src/constants.ts
147
120
  var MYSTEN_TRANSFER_POLICY_RULES_PACKAGE_ID = "0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879";
@@ -1150,8 +1123,8 @@ var CUSTOM_TRANSFER_RULES_BY_COLLECTION = {
1150
1123
  };
1151
1124
 
1152
1125
  // src/graphql/queries/fetchNftsById.ts
1153
- var import_graphql_request4 = require("graphql-request");
1154
- var fetchNftById = import_graphql_request4.gql`
1126
+ import { gql as gql4 } from "graphql-request";
1127
+ var fetchNftById = gql4`
1155
1128
  query fetchNftById($nftId: uuid!) {
1156
1129
  nfts(where: { id: { _eq: $nftId } }) {
1157
1130
  id
@@ -1176,7 +1149,7 @@ var fetchNftById = import_graphql_request4.gql`
1176
1149
  }
1177
1150
  }
1178
1151
  `;
1179
- var fetchNftsById = import_graphql_request4.gql`
1152
+ var fetchNftsById = gql4`
1180
1153
  query fetchNftsById($nftIds: [uuid!]) {
1181
1154
  nfts(where: { id: { _in: $nftIds } }) {
1182
1155
  id
@@ -1196,7 +1169,7 @@ var fetchNftsById = import_graphql_request4.gql`
1196
1169
  }
1197
1170
  }
1198
1171
  `;
1199
- var fetchNftsWithListingsById = import_graphql_request4.gql`
1172
+ var fetchNftsWithListingsById = gql4`
1200
1173
  query fetchNftsWithListingsById($nftIds: [uuid!]) {
1201
1174
  nfts(where: { id: { _in: $nftIds } }) {
1202
1175
  id
@@ -1241,8 +1214,8 @@ var getNftType = ({
1241
1214
  };
1242
1215
 
1243
1216
  // src/graphql/queries/fetchSharedObjectsByType.ts
1244
- var import_graphql_request5 = require("graphql-request");
1245
- var fetchSharedObjectsByType = import_graphql_request5.gql`
1217
+ import { gql as gql5 } from "graphql-request";
1218
+ var fetchSharedObjectsByType = gql5`
1246
1219
  query fetchSharedObjectsByType($type: String!) {
1247
1220
  sharedObjects: shared_objects_by_type(type: $type) {
1248
1221
  id
@@ -1316,7 +1289,7 @@ var getSharedObjects = async (nftType) => {
1316
1289
  };
1317
1290
 
1318
1291
  // src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts
1319
- var import_utils5 = require("@mysten/sui/utils");
1292
+ import { normalizeSuiObjectId as normalizeSuiObjectId3 } from "@mysten/sui/utils";
1320
1293
 
1321
1294
  // src/utils/normalizeNftType.ts
1322
1295
  var normalizedNftType = (nftType) => {
@@ -1372,8 +1345,8 @@ var isSingleBid = (bidType) => {
1372
1345
  };
1373
1346
 
1374
1347
  // src/graphql/queries/fetchKiosksByOwner.ts
1375
- var import_graphql_request6 = require("graphql-request");
1376
- var fetchKiosksByOwner = import_graphql_request6.gql`
1348
+ import { gql as gql6 } from "graphql-request";
1349
+ var fetchKiosksByOwner = gql6`
1377
1350
  query fetchKiosksByOwner($ownerAddress: String!) {
1378
1351
  kiosks: kiosks_by_owner_address(owner_address: $ownerAddress) {
1379
1352
  id
@@ -1409,7 +1382,7 @@ var assertNftInSharedKiosk = async ({
1409
1382
  };
1410
1383
 
1411
1384
  // src/helpers/kiosk/getRulePackageId.ts
1412
- var import_kiosk2 = require("@mysten/kiosk");
1385
+ import { getNormalizedRuleType } from "@mysten/kiosk";
1413
1386
 
1414
1387
  // src/utils/addHexPrefix.ts
1415
1388
  function addHexPrefix(input) {
@@ -1420,34 +1393,27 @@ function addHexPrefix(input) {
1420
1393
  }
1421
1394
 
1422
1395
  // src/helpers/getTransferPolicyRuleNamesFromSuiObject.ts
1423
- var import_utils = require("@mysten/sui/utils");
1396
+ import { normalizeStructTag, normalizeSuiObjectId } from "@mysten/sui/utils";
1424
1397
  var getTransferPolicyRuleNamesFromSuiObject = async ({
1425
1398
  suiClient,
1426
1399
  transferPolicyId
1427
1400
  }) => {
1428
- const { data, error } = await suiClient.getObject({
1429
- id: (0, import_utils.normalizeSuiObjectId)(transferPolicyId),
1430
- options: {
1431
- showContent: true
1432
- }
1401
+ const { object } = await suiClient.getObject({
1402
+ objectId: normalizeSuiObjectId(transferPolicyId),
1403
+ include: { json: true }
1433
1404
  });
1434
- if (error) {
1435
- throw new Error(`Error on getting SUI object ${transferPolicyId}: ${error.code}`);
1436
- }
1437
- const content = data.content;
1438
- const ruleNames = content.fields.rules.fields.contents.map(
1439
- (rule) => (0, import_utils.normalizeStructTag)(rule.fields.name)
1440
- );
1405
+ const content = object.json;
1406
+ const ruleNames = content.rules.contents.map((rule) => normalizeStructTag(rule));
1441
1407
  return ruleNames;
1442
1408
  };
1443
1409
 
1444
1410
  // src/helpers/kiosk/upgradeKioskRulesPackageId.ts
1445
- var import_utils2 = require("@mysten/sui/utils");
1446
- var KIOSK_RULES_ORIGINAL_PACKAGE_ID = (0, import_utils2.normalizeSuiAddress)(
1411
+ import { normalizeSuiAddress } from "@mysten/sui/utils";
1412
+ var KIOSK_RULES_ORIGINAL_PACKAGE_ID = normalizeSuiAddress(
1447
1413
  "0x434b5bd8f6a7b05fede0ff46c6e511d71ea326ed38056e3bcd681d2d7c2a7879"
1448
1414
  );
1449
1415
  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;
1416
+ var upgradeKioskRulesPackageId = (packageId) => normalizeSuiAddress(packageId) === KIOSK_RULES_ORIGINAL_PACKAGE_ID ? KIOSK_RULES_UPGRADED_PACKAGE_ID : packageId;
1451
1417
 
1452
1418
  // src/helpers/kiosk/getRulePackageId.ts
1453
1419
  var getRulePackageId = async ({
@@ -1476,7 +1442,7 @@ var getRulePackageId = async ({
1476
1442
  }
1477
1443
  }
1478
1444
  const ruleDefinition = kioskClient.rules.find(
1479
- (x) => (0, import_kiosk2.getNormalizedRuleType)(x.rule) === (0, import_kiosk2.getNormalizedRuleType)(rule)
1445
+ (x) => getNormalizedRuleType(x.rule) === getNormalizedRuleType(rule)
1480
1446
  );
1481
1447
  let rulePackageId = ruleDefinition?.packageId;
1482
1448
  if (!rulePackageId) {
@@ -1492,11 +1458,11 @@ var isBluemoveKioskBid = (bidNonce) => bidNonce?.startsWith("10000");
1492
1458
  var isTradePortKioskBid = (bidType) => bidType === TRADEPORT_KIOSK_BID_NONCE_TYPE;
1493
1459
 
1494
1460
  // src/helpers/kiosk/kioskTxWrapper.ts
1495
- var import_kiosk3 = require("@mysten/kiosk");
1461
+ import { KioskTransaction } from "@mysten/kiosk";
1496
1462
 
1497
1463
  // src/graphql/queries/fetchOwnerCapByKiosk.ts
1498
- var import_graphql_request7 = require("graphql-request");
1499
- var fetchOwnerCapByKiosk = import_graphql_request7.gql`
1464
+ import { gql as gql7 } from "graphql-request";
1465
+ var fetchOwnerCapByKiosk = gql7`
1500
1466
  query fetchOwnerCapByKiosk($kioskId: String!) {
1501
1467
  ownerCap: kiosk_owner_cap_by_kiosk(kiosk_id: $kioskId) {
1502
1468
  id
@@ -1506,8 +1472,8 @@ var fetchOwnerCapByKiosk = import_graphql_request7.gql`
1506
1472
  `;
1507
1473
 
1508
1474
  // src/graphql/queries/fetchPersonalCapByKiosk.ts
1509
- var import_graphql_request8 = require("graphql-request");
1510
- var fetchPersonalCapByKiosk = import_graphql_request8.gql`
1475
+ import { gql as gql8 } from "graphql-request";
1476
+ var fetchPersonalCapByKiosk = gql8`
1511
1477
  query fetchPersonalCapByKiosk($kioskId: String!) {
1512
1478
  personalCap: personal_kiosk_cap_by_kiosk(kiosk_id: $kioskId) {
1513
1479
  id
@@ -1576,8 +1542,8 @@ var kioskTxWrapper = async ({
1576
1542
  query: fetchPersonalCapByKiosk,
1577
1543
  variables: { kioskId: personalKiosk.id }
1578
1544
  })).personalCap.id;
1579
- kioskTx = new import_kiosk3.KioskTransaction({
1580
- transactionBlock: tx,
1545
+ kioskTx = new KioskTransaction({
1546
+ transaction: tx,
1581
1547
  kioskClient,
1582
1548
  cap: {
1583
1549
  isPersonal: true,
@@ -1593,8 +1559,8 @@ var kioskTxWrapper = async ({
1593
1559
  query: fetchOwnerCapByKiosk,
1594
1560
  variables: { kioskId: kiosks[0].id }
1595
1561
  })).ownerCap?.id;
1596
- kioskTx = new import_kiosk3.KioskTransaction({
1597
- transactionBlock: tx,
1562
+ kioskTx = new KioskTransaction({
1563
+ transaction: tx,
1598
1564
  kioskClient,
1599
1565
  cap: {
1600
1566
  isPersonal: false,
@@ -1605,7 +1571,7 @@ var kioskTxWrapper = async ({
1605
1571
  }
1606
1572
  });
1607
1573
  } else {
1608
- kioskTx = new import_kiosk3.KioskTransaction({ transactionBlock: tx, kioskClient });
1574
+ kioskTx = new KioskTransaction({ transaction: tx, kioskClient });
1609
1575
  kioskTx.createPersonal(true);
1610
1576
  }
1611
1577
  if (shouldUseSharedKioskTx && sharedKioskState) {
@@ -1622,14 +1588,20 @@ var getKioskIdFromKioskTx = ({
1622
1588
  kioskTx,
1623
1589
  tx
1624
1590
  }) => {
1625
- const kioskId = "value" in kioskTx.kiosk ? kioskTx.kiosk.value : "Input" in kioskTx.kiosk ? tx.blockData.inputs[kioskTx.kiosk.Input].value : (() => {
1591
+ const kioskArg = kioskTx.kiosk;
1592
+ if (!kioskArg || !("Input" in kioskArg)) {
1626
1593
  throw new Error("Invalid kiosk transaction structure");
1627
- })();
1594
+ }
1595
+ const input = tx.getData().inputs[kioskArg.Input];
1596
+ const kioskId = input?.UnresolvedObject?.objectId ?? input?.Object?.ImmOrOwnedObject?.objectId ?? input?.Object?.SharedObject?.objectId ?? input?.Object?.Receiving?.objectId;
1597
+ if (!kioskId) {
1598
+ throw new Error("Invalid kiosk transaction structure");
1599
+ }
1628
1600
  return kioskId;
1629
1601
  };
1630
1602
 
1631
1603
  // src/helpers/kiosk/getTransferPoliciesToResolve.ts
1632
- var import_kiosk4 = require("@mysten/kiosk");
1604
+ import { getNormalizedRuleType as getNormalizedRuleType2 } from "@mysten/kiosk";
1633
1605
  var originByteRuleModules = ["royalty_strategy_bps", "transfer_allowlist"];
1634
1606
  var getTransferPoliciesToResolve = async ({
1635
1607
  transferPolicies,
@@ -1713,7 +1685,7 @@ var getTransferPoliciesToResolve = async ({
1713
1685
  ...policy,
1714
1686
  rules: [kioskLockRule, personalKioskRule, ...otherRules].filter(Boolean)?.map((ruleData) => {
1715
1687
  const ruleDefinition = kioskClient.rules.find(
1716
- (x) => (0, import_kiosk4.getNormalizedRuleType)(x.rule) === (0, import_kiosk4.getNormalizedRuleType)(ruleData.rule)
1688
+ (x) => getNormalizedRuleType2(x.rule) === getNormalizedRuleType2(ruleData.rule)
1717
1689
  );
1718
1690
  let rulePackageId = ruleDefinition?.packageId;
1719
1691
  if (!rulePackageId) {
@@ -1784,8 +1756,10 @@ function resolvePersonalKioskRule({ tx, packageId, nftType, kiosk, transferReque
1784
1756
  }
1785
1757
 
1786
1758
  // src/helpers/kiosk/getKioskCollectionRoyaltyFeeAmount.ts
1787
- var import_bcs = require("@mysten/sui/bcs");
1788
- var import_transactions = require("@mysten/sui/transactions");
1759
+ import { bcs } from "@mysten/sui/bcs";
1760
+ import {
1761
+ Transaction
1762
+ } from "@mysten/sui/transactions";
1789
1763
  async function getKioskCollectionRoyaltyFeeAmount({
1790
1764
  tx,
1791
1765
  suiClient,
@@ -1804,22 +1778,22 @@ async function getKioskCollectionRoyaltyFeeAmount({
1804
1778
  console.warn("Price is undefined or 0");
1805
1779
  return void 0;
1806
1780
  }
1807
- const feeTx = new import_transactions.Transaction();
1781
+ const feeTx = new Transaction();
1808
1782
  feeTx.moveCall({
1809
1783
  target: `${royaltyRulePackageId}::${royaltyRuleModule}::fee_amount`,
1810
1784
  arguments: [feeTx.object(transferPolicyId), feeTx.pure.u64(price)],
1811
1785
  typeArguments: [nftType]
1812
1786
  });
1813
- const res = await suiClient.devInspectTransactionBlock({
1814
- sender: addLeadingZerosAfter0x(walletAddress),
1815
- transactionBlock: feeTx
1787
+ feeTx.setSender(addLeadingZerosAfter0x(walletAddress));
1788
+ const res = await suiClient.simulateTransaction({
1789
+ transaction: feeTx,
1790
+ include: { commandResults: true },
1791
+ checksEnabled: false
1816
1792
  });
1817
1793
  let feeAmount;
1818
- if (res?.results?.[0]?.returnValues?.[0]?.[0]) {
1819
- const returnedAmount = res?.results?.[0]?.returnValues?.[0]?.[0];
1820
- if (returnedAmount) {
1821
- feeAmount = BigInt(import_bcs.bcs.U64.parse(new Uint8Array(returnedAmount)));
1822
- }
1794
+ const returnedAmount = res?.commandResults?.[0]?.returnValues?.[0]?.bcs;
1795
+ if (returnedAmount) {
1796
+ feeAmount = BigInt(bcs.U64.parse(returnedAmount));
1823
1797
  }
1824
1798
  if (!feeAmount && feeAmount !== 0n) {
1825
1799
  [feeAmount] = tx.moveCall({
@@ -2058,8 +2032,8 @@ var takeLockedNftFromKiosk = async ({
2058
2032
  const [purchase_cap] = tx.moveCall({
2059
2033
  target: "0x2::kiosk::list_with_purchase_cap",
2060
2034
  arguments: [
2061
- tx.object("value" in kioskTx.kiosk ? kioskTx.kiosk.value : kioskTx.kiosk),
2062
- tx.object("value" in kioskTx.kioskCap ? kioskTx.kioskCap.value : kioskTx.kioskCap),
2035
+ tx.object(kioskTx.kiosk),
2036
+ tx.object(kioskTx.kioskCap),
2063
2037
  tx.pure.address(nftTokenId),
2064
2038
  tx.pure.u64(0)
2065
2039
  ],
@@ -2072,11 +2046,7 @@ var takeLockedNftFromKiosk = async ({
2072
2046
  });
2073
2047
  const [nft, transferRequest] = tx.moveCall({
2074
2048
  target: "0x2::kiosk::purchase_with_cap",
2075
- arguments: [
2076
- tx.object("value" in kioskTx.kiosk ? kioskTx.kiosk.value : kioskTx.kiosk),
2077
- purchase_cap,
2078
- zeroCoin
2079
- ],
2049
+ arguments: [tx.object(kioskTx.kiosk), purchase_cap, zeroCoin],
2080
2050
  typeArguments: [nftType]
2081
2051
  });
2082
2052
  await resolveTransferPolicies({
@@ -2170,8 +2140,8 @@ var createOBKiosk = async ({ tx, createMethod = "new" }) => {
2170
2140
  };
2171
2141
 
2172
2142
  // src/graphql/queries/fetchWalletKiosks.ts
2173
- var import_graphql_request9 = require("graphql-request");
2174
- var fetchWalletKiosks = import_graphql_request9.gql`
2143
+ import { gql as gql9 } from "graphql-request";
2144
+ var fetchWalletKiosks = gql9`
2175
2145
  query fetchWalletKiosks($wallet: String!) {
2176
2146
  kiosks: kiosks_by_owner_address(owner_address: $wallet) {
2177
2147
  id
@@ -2250,25 +2220,29 @@ var shareOriginByteKiosk = ({ tx, kiosk }) => {
2250
2220
  };
2251
2221
 
2252
2222
  // src/helpers/rpc/getObjectType.ts
2253
- var import_utils3 = require("@mysten/sui/utils");
2223
+ import { isValidSuiObjectId } from "@mysten/sui/utils";
2254
2224
  var getObjectType = async ({
2255
2225
  suiClient,
2256
2226
  objectId
2257
2227
  }) => {
2258
2228
  const normalizedObjectId = objectId.startsWith("0x") ? addLeadingZerosAfter0x(objectId) : objectId;
2259
- if ((0, import_utils3.isValidSuiObjectId)(normalizedObjectId)) {
2260
- const res = await suiClient.getObject({ id: normalizedObjectId, options: { showType: true } });
2261
- return res.data.type;
2229
+ if (isValidSuiObjectId(normalizedObjectId)) {
2230
+ try {
2231
+ const res = await suiClient.getObject({ objectId: normalizedObjectId, include: {} });
2232
+ return res.object?.type ?? "";
2233
+ } catch {
2234
+ return "";
2235
+ }
2262
2236
  }
2263
2237
  return "";
2264
2238
  };
2265
2239
 
2266
2240
  // src/methods/acceptNftBids/addAcceptNftBidTxs.ts
2267
- var import_utils4 = require("@mysten/sui/utils");
2241
+ import { normalizeSuiObjectId as normalizeSuiObjectId2, SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
2268
2242
 
2269
2243
  // src/graphql/queries/fetchMultibidById.ts
2270
- var import_graphql_request10 = require("graphql-request");
2271
- var fetchMultibidChainIdById = import_graphql_request10.gql`
2244
+ import { gql as gql10 } from "graphql-request";
2245
+ var fetchMultibidChainIdById = gql10`
2272
2246
  query fetchMultibidById($multiBidId: uuid!) {
2273
2247
  multi_bids(where: { id: { _eq: $multiBidId } }) {
2274
2248
  chain_id
@@ -2276,7 +2250,7 @@ var fetchMultibidChainIdById = import_graphql_request10.gql`
2276
2250
  }
2277
2251
  }
2278
2252
  `;
2279
- var fetchMultibidChainIdAndSingleBidsById = import_graphql_request10.gql`
2253
+ var fetchMultibidChainIdAndSingleBidsById = gql10`
2280
2254
  query fetchMultibidChainIdAndSingleBidsById($multiBidId: uuid!) {
2281
2255
  multi_bids(where: { id: { _eq: $multiBidId } }) {
2282
2256
  chain_id
@@ -2287,7 +2261,7 @@ var fetchMultibidChainIdAndSingleBidsById = import_graphql_request10.gql`
2287
2261
  }
2288
2262
  }
2289
2263
  `;
2290
- var fetchMultibidChainIdAndExpiredSingleBidsById = import_graphql_request10.gql`
2264
+ var fetchMultibidChainIdAndExpiredSingleBidsById = gql10`
2291
2265
  query fetchMultibidChainIdAndExpiredSingleBidsById($multiBidId: uuid!, $expiredBidLimit: Int!) {
2292
2266
  multi_bids(where: { id: { _eq: $multiBidId } }) {
2293
2267
  chain_id
@@ -2316,11 +2290,11 @@ var lockNftInsideKioskIfNotLocked = async ({
2316
2290
  const nftInKiosk = res.items.find((i) => i.objectId === nftTokenId);
2317
2291
  let takeFromKiosk = true;
2318
2292
  if (!nftInKiosk) {
2319
- const result = await kioskClient.client.getObject({
2320
- id: nftTokenId,
2321
- options: { showOwner: true }
2293
+ const { object } = await kioskClient.client.getObject({
2294
+ objectId: nftTokenId,
2295
+ include: {}
2322
2296
  });
2323
- if (result.data.owner.AddressOwner) {
2297
+ if (object?.owner?.$kind === "AddressOwner") {
2324
2298
  takeFromKiosk = false;
2325
2299
  } else {
2326
2300
  throw new Error(`NFT ${nftTokenId} is not found in kiosk ${kioskId}`);
@@ -2333,10 +2307,10 @@ var lockNftInsideKioskIfNotLocked = async ({
2333
2307
  itemId: nftTokenId,
2334
2308
  itemType: nftType
2335
2309
  });
2336
- takenNftId = "value" in takenNft ? takenNft.value : takenNft;
2310
+ takenNftId = takenNft.value ?? takenNft;
2337
2311
  }
2338
2312
  kioskTx.lock({
2339
- itemId: takenNftId ?? nftTokenId,
2313
+ item: takenNftId ?? nftTokenId,
2340
2314
  itemType: nftType,
2341
2315
  policy: transferPolicyId
2342
2316
  });
@@ -2350,10 +2324,10 @@ function lockNftInsideKioskIfKioskCreatedInThisTx({
2350
2324
  transferPolicyId
2351
2325
  }) {
2352
2326
  if (Array.isArray(kioskTx.kiosk.NestedResult)) {
2353
- const transaction = tx.blockData.transactions[kioskTx.kiosk.NestedResult[0]];
2327
+ const transaction = tx.getData().commands[kioskTx.kiosk.NestedResult[0]];
2354
2328
  if (transaction.target === "0x0000000000000000000000000000000000000000000000000000000000000002::kiosk::new" || transaction.target === "0x0000000000000000000000000000000000000000000000000000000000000002::personal_kiosk::new") {
2355
2329
  kioskTx.lock({
2356
- itemId: nftTokenId,
2330
+ item: nftTokenId,
2357
2331
  itemType: nftType,
2358
2332
  policy: transferPolicyId
2359
2333
  });
@@ -2369,11 +2343,8 @@ var getOBBidderKiosk = async ({
2369
2343
  suiClient,
2370
2344
  bidNonce
2371
2345
  }) => {
2372
- const bidObject = await suiClient.call("sui_getObject", [
2373
- bidNonce,
2374
- { showContent: true }
2375
- ]);
2376
- return bidObject.data?.content?.fields?.kiosk;
2346
+ const bidObject = await suiClient.getObject({ objectId: bidNonce, include: { json: true } });
2347
+ return bidObject.object?.json?.kiosk;
2377
2348
  };
2378
2349
 
2379
2350
  // src/methods/acceptNftBids/addAcceptNftBidTxs.ts
@@ -2440,8 +2411,8 @@ async function addTradeportKioskAcceptNftBidTx({
2440
2411
  arguments: [
2441
2412
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
2442
2413
  tx.pure.address(bidNonce),
2443
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
2444
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
2414
+ tx.object(kioskTx.kiosk),
2415
+ tx.object(kioskTx.kioskCap),
2445
2416
  tx.pure.address(nftTokenId)
2446
2417
  ],
2447
2418
  typeArguments: [nftType]
@@ -2467,8 +2438,8 @@ async function addTradeportKioskAcceptNftBidTx({
2467
2438
  arguments: [
2468
2439
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
2469
2440
  tx.pure.address(bidNonce),
2470
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
2471
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
2441
+ tx.object(kioskTx.kiosk),
2442
+ tx.object(kioskTx.kioskCap),
2472
2443
  tx.pure.address(nftTokenId)
2473
2444
  ],
2474
2445
  typeArguments: [nftType]
@@ -2609,9 +2580,9 @@ async function addSingleBidAcceptNftBidTx(txData) {
2609
2580
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::accept_bid_with_transfer_policy`,
2610
2581
  typeArguments: [nftType],
2611
2582
  arguments: [
2612
- tx.object(import_utils4.SUI_CLOCK_OBJECT_ID),
2583
+ tx.object(SUI_CLOCK_OBJECT_ID),
2613
2584
  tx.object(TRADEPORT_MULTI_BID_STORE),
2614
- tx.pure.id((0, import_utils4.normalizeSuiObjectId)(bidNonce)),
2585
+ tx.pure.id(normalizeSuiObjectId2(bidNonce)),
2615
2586
  tx.pure.option("id", multiBidChainId),
2616
2587
  tx.object(kioskTx.getKiosk()),
2617
2588
  tx.object(kioskTx.getKioskCap()),
@@ -2648,7 +2619,7 @@ async function addSingleBidAcceptNftBidTx(txData) {
2648
2619
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::accept_bid_without_transfer_policy`,
2649
2620
  typeArguments: [nftType],
2650
2621
  arguments: [
2651
- tx.object(import_utils4.SUI_CLOCK_OBJECT_ID),
2622
+ tx.object(SUI_CLOCK_OBJECT_ID),
2652
2623
  tx.object(TRADEPORT_MULTI_BID_STORE),
2653
2624
  tx.pure.id(bidNonce),
2654
2625
  tx.pure.option("id", multiBidChainId),
@@ -2659,7 +2630,7 @@ async function addSingleBidAcceptNftBidTx(txData) {
2659
2630
  async function addTradePortAcceptNftBidTxHandler(txData) {
2660
2631
  const bidType = await getObjectType({
2661
2632
  suiClient: txData?.suiClient,
2662
- objectId: (0, import_utils4.normalizeSuiObjectId)(txData?.bidNonce)
2633
+ objectId: normalizeSuiObjectId2(txData?.bidNonce)
2663
2634
  });
2664
2635
  if (isSingleBid(bidType)) {
2665
2636
  await addSingleBidAcceptNftBidTx(txData);
@@ -2745,8 +2716,8 @@ async function addLegacyTradePortKioskUnlistTx({
2745
2716
  target: "0x475e98e9c436ec118909f3b9e241d86bcbbc2cf9fba05e99a934823fefb375b7::kiosk_listings::unlist",
2746
2717
  arguments: [
2747
2718
  tx.object(TRADEPORT_KIOSK_LISTING_STORE),
2748
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
2749
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
2719
+ tx.object(kioskTx.kiosk),
2720
+ tx.object(kioskTx.kioskCap),
2750
2721
  tx.pure.address(nftTokenId)
2751
2722
  ],
2752
2723
  typeArguments: [nftType]
@@ -2774,8 +2745,8 @@ async function addKioskTradePortUnlistTx({
2774
2745
  arguments: [
2775
2746
  tx.object(TRADEPORT_LISTINGS_STORE),
2776
2747
  tx.object(TRADEPORT_ORDERBOOK_STORE),
2777
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
2778
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
2748
+ tx.object(kioskTx.kiosk),
2749
+ tx.object(kioskTx.kioskCap),
2779
2750
  tx.pure.id(nftTokenId)
2780
2751
  ],
2781
2752
  typeArguments: [nftType]
@@ -2825,7 +2796,7 @@ async function addBluemoveKioskUnlistTx({
2825
2796
  target: "0xcc97b74ed95c8e8a3ed88050a898727dee37896da579fc400d482b64db6149ff::kiosk_trade::kiosk_delist",
2826
2797
  arguments: [
2827
2798
  tx.object(BLUEMOVE_KIOSK_MARKETPLACE_KIOSK_OBJECT),
2828
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
2799
+ tx.object(kioskTx.kiosk),
2829
2800
  tx.pure.address(nftTokenId)
2830
2801
  ],
2831
2802
  typeArguments: [nftType]
@@ -2850,11 +2821,7 @@ async function addHyperspaceKioskUnlistTx({
2850
2821
  }) {
2851
2822
  tx.moveCall({
2852
2823
  target: "0x6ea97b03c441edd54ae89224bf9560e583ee66c37e6c246f5db35258e580ba94::hyperspace::delist",
2853
- arguments: [
2854
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
2855
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
2856
- tx.pure.address(nftTokenId)
2857
- ],
2824
+ arguments: [tx.object(kioskTx.kiosk), tx.object(kioskTx.kioskCap), tx.pure.address(nftTokenId)],
2858
2825
  typeArguments: [nftType, HYPERSPACE_MP_TRANSFER_POLICY_TYPE]
2859
2826
  });
2860
2827
  }
@@ -3177,8 +3144,8 @@ async function addBluemoveKioskAcceptCollectionBidTx({
3177
3144
  tx.object(BLUEMOVE_KIOSK_OFFER_COLLECTION_DATA_OBJECT),
3178
3145
  tx.object(BLUEMOVE_KIOSK_OFFER_COLLECTION_BIDDER_BAG),
3179
3146
  tx.pure.u64(bidNonce),
3180
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
3181
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
3147
+ tx.object(kioskTx.kiosk),
3148
+ tx.object(kioskTx.kioskCap),
3182
3149
  tx.pure.address(nftTokenId)
3183
3150
  ],
3184
3151
  typeArguments: [nftType]
@@ -3205,7 +3172,7 @@ function addTocenAcceptCollectionBidTx({
3205
3172
  async function addTradePortAcceptCollectionBidTxHandler(txData) {
3206
3173
  const bidType = await getObjectType({
3207
3174
  suiClient: txData?.suiClient,
3208
- objectId: (0, import_utils5.normalizeSuiObjectId)(txData?.bidNonce)
3175
+ objectId: normalizeSuiObjectId3(txData?.bidNonce)
3209
3176
  });
3210
3177
  if (isSingleBid(bidType)) {
3211
3178
  await addSingleBidAcceptNftBidTx(txData);
@@ -3369,7 +3336,7 @@ var acceptCollectionBid = async ({
3369
3336
  throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
3370
3337
  }
3371
3338
  const bidsForTracking = [];
3372
- const tx = existingTx ?? new import_transactions2.Transaction();
3339
+ const tx = existingTx ?? new Transaction2();
3373
3340
  const sharedKioskState = {
3374
3341
  kioskTx: kioskTx ?? void 0
3375
3342
  };
@@ -3439,15 +3406,15 @@ var acceptCollectionBid = async ({
3439
3406
  bidder: bid?.bidder
3440
3407
  });
3441
3408
  sharedKioskState?.kioskTx?.finalize();
3442
- return import_transactions2.Transaction.from(tx);
3409
+ return Transaction2.from(tx);
3443
3410
  };
3444
3411
 
3445
3412
  // src/methods/acceptNftBids/acceptNftBids.ts
3446
- var import_transactions3 = require("@mysten/sui/transactions");
3413
+ import { Transaction as Transaction3 } from "@mysten/sui/transactions";
3447
3414
 
3448
3415
  // src/graphql/queries/fetchBidsById.ts
3449
- var import_graphql_request11 = require("graphql-request");
3450
- var fetchBidsById = import_graphql_request11.gql`
3416
+ import { gql as gql11 } from "graphql-request";
3417
+ var fetchBidsById = gql11`
3451
3418
  query fetchBidsById($bidIds: [uuid!]) {
3452
3419
  bids(where: { id: { _in: $bidIds } }) {
3453
3420
  nonce
@@ -3500,7 +3467,7 @@ var acceptNftBids = async ({
3500
3467
  throw new Error("No bids found");
3501
3468
  }
3502
3469
  const bidsForTracking = [];
3503
- const tx = existingTx ?? new import_transactions3.Transaction();
3470
+ const tx = existingTx ?? new Transaction3();
3504
3471
  const sharedKioskState = {
3505
3472
  kioskTx: kioskTx ?? void 0
3506
3473
  };
@@ -3573,22 +3540,22 @@ var acceptNftBids = async ({
3573
3540
  });
3574
3541
  }
3575
3542
  sharedKioskState?.kioskTx?.finalize();
3576
- return import_transactions3.Transaction.from(tx);
3543
+ return Transaction3.from(tx);
3577
3544
  };
3578
3545
 
3579
3546
  // src/methods/applyFtStrategy/applyFtStrategy.ts
3580
- var import_transactions4 = require("@mysten/sui/transactions");
3547
+ import { Transaction as Transaction4 } from "@mysten/sui/transactions";
3581
3548
 
3582
3549
  // src/graphql/queries/fetchCollectionChainState.ts
3583
- var import_graphql_request12 = require("graphql-request");
3584
- var fetchCollectionChainState = import_graphql_request12.gql`
3550
+ import { gql as gql12 } from "graphql-request";
3551
+ var fetchCollectionChainState = gql12`
3585
3552
  query fetchCollectionChainState($collectionId: uuid!) @cached(ttl: 10) {
3586
3553
  collections(where: { id: { _eq: $collectionId } }) {
3587
3554
  chain_state
3588
3555
  }
3589
3556
  }
3590
3557
  `;
3591
- var fetchCollectionChainStateByFtType = import_graphql_request12.gql`
3558
+ var fetchCollectionChainStateByFtType = gql12`
3592
3559
  query fetchCollectionChainStateByFtType($ftType: String!) @cached(ttl: 10) {
3593
3560
  collections_by_ft_type(args: { coin_type: $ftType }, limit: 1) {
3594
3561
  chain_state
@@ -3613,7 +3580,7 @@ async function applyFtStrategy({
3613
3580
  tx: existingTx,
3614
3581
  collectionChainState
3615
3582
  }) {
3616
- const tx = existingTx ?? new import_transactions4.Transaction();
3583
+ const tx = existingTx ?? new Transaction4();
3617
3584
  const chainState = collectionChainState ?? await getCollectionChainState(collectionId);
3618
3585
  const nftStrategies = chainState?.nft_strategies ?? {};
3619
3586
  const nftStrategyKeys = Object.keys(nftStrategies);
@@ -3640,11 +3607,11 @@ async function applyFtStrategy({
3640
3607
  }
3641
3608
 
3642
3609
  // src/methods/applyNftStrategy/applyNftStrategy.ts
3643
- var import_transactions5 = require("@mysten/sui/transactions");
3610
+ import { Transaction as Transaction5 } from "@mysten/sui/transactions";
3644
3611
 
3645
3612
  // src/graphql/queries/fetchCollectionFloorListingForMarket.ts
3646
- var import_graphql_request13 = require("graphql-request");
3647
- var fetchCollectionFloorListingsForMarket = import_graphql_request13.gql`
3613
+ import { gql as gql13 } from "graphql-request";
3614
+ var fetchCollectionFloorListingsForMarket = gql13`
3648
3615
  query fetchCollectionFloorListingsForMarket(
3649
3616
  $collectionId: uuid!
3650
3617
  $marketAddress: String!
@@ -3677,7 +3644,7 @@ async function applyTradeportNftStrategy({
3677
3644
  strategyFtType,
3678
3645
  tx: existingTx
3679
3646
  }) {
3680
- const tx = existingTx ?? new import_transactions5.Transaction();
3647
+ const tx = existingTx ?? new Transaction5();
3681
3648
  const chainState = await getCollectionChainState(collectionId);
3682
3649
  const nftStrategies = chainState?.nft_strategies ?? {};
3683
3650
  const nftStrategyKeys = Object.keys(nftStrategies);
@@ -3733,11 +3700,11 @@ async function applyTradeportNftStrategy({
3733
3700
  }
3734
3701
 
3735
3702
  // src/methods/buyListings/buyListings.ts
3736
- var import_transactions7 = require("@mysten/sui/transactions");
3703
+ import { Transaction as Transaction7 } from "@mysten/sui/transactions";
3737
3704
 
3738
3705
  // src/graphql/queries/fetchListingsById.ts
3739
- var import_graphql_request14 = require("graphql-request");
3740
- var fetchListingsById = import_graphql_request14.gql`
3706
+ import { gql as gql14 } from "graphql-request";
3707
+ var fetchListingsById = gql14`
3741
3708
  query fetchListingsById($listingIds: [uuid!]) {
3742
3709
  listings(where: { id: { _in: $listingIds } }) {
3743
3710
  id
@@ -3777,8 +3744,29 @@ var addThirdPartyTxFee = async (tx, price) => {
3777
3744
  };
3778
3745
 
3779
3746
  // src/helpers/kiosk/preProcessSharedBulkBuyingData.ts
3780
- var import_bcs2 = require("@mysten/sui/bcs");
3781
- var import_transactions6 = require("@mysten/sui/transactions");
3747
+ import { bcs as bcs3 } from "@mysten/sui/bcs";
3748
+ import { Transaction as Transaction6 } from "@mysten/sui/transactions";
3749
+
3750
+ // src/helpers/kiosk/kioskListingBcs.ts
3751
+ import { bcs as bcs2 } from "@mysten/sui/bcs";
3752
+ var PurchaseCap = bcs2.struct("PurchaseCap", {
3753
+ id: bcs2.Address,
3754
+ kiosk_id: bcs2.Address,
3755
+ item_id: bcs2.Address,
3756
+ min_price: bcs2.u64()
3757
+ });
3758
+ var KioskListing = bcs2.struct("KioskListing", {
3759
+ id: bcs2.Address,
3760
+ seller: bcs2.Address,
3761
+ kiosk_id: bcs2.Address,
3762
+ nft_id: bcs2.Address,
3763
+ cap: PurchaseCap,
3764
+ price: bcs2.u64(),
3765
+ commission: bcs2.u64(),
3766
+ beneficiary: bcs2.Address
3767
+ });
3768
+
3769
+ // src/helpers/kiosk/preProcessSharedBulkBuyingData.ts
3782
3770
  var preProcessSharedBulkBuyingData = async ({
3783
3771
  listings,
3784
3772
  suiClient,
@@ -3828,7 +3816,7 @@ var preProcessSharedBulkBuyingData = async ({
3828
3816
  (rule) => rule.moduleName === "royalty_rule" || rule.moduleName === "kiosk_royalty_rule"
3829
3817
  );
3830
3818
  if (royaltyRuleToResolve?.rulePackageId && royaltyRuleToResolve?.moduleName) {
3831
- const feeTx = new import_transactions6.Transaction();
3819
+ const feeTx = new Transaction6();
3832
3820
  for (const listing of tradeportLegacyKioskListings) {
3833
3821
  feeTx.moveCall({
3834
3822
  target: `${royaltyRuleToResolve.rulePackageId}::${royaltyRuleToResolve.moduleName}::fee_amount`,
@@ -3836,14 +3824,20 @@ var preProcessSharedBulkBuyingData = async ({
3836
3824
  typeArguments: [nftType]
3837
3825
  });
3838
3826
  }
3839
- const res = await suiClient.devInspectTransactionBlock({
3840
- sender: addLeadingZerosAfter0x(walletAddress),
3841
- transactionBlock: feeTx
3827
+ feeTx.setSender(addLeadingZerosAfter0x(walletAddress));
3828
+ const res = await suiClient.simulateTransaction({
3829
+ transaction: feeTx,
3830
+ include: { commandResults: true },
3831
+ checksEnabled: false
3842
3832
  });
3843
- for (let i = 0; i < res.results.length; i++) {
3844
- const result = res.results[i];
3845
- const returnedAmount = result?.returnValues?.[0]?.[0];
3846
- const feeAmount = BigInt(import_bcs2.bcs.U64.parse(new Uint8Array(returnedAmount)));
3833
+ const commandResults = res.commandResults ?? [];
3834
+ for (let i = 0; i < commandResults.length; i++) {
3835
+ const result = commandResults[i];
3836
+ const returnedAmount = result?.returnValues?.[0]?.bcs;
3837
+ if (!returnedAmount) {
3838
+ continue;
3839
+ }
3840
+ const feeAmount = BigInt(bcs3.U64.parse(returnedAmount));
3847
3841
  if (!feeAmount && feeAmount !== 0n) {
3848
3842
  continue;
3849
3843
  }
@@ -3855,17 +3849,22 @@ var preProcessSharedBulkBuyingData = async ({
3855
3849
  for (let i = 0; i < tradeportLegacyKioskListings.length; i += batchSize) {
3856
3850
  const batch = tradeportLegacyKioskListings.slice(i, i + batchSize);
3857
3851
  const batchPromises = batch.map(async (listing) => {
3858
- const response = await suiClient.getDynamicFieldObject({
3859
- parentId: TRADEPORT_KIOSK_LISTING_STORE,
3860
- name: { type: "0x2::object::ID", value: listing.nft.token_id }
3861
- });
3862
- if (response.error?.code === "dynamicFieldNotFound") {
3852
+ try {
3853
+ const { object } = await suiClient.core.getDynamicObjectField({
3854
+ parentId: TRADEPORT_KIOSK_LISTING_STORE,
3855
+ name: {
3856
+ type: "0x2::object::ID",
3857
+ bcs: bcs3.Address.serialize(listing.nft.token_id).toBytes()
3858
+ },
3859
+ include: { content: true }
3860
+ });
3861
+ return {
3862
+ listingId: listing.id,
3863
+ commission: Number(KioskListing.parse(object.content).commission)
3864
+ };
3865
+ } catch {
3863
3866
  throw new Error(`Not found kiosk listing object of token ${listing.nft.token_id}`);
3864
3867
  }
3865
- return {
3866
- listingId: listing.id,
3867
- commission: Number(response.data.content.fields.commission)
3868
- };
3869
3868
  });
3870
3869
  const batchResults = await Promise.all(batchPromises);
3871
3870
  commissionResults.push(...batchResults);
@@ -3878,11 +3877,11 @@ var preProcessSharedBulkBuyingData = async ({
3878
3877
  };
3879
3878
 
3880
3879
  // src/methods/buyListings/addBuyListingTxs.ts
3881
- var import_bcs3 = require("@mysten/sui/bcs");
3880
+ import { bcs as bcs4 } from "@mysten/sui/bcs";
3882
3881
 
3883
3882
  // src/graphql/queries/fetchCommissionByListingId.ts
3884
- var import_graphql_request15 = require("graphql-request");
3885
- var fetchCommissionByNftContractId = import_graphql_request15.gql`
3883
+ import { gql as gql15 } from "graphql-request";
3884
+ var fetchCommissionByNftContractId = gql15`
3886
3885
  query fetchCommissionByNftContractId($nftContractId: uuid!) {
3887
3886
  commissions(where: { contract_id: { _eq: $nftContractId } }) {
3888
3887
  is_custodial
@@ -3975,13 +3974,13 @@ var getMarketFeePrice = ({
3975
3974
  };
3976
3975
 
3977
3976
  // src/bigNumberConfig.ts
3978
- var import_bignumber = require("bignumber.js");
3979
- import_bignumber.BigNumber.set({
3977
+ import { BigNumber } from "bignumber.js";
3978
+ BigNumber.set({
3980
3979
  POW_PRECISION: 64
3981
3980
  });
3982
- var ZERO = new import_bignumber.BigNumber(0);
3983
- var ONE = new import_bignumber.BigNumber(1);
3984
- var bigNumberConfig_default = import_bignumber.BigNumber;
3981
+ var ZERO = new BigNumber(0);
3982
+ var ONE = new BigNumber(1);
3983
+ var bigNumberConfig_default = BigNumber;
3985
3984
 
3986
3985
  // src/helpers/calculateRoyaltyFee.ts
3987
3986
  function calculateRoyaltyFee(transferPolicyRules, price) {
@@ -3999,7 +3998,7 @@ function calculateRoyaltyFee(transferPolicyRules, price) {
3999
3998
  }
4000
3999
 
4001
4000
  // src/methods/buyListings/addBuyListingTxs.ts
4002
- var import_utils6 = require("@mysten/sui/utils");
4001
+ import { normalizeSuiObjectId as normalizeSuiObjectId4 } from "@mysten/sui/utils";
4003
4002
  function addLegacyTradePortBuyTx({
4004
4003
  tx,
4005
4004
  nftType,
@@ -4055,14 +4054,16 @@ var addLegacyTradeportKioskBuyTx = async ({
4055
4054
  }) => {
4056
4055
  let commissionFeeAmount = sharedBulkBuyingDataByNftType?.[nftType]?.commissionFeeAmountsByListingId?.[listingId] ?? 0;
4057
4056
  if (!commissionFeeAmount) {
4058
- const response = await suiClient.getDynamicFieldObject({
4059
- parentId: TRADEPORT_KIOSK_LISTING_STORE,
4060
- name: { type: "0x2::object::ID", value: nftTokenId }
4061
- });
4062
- if (response.error?.code === "dynamicFieldNotFound") {
4057
+ try {
4058
+ const { object } = await suiClient.core.getDynamicObjectField({
4059
+ parentId: TRADEPORT_KIOSK_LISTING_STORE,
4060
+ name: { type: "0x2::object::ID", bcs: bcs4.Address.serialize(nftTokenId).toBytes() },
4061
+ include: { content: true }
4062
+ });
4063
+ commissionFeeAmount = Number(KioskListing.parse(object.content).commission);
4064
+ } catch {
4063
4065
  throw new Error(`Not found kiosk listing object of token ${nftTokenId}`);
4064
4066
  }
4065
- commissionFeeAmount = Number(response.data?.content?.fields?.commission);
4066
4067
  }
4067
4068
  if (commissionFeeAmount === 0) {
4068
4069
  commissionFeeAmount = getMarketFeePrice({ price, collectionId });
@@ -4076,7 +4077,7 @@ var addLegacyTradeportKioskBuyTx = async ({
4076
4077
  arguments: [
4077
4078
  tx.object(TRADEPORT_KIOSK_LISTING_STORE),
4078
4079
  tx.object(sellerKiosk),
4079
- tx.object("value" in kioskTx.kiosk ? kioskTx.kiosk.value : kioskTx.kiosk),
4080
+ tx.object(kioskTx.kiosk),
4080
4081
  tx.pure.address(nftTokenId),
4081
4082
  tx.object(coin)
4082
4083
  ],
@@ -4144,8 +4145,8 @@ async function addKioskTradePortBuyTx({
4144
4145
  tx.object(TRADEPORT_LISTINGS_STORE),
4145
4146
  tx.object(TRADEPORT_ORDERBOOK_STORE),
4146
4147
  tx.object(sellerKiosk),
4147
- tx.object("value" in kioskTx.kiosk ? kioskTx.kiosk.value : kioskTx.kiosk),
4148
- tx.object("value" in kioskTx.kioskCap ? kioskTx.kioskCap.value : kioskTx.kioskCap),
4148
+ tx.object(kioskTx.kiosk),
4149
+ tx.object(kioskTx.kioskCap),
4149
4150
  tx.pure.address(buyer),
4150
4151
  tx.pure.id(nftTokenId),
4151
4152
  tx.object(coin),
@@ -4308,7 +4309,7 @@ async function addBluemoveKioskBuyTx({
4308
4309
  tx.object(BLUEMOVE_KIOSK_MARKETPLACE_KIOSK_OBJECT),
4309
4310
  tx.object(sellerKiosk),
4310
4311
  tx.object(transferPolicyId),
4311
- tx.object("value" in kioskTx.kiosk ? kioskTx.kiosk.value : kioskTx.kiosk),
4312
+ tx.object(kioskTx.kiosk),
4312
4313
  tx.pure.address(nftTokenId),
4313
4314
  tx.pure.u64(price),
4314
4315
  tx.object(coin1)
@@ -4454,7 +4455,7 @@ var addTocenBuyTx = ({ tx, nftTokenIds, nftType, price, coinToSplit }) => {
4454
4455
  target: "0x3605d91c559e80cf8fdeabae9abaccb0bc38f96eac0b32bf47e95a9159a5277f::tocen_marketplace::buy_cart",
4455
4456
  arguments: [
4456
4457
  tx.object(TOCEN_MARKETPLACE_OBJECT),
4457
- tx.pure(import_bcs3.bcs.vector(import_bcs3.bcs.Address).serialize(nftTokenIds)),
4458
+ tx.pure(bcs4.vector(bcs4.Address).serialize(nftTokenIds)),
4458
4459
  tx.object(coin)
4459
4460
  ],
4460
4461
  typeArguments: [nftType]
@@ -4497,10 +4498,10 @@ async function addTradePortBuyTxHandler(txData) {
4497
4498
  });
4498
4499
  const chainState = await getCollectionChainState(txData.collectionId);
4499
4500
  const nftStrategies = chainState?.nft_strategies ?? {};
4500
- const normalizedSellerKiosk = (0, import_utils6.normalizeSuiObjectId)(txData.sellerKiosk);
4501
+ const normalizedSellerKiosk = normalizeSuiObjectId4(txData.sellerKiosk);
4501
4502
  for (const [strategyFtType, strategyData] of Object.entries(nftStrategies)) {
4502
4503
  const strategyKioskId = strategyData.kiosk_id ?? "0x0";
4503
- if ((0, import_utils6.normalizeSuiObjectId)(strategyKioskId) === normalizedSellerKiosk) {
4504
+ if (normalizeSuiObjectId4(strategyKioskId) === normalizedSellerKiosk) {
4504
4505
  await applyFtStrategy({
4505
4506
  collectionId: txData.collectionId,
4506
4507
  strategyFtType,
@@ -4514,13 +4515,10 @@ async function addTradePortBuyTxHandler(txData) {
4514
4515
  }
4515
4516
  if (txData.listingNonce?.startsWith("0x")) {
4516
4517
  const response = await txData?.suiClient.getObject({
4517
- id: txData.listingNonce,
4518
- options: { showType: true }
4518
+ objectId: txData.listingNonce,
4519
+ include: {}
4519
4520
  });
4520
- if (response.error) {
4521
- throw new Error(response.error.code);
4522
- }
4523
- if (response.data.type === NON_KIOSK_LISTING_NONCE_TYPE) {
4521
+ if (response.object.type === NON_KIOSK_LISTING_NONCE_TYPE) {
4524
4522
  const sharedObjects2 = txData?.sharedBulkBuyingDataByNftType?.[txData?.nftType]?.sharedObjects ?? await getSharedObjects(txData?.nftType);
4525
4523
  addLegacyTradePortBuyTx({ ...txData, sharedObjects: sharedObjects2 });
4526
4524
  return;
@@ -4632,7 +4630,7 @@ var buyListings = async ({
4632
4630
  throw new Error("No listings found");
4633
4631
  }
4634
4632
  const listingsForTracking = [];
4635
- const tx = existingTx ?? new import_transactions7.Transaction();
4633
+ const tx = existingTx ?? new Transaction7();
4636
4634
  const tocenTokenIds = [];
4637
4635
  let tocenNftType = "";
4638
4636
  let tocenTotalPrice = 0;
@@ -4738,10 +4736,10 @@ var buyListings = async ({
4738
4736
  };
4739
4737
 
4740
4738
  // src/methods/cancelMultiBid/cancelMultiBid.ts
4741
- var import_transactions8 = require("@mysten/sui/transactions");
4739
+ import { Transaction as Transaction8 } from "@mysten/sui/transactions";
4742
4740
 
4743
4741
  // src/methods/removeNftBids/addRemoveNftBidTxs.ts
4744
- var import_utils7 = require("@mysten/sui/utils");
4742
+ import { normalizeSuiObjectId as normalizeSuiObjectId5 } from "@mysten/sui/utils";
4745
4743
  function addTradeportRemoveNftBidTx({ tx, bidNonce, nftType }) {
4746
4744
  tx.moveCall({
4747
4745
  target: "0xb42dbb7413b79394e1a0175af6ae22b69a5c7cc5df259cd78072b6818217c027::biddings::cancel_bid",
@@ -4798,7 +4796,7 @@ function addCancelSingleBidForMultibidChainId(tx, bidNonce, multiBidChainId) {
4798
4796
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::cancel_bid`,
4799
4797
  arguments: [
4800
4798
  tx.object(TRADEPORT_MULTI_BID_STORE),
4801
- tx.pure.id((0, import_utils7.normalizeSuiObjectId)(bidNonce)),
4799
+ tx.pure.id(normalizeSuiObjectId5(bidNonce)),
4802
4800
  tx.pure.option("id", multiBidChainId)
4803
4801
  ]
4804
4802
  });
@@ -4806,7 +4804,7 @@ function addCancelSingleBidForMultibidChainId(tx, bidNonce, multiBidChainId) {
4806
4804
  async function addTradePortRemoveNftBidTxHandler(txData) {
4807
4805
  const bidType = await getObjectType({
4808
4806
  suiClient: txData?.suiClient,
4809
- objectId: (0, import_utils7.normalizeSuiObjectId)(txData?.bidNonce)
4807
+ objectId: normalizeSuiObjectId5(txData?.bidNonce)
4810
4808
  });
4811
4809
  if (isSingleBid(bidType)) {
4812
4810
  await addSingleBidRemoveNftBidTx(txData);
@@ -4840,7 +4838,7 @@ async function cancelMultiBid({ multiBidId }) {
4840
4838
  if (cancelled_at) {
4841
4839
  throw new Error(`MultiBid ${multiBidId} already cancelled`);
4842
4840
  }
4843
- const tx = new import_transactions8.Transaction();
4841
+ const tx = new Transaction8();
4844
4842
  if (bids.length > 1022) {
4845
4843
  throw new Error(`Too many bids to cancel in one transaction`);
4846
4844
  }
@@ -4855,11 +4853,11 @@ async function cancelMultiBid({ multiBidId }) {
4855
4853
  }
4856
4854
 
4857
4855
  // src/methods/cancelNftTransfers/cancelNftTransfers.ts
4858
- var import_transactions9 = require("@mysten/sui/transactions");
4856
+ import { Transaction as Transaction9 } from "@mysten/sui/transactions";
4859
4857
 
4860
4858
  // src/graphql/queries/fetchAccountKiosks.ts
4861
- var import_graphql_request16 = require("graphql-request");
4862
- var fetchAccountKiosks = import_graphql_request16.gql`
4859
+ import { gql as gql16 } from "graphql-request";
4860
+ var fetchAccountKiosks = gql16`
4863
4861
  query fetchAccountKiosks($accountAddress: String!) {
4864
4862
  kiosks: kiosks_by_owner_address(owner_address: $accountAddress) {
4865
4863
  id
@@ -4891,7 +4889,7 @@ async function addTradeportKioskCancelNftTransferTx({
4891
4889
  target: "0x49642273ca7db3d942f9fd810c93467974c40e73ea7f03e8e7a632f1222aca73::kiosk_transfers::cancel_with_purchase_cap",
4892
4890
  arguments: [
4893
4891
  tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
4894
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
4892
+ tx.object(kioskTx.kiosk),
4895
4893
  tx.pure.address(nftTokenId)
4896
4894
  ],
4897
4895
  typeArguments: [nftType]
@@ -4909,7 +4907,7 @@ var cancelNftTransfers = async ({ nftIds, walletAddress }, context) => {
4909
4907
  throw new Error("No nfts found");
4910
4908
  }
4911
4909
  const nftsForTracking = [];
4912
- const tx = new import_transactions9.Transaction();
4910
+ const tx = new Transaction9();
4913
4911
  const sharedKioskState = {
4914
4912
  kioskTx: void 0
4915
4913
  };
@@ -4953,11 +4951,11 @@ var cancelNftTransfers = async ({ nftIds, walletAddress }, context) => {
4953
4951
  });
4954
4952
  }
4955
4953
  sharedKioskState?.kioskTx?.finalize();
4956
- return import_transactions9.Transaction.from(tx);
4954
+ return Transaction9.from(tx);
4957
4955
  };
4958
4956
 
4959
4957
  // src/methods/claimNfts/claimNfts.ts
4960
- var import_transactions10 = require("@mysten/sui/transactions");
4958
+ import { Transaction as Transaction10 } from "@mysten/sui/transactions";
4961
4959
 
4962
4960
  // src/helpers/splitCoins.ts
4963
4961
  var splitCoins = ({ tx, amounts }) => {
@@ -5003,8 +5001,8 @@ var addClaimAcceptedBidNftTx = async ({
5003
5001
  arguments: [
5004
5002
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
5005
5003
  tx.object(TRADEPORT_KIOSK_BIDDING_ESCROW_KIOSK),
5006
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
5007
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
5004
+ tx.object(kioskTx.kiosk),
5005
+ tx.object(kioskTx.kioskCap),
5008
5006
  tx.pure.address(nftTokenId),
5009
5007
  tx.object(transferPolicyId)
5010
5008
  ],
@@ -5040,8 +5038,8 @@ var addClaimAcceptedBidNftWithPurchaseCapTx = async ({
5040
5038
  arguments: [
5041
5039
  tx.object(TRADEPORT_KIOSK_BIDDING_STORE),
5042
5040
  tx.object(sellerKiosk),
5043
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
5044
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
5041
+ tx.object(kioskTx.kiosk),
5042
+ tx.object(kioskTx.kioskCap),
5045
5043
  tx.pure.address(nftTokenId),
5046
5044
  tx.object(transferPolicyId)
5047
5045
  ],
@@ -5076,8 +5074,8 @@ var addClaimTransferredNftTx = async ({
5076
5074
  arguments: [
5077
5075
  tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
5078
5076
  tx.object(TRADEPORT_KIOSK_TRANSFERS_ESCROW_KIOSK),
5079
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
5080
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
5077
+ tx.object(kioskTx.kiosk),
5078
+ tx.object(kioskTx.kioskCap),
5081
5079
  tx.pure.address(nftTokenId),
5082
5080
  tx.object(transferPolicyId)
5083
5081
  ],
@@ -5162,8 +5160,8 @@ var addBluemoveClaimAcceptedBidNft = async ({
5162
5160
  tx.object(BLUEMOVE_KIOSK_OFFER_COLLECTION_BIDDER_BAG),
5163
5161
  tx.object(transferPolicyId),
5164
5162
  tx.object(sellerKiosk),
5165
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
5166
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
5163
+ tx.object(kioskTx.kiosk),
5164
+ tx.object(kioskTx.kioskCap),
5167
5165
  tx.pure.address(nftTokenId),
5168
5166
  tx.object(coin)
5169
5167
  ],
@@ -5182,7 +5180,7 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
5182
5180
  throw new Error("No nfts found");
5183
5181
  }
5184
5182
  const nftsForTracking = [];
5185
- const tx = existingTx ?? new import_transactions10.Transaction();
5183
+ const tx = existingTx ?? new Transaction10();
5186
5184
  const sharedKioskState = {
5187
5185
  kioskTx: void 0
5188
5186
  };
@@ -5325,14 +5323,14 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
5325
5323
  }
5326
5324
  }
5327
5325
  sharedKioskState?.kioskTx?.finalize();
5328
- return import_transactions10.Transaction.from(tx);
5326
+ return Transaction10.from(tx);
5329
5327
  };
5330
5328
 
5331
5329
  // src/methods/createMultiBid/createMultiBid.ts
5332
- var import_transactions12 = require("@mysten/sui/transactions");
5330
+ import { Transaction as Transaction12 } from "@mysten/sui/transactions";
5333
5331
 
5334
5332
  // src/methods/updateMultiBid/updateMultiBid.ts
5335
- var import_transactions11 = require("@mysten/sui/transactions");
5333
+ import { Transaction as Transaction11 } from "@mysten/sui/transactions";
5336
5334
  async function updateMultiBid({
5337
5335
  walletAddress,
5338
5336
  multiBidId,
@@ -5343,7 +5341,7 @@ async function updateMultiBid({
5343
5341
  multiBidChainId,
5344
5342
  coinToSplit
5345
5343
  }, context) {
5346
- const tx = existingTx ?? new import_transactions11.Transaction();
5344
+ const tx = existingTx ?? new Transaction11();
5347
5345
  if (!multiBidChainId) {
5348
5346
  const { chain_id: chainId, cancelled_at } = (await gqlChainRequest({
5349
5347
  chain: "sui",
@@ -5379,7 +5377,7 @@ async function createMultiBid({
5379
5377
  amount,
5380
5378
  tx: existingTx
5381
5379
  }) {
5382
- const tx = existingTx ?? new import_transactions12.Transaction();
5380
+ const tx = existingTx ?? new Transaction12();
5383
5381
  const multiBidChainId = tx.moveCall({
5384
5382
  target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::create_multi_bid`,
5385
5383
  arguments: [tx.object(TRADEPORT_MULTI_BID_STORE), tx.pure.option("string", name)]
@@ -5397,11 +5395,11 @@ async function createMultiBid({
5397
5395
  }
5398
5396
 
5399
5397
  // src/methods/listNfts/listNfts.ts
5400
- var import_transactions14 = require("@mysten/sui/transactions");
5398
+ import { Transaction as Transaction13 } from "@mysten/sui/transactions";
5401
5399
 
5402
5400
  // 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);
5401
+ import { normalizeSuiAddress as normalizeSuiAddress2 } from "@mysten/sui/utils";
5402
+ var isExpiredListing = (listing, walletAddress) => listing.nonce && listing.seller && normalizeSuiAddress2(listing.seller) === normalizeSuiAddress2(walletAddress);
5405
5403
 
5406
5404
  // src/helpers/validateMinFloorPrice.ts
5407
5405
  function validateMinFloorPrice({ transferPolicies, listPrice }) {
@@ -5501,8 +5499,8 @@ async function addKioskTradePortListTx({
5501
5499
  arguments: [
5502
5500
  tx.object(TRADEPORT_LISTINGS_STORE),
5503
5501
  tx.object(TRADEPORT_ORDERBOOK_STORE),
5504
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
5505
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
5502
+ tx.object(kioskTx.kiosk),
5503
+ tx.object(kioskTx.kioskCap),
5506
5504
  tx.pure.address(seller),
5507
5505
  tx.pure.id(nftTokenId),
5508
5506
  tx.pure.u64(listPrice)
@@ -5605,8 +5603,8 @@ async function addKioskTradePortRelistTx({
5605
5603
  arguments: [
5606
5604
  tx.object(TRADEPORT_LISTINGS_STORE),
5607
5605
  tx.object(TRADEPORT_ORDERBOOK_STORE),
5608
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
5609
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
5606
+ tx.object(kioskTx.kiosk),
5607
+ tx.object(kioskTx.kioskCap),
5610
5608
  tx.pure.id(nftTokenId),
5611
5609
  tx.pure.u64(listPrice)
5612
5610
  ],
@@ -5731,7 +5729,7 @@ async function relistNft({
5731
5729
  }
5732
5730
 
5733
5731
  // src/methods/sponsorNftListing/addSponsorNftListingTx.ts
5734
- var import_transactions13 = require("@mysten/sui/transactions");
5732
+ import { coinWithBalance } from "@mysten/sui/transactions";
5735
5733
  var addSponsorListingTx = async ({
5736
5734
  tx,
5737
5735
  nftTokenId,
@@ -5739,7 +5737,7 @@ var addSponsorListingTx = async ({
5739
5737
  sponsorOptions
5740
5738
  }) => {
5741
5739
  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) });
5740
+ const sponsorCoin = sponsorOptions.coinToSplit ? tx.splitCoins(sponsorOptions.coinToSplit, [tx.pure.u64(totalFee)])[0] : coinWithBalance({ type: USDC_COIN_TYPE, balance: BigInt(totalFee) });
5743
5741
  tx.moveCall({
5744
5742
  target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::add_sponsored_listing`,
5745
5743
  arguments: [
@@ -5764,7 +5762,7 @@ var listNfts = async ({ nfts, walletAddress, tx: existingTx }, context) => {
5764
5762
  throw new Error("No nfts found");
5765
5763
  }
5766
5764
  const nftsForTracking = [];
5767
- const tx = existingTx ?? new import_transactions14.Transaction();
5765
+ const tx = existingTx ?? new Transaction13();
5768
5766
  const sharedKioskState = {
5769
5767
  kioskTx: void 0
5770
5768
  };
@@ -5833,11 +5831,11 @@ var listNfts = async ({ nfts, walletAddress, tx: existingTx }, context) => {
5833
5831
  };
5834
5832
 
5835
5833
  // src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts
5836
- var import_transactions15 = require("@mysten/sui/transactions");
5834
+ import { Transaction as Transaction14 } from "@mysten/sui/transactions";
5837
5835
 
5838
5836
  // src/graphql/queries/fetchNftsByKioskId.ts
5839
- var import_graphql_request17 = require("graphql-request");
5840
- var fetchNftsByKioskId = import_graphql_request17.gql`
5837
+ import { gql as gql17 } from "graphql-request";
5838
+ var fetchNftsByKioskId = gql17`
5841
5839
  query fetchNftsByKioskId($jsonFilter: jsonb) {
5842
5840
  nfts(where: { chain_state: { _contains: $jsonFilter } }) {
5843
5841
  id
@@ -5858,7 +5856,7 @@ var fetchNftsByKioskId = import_graphql_request17.gql`
5858
5856
  }
5859
5857
  }
5860
5858
  `;
5861
- var fetchBulkNftsByKioskId = import_graphql_request17.gql`
5859
+ var fetchBulkNftsByKioskId = gql17`
5862
5860
  query fetchNftsByKioskId($where: nfts_bool_exp) {
5863
5861
  nfts(where: $where) {
5864
5862
  id
@@ -5881,8 +5879,8 @@ var fetchBulkNftsByKioskId = import_graphql_request17.gql`
5881
5879
  `;
5882
5880
 
5883
5881
  // src/graphql/queries/fetchTransferPoliciesByType.ts
5884
- var import_graphql_request18 = require("graphql-request");
5885
- var fetchTransferPoliciesByType = import_graphql_request18.gql`
5882
+ import { gql as gql18 } from "graphql-request";
5883
+ var fetchTransferPoliciesByType = gql18`
5886
5884
  query fetchTransferPoliciesByType($type: String!) {
5887
5885
  transfer_policies_by_type(type: $type) {
5888
5886
  id
@@ -5957,8 +5955,8 @@ async function addTradeportKioskTransferTx({
5957
5955
  target: "0x49642273ca7db3d942f9fd810c93467974c40e73ea7f03e8e7a632f1222aca73::kiosk_transfers::transfer_with_purchase_capability",
5958
5956
  arguments: [
5959
5957
  tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
5960
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
5961
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
5958
+ tx.object(kioskTx.kiosk),
5959
+ tx.object(kioskTx.kioskCap),
5962
5960
  tx.pure.address(nftTokenId),
5963
5961
  tx.pure.address(addLeadingZerosAfter0x(recipientAddress))
5964
5962
  ],
@@ -5984,7 +5982,11 @@ async function addTradeportKioskDirectTransferTx(txData, nfts, suiClient) {
5984
5982
  (transferPolicy) => BigInt(transferPolicy?.rules.find((rule) => rule.type === "royalty_rule")?.min_amount ?? 0n)
5985
5983
  );
5986
5984
  const totalRoyaltyAmount = royaltyAmounts.reduce((sum, amount) => sum + amount, 0n);
5987
- const [royaltyCoin] = tx.splitCoins(tx.gas, [tx.pure.u64(totalRoyaltyAmount)]);
5985
+ const [royaltyCoin] = totalRoyaltyAmount === 0n ? tx.moveCall({
5986
+ target: "0x2::coin::zero",
5987
+ arguments: [],
5988
+ typeArguments: ["0x2::sui::SUI"]
5989
+ }) : tx.splitCoins(tx.gas, [tx.pure.u64(totalRoyaltyAmount)]);
5988
5990
  for (const nft of nfts) {
5989
5991
  const nftType = getNftType({
5990
5992
  collectionId: nft?.collection?.id,
@@ -6041,7 +6043,7 @@ async function getTransferPolicyForDirectTransfer(suiClient, collectionChainStat
6041
6043
 
6042
6044
  // src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts
6043
6045
  async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }, context) {
6044
- const tx = new import_transactions15.Transaction();
6046
+ const tx = new Transaction14();
6045
6047
  const res = await gqlChainRequest({
6046
6048
  chain: "sui",
6047
6049
  query: fetchKiosksByOwner,
@@ -6207,15 +6209,15 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }
6207
6209
  }
6208
6210
  }
6209
6211
  sharedKioskState?.kioskTx?.finalize();
6210
- return import_transactions15.Transaction.from(tx);
6212
+ return Transaction14.from(tx);
6211
6213
  }
6212
6214
 
6213
6215
  // src/methods/placeCollectionBids/placeCollectionBids.ts
6214
- var import_transactions16 = require("@mysten/sui/transactions");
6216
+ import { Transaction as Transaction15 } from "@mysten/sui/transactions";
6215
6217
 
6216
6218
  // src/graphql/queries/fetchCollectionsById.ts
6217
- var import_graphql_request19 = require("graphql-request");
6218
- var fetchCollectionsById = import_graphql_request19.gql`
6219
+ import { gql as gql19 } from "graphql-request";
6220
+ var fetchCollectionsById = gql19`
6219
6221
  query fetchCollectionsById($collectionIds: [uuid!]) {
6220
6222
  collections(where: { id: { _in: $collectionIds } }) {
6221
6223
  id
@@ -6225,7 +6227,7 @@ var fetchCollectionsById = import_graphql_request19.gql`
6225
6227
  }
6226
6228
  }
6227
6229
  `;
6228
- var fetchCollectionsByIdWithOneNft = import_graphql_request19.gql`
6230
+ var fetchCollectionsByIdWithOneNft = gql19`
6229
6231
  query fetchCollectionsByIdWithOneNft($collectionIds: [uuid!]) {
6230
6232
  collections(where: { id: { _in: $collectionIds } }) {
6231
6233
  id
@@ -6243,7 +6245,7 @@ var fetchCollectionsByIdWithOneNft = import_graphql_request19.gql`
6243
6245
  }
6244
6246
  }
6245
6247
  `;
6246
- var fetchCollectionsBySlug = import_graphql_request19.gql`
6248
+ var fetchCollectionsBySlug = gql19`
6247
6249
  query fetchCollectionsBySlug($slug: String!) {
6248
6250
  collections(where: { slug: { _eq: $slug } }) {
6249
6251
  id
@@ -6252,7 +6254,7 @@ var fetchCollectionsBySlug = import_graphql_request19.gql`
6252
6254
  `;
6253
6255
 
6254
6256
  // src/methods/placeNftBids/addPlaceNftBidTxs.ts
6255
- var import_utils9 = require("@mysten/sui/utils");
6257
+ import { fromHex, normalizeSuiObjectId as normalizeSuiObjectId6 } from "@mysten/sui/utils";
6256
6258
  async function addTradePortPlaceNftBidTxHandler(txData) {
6257
6259
  if (isOriginByteCollection(txData?.transferPolicies) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
6258
6260
  throw new Error("OriginByte bidding not supported currently");
@@ -6268,12 +6270,12 @@ async function addTradePortPlaceNftBidTxHandler(txData) {
6268
6270
  expireAt,
6269
6271
  coinToSplit
6270
6272
  } = txData;
6271
- let bcs4;
6273
+ let bcs5;
6272
6274
  if (nftTokenId && isDynamicCollection(collectionId)) {
6273
6275
  if (!bcsHex) {
6274
6276
  throw new Error(`No BCS found for token ${nftTokenId}`);
6275
6277
  }
6276
- bcs4 = (0, import_utils9.fromHex)(bcsHex);
6278
+ bcs5 = fromHex(bcsHex);
6277
6279
  }
6278
6280
  let multiBidChainId;
6279
6281
  let expiredBids;
@@ -6329,13 +6331,13 @@ async function addTradePortPlaceNftBidTxHandler(txData) {
6329
6331
  arguments: [
6330
6332
  tx.object(TRADEPORT_MULTI_BID_STORE),
6331
6333
  tx.pure.u64(nftTokenId ? 1 : 0),
6332
- multiBidChainId ? typeof multiBidChainId === "string" ? tx.pure.option("id", (0, import_utils9.normalizeSuiObjectId)(multiBidChainId)) : tx.moveCall({
6334
+ multiBidChainId ? typeof multiBidChainId === "string" ? tx.pure.option("id", normalizeSuiObjectId6(multiBidChainId)) : tx.moveCall({
6333
6335
  target: "0x1::option::some",
6334
6336
  typeArguments: ["0x2::object::ID"],
6335
6337
  arguments: [multiBidChainId]
6336
6338
  }) : void 0,
6337
- tx.pure.option("id", nftTokenId ? (0, import_utils9.normalizeSuiObjectId)(nftTokenId) : void 0),
6338
- tx.pure.option("vector<u8>", bcs4 ? [...bcs4] : void 0),
6339
+ tx.pure.option("id", nftTokenId ? normalizeSuiObjectId6(nftTokenId) : void 0),
6340
+ tx.pure.option("vector<u8>", bcs5 ? [...bcs5] : void 0),
6339
6341
  tx.pure.option("u64", expireAt?.getTime()),
6340
6342
  tx.pure.u64(price),
6341
6343
  ...transferPolicy ? [tx.object(transferPolicy.id)] : [],
@@ -6349,15 +6351,10 @@ async function getBidFeeBps(suiClient) {
6349
6351
  return bidFeeBps;
6350
6352
  }
6351
6353
  const res = await suiClient.getObject({
6352
- id: TRADEPORT_MULTI_BID_STORE,
6353
- options: { showContent: true }
6354
+ objectId: TRADEPORT_MULTI_BID_STORE,
6355
+ include: { json: true }
6354
6356
  });
6355
- if (res.error) {
6356
- throw new Error(`Error on getting SUI object ${TRADEPORT_MULTI_BID_STORE}: ${res.error.code}`);
6357
- }
6358
- bidFeeBps = BigInt(
6359
- res?.data?.content?.fields?.fee_bps ?? 0
6360
- );
6357
+ bidFeeBps = BigInt(res?.object?.json?.fee_bps ?? 0);
6361
6358
  return bidFeeBps;
6362
6359
  }
6363
6360
  function isDynamicCollection(collectionId) {
@@ -6365,8 +6362,8 @@ function isDynamicCollection(collectionId) {
6365
6362
  }
6366
6363
 
6367
6364
  // src/graphql/queries/fetchCollectionFloorListings.ts
6368
- var import_graphql_request20 = require("graphql-request");
6369
- var fetchCollectionFloorListings = import_graphql_request20.gql`
6365
+ import { gql as gql20 } from "graphql-request";
6366
+ var fetchCollectionFloorListings = gql20`
6370
6367
  query fetchCollectionFloorListings($collectionId: uuid!) {
6371
6368
  listings(
6372
6369
  where: { collection_id: { _eq: $collectionId }, listed: { _eq: true }, nft: {} }
@@ -6442,7 +6439,7 @@ var placeCollectionBids = async ({
6442
6439
  throw new Error("No collection found");
6443
6440
  }
6444
6441
  const collectionsForTracking = [];
6445
- const tx = existingTx ?? new import_transactions16.Transaction();
6442
+ const tx = existingTx ?? new Transaction15();
6446
6443
  for (const collection of res.collections) {
6447
6444
  const nftType = getNftType({
6448
6445
  collectionId: collection?.id,
@@ -6493,9 +6490,9 @@ var placeCollectionBids = async ({
6493
6490
  };
6494
6491
 
6495
6492
  // src/methods/placeNftBids/placeNftBids.ts
6496
- var import_transactions17 = require("@mysten/sui/transactions");
6493
+ import { Transaction as Transaction16 } from "@mysten/sui/transactions";
6497
6494
  var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx: existingTx, coinToSplit }, context) => {
6498
- const tx = existingTx ?? new import_transactions17.Transaction();
6495
+ const tx = existingTx ?? new Transaction16();
6499
6496
  const res = await gqlChainRequest({
6500
6497
  chain: "sui",
6501
6498
  query: fetchNftsById,
@@ -6543,10 +6540,10 @@ var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx
6543
6540
  };
6544
6541
 
6545
6542
  // src/methods/removeCollectionBids/removeCollectionBids.ts
6546
- var import_transactions18 = require("@mysten/sui/transactions");
6543
+ import { Transaction as Transaction17 } from "@mysten/sui/transactions";
6547
6544
 
6548
6545
  // src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts
6549
- var import_utils10 = require("@mysten/sui/utils");
6546
+ import { normalizeSuiObjectId as normalizeSuiObjectId7 } from "@mysten/sui/utils";
6550
6547
  function addTradeportRemoveCollectionBidTx({
6551
6548
  tx,
6552
6549
  nftType,
@@ -6602,7 +6599,7 @@ function addBluemoveKioskRemoveCollectionBidTx({
6602
6599
  async function addTradePortRemoveCollectionBidTxHandler(txData) {
6603
6600
  const bidType = await getObjectType({
6604
6601
  suiClient: txData?.suiClient,
6605
- objectId: (0, import_utils10.normalizeSuiObjectId)(txData?.bidNonce)
6602
+ objectId: normalizeSuiObjectId7(txData?.bidNonce)
6606
6603
  });
6607
6604
  if (isSingleBid(bidType)) {
6608
6605
  await addSingleBidRemoveNftBidTx(txData);
@@ -6622,7 +6619,7 @@ async function addTradePortRemoveCollectionBidTxHandler(txData) {
6622
6619
  async function addBluemoveRemoveCollectionBidTxHandler(txData) {
6623
6620
  const bidType = await getObjectType({
6624
6621
  suiClient: txData?.suiClient,
6625
- objectId: (0, import_utils10.normalizeSuiObjectId)(txData?.bidNonce)
6622
+ objectId: normalizeSuiObjectId7(txData?.bidNonce)
6626
6623
  });
6627
6624
  if (isOriginByteBid(bidType)) {
6628
6625
  const sharedObjects = await getSharedObjects(txData?.nftType);
@@ -6651,7 +6648,7 @@ var removeCollectionBids = async ({ bidIds, tx: existingTx }, context) => {
6651
6648
  throw new Error("No bids found");
6652
6649
  }
6653
6650
  const bidsForTracking = [];
6654
- const tx = existingTx ? import_transactions18.Transaction.from(existingTx) : new import_transactions18.Transaction();
6651
+ const tx = existingTx ? Transaction17.from(existingTx) : new Transaction17();
6655
6652
  for (const bid of res.bids) {
6656
6653
  if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
6657
6654
  throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
@@ -6699,11 +6696,11 @@ var removeCollectionBids = async ({ bidIds, tx: existingTx }, context) => {
6699
6696
  bidder: bid?.bidder
6700
6697
  });
6701
6698
  }
6702
- return import_transactions18.Transaction.from(tx);
6699
+ return Transaction17.from(tx);
6703
6700
  };
6704
6701
 
6705
6702
  // src/methods/removeNftBids/removeNftBids.ts
6706
- var import_transactions19 = require("@mysten/sui/transactions");
6703
+ import { Transaction as Transaction18 } from "@mysten/sui/transactions";
6707
6704
  var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
6708
6705
  const res = await gqlChainRequest({
6709
6706
  chain: "sui",
@@ -6714,7 +6711,7 @@ var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
6714
6711
  throw new Error("No bids found");
6715
6712
  }
6716
6713
  const bidsForTracking = [];
6717
- const tx = existingTx ? import_transactions19.Transaction.from(existingTx) : new import_transactions19.Transaction();
6714
+ const tx = existingTx ? Transaction18.from(existingTx) : new Transaction18();
6718
6715
  for (const bid of res.bids) {
6719
6716
  if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
6720
6717
  throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
@@ -6759,15 +6756,15 @@ var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
6759
6756
  bidder: bid?.bidder
6760
6757
  });
6761
6758
  }
6762
- return import_transactions19.Transaction.from(tx);
6759
+ return Transaction18.from(tx);
6763
6760
  };
6764
6761
 
6765
6762
  // src/methods/sponsorNftListing/sponsorNftListing.ts
6766
- var import_transactions20 = require("@mysten/sui/transactions");
6763
+ import { Transaction as Transaction19 } from "@mysten/sui/transactions";
6767
6764
 
6768
6765
  // src/graphql/queries/fetchNftCollectionChainState.ts
6769
- var import_graphql_request21 = require("graphql-request");
6770
- var fetchNftCollectionChainState = import_graphql_request21.gql`
6766
+ import { gql as gql21 } from "graphql-request";
6767
+ var fetchNftCollectionChainState = gql21`
6771
6768
  query fetchNftCollectionChainState($nftTokenId: String!) {
6772
6769
  nfts(where: { token_id: { _eq: $nftTokenId } }) {
6773
6770
  collection {
@@ -6802,7 +6799,7 @@ var sponsorNftListing = async ({
6802
6799
  if (isOriginByteCollection(transferPolicies)) {
6803
6800
  throw new Error(`You cannot sponsor an Origin Byte NFT. Nft Token Id: ${nftTokenId}`);
6804
6801
  }
6805
- const tx = existingTx ?? new import_transactions20.Transaction();
6802
+ const tx = existingTx ?? new Transaction19();
6806
6803
  await addSponsorListingTx({
6807
6804
  tx,
6808
6805
  nftTokenId,
@@ -6813,7 +6810,7 @@ var sponsorNftListing = async ({
6813
6810
  };
6814
6811
 
6815
6812
  // src/methods/transferNfts/transferNfts.ts
6816
- var import_transactions21 = require("@mysten/sui/transactions");
6813
+ import { Transaction as Transaction20 } from "@mysten/sui/transactions";
6817
6814
  var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context) => {
6818
6815
  if (addLeadingZerosAfter0x(recipientAddress) === addLeadingZerosAfter0x(walletAddress)) {
6819
6816
  throw new Error("Cannot transfer to self");
@@ -6831,7 +6828,7 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
6831
6828
  }
6832
6829
  const nftsForTracking = [];
6833
6830
  const nftsToTransferDirectly = [];
6834
- const tx = new import_transactions21.Transaction();
6831
+ const tx = new Transaction20();
6835
6832
  const sharedKioskState = {
6836
6833
  kioskTx: void 0
6837
6834
  };
@@ -6934,11 +6931,11 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
6934
6931
  context.suiClient
6935
6932
  );
6936
6933
  sharedKioskState?.kioskTx?.finalize();
6937
- return import_transactions21.Transaction.from(tx);
6934
+ return Transaction20.from(tx);
6938
6935
  };
6939
6936
 
6940
6937
  // src/methods/unlistListings/unlistListings.ts
6941
- var import_transactions22 = require("@mysten/sui/transactions");
6938
+ import { Transaction as Transaction21 } from "@mysten/sui/transactions";
6942
6939
  var unlistListings = async ({ listingIds, walletAddress }, context) => {
6943
6940
  const res = await gqlChainRequest({
6944
6941
  chain: "sui",
@@ -6949,7 +6946,7 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
6949
6946
  throw new Error("No listings found");
6950
6947
  }
6951
6948
  const listingsForTracking = [];
6952
- const tx = new import_transactions22.Transaction();
6949
+ const tx = new Transaction21();
6953
6950
  const sharedKioskState = {
6954
6951
  kioskTx: void 0
6955
6952
  };
@@ -7018,12 +7015,12 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
7018
7015
  });
7019
7016
  }
7020
7017
  sharedKioskState?.kioskTx?.finalize();
7021
- return import_transactions22.Transaction.from(tx);
7018
+ return Transaction21.from(tx);
7022
7019
  };
7023
7020
 
7024
7021
  // src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts
7025
- var import_kiosk5 = require("@mysten/kiosk");
7026
- var import_transactions23 = require("@mysten/sui/transactions");
7022
+ import { KioskTransaction as KioskTransaction2 } from "@mysten/kiosk";
7023
+ import { Transaction as Transaction22 } from "@mysten/sui/transactions";
7027
7024
  async function withdrawProfitsFromKiosks({ walletAddress }, context) {
7028
7025
  const res = await gqlChainRequest({
7029
7026
  chain: "sui",
@@ -7043,7 +7040,7 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
7043
7040
  if (kiosksWithProfit.length === 0) {
7044
7041
  throw new Error(`No kiosks with profit to withdraw found for ${walletAddress}`);
7045
7042
  }
7046
- const tx = new import_transactions23.Transaction();
7043
+ const tx = new Transaction22();
7047
7044
  try {
7048
7045
  for (const kiosk of kiosksWithProfit) {
7049
7046
  let kioskTx;
@@ -7053,8 +7050,8 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
7053
7050
  query: fetchPersonalCapByKiosk,
7054
7051
  variables: { kioskId: kiosk.id }
7055
7052
  })).personalCap?.id;
7056
- kioskTx = new import_kiosk5.KioskTransaction({
7057
- transactionBlock: tx,
7053
+ kioskTx = new KioskTransaction2({
7054
+ transaction: tx,
7058
7055
  kioskClient: context.kioskClient,
7059
7056
  cap: {
7060
7057
  isPersonal: true,
@@ -7070,8 +7067,8 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
7070
7067
  query: fetchOwnerCapByKiosk,
7071
7068
  variables: { kioskId: kiosk.id }
7072
7069
  })).ownerCap?.id;
7073
- kioskTx = new import_kiosk5.KioskTransaction({
7074
- transactionBlock: tx,
7070
+ kioskTx = new KioskTransaction2({
7071
+ transaction: tx,
7075
7072
  kioskClient: context.kioskClient,
7076
7073
  cap: {
7077
7074
  isPersonal: false,
@@ -7089,10 +7086,12 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
7089
7086
  } catch (err) {
7090
7087
  console.log("err", err);
7091
7088
  }
7092
- return import_transactions23.Transaction.from(tx);
7089
+ return Transaction22.from(tx);
7093
7090
  }
7094
7091
 
7095
7092
  // src/SuiTradingClient.ts
7093
+ var DEFAULT_SUI_GRPC_URL = "https://fullnode.mainnet.sui.io:443";
7094
+ var DEFAULT_SUI_GRAPHQL_URL = "https://graphql.mainnet.sui.io/";
7096
7095
  var SuiTradingClient = class {
7097
7096
  constructor({
7098
7097
  apiUser,
@@ -7101,18 +7100,19 @@ var SuiTradingClient = class {
7101
7100
  apiUrl,
7102
7101
  tradeportRouterUrl,
7103
7102
  suiNodeUrl,
7103
+ suiGraphqlUrl,
7104
7104
  graphQLClient
7105
7105
  }) {
7106
7106
  this.allowedApiUsersForUnsharedKiosksMigration = ["tradeport.xyz", "mercato.xyz"];
7107
7107
  this.apiUser = apiUser;
7108
7108
  this.apiKey = apiKey;
7109
7109
  this.tradeportRouterUrl = tradeportRouterUrl;
7110
- this.suiClient = createSuiClient_default(suiNodeUrl ?? (0, import_client2.getFullnodeUrl)("mainnet"));
7111
- this.kioskClient = createKioskClient_default(this.suiClient);
7110
+ this.suiClient = createSuiClient_default(suiNodeUrl ?? DEFAULT_SUI_GRPC_URL);
7111
+ this.kioskClient = createKioskClient_default(suiGraphqlUrl ?? DEFAULT_SUI_GRAPHQL_URL);
7112
7112
  if (graphQLClient) {
7113
7113
  setGraphqlClient(graphQLClient);
7114
7114
  } else {
7115
- setGraphqlClient(new import_graphql_request22.GraphQLClient(apiUrl ?? "https://graphql.tradeport.gg"));
7115
+ setGraphqlClient(new GraphQLClient(apiUrl ?? "https://graphql.tradeport.gg"));
7116
7116
  }
7117
7117
  getGraphqlClient().setHeaders({
7118
7118
  "x-api-user": apiUser,
@@ -7259,11 +7259,12 @@ var SuiTradingClient = class {
7259
7259
  },
7260
7260
  context
7261
7261
  );
7262
- let result = await this.suiClient.devInspectTransactionBlock({
7263
- transactionBlock: tx,
7264
- sender: addLeadingZerosAfter0x(walletAddress)
7262
+ tx.setSenderIfNotSet(addLeadingZerosAfter0x(walletAddress));
7263
+ let result = await this.suiClient.simulateTransaction({
7264
+ transaction: tx,
7265
+ include: { effects: true }
7265
7266
  });
7266
- if (result.effects.status.status === "success") {
7267
+ if (result.$kind === "Transaction") {
7267
7268
  return tx;
7268
7269
  }
7269
7270
  if (i === allBidsWithSameHighestPrice.length - 1) {
@@ -7277,16 +7278,17 @@ var SuiTradingClient = class {
7277
7278
  },
7278
7279
  context
7279
7280
  );
7280
- result = await this.suiClient.devInspectTransactionBlock({
7281
- transactionBlock: tx2,
7282
- sender: addLeadingZerosAfter0x(walletAddress)
7281
+ tx2.setSenderIfNotSet(addLeadingZerosAfter0x(walletAddress));
7282
+ result = await this.suiClient.simulateTransaction({
7283
+ transaction: tx2,
7284
+ include: { effects: true }
7283
7285
  });
7284
- if (result?.effects.status.status === "success") {
7286
+ if (result?.$kind === "Transaction") {
7285
7287
  return tx2;
7286
7288
  }
7287
7289
  }
7288
7290
  throw new Error(
7289
- `Failed to validate accept bid transaction: ${result?.error ?? result?.effects?.status?.error ?? "Unknown error"}`
7291
+ `Failed to validate accept bid transaction: ${result?.FailedTransaction?.status?.error ? JSON.stringify(result.FailedTransaction.status.error) : "Unknown error"}`
7290
7292
  );
7291
7293
  }
7292
7294
  }
@@ -7339,8 +7341,8 @@ var SuiTradingClient = class {
7339
7341
  const tx = await claimNfts({ nftIds, walletAddress }, context, true);
7340
7342
  tx.setSenderIfNotSet(addLeadingZerosAfter0x(walletAddress));
7341
7343
  const rawTransaction = await tx.build({ client: this.suiClient });
7342
- await this.suiClient.dryRunTransactionBlock({
7343
- transactionBlock: rawTransaction
7344
+ await this.suiClient.simulateTransaction({
7345
+ transaction: rawTransaction
7344
7346
  });
7345
7347
  return tx;
7346
7348
  } catch (err) {
@@ -7393,8 +7395,7 @@ var SuiTradingClient = class {
7393
7395
  }
7394
7396
  };
7395
7397
  var SuiTradingClient_default = SuiTradingClient;
7396
- // Annotate the CommonJS export names for ESM import in node:
7397
- 0 && (module.exports = {
7398
- SuiTradingClient
7399
- });
7398
+ export {
7399
+ SuiTradingClient_default as SuiTradingClient
7400
+ };
7400
7401
  //# sourceMappingURL=index.js.map