@tradeport/sui-trading-sdk 0.4.0 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tradeport/sui-trading-sdk
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 070925f: changed multibid config to prod and allowed strings for existing serialized txs to be passed into place bid methods
8
+
3
9
  ## 0.4.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -121,7 +121,7 @@ type PlaceCollectionBid = {
121
121
  multiBidId?: string;
122
122
  multiBidChainId?: any;
123
123
  expireAt?: Date;
124
- tx?: Transaction;
124
+ tx?: Transaction | string;
125
125
  };
126
126
 
127
127
  type PlaceNftBids = {
@@ -133,7 +133,7 @@ type PlaceNftBids = {
133
133
  multiBidId?: string;
134
134
  multiBidChainId?: any;
135
135
  expireAt?: Date;
136
- tx?: Transaction;
136
+ tx?: Transaction | string;
137
137
  };
138
138
 
139
139
  type RemoveCollectionBids = {
package/dist/index.d.ts CHANGED
@@ -121,7 +121,7 @@ type PlaceCollectionBid = {
121
121
  multiBidId?: string;
122
122
  multiBidChainId?: any;
123
123
  expireAt?: Date;
124
- tx?: Transaction;
124
+ tx?: Transaction | string;
125
125
  };
126
126
 
127
127
  type PlaceNftBids = {
@@ -133,7 +133,7 @@ type PlaceNftBids = {
133
133
  multiBidId?: string;
134
134
  multiBidChainId?: any;
135
135
  expireAt?: Date;
136
- tx?: Transaction;
136
+ tx?: Transaction | string;
137
137
  };
138
138
 
139
139
  type RemoveCollectionBids = {
package/dist/index.js CHANGED
@@ -148,8 +148,8 @@ var TRADEPORT_KIOSK_BIDDING_ESCROW_KIOSK = "0x151fbe627d3f8de855f424c879ea2176d8
148
148
  var TRADEPORT_KIOSK_BID_NONCE_TYPE = "0xec175e537be9e48f75fa6929291de6454d2502f1091feb22c0d26a22821bbf28::kiosk_biddings::Bid";
149
149
  var TRADEPORT_PRICE_LOCK_PACKAGE = "0x3cb532a2548290780a3d70ad6f4f06abc5bebb75ec6f8dd0197d4d2b2860c5d8";
150
150
  var TRADEPORT_PRICE_LOCK_STORE = "0x4b705de46a79b29276baf45009bc7d6f70cc0f1407f0c9e03cac5729c0c47946";
151
- var TRADEPORT_MULTI_BID_PACKAGE = "0xb32c899d9fb0d79a7e384bfbf2830a19ee26ccf51d6cadaaf1a14c4a2817886a";
152
- var TRADEPORT_MULTI_BID_STORE = "0x2617658a6b03dcf6df2df4d256341bc4690d3a3d299c9552ca6ac9799ceb0ed7";
151
+ var TRADEPORT_MULTI_BID_PACKAGE = "0x53134eb544c5a0b5085e99efaf7eab13b28ad123de35d61f941f8c8c40b72033";
152
+ var TRADEPORT_MULTI_BID_STORE = "0x8aaed7e884343fb8b222c721d02eaac2c6ae2abbb4ddcdf16cb55cf8754ee860";
153
153
  var COLLECTION_IDS_WITH_ZERO_COMMISSION = [
154
154
  ""
155
155
  ];
@@ -5467,63 +5467,6 @@ var fetchCollectionsBySlug = import_graphql_request20.gql`
5467
5467
  }
5468
5468
  `;
5469
5469
 
5470
- // src/graphql/queries/fetchCollectionFloorListings.ts
5471
- var import_graphql_request21 = require("graphql-request");
5472
- var fetchCollectionFloorListings = import_graphql_request21.gql`
5473
- query fetchCollectionFloorListings($collectionId: uuid!) {
5474
- listings(
5475
- where: { collection_id: { _eq: $collectionId }, listed: { _eq: true }, nft: {} }
5476
- order_by: { price: asc_nulls_last, market_name: desc_nulls_last }
5477
- limit: 3
5478
- ) {
5479
- id
5480
- price
5481
- market_name
5482
- }
5483
- }
5484
- `;
5485
-
5486
- // src/helpers/getCollectionFloorPrice.ts
5487
- var getCollectionFloorPrice = async (collectionId) => {
5488
- const res = await gqlChainRequest({
5489
- chain: "sui",
5490
- query: fetchCollectionFloorListings,
5491
- variables: { collectionId }
5492
- });
5493
- return res?.listings?.[0]?.price;
5494
- };
5495
-
5496
- // src/methods/placeCollectionBids/addPlaceCollectionBidTxs.ts
5497
- async function addOriginByteCollectionBidTx({
5498
- tx,
5499
- collectionId,
5500
- nftType,
5501
- bidAmount,
5502
- sharedObjects,
5503
- bidderKiosk
5504
- }) {
5505
- const collectionFloorPrice = await getCollectionFloorPrice(collectionId);
5506
- if (collectionFloorPrice && collectionFloorPrice > 0 && Number(bidAmount) > Number(collectionFloorPrice)) {
5507
- throw new Error("Bid amount must be less than the collection floor price");
5508
- }
5509
- const { orderbook } = sharedObjects;
5510
- const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
5511
- const [coin] = splitCoins({ tx, amounts: [tx.pure.u64(bidAmount + marketFeePrice)] });
5512
- tx.moveCall({
5513
- target: "0x8534e4cdfd28709c94330a9783c3d5fe6f5daba0bffb69102ce303c5b38aed5a::orderbook::create_bid_with_commission",
5514
- arguments: [
5515
- tx.object(orderbook),
5516
- tx.object(bidderKiosk),
5517
- tx.pure.u64(bidAmount),
5518
- tx.pure.address(TRADEPORT_BENEFICIARY_ADDRESS),
5519
- tx.pure.u64(marketFeePrice),
5520
- tx.object(coin)
5521
- ],
5522
- typeArguments: [nftType, "0x2::sui::SUI"]
5523
- });
5524
- destroyZeroCoin({ tx, coin });
5525
- }
5526
-
5527
5470
  // src/methods/placeNftBids/addPlaceNftBidTxs.ts
5528
5471
  var import_utils7 = require("@mysten/sui/utils");
5529
5472
  async function addTradePortPlaceNftBidTxHandler(txData) {
@@ -5620,6 +5563,63 @@ function isDynamicCollection(collectionId) {
5620
5563
  return DYNAMIC_COLLECTION_IDS.includes(collectionId);
5621
5564
  }
5622
5565
 
5566
+ // src/graphql/queries/fetchCollectionFloorListings.ts
5567
+ var import_graphql_request21 = require("graphql-request");
5568
+ var fetchCollectionFloorListings = import_graphql_request21.gql`
5569
+ query fetchCollectionFloorListings($collectionId: uuid!) {
5570
+ listings(
5571
+ where: { collection_id: { _eq: $collectionId }, listed: { _eq: true }, nft: {} }
5572
+ order_by: { price: asc_nulls_last, market_name: desc_nulls_last }
5573
+ limit: 3
5574
+ ) {
5575
+ id
5576
+ price
5577
+ market_name
5578
+ }
5579
+ }
5580
+ `;
5581
+
5582
+ // src/helpers/getCollectionFloorPrice.ts
5583
+ var getCollectionFloorPrice = async (collectionId) => {
5584
+ const res = await gqlChainRequest({
5585
+ chain: "sui",
5586
+ query: fetchCollectionFloorListings,
5587
+ variables: { collectionId }
5588
+ });
5589
+ return res?.listings?.[0]?.price;
5590
+ };
5591
+
5592
+ // src/methods/placeCollectionBids/addPlaceCollectionBidTxs.ts
5593
+ async function addOriginByteCollectionBidTx({
5594
+ tx,
5595
+ collectionId,
5596
+ nftType,
5597
+ bidAmount,
5598
+ sharedObjects,
5599
+ bidderKiosk
5600
+ }) {
5601
+ const collectionFloorPrice = await getCollectionFloorPrice(collectionId);
5602
+ if (collectionFloorPrice && collectionFloorPrice > 0 && Number(bidAmount) > Number(collectionFloorPrice)) {
5603
+ throw new Error("Bid amount must be less than the collection floor price");
5604
+ }
5605
+ const { orderbook } = sharedObjects;
5606
+ const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
5607
+ const [coin] = splitCoins({ tx, amounts: [tx.pure.u64(bidAmount + marketFeePrice)] });
5608
+ tx.moveCall({
5609
+ target: "0x8534e4cdfd28709c94330a9783c3d5fe6f5daba0bffb69102ce303c5b38aed5a::orderbook::create_bid_with_commission",
5610
+ arguments: [
5611
+ tx.object(orderbook),
5612
+ tx.object(bidderKiosk),
5613
+ tx.pure.u64(bidAmount),
5614
+ tx.pure.address(TRADEPORT_BENEFICIARY_ADDRESS),
5615
+ tx.pure.u64(marketFeePrice),
5616
+ tx.object(coin)
5617
+ ],
5618
+ typeArguments: [nftType, "0x2::sui::SUI"]
5619
+ });
5620
+ destroyZeroCoin({ tx, coin });
5621
+ }
5622
+
5623
5623
  // src/methods/placeCollectionBids/placeCollectionBids.ts
5624
5624
  var placeCollectionBids = async ({
5625
5625
  collections,
@@ -5638,7 +5638,7 @@ var placeCollectionBids = async ({
5638
5638
  throw new Error("No collection found");
5639
5639
  }
5640
5640
  const collectionsForTracking = [];
5641
- const tx = existingTx ?? new import_transactions17.Transaction();
5641
+ const tx = existingTx ? import_transactions17.Transaction.from(existingTx) : new import_transactions17.Transaction();
5642
5642
  for (const collection of res.collections) {
5643
5643
  const nftType = getNftType({
5644
5644
  collectionId: collection?.id,
@@ -5689,7 +5689,7 @@ var placeCollectionBids = async ({
5689
5689
  // src/methods/placeNftBids/placeNftBids.ts
5690
5690
  var import_transactions18 = require("@mysten/sui/transactions");
5691
5691
  var placeNftBids = async ({ nfts, walletAddress, multiBidId, multiBidChainId, expireAt, tx: existingTx }, context) => {
5692
- const tx = existingTx ?? new import_transactions18.Transaction();
5692
+ const tx = existingTx ? import_transactions18.Transaction.from(existingTx) : new import_transactions18.Transaction();
5693
5693
  const res = await gqlChainRequest({
5694
5694
  chain: "sui",
5695
5695
  query: fetchNftsById,