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

expresstrade

v1.1.2

Published

Interact with the OPSkins ExpressTrade API from Node.js

Downloads

1,212

Readme

OPSkins ExpressTrade API for Node.js

This module provides easy interaction with the OPSkins ExpressTrade API. It provides a basic schema of the API to perform simple checks on the required inputs, and it automatically adds the 2FA token if required.

All you need to run a bot is your API key and the secret of your 2FA registered with your OPSkins account.

Installation

npm i expresstrade --save

Usage

var ExpressTrade = require('expresstrade')

var ET = new ExpressTrade({
  apikey: 'Your OPSkins API Key',
  twofactorsecret: 'Your OPSkins 2FA Secret',
  pollInterval: 5000
})

ET.IUser.GetInventory((err, body) => {
  // ...
})

ET.ITrade.SendOfferToSteamId({steam_id: '76561197982275081', items: '1234,5678'}, (err, body) => {
  // ...
})

ET.on('offerReceived', (_offer) => {
  console.log(_offer.id)

  ET.ITrade.CancelOffer({offer_id: _offer.id})
})

Syntax

You can either address the methods as object properties like this:

ET.IUser.GetInventory((err, body) => {
  // ...
})

or address the path like this:

ET.request('IUser/GetInventory', ((err, body) => {
  // ...
})

Request Methods (GET/POST)

The required methods are saved in the API schema and node-expresstrade handles the conversion for GET (query string) and POST (form) on its own.

node-expresstrade accepts any JSON object containin the data.

Events

If pollInterval is set, node-expresstrade will poll for changes. If any new or changed offers are detected, an event will be emitted.

any

Emitted on any event.

offerSent

Emitted when an offer has been sent out. The offer is active and the recipient can accept it to exchange the items.

offerReceived

Emitted when an offer was received. The offer is active and you can accept it to exchange the items.

offerAccepted

Emitted when an offer has been accepted. The recipient accepted the offer and items were exchanged.

offerExpired

Emitted when an offer has expired. The offer expired from inactivity.

offerCancelled

Emitted when an offer was cancelled. The sender cancelled the offer.

offerDeclined

Emitted when an offer has been declined. The recipient declined the offer.

offerNoLongerValid

Emitted when an offer is no longer valid. One of the items in the offer is no longer available/eligible so the offer was cancelled automatically.

caseOpenPending

Emitted when an offer has a pending case opening. The trade offer was initiated by a VCase site and it's awaiting ETH confirmations. The vKeys have been removed from the user iventory but may be restored on error later.

caseOpenExpired

Emitted when an offer for a case opening has expired. The trade offer was initiated by a VCase site and there was an error opening the case due to backend issues. No items should have been exchanged.

caseOpenFailed

Emitted when an offer for a case opening failed. The trade offer was initiated by a VCase site and VGO was unable to generate items on the blockchain, so the vKeys have been refunded.