steamutils 1.1.46 → 1.1.47

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 +38 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5425,6 +5425,44 @@ class SteamUser {
5425
5425
  const trade_offer_access_url = $('#trade_offer_access_url').attr('value')
5426
5426
  return trade_offer_access_url
5427
5427
  }
5428
+
5429
+ async sendTradeOffer({tradeURL, me, them, tradeoffermessage = ''}) {//partner: steamid not accountid
5430
+ // const meExample = {
5431
+ // "assets": [{"appid": 730, "contextid": "2", "amount": 1, "assetid": "30492209501"}],
5432
+ // "currency": [],
5433
+ // "ready": false
5434
+ // }
5435
+ // const themExample = {
5436
+ // "assets": [{"appid": 730, "contextid": "2", "amount": 1, "assetid": "30494845811"}],
5437
+ // "currency": [],
5438
+ // "ready": false
5439
+ // }
5440
+ const tradeURLParams = url.parse(tradeURL).query.split('&').reduce((accumulator, currentValue, index) => ({
5441
+ ...accumulator, [currentValue.split('=')[0]]: currentValue.split('=')[1]
5442
+ }), {})
5443
+ const result = await this._httpRequest({
5444
+ url: `tradeoffer/new/send`,
5445
+ headers: {
5446
+ Referer: tradeURL
5447
+ },
5448
+ data: {
5449
+ serverid: 1,
5450
+ partner: SteamID.fromIndividualAccountID(tradeURLParams.partner).getSteamID64(),
5451
+ tradeoffermessage,
5452
+ json: JSON.stringify({
5453
+ newversion: true,
5454
+ version: 3,
5455
+ me,
5456
+ them,
5457
+ }),
5458
+ captcha: '',
5459
+ trade_offer_create_params: JSON.stringify({trade_offer_access_token: tradeURLParams.token}),
5460
+ account: this.getMiniProfileUser(),
5461
+ },
5462
+ method: 'POST',
5463
+ })
5464
+ return result.data
5465
+ }
5428
5466
  }
5429
5467
 
5430
5468
  export default SteamUser
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.1.46",
3
+ "version": "1.1.47",
4
4
  "main":"index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.3.4",