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

moneypot

v1.0.1

Published

Node.js package for Moneypot

Downloads

2

Readme

API Reference

Amounts of Bitcoin are given and expected in satoshi (0.00000001 BTC) unless noted otherwise.

Multipliers are given and expected in integer format, e.g. 1920 for 19.20x unless noted otherwise.

MoneyPot

calculateElapsed(multiplier) -> Number

Calculate the amount of time in milliseconds that must pass for multiplier to be reached.

calculateMultiplier(elapsed) -> Number

Calculate the current multiplier of a game after a given amount of time in milliseconds has passed.

getCookie(options) -> Promise

Acquire a new session cookie and return a Bluebird Promise.

options must be an Object that must have the fields username and password, which will be used to obtain a new session cookie.

options may also contain a loginURI String field, which will override the default login URI of https://www.moneypot.com/login.

getToken(options) -> Promise

Acquire a new one-time token and return a Bluebird Promise.

options must be an Object that must have a cookie field, which will be used to obtain the one-time token.

options may also contain a tokenURI String field, which will override the default one-time token URI of https://www.moneypot.com/ott.

formatBTC(amount, [unit]) -> String

Return a string representation of amount satoshi using unit, which must be one of the following:

  • BTC
  • mBTC
  • bit or µBTC or uBTC
  • satoshi

If unit is omitted, an appropriate one is chosen automatically.

losingOdds(target, [start]) -> Number

Calculate the probability of a game crashing before target is reached rounded to six decimals.

start is the multiplier which has already been reached at the time of the calculation. If it is omitted, the game is assumed to have not yet started.

winningOdds(target, [start]) -> Number

Calculate the probability of a game crashing after target is reached rounded to six decimals.

start is the multiplier which has already been reached at the time of the calculation. If it is omitted, the game is assumed to have not yet started.

Game

{
  id: Number,
  players: [ Player ],
  multiplier: Number,
  state: String,
  maxWin: Number
}

new Game([players]) -> Game

Return a new Game.

players is optional and must be an Array of Player objects. players is not required to be sorted.

addPlayer(player, [wager, [multiplier]])

Add a new Player to the game's players array in the correct location.

player must be either a Player object, in which case wager and multiplier are ignored, or a String, in which case a new Player is created.

wager and multiplier default to 0 if omitted.

bonus([player]) -> Number or Object

Calculate the boni of the current game.

player must be a Player or a String, in which case a Number indicating the player's bonus for this game is returned. If it is a Player, it is matched to the player in players by its name field, not by reference.

If player is omitted, a map of player names to their respective bonus is returned instead.

changeMultiplier(player, multiplier)

Change a player's multiplier while keeping the sorting order of players intact.

player must be a Player or a String. If it is a Player, it is matched to the player in players by its name field, not by reference.

changeWager(player, wager)

Change a player's wager while keeping the sorting order of players intact.

player must be a Player or a String. If it is a Player, it is matched to the player in players by its name field, not by reference.

clone() -> Object

Create a deep copy of the Game, retaining the standard fields.

contains(player) -> Boolean

Return true if the game contains player and false otherwise.

player must be a Player or a String. If it is a Player, it is matched to the player in players by its name field, not by reference.

isSorted() -> Boolean

Returns true if the game's players array is correctly sorted and false otherwise.

Player

{
  name: String,
  wager: Number,
  multiplier: Number,
}

new Player(name, [wager, [multiplier]]) -> Player

Create a new Player.

wager and multiplier both default to 0 when omitted.

Session

{
  username: String,
  balance: Number,
  game: Game
}

new Session(options) -> Promise

Open a new connection to MoneyPot and return a Bluebird Promise that resolves with an array containing the Session and the results from the join process as soon as the join process is completed.

options must be an Object that may have a token field, which is a one-time token as returned by MoneyPot.getToken in String from. If no token field is provided, an unauthenticated session is created.

options may also contain a socketURI String field, which will override the default game server URI of wss://game.moneypot.com.

cashOut([multiplier]) -> Promise

Cash the player out and return a Bluebird Promise.

If multiplier is given, the player is attempted to be cashed out at that multiplier or immediately if the multiplier has already passed.

If multiplier is omitted, the cash-out is attempted immediately.

close()

Close the underlying socket.

submitWager(wager, [multiplier]) -> Promise

Make a new bet with an optional auto cash-out multiplier and return a Bluebird Promise.