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

cryptokingdom

v2.6.2

Published

a node.js wrapper for cryptokingdom API

Downloads

4

Readme

cryptokingdom.js

A Node.js client for the CryptoKingdom API.

This client supports public and private calls to the Agora Marketplace for trading on CryptoKingdom.

GitHub repository: github.com/saddammonero/cryptokingdom

License

ISC, open source. See LICENSE file.

install via NPM

npm install cryptokingdom

or install via Github

git clone https://github.com/saddammonero/cryptokingdom.git
cd cryptokingdom
npm install

or download the latest zip

Require the module

var CryptoKingdom = require('cryptokingdom');

If not installed via NPM, provide the path to lib/cryptokingdom.js

Create an instance of the client

var ck = new CryptoKingdom('USERNAME', 'PASSWORD', 'DEVICE_ID');

Make API calls

Supported API methods: buy, sell, cancelBid, cancelAsk, cancelAll, give, consume, getStateForItem. All methods require a callback function. The callback is passed two arguments: an error object (null if successful), and a data object (the response from the API).

Public API methods

These methods do not require user authentication.

getStateForItem(item, callback)

Returns the current order book for a given item.

ck.getStateForItem('W1604', function(err, data){
    if (err){
        //handle error
    }
    console.log(data);
});

Example response:

{ asks: [ { id: '2557', itemID: 'w1604', price: '200000', amount: '5', shortName: 'saddam'} ],
bids: [ { price: '80000', amount: '100', shortName: 'binaryFate' },
           { price: '30000', amount: '50', shortName: 'Zechariah' } ] }

Private API methods

These methods require username, password, and deviceID for user authentication.

buy(item, quantity, price, callback)

Places a bid order for a given item.

ck.buy('W1601', 1, 10000, function(err, response){
    if(err){
        //handle error
    }
    console.log(response);
});

Example response:

{ status: 200,
  error: false,
  data: { result: 'New bid added for 1 units of W1601 at a limit price of 10000.' } }
  

sell(item, quantity, price, callback)

Places an ask order for a given item.

ck.sell('W1601', 1, 250000, function(err, response){
        if(err){
            //handle error
        }
        console.log(response);
    });
    

Example response:

{ status: 200,
  error: false,
  data: { result: 'New ask added for 1 units of W1601 at a limit price of 250000.' } }
  

cancelAll(item, callback)

Cancels all ask and bid orders for a given item.

ck.cancelAll('W1601', function(err, response){
    if(err){
        //handle error
    }
    console.log(response);
});

Example response:

{ status: 200,
  error: false,
  data: { result: 'Your asks and bids are cancelled' } }
  

cancelBid(item, amount, price, callback)

Cancels a specified bid order.

ck.cancelBid('W1601', 1, 10000, function(err, response){
    if(err){
        console.log(err);
    }
    console.log(response);
});

Example response:

{ status: 200, error: false, data: { result: 'Order removed.' } }

cancelAsk(item, amount, price, callback)

Cancels a specified ask order.

ck.cancelAsk('W1601', 1, 300000, function(err, response){
    if(err){
        console.log(err);
    }
    console.log(response);
});

Example response:

{ status: 200, error: false, data: { result: 'Order removed.' } }

give(item, amount, recipient, callback)

Give an item to another player. Recipient can be specified as ID or username.

ck.give('W1601', 1, 57, function(err, response){
    if(err){
        console.log(err);
    }
    console.log(response);
});

OR:

ck.give('W1601', 1, 'Riddick', function(err, response){
    if(err){
        console.log(err);
    }
    console.log(response);
});

Example response:

{ status: 200,
  error: false,
  data: { result: '1 units of W1601 given to Riddick.' } }

consume(item, amount, callback)

Consume an item. Item must be consumable.

ck.consume('W1604', 1, function(err, response){
    if(err){
        console.log(err);
    }
    console.log(response);
});

Example response:

{ status: 200,
  error: false,
  data: { result: '1 units of W1604 consumed.' } }
  

create(item, amount, recipient, callback)

Create an item to recipient. Senior admin only.

ck.create('BEER', 1, 7, function(err, response){
    if(err){
        console.log(err);
    }
    console.log(response);
});

Example response:

{ status: 200,
  error: false,
  data: { result: '1 units of beer created to saddam' } }

transfer(item, amount, transferFrom, transferTo, callback)

Transfer an item from a character to another character. Senior admin only.

ck.transfer('BEER', 1, 7, 57, function(err, response){
    if(err){
        console.log(err);
    }
    console.log(response);
});

Example response:

{ status: 200,
  error: false,
  data: { result: '1 units of BEER transferred to Riddick.' } }