@tradeport/sui-trading-sdk 0.3.7 → 0.3.9
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/SuiTradingClient.ts +6 -2
- package/src/helpers/kiosk/kioskTxWrapper.ts +4 -5
- package/src/methods/acceptNftBids/acceptNftBids.ts +17 -9
package/dist/index.mjs
CHANGED
|
@@ -1454,7 +1454,10 @@ var kioskTxWrapper = async ({
|
|
|
1454
1454
|
version: ""
|
|
1455
1455
|
}
|
|
1456
1456
|
});
|
|
1457
|
-
} else if (kiosks.length
|
|
1457
|
+
} else if (shouldConvertToPersonalKiosk || kiosks.length === 0) {
|
|
1458
|
+
kioskTx = new KioskTransaction({ transactionBlock: tx, kioskClient });
|
|
1459
|
+
kioskTx.createPersonal(true);
|
|
1460
|
+
} else {
|
|
1458
1461
|
const kioskCapId = (await gqlChainRequest({
|
|
1459
1462
|
chain: "sui",
|
|
1460
1463
|
query: fetchOwnerCapByKiosk,
|
|
@@ -1471,9 +1474,6 @@ var kioskTxWrapper = async ({
|
|
|
1471
1474
|
version: ""
|
|
1472
1475
|
}
|
|
1473
1476
|
});
|
|
1474
|
-
} else {
|
|
1475
|
-
kioskTx = new KioskTransaction({ transactionBlock: tx, kioskClient });
|
|
1476
|
-
kioskTx.createPersonal(true);
|
|
1477
1477
|
}
|
|
1478
1478
|
await runCommands(kioskTx);
|
|
1479
1479
|
kioskTx.finalize();
|
|
@@ -2823,7 +2823,13 @@ var fetchBidsById = gql11`
|
|
|
2823
2823
|
|
|
2824
2824
|
// src/methods/acceptNftBids/acceptNftBids.ts
|
|
2825
2825
|
var ERROR_UNLIST_FIRST2 = "Item must be unlisted first before you can accept a solo bid on it";
|
|
2826
|
-
var acceptNftBids = async ({
|
|
2826
|
+
var acceptNftBids = async ({
|
|
2827
|
+
bidIds,
|
|
2828
|
+
walletAddress,
|
|
2829
|
+
tx: existingTx,
|
|
2830
|
+
kioskTx,
|
|
2831
|
+
beforeResolveKioskTransferRequest
|
|
2832
|
+
}, context) => {
|
|
2827
2833
|
const res = await gqlChainRequest({
|
|
2828
2834
|
chain: "sui",
|
|
2829
2835
|
query: fetchBidsById,
|
|
@@ -2838,6 +2844,9 @@ var acceptNftBids = async ({ bidIds, tx: existingTx, kioskTx, beforeResolveKiosk
|
|
|
2838
2844
|
if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
|
|
2839
2845
|
throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
|
|
2840
2846
|
}
|
|
2847
|
+
if (addLeadingZerosAfter0x(bid?.bidder) === addLeadingZerosAfter0x(walletAddress)) {
|
|
2848
|
+
throw new Error("Wallet cannot accept its own bid");
|
|
2849
|
+
}
|
|
2841
2850
|
if (bid?.status !== "active") {
|
|
2842
2851
|
throw new Error("Bid not active");
|
|
2843
2852
|
}
|
|
@@ -6344,14 +6353,14 @@ var SuiTradingClient = class {
|
|
|
6344
6353
|
};
|
|
6345
6354
|
return removeNftBids({ bidIds, tx }, context);
|
|
6346
6355
|
}
|
|
6347
|
-
async acceptNftBids({ bidIds }) {
|
|
6356
|
+
async acceptNftBids({ bidIds, walletAddress }) {
|
|
6348
6357
|
const context = {
|
|
6349
6358
|
apiUser: this.apiUser,
|
|
6350
6359
|
apiKey: this.apiKey,
|
|
6351
6360
|
suiClient: this.suiClient,
|
|
6352
6361
|
kioskClient: this.kioskClient
|
|
6353
6362
|
};
|
|
6354
|
-
return acceptNftBids({ bidIds }, context);
|
|
6363
|
+
return acceptNftBids({ bidIds, walletAddress }, context);
|
|
6355
6364
|
}
|
|
6356
6365
|
async placeCollectionBid({
|
|
6357
6366
|
collectionId,
|
|
@@ -6395,6 +6404,9 @@ var SuiTradingClient = class {
|
|
|
6395
6404
|
if (!bid) {
|
|
6396
6405
|
throw new Error("No bid found");
|
|
6397
6406
|
}
|
|
6407
|
+
if (addLeadingZerosAfter0x(bid?.bidder) === addLeadingZerosAfter0x(walletAddress)) {
|
|
6408
|
+
throw new Error("Wallet cannot accept its own bid");
|
|
6409
|
+
}
|
|
6398
6410
|
if (bid?.status !== "active") {
|
|
6399
6411
|
throw new Error("Bid not active");
|
|
6400
6412
|
}
|