fix(core): update
This commit is contained in:
@ -4,5 +4,41 @@ import * as plugins from './bobcat.plugins';
|
||||
* maps to an individual bobcat miner
|
||||
*/
|
||||
export class Bobcat {
|
||||
|
||||
// STATIC
|
||||
public static async createFromNetworkAddress(networkAddressArg: string) {
|
||||
const newBobcat = new Bobcat(networkAddressArg);
|
||||
await newBobcat.gatherMinerDetails();
|
||||
return newBobcat;
|
||||
}
|
||||
|
||||
// INSTANCE
|
||||
public networkAddress: string;
|
||||
constructor(networkAddress: string) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* checks the status of the miner
|
||||
*/
|
||||
public async checkMinerStatus() {
|
||||
const response = await plugins.smartrequest.getJson(`http://${this.networkAddress}/status.json`);
|
||||
const body: {
|
||||
"status": string,
|
||||
"gap": string,
|
||||
"miner_height": string,
|
||||
"blockchain_height": string,
|
||||
"epoch": "rpc"
|
||||
} = response.body;
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* gathers the miner details
|
||||
*/
|
||||
public async gatherMinerDetails() {
|
||||
const response: {
|
||||
|
||||
} = plugins.smartrequest.getJson(`http://${this.networkAddress}/miner.json`);
|
||||
|
||||
}
|
||||
}
|
@ -1,8 +1,14 @@
|
||||
import * as plugins from './bobcat.plugins';
|
||||
import { Bobcat } from './bobcat.classes.bobcat';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export class BobcatManager {
|
||||
|
||||
public bobcats: Bobcat[] = [];
|
||||
|
||||
public async addBobcat(networkAddressArg: string) {
|
||||
const newBobcat = await Bobcat.createFromNetworkAddress(networkAddressArg);
|
||||
this.bobcats.push(newBobcat);
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
import * as smartnetwork from '@pushrocks/smartnetwork';
|
||||
import * as smartrequest from '@pushrocks/smartrequest';
|
||||
|
||||
export {
|
||||
smartnetwork,
|
||||
smartrequest
|
||||
}
|
||||
|
Reference in New Issue
Block a user