WaxPeer API wrapper for Node.js
Full API documentation here
Trade websocket documentation here
$ npm i @darkgl/waxpeer
import { Waxpeer, TradeWebsocket } from 'waxpeer';
//API wrapper
const WP = new Waxpeer(WAXPEER_API);
//Trade websocket
const TS = new TradeWebsocket(WAXPEER_API, STEAM_ID, TRADELINK); //auto connect after init
TS.connectWss(); //connect
const user = await WP.getProfile();
console.log(user);
//MM-DD-YY
const history = WP.myHistory(0, '11-11-2022', '12-12-2022', 'DESC');
console.log(history);
let data = await WP.changeTradeLink('https://steamcommunity.com/tradeoffer/new/?partner=900267897&token=P2YkRJOk');
console.log(data);
let data = await WP.setMyKeys('11EDA9771EB4A200B579A530009CC000');
console.log(data);
const purchase = await WP.buyItemWithId(17441538677, 798500, 'oFvyi0Ma', '378049039');
console.log(purchase);
const purchase = await WP.buyItemWithName(
'AK-47 | Redline (Field-Tested)',
15000,
'oFvyi0Ma',
'378049039',
null,
'csgo',
);
console.log(purchase);
const items = await WP.getPrices('csgo');
console.log(items);
const items = await WP.getPricesDopplers('any');
console.log(items);
const items = await WP.massInfo(['AK-47 | Redline (Field-Tested)', 'csgo']);
console.log(items);
const items = await WP.searchItems(['AK-47 | Redline (Field-Tested)', 'csgo']);
console.log(items);
const items = await WP.customTradeRequest(['my_id_1', 'my_id_2']);
console.log(items);
const items = await WP.tradeRequestStatus(['12345', '23456']);
console.log(items);
const items = await WP.checkItemAvailability(['17441538677', '17441538678']);
console.log(items);
const data = await WP.validateTradeLink('https://steamcommunity.com/tradeoffer/new/?partner=900267897&token=P2YkRJOk');
console.log(data);
const data = await WP.getHistory('153912146', 'ssR242yo');
console.log(data);
const data = await WP.readyToTransferP2P('11EDA9771EB4A200B579A530009CC000');
console.log(data);
const data = await WP.checkWssUser('765611983383140000');
console.log(data);
const data = await WP.editItems([{ item_id: 1, price: 1 }], 'csgo');
console.log(data);
const data = await WP.fetchInventory('csgo');
console.log(data);
const data = await WP.getMyInventory(0, 'csgo');
console.log(data);
const data = await WP.myListedItems('csgo');
console.log(data);
const data = await WP.listItemsSteam([{ item_id: 1, price: 1 }], 'csgo');
console.log(data);
const data = await WP.removeItems([1, 2, 3, 4]);
console.log(data);
const data = await WP.removeAll('csgo');
console.log(data);
const data = await WP.buyOrderHistory(0, 'csgo');
console.log(data);
const data = await WP.buyOrders(0, 'AK-47 | Redline (Field-Tested)', '1', 'csgo');
console.log(data);
const data = await WP.createBuyOrder('AK-47 | Redline (Field-Tested)', 5, 15000, 'csgo');
console.log(data);
const data = await WP.editBuyOrder(123, 5, 1000);
console.log(data);
const data = await WP.removeBuyOrder([1, 2, 3]);
console.log(data);
const data = await WP.removeAllOrders('csgo');
console.log(data);
const data = await WP.getItemsList(0, null, 'knife', 'DESC');
console.log(data);
const data = await WP.getSteamItems(730);
console.log(data);
const data = await WP.getMerchantUser('76561198000000000', 'my_merchant');
console.log(data);
const data = await WP.postMerchantUser(
'my_merchant',
'https://steamcommunity.com/tradeoffer/new/?partner=900267897&token=P2YkRJOk',
'76561198000000000',
);
console.log(data);
const data = await WP.MerchantInventoryUpdate('76561198000000000', 'my_merchant');
console.log(data);
const data = await WP.MerchantInventory('76561198000000000', 'my_merchant', 730);
console.log(data);
const data = await WP.MerchantListItemsSteam('my_merchant', '76561198000000000', [{ item_id: 1, price: 1 }]);
console.log(data);
const data = await WP.MerchantDepositsHistory(
'my_merchant',
'76561198000000000',
'aaabe17b-dddd-4444-affd-dcad3fa6fbbe',
);
console.log(data);
TS.on('send-trade', (message: TradeWebsocketCreateTradeData) => {
console.log(message);
});
TS.on('cancelTrade', (message: TradeWebsocketCancelTradeData) => {
console.log(message);
});
TS.on('accept_withdraw', (message: TradeWebsocketAcceptWithdrawData) => {
console.log(message);
});
//manual sub events
WS.on('add_item', (message: ItemChangeEvent) => {
console.log(message); //waxpeer new item event
});
WS.on('remove', (message: ItemChangeEvent) => {
console.log(message); //waxpeer item removed event
});
WS.on('update_item', (message: UpdateItemEvent) => {
console.log(message); //waxpeer item price change event
});
//auto sub after auth
WS.on('change_user', (message: ChangeUserEvent) => {
if (message.name === 'wallet') console.log(message); //balance change event
});
WS.on('updated_item', (message: UpdatedItemEvent) => {
console.log(message); //trade status change event
});
try {
let user = await WP.getProfile();
console.log(user);
} catch (e) {
console.log(e);
}