@tradeport/sui-trading-sdk 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tradeport/sui-trading-sdk
2
2
 
3
+ ## 0.1.26
4
+
5
+ ### Patch Changes
6
+
7
+ - 5fe883d: Added buyAndExerciseShortLocks
8
+
3
9
  ## 0.1.25
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -23,6 +23,16 @@ type BuyAndExerciseLongLocks = {
23
23
  tx?: Transaction;
24
24
  };
25
25
 
26
+ type BuyAndExerciseShortLocks = {
27
+ walletAddress: string;
28
+ locks: Array<{
29
+ id: string;
30
+ listingId?: string;
31
+ nftId?: string;
32
+ }>;
33
+ tx?: Transaction;
34
+ };
35
+
26
36
  type BuyListings = {
27
37
  listingIds: string[];
28
38
  walletAddress: string;
@@ -151,6 +161,7 @@ declare class SuiTradingClient {
151
161
  exerciseLongLocks(args: ExerciseLongLocks): Promise<Transaction>;
152
162
  exerciseShortLocks(args: ExerciseShortLocks): Promise<Transaction>;
153
163
  buyAndExerciseLongLocks(args: BuyAndExerciseLongLocks): Promise<Transaction>;
164
+ buyAndExerciseShortLocks(args: BuyAndExerciseShortLocks): Promise<Transaction>;
154
165
  }
155
166
 
156
167
  export { SuiTradingClient };
package/dist/index.d.ts CHANGED
@@ -23,6 +23,16 @@ type BuyAndExerciseLongLocks = {
23
23
  tx?: Transaction;
24
24
  };
25
25
 
26
+ type BuyAndExerciseShortLocks = {
27
+ walletAddress: string;
28
+ locks: Array<{
29
+ id: string;
30
+ listingId?: string;
31
+ nftId?: string;
32
+ }>;
33
+ tx?: Transaction;
34
+ };
35
+
26
36
  type BuyListings = {
27
37
  listingIds: string[];
28
38
  walletAddress: string;
@@ -151,6 +161,7 @@ declare class SuiTradingClient {
151
161
  exerciseLongLocks(args: ExerciseLongLocks): Promise<Transaction>;
152
162
  exerciseShortLocks(args: ExerciseShortLocks): Promise<Transaction>;
153
163
  buyAndExerciseLongLocks(args: BuyAndExerciseLongLocks): Promise<Transaction>;
164
+ buyAndExerciseShortLocks(args: BuyAndExerciseShortLocks): Promise<Transaction>;
154
165
  }
155
166
 
156
167
  export { SuiTradingClient };
package/dist/index.js CHANGED
@@ -1953,8 +1953,12 @@ async function buyAndExerciseLongLocks({ walletAddress, locks, tx: existingTx },
1953
1953
  return transaction;
1954
1954
  }
1955
1955
 
1956
- // src/methods/buyListings/buyListings.ts
1957
- var import_transactions6 = require("@mysten/sui/transactions");
1956
+ // src/methods/buyAndExerciseShortLocks/buyAndExerciseShortLocks.ts
1957
+ var import_transactions8 = require("@mysten/sui/transactions");
1958
+
1959
+ // src/methods/exerciseShortLocks/exerciseShortLocks.ts
1960
+ var import_utils3 = require("@mysten/sui.js/utils");
1961
+ var import_transactions7 = require("@mysten/sui/transactions");
1958
1962
 
1959
1963
  // src/graphql/queries/fetchListingsById.ts
1960
1964
  var import_graphql_request14 = require("graphql-request");
@@ -1981,6 +1985,20 @@ var fetchListingsById = import_graphql_request14.gql`
1981
1985
  }
1982
1986
  `;
1983
1987
 
1988
+ // src/helpers/calculateRoyaltyFee.ts
1989
+ function calculateRoyaltyFee(transferPolicyRules, price) {
1990
+ const royaltyRules = transferPolicyRules.filter(
1991
+ (rule) => rule.type === "royalty_rule"
1992
+ );
1993
+ return royaltyRules.reduce(
1994
+ (sum, rule) => sum + BigInt(rule.min_amount) + BigInt(rule.amount_bp) * price / 10000n,
1995
+ 0n
1996
+ );
1997
+ }
1998
+
1999
+ // src/methods/buyListings/buyListings.ts
2000
+ var import_transactions6 = require("@mysten/sui/transactions");
2001
+
1984
2002
  // src/helpers/addThirdPartyTxFee.ts
1985
2003
  var addThirdPartyTxFee = async (tx, price) => {
1986
2004
  const [microTxFee] = tx.splitCoins(tx.gas, [
@@ -2543,15 +2561,148 @@ var buyListings = async ({
2543
2561
  return import_transactions6.Transaction.from(tx);
2544
2562
  };
2545
2563
 
2564
+ // src/methods/exerciseShortLocks/exerciseShortLocks.ts
2565
+ async function exerciseShortLocks({ walletAddress, transaction, locks }, context) {
2566
+ const tx = transaction ?? new import_transactions7.Transaction();
2567
+ for (const { id: lockId, listingId, nftId: nftIdArg } of locks) {
2568
+ const lock = await getLockById(lockId);
2569
+ if (!transaction && lock.state !== "bought") {
2570
+ throw new Error("Lock must be in bought state");
2571
+ }
2572
+ const transferPolicy = (await getKioskTransferPolicies(lock.nft_type))?.at(0);
2573
+ if (!transferPolicy) {
2574
+ throw new Error(`Transfer policy is not found for ${lock.nft_type}`);
2575
+ }
2576
+ const sharedObjects = await getSharedObjects(lock.nft_type);
2577
+ if (lock.nft?.token_id) {
2578
+ throw new Error(`The short lock ${lockId} must not have any nft`);
2579
+ }
2580
+ let listing = null;
2581
+ if (listingId) {
2582
+ const res = await gqlChainRequest({
2583
+ chain: "sui",
2584
+ query: fetchListingsById,
2585
+ variables: { listingIds: [listingId] }
2586
+ });
2587
+ listing = res.listings[0];
2588
+ if (!listing) {
2589
+ throw new Error(`Missing listing ${listingId}`);
2590
+ }
2591
+ }
2592
+ let nftId = nftIdArg;
2593
+ if (listing) {
2594
+ if (nftIdArg && listing.nft.id !== nftIdArg) {
2595
+ throw new Error(`The listing ${listingId} must be for token ${listing.nft.token_id}`);
2596
+ }
2597
+ if (!nftIdArg) {
2598
+ nftId = listing.nft.id;
2599
+ }
2600
+ if (listing.nonce && isOriginByteTx(sharedObjects) || !listing.nft?.chain_state?.kiosk_id) {
2601
+ throw new Error(`The listing ${listingId} must be for native kiosk`);
2602
+ }
2603
+ }
2604
+ if (!nftId) {
2605
+ throw new Error(`nftId is required for shorts`);
2606
+ }
2607
+ const nft = (await gqlChainRequest({
2608
+ chain: "sui",
2609
+ query: fetchNftById,
2610
+ variables: { nftId }
2611
+ }))?.nfts?.[0];
2612
+ if (!nft) {
2613
+ throw new Error(`No nft ${nftId} found`);
2614
+ }
2615
+ if (!listing && nft.owner !== walletAddress) {
2616
+ throw new Error(`The nft ${nftId} must be owned by ${walletAddress}`);
2617
+ }
2618
+ await kioskTxWrapper({
2619
+ tx,
2620
+ kioskOwner: walletAddress,
2621
+ kiosk: nftIdArg ? nft?.chain_state?.kiosk_id : null,
2622
+ async runCommands(kioskTx) {
2623
+ let confirmLockRequest;
2624
+ if (listing) {
2625
+ const beforeResolveKioskTransferRequest = async (transferRequest) => {
2626
+ const [request] = tx.moveCall({
2627
+ target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::start_confirm_short_lock_with_buy_listing`,
2628
+ typeArguments: [lock.nft_type],
2629
+ arguments: [
2630
+ tx.object(TRADEPORT_PRICE_LOCK_STORE),
2631
+ tx.object(import_utils3.SUI_CLOCK_OBJECT_ID),
2632
+ tx.pure.id(lock.lock_id),
2633
+ tx.pure.u64(listing.price),
2634
+ tx.pure.u64(calculateRoyaltyFee(transferPolicy.rules, BigInt(listing.price))),
2635
+ transferRequest
2636
+ ]
2637
+ });
2638
+ confirmLockRequest = request;
2639
+ };
2640
+ await buyListings(
2641
+ {
2642
+ listingIds: [listingId],
2643
+ walletAddress,
2644
+ tx,
2645
+ kioskTx,
2646
+ beforeResolveKioskTransferRequest
2647
+ },
2648
+ context
2649
+ );
2650
+ } else {
2651
+ const [buyListinTransferRequest, request] = tx.moveCall({
2652
+ target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::start_confirm_short_lock`,
2653
+ typeArguments: [lock.nft_type],
2654
+ arguments: [
2655
+ tx.object(TRADEPORT_PRICE_LOCK_STORE),
2656
+ tx.object(import_utils3.SUI_CLOCK_OBJECT_ID),
2657
+ tx.pure.id(lock.lock_id),
2658
+ tx.pure.id(nft.token_id),
2659
+ tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk)
2660
+ ]
2661
+ });
2662
+ confirmLockRequest = request;
2663
+ await resolveTransferPolicies({
2664
+ tx,
2665
+ kioskTx,
2666
+ nftType: lock.nft_type,
2667
+ price: lock.maker_price.toString(),
2668
+ transferRequest: buyListinTransferRequest,
2669
+ shouldSkipKioskLocking: true
2670
+ });
2671
+ }
2672
+ tx.moveCall({
2673
+ target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::end_confirm_short_lock`,
2674
+ typeArguments: [lock.nft_type],
2675
+ arguments: [
2676
+ tx.object(TRADEPORT_PRICE_LOCK_STORE),
2677
+ tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
2678
+ confirmLockRequest,
2679
+ tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
2680
+ tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap)
2681
+ ]
2682
+ });
2683
+ }
2684
+ });
2685
+ }
2686
+ return tx;
2687
+ }
2688
+
2689
+ // src/methods/buyAndExerciseShortLocks/buyAndExerciseShortLocks.ts
2690
+ async function buyAndExerciseShortLocks({ walletAddress, locks, tx: existingTx }, context) {
2691
+ const transaction = existingTx ?? new import_transactions8.Transaction();
2692
+ await buyLocks({ lockIds: locks?.map((lock) => lock?.id), transaction });
2693
+ await exerciseShortLocks({ locks, walletAddress, transaction }, context);
2694
+ return transaction;
2695
+ }
2696
+
2546
2697
  // src/methods/cancelLocks/cancelLocks.ts
2547
- var import_transactions7 = require("@mysten/sui/transactions");
2548
- var import_utils3 = require("@mysten/sui.js/utils");
2698
+ var import_transactions9 = require("@mysten/sui/transactions");
2699
+ var import_utils4 = require("@mysten/sui.js/utils");
2549
2700
  async function cancelLocks({
2550
2701
  lockIds,
2551
2702
  walletAddress,
2552
2703
  tx: existingTx
2553
2704
  }) {
2554
- const tx = existingTx ?? new import_transactions7.Transaction();
2705
+ const tx = existingTx ?? new import_transactions9.Transaction();
2555
2706
  for (const lockId of lockIds) {
2556
2707
  const lock = await getLockById(lockId);
2557
2708
  if (!lock) {
@@ -2570,7 +2721,7 @@ async function cancelLocks({
2570
2721
  typeArguments: [lock.nft_type],
2571
2722
  arguments: [
2572
2723
  tx.object(TRADEPORT_PRICE_LOCK_STORE),
2573
- tx.object(import_utils3.SUI_CLOCK_OBJECT_ID),
2724
+ tx.object(import_utils4.SUI_CLOCK_OBJECT_ID),
2574
2725
  tx.pure.id(lock.lock_id),
2575
2726
  tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk)
2576
2727
  ]
@@ -2582,7 +2733,7 @@ async function cancelLocks({
2582
2733
  }
2583
2734
 
2584
2735
  // src/methods/claimNfts/claimNfts.ts
2585
- var import_transactions8 = require("@mysten/sui/transactions");
2736
+ var import_transactions10 = require("@mysten/sui/transactions");
2586
2737
 
2587
2738
  // src/methods/claimNfts/addClaimNftsTxs.ts
2588
2739
  var addClaimTradeHoldTx = ({
@@ -2736,7 +2887,7 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
2736
2887
  throw new Error("No nfts found");
2737
2888
  }
2738
2889
  const nftsForTracking = [];
2739
- const tx = existingTx ?? new import_transactions8.Transaction();
2890
+ const tx = existingTx ?? new import_transactions10.Transaction();
2740
2891
  for (const nft of res.nfts) {
2741
2892
  if (!nft) {
2742
2893
  throw new Error("No nft found");
@@ -2826,11 +2977,11 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context, useOl
2826
2977
  claimReason: nft?.chain_state?.claimable_reason
2827
2978
  });
2828
2979
  }
2829
- return import_transactions8.Transaction.from(tx);
2980
+ return import_transactions10.Transaction.from(tx);
2830
2981
  };
2831
2982
 
2832
2983
  // src/methods/createLongLocks/createLongLocks.ts
2833
- var import_transactions9 = require("@mysten/sui/transactions");
2984
+ var import_transactions11 = require("@mysten/sui/transactions");
2834
2985
 
2835
2986
  // src/graphql/queries/fetchActiveLockStateByNftId.ts
2836
2987
  var import_graphql_request16 = require("graphql-request");
@@ -2858,24 +3009,13 @@ var getActiveLockStateByNftId = async (nftId) => {
2858
3009
  return res?.locks?.[0] ?? void 0;
2859
3010
  };
2860
3011
 
2861
- // src/helpers/calculateRoyaltyFee.ts
2862
- function calculateRoyaltyFee(transferPolicyRules, price) {
2863
- const royaltyRules = transferPolicyRules.filter(
2864
- (rule) => rule.type === "royalty_rule"
2865
- );
2866
- return royaltyRules.reduce(
2867
- (sum, rule) => sum + BigInt(rule.min_amount) + BigInt(rule.amount_bp) * price / 10000n,
2868
- 0n
2869
- );
2870
- }
2871
-
2872
3012
  // src/methods/createLongLocks/createLongLocks.ts
2873
3013
  async function createLongLocks({
2874
3014
  walletAddress,
2875
3015
  nfts
2876
3016
  }) {
2877
3017
  const expireIn = 7 * 24 * 3600 * 1e3;
2878
- const tx = new import_transactions9.Transaction();
3018
+ const tx = new import_transactions11.Transaction();
2879
3019
  for (const argNft of nfts) {
2880
3020
  const existingLock = await getActiveLockStateByNftId(argNft.id);
2881
3021
  if (existingLock) {
@@ -2930,10 +3070,10 @@ async function createLongLocks({
2930
3070
  }
2931
3071
 
2932
3072
  // src/methods/createShortLocks/createShortLocks.ts
2933
- var import_transactions10 = require("@mysten/sui/transactions");
3073
+ var import_transactions12 = require("@mysten/sui/transactions");
2934
3074
  async function createShortLocks({ nfts }) {
2935
3075
  const expireIn = 7 * 24 * 3600 * 1e3;
2936
- const tx = new import_transactions10.Transaction();
3076
+ const tx = new import_transactions12.Transaction();
2937
3077
  for (const argNft of nfts) {
2938
3078
  const premium = calculatePremium(BigInt(argNft.priceInMist));
2939
3079
  if (!argNft.type) {
@@ -2970,135 +3110,8 @@ async function createShortLocks({ nfts }) {
2970
3110
  return tx;
2971
3111
  }
2972
3112
 
2973
- // src/methods/exerciseShortLocks/exerciseShortLocks.ts
2974
- var import_utils4 = require("@mysten/sui.js/utils");
2975
- var import_transactions11 = require("@mysten/sui/transactions");
2976
- async function exerciseShortLocks({ walletAddress, transaction, locks }, context) {
2977
- const tx = transaction ?? new import_transactions11.Transaction();
2978
- for (const { id: lockId, listingId, nftId: nftIdArg } of locks) {
2979
- const lock = await getLockById(lockId);
2980
- if (!transaction && lock.state !== "bought") {
2981
- throw new Error("Lock must be in bought state");
2982
- }
2983
- const transferPolicy = (await getKioskTransferPolicies(lock.nft_type))?.at(0);
2984
- if (!transferPolicy) {
2985
- throw new Error(`Transfer policy is not found for ${lock.nft_type}`);
2986
- }
2987
- const sharedObjects = await getSharedObjects(lock.nft_type);
2988
- if (lock.nft?.token_id) {
2989
- throw new Error(`The short lock ${lockId} must not have any nft`);
2990
- }
2991
- let listing = null;
2992
- if (listingId) {
2993
- const res = await gqlChainRequest({
2994
- chain: "sui",
2995
- query: fetchListingsById,
2996
- variables: { listingIds: [listingId] }
2997
- });
2998
- listing = res.listings[0];
2999
- if (!listing) {
3000
- throw new Error(`Missing listing ${listingId}`);
3001
- }
3002
- }
3003
- let nftId = nftIdArg;
3004
- if (listing) {
3005
- if (nftIdArg && listing.nft.id !== nftIdArg) {
3006
- throw new Error(`The listing ${listingId} must be for token ${listing.nft.token_id}`);
3007
- }
3008
- if (!nftIdArg) {
3009
- nftId = listing.nft.id;
3010
- }
3011
- if (listing.nonce && isOriginByteTx(sharedObjects) || !listing.nft?.chain_state?.kiosk_id) {
3012
- throw new Error(`The listing ${listingId} must be for native kiosk`);
3013
- }
3014
- }
3015
- if (!nftId) {
3016
- throw new Error(`nftId is required for shorts`);
3017
- }
3018
- const nft = (await gqlChainRequest({
3019
- chain: "sui",
3020
- query: fetchNftById,
3021
- variables: { nftId }
3022
- }))?.nfts?.[0];
3023
- if (!nft) {
3024
- throw new Error(`No nft ${nftId} found`);
3025
- }
3026
- if (!listing && nft.owner !== walletAddress) {
3027
- throw new Error(`The nft ${nftId} must be owned by ${walletAddress}`);
3028
- }
3029
- await kioskTxWrapper({
3030
- tx,
3031
- kioskOwner: walletAddress,
3032
- kiosk: nftIdArg ? nft?.chain_state?.kiosk_id : null,
3033
- async runCommands(kioskTx) {
3034
- let confirmLockRequest;
3035
- if (listing) {
3036
- const beforeResolveKioskTransferRequest = async (transferRequest) => {
3037
- const [request] = tx.moveCall({
3038
- target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::start_confirm_short_lock_with_buy_listing`,
3039
- typeArguments: [lock.nft_type],
3040
- arguments: [
3041
- tx.object(TRADEPORT_PRICE_LOCK_STORE),
3042
- tx.object(import_utils4.SUI_CLOCK_OBJECT_ID),
3043
- tx.pure.id(lock.lock_id),
3044
- tx.pure.u64(listing.price),
3045
- tx.pure.u64(calculateRoyaltyFee(transferPolicy.rules, BigInt(listing.price))),
3046
- transferRequest
3047
- ]
3048
- });
3049
- confirmLockRequest = request;
3050
- };
3051
- await buyListings(
3052
- {
3053
- listingIds: [listingId],
3054
- walletAddress,
3055
- tx,
3056
- kioskTx,
3057
- beforeResolveKioskTransferRequest
3058
- },
3059
- context
3060
- );
3061
- } else {
3062
- const [buyListinTransferRequest, request] = tx.moveCall({
3063
- target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::start_confirm_short_lock`,
3064
- typeArguments: [lock.nft_type],
3065
- arguments: [
3066
- tx.object(TRADEPORT_PRICE_LOCK_STORE),
3067
- tx.object(import_utils4.SUI_CLOCK_OBJECT_ID),
3068
- tx.pure.id(lock.lock_id),
3069
- tx.pure.id(nft.token_id),
3070
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk)
3071
- ]
3072
- });
3073
- confirmLockRequest = request;
3074
- await resolveTransferPolicies({
3075
- tx,
3076
- kioskTx,
3077
- nftType: lock.nft_type,
3078
- price: lock.maker_price.toString(),
3079
- transferRequest: buyListinTransferRequest,
3080
- shouldSkipKioskLocking: true
3081
- });
3082
- }
3083
- tx.moveCall({
3084
- target: `${TRADEPORT_PRICE_LOCK_PACKAGE}::tradeport_price_lock::end_confirm_short_lock`,
3085
- typeArguments: [lock.nft_type],
3086
- arguments: [
3087
- tx.object(TRADEPORT_PRICE_LOCK_STORE),
3088
- tx.object(TRADEPORT_KIOSK_TRANSFERS_STORE),
3089
- confirmLockRequest,
3090
- tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
3091
- tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap)
3092
- ]
3093
- });
3094
- }
3095
- });
3096
- }
3097
- return tx;
3098
- }
3099
-
3100
3113
  // src/methods/listNfts/listNfts.ts
3101
- var import_transactions12 = require("@mysten/sui/transactions");
3114
+ var import_transactions13 = require("@mysten/sui/transactions");
3102
3115
 
3103
3116
  // src/methods/listNfts/addListTxs.ts
3104
3117
  async function addOriginByteListTx({
@@ -3363,7 +3376,7 @@ var listNfts = async ({ nfts, walletAddress }, context) => {
3363
3376
  throw new Error("No nfts found");
3364
3377
  }
3365
3378
  const nftsForTracking = [];
3366
- const tx = new import_transactions12.Transaction();
3379
+ const tx = new import_transactions13.Transaction();
3367
3380
  for (const nft of res.nfts) {
3368
3381
  const sharedObjects = await getSharedObjects(
3369
3382
  nft?.properties?.nft_type || nft?.contract?.properties?.nft_type
@@ -3398,11 +3411,11 @@ var listNfts = async ({ nfts, walletAddress }, context) => {
3398
3411
  marketRelistedFrom: nft?.listings?.[0]?.market_name
3399
3412
  });
3400
3413
  }
3401
- return import_transactions12.Transaction.from(tx);
3414
+ return import_transactions13.Transaction.from(tx);
3402
3415
  };
3403
3416
 
3404
3417
  // src/methods/placeCollectionBids/placeCollectionBids.ts
3405
- var import_transactions13 = require("@mysten/sui/transactions");
3418
+ var import_transactions14 = require("@mysten/sui/transactions");
3406
3419
 
3407
3420
  // src/graphql/queries/fetchCollectionsById.ts
3408
3421
  var import_graphql_request17 = require("graphql-request");
@@ -3594,7 +3607,7 @@ var placeCollectionBids = async ({ collections, walletAddress }, context) => {
3594
3607
  throw new Error("No collection found");
3595
3608
  }
3596
3609
  const collectionsForTracking = [];
3597
- const tx = new import_transactions13.Transaction();
3610
+ const tx = new import_transactions14.Transaction();
3598
3611
  for (const collection of res.collections) {
3599
3612
  const nftType = collections?.some(
3600
3613
  (collection2) => collection2.id === "fa58ae52-b18d-4179-a2d4-c2471ede5f14" || // S-Card
@@ -3636,11 +3649,11 @@ var placeCollectionBids = async ({ collections, walletAddress }, context) => {
3636
3649
  bidder: walletAddress
3637
3650
  });
3638
3651
  }
3639
- return import_transactions13.Transaction.from(tx);
3652
+ return import_transactions14.Transaction.from(tx);
3640
3653
  };
3641
3654
 
3642
3655
  // src/methods/placeNftBids/placeNftBids.ts
3643
- var import_transactions14 = require("@mysten/sui/transactions");
3656
+ var import_transactions15 = require("@mysten/sui/transactions");
3644
3657
 
3645
3658
  // src/methods/placeNftBids/addPlaceNftBidTxs.ts
3646
3659
  function addTradePortPlaceNftBidTx({
@@ -3756,7 +3769,7 @@ var placeNftBids = async ({ nfts, walletAddress }, context) => {
3756
3769
  throw new Error("No nfts found");
3757
3770
  }
3758
3771
  const nftsForTracking = [];
3759
- const tx = new import_transactions14.Transaction();
3772
+ const tx = new import_transactions15.Transaction();
3760
3773
  for (const nft of res.nfts) {
3761
3774
  const sharedObjects = await getSharedObjects(
3762
3775
  nft?.properties?.nft_type || nft?.contract?.properties?.nft_type
@@ -3779,11 +3792,11 @@ var placeNftBids = async ({ nfts, walletAddress }, context) => {
3779
3792
  bidder: walletAddress
3780
3793
  });
3781
3794
  }
3782
- return import_transactions14.Transaction.from(tx);
3795
+ return import_transactions15.Transaction.from(tx);
3783
3796
  };
3784
3797
 
3785
3798
  // src/methods/removeCollectionBid/removeCollectionBid.ts
3786
- var import_transactions15 = require("@mysten/sui/transactions");
3799
+ var import_transactions16 = require("@mysten/sui/transactions");
3787
3800
 
3788
3801
  // src/methods/removeNftBids/addRemoveNftBidTxs.ts
3789
3802
  function addTradeportRemoveNftBidTx({ tx, bidNonce, nftType }) {
@@ -3934,7 +3947,7 @@ var removeCollectionBid = async ({ bidId }, context) => {
3934
3947
  throw new Error("No bids found");
3935
3948
  }
3936
3949
  const bidsForTracking = [];
3937
- const tx = new import_transactions15.Transaction();
3950
+ const tx = new import_transactions16.Transaction();
3938
3951
  for (const bid of res.bids) {
3939
3952
  let nftType;
3940
3953
  if ([
@@ -3991,11 +4004,11 @@ var removeCollectionBid = async ({ bidId }, context) => {
3991
4004
  bidder: bid?.bidder
3992
4005
  });
3993
4006
  }
3994
- return import_transactions15.Transaction.from(tx);
4007
+ return import_transactions16.Transaction.from(tx);
3995
4008
  };
3996
4009
 
3997
4010
  // src/methods/removeNftBids/removeNftBids.ts
3998
- var import_transactions16 = require("@mysten/sui/transactions");
4011
+ var import_transactions17 = require("@mysten/sui/transactions");
3999
4012
  var removeNftBids = async ({ bidIds }, context) => {
4000
4013
  const res = await gqlChainRequest({
4001
4014
  chain: "sui",
@@ -4006,7 +4019,7 @@ var removeNftBids = async ({ bidIds }, context) => {
4006
4019
  throw new Error("No bids found");
4007
4020
  }
4008
4021
  const bidsForTracking = [];
4009
- const tx = new import_transactions16.Transaction();
4022
+ const tx = new import_transactions17.Transaction();
4010
4023
  for (const bid of res.bids) {
4011
4024
  const sharedObjects = await getSharedObjects(
4012
4025
  bid?.nft?.properties?.nft_type || bid?.nft?.contract?.properties?.nft_type
@@ -4045,11 +4058,11 @@ var removeNftBids = async ({ bidIds }, context) => {
4045
4058
  bidder: bid?.bidder
4046
4059
  });
4047
4060
  }
4048
- return import_transactions16.Transaction.from(tx);
4061
+ return import_transactions17.Transaction.from(tx);
4049
4062
  };
4050
4063
 
4051
4064
  // src/methods/transferNfts/transferNfts.ts
4052
- var import_transactions17 = require("@mysten/sui/transactions");
4065
+ var import_transactions18 = require("@mysten/sui/transactions");
4053
4066
 
4054
4067
  // src/graphql/queries/fetchCryptoToUsdRate.ts
4055
4068
  var import_graphql_request18 = require("graphql-request");
@@ -4189,7 +4202,7 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
4189
4202
  throw new Error("No nfts found");
4190
4203
  }
4191
4204
  const nftsForTracking = [];
4192
- const tx = new import_transactions17.Transaction();
4205
+ const tx = new import_transactions18.Transaction();
4193
4206
  for (const nft of res.nfts) {
4194
4207
  if (nft?.listed) {
4195
4208
  throw new Error("Cannot transfer a listed NFT");
@@ -4233,11 +4246,11 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
4233
4246
  if (res?.nfts?.length > 1) {
4234
4247
  await addOneDollarFee(tx);
4235
4248
  }
4236
- return import_transactions17.Transaction.from(tx);
4249
+ return import_transactions18.Transaction.from(tx);
4237
4250
  };
4238
4251
 
4239
4252
  // src/methods/unlistListings/unlistListings.ts
4240
- var import_transactions18 = require("@mysten/sui/transactions");
4253
+ var import_transactions19 = require("@mysten/sui/transactions");
4241
4254
  var unlistListings = async ({ listingIds, walletAddress }, context) => {
4242
4255
  const res = await gqlChainRequest({
4243
4256
  chain: "sui",
@@ -4248,7 +4261,7 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
4248
4261
  throw new Error("No listings found");
4249
4262
  }
4250
4263
  const listingsForTracking = [];
4251
- const tx = new import_transactions18.Transaction();
4264
+ const tx = new import_transactions19.Transaction();
4252
4265
  for (const listing of res.listings) {
4253
4266
  if (!listing?.listed) {
4254
4267
  throw new Error(`Listing ${listing?.id} is not listed`);
@@ -4304,7 +4317,7 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
4304
4317
  marketName: listing?.market_name
4305
4318
  });
4306
4319
  }
4307
- return import_transactions18.Transaction.from(tx);
4320
+ return import_transactions19.Transaction.from(tx);
4308
4321
  };
4309
4322
 
4310
4323
  // src/SuiTradingClient.ts
@@ -4499,6 +4512,13 @@ var SuiTradingClient = class {
4499
4512
  };
4500
4513
  return buyAndExerciseLongLocks(args, context);
4501
4514
  }
4515
+ async buyAndExerciseShortLocks(args) {
4516
+ const context = {
4517
+ apiUser: this.apiUser,
4518
+ apiKey: this.apiKey
4519
+ };
4520
+ return buyAndExerciseShortLocks(args, context);
4521
+ }
4502
4522
  };
4503
4523
  var SuiTradingClient_default = SuiTradingClient;
4504
4524
  // Annotate the CommonJS export names for ESM import in node: