@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/package.json
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
import { addOriginByteUnlistTx } from '../unlistListings/addUnlistListingTxs';
|
|
33
33
|
import { type AcceptCollectionBidTx } from './acceptCollectionBid';
|
|
34
34
|
import { isSingleBid } from '../../helpers/isSIngleBid';
|
|
35
|
+
import { normalizeSuiObjectId } from '@mysten/sui/utils';
|
|
35
36
|
|
|
36
37
|
export function addTradeportAcceptCollectionBidTx({
|
|
37
38
|
tx,
|
|
@@ -230,7 +231,10 @@ export function addTocenAcceptCollectionBidTx({
|
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
export async function addTradePortAcceptCollectionBidTxHandler(txData: AcceptCollectionBidTx) {
|
|
233
|
-
const bidType = await getObjectType({
|
|
234
|
+
const bidType = await getObjectType({
|
|
235
|
+
suiClient: txData?.suiClient,
|
|
236
|
+
objectId: normalizeSuiObjectId(txData?.bidNonce),
|
|
237
|
+
});
|
|
234
238
|
|
|
235
239
|
if (isSingleBid(bidType)) {
|
|
236
240
|
await addSingleBidAcceptNftBidTx(txData);
|
|
@@ -29,7 +29,7 @@ import { getObjectType } from '../../helpers/rpc/getObjectType';
|
|
|
29
29
|
import { addLeadingZerosAfter0x } from '../../utils/addLeadingZerosAfter0x';
|
|
30
30
|
import { type AcceptNftBidTx } from './acceptNftBids';
|
|
31
31
|
import { isSingleBid } from '../../helpers/isSIngleBid';
|
|
32
|
-
import { normalizeStructTag, SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils';
|
|
32
|
+
import { normalizeStructTag, normalizeSuiObjectId, SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils';
|
|
33
33
|
import { gqlChainRequest } from '../../graphql/gqlChainRequest';
|
|
34
34
|
import { fetchMultibidChainIdById } from '../../graphql/queries/fetchMultibidById';
|
|
35
35
|
|
|
@@ -291,7 +291,7 @@ export async function addSingleBidAcceptNftBidTx(txData: AcceptNftBidTx) {
|
|
|
291
291
|
arguments: [
|
|
292
292
|
tx.object(SUI_CLOCK_OBJECT_ID),
|
|
293
293
|
tx.object(TRADEPORT_MULTI_BID_STORE),
|
|
294
|
-
tx.pure.id(bidNonce),
|
|
294
|
+
tx.pure.id(normalizeSuiObjectId(bidNonce)),
|
|
295
295
|
tx.pure.option('id', multiBidChainId),
|
|
296
296
|
tx.object(kioskTx.getKiosk() as any),
|
|
297
297
|
tx.object(kioskTx.getKioskCap() as any),
|
|
@@ -324,7 +324,10 @@ export async function addSingleBidAcceptNftBidTx(txData: AcceptNftBidTx) {
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
export async function addTradePortAcceptNftBidTxHandler(txData: AcceptNftBidTx) {
|
|
327
|
-
const bidType = await getObjectType({
|
|
327
|
+
const bidType = await getObjectType({
|
|
328
|
+
suiClient: txData?.suiClient,
|
|
329
|
+
objectId: normalizeSuiObjectId(txData?.bidNonce),
|
|
330
|
+
});
|
|
328
331
|
|
|
329
332
|
if (isSingleBid(bidType)) {
|
|
330
333
|
await addSingleBidAcceptNftBidTx(txData);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeSuiObjectId } from '@mysten/sui/utils';
|
|
1
2
|
import {
|
|
2
3
|
BLUEMOVE_KIOSK_OFFER_COLLECTION_DATA_OBJECT,
|
|
3
4
|
BLUEMOVE_OFFER_COLLECTION_DATA_OBJECT,
|
|
@@ -83,9 +84,14 @@ export function addBluemoveKioskRemoveCollectionBidTx({
|
|
|
83
84
|
export async function addTradePortRemoveCollectionBidTxHandler(txData: RemoveCollectionBidTx) {
|
|
84
85
|
const bidType = await getObjectType({
|
|
85
86
|
suiClient: txData?.suiClient,
|
|
86
|
-
objectId: txData?.bidNonce,
|
|
87
|
+
objectId: normalizeSuiObjectId(txData?.bidNonce),
|
|
87
88
|
});
|
|
88
89
|
|
|
90
|
+
if (isSingleBid(bidType)) {
|
|
91
|
+
await addSingleBidRemoveNftBidTx(txData);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
if (isOriginByteBid(bidType)) {
|
|
90
96
|
const sharedObjects = await getSharedObjects(txData?.nftType);
|
|
91
97
|
addOriginByteRemoveCollectionBidTx({ ...txData, sharedObjects });
|
|
@@ -101,12 +107,10 @@ export async function addTradePortRemoveCollectionBidTxHandler(txData: RemoveCol
|
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
export async function addBluemoveRemoveCollectionBidTxHandler(txData: RemoveCollectionBidTx) {
|
|
104
|
-
const bidType = await getObjectType({
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
+
const bidType = await getObjectType({
|
|
111
|
+
suiClient: txData?.suiClient,
|
|
112
|
+
objectId: normalizeSuiObjectId(txData?.bidNonce),
|
|
113
|
+
});
|
|
110
114
|
|
|
111
115
|
if (isOriginByteBid(bidType)) {
|
|
112
116
|
const sharedObjects = await getSharedObjects(txData?.nftType);
|
|
@@ -26,6 +26,7 @@ export type RemoveCollectionBidTx = {
|
|
|
26
26
|
bidAmount: number;
|
|
27
27
|
sellerKiosk: string;
|
|
28
28
|
bidMarketName: string;
|
|
29
|
+
multiBidId?: string;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export type RemoveCollectionBids = {
|
|
@@ -77,6 +78,7 @@ export const removeCollectionBids = async (
|
|
|
77
78
|
bidAmount: bid?.price,
|
|
78
79
|
sellerKiosk: bid?.nft?.chain_state?.kiosk_id,
|
|
79
80
|
bidMarketName: bid?.market_contract?.name,
|
|
81
|
+
multiBidId: bid?.multi_bid_id,
|
|
80
82
|
};
|
|
81
83
|
|
|
82
84
|
switch (txData.bidMarketName) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeSuiObjectId } from '@mysten/sui/utils';
|
|
1
2
|
import {
|
|
2
3
|
BLUEMOVE_OFFER_DATA_OBJECT,
|
|
3
4
|
TOCEN_MARKETPLACE_OBJECT,
|
|
@@ -81,14 +82,17 @@ export async function addSingleBidRemoveNftBidTx({ tx, bidNonce, multiBidId }: R
|
|
|
81
82
|
target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::cancel_bid`,
|
|
82
83
|
arguments: [
|
|
83
84
|
tx.object(TRADEPORT_MULTI_BID_STORE),
|
|
84
|
-
tx.pure.id(bidNonce),
|
|
85
|
+
tx.pure.id(normalizeSuiObjectId(bidNonce)),
|
|
85
86
|
tx.pure.option('id', multiBidChainId),
|
|
86
87
|
],
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
export async function addTradePortRemoveNftBidTxHandler(txData: RemoveNftBidTx) {
|
|
91
|
-
const bidType = await getObjectType({
|
|
92
|
+
const bidType = await getObjectType({
|
|
93
|
+
suiClient: txData?.suiClient,
|
|
94
|
+
objectId: normalizeSuiObjectId(txData?.bidNonce),
|
|
95
|
+
});
|
|
92
96
|
|
|
93
97
|
if (isSingleBid(bidType)) {
|
|
94
98
|
await addSingleBidRemoveNftBidTx(txData);
|