@tradeport/sui-trading-sdk 0.4.63 → 0.4.64
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.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +31 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/methods/listNfts/listNfts.ts +0 -1
- package/src/methods/sponsorNftListing/addSponsorNftListingTx.ts +14 -12
- package/src/methods/sponsorNftListing/sponsorNftListing.ts +0 -3
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -168,6 +168,7 @@ var TRADEPORT_NFT_STRATEGY_PACKAGE_ID = "0xb7386fc8c6e64ea2b0079e293592b57e98498
|
|
|
168
168
|
var TRADEPORT_NFT_STRATEGY_MANAGER_ID = "0xfb58ee62b3a62a8150f871da950dfdf923cd0d97b153caf99b5219cd4ddda5bd";
|
|
169
169
|
var TRADEPORT_POOL_REGISTRY_ID = "0xcd0a614c4cbbf173f59dee2602c43a1717f283215ed7a0bb1d55d786af16fbcd";
|
|
170
170
|
var TRADEPORT_POOL_VERSIONED_ID = "0x0309b66202e9aaf470081fffee7ffc0fbd50e3b7400d4f56fd06502e4dbbd676";
|
|
171
|
+
var USDC_COIN_TYPE = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
171
172
|
var COLLECTION_IDS_WITH_ZERO_COMMISSION = [
|
|
172
173
|
""
|
|
173
174
|
];
|
|
@@ -5387,7 +5388,7 @@ async function createMultiBid({
|
|
|
5387
5388
|
}
|
|
5388
5389
|
|
|
5389
5390
|
// src/methods/listNfts/listNfts.ts
|
|
5390
|
-
var
|
|
5391
|
+
var import_transactions14 = require("@mysten/sui/transactions");
|
|
5391
5392
|
|
|
5392
5393
|
// src/helpers/isExpiredListing.ts
|
|
5393
5394
|
var import_utils7 = require("@mysten/sui/utils");
|
|
@@ -5721,18 +5722,15 @@ async function relistNft({
|
|
|
5721
5722
|
}
|
|
5722
5723
|
|
|
5723
5724
|
// src/methods/sponsorNftListing/addSponsorNftListingTx.ts
|
|
5725
|
+
var import_transactions13 = require("@mysten/sui/transactions");
|
|
5724
5726
|
var addSponsorListingTx = async ({
|
|
5725
5727
|
tx,
|
|
5726
|
-
coinToSplit,
|
|
5727
5728
|
nftTokenId,
|
|
5728
5729
|
nftType,
|
|
5729
5730
|
sponsorOptions
|
|
5730
5731
|
}) => {
|
|
5731
|
-
const
|
|
5732
|
-
|
|
5733
|
-
new bigNumberConfig_default(sponsorOptions?.usdcFeeAmountPerPeriod)?.times(sponsorOptions?.numOfPeriods).toString()
|
|
5734
|
-
)
|
|
5735
|
-
]);
|
|
5732
|
+
const totalFee = new bigNumberConfig_default(sponsorOptions?.usdcFeeAmountPerPeriod)?.times(sponsorOptions?.numOfPeriods).toString();
|
|
5733
|
+
const sponsorCoin = sponsorOptions.coinToSplit ? tx.splitCoins(sponsorOptions.coinToSplit, [tx.pure.u64(totalFee)])[0] : (0, import_transactions13.coinWithBalance)({ type: USDC_COIN_TYPE, balance: BigInt(totalFee) });
|
|
5736
5734
|
tx.moveCall({
|
|
5737
5735
|
target: `${TRADEPORT_LISTINGS_PACKAGE}::tradeport_listings::add_sponsored_listing`,
|
|
5738
5736
|
arguments: [
|
|
@@ -5740,7 +5738,7 @@ var addSponsorListingTx = async ({
|
|
|
5740
5738
|
tx.object.clock(),
|
|
5741
5739
|
tx.pure.id(nftTokenId),
|
|
5742
5740
|
tx.pure.u64(sponsorOptions?.numOfPeriods),
|
|
5743
|
-
tx.object(
|
|
5741
|
+
tx.object(sponsorCoin)
|
|
5744
5742
|
],
|
|
5745
5743
|
typeArguments: [nftType]
|
|
5746
5744
|
});
|
|
@@ -5757,7 +5755,7 @@ var listNfts = async ({ nfts, walletAddress, tx: existingTx }, context) => {
|
|
|
5757
5755
|
throw new Error("No nfts found");
|
|
5758
5756
|
}
|
|
5759
5757
|
const nftsForTracking = [];
|
|
5760
|
-
const tx = existingTx ?? new
|
|
5758
|
+
const tx = existingTx ?? new import_transactions14.Transaction();
|
|
5761
5759
|
const sharedKioskState = {
|
|
5762
5760
|
kioskTx: void 0
|
|
5763
5761
|
};
|
|
@@ -5807,7 +5805,6 @@ var listNfts = async ({ nfts, walletAddress, tx: existingTx }, context) => {
|
|
|
5807
5805
|
if (inputNft?.sponsorOptions?.shouldSponsor) {
|
|
5808
5806
|
await addSponsorListingTx({
|
|
5809
5807
|
tx,
|
|
5810
|
-
coinToSplit: inputNft?.sponsorOptions?.coinToSplit,
|
|
5811
5808
|
nftTokenId: nft?.token_id,
|
|
5812
5809
|
nftType,
|
|
5813
5810
|
sponsorOptions: inputNft?.sponsorOptions
|
|
@@ -5827,7 +5824,7 @@ var listNfts = async ({ nfts, walletAddress, tx: existingTx }, context) => {
|
|
|
5827
5824
|
};
|
|
5828
5825
|
|
|
5829
5826
|
// src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts
|
|
5830
|
-
var
|
|
5827
|
+
var import_transactions15 = require("@mysten/sui/transactions");
|
|
5831
5828
|
|
|
5832
5829
|
// src/graphql/queries/fetchNftsByKioskId.ts
|
|
5833
5830
|
var import_graphql_request17 = require("graphql-request");
|
|
@@ -6035,7 +6032,7 @@ async function getTransferPolicyForDirectTransfer(suiClient, collectionChainStat
|
|
|
6035
6032
|
|
|
6036
6033
|
// src/methods/migrateNftsFromUnsharedToSharedKiosks/migrateNftsFromUnsharedToSharedKiosks.ts
|
|
6037
6034
|
async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }, context) {
|
|
6038
|
-
const tx = new
|
|
6035
|
+
const tx = new import_transactions15.Transaction();
|
|
6039
6036
|
const res = await gqlChainRequest({
|
|
6040
6037
|
chain: "sui",
|
|
6041
6038
|
query: fetchKiosksByOwner,
|
|
@@ -6201,11 +6198,11 @@ async function migrateNftsFromUnsharedToSharedKiosks({ walletAddress, max = 50 }
|
|
|
6201
6198
|
}
|
|
6202
6199
|
}
|
|
6203
6200
|
sharedKioskState?.kioskTx?.finalize();
|
|
6204
|
-
return
|
|
6201
|
+
return import_transactions15.Transaction.from(tx);
|
|
6205
6202
|
}
|
|
6206
6203
|
|
|
6207
6204
|
// src/methods/placeCollectionBids/placeCollectionBids.ts
|
|
6208
|
-
var
|
|
6205
|
+
var import_transactions16 = require("@mysten/sui/transactions");
|
|
6209
6206
|
|
|
6210
6207
|
// src/graphql/queries/fetchCollectionsById.ts
|
|
6211
6208
|
var import_graphql_request19 = require("graphql-request");
|
|
@@ -6436,7 +6433,7 @@ var placeCollectionBids = async ({
|
|
|
6436
6433
|
throw new Error("No collection found");
|
|
6437
6434
|
}
|
|
6438
6435
|
const collectionsForTracking = [];
|
|
6439
|
-
const tx = existingTx ?? new
|
|
6436
|
+
const tx = existingTx ?? new import_transactions16.Transaction();
|
|
6440
6437
|
for (const collection of res.collections) {
|
|
6441
6438
|
const nftType = getNftType({
|
|
6442
6439
|
collectionId: collection?.id,
|
|
@@ -6487,9 +6484,9 @@ var placeCollectionBids = async ({
|
|
|
6487
6484
|
};
|
|
6488
6485
|
|
|
6489
6486
|
// src/methods/placeNftBids/placeNftBids.ts
|
|
6490
|
-
var
|
|
6487
|
+
var import_transactions17 = require("@mysten/sui/transactions");
|
|
6491
6488
|
var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx: existingTx, coinToSplit }, context) => {
|
|
6492
|
-
const tx = existingTx ?? new
|
|
6489
|
+
const tx = existingTx ?? new import_transactions17.Transaction();
|
|
6493
6490
|
const res = await gqlChainRequest({
|
|
6494
6491
|
chain: "sui",
|
|
6495
6492
|
query: fetchNftsById,
|
|
@@ -6537,7 +6534,7 @@ var placeNftBids = async ({ bids, walletAddress, multiBidId, multiBidChainId, tx
|
|
|
6537
6534
|
};
|
|
6538
6535
|
|
|
6539
6536
|
// src/methods/removeCollectionBids/removeCollectionBids.ts
|
|
6540
|
-
var
|
|
6537
|
+
var import_transactions18 = require("@mysten/sui/transactions");
|
|
6541
6538
|
|
|
6542
6539
|
// src/methods/removeCollectionBids/addRemoveCollectionBidsTxs.ts
|
|
6543
6540
|
var import_utils9 = require("@mysten/sui/utils");
|
|
@@ -6645,7 +6642,7 @@ var removeCollectionBids = async ({ bidIds, tx: existingTx }, context) => {
|
|
|
6645
6642
|
throw new Error("No bids found");
|
|
6646
6643
|
}
|
|
6647
6644
|
const bidsForTracking = [];
|
|
6648
|
-
const tx = existingTx ?
|
|
6645
|
+
const tx = existingTx ? import_transactions18.Transaction.from(existingTx) : new import_transactions18.Transaction();
|
|
6649
6646
|
for (const bid of res.bids) {
|
|
6650
6647
|
if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
|
|
6651
6648
|
throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
|
|
@@ -6693,11 +6690,11 @@ var removeCollectionBids = async ({ bidIds, tx: existingTx }, context) => {
|
|
|
6693
6690
|
bidder: bid?.bidder
|
|
6694
6691
|
});
|
|
6695
6692
|
}
|
|
6696
|
-
return
|
|
6693
|
+
return import_transactions18.Transaction.from(tx);
|
|
6697
6694
|
};
|
|
6698
6695
|
|
|
6699
6696
|
// src/methods/removeNftBids/removeNftBids.ts
|
|
6700
|
-
var
|
|
6697
|
+
var import_transactions19 = require("@mysten/sui/transactions");
|
|
6701
6698
|
var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
|
|
6702
6699
|
const res = await gqlChainRequest({
|
|
6703
6700
|
chain: "sui",
|
|
@@ -6708,7 +6705,7 @@ var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
|
|
|
6708
6705
|
throw new Error("No bids found");
|
|
6709
6706
|
}
|
|
6710
6707
|
const bidsForTracking = [];
|
|
6711
|
-
const tx = existingTx ?
|
|
6708
|
+
const tx = existingTx ? import_transactions19.Transaction.from(existingTx) : new import_transactions19.Transaction();
|
|
6712
6709
|
for (const bid of res.bids) {
|
|
6713
6710
|
if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
|
|
6714
6711
|
throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
|
|
@@ -6753,11 +6750,11 @@ var removeNftBids = async ({ bidIds, tx: existingTx }, context) => {
|
|
|
6753
6750
|
bidder: bid?.bidder
|
|
6754
6751
|
});
|
|
6755
6752
|
}
|
|
6756
|
-
return
|
|
6753
|
+
return import_transactions19.Transaction.from(tx);
|
|
6757
6754
|
};
|
|
6758
6755
|
|
|
6759
6756
|
// src/methods/sponsorNftListing/sponsorNftListing.ts
|
|
6760
|
-
var
|
|
6757
|
+
var import_transactions20 = require("@mysten/sui/transactions");
|
|
6761
6758
|
|
|
6762
6759
|
// src/graphql/queries/fetchNftCollectionChainState.ts
|
|
6763
6760
|
var import_graphql_request21 = require("graphql-request");
|
|
@@ -6775,7 +6772,6 @@ var fetchNftCollectionChainState = import_graphql_request21.gql`
|
|
|
6775
6772
|
// src/methods/sponsorNftListing/sponsorNftListing.ts
|
|
6776
6773
|
var sponsorNftListing = async ({
|
|
6777
6774
|
tx: existingTx,
|
|
6778
|
-
coinToSplit,
|
|
6779
6775
|
nftTokenId,
|
|
6780
6776
|
options
|
|
6781
6777
|
}) => {
|
|
@@ -6797,10 +6793,9 @@ var sponsorNftListing = async ({
|
|
|
6797
6793
|
if (isOriginByteCollection(transferPolicies)) {
|
|
6798
6794
|
throw new Error(`You cannot sponsor an Origin Byte NFT. Nft Token Id: ${nftTokenId}`);
|
|
6799
6795
|
}
|
|
6800
|
-
const tx = existingTx ?? new
|
|
6796
|
+
const tx = existingTx ?? new import_transactions20.Transaction();
|
|
6801
6797
|
await addSponsorListingTx({
|
|
6802
6798
|
tx,
|
|
6803
|
-
coinToSplit,
|
|
6804
6799
|
nftTokenId,
|
|
6805
6800
|
nftType,
|
|
6806
6801
|
sponsorOptions: options
|
|
@@ -6809,7 +6804,7 @@ var sponsorNftListing = async ({
|
|
|
6809
6804
|
};
|
|
6810
6805
|
|
|
6811
6806
|
// src/methods/transferNfts/transferNfts.ts
|
|
6812
|
-
var
|
|
6807
|
+
var import_transactions21 = require("@mysten/sui/transactions");
|
|
6813
6808
|
var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context) => {
|
|
6814
6809
|
if (addLeadingZerosAfter0x(recipientAddress) === addLeadingZerosAfter0x(walletAddress)) {
|
|
6815
6810
|
throw new Error("Cannot transfer to self");
|
|
@@ -6827,7 +6822,7 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
|
|
|
6827
6822
|
}
|
|
6828
6823
|
const nftsForTracking = [];
|
|
6829
6824
|
const nftsToTransferDirectly = [];
|
|
6830
|
-
const tx = new
|
|
6825
|
+
const tx = new import_transactions21.Transaction();
|
|
6831
6826
|
const sharedKioskState = {
|
|
6832
6827
|
kioskTx: void 0
|
|
6833
6828
|
};
|
|
@@ -6930,11 +6925,11 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
|
|
|
6930
6925
|
context.suiClient
|
|
6931
6926
|
);
|
|
6932
6927
|
sharedKioskState?.kioskTx?.finalize();
|
|
6933
|
-
return
|
|
6928
|
+
return import_transactions21.Transaction.from(tx);
|
|
6934
6929
|
};
|
|
6935
6930
|
|
|
6936
6931
|
// src/methods/unlistListings/unlistListings.ts
|
|
6937
|
-
var
|
|
6932
|
+
var import_transactions22 = require("@mysten/sui/transactions");
|
|
6938
6933
|
var unlistListings = async ({ listingIds, walletAddress }, context) => {
|
|
6939
6934
|
const res = await gqlChainRequest({
|
|
6940
6935
|
chain: "sui",
|
|
@@ -6945,7 +6940,7 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
|
|
|
6945
6940
|
throw new Error("No listings found");
|
|
6946
6941
|
}
|
|
6947
6942
|
const listingsForTracking = [];
|
|
6948
|
-
const tx = new
|
|
6943
|
+
const tx = new import_transactions22.Transaction();
|
|
6949
6944
|
const sharedKioskState = {
|
|
6950
6945
|
kioskTx: void 0
|
|
6951
6946
|
};
|
|
@@ -7014,12 +7009,12 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
|
|
|
7014
7009
|
});
|
|
7015
7010
|
}
|
|
7016
7011
|
sharedKioskState?.kioskTx?.finalize();
|
|
7017
|
-
return
|
|
7012
|
+
return import_transactions22.Transaction.from(tx);
|
|
7018
7013
|
};
|
|
7019
7014
|
|
|
7020
7015
|
// src/methods/withdrawProfitsFromKiosks/withdrawProfitsFromKiosks.ts
|
|
7021
7016
|
var import_kiosk5 = require("@mysten/kiosk");
|
|
7022
|
-
var
|
|
7017
|
+
var import_transactions23 = require("@mysten/sui/transactions");
|
|
7023
7018
|
async function withdrawProfitsFromKiosks({ walletAddress }, context) {
|
|
7024
7019
|
const res = await gqlChainRequest({
|
|
7025
7020
|
chain: "sui",
|
|
@@ -7039,7 +7034,7 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
|
|
|
7039
7034
|
if (kiosksWithProfit.length === 0) {
|
|
7040
7035
|
throw new Error(`No kiosks with profit to withdraw found for ${walletAddress}`);
|
|
7041
7036
|
}
|
|
7042
|
-
const tx = new
|
|
7037
|
+
const tx = new import_transactions23.Transaction();
|
|
7043
7038
|
try {
|
|
7044
7039
|
for (const kiosk of kiosksWithProfit) {
|
|
7045
7040
|
let kioskTx;
|
|
@@ -7085,7 +7080,7 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
|
|
|
7085
7080
|
} catch (err) {
|
|
7086
7081
|
console.log("err", err);
|
|
7087
7082
|
}
|
|
7088
|
-
return
|
|
7083
|
+
return import_transactions23.Transaction.from(tx);
|
|
7089
7084
|
}
|
|
7090
7085
|
|
|
7091
7086
|
// src/SuiTradingClient.ts
|