@tradeport/sui-trading-sdk 0.1.7 → 0.1.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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @tradeport/sui-trading-sdk
2
2
 
3
+ ## 0.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 36e948c: disabled tracking for now
8
+ - 374a9dd: Attempt to fix tracking
9
+
10
+ ## 0.1.8
11
+
12
+ ### Patch Changes
13
+
14
+ - ef1e578: Attempt to fix tracking
15
+
3
16
  ## 0.1.7
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.ts
@@ -126,23 +116,6 @@ var fetchCollectionBidsAtSamePrice = import_graphql_request4.gql`
126
116
  }
127
117
  `;
128
118
 
129
- // src/helpers/track.ts
130
- var import_analytics_node = __toESM(require("analytics-node"));
131
- var analytics = new import_analytics_node.default(process.env.SEGMENT_API_KEY, { flushAt: 5, flushed: true });
132
- var trackMethodCall = ({ apiUser, apiKey, event, items }) => {
133
- analytics.track({
134
- userId: apiUser,
135
- event,
136
- properties: {
137
- chain: "sui",
138
- apiUser,
139
- apiKey,
140
- items
141
- }
142
- });
143
- void analytics.flush();
144
- };
145
-
146
119
  // src/methods/acceptCollectionBid/acceptCollectionBid.ts
147
120
  var import_transactions = require("@mysten/sui/transactions");
148
121
 
@@ -1591,14 +1564,6 @@ var acceptCollectionBid = async ({ bid, nftId, walletAddress }, context) => {
1591
1564
  itemOwner: nft?.owner,
1592
1565
  bidder: bid?.bidder
1593
1566
  });
1594
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && bidsForTracking.length > 0) {
1595
- trackMethodCall({
1596
- apiUser: context.apiUser,
1597
- apiKey: context.apiKey,
1598
- event: "ACCEPT_COLLECTION_BID",
1599
- items: bidsForTracking
1600
- });
1601
- }
1602
1567
  return import_transactions.Transaction.from(tx);
1603
1568
  };
1604
1569
 
@@ -1701,14 +1666,6 @@ var acceptNftBids = async ({ bidIds, tx: existingTx, kioskTx }, context) => {
1701
1666
  bidder: bid?.bidder
1702
1667
  });
1703
1668
  }
1704
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && bidsForTracking.length > 0) {
1705
- trackMethodCall({
1706
- apiUser: context.apiUser,
1707
- apiKey: context.apiKey,
1708
- event: "ACCEPT_NFT_BIDS",
1709
- items: bidsForTracking
1710
- });
1711
- }
1712
1669
  return import_transactions2.Transaction.from(tx);
1713
1670
  };
1714
1671
 
@@ -2423,14 +2380,6 @@ var buyListings = async ({ listingIds, walletAddress, tx: existingTx, kioskTx },
2423
2380
  price: tocenTotalPrice
2424
2381
  });
2425
2382
  }
2426
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && listingsForTracking.length > 0) {
2427
- trackMethodCall({
2428
- apiUser: context.apiUser,
2429
- apiKey: context.apiKey,
2430
- event: "BUY_LISTINGS",
2431
- items: listingsForTracking
2432
- });
2433
- }
2434
2383
  return import_transactions4.Transaction.from(tx);
2435
2384
  };
2436
2385
 
@@ -2821,14 +2770,6 @@ var claimNfts = async ({ nftIds, walletAddress, tx: existingTx }, context) => {
2821
2770
  claimReason: nft?.chain_state?.claimable_reason
2822
2771
  });
2823
2772
  }
2824
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && nftsForTracking.length > 0) {
2825
- trackMethodCall({
2826
- apiUser: context.apiUser,
2827
- apiKey: context.apiKey,
2828
- event: "CLAIM_NFTS",
2829
- items: nftsForTracking
2830
- });
2831
- }
2832
2773
  return import_transactions8.Transaction.from(tx);
2833
2774
  };
2834
2775
 
@@ -3203,14 +3144,6 @@ var listNfts = async ({ nfts, walletAddress }, context) => {
3203
3144
  marketRelistedFrom: nft?.listings?.[0]?.market_name
3204
3145
  });
3205
3146
  }
