fix(core): update
This commit is contained in:
parent
babcb832f3
commit
e5fe74d2d2
371
package-lock.json
generated
371
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,7 @@
|
|||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.25",
|
||||||
"@gitzone/tsbundle": "^1.0.78",
|
"@gitzone/tsbundle": "^1.0.78",
|
||||||
"@gitzone/tstest": "^1.0.44",
|
"@gitzone/tstest": "^1.0.44",
|
||||||
|
"@pushrocks/qenv": "^4.0.10",
|
||||||
"@pushrocks/tapbundle": "^4.0.7",
|
"@pushrocks/tapbundle": "^4.0.7",
|
||||||
"@types/node": "^17.0.21",
|
"@types/node": "^17.0.21",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
@ -36,6 +37,7 @@
|
|||||||
"readme.md"
|
"readme.md"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@pushrocks/smartnetwork": "^2.0.14",
|
||||||
"@pushrocks/smartrequest": "^1.1.56"
|
"@pushrocks/smartrequest": "^1.1.56"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
|
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
|
||||||
|
import { Qenv } from '@pushrocks/qenv';
|
||||||
|
|
||||||
|
const testQenv = new Qenv('./', './.nogit');
|
||||||
|
|
||||||
import * as bobcat from '../ts/index';
|
import * as bobcat from '../ts/index';
|
||||||
|
|
||||||
let testBobcatManager: bobcat.BobcatManager;
|
let testBobcatManager: bobcat.BobcatManager;
|
||||||
@ -9,8 +13,17 @@ tap.test('first test', async () => {
|
|||||||
expect(testBobcatManager).toBeInstanceOf(bobcat.BobcatManager);
|
expect(testBobcatManager).toBeInstanceOf(bobcat.BobcatManager);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should add a Bobcat miner', async () => {
|
||||||
|
const bobcatAddresses = testQenv.getEnvVarOnDemand('BOBCATS').split(',');
|
||||||
|
console.log(bobcatAddresses);
|
||||||
|
|
||||||
|
for (const bobcatAddress of bobcatAddresses) {
|
||||||
|
await testBobcatManager.addBobcat(bobcatAddress);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('', async () => {
|
tap.test('', async () => {
|
||||||
testBobcat = new bobcat.Bobcat();
|
testBobcat = new bobcat.Bobcat('bobcat.bleu.de');
|
||||||
expect(testBobcat).toBeInstanceOf(bobcat.Bobcat);
|
expect(testBobcat).toBeInstanceOf(bobcat.Bobcat);
|
||||||
})
|
})
|
||||||
|
|
@ -4,5 +4,41 @@ import * as plugins from './bobcat.plugins';
|
|||||||
* maps to an individual bobcat miner
|
* maps to an individual bobcat miner
|
||||||
*/
|
*/
|
||||||
export class Bobcat {
|
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 * as plugins from './bobcat.plugins';
|
||||||
|
import { Bobcat } from './bobcat.classes.bobcat';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export class BobcatManager {
|
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';
|
import * as smartrequest from '@pushrocks/smartrequest';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
smartnetwork,
|
||||||
smartrequest
|
smartrequest
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user