2.2.1 • Published 5 years ago

hdpool-api v2.2.1

Weekly downloads
4
License
GPL-3.0
Repository
github
Last release
5 years ago

HDPool API

Software License npm npm weekly downloads

Usage

Public API

const { HDPoolPublicApi } = require('hdpool-api');

const client = new HDPoolPublicApi();

(async () => {
  await client.init();

  const poolStats = await client.getPoolStats();

  const loginCodeResponse = await client.getLoginCode(); // Retrieve login code png

  const loginResponse = await client.login('example@mail.tld', 'mypassword', '123456');

  client.onBestMiningInfo(bestMiningInfo => {
      // Do stuff
    });
})();

Account API

const { HDPoolAccountApi } = require('hdpool-api');

const userId = 12345;
const sessionKey = 'rOw7vZuqaC0GbapWGxeUECwLfDJaE2J74aCrmgnRfroolPuMOZUX7GotMRsy';

const client = new HDPoolAccountApi(userId, sessionKey);

(async () => {
  await client.init();

  const userInfo = await client.getUserInfo();
  const earningsStats = await client.getEarningsStats();
  const miners = await client.getMiners();
  const pledgeState = await client.getPledgeState();
  const boundPlotter = await client.getBoundPlotter();
  const depositHistory = await client.getDepositHistory();
  const withdrawHistory = await client.getWithdrawHistory();
  const earningsHistory = await client.getEarningsHistory();
  const expectedEarningsHistory = await client.getExpectedEarningsHistory();
  const poolStats = await client.getPoolStats();
  const nextFreePaymentDate = await client.getNextFreePaymentDate(); // When we can send a payout without paying fees
  
  await client.withdraw(Math.round(5 * Math.pow(10, 8)), 'some code'); // withdraw 5 BHD
  await client.cancelWithdraw(1234); // Cancel the withdraw with id 1234
  const depositAddr= await client.getDepositAddr(); // retrieve your deposit addr
  
  client.onBestMiningInfo(bestMiningInfo => {
    // Do stuff
  });
})();

Mining API

const { HDPoolMiningApi } = require('hdpool-api');

const accountKey = 'dpvwfv34-xprf-15t2xwb12o8yglm4palf55';
const minerName = 'Miner 1';
const capacityInGB = 512;

const client = new HDPoolMiningApi(accountKey, minerName, capacityInGB);

(async () => {
  await client.init();

  const miningInfo = await client.getMiningInfo();

  client.onMiningInfo(miningInfo => {
    // Do stuff
  });

  client.submitNonce('12297078971021390907', 143779, '111137519053', 81);
})();

Obtaining the userId and sessionKey

  • Login to hdpool
  • Open the dev console (F12) and enter localStorage.getItem('sess') into the console
  • Copy the uid (userId) and key (sessionKey) values

License

GNU GPLv3 (see LICENSE)

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago