@darkgl/waxpeer 1.8.0
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/LICENSE +21 -0
- package/README.md +352 -0
- package/dist/Sockets/tradeSocket.d.ts +12 -0
- package/dist/Sockets/tradeSocket.d.ts.map +1 -0
- package/dist/Sockets/tradeSocket.js +109 -0
- package/dist/Sockets/tradeSocket.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/types/sockets.d.ts +255 -0
- package/dist/types/sockets.d.ts.map +1 -0
- package/dist/types/sockets.js +20 -0
- package/dist/types/sockets.js.map +1 -0
- package/dist/types/waxpeer.d.ts +642 -0
- package/dist/types/waxpeer.d.ts.map +1 -0
- package/dist/types/waxpeer.js +147 -0
- package/dist/types/waxpeer.js.map +1 -0
- package/dist/waxpeer.d.ts +1027 -0
- package/dist/waxpeer.d.ts.map +1 -0
- package/dist/waxpeer.js +1196 -0
- package/dist/waxpeer.js.map +1 -0
- package/package.json +64 -0
package/dist/waxpeer.js
ADDED
|
@@ -0,0 +1,1196 @@
|
|
|
1
|
+
import { Client } from 'undici';
|
|
2
|
+
import qs from 'qs';
|
|
3
|
+
import CacheableLookup from 'cacheable-lookup';
|
|
4
|
+
const cacheable = new CacheableLookup();
|
|
5
|
+
const baseUrl = 'https://api.waxpeer.com';
|
|
6
|
+
const version = 'v1';
|
|
7
|
+
export class Waxpeer {
|
|
8
|
+
api;
|
|
9
|
+
apiClient;
|
|
10
|
+
constructor(api, localAddress) {
|
|
11
|
+
this.api = api;
|
|
12
|
+
this.apiClient = new Client(baseUrl, {
|
|
13
|
+
...(localAddress ? { localAddress } : {}),
|
|
14
|
+
keepAliveTimeout: 60000,
|
|
15
|
+
// @ts-expect-error https://github.com/szmarczak/cacheable-lookup/issues/79
|
|
16
|
+
connect: {
|
|
17
|
+
rejectUnauthorized: false,
|
|
18
|
+
keepAlive: true,
|
|
19
|
+
lookup: cacheable.lookup,
|
|
20
|
+
noDelay: true,
|
|
21
|
+
},
|
|
22
|
+
maxRedirections: 5,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fetch trades and transactions by one request, maximum 100 in response.
|
|
27
|
+
*
|
|
28
|
+
* @param skip Skip to get next results (max 1000)
|
|
29
|
+
* @param start Start date
|
|
30
|
+
* @param end End date
|
|
31
|
+
* @param sort (optional) Sort by creation time
|
|
32
|
+
* @example
|
|
33
|
+
* // example response:
|
|
34
|
+
* {
|
|
35
|
+
* "success": true,
|
|
36
|
+
* "data": {
|
|
37
|
+
* "trades": [
|
|
38
|
+
* {
|
|
39
|
+
* "date": "2022-10-29T23:58:17.318Z",
|
|
40
|
+
* "created": "2022-10-29T23:52:17.318Z",
|
|
41
|
+
* "id": 4258120,
|
|
42
|
+
* "item_id": "27341302961",
|
|
43
|
+
* "give_amount": 22,
|
|
44
|
+
* "image": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/4839650857/200fx125f",
|
|
45
|
+
* "price": 24,
|
|
46
|
+
* "game": "csgo",
|
|
47
|
+
* "name": "Sticker | BIG | Antwerp 2022",
|
|
48
|
+
* "status": 5,
|
|
49
|
+
* "average": 30,
|
|
50
|
+
* "action": "buy"
|
|
51
|
+
* }
|
|
52
|
+
* ],
|
|
53
|
+
* "transactions": [
|
|
54
|
+
* {
|
|
55
|
+
* "wallet": "string",
|
|
56
|
+
* "type": "BTC",
|
|
57
|
+
* "status": "completed",
|
|
58
|
+
* "amount": "10256672",
|
|
59
|
+
* "give_amount": "10256672",
|
|
60
|
+
* "direction": "in",
|
|
61
|
+
* "date": "2022-01-22T01:22:43.021Z"
|
|
62
|
+
* }
|
|
63
|
+
* ]
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
*/
|
|
67
|
+
myHistory(skip, start, end, sort = 'DESC') {
|
|
68
|
+
return this.post('my-history', { skip, start, end, sort });
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Change your tradelink - `/change-tradelink`
|
|
72
|
+
* @param tradelink Your new tradelink
|
|
73
|
+
* @example
|
|
74
|
+
* // example response:
|
|
75
|
+
* /{
|
|
76
|
+
* / "success": false,
|
|
77
|
+
* / "link": "https://steamcommunity.com/tradeoffer/new/?partner=900267897&token=P2YkRJOk",
|
|
78
|
+
* / "info": "You cannot trade with SteamUserName because they have a trade ban.",
|
|
79
|
+
* / "msg": "We couldn't validate your trade link, either your inventory is private or you can't trade",
|
|
80
|
+
* / "token": "P2YkRJOk",
|
|
81
|
+
* / "steamid32": 900267897,
|
|
82
|
+
* / "steamid64": 76561198000000000
|
|
83
|
+
* /}
|
|
84
|
+
*/
|
|
85
|
+
changeTradeLink(tradelink) {
|
|
86
|
+
return this.post('change-tradelink', { tradelink });
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Buy item using name and send to specific tradelink - `buy-one-p2p-name`
|
|
90
|
+
*
|
|
91
|
+
* Notes about trades and frequently asked questions.
|
|
92
|
+
* The duration of the trade in different situations:
|
|
93
|
+
* If seller's info is invalid then it can be cancelled immediately and status 6 is set;
|
|
94
|
+
* If seller's details are valid, but no trade is created, then it will auto-cancel after 6 minutes;
|
|
95
|
+
* if created or waiting for mobile confirmation then it will auto-cancel after 11 to 15 min (depends on when created);
|
|
96
|
+
* if trade is waiting for mobile confirmation and connection with the seller was lost then it will auto-cancel after 6 hours.
|
|
97
|
+
* We recommend adding project_id to purchase so that you can track a trade in case of a timeout or break of purchase request using the /check-many-project-id GET method one minute after the request.
|
|
98
|
+
* An array of possible messages with purchase errors and other information, such as status, can be seen by opening the response scheme, where:
|
|
99
|
+
* System busy - trade is cancelled due to tradelink check timeout or heavy load;
|
|
100
|
+
* buy_csgo - CS:GO purchases are deactivated on the market;
|
|
101
|
+
* buy_rust - RUST purchases are deactivated on the market.
|
|
102
|
+
*
|
|
103
|
+
* @param name Market hash name of the item
|
|
104
|
+
* @param price Price, should be greater than item price
|
|
105
|
+
* @param token Token from tradelink
|
|
106
|
+
* @param partner Partner from tradelink
|
|
107
|
+
* @param project_id Your custom id string[50]
|
|
108
|
+
* @param game Game from supported games
|
|
109
|
+
* @example
|
|
110
|
+
* // example response:
|
|
111
|
+
* {
|
|
112
|
+
* "success": true,
|
|
113
|
+
* "id": 1,
|
|
114
|
+
* "msg": "buy_csgo"
|
|
115
|
+
* }
|
|
116
|
+
*/
|
|
117
|
+
buyItemWithName(name, price, token, partner, project_id = undefined, game = 'csgo') {
|
|
118
|
+
return this.get('buy-one-p2p-name', qs.stringify({
|
|
119
|
+
name: encodeURIComponent(name),
|
|
120
|
+
price,
|
|
121
|
+
token,
|
|
122
|
+
partner,
|
|
123
|
+
project_id,
|
|
124
|
+
game,
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Buy item using `item_id` and send to specific tradelink - `/buy-one-p2p`
|
|
129
|
+
*
|
|
130
|
+
* WARNING: Always paste item_id as string for RUST items.
|
|
131
|
+
* Notes about trades and frequently asked questions.
|
|
132
|
+
* The duration of the trade in different situations:
|
|
133
|
+
* If seller's info is invalid then it can be cancelled immediately and status 6 is set;
|
|
134
|
+
* If seller's details are valid, but no trade is created, then it will auto-cancel after 6 minutes;
|
|
135
|
+
* if created or waiting for mobile confirmation then it will auto-cancel after 11 to 15 min (depends on when created);
|
|
136
|
+
* if trade is waiting for mobile confirmation and connection with the seller was lost then it will auto-cancel after 6 hours.
|
|
137
|
+
* We recommend adding project_id to purchase so that you can track a trade in case of a timeout or break of purchase request using the /check-many-project-id GET method one minute after the request.
|
|
138
|
+
* An array of possible messages with purchase errors and other information, such as status, can be seen by opening the response scheme, where:
|
|
139
|
+
* System busy - trade is cancelled due to tradelink check timeout or heavy load;
|
|
140
|
+
* buy_csgo - CS:GO purchases are deactivated on the market;
|
|
141
|
+
* buy_rust - RUST purchases are deactivated on the market.
|
|
142
|
+
*
|
|
143
|
+
* @param item_id Item id from fetching items
|
|
144
|
+
* @param price Price of the item 1$=1000
|
|
145
|
+
* @param token Token from tradelink
|
|
146
|
+
* @param partner Partner from tradelink
|
|
147
|
+
* @param project_id Your custom id string[50]
|
|
148
|
+
* @example
|
|
149
|
+
* // example resonse:
|
|
150
|
+
* {
|
|
151
|
+
* "success": true,
|
|
152
|
+
* "id": 1,
|
|
153
|
+
* "msg": "buy_csgo"
|
|
154
|
+
* }
|
|
155
|
+
*/
|
|
156
|
+
buyItemWithId(item_id, price, token, partner, project_id) {
|
|
157
|
+
return this.get('buy-one-p2p', qs.stringify({ item_id, price, token, partner, project_id }));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get recent purchases by filters - `/history`
|
|
161
|
+
*
|
|
162
|
+
* @param partner (optional) Partner from tradelink
|
|
163
|
+
* @param token (optional) Token from tradelink
|
|
164
|
+
* @param skip (optional) How many items to skip
|
|
165
|
+
* @example
|
|
166
|
+
* // example response:
|
|
167
|
+
* {
|
|
168
|
+
* "success": true,
|
|
169
|
+
* "history": [
|
|
170
|
+
* {
|
|
171
|
+
* "item_id": "27165625733",
|
|
172
|
+
* "trade_id": 5114261104,
|
|
173
|
+
* "token": "ssR242yo",
|
|
174
|
+
* "partner": 153912146,
|
|
175
|
+
* "created": "2020-01-18T07:28:12.360Z",
|
|
176
|
+
* "send_until": "2020-01-18T07:28:12.360Z",
|
|
177
|
+
* "reason": "Buyer failed to accept",
|
|
178
|
+
* "id": 4258189,
|
|
179
|
+
* "image": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/5040342865/200fx125f",
|
|
180
|
+
* "price": 1200,
|
|
181
|
+
* "name": "USP-S | Cortex (Field-Tested)",
|
|
182
|
+
* "status": 6
|
|
183
|
+
* }
|
|
184
|
+
* ]
|
|
185
|
+
* }
|
|
186
|
+
*/
|
|
187
|
+
getHistory(partner, token, skip) {
|
|
188
|
+
return this.get('history', qs.stringify({ partner, token, skip }));
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Checking the status of many steam trades by project_id identifier - `/check-many-steam`
|
|
192
|
+
*
|
|
193
|
+
* Please check success state. Success must be "true" and msg usually null, but if something went wrong, you will get error message here and you need to retry the request.
|
|
194
|
+
*
|
|
195
|
+
* @param ids Ids or id that you recived when purchasing items
|
|
196
|
+
* @example
|
|
197
|
+
* // example response:
|
|
198
|
+
* {
|
|
199
|
+
* "success": true,
|
|
200
|
+
* "msg": "Invalid ID",
|
|
201
|
+
* "trades": [
|
|
202
|
+
* {
|
|
203
|
+
* "id": 1,
|
|
204
|
+
* "price": 140,
|
|
205
|
+
* "name": "Nova | Sand Dune (Field-Tested)",
|
|
206
|
+
* "status": 4,
|
|
207
|
+
* "project_id": "My_custom_project_identifier_asgd6ad8sg68gasgas8d",
|
|
208
|
+
* "custom_id": "224bdce2-as44-5ae6-be3g-1a80500de23s",
|
|
209
|
+
* "trade_id": "3547735377",
|
|
210
|
+
* "done": false,
|
|
211
|
+
* "for_steamid64": "76561198338314XXX",
|
|
212
|
+
* "reason": "We couldn't validate your trade link, either your inventory is private or you can't trade",
|
|
213
|
+
* "seller_name": "turboTrade",
|
|
214
|
+
* "seller_avatar": "https://avatars.akamai.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_medium.jpg",
|
|
215
|
+
* "seller_steam_joined": 1589314982,
|
|
216
|
+
* "seller_steam_level": 45,
|
|
217
|
+
* "send_until": 1566796475,
|
|
218
|
+
* "last_updated": 1566796111,
|
|
219
|
+
* "counter": 10
|
|
220
|
+
* }
|
|
221
|
+
* ]
|
|
222
|
+
* }
|
|
223
|
+
*/
|
|
224
|
+
tradeRequestStatus(ids) {
|
|
225
|
+
let id = [];
|
|
226
|
+
if (typeof ids !== 'object')
|
|
227
|
+
id = [ids];
|
|
228
|
+
else
|
|
229
|
+
id = [...ids];
|
|
230
|
+
return this.get('check-many-steam', id.map((i) => `id=${i}`).join('&'));
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Check many steam trades - `check-many-project-id
|
|
234
|
+
*
|
|
235
|
+
* Please check success state. Success must be "true" and msg usually null, but if something went wrong, you will get error message here and you need to retry the request.
|
|
236
|
+
*
|
|
237
|
+
* @param ids Ids or id that you passed as project_id when making a purchase
|
|
238
|
+
* @example
|
|
239
|
+
* // example response:
|
|
240
|
+
* {
|
|
241
|
+
* "success": true,
|
|
242
|
+
* "msg": "Please try again",
|
|
243
|
+
* "trades": [
|
|
244
|
+
* {
|
|
245
|
+
* "id": 1,
|
|
246
|
+
* "price": 140,
|
|
247
|
+
* "name": "Nova | Sand Dune (Field-Tested)",
|
|
248
|
+
* "status": 4,
|
|
249
|
+
* "project_id": "My_custom_project_identifier_asgd6ad8sg68gasgas8d",
|
|
250
|
+
* "custom_id": "224bdce2-as44-5ae6-be3g-1a80500de23s",
|
|
251
|
+
* "trade_id": "3547735377",
|
|
252
|
+
* "done": false,
|
|
253
|
+
* "for_steamid64": "76561198338314XXX",
|
|
254
|
+
* "reason": "We couldn't validate your trade link, either your inventory is private or you can't trade",
|
|
255
|
+
* "seller_name": "turboTrade",
|
|
256
|
+
* "seller_avatar": "https://avatars.akamai.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_medium.jpg",
|
|
257
|
+
* "seller_steam_joined": 1589314982,
|
|
258
|
+
* "seller_steam_level": 45,
|
|
259
|
+
* "send_until": 1566796475,
|
|
260
|
+
* "last_updated": 1566796111,
|
|
261
|
+
* "counter": 10
|
|
262
|
+
* }
|
|
263
|
+
* ]
|
|
264
|
+
* }
|
|
265
|
+
*/
|
|
266
|
+
customTradeRequest(ids) {
|
|
267
|
+
let id = [];
|
|
268
|
+
if (typeof ids !== 'object')
|
|
269
|
+
id = [ids];
|
|
270
|
+
else
|
|
271
|
+
id = [...ids];
|
|
272
|
+
return this.get('check-many-project-id', id.map((i) => `id=${i}`).join('&'));
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Connect steam api and waxpeer api - `/set-my-steamapi`
|
|
276
|
+
*
|
|
277
|
+
* @param steam_api (optional) you can pass a steam api to waxpeer
|
|
278
|
+
* @example
|
|
279
|
+
* // example response:
|
|
280
|
+
* {
|
|
281
|
+
* "success": true,
|
|
282
|
+
* "msg": "string"
|
|
283
|
+
* }
|
|
284
|
+
*/
|
|
285
|
+
setMyKeys(steam_api) {
|
|
286
|
+
return this.get('set-my-steamapi', qs.stringify({ steam_api }));
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Due to the steam update, it became mandatory to pass regularly (we recommend sending once an hour and keep 6 hours from the time we receive it) to be online and sell on the marketplace.
|
|
290
|
+
*
|
|
291
|
+
* Token should be in base64 format and belong to your account.
|
|
292
|
+
*
|
|
293
|
+
* It is recommended to transmit it once an hour to maintain validity, as well as in case of refreshing
|
|
294
|
+
*
|
|
295
|
+
* If the "success" parameter in the response is false, you will not get online and most likely you need to update the token and send a new one
|
|
296
|
+
*
|
|
297
|
+
* @param token Steam access token in base64 format
|
|
298
|
+
* @example
|
|
299
|
+
* // example response:
|
|
300
|
+
* {
|
|
301
|
+
* "success": false,
|
|
302
|
+
* "msg": "Need to refresh access token",
|
|
303
|
+
* "exp": 1712852259
|
|
304
|
+
* }
|
|
305
|
+
*/
|
|
306
|
+
UserSteamToken(token) {
|
|
307
|
+
return this.post('user/steam-token', {
|
|
308
|
+
token: Buffer.from(token).toString('base64'),
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Due to the Steam update we recommend to send this request and do mobile confirmation only if you receive a successful response (success param is true).
|
|
313
|
+
* @param tradeid Created Steam trade id
|
|
314
|
+
* @param waxid Waxpeer uuid trade id (waxid in "send-trade" event OR "costum_id" from another source)
|
|
315
|
+
* @example
|
|
316
|
+
* // example response:
|
|
317
|
+
* {
|
|
318
|
+
* "success": false,
|
|
319
|
+
* "msg": "No token found"
|
|
320
|
+
* }
|
|
321
|
+
*
|
|
322
|
+
*/
|
|
323
|
+
steamTrade(tradeid, waxid) {
|
|
324
|
+
return this.post('steam-trade', { tradeid, waxid });
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Fetches your steam inventory make sure your steamid is connected on waxpeer - `/fetch-my-inventory`.
|
|
328
|
+
* Call this endpoint before calling {@link getMyInventory|getMyInventory()} (`/get-my-inventory`)
|
|
329
|
+
*
|
|
330
|
+
* @param game Game from supported games
|
|
331
|
+
* @example
|
|
332
|
+
* // example response:
|
|
333
|
+
* {
|
|
334
|
+
* "success": true,
|
|
335
|
+
* "total_inventory_count": 120
|
|
336
|
+
* }
|
|
337
|
+
*/
|
|
338
|
+
fetchInventory(game = 'csgo') {
|
|
339
|
+
return this.get('fetch-my-inventory', qs.stringify({ game }));
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Fetch all unique items and their min price and count - `/prices`
|
|
343
|
+
*
|
|
344
|
+
* @param game Game from supported games
|
|
345
|
+
* @param min_price (optional) Min price
|
|
346
|
+
* @param max_price (optional) Max price
|
|
347
|
+
* @param search (optional) Search by part of the name, ex: 'hardened'.
|
|
348
|
+
* @param minified (optional) Will return additional data about items if set to 0
|
|
349
|
+
* @param highest_offer (optional) Will return highest_offer for the items if set to 1
|
|
350
|
+
* @param single (optional) Will select only one item if set to 1
|
|
351
|
+
* @example
|
|
352
|
+
* // example response:
|
|
353
|
+
* {
|
|
354
|
+
* "success": true,
|
|
355
|
+
* "items": [
|
|
356
|
+
* {
|
|
357
|
+
* "name": "★ Hand Wraps | Cobalt Skulls (Minimal Wear)",
|
|
358
|
+
* "count": 5,
|
|
359
|
+
* "min": 937999,
|
|
360
|
+
* "img": "https://community.akamai.steamstatic.com/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DfVlxgLQFFibKkJQN3wfLYYgJK7dKyg5KKh8j4NrrFnm5D8fp3i-vT_I_KilihriwvOCyveMX6Ll9pORy_pgD8lrvxgJfpvpWamnZn6XUl5SmJm0DjhhlFbedp1PWYH1jNVaUcSqOKBnuCtYczFntLO18msw",
|
|
361
|
+
* "steam_price": "990000",
|
|
362
|
+
* "rarity_color": "#EB4B4B",
|
|
363
|
+
* "type": "Gloves"
|
|
364
|
+
* }
|
|
365
|
+
* ]
|
|
366
|
+
* }
|
|
367
|
+
*/
|
|
368
|
+
getPrices(game = 'csgo', min_price = undefined, max_price = undefined, search = undefined, minified = 1, highest_offer = 0, single = 0) {
|
|
369
|
+
return this.get('prices', qs.stringify({
|
|
370
|
+
game,
|
|
371
|
+
min_price,
|
|
372
|
+
max_price,
|
|
373
|
+
search: typeof search === 'string' && search?.length
|
|
374
|
+
? encodeURIComponent(search)
|
|
375
|
+
: undefined,
|
|
376
|
+
minified,
|
|
377
|
+
highest_offer,
|
|
378
|
+
single,
|
|
379
|
+
}));
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Fetch all dopplers phases by filters - `/prices/dopplers`
|
|
383
|
+
*
|
|
384
|
+
* @param phase (optional) Doppler phase. Will return all if set to 'any'. For multiple phases pass it like this phase=Emerald&phase=Ruby
|
|
385
|
+
* @param exterior (optional) Item exterior. Will return all if not set. For multiple exteriors pass it like this exterior=FN&exterior=MW
|
|
386
|
+
* @param weapon (optional) Weapon type. Will return all if not set. For multiple weapons pass it like this weapon=Bayonet&weapon=Karambit
|
|
387
|
+
* @param minified (optional) Will return additional data about items if set to 0 (steam_price, img, weapon, float, paint_index)
|
|
388
|
+
* @param min_price (optional) Min price
|
|
389
|
+
* @param max_price (optional) Max price
|
|
390
|
+
* @param search (optional) Search by part of the name, ex: 'bayonet'.
|
|
391
|
+
* @param single (optional) Will select only one item if set to 1
|
|
392
|
+
* @example
|
|
393
|
+
* {
|
|
394
|
+
* "success": true,
|
|
395
|
+
* "items": [
|
|
396
|
+
* {
|
|
397
|
+
* "name": "★ Butterfly Knife | Doppler (Factory New)",
|
|
398
|
+
* "item_id": "27253164358",
|
|
399
|
+
* "price": 1380000,
|
|
400
|
+
* "phase": "Phase 3",
|
|
401
|
+
* "steam_price": 1453040,
|
|
402
|
+
* "img": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/5070448210/200fx125f",
|
|
403
|
+
* "weapon": "Butterfly Knife",
|
|
404
|
+
* "paint_index": 420,
|
|
405
|
+
* "float": 0.0460052728652954
|
|
406
|
+
* }
|
|
407
|
+
* ],
|
|
408
|
+
* "msg": "Wrong input"
|
|
409
|
+
* }
|
|
410
|
+
*/
|
|
411
|
+
getPricesDopplers(phase = 'any', exterior = undefined, weapon = undefined, minified = 1, min_price = undefined, max_price = undefined, search = undefined, single = 0) {
|
|
412
|
+
return this.get('prices/dopplers', qs.stringify({
|
|
413
|
+
phase,
|
|
414
|
+
exterior,
|
|
415
|
+
weapon,
|
|
416
|
+
minified,
|
|
417
|
+
min_price,
|
|
418
|
+
max_price,
|
|
419
|
+
search,
|
|
420
|
+
single,
|
|
421
|
+
}));
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Fetch all listings by names. The maximum names per request is 50
|
|
425
|
+
* For csgo dopplers items 'phase' parameter available in response. Possible values: 'Emerald', 'Ruby', 'Sapphire', 'Black Pearl', 'Phase 1', 'Phase 2', 'Phase 3', 'Phase 4'
|
|
426
|
+
* @param game (optional) Game from supported games
|
|
427
|
+
* @example
|
|
428
|
+
* // example response:
|
|
429
|
+
* {
|
|
430
|
+
* "success": true,
|
|
431
|
+
* "data": {
|
|
432
|
+
* "AK-47 | Redline (Field-Tested)": {
|
|
433
|
+
* "listings": [
|
|
434
|
+
* [
|
|
435
|
+
* {
|
|
436
|
+
* "price": 12100,
|
|
437
|
+
* "by": "1247ffd5-f437-4a30-9953-10eda7df6e17",
|
|
438
|
+
* "item_id": "27165625733",
|
|
439
|
+
* "name": "AK-47 | Redline (Field-Tested)",
|
|
440
|
+
* "paint_index": 123,
|
|
441
|
+
* "steam_price": 14100,
|
|
442
|
+
* "classid": "3669724953",
|
|
443
|
+
* "image": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/3669724953"
|
|
444
|
+
* }
|
|
445
|
+
* ]
|
|
446
|
+
* ],
|
|
447
|
+
* "orders": [
|
|
448
|
+
* {}
|
|
449
|
+
* ],
|
|
450
|
+
* "history": [
|
|
451
|
+
* {}
|
|
452
|
+
* ],
|
|
453
|
+
* "info": {}
|
|
454
|
+
* },
|
|
455
|
+
* "★ Butterfly Knife | Gamma Doppler (Factory New)": {
|
|
456
|
+
* "listings": [
|
|
457
|
+
* [
|
|
458
|
+
* {
|
|
459
|
+
* "price": 2050000,
|
|
460
|
+
* "by": "1247ffd5-f437-4a30-9953-10eda7df6e17",
|
|
461
|
+
* "item_id": "27165625734",
|
|
462
|
+
* "name": "★ Butterfly Knife | Gamma Doppler (Factory New)",
|
|
463
|
+
* "paint_index": 572,
|
|
464
|
+
* "steam_price": 1709860,
|
|
465
|
+
* "classid": "5035516602",
|
|
466
|
+
* "image": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/5035516602",
|
|
467
|
+
* "phase": "Phase 4"
|
|
468
|
+
* }
|
|
469
|
+
* ]
|
|
470
|
+
* ],
|
|
471
|
+
* "orders": [
|
|
472
|
+
* {}
|
|
473
|
+
* ],
|
|
474
|
+
* "history": [
|
|
475
|
+
* {}
|
|
476
|
+
* ],
|
|
477
|
+
* "info": {}
|
|
478
|
+
* }
|
|
479
|
+
* }
|
|
480
|
+
* }
|
|
481
|
+
*/
|
|
482
|
+
massInfo(names, game = 'csgo') {
|
|
483
|
+
return this.post('mass-info', { name: names, sell: 1 }, qs.stringify({ game }));
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Check provided tradelink - `/check-tradelink`
|
|
487
|
+
* @param tradelink Target tradelink
|
|
488
|
+
* @example
|
|
489
|
+
* // example response:
|
|
490
|
+
* /{
|
|
491
|
+
* / "success": false,
|
|
492
|
+
* / "link": "https://steamcommunity.com/tradeoffer/new/?partner=900267897&token=P2YkRJOk",
|
|
493
|
+
* / "info": "You cannot trade with SteamUserName because they have a trade ban.",
|
|
494
|
+
* / "msg": "We couldn't validate your trade link, either your inventory is private or you can't trade",
|
|
495
|
+
* / "token": "P2YkRJOk",
|
|
496
|
+
* / "steamid32": 900267897,
|
|
497
|
+
* / "steamid64": 76561198000000000
|
|
498
|
+
* /}
|
|
499
|
+
*/
|
|
500
|
+
validateTradeLink(tradelink) {
|
|
501
|
+
return this.post('check-tradelink', { tradelink });
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Check weather items are available by item_id max 100 items - `/check-availability`
|
|
505
|
+
*
|
|
506
|
+
* @param item_id ItemIds that you want to check weather items are available
|
|
507
|
+
* @example
|
|
508
|
+
* // example response:
|
|
509
|
+
* {
|
|
510
|
+
* "success": true,
|
|
511
|
+
* "items": [
|
|
512
|
+
* {
|
|
513
|
+
* "item_id": "27165625733",
|
|
514
|
+
* "selling": true,
|
|
515
|
+
* "price": 1687470,
|
|
516
|
+
* "name": "★ Karambit | Fade (Factory New)",
|
|
517
|
+
* "image": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/310854699/200fx125f"
|
|
518
|
+
* }
|
|
519
|
+
* ]
|
|
520
|
+
* }
|
|
521
|
+
*/
|
|
522
|
+
checkItemAvailability(item_id) {
|
|
523
|
+
const ids = typeof item_id === 'object' ? item_id : [item_id];
|
|
524
|
+
return this.get('check-availability', ids.map((i) => `item_id=${i}`).join('&'));
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Edit price for listed items - `/edit-items`
|
|
528
|
+
*
|
|
529
|
+
* Array of items
|
|
530
|
+
* Rate limit of list/edit actions for each item_id is 2 requests per 120 seconds
|
|
531
|
+
* Note: For Rust items item_id must be a string type, since id is greater than the maximum for number type
|
|
532
|
+
* Set the price to 0 to remove the item from sale
|
|
533
|
+
* @param items Array of items with item_id and price keys
|
|
534
|
+
* @param game (optional) Game from supported games
|
|
535
|
+
* @example
|
|
536
|
+
* // example response:
|
|
537
|
+
* {
|
|
538
|
+
* "success": true,
|
|
539
|
+
* "updated": [
|
|
540
|
+
* {
|
|
541
|
+
* "item_id": "141414144",
|
|
542
|
+
* "price": "1000"
|
|
543
|
+
* }
|
|
544
|
+
* ],
|
|
545
|
+
* "failed": [
|
|
546
|
+
* {
|
|
547
|
+
* "item_id": 141414145,
|
|
548
|
+
* "price": 1000,
|
|
549
|
+
* "msg": "You can update price after 40 seconds",
|
|
550
|
+
* "msBeforeNext": 39636
|
|
551
|
+
* }
|
|
552
|
+
* ],
|
|
553
|
+
* "removed": 0
|
|
554
|
+
* }
|
|
555
|
+
*/
|
|
556
|
+
editItems(items, game = 'csgo') {
|
|
557
|
+
return this.post('edit-items', {
|
|
558
|
+
items,
|
|
559
|
+
}, qs.stringify({ game }));
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* List steam items from inventory - `/list-items-steam`
|
|
563
|
+
*
|
|
564
|
+
* @param items Items object https://api.waxpeer.com/docs/#/Steam/post_list_items_steam
|
|
565
|
+
* @param game (optional) Game from supported games
|
|
566
|
+
* @example
|
|
567
|
+
* // example value:
|
|
568
|
+
* {
|
|
569
|
+
* "success": true,
|
|
570
|
+
* "msg": "no items",
|
|
571
|
+
* "listed": [
|
|
572
|
+
* {
|
|
573
|
+
* "item_id": 141414144,
|
|
574
|
+
* "price": 1000,
|
|
575
|
+
* "name": "AWP | Asiimov (Field-tested)"
|
|
576
|
+
* }
|
|
577
|
+
* ],
|
|
578
|
+
* "failed": [
|
|
579
|
+
* {
|
|
580
|
+
* "item_id": 141414145,
|
|
581
|
+
* "price": 1000,
|
|
582
|
+
* "msg": "You can list your item after 40 seconds",
|
|
583
|
+
* "msBeforeNext": 39636
|
|
584
|
+
* }
|
|
585
|
+
* ]
|
|
586
|
+
* }
|
|
587
|
+
*/
|
|
588
|
+
listItemsSteam(items, game = 'csgo') {
|
|
589
|
+
return this.post('list-items-steam', {
|
|
590
|
+
items,
|
|
591
|
+
}, qs.stringify({ game }));
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Get listed steam items - `/list-items-steam`
|
|
595
|
+
*
|
|
596
|
+
* @param game (optional) Game from supported games
|
|
597
|
+
* @example
|
|
598
|
+
* // example response:
|
|
599
|
+
* {
|
|
600
|
+
* "success": true,
|
|
601
|
+
* "items": [
|
|
602
|
+
* {
|
|
603
|
+
* "item_id": "16037911576",
|
|
604
|
+
* "price": 2367941,
|
|
605
|
+
* "date": "2020-01-11T07:18:50.749Z",
|
|
606
|
+
* "position": 1,
|
|
607
|
+
* "name": "★ Butterfly Knife | Gamma Doppler (Factory New)",
|
|
608
|
+
* "market_name": "Gamma Doppler Phase 2",
|
|
609
|
+
* "steam_price": {
|
|
610
|
+
* "average": 2767941,
|
|
611
|
+
* "rarity_color": "string",
|
|
612
|
+
* "rarity": "string",
|
|
613
|
+
* "current": 2633000,
|
|
614
|
+
* "name": "★ Butterfly Knife | Gamma Doppler Phase 2 (Factory New)",
|
|
615
|
+
* "lowest_price": 2125555,
|
|
616
|
+
* "img": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpovbSsLQJf0ebcZThQ6tCvq4GGqPD1PrbQqW9e-NV9j_v-5YT0m1HllB81NDG3S9rEMFFrf1iC_QXqw7u9h5PqupTKyiNh6ClxtCvczUPmgUtPPbE-1qDISFicAqVXXP7V9p_o84A"
|
|
617
|
+
* }
|
|
618
|
+
* }
|
|
619
|
+
* ]
|
|
620
|
+
* }
|
|
621
|
+
*/
|
|
622
|
+
myListedItems(game = 'csgo') {
|
|
623
|
+
return this.get('list-items-steam', qs.stringify({ game }));
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Get items that you can list for sale - `/get-my-inventory`
|
|
627
|
+
*
|
|
628
|
+
* @param skip (optional) Skip items
|
|
629
|
+
* @param game (optional) Game from supported games
|
|
630
|
+
* @example
|
|
631
|
+
* // example response:
|
|
632
|
+
* {
|
|
633
|
+
* "success": true,
|
|
634
|
+
* "items": [
|
|
635
|
+
* {
|
|
636
|
+
* "item_id": "24758826121",
|
|
637
|
+
* "type": "Butterfly Knife",
|
|
638
|
+
* "icon_url": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpovbSsLQJf0ebcZThQ6tCvq4GGqPD1PrbQqW9e-NV9j_v-5YT0m1HmlB81NDG3OtOcdlM5MF3Srla4wO-8h5PuucyawHo37HZxsXePnEe20xseaLBnhPSACQLJc-o5FQc",
|
|
639
|
+
* "name": "★ Butterfly Knife | Gamma Doppler (Factory New)",
|
|
640
|
+
* "steam_price": {
|
|
641
|
+
* "average": 2767941,
|
|
642
|
+
* "rarity_color": "string",
|
|
643
|
+
* "rarity": "string",
|
|
644
|
+
* "current": 2633000,
|
|
645
|
+
* "name": "★ Butterfly Knife | Gamma Doppler Phase 2 (Factory New)",
|
|
646
|
+
* "lowest_price": 2125555,
|
|
647
|
+
* "img": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpovbSsLQJf0ebcZThQ6tCvq4GGqPD1PrbQqW9e-NV9j_v-5YT0m1HllB81NDG3S9rEMFFrf1iC_QXqw7u9h5PqupTKyiNh6ClxtCvczUPmgUtPPbE-1qDISFicAqVXXP7V9p_o84A"
|
|
648
|
+
* }
|
|
649
|
+
* }
|
|
650
|
+
* ],
|
|
651
|
+
* "count": 5,
|
|
652
|
+
* }
|
|
653
|
+
*/
|
|
654
|
+
getMyInventory(skip = 0, game = 'csgo') {
|
|
655
|
+
return this.get('get-my-inventory', qs.stringify({ skip, game }));
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Search multiple items by name - `/search-items-by-name`
|
|
659
|
+
*
|
|
660
|
+
* @param names Array of item names
|
|
661
|
+
* @param game (optional) Game from supported games
|
|
662
|
+
* @example
|
|
663
|
+
* // example response:
|
|
664
|
+
* {
|
|
665
|
+
* "success": true,
|
|
666
|
+
* "items": [
|
|
667
|
+
* {
|
|
668
|
+
* "name": "★ Butterfly Knife | Gamma Doppler (Factory New)",
|
|
669
|
+
* "price": 2050000,
|
|
670
|
+
* "image": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/5035516602",
|
|
671
|
+
* "item_id": "27165625734",
|
|
672
|
+
* "phase": "Phase 4"
|
|
673
|
+
* }
|
|
674
|
+
* ]
|
|
675
|
+
* }
|
|
676
|
+
*/
|
|
677
|
+
searchItems(names, game = 'csgo') {
|
|
678
|
+
const nameSearch = typeof names === 'object' ? names : [names];
|
|
679
|
+
const searchNames = nameSearch.map((i) => `names=${encodeURIComponent(i)}`).join('&');
|
|
680
|
+
return this.get('search-items-by-name', `game=${game}&${searchNames}`);
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Get recent purchases - `/history`
|
|
684
|
+
*
|
|
685
|
+
* @param skip skip since by default it returns 50 items
|
|
686
|
+
* @param partner (optional) partner parameter that you passed when buying
|
|
687
|
+
* @param token (optional) token parameter that you passed when buying
|
|
688
|
+
* @example
|
|
689
|
+
* // example response
|
|
690
|
+
* {
|
|
691
|
+
* "success": true,
|
|
692
|
+
* "history": [
|
|
693
|
+
* {
|
|
694
|
+
* "item_id": "27165625733",
|
|
695
|
+
* "trade_id": 5114261104,
|
|
696
|
+
* "token": "ssR242yo",
|
|
697
|
+
* "partner": 153912146,
|
|
698
|
+
* "created": "2020-01-18T07:28:12.360Z",
|
|
699
|
+
* "send_until": "2020-01-18T07:28:12.360Z",
|
|
700
|
+
* "reason": "Buyer failed to accept",
|
|
701
|
+
* "id": 4258189,
|
|
702
|
+
* "image": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/5040342865/200fx125f",
|
|
703
|
+
* "price": 1200,
|
|
704
|
+
* "name": "USP-S | Cortex (Field-Tested)",
|
|
705
|
+
* "status": 6
|
|
706
|
+
* }
|
|
707
|
+
* ]
|
|
708
|
+
* }
|
|
709
|
+
*/
|
|
710
|
+
myPurchases(skip = 0, partner = undefined, token = undefined) {
|
|
711
|
+
return this.get('history', qs.stringify({ skip, partner, token }));
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Fetch trades that need to be sent - `/ready-to-transfer-p2p`
|
|
715
|
+
*
|
|
716
|
+
* Connecting to the trade websocket is required to sell items (included in the extension and official app).
|
|
717
|
+
* If your connection is unstable (such as public Wi-Fi or mobile data), your trade websocket connection can be interrupted and the creation of a trade event may be missed.
|
|
718
|
+
* In order not to miss the sending of a trade you should be making this request at least every minute.
|
|
719
|
+
* Please check send_until timestamp before creating trade in Steam (we do not recommend creating a trade if one minute or less is left).
|
|
720
|
+
* Trade websocket documentation is published here (https://docs.waxpeer.com/?method=websocket).
|
|
721
|
+
*
|
|
722
|
+
* @param steam_api Steam API key
|
|
723
|
+
* @example
|
|
724
|
+
* // example response
|
|
725
|
+
* {
|
|
726
|
+
* "id": 1,
|
|
727
|
+
* "costum_id": "string",
|
|
728
|
+
* "trade_id": "3547735377",
|
|
729
|
+
* "tradelink": "https://steamcommunity.com/tradeoffer/new/?partner=14221897&token=i2yUssgF",
|
|
730
|
+
* "trade_message": "string",
|
|
731
|
+
* "done": false,
|
|
732
|
+
* "stage": 1,
|
|
733
|
+
* "creator": "seller",
|
|
734
|
+
* "send_until": "2022-10-30T15:18:46.566Z",
|
|
735
|
+
* "last_updated": "2022-10-30T15:13:08.139Z",
|
|
736
|
+
* "for_steamid64": "76561198338314XXX",
|
|
737
|
+
* "user": {
|
|
738
|
+
* "id": "182dbd1c-2es6-470s-z1q2-627xa6207211",
|
|
739
|
+
* "avatar": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/16/1622081f90ef78b0ca1372cae7663a2592939e00_medium.jpg"
|
|
740
|
+
* },
|
|
741
|
+
* "seller": {
|
|
742
|
+
* "id": "282dbd1c-2es6-470s-z1q2-627xa6207212",
|
|
743
|
+
* "avatar": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/16/1622081f90ef78b0ca1372cae7663a2592939e00_medium.jpg"
|
|
744
|
+
* },
|
|
745
|
+
* "items": [
|
|
746
|
+
* {
|
|
747
|
+
* "id": 4258189,
|
|
748
|
+
* "item_id": "27165625733",
|
|
749
|
+
* "give_amount": 25926,
|
|
750
|
+
* "merchant": "string",
|
|
751
|
+
* "image": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/5041964706/200fx125f",
|
|
752
|
+
* "price": 27581,
|
|
753
|
+
* "game": "csgo",
|
|
754
|
+
* "name": "AWP | Neo-Noir (Minimal Wear)",
|
|
755
|
+
* "status": 0
|
|
756
|
+
* }
|
|
757
|
+
* ]
|
|
758
|
+
* }
|
|
759
|
+
*/
|
|
760
|
+
readyToTransferP2P(steam_api) {
|
|
761
|
+
return this.get('ready-to-transfer-p2p', qs.stringify({ steam_api }));
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Force p2p status check. Recommended for usage with poor network connections - `/check-wss-user`
|
|
765
|
+
*
|
|
766
|
+
* If the network connection is poor, we recommend to request once per hour so that items remain or come back on sale.
|
|
767
|
+
* Note: This method will enable items for sale if you're connected to the trade websocket and even if you set your sales status to offline.
|
|
768
|
+
* @param steamid Your Steam64ID. Can be found in /user endpoint
|
|
769
|
+
* @example
|
|
770
|
+
* // example response
|
|
771
|
+
* {
|
|
772
|
+
* "success": true,
|
|
773
|
+
* "step": 3,
|
|
774
|
+
* "msg": "You can sell now"
|
|
775
|
+
* }
|
|
776
|
+
*/
|
|
777
|
+
checkWssUser(steamid) {
|
|
778
|
+
return this.get('check-wss-user', qs.stringify({ steamid }));
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Get Profile data - `/user`
|
|
782
|
+
*
|
|
783
|
+
* @example
|
|
784
|
+
* // example response:
|
|
785
|
+
* {
|
|
786
|
+
* "success": true,
|
|
787
|
+
* "user": {
|
|
788
|
+
* "wallet": 1000,
|
|
789
|
+
* "id": "11d6f117-1ad2-47e1-aca1-bcasdf9e37fa",
|
|
790
|
+
* "userid": 1,
|
|
791
|
+
* "id64": "765611983383140000",
|
|
792
|
+
* "avatar": "https://www.gravatar.com/avatar/31609d41eb6ccb405b1984967693de76?d=identicon&r=pg&s=32",
|
|
793
|
+
* "name": "WAXPEER",
|
|
794
|
+
* "sell_fees": 0.95,
|
|
795
|
+
* "can_p2p": true,
|
|
796
|
+
* "tradelink": "https://steamcommunity.com/tradeoffer/new/?partner=378049039&token=XWpC4ZTT",
|
|
797
|
+
* "login": "makc",
|
|
798
|
+
* "ref": "waxpeer",
|
|
799
|
+
* "sell_status": true
|
|
800
|
+
* }
|
|
801
|
+
* }
|
|
802
|
+
*/
|
|
803
|
+
getProfile() {
|
|
804
|
+
return this.get('user');
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Removes all listed items - `/remove-all`
|
|
808
|
+
*
|
|
809
|
+
* @param game (optional) Game from supported games (If not passed - will remove for all games)
|
|
810
|
+
* @example
|
|
811
|
+
* // example response:
|
|
812
|
+
* {
|
|
813
|
+
* "success": true,
|
|
814
|
+
* "msg": "string",
|
|
815
|
+
* "count": 0
|
|
816
|
+
* }
|
|
817
|
+
*/
|
|
818
|
+
removeAll(game = undefined) {
|
|
819
|
+
return this.get('remove-all', qs.stringify({ game }));
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Remove specified items - `/remove-items`
|
|
823
|
+
*
|
|
824
|
+
* @param ids Either array or one item_id that you want to remove from listing
|
|
825
|
+
* @example
|
|
826
|
+
* // example response:
|
|
827
|
+
* {
|
|
828
|
+
* "success": true,
|
|
829
|
+
* "count": 1
|
|
830
|
+
* }
|
|
831
|
+
*/
|
|
832
|
+
removeItems(ids) {
|
|
833
|
+
const removeId = typeof ids === 'object' ? ids : [ids];
|
|
834
|
+
return this.get('remove-items', removeId.map((i) => `id=${i}`).join('&'));
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Buy order trigger history - `/buy-order-history`
|
|
838
|
+
*
|
|
839
|
+
* @param skip (optional) How many orders to skip
|
|
840
|
+
* @param game (optional) Game from supported games (without game param will return for all)
|
|
841
|
+
* @param sort (optional) Sort by date (default: ASC)
|
|
842
|
+
* @example
|
|
843
|
+
* // example response:
|
|
844
|
+
* {
|
|
845
|
+
* "success": true,
|
|
846
|
+
* "history": [
|
|
847
|
+
* {
|
|
848
|
+
* "id": 0,
|
|
849
|
+
* "item_name": "string",
|
|
850
|
+
* "game": "string",
|
|
851
|
+
* "price": 0,
|
|
852
|
+
* "created": "2020-03-25T07:10:03.674Z",
|
|
853
|
+
* "last_updated": "2020-03-25T07:10:03.674Z"
|
|
854
|
+
* }
|
|
855
|
+
* ],
|
|
856
|
+
* "count": 2
|
|
857
|
+
* }
|
|
858
|
+
*/
|
|
859
|
+
buyOrderHistory(skip = 0, game, sort = 'ASC') {
|
|
860
|
+
return this.get('buy-order-history', qs.stringify({ skip, game, sort }));
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Active buy orders. Sorted by price DESC, if a filter by name is specified - `/buy-orders`
|
|
864
|
+
*
|
|
865
|
+
* @param skip (optional) How many orders to skip
|
|
866
|
+
* @param name (optional) Filter by item name
|
|
867
|
+
* @param own (optional) Filter by own orders
|
|
868
|
+
* @param game (optional) Game from supported games (without game param will return for all)
|
|
869
|
+
* @example
|
|
870
|
+
* // example response:
|
|
871
|
+
* {
|
|
872
|
+
* "success": true,
|
|
873
|
+
* "offers": [
|
|
874
|
+
* {
|
|
875
|
+
* "id": 1,
|
|
876
|
+
* "name": "MP9 | Hypnotic (Minimal Wear)",
|
|
877
|
+
* "price": 1,
|
|
878
|
+
* "amount": 5,
|
|
879
|
+
* "game": "csgo",
|
|
880
|
+
* "filled": 2,
|
|
881
|
+
* "by": "1247ffd5-f437-4a30-9953-10eda7df6e17"
|
|
882
|
+
* }
|
|
883
|
+
* ],
|
|
884
|
+
* "count": 0
|
|
885
|
+
* }
|
|
886
|
+
*/
|
|
887
|
+
buyOrders(skip = 0, name, own = '0', game) {
|
|
888
|
+
return this.get('buy-orders', qs.stringify({ skip, name, own, game }));
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Create a buy order to auto purchase items. Currently independent of the p2p status of the user - `/create-buy-order`
|
|
892
|
+
*
|
|
893
|
+
* @param name Item name
|
|
894
|
+
* @param amount Amount of items to buy
|
|
895
|
+
* @param price Max price that you want to buy item for (1000 = 1$)
|
|
896
|
+
* @param game Game from supported games
|
|
897
|
+
* @example
|
|
898
|
+
* // example response:
|
|
899
|
+
* {
|
|
900
|
+
* "success": true,
|
|
901
|
+
* "msg": "Placed order",
|
|
902
|
+
* "filled": 2,
|
|
903
|
+
* "id": 2007
|
|
904
|
+
* }
|
|
905
|
+
*/
|
|
906
|
+
createBuyOrder(name, amount, price, game = 'csgo') {
|
|
907
|
+
return this.post('create-buy-order', null, qs.stringify({ name, amount, price, game }));
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Edit buy order - `/edit-buy-order`
|
|
911
|
+
*
|
|
912
|
+
* @param id Order id
|
|
913
|
+
* @param amount Amount of items to buy
|
|
914
|
+
* @param price Max price that you want to buy item for (1000 = 1$)
|
|
915
|
+
* @example
|
|
916
|
+
* // example response:
|
|
917
|
+
* {
|
|
918
|
+
* "success": true,
|
|
919
|
+
* "msg": "string",
|
|
920
|
+
* "id": 2007,
|
|
921
|
+
* "amount": 6,
|
|
922
|
+
* "price": 2008
|
|
923
|
+
* }
|
|
924
|
+
*/
|
|
925
|
+
editBuyOrder(id, amount, price) {
|
|
926
|
+
return this.post('edit-buy-order', { id, amount, price });
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Remove buy order(s) - `/remove-buy-order`
|
|
930
|
+
*
|
|
931
|
+
* @param ids Either array or one order_id that you want to remove from listing
|
|
932
|
+
* @example
|
|
933
|
+
* // example response:
|
|
934
|
+
* {
|
|
935
|
+
* "success": true,
|
|
936
|
+
* "msg": "string",
|
|
937
|
+
* "removed": 5
|
|
938
|
+
* }
|
|
939
|
+
*/
|
|
940
|
+
removeBuyOrder(ids) {
|
|
941
|
+
const removeIds = typeof ids === 'object' ? ids : [ids];
|
|
942
|
+
return this.get('remove-buy-order', removeIds.map((i) => `id=${i}`).join('&'));
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Remove all buy orders by filters - `/remove-all-orders`
|
|
946
|
+
*
|
|
947
|
+
* Remove all orders with filter by game.
|
|
948
|
+
* Note: If response success is false, then some orders may be not removed (due to timeout), removed count will be also available in that case
|
|
949
|
+
*
|
|
950
|
+
* @param game (optional) Game from supported games (without game param will remove all)
|
|
951
|
+
*/
|
|
952
|
+
removeAllOrders(game) {
|
|
953
|
+
return this.get('remove-all-orders', qs.stringify({ game }));
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Fetches items based on the game you pass as a query - `/get-items-list`
|
|
957
|
+
*
|
|
958
|
+
* Responses are limited to 100 items.
|
|
959
|
+
*
|
|
960
|
+
* @param skip (optional) How many items to skip
|
|
961
|
+
* @param search (optional) Search by item name
|
|
962
|
+
* @param brand (optional) The specified category of game items, ex: rifle for CS:GO and Pants for Rust
|
|
963
|
+
* @param order (optional) Order by ASC or DESC (default DESC)
|
|
964
|
+
* @param order_by (optional) Return order
|
|
965
|
+
* @param exterior (optional) Exterior of the item (for CS:GO game)
|
|
966
|
+
* @param max_price (optional) Max price of the item (1000 = 1$)
|
|
967
|
+
* @param min_price (optional) Min price of the item (1000 = 1$)
|
|
968
|
+
* @param game Game from supported games (default csgo)
|
|
969
|
+
* @example
|
|
970
|
+
* // example response:
|
|
971
|
+
* {
|
|
972
|
+
* "success": true,
|
|
973
|
+
* "items": [
|
|
974
|
+
* {
|
|
975
|
+
* "name": "★ Butterfly Knife | Gamma Doppler (Factory New)",
|
|
976
|
+
* "price": 4999,
|
|
977
|
+
* "float": 0.1452850103378296,
|
|
978
|
+
* "best_deals": 541,
|
|
979
|
+
* "discount": 10,
|
|
980
|
+
* "steam_price": 5540,
|
|
981
|
+
* "image": "https://steamcommunity-a.akamaihd.net/economy/image/class/730/520026599/200fx125f",
|
|
982
|
+
* "item_id": "27402864642",
|
|
983
|
+
* "brand": "pistol",
|
|
984
|
+
* "type": "Glock-18"
|
|
985
|
+
* }
|
|
986
|
+
* ],
|
|
987
|
+
* "count": 100
|
|
988
|
+
* }
|
|
989
|
+
*/
|
|
990
|
+
getItemsList(skip = 0, search = undefined, brand = undefined, order = 'DESC', order_by = 'price', exterior = undefined, max_price = undefined, min_price = undefined, game = 'csgo') {
|
|
991
|
+
return this.get('get-items-list', qs.stringify({
|
|
992
|
+
skip,
|
|
993
|
+
search,
|
|
994
|
+
brand,
|
|
995
|
+
order,
|
|
996
|
+
order_by,
|
|
997
|
+
exterior,
|
|
998
|
+
max_price,
|
|
999
|
+
min_price,
|
|
1000
|
+
game,
|
|
1001
|
+
}));
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Fetches recommended item price and other info - `/get-steam-items`
|
|
1005
|
+
*
|
|
1006
|
+
* @param game Game app_id from supported games (default 730)
|
|
1007
|
+
* @param highest_offer (optional) Highest offer price (Not accurate, because not filtering offers by users balances)
|
|
1008
|
+
* @example
|
|
1009
|
+
* // example response:
|
|
1010
|
+
* {
|
|
1011
|
+
* "success": true,
|
|
1012
|
+
* "items": [
|
|
1013
|
+
* {
|
|
1014
|
+
* "name": "AK-47 | Predator (Minimal Wear)",
|
|
1015
|
+
* "average": 12685,
|
|
1016
|
+
* "game_id": 730,
|
|
1017
|
+
* "type": "Rifle",
|
|
1018
|
+
* "collection": "The Dust Collection",
|
|
1019
|
+
* "ru_name": "AK-47 | Хищник (Немного поношенное)"
|
|
1020
|
+
* }
|
|
1021
|
+
* ]
|
|
1022
|
+
* }
|
|
1023
|
+
*/
|
|
1024
|
+
getSteamItems(game = 730, highest_offer = '0') {
|
|
1025
|
+
return this.get('get-steam-items', qs.stringify({ game, highest_offer }));
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Check if user is in system - `/merchant/user`
|
|
1029
|
+
*
|
|
1030
|
+
* @param steam_id Steam ID of the user
|
|
1031
|
+
* @param merchant Your merchant name
|
|
1032
|
+
* @example
|
|
1033
|
+
* // example response:
|
|
1034
|
+
* {
|
|
1035
|
+
* "success": true,
|
|
1036
|
+
* "user": {
|
|
1037
|
+
* "steam_id": "string",
|
|
1038
|
+
* "can_sell": true,
|
|
1039
|
+
* "can_p2p": true,
|
|
1040
|
+
* "tradelink": "string"
|
|
1041
|
+
* }
|
|
1042
|
+
* }
|
|
1043
|
+
*/
|
|
1044
|
+
getMerchantUser(steam_id, merchant) {
|
|
1045
|
+
return this.get('merchant/user', qs.stringify({ steam_id, merchant }));
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Insert a user into a system - `/merchant/user`
|
|
1049
|
+
*
|
|
1050
|
+
* @param merchant Your merchant name
|
|
1051
|
+
* @param tradelink User's tradelink
|
|
1052
|
+
* @param steam_id Steam ID of the user
|
|
1053
|
+
* @example
|
|
1054
|
+
* // example response:
|
|
1055
|
+
* {
|
|
1056
|
+
* "success": true,
|
|
1057
|
+
* "user": {
|
|
1058
|
+
* "steam_id": "string",
|
|
1059
|
+
* "can_sell": true,
|
|
1060
|
+
* "can_p2p": true,
|
|
1061
|
+
* "tradelink": "string"
|
|
1062
|
+
* },
|
|
1063
|
+
* "msg": "string"
|
|
1064
|
+
* }
|
|
1065
|
+
*/
|
|
1066
|
+
postMerchantUser(merchant, tradelink, steam_id) {
|
|
1067
|
+
return this.post('merchant/user', { tradelink, steam_id }, qs.stringify({ merchant }));
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Fetch user inventory - `/merchant/inventory`
|
|
1071
|
+
*
|
|
1072
|
+
* Fetch and process user inventory via our system, call this endpoint before calling {@link MerchantInventory|MerchantInventory()} /merchant/inventory GET
|
|
1073
|
+
*
|
|
1074
|
+
* @param steam_id Steam ID of the user
|
|
1075
|
+
* @param merchant Your merchant name
|
|
1076
|
+
* @example
|
|
1077
|
+
* // example response:
|
|
1078
|
+
* {
|
|
1079
|
+
* "success": false,
|
|
1080
|
+
* "msg": "Inventory is closed",
|
|
1081
|
+
* "count": 0
|
|
1082
|
+
* }
|
|
1083
|
+
*/
|
|
1084
|
+
MerchantInventoryUpdate(steam_id, merchant) {
|
|
1085
|
+
return this.post('merchant/inventory', null, qs.stringify({ steam_id, merchant }));
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Get items that you can list for the user - `/merchant/inventory`
|
|
1089
|
+
*
|
|
1090
|
+
* Display items for the user to select.
|
|
1091
|
+
* Will return fetched items by {@link MerchantInventoryUpdate|MerchantInventoryUpdate()} /merchant/inventory POST
|
|
1092
|
+
*
|
|
1093
|
+
* @param merchant Your merchant name
|
|
1094
|
+
* @param steam_id Steam ID of the user
|
|
1095
|
+
* @param game Game app_id from supported games (default 730)
|
|
1096
|
+
* @param skip (optional) Skip first N items (default 0)
|
|
1097
|
+
*/
|
|
1098
|
+
MerchantInventory(steam_id, merchant, game = 730, skip = 0) {
|
|
1099
|
+
return this.get('merchant/inventory', qs.stringify({ steam_id, merchant, game, skip }));
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* List steam items from inventory - `/merchant/list-items-steam`
|
|
1103
|
+
*
|
|
1104
|
+
* Which items need to be deposited
|
|
1105
|
+
* If instant set to true, the price will be overwritten during processing
|
|
1106
|
+
*
|
|
1107
|
+
* @param merchant Your merchant name
|
|
1108
|
+
* @param steam_id Steam ID of the user
|
|
1109
|
+
* @param items Items to list
|
|
1110
|
+
* @param item_id Item ID to list
|
|
1111
|
+
* @param price Price to list (1000 = 1$)
|
|
1112
|
+
* @param instant (optional) Instant listing (default false)
|
|
1113
|
+
* @example
|
|
1114
|
+
* // example response:
|
|
1115
|
+
* {
|
|
1116
|
+
* "success": true,
|
|
1117
|
+
* "msg": "item_not_in_inventory",
|
|
1118
|
+
* "listed": [
|
|
1119
|
+
* {
|
|
1120
|
+
* "item_id": 141414144,
|
|
1121
|
+
* "price": 1000,
|
|
1122
|
+
* "name": "AWP | Asiimov (Field-tested)"
|
|
1123
|
+
* }
|
|
1124
|
+
* ],
|
|
1125
|
+
* "tx_id": "string"
|
|
1126
|
+
* }
|
|
1127
|
+
*/
|
|
1128
|
+
MerchantListItemsSteam(merchant, steam_id, items) {
|
|
1129
|
+
return this.post('merchant/list-items-steam', { items }, qs.stringify({ merchant, steam_id }));
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Returns history of deposits - `/merchant/deposits`
|
|
1133
|
+
*
|
|
1134
|
+
* @param merchant Your merchant name
|
|
1135
|
+
* @param steam_id (optional) Steam ID of the user
|
|
1136
|
+
* @param tx_id (optional) Transaction ID
|
|
1137
|
+
* @example
|
|
1138
|
+
* // example response:
|
|
1139
|
+
* {
|
|
1140
|
+
* "success": true,
|
|
1141
|
+
* "data": [
|
|
1142
|
+
* {
|
|
1143
|
+
* "id": "string",
|
|
1144
|
+
* "costum_id": "string",
|
|
1145
|
+
* "trade_id": "string",
|
|
1146
|
+
* "tradelink": "string",
|
|
1147
|
+
* "steamid_seller": "string",
|
|
1148
|
+
* "created": "2022-04-14T13:39:51.362Z",
|
|
1149
|
+
* "send_until": "2022-04-14T13:39:51.362Z",
|
|
1150
|
+
* "last_updated": "string",
|
|
1151
|
+
* "reason": "string",
|
|
1152
|
+
* "user": {
|
|
1153
|
+
* "name": "string",
|
|
1154
|
+
* "steam_id": "string",
|
|
1155
|
+
* "steam_joined": 0
|
|
1156
|
+
* },
|
|
1157
|
+
* "items": [
|
|
1158
|
+
* {
|
|
1159
|
+
* "item_id": "string",
|
|
1160
|
+
* "price": 0,
|
|
1161
|
+
* "give_amount": 0,
|
|
1162
|
+
* "name": "string",
|
|
1163
|
+
* "status": 5
|
|
1164
|
+
* }
|
|
1165
|
+
* ]
|
|
1166
|
+
* }
|
|
1167
|
+
* ]
|
|
1168
|
+
* }
|
|
1169
|
+
*/
|
|
1170
|
+
MerchantDepositsHistory(merchant, steam_id, tx_id) {
|
|
1171
|
+
return this.post('merchant/deposits', null, qs.stringify({ merchant, steam_id, tx_id }));
|
|
1172
|
+
}
|
|
1173
|
+
async post(url, body, token) {
|
|
1174
|
+
const path = `/${version}/${url}?api=${this.api}${token ? `&${token}` : ''}`;
|
|
1175
|
+
return this.apiClient
|
|
1176
|
+
.request({
|
|
1177
|
+
method: 'POST',
|
|
1178
|
+
path,
|
|
1179
|
+
body: JSON.stringify(body),
|
|
1180
|
+
headers: {
|
|
1181
|
+
'Content-Type': 'application/json',
|
|
1182
|
+
},
|
|
1183
|
+
})
|
|
1184
|
+
.then((response) => response.body.json());
|
|
1185
|
+
}
|
|
1186
|
+
async get(url, token) {
|
|
1187
|
+
const path = `/${version}/${url}?api=${this.api}${token ? `&${token}` : ''}`;
|
|
1188
|
+
return this.apiClient
|
|
1189
|
+
.request({
|
|
1190
|
+
method: 'GET',
|
|
1191
|
+
path,
|
|
1192
|
+
})
|
|
1193
|
+
.then((response) => response.body.json());
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
//# sourceMappingURL=waxpeer.js.map
|