steamutils 1.5.48 → 1.5.50

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.
Files changed (4) hide show
  1. package/index.js +19 -10
  2. package/package.json +1 -1
  3. package/parse_html.js +1 -1
  4. package/remote.js +2503 -2268
package/index.js CHANGED
@@ -6262,10 +6262,27 @@ export default class SteamUser {
6262
6262
  }
6263
6263
  }
6264
6264
 
6265
+ /**
6266
+ * Sells an item from the user's inventory on the Steam market.
6267
+ *
6268
+ * @param {Object} options - The item selling options.
6269
+ * @param {number} [options.appid=730] - The application ID (default is 730).
6270
+ * @param {number} [options.contextid=2] - The inventory context ID (default is 2).
6271
+ * @param {string|number} options.assetid - The asset ID of the item to sell.
6272
+ * @param {number} [options.amount=1] - The number of items to sell (default is 1).
6273
+ * @param {number|string} options.price - The price at which to list the item.
6274
+ * @returns {Promise<{
6275
+ * success: boolean,
6276
+ * requires_confirmation: number,
6277
+ * needs_mobile_confirmation: boolean,
6278
+ * needs_email_confirmation: boolean,
6279
+ * email_domain: string
6280
+ * } | null>} An object with the sale result and required confirmations, or null if input is invalid or request fails.
6281
+ */
6265
6282
  async sellItem({ appid = 730, contextid = 2, assetid, amount = 1, price }) {
6266
6283
  price = parseInt(price);
6267
6284
  if (!price) {
6268
- return;
6285
+ return null;
6269
6286
  }
6270
6287
 
6271
6288
  const result = await this._httpRequestAjax({
@@ -6285,18 +6302,10 @@ export default class SteamUser {
6285
6302
  });
6286
6303
 
6287
6304
  if (result instanceof ResponseError) {
6288
- return result;
6305
+ return null;
6289
6306
  }
6290
6307
 
6291
6308
  return result?.data;
6292
-
6293
- const resultExample = {
6294
- success: true,
6295
- requires_confirmation: 1,
6296
- needs_mobile_confirmation: true,
6297
- needs_email_confirmation: false,
6298
- email_domain: "gmail.com",
6299
- };
6300
6309
  }
6301
6310
 
6302
6311
  async removeListing(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.5.48",
3
+ "version": "1.5.50",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",
package/parse_html.js CHANGED
@@ -150,7 +150,7 @@ export function parseMarketListings(html) {
150
150
  const paramsMatch = cancelLink.match(/\(([^)]*)\)/);
151
151
  if (!paramsMatch) return;
152
152
 
153
- let [listingId, appId, contextId, itemId] = paramsMatch[1].split(",").map((param) => param.trim().replace(/^['"]|['"]$/g, ""));
153
+ let [, listingId, appId, contextId, itemId] = paramsMatch[1].split(",").map((param) => param.trim().replace(/^['"]|['"]$/g, ""));
154
154
 
155
155
  appId = Number(appId);
156
156
  contextId = Number(contextId);