npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

opskins-tradeoffer-manager

v0.6.1

Published

Simple and sane [WAX ExpressTrade](https://trade.opskins.com) offer management

Downloads

12

Readme

node-opskins-tradeoffer-manager

Simple and sane WAX ExpressTrade offer management

npm version npm downloads npm downloads license

Contributing

Rule 1: Respect the ESLint config.

API

Basic Use

const TradeManager = require('opskins-tradeoffer-manager')

const manager = new TradeManager({
  apiKey: "", // opskins apiKey
  twoFactorSecret: "", // opskins 2fa secret
  pollInterval: "", // default is 5000
})

// listen for new offers.
manager.on("newOffer", offer => {

  manager.acceptOffer(offer.id).then(result => {
    // do somthing else...
  })

})

Constructor(options)

Initialize your class and start the recursive polling loop.

  • apiKey - Your opskins api key.
  • twoFactorSecret - Your opskins twofactor secret.
  • pollInterval - (optional) The rate you would like to check for new offers in ms.
  • pollData - (optional) Provide polling data to resume a previous state.
  • cancelTime - The amount of time to wait before a offer is automatically canceled.
const TradeManager = require('opskins-tradeoffer-manager')
const manager = new TradeManager(options)

Methods

manager.doPoll()

Force polling check of the express trade api.

Returns null

manager.resetPollTimer(time)

Reset the wait timer for the recursive polling loop. Returns null

  • time - Set the time to wait between loops.

manager.withdrawToOpskins(itemids)

Request withdraw of the items from your express trade inventory to opskins.

Returns the express trade api result.

  • itemids - Array of express trade item ids.

manager.sendOffer(offer)

Send an express trade offer.

Returns the created express trade offer.

  • offer - A object containing the express trade offer options.

manager.acceptOffer(offerid)

Accept an express trade offer.

Returns the express trade api result.

  • offerid - The id of the offer you would like to accept.

manager.cancelOffer(offerid)

Cancel an express trade offer.

Returns the canceled express trade offer.

  • offerid - The id of the offer you would like to accept.

manager.getOffer(offerid)

Get the state of an express trade offer.

Returns the canceled express trade offer.

  • offerid - The id of the offer you would like to accept.

manager.getOffers(state, historicalCutoff, options)

Get a list of express trade offers.

Returns a list the existing express trade offers.

  • state - The state you would like to filter the results by.
  • historicalCutoff - (optional) Filter and do not return offers past this time.
  • options - (optional) Express trade options such as page.

manager.getInventory(appid, options)

Get your express trade inventory.

Returns the express trade api result.

  • appid - The express trade appid you would like to get items for.
  • options - (optional) Express trade options such as page.

manager.getUserInventory(userid, appid, options)

Get another user's express trade inventory.

Returns the express trade api result.

  • userid - The express trade user's steamid or userid.
  • appid - The express trade appid you would like to get items for.
  • options - (optional) Express trade options such as page.

Events

Various events will be emitted after a poll has taken place.

manager.on("newOffer", offer => {
  // do somthing with the event...
})

manager.on("pollFailure", error)

Emitted when a polling attempt fails.

Emits the created error.

manager.on("pollSuccess")

Emitted when a polling attempt succeeds.

Emits null

manager.on("pollData", state)

Emitted when the raw polling state changes.

Emits the current state.

manager.on("unknownOfferSent", offer)

Emitted when a sent offer is found that does not exist in our polling history.

Emits the offer state.

manager.on("sentOfferChanged", (newState, oldState))

Emitted when a existing sent offer changes state.

Emits the updated and old offer state.

manager.on("sentOfferCanceled", offer)

Emitted when a existing sent offer is canceled.

Emits the offer state.

manager.on("newOffer", offer)

Emitted when a new offer is recieved.

Emits the offer state.

manager.on("receivedOfferChanged", (newState, oldState))

Emitted when a existing recieved offer changes state.

Emits the updated and old offer state.