3206
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && nftsForTracking.length > 0) {
3207
- trackMethodCall({
3208
- apiUser: context.apiUser,
3209
- apiKey: context.apiKey,
3210
- event: "LIST_NFTS",
3211
- items: nftsForTracking
3212
- });
3213
- }
3214
3147
  return import_transactions10.Transaction.from(tx);
3215
3148
  };
3216
3149
 
@@ -3449,14 +3382,6 @@ var placeCollectionBids = async ({ collections, walletAddress }, context) => {
3449
3382
  bidder: walletAddress
3450
3383
  });
3451
3384
  }
3452
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && collectionsForTracking.length > 0) {
3453
- trackMethodCall({
3454
- apiUser: context.apiUser,
3455
- apiKey: context.apiKey,
3456
- event: "PLACE_COLLECTION_BIDS",
3457
- items: collectionsForTracking
3458
- });
3459
- }
3460
3385
  return import_transactions11.Transaction.from(tx);
3461
3386
  };
3462
3387
 
@@ -3600,14 +3525,6 @@ var placeNftBids = async ({ nfts, walletAddress }, context) => {
3600
3525
  bidder: walletAddress
3601
3526
  });
3602
3527
  }
3603
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && nftsForTracking.length > 0) {
3604
- trackMethodCall({
3605
- apiUser: context.apiUser,
3606
- apiKey: context.apiKey,
3607
- event: "PLACE_NFT_BIDS",
3608
- items: nftsForTracking
3609
- });
3610
- }
3611
3528
  return import_transactions12.Transaction.from(tx);
3612
3529
  };
3613
3530
 
@@ -3820,14 +3737,6 @@ var removeCollectionBid = async ({ bidId }, context) => {
3820
3737
  bidder: bid?.bidder
3821
3738
  });
3822
3739
  }
3823
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && bidsForTracking.length > 0) {
3824
- trackMethodCall({
3825
- apiUser: context.apiUser,
3826
- apiKey: context.apiKey,
3827
- event: "REMOVE_COLLECTION_BID",
3828
- items: bidsForTracking
3829
- });
3830
- }
3831
3740
  return import_transactions13.Transaction.from(tx);
3832
3741
  };
3833
3742
 
@@ -3882,14 +3791,6 @@ var removeNftBids = async ({ bidIds }, context) => {
3882
3791
  bidder: bid?.bidder
3883
3792
  });
3884
3793
  }
3885
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && bidsForTracking.length > 0) {
3886
- trackMethodCall({
3887
- apiUser: context.apiUser,
3888
- apiKey: context.apiKey,
3889
- event: "REMOVE_NFT_BIDS",
3890
- items: bidsForTracking
3891
- });
3892
- }
3893
3794
  return import_transactions14.Transaction.from(tx);
3894
3795
  };
3895
3796
 
@@ -4091,14 +3992,6 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
4091
3992
  if (res?.nfts?.length > 1) {
4092
3993
  await addOneDollarFee(tx);
4093
3994
  }
4094
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && nftsForTracking.length > 0) {
4095
- trackMethodCall({
4096
- apiUser: context.apiUser,
4097
- apiKey: context.apiKey,
4098
- event: "TRANSFER_NFTS",
4099
- items: nftsForTracking
4100
- });
4101
- }
4102
3995
  return import_transactions15.Transaction.from(tx);
4103
3996
  };
4104
3997
 
@@ -4170,14 +4063,6 @@ var unlistListings = async ({ listingIds, walletAddress }, context) => {
4170
4063
  marketName: listing?.market_name
4171
4064
  });
4172
4065
  }
4173
- if (process.env.ENABLE_SEGMENT_TRACKING === "true" && listingsForTracking.length > 0) {
4174
- trackMethodCall({
4175
- apiUser: context.apiUser,
4176
- apiKey: context.apiKey,
4177
- event: "UNLIST_LISTINGS",
4178
- items: listingsForTracking
4179
- });
4180
- }
4181
4066
  return import_transactions16.Transaction.from(tx);
4182
4067
  };
4183
4068
 
@@ -4190,7 +4075,6 @@ var SuiTradingClient = class {
4190
4075
  "x-api-user": apiUser,
4191
4076
  "x-api-key": apiKey
4192
4077
  });
4193
- trackMethodCall({ apiUser, apiKey, event: "INITIALIZE_CLIENT" });
4194
4078
  }
4195
4079
  async buyListings({ listingIds, walletAddress }) {
4196
4080
  const context = {