@tradeport/sui-trading-sdk 0.4.4 → 0.4.5
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 +6 -0
- package/dist/index.js +40 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -15
- 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/removeNftBids/addRemoveNftBidTxs.ts +6 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2264,7 +2264,7 @@ async function addSingleBidAcceptNftBidTx(txData) {
|
|
|
2264
2264
|
arguments: [
|
|
2265
2265
|
tx.object(import_utils2.SUI_CLOCK_OBJECT_ID),
|
|
2266
2266
|
tx.object(TRADEPORT_MULTI_BID_STORE),
|
|
2267
|
-
tx.pure.id(bidNonce),
|
|
2267
|
+
tx.pure.id((0, import_utils2.normalizeSuiObjectId)(bidNonce)),
|
|
2268
2268
|
tx.pure.option("id", multiBidChainId),
|
|
2269
2269
|
tx.object(kioskTx.getKiosk()),
|
|
2270
2270
|
tx.object(kioskTx.getKioskCap()),
|
|
@@ -2293,7 +2293,10 @@ async function addSingleBidAcceptNftBidTx(txData) {
|
|
|
2293
2293
|
});
|
|
2294
2294
|
}
|
|
2295
2295
|
async function addTradePortAcceptNftBidTxHandler(txData) {
|
|
2296
|
-
const bidType = await getObjectType({
|
|
2296
|
+
const bidType = await getObjectType({
|
|
2297
|
+
suiClient: txData?.suiClient,
|
|
2298
|
+
objectId: (0, import_utils2.normalizeSuiObjectId)(txData?.bidNonce)
|
|
2299
|
+
});
|
|
2297
2300
|
if (isSingleBid(bidType)) {
|
|
2298
2301
|
await addSingleBidAcceptNftBidTx(txData);
|
|
2299
2302
|
return;
|
|
@@ -2561,6 +2564,7 @@ function addTocenUnlistTxHandler(txData) {
|
|
|
2561
2564
|
}
|
|
2562
2565
|
|
|
2563
2566
|
// src/methods/acceptCollectionBid/addAcceptCollectionBIdTxs.ts
|
|
2567
|
+
var import_utils3 = require("@mysten/sui/utils");
|
|
2564
2568
|
function addTradeportAcceptCollectionBidTx({
|
|
2565
2569
|
tx,
|
|
2566
2570
|
sharedObjects,
|
|
@@ -2727,7 +2731,10 @@ function addTocenAcceptCollectionBidTx({
|
|
|
2727
2731
|
});
|
|
2728
2732
|
}
|
|
2729
2733
|
async function addTradePortAcceptCollectionBidTxHandler(txData) {
|
|
2730
|
-
const bidType = await getObjectType({
|
|
2734
|
+
const bidType = await getObjectType({
|
|
2735
|
+
suiClient: txData?.suiClient,
|
|
2736
|
+
objectId: (0, import_utils3.normalizeSuiObjectId)(txData?.bidNonce)
|
|
2737
|
+
});
|
|
2731
2738
|
if (isSingleBid(bidType)) {
|
|
2732
2739
|
await addSingleBidAcceptNftBidTx(txData);
|
|
2733
2740
|
return;
|
|
@@ -3064,7 +3071,7 @@ var acceptNftBids = async ({
|
|
|
3064
3071
|
var import_transactions6 = require("@mysten/sui/transactions");
|
|
3065
3072
|
|
|
3066
3073
|
// src/methods/buyLocks/buyLocks.ts
|
|
3067
|
-
var
|
|
3074
|
+
var import_utils4 = require("@mysten/sui.js/utils");
|
|
3068
3075
|
var import_transactions4 = require("@mysten/sui/transactions");
|
|
3069
3076
|
|
|
3070
3077
|
// src/helpers/calculatePremium.ts
|
|
@@ -3207,7 +3214,7 @@ async function buyLocks({ lockIds, transaction }, context) {
|
|
|
3207
3214
|
typeArguments: [lock.nft_type],
|
|
3208
3215
|
arguments: [
|
|
3209
3216
|
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
3210
|
-
tx.object(
|
|
3217
|
+
tx.object(import_utils4.SUI_CLOCK_OBJECT_ID),
|
|
3211
3218
|
tx.pure.id(lock.lock_id),
|
|
3212
3219
|
tx.pure.u64(lock.maker_price),
|
|
3213
3220
|
tx.pure.u64(marketplaceFee),
|
|
@@ -3221,7 +3228,7 @@ async function buyLocks({ lockIds, transaction }, context) {
|
|
|
3221
3228
|
}
|
|
3222
3229
|
|
|
3223
3230
|
// src/methods/exerciseLongLocks/exerciseLongLocks.ts
|
|
3224
|
-
var
|
|
3231
|
+
var import_utils5 = require("@mysten/sui.js/utils");
|
|
3225
3232
|
var import_transactions5 = require("@mysten/sui/transactions");
|
|
3226
3233
|
async function exerciseLongLocks({ walletAddress, transaction, locks }, context) {
|
|
3227
3234
|
const tx = transaction ?? new import_transactions5.Transaction();
|
|
@@ -3279,7 +3286,7 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
|
|
|
3279
3286
|
typeArguments: [lock.nft_type],
|
|
3280
3287
|
arguments: [
|
|
3281
3288
|
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
3282
|
-
tx.object(
|
|
3289
|
+
tx.object(import_utils5.SUI_CLOCK_OBJECT_ID),
|
|
3283
3290
|
tx.pure.id(lock.lock_id),
|
|
3284
3291
|
tx.object(lock.chain_state.makerKioskId),
|
|
3285
3292
|
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
@@ -3384,7 +3391,7 @@ async function buyAndExerciseLongLocks({ walletAddress, locks, tx: existingTx },
|
|
|
3384
3391
|
var import_transactions9 = require("@mysten/sui/transactions");
|
|
3385
3392
|
|
|
3386
3393
|
// src/methods/exerciseShortLocks/exerciseShortLocks.ts
|
|
3387
|
-
var
|
|
3394
|
+
var import_utils6 = require("@mysten/sui.js/utils");
|
|
3388
3395
|
var import_transactions8 = require("@mysten/sui/transactions");
|
|
3389
3396
|
|
|
3390
3397
|
// src/graphql/queries/fetchListingsById.ts
|
|
@@ -4093,7 +4100,7 @@ async function exerciseShortLocks({ walletAddress, transaction, locks }, context
|
|
|
4093
4100
|
typeArguments: [lock.nft_type],
|
|
4094
4101
|
arguments: [
|
|
4095
4102
|
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
4096
|
-
tx.object(
|
|
4103
|
+
tx.object(import_utils6.SUI_CLOCK_OBJECT_ID),
|
|
4097
4104
|
tx.pure.id(lock.lock_id)
|
|
4098
4105
|
]
|
|
4099
4106
|
});
|
|
@@ -4174,7 +4181,7 @@ async function buyAndExerciseShortLocks({ walletAddress, locks, tx: existingTx }
|
|
|
4174
4181
|
}
|
|
4175
4182
|
|
|
4176
4183
|
// src/methods/cancelLocks/cancelLocks.ts
|
|
4177
|
-
var
|
|
4184
|
+
var import_utils7 = require("@mysten/sui.js/utils");
|
|
4178
4185
|
var import_transactions10 = require("@mysten/sui/transactions");
|
|
4179
4186
|
async function cancelLocks({ lockIds, walletAddress, tx: existingTx }, context) {
|
|
4180
4187
|
const tx = existingTx ?? new import_transactions10.Transaction();
|
|
@@ -4197,7 +4204,7 @@ async function cancelLocks({ lockIds, walletAddress, tx: existingTx }, context)
|
|
|
4197
4204
|
typeArguments: [lock.nft_type],
|
|
4198
4205
|
arguments: [
|
|
4199
4206
|
tx.object(TRADEPORT_PRICE_LOCK_STORE),
|
|
4200
|
-
tx.object(
|
|
4207
|
+
tx.object(import_utils7.SUI_CLOCK_OBJECT_ID),
|
|
4201
4208
|
tx.pure.id(lock.lock_id),
|
|
4202
4209
|
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk)
|
|
4203
4210
|
]
|
|
@@ -5631,7 +5638,7 @@ var fetchCollectionsBySlug = import_graphql_request20.gql`
|
|
|
5631
5638
|
`;
|
|
5632
5639
|
|
|
5633
5640
|
// src/methods/placeNftBids/addPlaceNftBidTxs.ts
|
|
5634
|
-
var
|
|
5641
|
+
var import_utils8 = require("@mysten/sui/utils");
|
|
5635
5642
|
async function addTradePortPlaceNftBidTxHandler(txData) {
|
|
5636
5643
|
if (isOriginByteTx(txData?.sharedObjects) && !ORIGIN_BYTE_NFT_TYPES_MISSING_ORDERBOOK?.includes(normalizedNftType(txData?.nftType))) {
|
|
5637
5644
|
throw new Error("OriginByte bidding not supported currently");
|
|
@@ -5651,7 +5658,7 @@ async function addTradePortPlaceNftBidTxHandler(txData) {
|
|
|
5651
5658
|
if (!bcsHex) {
|
|
5652
5659
|
throw new Error(`No BCS found for token ${nftTokenId}`);
|
|
5653
5660
|
}
|
|
5654
|
-
bcs3 = (0,
|
|
5661
|
+
bcs3 = (0, import_utils8.fromHex)(bcsHex);
|
|
5655
5662
|
}
|
|
5656
5663
|
let multiBidChainId;
|
|
5657
5664
|
if (existingMultiBidChainId) {
|
|
@@ -5691,12 +5698,12 @@ async function addTradePortPlaceNftBidTxHandler(txData) {
|
|
|
5691
5698
|
arguments: [
|
|
5692
5699
|
tx.object(TRADEPORT_MULTI_BID_STORE),
|
|
5693
5700
|
tx.pure.u64(nftTokenId ? 1 : 0),
|
|
5694
|
-
multiBidChainId ? typeof multiBidChainId === "string" ? tx.pure.option("id", (0,
|
|
5701
|
+
multiBidChainId ? typeof multiBidChainId === "string" ? tx.pure.option("id", (0, import_utils8.normalizeSuiObjectId)(multiBidChainId)) : tx.moveCall({
|
|
5695
5702
|
target: "0x1::option::some",
|
|
5696
5703
|
typeArguments: ["0x2::object::ID"],
|
|
5697
5704
|
arguments: [multiBidChainId]
|
|
5698
5705
|
}) : void 0,
|
|
5699
|
-
tx.pure.option("id", nftTokenId ? (0,
|
|
5706
|
+
tx.pure.option("id", nftTokenId ? (0, import_utils8.normalizeSuiObjectId)(nftTokenId) : void 0),
|
|
5700
5707
|
tx.pure.option("vector<u8>", bcs3 ? [...bcs3] : void 0),
|
|
5701
5708
|
tx.pure.option("u64", expireAt?.getTime()),
|
|
5702
5709
|
tx.pure.u64(price),
|
|
@@ -5894,7 +5901,11 @@ var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx
|
|
|
5894
5901
|
// src/methods/removeCollectionBids/removeCollectionBids.ts
|
|
5895
5902
|
var import_transactions22 = require("@mysten/sui/transactions");
|
|
5896
5903
|
|
|
5904
|
+
// src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts
|
|
5905
|
+
var import_utils10 = require("@mysten/sui/utils");
|
|
5906
|
+
|
|
5897
5907
|
// src/methods/removeNftBids/addRemoveNftBidTxs.ts
|
|
5908
|
+
var import_utils9 = require("@mysten/sui/utils");
|
|
5898
5909
|
function addTradeportRemoveNftBidTx({ tx, bidNonce, nftType }) {
|
|
5899
5910
|
tx.moveCall({
|
|
5900
5911
|
target: "0xb42dbb7413b79394e1a0175af6ae22b69a5c7cc5df259cd78072b6818217c027::biddings::cancel_bid",
|
|
@@ -5948,13 +5959,16 @@ async function addSingleBidRemoveNftBidTx({ tx, bidNonce, multiBidId }) {
|
|
|
5948
5959
|
target: `${TRADEPORT_MULTI_BID_PACKAGE}::tradeport_biddings::cancel_bid`,
|
|
5949
5960
|
arguments: [
|
|
5950
5961
|
tx.object(TRADEPORT_MULTI_BID_STORE),
|
|
5951
|
-
tx.pure.id(bidNonce),
|
|
5962
|
+
tx.pure.id((0, import_utils9.normalizeSuiObjectId)(bidNonce)),
|
|
5952
5963
|
tx.pure.option("id", multiBidChainId)
|
|
5953
5964
|
]
|
|
5954
5965
|
});
|
|
5955
5966
|
}
|
|
5956
5967
|
async function addTradePortRemoveNftBidTxHandler(txData) {
|
|
5957
|
-
const bidType = await getObjectType({
|
|
5968
|
+
const bidType = await getObjectType({
|
|
5969
|
+
suiClient: txData?.suiClient,
|
|
5970
|
+
objectId: (0, import_utils9.normalizeSuiObjectId)(txData?.bidNonce)
|
|
5971
|
+
});
|
|
5958
5972
|
if (isSingleBid(bidType)) {
|
|
5959
5973
|
await addSingleBidRemoveNftBidTx(txData);
|
|
5960
5974
|
return;
|
|
@@ -6026,8 +6040,12 @@ function addBluemoveKioskRemoveCollectionBidTx({
|
|
|
6026
6040
|
async function addTradePortRemoveCollectionBidTxHandler(txData) {
|
|
6027
6041
|
const bidType = await getObjectType({
|
|
6028
6042
|
suiClient: txData?.suiClient,
|
|
6029
|
-
objectId: txData?.bidNonce
|
|
6043
|
+
objectId: (0, import_utils10.normalizeSuiObjectId)(txData?.bidNonce)
|
|
6030
6044
|
});
|
|
6045
|
+
if (isSingleBid(bidType)) {
|
|
6046
|
+
await addSingleBidRemoveNftBidTx(txData);
|
|
6047
|
+
return;
|
|
6048
|
+
}
|
|
6031
6049
|
if (isOriginByteBid(bidType)) {
|
|
6032
6050
|
const sharedObjects = await getSharedObjects(txData?.nftType);
|
|
6033
6051
|
addOriginByteRemoveCollectionBidTx({ ...txData, sharedObjects });
|
|
@@ -6040,11 +6058,10 @@ async function addTradePortRemoveCollectionBidTxHandler(txData) {
|
|
|
6040
6058
|
addTradeportRemoveCollectionBidTx(txData);
|
|
6041
6059
|
}
|
|
6042
6060
|
async function addBluemoveRemoveCollectionBidTxHandler(txData) {
|
|
6043
|
-
const bidType = await getObjectType({
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
}
|
|
6061
|
+
const bidType = await getObjectType({
|
|
6062
|
+
suiClient: txData?.suiClient,
|
|
6063
|
+
objectId: (0, import_utils10.normalizeSuiObjectId)(txData?.bidNonce)
|
|
6064
|
+
});
|
|
6048
6065
|
if (isOriginByteBid(bidType)) {
|
|
6049
6066
|
const sharedObjects = await getSharedObjects(txData?.nftType);
|
|
6050
6067
|
addOriginByteRemoveCollectionBidTx({ ...txData, sharedObjects });
|