@tradeport/sui-trading-sdk 0.4.56 → 0.4.57
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/dist/index.js +34 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +3 -1
- package/src/methods/buyListings/addBuyListingTxs.ts +15 -5
- package/src/methods/listNfts/addListTxs.ts +7 -2
- package/src/methods/listNfts/addRelistTxs.ts +5 -2
- package/src/methods/unlistListings/addUnlistListingTxs.ts +9 -3
package/dist/index.js
CHANGED
|
@@ -162,8 +162,9 @@ var TRADEPORT_THIRD_PARTY_FEE_DECIMAL_PERCENT = 5e-3;
|
|
|
162
162
|
var TRADEPORT_LISTINGS_DEFAULT_COMMISSION_BPS = 300;
|
|
163
163
|
var TRADEPORT_LISTING_STORE = "0x47cba0b6309a12ce39f9306e28b899ed4b3698bce4f4911fd0c58ff2329a2ff6";
|
|
164
164
|
var TRADEPORT_BIDDING_STORE = "0x3d3b0c6e616fdc1a45b2b73d022bc085448e78bd729d28081c7a340abb33cba1";
|
|
165
|
-
var TRADEPORT_LISTINGS_PACKAGE = "
|
|
165
|
+
var TRADEPORT_LISTINGS_PACKAGE = "0xc99caf110751c3c615c64a27c81bf5c829e39b21a32613b9e4f87ca69cb8ec38";
|
|
166
166
|
var TRADEPORT_LISTINGS_STORE = "0xf96f9363ac5a64c058bf7140723226804d74c0dab2dd27516fb441a180cd763b";
|
|
167
|
+
var TRADEPORT_ORDERBOOK_STORE = "0x3af0a94360253c80fbabe73f6832be0a49ddfc0b8772ccd5335f568cbc356da1";
|
|
167
168
|
var TRADEPORT_KIOSK_LISTING_STORE = "0xbff3161b047fb8b727883838c09b08afa9e0dd0f5488bde9e99e80643da9b9e0";
|
|
168
169
|
var TRADEPORT_KIOSK_TRANSFERS_STORE = "0xe0f61b6915d3fd4ec8bbe4618514e2152a82841605bfa00cde22ace434153a1b";
|
|
169
170
|
var TRADEPORT_KIOSK_TRANSFERS_ESCROW_KIOSK = "0xa677dab85a93bd8d6845b6cc7914f3bbb334fef7fbcbe0e997b5f75b5922d106";
|
|
@@ -2762,8 +2763,12 @@ async function addLegacyTradePortKioskUnlistTx({
|
|
|
2762
2763
|
}
|
|
2763
2764
|
function addTradePortUnlistTx({ tx, nftTokenId, nftType }) {
|
|
2764
2765
|
tx.moveCall({
|
|
2765
|
-
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::
|
|
2766
|
-
arguments: [
|
|
2766
|
+
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::cancel_ob_listing_without_transfer_policy`,
|
|
2767
|
+
arguments: [
|
|
2768
|
+
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
2769
|
+
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
2770
|
+
tx.pure.id(nftTokenId)
|
|
2771
|
+
],
|
|
2767
2772
|
typeArguments: [nftType]
|
|
2768
2773
|
});
|
|
2769
2774
|
}
|
|
@@ -2774,9 +2779,10 @@ async function addKioskTradePortUnlistTx({
|
|
|
2774
2779
|
nftType
|
|
2775
2780
|
}) {
|
|
2776
2781
|
tx.moveCall({
|
|
2777
|
-
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::
|
|
2782
|
+
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::cancel_ob_listing_with_transfer_policy`,
|
|
2778
2783
|
arguments: [
|
|
2779
2784
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
2785
|
+
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
2780
2786
|
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
2781
2787
|
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
2782
2788
|
tx.pure.id(nftTokenId)
|
|
@@ -3975,8 +3981,13 @@ async function addTradePortBuyTx({ tx, nftType, nftTokenId, price, coinToSplit }
|
|
|
3975
3981
|
const [coin] = tx.splitCoins(coinToSplit ? coinToSplit : tx.gas, [tx.pure.u64(totalAmount)]);
|
|
3976
3982
|
if (!coin) throw new Error("Coin could not be split");
|
|
3977
3983
|
tx.moveCall({
|
|
3978
|
-
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::
|
|
3979
|
-
arguments: [
|
|
3984
|
+
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::buy_ob_listing_without_transfer_policy`,
|
|
3985
|
+
arguments: [
|
|
3986
|
+
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
3987
|
+
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
3988
|
+
tx.pure.id(nftTokenId),
|
|
3989
|
+
tx.object(coin)
|
|
3990
|
+
],
|
|
3980
3991
|
typeArguments: [nftType]
|
|
3981
3992
|
});
|
|
3982
3993
|
destroyZeroCoin({ tx, coin });
|
|
@@ -3990,6 +4001,7 @@ async function addKioskTradePortBuyTx({
|
|
|
3990
4001
|
price,
|
|
3991
4002
|
sellerKiosk,
|
|
3992
4003
|
coinToSplit,
|
|
4004
|
+
buyer,
|
|
3993
4005
|
collectionId
|
|
3994
4006
|
}) {
|
|
3995
4007
|
const transferPolicyId = getNativeKioskTransferPolicies(transferPolicies)?.at(0)?.id;
|
|
@@ -4002,12 +4014,14 @@ async function addKioskTradePortBuyTx({
|
|
|
4002
4014
|
const [coin] = tx.splitCoins(coinToSplit ? coinToSplit : tx.gas, [tx.pure.u64(totalAmount)]);
|
|
4003
4015
|
if (!coin) throw new Error("Coin could not be split");
|
|
4004
4016
|
const transferRequest = tx.moveCall({
|
|
4005
|
-
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::
|
|
4017
|
+
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::buy_ob_listing_with_transfer_policy`,
|
|
4006
4018
|
arguments: [
|
|
4007
4019
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
4020
|
+
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
4008
4021
|
tx.object(sellerKiosk),
|
|
4009
4022
|
tx.object("value" in kioskTx.kiosk ? kioskTx.kiosk.value : kioskTx.kiosk),
|
|
4010
4023
|
tx.object("value" in kioskTx.kioskCap ? kioskTx.kioskCap.value : kioskTx.kioskCap),
|
|
4024
|
+
tx.pure.address(buyer),
|
|
4011
4025
|
tx.pure.id(nftTokenId),
|
|
4012
4026
|
tx.object(coin),
|
|
4013
4027
|
tx.object(transferPolicyId)
|
|
@@ -4332,7 +4346,7 @@ async function addTradePortBuyTxHandler(txData) {
|
|
|
4332
4346
|
return;
|
|
4333
4347
|
}
|
|
4334
4348
|
if (txData?.listingNonce?.startsWith("1::")) {
|
|
4335
|
-
|
|
4349
|
+
await kioskTxWrapper({
|
|
4336
4350
|
tx: txData?.tx,
|
|
4337
4351
|
kioskClient: txData?.kioskClient,
|
|
4338
4352
|
kioskOwner: txData?.buyer,
|
|
@@ -4356,6 +4370,7 @@ async function addTradePortBuyTxHandler(txData) {
|
|
|
4356
4370
|
}
|
|
4357
4371
|
}
|
|
4358
4372
|
});
|
|
4373
|
+
return;
|
|
4359
4374
|
}
|
|
4360
4375
|
if (txData.listingNonce?.startsWith("0x")) {
|
|
4361
4376
|
const response = await txData?.suiClient.getObject({
|
|
@@ -5316,9 +5331,10 @@ function addTradePortListTx({
|
|
|
5316
5331
|
listPrice
|
|
5317
5332
|
}) {
|
|
5318
5333
|
tx.moveCall({
|
|
5319
|
-
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::
|
|
5334
|
+
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::create_ob_listing_without_transfer_policy`,
|
|
5320
5335
|
arguments: [
|
|
5321
5336
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
5337
|
+
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
5322
5338
|
borrowedItem ? tx.object(borrowedItem) : tx.object(nftTokenId),
|
|
5323
5339
|
tx.pure.u64(listPrice)
|
|
5324
5340
|
],
|
|
@@ -5331,15 +5347,18 @@ async function addKioskTradePortListTx({
|
|
|
5331
5347
|
transferPolicies,
|
|
5332
5348
|
nftTokenId,
|
|
5333
5349
|
nftType,
|
|
5334
|
-
listPrice
|
|
5350
|
+
listPrice,
|
|
5351
|
+
seller
|
|
5335
5352
|
}) {
|
|
5336
5353
|
validateMinFloorPrice({ transferPolicies, listPrice });
|
|
5337
5354
|
tx.moveCall({
|
|
5338
|
-
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::
|
|
5355
|
+
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::create_ob_listing_with_transfer_policy`,
|
|
5339
5356
|
arguments: [
|
|
5340
5357
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
5358
|
+
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
5341
5359
|
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
5342
5360
|
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
5361
|
+
tx.pure.address(seller),
|
|
5343
5362
|
tx.pure.id(nftTokenId),
|
|
5344
5363
|
tx.pure.u64(listPrice)
|
|
5345
5364
|
],
|
|
@@ -5419,9 +5438,10 @@ async function addTradePortListTxHandler(txData) {
|
|
|
5419
5438
|
// src/methods/listNfts/addRelistTxs.ts
|
|
5420
5439
|
function addTradePortRelistTx({ tx, nftTokenId, nftType, listPrice }) {
|
|
5421
5440
|
tx.moveCall({
|
|
5422
|
-
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::
|
|
5441
|
+
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::relist_ob_listing_without_transfer_policy`,
|
|
5423
5442
|
arguments: [
|
|
5424
5443
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
5444
|
+
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
5425
5445
|
tx.pure.id(nftTokenId),
|
|
5426
5446
|
tx.pure.u64(listPrice)
|
|
5427
5447
|
],
|
|
@@ -5436,9 +5456,10 @@ async function addKioskTradePortRelistTx({
|
|
|
5436
5456
|
listPrice
|
|
5437
5457
|
}) {
|
|
5438
5458
|
tx.moveCall({
|
|
5439
|
-
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::
|
|
5459
|
+
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::relist_ob_listing_with_transfer_policy`,
|
|
5440
5460
|
arguments: [
|
|
5441
5461
|
tx.object(TRADEPORT_LISTINGS_STORE),
|
|
5462
|
+
tx.object(TRADEPORT_ORDERBOOK_STORE),
|
|
5442
5463
|
tx.object(kioskTx.kiosk.value ?? kioskTx.kiosk),
|
|
5443
5464
|
tx.object(kioskTx.kioskCap.value ?? kioskTx.kioskCap),
|
|
5444
5465
|
tx.pure.id(nftTokenId),
|