@tradeport/sui-trading-sdk 0.0.0 → 0.0.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 +7 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +45 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -99
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/SuiTradingClient.ts +2 -2
- package/src/helpers/getMarketFeePrice.ts +1 -6
- package/src/helpers/getSharedObjects.ts +4 -5
- package/src/helpers/{getTradeportBiddingContractParsedBidAmount.ts → getTradeportBiddingContractBidAmount.ts} +2 -3
- package/src/helpers/kiosk/resolveTransferPolicies.ts +1 -1
- package/src/methods/listNfts/addListTxs.ts +6 -24
- package/src/methods/listNfts/addRelistTxs.ts +2 -9
- package/src/methods/listNfts/listNfts.ts +4 -4
- package/src/methods/placeCollectionBids/addPlaceCollectionBidTxs.ts +12 -29
- package/src/methods/placeCollectionBids/placeCollectionBids.ts +5 -5
- package/src/methods/placeNftBids/addPlaceNftBidTxs.ts +12 -25
- package/src/methods/placeNftBids/placeNftBids.ts +3 -3
- package/src/utils/parseSUI.ts +0 -1
package/CHANGELOG.md
ADDED
package/dist/index.d.mts
CHANGED
|
@@ -23,14 +23,14 @@ type ClaimNfts = {
|
|
|
23
23
|
type ListNfts = {
|
|
24
24
|
nfts: Array<{
|
|
25
25
|
id: string;
|
|
26
|
-
|
|
26
|
+
listPriceInMist: number;
|
|
27
27
|
}>;
|
|
28
28
|
walletAddress: string;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
type PlaceCollectionBid = {
|
|
32
32
|
collectionId: string;
|
|
33
|
-
|
|
33
|
+
bidAmountInMist: number;
|
|
34
34
|
numOfBids: number;
|
|
35
35
|
walletAddress: string;
|
|
36
36
|
};
|
|
@@ -38,7 +38,7 @@ type PlaceCollectionBid = {
|
|
|
38
38
|
type PlaceNftBids = {
|
|
39
39
|
nfts: Array<{
|
|
40
40
|
id: string;
|
|
41
|
-
|
|
41
|
+
bidAmountInMist: number;
|
|
42
42
|
}>;
|
|
43
43
|
walletAddress: string;
|
|
44
44
|
};
|
|
@@ -79,7 +79,7 @@ declare class SuiTradingClient {
|
|
|
79
79
|
placeNftBids({ nfts, walletAddress }: PlaceNftBids): Promise<TransactionBlock>;
|
|
80
80
|
removeNftBids({ bidIds }: RemoveNftBids): Promise<TransactionBlock>;
|
|
81
81
|
acceptNftBids({ bidIds }: AcceptNftBids): Promise<TransactionBlock>;
|
|
82
|
-
placeCollectionBid({ collectionId,
|
|
82
|
+
placeCollectionBid({ collectionId, bidAmountInMist, numOfBids, walletAddress, }: PlaceCollectionBid): Promise<TransactionBlock>;
|
|
83
83
|
acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<TransactionBlock>;
|
|
84
84
|
removeCollectionBid({ bidId }: RemoveCollectionBid): Promise<TransactionBlock>;
|
|
85
85
|
transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<TransactionBlock>;
|
package/dist/index.d.ts
CHANGED
|
@@ -23,14 +23,14 @@ type ClaimNfts = {
|
|
|
23
23
|
type ListNfts = {
|
|
24
24
|
nfts: Array<{
|
|
25
25
|
id: string;
|
|
26
|
-
|
|
26
|
+
listPriceInMist: number;
|
|
27
27
|
}>;
|
|
28
28
|
walletAddress: string;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
type PlaceCollectionBid = {
|
|
32
32
|
collectionId: string;
|
|
33
|
-
|
|
33
|
+
bidAmountInMist: number;
|
|
34
34
|
numOfBids: number;
|
|
35
35
|
walletAddress: string;
|
|
36
36
|
};
|
|
@@ -38,7 +38,7 @@ type PlaceCollectionBid = {
|
|
|
38
38
|
type PlaceNftBids = {
|
|
39
39
|
nfts: Array<{
|
|
40
40
|
id: string;
|
|
41
|
-
|
|
41
|
+
bidAmountInMist: number;
|
|
42
42
|
}>;
|
|
43
43
|
walletAddress: string;
|
|
44
44
|
};
|
|
@@ -79,7 +79,7 @@ declare class SuiTradingClient {
|
|
|
79
79
|
placeNftBids({ nfts, walletAddress }: PlaceNftBids): Promise<TransactionBlock>;
|
|
80
80
|
removeNftBids({ bidIds }: RemoveNftBids): Promise<TransactionBlock>;
|
|
81
81
|
acceptNftBids({ bidIds }: AcceptNftBids): Promise<TransactionBlock>;
|
|
82
|
-
placeCollectionBid({ collectionId,
|
|
82
|
+
placeCollectionBid({ collectionId, bidAmountInMist, numOfBids, walletAddress, }: PlaceCollectionBid): Promise<TransactionBlock>;
|
|
83
83
|
acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<TransactionBlock>;
|
|
84
84
|
removeCollectionBid({ bidId }: RemoveCollectionBid): Promise<TransactionBlock>;
|
|
85
85
|
transferNfts({ nftIds, recipientAddress, walletAddress }: TransferNfts): Promise<TransactionBlock>;
|
package/dist/index.js
CHANGED
|
@@ -2391,7 +2391,7 @@ var getDSLLegacyMarketFeePrice = (price) => {
|
|
|
2391
2391
|
10
|
|
2392
2392
|
);
|
|
2393
2393
|
};
|
|
2394
|
-
var getMarketFeePrice = ({ price, collectionId
|
|
2394
|
+
var getMarketFeePrice = ({ price, collectionId }) => {
|
|
2395
2395
|
if (collectionId === "6824e1ff-477e-4810-9ba7-8d6387b68c7d") {
|
|
2396
2396
|
return getBASCMarketFeePrice(price);
|
|
2397
2397
|
}
|
|
@@ -2411,9 +2411,6 @@ var getMarketFeePrice = ({ price, collectionId, walletId }) => {
|
|
|
2411
2411
|
return parseInt(marketFeePrice?.toFixed(0), 10);
|
|
2412
2412
|
};
|
|
2413
2413
|
|
|
2414
|
-
// src/utils/parseSUI.ts
|
|
2415
|
-
var parseSUI = (num) => parseInt((1e9 * num).toFixed(0), 10);
|
|
2416
|
-
|
|
2417
2414
|
// src/methods/listNfts/addListTxs.ts
|
|
2418
2415
|
async function addOriginByteListTx({
|
|
2419
2416
|
txBlock,
|
|
@@ -2439,18 +2436,13 @@ async function addOriginByteListTx({
|
|
|
2439
2436
|
nftType
|
|
2440
2437
|
});
|
|
2441
2438
|
}
|
|
2442
|
-
const
|
|
2443
|
-
const marketFeePrice = getMarketFeePrice({
|
|
2444
|
-
price: parsedListPrice,
|
|
2445
|
-
collectionId,
|
|
2446
|
-
walletId: seller
|
|
2447
|
-
});
|
|
2439
|
+
const marketFeePrice = getMarketFeePrice({ price: listPrice, collectionId });
|
|
2448
2440
|
txBlock.moveCall({
|
|
2449
2441
|
target: "0x8534e4cdfd28709c94330a9783c3d5fe6f5daba0bffb69102ce303c5b38aed5a::orderbook::create_ask_with_commission",
|
|
2450
2442
|
arguments: [
|
|
2451
2443
|
txBlock.object(orderbook),
|
|
2452
2444
|
txBlock.object(kiosk),
|
|
2453
|
-
txBlock.pure(
|
|
2445
|
+
txBlock.pure(listPrice),
|
|
2454
2446
|
txBlock.pure(nftTokenId),
|
|
2455
2447
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS),
|
|
2456
2448
|
txBlock.pure(marketFeePrice)
|
|
@@ -2467,21 +2459,15 @@ function addTradePortListTx({
|
|
|
2467
2459
|
borrowedItem,
|
|
2468
2460
|
nftType,
|
|
2469
2461
|
collectionId,
|
|
2470
|
-
listPrice
|
|
2471
|
-
seller
|
|
2462
|
+
listPrice
|
|
2472
2463
|
}) {
|
|
2473
|
-
const
|
|
2474
|
-
const marketFeePrice = getMarketFeePrice({
|
|
2475
|
-
price: parsedListPrice,
|
|
2476
|
-
collectionId,
|
|
2477
|
-
walletId: seller
|
|
2478
|
-
});
|
|
2464
|
+
const marketFeePrice = getMarketFeePrice({ price: listPrice, collectionId });
|
|
2479
2465
|
txBlock.moveCall({
|
|
2480
2466
|
target: "0xb42dbb7413b79394e1a0175af6ae22b69a5c7cc5df259cd78072b6818217c027::listings::list",
|
|
2481
2467
|
arguments: [
|
|
2482
2468
|
txBlock.object(TRADEPORT_LISTING_STORE),
|
|
2483
2469
|
borrowedItem ? txBlock.object(borrowedItem) : txBlock.pure(nftTokenId),
|
|
2484
|
-
txBlock.pure(
|
|
2470
|
+
txBlock.pure(listPrice),
|
|
2485
2471
|
txBlock.pure(marketFeePrice),
|
|
2486
2472
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS)
|
|
2487
2473
|
],
|
|
@@ -2494,15 +2480,9 @@ async function addTradePortKioskListTx({
|
|
|
2494
2480
|
nftTokenId,
|
|
2495
2481
|
nftType,
|
|
2496
2482
|
collectionId,
|
|
2497
|
-
listPrice
|
|
2498
|
-
seller
|
|
2483
|
+
listPrice
|
|
2499
2484
|
}) {
|
|
2500
|
-
const
|
|
2501
|
-
const marketFeePrice = getMarketFeePrice({
|
|
2502
|
-
price: parsedListPrice,
|
|
2503
|
-
collectionId,
|
|
2504
|
-
walletId: seller
|
|
2505
|
-
});
|
|
2485
|
+
const marketFeePrice = getMarketFeePrice({ price: listPrice, collectionId });
|
|
2506
2486
|
txBlock.moveCall({
|
|
2507
2487
|
target: "0x33a9e4a3089d911c2a2bf16157a1d6a4a8cbd9a2106a98ecbaefe6ed370d7a25::kiosk_listings::list",
|
|
2508
2488
|
arguments: [
|
|
@@ -2510,7 +2490,7 @@ async function addTradePortKioskListTx({
|
|
|
2510
2490
|
txBlock.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
2511
2491
|
txBlock.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
2512
2492
|
txBlock.pure(nftTokenId),
|
|
2513
|
-
txBlock.pure(
|
|
2493
|
+
txBlock.pure(listPrice + marketFeePrice),
|
|
2514
2494
|
txBlock.pure(marketFeePrice),
|
|
2515
2495
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS)
|
|
2516
2496
|
],
|
|
@@ -2575,21 +2555,15 @@ function addTradePortRelistTx({
|
|
|
2575
2555
|
nftType,
|
|
2576
2556
|
collectionId,
|
|
2577
2557
|
listingNonce,
|
|
2578
|
-
listPrice
|
|
2579
|
-
seller
|
|
2558
|
+
listPrice
|
|
2580
2559
|
}) {
|
|
2581
|
-
const
|
|
2582
|
-
const marketFeePrice = getMarketFeePrice({
|
|
2583
|
-
price: parsedListPrice,
|
|
2584
|
-
collectionId,
|
|
2585
|
-
walletId: seller
|
|
2586
|
-
});
|
|
2560
|
+
const marketFeePrice = getMarketFeePrice({ price: listPrice, collectionId });
|
|
2587
2561
|
txBlock.moveCall({
|
|
2588
2562
|
target: "0xb42dbb7413b79394e1a0175af6ae22b69a5c7cc5df259cd78072b6818217c027::listings::relist",
|
|
2589
2563
|
arguments: [
|
|
2590
2564
|
txBlock.object(TRADEPORT_LISTING_STORE),
|
|
2591
2565
|
txBlock.pure(listingNonce),
|
|
2592
|
-
txBlock.pure(
|
|
2566
|
+
txBlock.pure(listPrice),
|
|
2593
2567
|
txBlock.pure(marketFeePrice),
|
|
2594
2568
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS)
|
|
2595
2569
|
],
|
|
@@ -2701,7 +2675,7 @@ var listNfts = async ({ nfts, walletAddress }) => {
|
|
|
2701
2675
|
txBlock,
|
|
2702
2676
|
sharedObjects,
|
|
2703
2677
|
nft,
|
|
2704
|
-
listPrice: nfts?.find((n) => n.id === nft?.id)?.
|
|
2678
|
+
listPrice: nfts?.find((n) => n.id === nft?.id)?.listPriceInMist,
|
|
2705
2679
|
walletAddress
|
|
2706
2680
|
});
|
|
2707
2681
|
} else {
|
|
@@ -2712,7 +2686,7 @@ var listNfts = async ({ nfts, walletAddress }) => {
|
|
|
2712
2686
|
collectionId: nft?.collection_id,
|
|
2713
2687
|
nftTokenId: nft?.token_id,
|
|
2714
2688
|
nftType: getNftTypeFromNft(nft),
|
|
2715
|
-
listPrice: nfts?.find((n) => n.id === nft?.id)?.
|
|
2689
|
+
listPrice: nfts?.find((n) => n.id === nft?.id)?.listPriceInMist,
|
|
2716
2690
|
sellerKiosk: nft?.chain_state?.kiosk_id
|
|
2717
2691
|
};
|
|
2718
2692
|
await addTradePortListTxHandler(listTxData);
|
|
@@ -2754,8 +2728,8 @@ var fetchCollectionsByIdWithOneNft = import_graphql_request14.gql`
|
|
|
2754
2728
|
}
|
|
2755
2729
|
`;
|
|
2756
2730
|
|
|
2757
|
-
// src/helpers/
|
|
2758
|
-
var
|
|
2731
|
+
// src/helpers/getTradeportBiddingContractBidAmount.ts
|
|
2732
|
+
var getTradeportBiddingContractBidAmount = ({ bidAmount, collectionId }) => {
|
|
2759
2733
|
let amount = bidAmount;
|
|
2760
2734
|
if (collectionId === "8568521c-73a3-4beb-b830-d1ff27a3f1ca") {
|
|
2761
2735
|
amount = bidAmount - bidAmount * MASC_ROYALTY_DECIMAL_PERCENT;
|
|
@@ -2766,7 +2740,7 @@ var getTradeportBiddingContractParsedBidAmount = ({ bidAmount, collectionId }) =
|
|
|
2766
2740
|
if (collectionId === "307c7e7a-be3a-43a5-ae44-37f3a37d01f9") {
|
|
2767
2741
|
amount = bidAmount - bidAmount * DSL_LEGACY_ROYALTY_DECIMAL_PERCENT;
|
|
2768
2742
|
}
|
|
2769
|
-
return
|
|
2743
|
+
return amount;
|
|
2770
2744
|
};
|
|
2771
2745
|
|
|
2772
2746
|
// src/helpers/hasRoyaltyRule.ts
|
|
@@ -2785,21 +2759,16 @@ function addTradePortCollectionBidTx({
|
|
|
2785
2759
|
txBlock,
|
|
2786
2760
|
collectionId,
|
|
2787
2761
|
nftType,
|
|
2788
|
-
bidAmount
|
|
2789
|
-
bidder
|
|
2762
|
+
bidAmount
|
|
2790
2763
|
}) {
|
|
2791
|
-
const
|
|
2792
|
-
const marketFeePrice = getMarketFeePrice({
|
|
2793
|
-
|
|
2794
|
-
collectionId,
|
|
2795
|
-
walletId: bidder
|
|
2796
|
-
});
|
|
2797
|
-
const [coin] = splitCoins({ txBlock, amounts: [txBlock.pure(parsedBidAmount + marketFeePrice)] });
|
|
2764
|
+
const amountToBid = getTradeportBiddingContractBidAmount({ bidAmount, collectionId });
|
|
2765
|
+
const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
|
|
2766
|
+
const [coin] = splitCoins({ txBlock, amounts: [txBlock.pure(amountToBid + marketFeePrice)] });
|
|
2798
2767
|
txBlock.moveCall({
|
|
2799
2768
|
target: "0xb42dbb7413b79394e1a0175af6ae22b69a5c7cc5df259cd78072b6818217c027::biddings::collection_bid",
|
|
2800
2769
|
arguments: [
|
|
2801
2770
|
txBlock.object(TRADEPORT_BIDDING_STORE),
|
|
2802
|
-
txBlock.pure(
|
|
2771
|
+
txBlock.pure(amountToBid),
|
|
2803
2772
|
txBlock.object(coin),
|
|
2804
2773
|
txBlock.pure(marketFeePrice),
|
|
2805
2774
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS)
|
|
@@ -2819,20 +2788,15 @@ function addTradePortKioskCollectionBidTx({
|
|
|
2819
2788
|
royaltyRuleModule
|
|
2820
2789
|
}) {
|
|
2821
2790
|
const { transferPolicy } = sharedObjects;
|
|
2822
|
-
const
|
|
2823
|
-
const marketFeePrice = getMarketFeePrice({
|
|
2824
|
-
price: parsedBidAmount,
|
|
2825
|
-
collectionId,
|
|
2826
|
-
walletId: bidder
|
|
2827
|
-
});
|
|
2791
|
+
const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
|
|
2828
2792
|
const fee = txBlock.moveCall({
|
|
2829
2793
|
target: `${royaltyRulePackageId}::${royaltyRuleModule}::fee_amount`,
|
|
2830
|
-
arguments: [txBlock.object(transferPolicy), txBlock.pure(
|
|
2794
|
+
arguments: [txBlock.object(transferPolicy), txBlock.pure(bidAmount)],
|
|
2831
2795
|
typeArguments: [nftType]
|
|
2832
2796
|
});
|
|
2833
2797
|
const [coin1, coin2] = splitCoins({
|
|
2834
2798
|
txBlock,
|
|
2835
|
-
amounts: [txBlock.pure(
|
|
2799
|
+
amounts: [txBlock.pure(bidAmount + marketFeePrice), txBlock.object(fee)]
|
|
2836
2800
|
});
|
|
2837
2801
|
if (!coin1 || !coin2)
|
|
2838
2802
|
throw new Error("Coin could not be split");
|
|
@@ -2841,7 +2805,7 @@ function addTradePortKioskCollectionBidTx({
|
|
|
2841
2805
|
target: "0x33a9e4a3089d911c2a2bf16157a1d6a4a8cbd9a2106a98ecbaefe6ed370d7a25::kiosk_biddings::collection_bid",
|
|
2842
2806
|
arguments: [
|
|
2843
2807
|
txBlock.object(TRADEPORT_KIOSK_BIDDING_STORE),
|
|
2844
|
-
txBlock.pure(
|
|
2808
|
+
txBlock.pure(bidAmount),
|
|
2845
2809
|
txBlock.object(coin1),
|
|
2846
2810
|
txBlock.pure(marketFeePrice),
|
|
2847
2811
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS)
|
|
@@ -2855,24 +2819,18 @@ async function addOriginByteCollectionBidTx({
|
|
|
2855
2819
|
collectionId,
|
|
2856
2820
|
nftType,
|
|
2857
2821
|
bidAmount,
|
|
2858
|
-
bidder,
|
|
2859
2822
|
sharedObjects,
|
|
2860
2823
|
bidderKiosk
|
|
2861
2824
|
}) {
|
|
2862
2825
|
const { orderbook } = sharedObjects;
|
|
2863
|
-
const
|
|
2864
|
-
const
|
|
2865
|
-
price: parsedBidAmount,
|
|
2866
|
-
collectionId,
|
|
2867
|
-
walletId: bidder
|
|
2868
|
-
});
|
|
2869
|
-
const [coin] = splitCoins({ txBlock, amounts: [txBlock.pure(parsedBidAmount + marketFeePrice)] });
|
|
2826
|
+
const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
|
|
2827
|
+
const [coin] = splitCoins({ txBlock, amounts: [txBlock.pure(bidAmount + marketFeePrice)] });
|
|
2870
2828
|
txBlock.moveCall({
|
|
2871
2829
|
target: "0x8534e4cdfd28709c94330a9783c3d5fe6f5daba0bffb69102ce303c5b38aed5a::orderbook::create_bid_with_commission",
|
|
2872
2830
|
arguments: [
|
|
2873
2831
|
txBlock.object(orderbook),
|
|
2874
2832
|
txBlock.object(bidderKiosk),
|
|
2875
|
-
txBlock.pure(
|
|
2833
|
+
txBlock.pure(bidAmount),
|
|
2876
2834
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS),
|
|
2877
2835
|
txBlock.pure(marketFeePrice),
|
|
2878
2836
|
txBlock.object(coin)
|
|
@@ -2929,7 +2887,7 @@ var placeCollectionBids = async ({
|
|
|
2929
2887
|
bidder: walletAddress,
|
|
2930
2888
|
collectionId: collection?.id,
|
|
2931
2889
|
nftType,
|
|
2932
|
-
bidAmount: collections?.find((c) => c.id === collection?.id)?.
|
|
2890
|
+
bidAmount: collections?.find((c) => c.id === collection?.id)?.bidAmountInMist
|
|
2933
2891
|
};
|
|
2934
2892
|
const numOfBids = collections?.find((c) => c.id === collection?.id)?.numOfBids;
|
|
2935
2893
|
if (isOriginByteTx(txData?.sharedObjects)) {
|
|
@@ -2961,22 +2919,17 @@ function addTradePortPlaceNftBidTx({
|
|
|
2961
2919
|
collectionId,
|
|
2962
2920
|
nftTokenId,
|
|
2963
2921
|
nftType,
|
|
2964
|
-
bidAmount
|
|
2965
|
-
bidder
|
|
2922
|
+
bidAmount
|
|
2966
2923
|
}) {
|
|
2967
|
-
const
|
|
2968
|
-
const marketFeePrice = getMarketFeePrice({
|
|
2969
|
-
|
|
2970
|
-
collectionId,
|
|
2971
|
-
walletId: bidder
|
|
2972
|
-
});
|
|
2973
|
-
const [coin] = splitCoins({ txBlock, amounts: [txBlock.pure(parsedBidAmount + marketFeePrice)] });
|
|
2924
|
+
const amountToBid = getTradeportBiddingContractBidAmount({ bidAmount, collectionId });
|
|
2925
|
+
const marketFeePrice = getMarketFeePrice({ price: amountToBid, collectionId });
|
|
2926
|
+
const [coin] = splitCoins({ txBlock, amounts: [txBlock.pure(amountToBid + marketFeePrice)] });
|
|
2974
2927
|
txBlock.moveCall({
|
|
2975
2928
|
target: "0x398aae1ad267d989dcc99ba449b0a30101a6b851ec1284ccddab5937df66bfcf::biddings::bid",
|
|
2976
2929
|
arguments: [
|
|
2977
2930
|
txBlock.object(TRADEPORT_BIDDING_STORE),
|
|
2978
2931
|
txBlock.pure(nftTokenId),
|
|
2979
|
-
txBlock.pure(
|
|
2932
|
+
txBlock.pure(amountToBid),
|
|
2980
2933
|
txBlock.object(coin),
|
|
2981
2934
|
txBlock.pure(marketFeePrice),
|
|
2982
2935
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS)
|
|
@@ -2992,20 +2945,18 @@ function addTradePortKioskPlaceNftBidTx({
|
|
|
2992
2945
|
nftTokenId,
|
|
2993
2946
|
nftType,
|
|
2994
2947
|
bidAmount,
|
|
2995
|
-
bidder,
|
|
2996
2948
|
royaltyRulePackageId
|
|
2997
2949
|
}) {
|
|
2998
2950
|
const { transferPolicy } = sharedObjects;
|
|
2999
|
-
const
|
|
3000
|
-
const marketFeePrice = getMarketFeePrice({ price: bidPrice, collectionId, walletId: bidder });
|
|
2951
|
+
const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
|
|
3001
2952
|
const royaltyCoin = txBlock.moveCall({
|
|
3002
2953
|
target: `${royaltyRulePackageId}::royalty_rule::fee_amount`,
|
|
3003
|
-
arguments: [txBlock.object(transferPolicy), txBlock.pure(
|
|
2954
|
+
arguments: [txBlock.object(transferPolicy), txBlock.pure(bidAmount?.toString())],
|
|
3004
2955
|
typeArguments: [nftType]
|
|
3005
2956
|
});
|
|
3006
2957
|
const [coin1, coin2] = splitCoins({
|
|
3007
2958
|
txBlock,
|
|
3008
|
-
amounts: [txBlock.pure(
|
|
2959
|
+
amounts: [txBlock.pure(bidAmount + marketFeePrice), txBlock.object(royaltyCoin)]
|
|
3009
2960
|
});
|
|
3010
2961
|
txBlock.mergeCoins(txBlock.object(coin1), [txBlock.object(coin2)]);
|
|
3011
2962
|
txBlock.moveCall({
|
|
@@ -3013,7 +2964,7 @@ function addTradePortKioskPlaceNftBidTx({
|
|
|
3013
2964
|
arguments: [
|
|
3014
2965
|
txBlock.object(TRADEPORT_KIOSK_BIDDING_STORE),
|
|
3015
2966
|
txBlock.pure(nftTokenId),
|
|
3016
|
-
txBlock.pure(
|
|
2967
|
+
txBlock.pure(bidAmount),
|
|
3017
2968
|
txBlock.object(coin1),
|
|
3018
2969
|
txBlock.pure(marketFeePrice),
|
|
3019
2970
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS)
|
|
@@ -3034,19 +2985,14 @@ async function addOriginBytePlaceNftBidTx({
|
|
|
3034
2985
|
address: bidder,
|
|
3035
2986
|
createMethod: "create_for_sender"
|
|
3036
2987
|
});
|
|
3037
|
-
const
|
|
3038
|
-
const
|
|
3039
|
-
price: parsedBidAmount,
|
|
3040
|
-
collectionId,
|
|
3041
|
-
walletId: bidder
|
|
3042
|
-
});
|
|
3043
|
-
const [coin] = splitCoins({ txBlock, amounts: [txBlock.pure(parsedBidAmount + marketFeePrice)] });
|
|
2988
|
+
const marketFeePrice = getMarketFeePrice({ price: bidAmount, collectionId });
|
|
2989
|
+
const [coin] = splitCoins({ txBlock, amounts: [txBlock.pure(bidAmount + marketFeePrice)] });
|
|
3044
2990
|
txBlock.moveCall({
|
|
3045
2991
|
target: "0x8534e4cdfd28709c94330a9783c3d5fe6f5daba0bffb69102ce303c5b38aed5a::bidding::create_bid_with_commission",
|
|
3046
2992
|
arguments: [
|
|
3047
2993
|
isNewBidderKiosk ? txBlock.object(bidderKiosk) : txBlock.pure(bidderKiosk),
|
|
3048
2994
|
txBlock.pure(nftTokenId),
|
|
3049
|
-
txBlock.pure(
|
|
2995
|
+
txBlock.pure(bidAmount),
|
|
3050
2996
|
txBlock.pure(TRADEPORT_BENEFICIARY_ADDRESS),
|
|
3051
2997
|
txBlock.pure(marketFeePrice),
|
|
3052
2998
|
txBlock.object(coin)
|
|
@@ -3093,7 +3039,7 @@ var placeNftBids = async ({
|
|
|
3093
3039
|
collectionId: nft?.collection_id,
|
|
3094
3040
|
nftTokenId: nft?.token_id,
|
|
3095
3041
|
nftType: nft?.properties?.nft_type || nft?.contract?.properties?.nft_type,
|
|
3096
|
-
bidAmount: nfts?.find((n) => n.id === nft?.id)?.
|
|
3042
|
+
bidAmount: nfts?.find((n) => n.id === nft?.id)?.bidAmountInMist,
|
|
3097
3043
|
sellerKiosk: nft?.chain_state?.kiosk_id
|
|
3098
3044
|
};
|
|
3099
3045
|
await addTradePortPlaceNftBidTxHandler(txData);
|
|
@@ -3679,7 +3625,7 @@ var SuiTradingClient = class {
|
|
|
3679
3625
|
}
|
|
3680
3626
|
async placeCollectionBid({
|
|
3681
3627
|
collectionId,
|
|
3682
|
-
|
|
3628
|
+
bidAmountInMist,
|
|
3683
3629
|
numOfBids,
|
|
3684
3630
|
walletAddress
|
|
3685
3631
|
}) {
|
|
@@ -3687,7 +3633,7 @@ var SuiTradingClient = class {
|
|
|
3687
3633
|
collections: [
|
|
3688
3634
|
{
|
|
3689
3635
|
id: collectionId,
|
|
3690
|
-
|
|
3636
|
+
bidAmountInMist,
|
|
3691
3637
|
numOfBids
|
|
3692
3638
|
}
|
|
3693
3639
|
],
|