@tradeport/sui-trading-sdk 0.1.48 → 0.1.50

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.49
4
+
5
+ ### Patch Changes
6
+
7
+ - a20d38c: Renabling OB collection bidding, but not solo bidding yet
8
+
3
9
  ## 0.1.48
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var graphqlClient_default = graphqlClient;
31
31
 
32
32
  // src/apiClients/suiClient.ts
33
33
  var import_client = require("@mysten/sui/client");
34
- var rpcUrl = "https://rpc-mainnet.suiscan.xyz";
34
+ var rpcUrl = (0, import_client.getFullnodeUrl)("mainnet");
35
35
  var suiClient = new import_client.SuiClient({ url: rpcUrl });
36
36
  var suiClient_default = suiClient;
37
37
 
@@ -3677,6 +3677,31 @@ async function addTradePortKioskCollectionBidTx({
3677
3677
  });
3678
3678
  destroyZeroCoin({ tx, coin });
3679
3679
  }
3680
+ async function addOriginByteCollectionBidTx({
3681
+ tx,
3682
+ collectionId,
3683
+ nftType,
3684
+ bidAmount,
3685
+ sharedObjects,
3686
+ bidderKiosk
3687
+ }) {
3688
+ const { orderbook } = sharedObjects;
3689
+ const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
3690
+ const [coin] = splitCoins({ tx, amounts: [tx.pure.u64(bidAmount + marketFeePrice)] });
3691
+ tx.moveCall({
3692
+ target: "0x8534e4cdfd28709c94330a9783c3d5fe6f5daba0bffb69102ce303c5b38aed5a::orderbook::create_bid_with_commission",
3693
+ arguments: [
3694
+ tx.object(orderbook),
3695
+ tx.object(bidderKiosk),
3696
+ tx.pure.u64(bidAmount),
3697
+ tx.pure.address(TRADEPORT_BENEFICIARY_ADDRESS),
3698
+ tx.pure.u64(marketFeePrice),
3699
+ tx.object(coin)
3700
+ ],
3701
+ typeArguments: [nftType, "0x2::sui::SUI"]
3702
+ });
3703
+ destroyZeroCoin({ tx, coin });
3704
+ }
3680
3705
  async function addTradePortPlaceCollectionBidTxHandler(txData) {
3681
3706
  if (await hasRoyaltyRule(txData?.nftType)) {
3682
3707
  const royaltyRuleModule = getRoyaltyRuleModule(txData?.nftType);
@@ -3718,7 +3743,16 @@ var placeCollectionBids = async ({ collections, walletAddress }, context) => {
3718
3743
  };
3719
3744
  const numOfBids = collections?.find((c) => c.id === collection?.id)?.numOfBids;
3720
3745
  if (isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
3721
- throw new Error("OriginByte bidding not supported currently");
3746
+ const { kiosk: bidderKiosk, isNewKiosk: isNewBidderKiosk } = await getOrCreateOBKiosk({
3747
+ tx,
3748
+ address: txData.bidder
3749
+ });
3750
+ for (let i = 0; i < numOfBids; i++) {
3751
+ await addOriginByteCollectionBidTx({ ...txData, bidderKiosk });
3752
+ }
3753
+ if (isNewBidderKiosk) {
3754
+ await shareOriginByteKiosk({ tx, kiosk: bidderKiosk });
3755
+ }
3722
3756
  } else {
3723
3757
  for (let i = 0; i < numOfBids; i++) {
3724
3758
  await addTradePortPlaceCollectionBidTxHandler(txData);