@tradeport/sui-trading-sdk 0.1.11 → 0.1.12
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 +18 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/helpers/getLockById.ts +2 -2
- package/src/methods/acceptCollectionBid/acceptCollectionBid.ts +3 -2
- package/src/methods/exerciseLongLocks/exerciseLongLocks.ts +20 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1499,7 +1499,7 @@ function addTocenAcceptCollectionBidTxHandler(txData) {
|
|
|
1499
1499
|
|
|
1500
1500
|
// src/methods/acceptCollectionBid/acceptCollectionBid.ts
|
|
1501
1501
|
var ERROR_UNLIST_FIRST = "Item must be unlisted first before you can accept a collection bid with it";
|
|
1502
|
-
var acceptCollectionBid = async ({ bid, nftId, walletAddress }, context) => {
|
|
1502
|
+
var acceptCollectionBid = async ({ bid, nftId, walletAddress, tx: existingTx }, context) => {
|
|
1503
1503
|
const nftRes = await gqlChainRequest({
|
|
1504
1504
|
chain: "sui",
|
|
1505
1505
|
query: fetchNftById,
|
|
@@ -1510,7 +1510,7 @@ var acceptCollectionBid = async ({ bid, nftId, walletAddress }, context) => {
|
|
|
1510
1510
|
throw new Error("No nft found");
|
|
1511
1511
|
}
|
|
1512
1512
|
const bidsForTracking = [];
|
|
1513
|
-
const tx = new import_transactions.Transaction();
|
|
1513
|
+
const tx = existingTx ?? new import_transactions.Transaction();
|
|
1514
1514
|
const sharedObjects = await getSharedObjects(
|
|
1515
1515
|
nft?.properties?.nft_type || nft?.contract?.properties?.nft_type
|
|
1516
1516
|
);
|
|
@@ -1828,10 +1828,10 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
|
|
|
1828
1828
|
variables: { bidIds: [bidId] }
|
|
1829
1829
|
});
|
|
1830
1830
|
bid = res.bids.find(
|
|
1831
|
-
(bid2) => bid2.status === "active"
|
|
1831
|
+
(bid2) => bid2.status === "active"
|
|
1832
1832
|
);
|
|
1833
1833
|
if (!bid) {
|
|
1834
|
-
throw new Error(`Active
|
|
1834
|
+
throw new Error(`Active bid ${bidId} is missing for ${lock.nft_type}`);
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
1837
|
if (bid) {
|
|
@@ -1841,7 +1841,7 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
|
|
|
1841
1841
|
}
|
|
1842
1842
|
}
|
|
1843
1843
|
if (!lock.chain_state.makerKioskId) {
|
|
1844
|
-
throw new Error("Missing makerKioskId
|
|
1844
|
+
throw new Error("Missing makerKioskId in the lock data");
|
|
1845
1845
|
}
|
|
1846
1846
|
const marketplaceFee = BigInt(
|
|
1847
1847
|
getMarketFeePrice({
|
|
@@ -1876,7 +1876,19 @@ async function exerciseLongLocks({ walletAddress, transaction, locks }, context)
|
|
|
1876
1876
|
shouldSkipKioskLocking: true
|
|
1877
1877
|
});
|
|
1878
1878
|
if (bid) {
|
|
1879
|
-
|
|
1879
|
+
switch (bid.type) {
|
|
1880
|
+
case "solo": {
|
|
1881
|
+
await acceptNftBids({ bidIds: [bidId], tx, kioskTx }, context);
|
|
1882
|
+
break;
|
|
1883
|
+
}
|
|
1884
|
+
case "collection": {
|
|
1885
|
+
await acceptCollectionBid({ bid, tx, nftId: lock.nft?.id, walletAddress }, context);
|
|
1886
|
+
break;
|
|
1887
|
+
}
|
|
1888
|
+
default: {
|
|
1889
|
+
throw new Error(`Unsupported bid type ${bid.type}`);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1880
1892
|
}
|
|
1881
1893
|
}
|
|
1882
1894
|
});
|