@tradeport/sui-trading-sdk 0.4.4 → 0.4.6
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 +12 -0
- package/dist/index.js +42 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts +5 -1
- package/src/methods/acceptNftBids/addAcceptNftBidTxs.ts +6 -3
- package/src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts +11 -7
- package/src/methods/removeCollectionBids/removeCollectionBids.ts +2 -0
- package/src/methods/removeNftBids/addRemoveNftBidTxs.ts +6 -2
package/dist/index.mjs
CHANGED
|
@@ -2002,7 +2002,7 @@ var isSingleBid = (bidType) => {
|
|
|
2002
2002
|
};
|
|
2003
2003
|
|
|
2004
2004
|
// src/methods/acceptNftBids/addAcceptNftBidTxs.ts
|
|
2005
|
-
import { normalizeStructTag, SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2005
|
+
import { normalizeStructTag, normalizeSuiObjectId, SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils";
|
|
2006
2006
|
|
|
2007
2007
|
// src/graphql/queries/fetchMultibidById.ts
|
|
2008
2008
|
import { gql as gql11 } from "graphql-request";
|
|
@@ -2240,7 +2240,7 @@ async function addSingleBidAcceptNftBidTx(txData) {
|
|
|
2240
2240
|
arguments: [
|
|
2241
2241
|
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
2242
2242
|
tx.object(TRADEPORT_MULTI_BID_STORE),
|
|
2243
|
-
tx.pure.id(bidNonce),
|
|
2243
|
+
tx.pure.id(normalizeSuiObjectId(bidNonce)),
|
|
2244
2244
|
tx.pure.option("id", multiBidChainId),
|
|
2245
2245
|
tx.object(kioskTx.getKiosk()),
|
|
2246
2246
|
tx.object(kioskTx.getKioskCap()),
|
|
@@ -2269,7 +2269,10 @@ async function addSingleBidAcceptNftBidTx(txData) {
|
|
|
2269
2269
|
});
|
|
2270
2270
|
}
|
|
2271
2271
|
async function addTradePortAcceptNftBidTxHandler(txData) {
|
|
2272
|
-
const bidType = await getObjectType({
|
|
2272
|
+
const bidType = await getObjectType({
|
|
2273
|
+
suiClient: txData?.suiClient,
|
|
2274
|
+
objectId: normalizeSuiObjectId(txData?.bidNonce)
|
|
2275
|
+
});
|
|
2273
2276
|
if (isSingleBid(bidType)) {
|
|
2274
2277
|
await addSingleBidAcceptNftBidTx(txData);
|
|
2275
2278
|
return;
|
|
@@ -2537,6 +2540,7 @@ function addTocenUnlistTxHandler(txData) {
|
|
|
2537
2540
|
}
|
|
2538
2541
|
|
|
2539
2542
|
// src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts
|
|
2543
|
+
import { normalizeSuiObjectId as normalizeSuiObjectId2 } from "@mysten/sui/utils";
|
|
2540
2544
|
function addTradeportAcceptCollectionBidTx({
|
|
2541
2545
|
tx,
|
|
2542
2546
|
sharedObjects,
|
|
@@ -2703,7 +2707,10 @@ function addTocenAcceptCollectionBidTx({
|
|
|
2703
2707
|
});
|
|
2704
2708
|
}
|
|
2705
2709
|
async function addTradePortAcceptCollectionBidTxHandler(txData) {
|
|
2706
|
-
const bidType = await getObjectType({
|
|
2710
|
+
const bidType = await getObjectType({
|
|
2711
|
+
suiClient: txData?.suiClient,
|
|
2712
|
+
objectId: normalizeSuiObjectId2(txData?.bidNonce)
|
|
2713
|
+
});
|
|
2707
2714
|
if (isSingleBid(bidType)) {
|
|
2708
2715
|
await addSingleBidAcceptNftBidTx(txData);
|
|
2709
2716
|
return;
|
|
@@ -5607,7 +5614,7 @@ var fetchCollectionsBySlug = gql19`
|
|
|
5607
5614
|
`;
|
|
5608
5615
|
|
|
5609
5616
|
// src/methods/placeNftBids/addPlaceNftBidTxs.ts
|
|
5610
|
-
import { fromHex, normalizeSuiObjectId } from "@mysten/sui/utils";
|
|
5617
|
+
import { fromHex, normalizeSuiObjectId as normalizeSuiObjectId3 } from "@mysten/sui/utils";
|
|
5611
5618
|
async function addTradePortPlaceNftBidTxHandler(txData) {
|
|
5612
5619
|
if (isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
|
|
5613
5620
|
throw new Error("OriginByte bidding not supported currently");
|
|
@@ -5667,12 +5674,12 @@ async function addTradePortPlaceNftBidTxHandler(txData) {
|
|
|
5667
5674
|
arguments: [
|
|
5668
5675
|
tx.object(TRADEPORT_MULTI_BID_STORE),
|
|
5669
5676
|
tx.pure.u64(nftTokenId ? 1 : 0),
|
|
5670
|
-
multiBidChainId ? typeof multiBidChainId === "string" ? tx.pure.option("id",
|
|
5677
|
+
multiBidChainId ? typeof multiBidChainId === "string" ? tx.pure.option("id", normalizeSuiObjectId3(multiBidChainId)) : tx.moveCall({
|
|
5671
5678
|
target: "0x1::option::some",
|
|
5672
5679
|
typeArguments: ["0x2::object::ID"],
|
|
5673
5680
|
arguments: [multiBidChainId]
|
|
5674
5681
|
}) : void 0,
|
|
5675
|
-
tx.pure.option("id", nftTokenId ?
|
|
5682
|
+
tx.pure.option("id", nftTokenId ? normalizeSuiObjectId3(nftTokenId) : void 0),
|
|
5676
5683
|
tx.pure.option("vector<u8>", bcs3 ? [...bcs3] : void 0),
|
|
5677
5684
|
tx.pure.option("u64", expireAt?.getTime()),
|
|
5678
5685
|
tx.pure.u64(price),
|
|
@@ -5870,7 +5877,11 @@ var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx
|
|
|
5870
5877
|
// src/methods/removeCollectionBids/removeCollectionBids.ts
|
|
5871
5878
|
import { Transaction as Transaction22 } from "@mysten/sui/transactions";
|
|
5872
5879
|
|
|
5880
|
+
// src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts
|
|
5881
|
+
import { normalizeSuiObjectId as normalizeSuiObjectId5 } from "@mysten/sui/utils";
|
|
5882
|
+
|
|
5873
5883
|
// src/methods/removeNftBids/addRemoveNftBidTxs.ts
|
|
5884
|
+
import { normalizeSuiObjectId as normalizeSuiObjectId4 } from "@mysten/sui/utils";
|
|
5874
5885
|
function addTradeportRemoveNftBidTx({ tx, bidNonce, nftType }) {
|
|
5875
5886
|
tx.moveCall({
|
|
5876
5887
|
target: "0xb42dbb7413b79394e1a0175af6ae22b69a5c7cc5df259cd78072b6818217c027::biddings::cancel_bid",
|
|
@@ -5924,13 +5935,16 @@ async function addSingleBidRemoveNftBidTx({ tx, bidNonce, multiBidId }) {
|
|
|
5924
5935
|
target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::cancel_bid`,
|
|
5925
5936
|
arguments: [
|
|
5926
5937
|
tx.object(TRADEPORT_MULTI_BID_STORE),
|
|
5927
|
-
tx.pure.id(bidNonce),
|
|
5938
|
+
tx.pure.id(normalizeSuiObjectId4(bidNonce)),
|
|
5928
5939
|
tx.pure.option("id", multiBidChainId)
|
|
5929
5940
|
]
|
|
5930
5941
|
});
|
|
5931
5942
|
}
|
|
5932
5943
|
async function addTradePortRemoveNftBidTxHandler(txData) {
|
|
5933
|
-
const bidType = await getObjectType({
|
|
5944
|
+
const bidType = await getObjectType({
|
|
5945
|
+
suiClient: txData?.suiClient,
|
|
5946
|
+
objectId: normalizeSuiObjectId4(txData?.bidNonce)
|
|
5947
|
+
});
|
|
5934
5948
|
if (isSingleBid(bidType)) {
|
|
5935
5949
|
await addSingleBidRemoveNftBidTx(txData);
|
|
5936
5950
|
return;
|
|
@@ -6002,8 +6016,12 @@ function addBluemoveKioskRemoveCollectionBidTx({
|
|
|
6002
6016
|
async function addTradePortRemoveCollectionBidTxHandler(txData) {
|
|
6003
6017
|
const bidType = await getObjectType({
|
|
6004
6018
|
suiClient: txData?.suiClient,
|
|
6005
|
-
objectId: txData?.bidNonce
|
|
6019
|
+
objectId: normalizeSuiObjectId5(txData?.bidNonce)
|
|
6006
6020
|
});
|
|
6021
|
+
if (isSingleBid(bidType)) {
|
|
6022
|
+
await addSingleBidRemoveNftBidTx(txData);
|
|
6023
|
+
return;
|
|
6024
|
+
}
|
|
6007
6025
|
if (isOriginByteBid(bidType)) {
|
|
6008
6026
|
const sharedObjects = await getSharedObjects(txData?.nftType);
|
|
6009
6027
|
addOriginByteRemoveCollectionBidTx({ ...txData, sharedObjects });
|
|
@@ -6016,11 +6034,10 @@ async function addTradePortRemoveCollectionBidTxHandler(txData) {
|
|
|
6016
6034
|
addTradeportRemoveCollectionBidTx(txData);
|
|
6017
6035
|
}
|
|
6018
6036
|
async function addBluemoveRemoveCollectionBidTxHandler(txData) {
|
|
6019
|
-
const bidType = await getObjectType({
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
}
|
|
6037
|
+
const bidType = await getObjectType({
|
|
6038
|
+
suiClient: txData?.suiClient,
|
|
6039
|
+
objectId: normalizeSuiObjectId5(txData?.bidNonce)
|
|
6040
|
+
});
|
|
6024
6041
|
if (isOriginByteBid(bidType)) {
|
|
6025
6042
|
const sharedObjects = await getSharedObjects(txData?.nftType);
|
|
6026
6043
|
addOriginByteRemoveCollectionBidTx({ ...txData, sharedObjects });
|
|
@@ -6072,7 +6089,8 @@ var removeCollectionBids = async ({ bidIds, tx: existingTx }, context) => {
|
|
|
6072
6089
|
nftTokenId: bid?.nft?.token_id,
|
|
6073
6090
|
bidAmount: bid?.price,
|
|
6074
6091
|
sellerKiosk: bid?.nft?.chain_state?.kiosk_id,
|
|
6075
|
-
bidMarketName: bid?.market_contract?.name
|
|
6092
|
+
bidMarketName: bid?.market_contract?.name,
|
|
6093
|
+
multiBidId: bid?.multi_bid_id
|
|
6076
6094
|
};
|
|
6077
6095
|
switch (txData.bidMarketName) {
|
|
6078
6096
|
case "tradeport":
|