@tradeport/sui-trading-sdk 0.3.7 → 0.3.8

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tradeport/sui-trading-sdk
2
2
 
3
+ ## 0.3.8
4
+
5
+ ### Patch Changes
6
+
7
+ - d3982a6: Added restriction for accepting own bids
8
+
3
9
  ## 0.3.7
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -10,6 +10,7 @@ type AcceptCollectionBid = {
10
10
 
11
11
  type AcceptNftBids = {
12
12
  bidIds: string[];
13
+ walletAddress: string;
13
14
  tx?: Transaction;
14
15
  kioskTx?: KioskTransaction;
15
16
  beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
@@ -170,7 +171,7 @@ declare class SuiTradingClient {
170
171
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
171
172
  placeNftBids({ nfts, walletAddress }: PlaceNftBids): Promise<Transaction>;
172
173
  removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
173
- acceptNftBids({ bidIds }: AcceptNftBids): Promise<Transaction>;
174
+ acceptNftBids({ bidIds, walletAddress }: AcceptNftBids): Promise<Transaction>;
174
175
  placeCollectionBid({ collectionId, bidAmountInMist, numOfBids, walletAddress, }: PlaceCollectionBid): Promise<Transaction>;
175
176
  acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<Transaction>;
176
177
  removeCollectionBids({ bidIds, tx }: RemoveCollectionBids): Promise<Transaction>;
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ type AcceptCollectionBid = {
10
10
 
11
11
  type AcceptNftBids = {
12
12
  bidIds: string[];
13
+ walletAddress: string;
13
14
  tx?: Transaction;
14
15
  kioskTx?: KioskTransaction;
15
16
  beforeResolveKioskTransferRequest?: (coin: any, transferRequest: any) => void | Promise<void>;
@@ -170,7 +171,7 @@ declare class SuiTradingClient {
170
171
  unlistListings({ listingIds, walletAddress }: UnlistListings): Promise<Transaction>;
171
172
  placeNftBids({ nfts, walletAddress }: PlaceNftBids): Promise<Transaction>;
172
173
  removeNftBids({ bidIds, tx }: RemoveNftBids): Promise<Transaction>;
173
- acceptNftBids({ bidIds }: AcceptNftBids): Promise<Transaction>;
174
+ acceptNftBids({ bidIds, walletAddress }: AcceptNftBids): Promise<Transaction>;
174
175
  placeCollectionBid({ collectionId, bidAmountInMist, numOfBids, walletAddress, }: PlaceCollectionBid): Promise<Transaction>;
175
176
  acceptCollectionBid({ bidId, nftId, walletAddress }: AcceptCollectionBid): Promise<Transaction>;
176
177
  removeCollectionBids({ bidIds, tx }: RemoveCollectionBids): Promise<Transaction>;
package/dist/index.js CHANGED
@@ -2847,7 +2847,13 @@ var fetchBidsById = import_graphql_request12.gql`
2847
2847
 
2848
2848
  // src/methods/acceptNftBids/acceptNftBids.ts
2849
2849
  var ERROR_UNLIST_FIRST2 = "Item must be unlisted first before you can accept a solo bid on it";
2850
- var acceptNftBids = async ({ bidIds, tx: existingTx, kioskTx, beforeResolveKioskTransferRequest }, context) => {
2850
+ var acceptNftBids = async ({
2851
+ bidIds,
2852
+ walletAddress,
2853
+ tx: existingTx,
2854
+ kioskTx,
2855
+ beforeResolveKioskTransferRequest
2856
+ }, context) => {
2851
2857
  const res = await gqlChainRequest({
2852
2858
  chain: "sui",
2853
2859
  query: fetchBidsById,
@@ -2862,6 +2868,9 @@ var acceptNftBids = async ({ bidIds, tx: existingTx, kioskTx, beforeResolveKiosk
2862
2868
  if (DELOREAN_TOKEN_IDS_TO_DISABLE?.includes(bid?.nft?.token_id)) {
2863
2869
  throw new Error(DELOREAN_TOKEN_IDS_TO_DISABLE_MESSAGE);
2864
2870
  }
2871
+ if (addLeadingZerosAfter0x(bid?.bidder) === addLeadingZerosAfter0x(walletAddress)) {
2872
+ throw new Error("Wallet cannot accept its own bid");
2873
+ }
2865
2874
  if (bid?.status !== "active") {
2866
2875
  throw new Error("Bid not active");
2867
2876
  }
@@ -6368,14 +6377,14 @@ var SuiTradingClient = class {
6368
6377
  };
6369
6378
  return removeNftBids({ bidIds, tx }, context);
6370
6379
  }
6371
- async acceptNftBids({ bidIds }) {
6380
+ async acceptNftBids({ bidIds, walletAddress }) {
6372
6381
  const context = {
6373
6382
  apiUser: this.apiUser,
6374
6383
  apiKey: this.apiKey,
6375
6384
  suiClient: this.suiClient,
6376
6385
  kioskClient: this.kioskClient
6377
6386
  };
6378
- return acceptNftBids({ bidIds }, context);
6387
+ return acceptNftBids({ bidIds, walletAddress }, context);
6379
6388
  }
6380
6389
  async placeCollectionBid({
6381
6390
  collectionId,
@@ -6419,6 +6428,9 @@ var SuiTradingClient = class {
6419
6428
  if (!bid) {
6420
6429
  throw new Error("No bid found");
6421
6430
  }
6431
+ if (addLeadingZerosAfter0x(bid?.bidder) === addLeadingZerosAfter0x(walletAddress)) {
6432
+ throw new Error("Wallet cannot accept its own bid");
6433
+ }
6422
6434
  if (bid?.status !== "active") {
6423
6435
  throw new Error("Bid not active");
6424
6436
  }