const{HDPoolPublicApi}=require('hdpool-api');
constclient=newHDPoolPublicApi();
(async()=>{
awaitclient.init();
constpoolStats=awaitclient.getPoolStats();
constloginCodeResponse=awaitclient.getLoginCode();// Retrieve login code png
constloginResponse=awaitclient.login('[email protected]','mypassword','123456');
client.onBestMiningInfo(bestMiningInfo=>{
// Do stuff
});
})();
const{HDPoolAccountApi}=require('hdpool-api');
constuserId=12345;
constsessionKey='rOw7vZuqaC0GbapWGxeUECwLfDJaE2J74aCrmgnRfroolPuMOZUX7GotMRsy';
constclient=newHDPoolAccountApi(userId,sessionKey);
(async()=>{
awaitclient.init();
constuserInfo=awaitclient.getUserInfo();
constearningsStats=awaitclient.getEarningsStats();
constminers=awaitclient.getMiners();
constpledgeState=awaitclient.getPledgeState();
constboundPlotter=awaitclient.getBoundPlotter();
constdepositHistory=awaitclient.getDepositHistory();
constwithdrawHistory=awaitclient.getWithdrawHistory();
constearningsHistory=awaitclient.getEarningsHistory();
constexpectedEarningsHistory=awaitclient.getExpectedEarningsHistory();
constpoolStats=awaitclient.getPoolStats();
constnextFreePaymentDate=awaitclient.getNextFreePaymentDate();// When we can send a payout without paying fees
awaitclient.withdraw(Math.round(5*Math.pow(10,8)),'some code');// withdraw 5 BHD
awaitclient.cancelWithdraw(1234);// Cancel the withdraw with id 1234
constdepositAddr=awaitclient.getDepositAddr();// retrieve your deposit addr
client.onBestMiningInfo(bestMiningInfo=>{
// Do stuff
});
})();
const{HDPoolMiningApi}=require('hdpool-api');
constaccountKey='dpvwfv34-xprf-15t2xwb12o8yglm4palf55';
constminerName='Miner 1';
constcapacityInGB=512;
constclient=newHDPoolMiningApi(accountKey,minerName,capacityInGB);
(async()=>{
awaitclient.init();
constminingInfo=awaitclient.getMiningInfo();
client.onMiningInfo(miningInfo=>{
// Do stuff
});
client.submitNonce('12297078971021390907',143779,'111137519053',81);
})();
- Login to hdpool
- Open the dev console (F12) and enter
localStorage.getItem('sess')
into the console - Copy the uid (userId) and key (sessionKey) values
GNU GPLv3 (seeLICENSE)