steamutils 1.1.64 → 1.1.65

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +14 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5456,9 +5456,7 @@ class SteamUser {
5456
5456
  // currency: [],
5457
5457
  // ready: false
5458
5458
  // }
5459
- const tradeURLParams = url.parse(tradeURL).query.split('&').reduce((accumulator, currentValue, index) => ({
5460
- ...accumulator, [currentValue.split('=')[0]]: currentValue.split('=')[1]
5461
- }), {})
5459
+ const tradeURLParams = SteamUser.parseTradeURL(tradeURL)
5462
5460
  const result = await this._httpRequest({
5463
5461
  url: `tradeoffer/new/send`,
5464
5462
  headers: {
@@ -5468,7 +5466,7 @@ class SteamUser {
5468
5466
  },
5469
5467
  data: {
5470
5468
  serverid: 1,
5471
- partner: SteamID.fromIndividualAccountID(tradeURLParams.partner).getSteamID64(),
5469
+ partner: tradeURLParams.steamId,
5472
5470
  tradeoffermessage,
5473
5471
  json_tradeoffer: JSON.stringify({
5474
5472
  newversion: true,
@@ -5497,6 +5495,18 @@ class SteamUser {
5497
5495
  email_domain: "gmail.com"
5498
5496
  }
5499
5497
  }
5498
+
5499
+ static parseTradeURL(tradeURL){
5500
+ const tradeURLParams = url.parse(tradeURL).query.split('&').reduce((accumulator, currentValue, index) => ({
5501
+ ...accumulator, [currentValue.split('=')[0]]: currentValue.split('=')[1]
5502
+ }), {})
5503
+
5504
+ return {
5505
+ accountId: tradeURLParams.partner,
5506
+ steamId: SteamID.fromIndividualAccountID(tradeURLParams.partner).getSteamID64(),
5507
+ token: tradeURLParams.token,
5508
+ }
5509
+ }
5500
5510
  }
5501
5511
 
5502
5512
  export default SteamUser
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.1.64",
3
+ "version": "1.1.65",
4
4
  "main":"index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.3.4",