nym-api tests
This commit is contained in:
@@ -109,3 +109,6 @@ mixnet-opt: wasm
|
||||
generate-typescript:
|
||||
cd tools/ts-rs-cli && cargo run && cd ../..
|
||||
yarn types:lint:fix
|
||||
|
||||
run-validator-tests:
|
||||
cd nym-api/tests/functional_test && yarn test:qa
|
||||
@@ -0,0 +1,7 @@
|
||||
.vscode
|
||||
node_modules
|
||||
build
|
||||
coverage
|
||||
dist
|
||||
.cache
|
||||
jest.config.js
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"root": true,
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"import/extensions": "off",
|
||||
"no-console": ["warn", { "allow": ["warn", "error"] }],
|
||||
"import/prefer-default-export": "off",
|
||||
"prettier/prettier": ["error"]
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/*.ts", "**/*.tsx"],
|
||||
"rules": {
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"no-shadow": "off",
|
||||
"@typescript-eslint/no-shadow": ["error"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
dist
|
||||
coverage/
|
||||
.DS_Store
|
||||
.idea/
|
||||
junit.xml
|
||||
+783
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
<!-- ABOUT THE PROJECT -->
|
||||
## validator-api-test suite
|
||||
## nym-api-test suite
|
||||
|
||||
A Typescript test framework utilising Jest and Node to perform tests against the NYM validator-apis.
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import ConfigHandler from "../../src/config/configHandler";
|
||||
import ContractCache from "../../src/endpoints/CirculatingSupply";
|
||||
let contract: ContractCache;
|
||||
let config: ConfigHandler;
|
||||
|
||||
|
||||
describe("Get circulating supply", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
contract = new ContractCache();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get circulating supply amounts", async (): Promise<void> => {
|
||||
const response = await contract.getCirculatingSupply();
|
||||
|
||||
let initial: number = +(response.initial_supply.amount);
|
||||
let mixmining: number = +(response.mixmining_reserve.amount);
|
||||
let vest: number = +(response.vesting_tokens.amount);
|
||||
let circsupply: number = +(response.circulating_supply.amount);
|
||||
|
||||
expect(typeof response.vesting_tokens.amount).toBe('string');
|
||||
expect(initial - mixmining - vest).toStrictEqual(circsupply);
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import ContractCache from "../../src/endpoints/ContractCache";
|
||||
import ConfigHandler from "../../src/config/configHandler";
|
||||
|
||||
let contract: ContractCache;
|
||||
let config: ConfigHandler;
|
||||
|
||||
|
||||
describe("Get epoch info", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
contract = new ContractCache();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get epoch reward params", async (): Promise<void> => {
|
||||
const response = await contract.getEpochRewardParams();
|
||||
expect(typeof response.interval.reward_pool).toBe('string');
|
||||
expect(typeof response.interval.staking_supply_scale_factor).toBe('string');
|
||||
expect(typeof response.interval.staking_supply).toBe('string');
|
||||
expect(typeof response.interval.epoch_reward_budget).toBe('string');
|
||||
expect(typeof response.interval.stake_saturation_point).toBe('string');
|
||||
expect(typeof response.interval.sybil_resistance).toBe('string');
|
||||
expect(typeof response.interval.active_set_work_factor).toBe('string');
|
||||
expect(typeof response.interval.interval_pool_emission).toBe('string');
|
||||
expect(typeof response.active_set_size).toBe('number');
|
||||
expect(typeof response.rewarded_set_size).toBe('number');
|
||||
});
|
||||
|
||||
it("Get current epoch", async (): Promise<void> => {
|
||||
const response = await contract.getCurrentEpoch();
|
||||
expect(typeof response.id).toBe('number');
|
||||
expect(typeof response.epochs_in_interval).toBe('number');
|
||||
expect(typeof response.current_epoch_id).toBe('number');
|
||||
expect(typeof response.current_epoch_start).toBe('string');
|
||||
expect(typeof response.epoch_length.secs).toBe('number');
|
||||
expect(typeof response.epoch_length.nanos).toBe('number');
|
||||
expect(typeof response.total_elapsed_epochs).toBe('number');
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
import ContractCache from "../../../src/endpoints/ContractCache";
|
||||
import ConfigHandler from "../../../src/config/configHandler";
|
||||
|
||||
let contract: ContractCache;
|
||||
let config: ConfigHandler;
|
||||
|
||||
|
||||
describe("Get gateway data", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
contract = new ContractCache();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get all gateways", async (): Promise<void> => {
|
||||
const response = await contract.getGateways();
|
||||
response.forEach((gateway) => {
|
||||
//overview
|
||||
expect(typeof gateway.owner).toBe('string');
|
||||
expect(typeof gateway.block_height).toBe('number');
|
||||
|
||||
if (gateway.proxy === null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
expect(typeof gateway.proxy).toBe('string');
|
||||
}
|
||||
|
||||
//pledge_amount
|
||||
expect(typeof gateway.pledge_amount.denom).toBe('string');
|
||||
expect(typeof gateway.pledge_amount.amount).toBe('string');
|
||||
|
||||
//gateway
|
||||
expect(typeof gateway.gateway.host).toBe('string');
|
||||
expect(typeof gateway.gateway.mix_port).toBe('number');
|
||||
expect(typeof gateway.gateway.clients_port).toBe('number');
|
||||
expect(typeof gateway.gateway.location).toBe('string');
|
||||
expect(typeof gateway.gateway.sphinx_key).toBe('string');
|
||||
expect(typeof gateway.gateway.identity_key).toBe('string');
|
||||
expect(typeof gateway.gateway.version).toBe('string');
|
||||
});
|
||||
});
|
||||
|
||||
it("Get blacklisted gateways", async (): Promise<void> => {
|
||||
const response = await contract.getBlacklistedGateways();
|
||||
response.forEach(function (value) {
|
||||
expect(typeof value).toBe('string');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,173 @@
|
||||
import ContractCache from "../../../src/endpoints/ContractCache";
|
||||
import ConfigHandler from "../../../src/config/configHandler";
|
||||
|
||||
let contract: ContractCache;
|
||||
let config: ConfigHandler;
|
||||
|
||||
|
||||
describe("Get mixnode data", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
contract = new ContractCache();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get all mixnodes", async (): Promise<void> => {
|
||||
const response = await contract.getMixnodes();
|
||||
|
||||
response.forEach((mixnode) => {
|
||||
//bond information overview
|
||||
expect(typeof mixnode.bond_information.mix_id).toBe('number');
|
||||
expect(typeof mixnode.bond_information.owner).toBe('string');
|
||||
expect(typeof mixnode.bond_information.original_pledge.amount).toBe('string');
|
||||
expect(typeof mixnode.bond_information.original_pledge.denom).toBe('string');
|
||||
expect(typeof mixnode.bond_information.layer).toBe('number');
|
||||
expect(typeof mixnode.bond_information.bonding_height).toBe('number');
|
||||
expect(typeof mixnode.bond_information.is_unbonding).toBe('boolean');
|
||||
|
||||
if (mixnode.bond_information.proxy === null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
expect(typeof mixnode.bond_information.proxy).toBe('string');
|
||||
}
|
||||
|
||||
//mixnode
|
||||
expect(typeof mixnode.bond_information.mix_node.host).toBe('string')
|
||||
expect(mixnode.bond_information.mix_node.http_api_port).toStrictEqual(8000);
|
||||
expect(typeof mixnode.bond_information.mix_node.verloc_port).toBe('number')
|
||||
expect(typeof mixnode.bond_information.mix_node.mix_port).toBe('number')
|
||||
expect(mixnode.bond_information.mix_node.mix_port).toStrictEqual(1789);
|
||||
expect(mixnode.bond_information.mix_node.verloc_port).toStrictEqual(1790)
|
||||
|
||||
let identitykey = mixnode.bond_information.mix_node.identity_key
|
||||
if (typeof identitykey === 'string') {
|
||||
if (identitykey.length === 43) {
|
||||
return true
|
||||
}
|
||||
else expect(identitykey).toHaveLength(44);
|
||||
}
|
||||
|
||||
let sphinx = mixnode.bond_information.mix_node.sphinx_key
|
||||
if (typeof sphinx === 'string') {
|
||||
if (sphinx.length === 43) {
|
||||
return true
|
||||
}
|
||||
else expect(sphinx).toHaveLength(44);
|
||||
}
|
||||
|
||||
//rewarding details
|
||||
expect(typeof mixnode.rewarding_details.cost_params.profit_margin_percent).toBe('string')
|
||||
expect(typeof mixnode.rewarding_details.cost_params.interval_operating_cost.denom).toBe('string')
|
||||
expect(typeof mixnode.rewarding_details.cost_params.interval_operating_cost.amount).toBe('string')
|
||||
expect(typeof mixnode.rewarding_details.operator).toBe('string')
|
||||
expect(typeof mixnode.rewarding_details.delegates).toBe('string')
|
||||
expect(typeof mixnode.rewarding_details.total_unit_reward).toBe('string')
|
||||
expect(typeof mixnode.rewarding_details.unit_delegation).toBe('string')
|
||||
expect(typeof mixnode.rewarding_details.last_rewarded_epoch).toBe('number')
|
||||
expect(typeof mixnode.rewarding_details.unique_delegations).toBe('number')
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
it("Get all mixnodes detailed", async (): Promise<void> => {
|
||||
const response = await contract.getMixnodesDetailed();
|
||||
response.forEach((mixnode) => {
|
||||
// overview details
|
||||
expect(typeof mixnode.estimated_delegators_apy).toBe('string');
|
||||
expect(typeof mixnode.estimated_operator_apy).toBe('string');
|
||||
expect(typeof mixnode.performance).toBe('string');
|
||||
expect(typeof mixnode.uncapped_stake_saturation).toBe('string');
|
||||
expect(typeof mixnode.stake_saturation).toBe('string');
|
||||
expect(typeof mixnode.family).toBe('string');
|
||||
|
||||
//mixnode details bond info
|
||||
expect(typeof mixnode.mixnode_details.bond_information.mix_id).toBe('number')
|
||||
expect(typeof mixnode.mixnode_details.bond_information.owner).toBe('string');
|
||||
expect(typeof mixnode.mixnode_details.bond_information.original_pledge.amount).toBe('string');
|
||||
expect(typeof mixnode.mixnode_details.bond_information.original_pledge.denom).toBe('string');
|
||||
expect(typeof mixnode.mixnode_details.bond_information.layer).toBe('number');
|
||||
expect(typeof mixnode.mixnode_details.bond_information.bonding_height).toBe('number');
|
||||
expect(typeof mixnode.mixnode_details.bond_information.is_unbonding).toBe('boolean');
|
||||
|
||||
if (mixnode.mixnode_details.bond_information.proxy === null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
expect(typeof mixnode.mixnode_details.bond_information.proxy).toBe('string');
|
||||
}
|
||||
|
||||
//mixnode
|
||||
expect(typeof mixnode.mixnode_details.bond_information.mix_node.host).toBe('string')
|
||||
expect(mixnode.mixnode_details.bond_information.mix_node.http_api_port).toStrictEqual(8000);
|
||||
expect(typeof mixnode.mixnode_details.bond_information.mix_node.verloc_port).toBe('number')
|
||||
expect(typeof mixnode.mixnode_details.bond_information.mix_node.mix_port).toBe('number')
|
||||
expect(mixnode.mixnode_details.bond_information.mix_node.mix_port).toStrictEqual(1789);
|
||||
expect(mixnode.mixnode_details.bond_information.mix_node.verloc_port).toStrictEqual(1790)
|
||||
|
||||
let identitykey2 = mixnode.mixnode_details.bond_information.mix_node.identity_key
|
||||
if (typeof identitykey2 === 'string') {
|
||||
if (identitykey2.length === 43) {
|
||||
return true
|
||||
}
|
||||
else expect(identitykey2).toHaveLength(44);
|
||||
}
|
||||
|
||||
let sphinx2 = mixnode.mixnode_details.bond_information.mix_node.sphinx_key
|
||||
if (typeof sphinx2 === 'string') {
|
||||
if (sphinx2.length === 43) {
|
||||
return true
|
||||
}
|
||||
else expect(sphinx2).toHaveLength(44);
|
||||
}
|
||||
|
||||
//mixnode rewarding info
|
||||
expect(typeof mixnode.mixnode_details.rewarding_details.cost_params.profit_margin_percent).toBe('string')
|
||||
expect(typeof mixnode.mixnode_details.rewarding_details.cost_params.interval_operating_cost.denom).toBe('string')
|
||||
expect(typeof mixnode.mixnode_details.rewarding_details.cost_params.interval_operating_cost.amount).toBe('string')
|
||||
expect(typeof mixnode.mixnode_details.rewarding_details.operator).toBe('string')
|
||||
expect(typeof mixnode.mixnode_details.rewarding_details.delegates).toBe('string')
|
||||
expect(typeof mixnode.mixnode_details.rewarding_details.total_unit_reward).toBe('string')
|
||||
expect(typeof mixnode.mixnode_details.rewarding_details.unit_delegation).toBe('string')
|
||||
expect(typeof mixnode.mixnode_details.rewarding_details.last_rewarded_epoch).toBe('number')
|
||||
expect(typeof mixnode.mixnode_details.rewarding_details.unique_delegations).toBe('number')
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
it("Get active mixnodes", async (): Promise<void> => {
|
||||
const response = await contract.getActiveMixnodes();
|
||||
response.forEach(function (mixnode) {
|
||||
expect(mixnode.rewarding_details.cost_params.profit_margin_percent).toBeTruthy()
|
||||
expect(typeof mixnode.bond_information.layer).toBe('number')
|
||||
});
|
||||
});
|
||||
|
||||
it("Get active mixnodes detailed", async (): Promise<void> => {
|
||||
const response = await contract.getActiveMixnodesDetailed();
|
||||
response.forEach(function (mixnode) {
|
||||
expect(mixnode.mixnode_details.rewarding_details.cost_params.profit_margin_percent).toBeTruthy()
|
||||
});
|
||||
});
|
||||
|
||||
it("Get rewarded mixnodes", async (): Promise<void> => {
|
||||
const response = await contract.getRewardedMixnodes();
|
||||
response.forEach(function (mixnode) {
|
||||
expect(mixnode.rewarding_details.last_rewarded_epoch).toBeTruthy()
|
||||
});
|
||||
});
|
||||
|
||||
it("Get rewarded mixnodes detailed", async (): Promise<void> => {
|
||||
const response = await contract.getRewardedMixnodesDetailed();
|
||||
response.forEach(function (mixnode) {
|
||||
expect(mixnode.mixnode_details.rewarding_details.last_rewarded_epoch).toBeTruthy()
|
||||
});
|
||||
});
|
||||
|
||||
it("Get blacklisted mixnodes", async (): Promise<void> => {
|
||||
const response = await contract.getBlacklistedMixnodes();
|
||||
response.forEach(function (value) {
|
||||
expect(typeof value).toBe('number');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
import Status from "../../src/endpoints/Status";
|
||||
import ConfigHandler from "../../src/config/configHandler";
|
||||
|
||||
let status: Status;
|
||||
let config: ConfigHandler;
|
||||
|
||||
describe("Get gateway data", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
status = new Status();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get all gateways detailed", async (): Promise<void> => {
|
||||
const response = await status.getDetailedGateways();
|
||||
response.forEach((x) => {
|
||||
expect(typeof x.gateway_bond.owner).toBe("string");
|
||||
expect(typeof x.performance).toBe("string");
|
||||
});
|
||||
});
|
||||
|
||||
it("Get a gateway history", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.gateway_identity;
|
||||
const response = await status.getGatewayHistory(identity_key);
|
||||
response.history.forEach((x) => {
|
||||
expect(typeof x.date).toBe("string");
|
||||
expect(typeof x.uptime).toBe("number");
|
||||
});
|
||||
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
});
|
||||
|
||||
it("Get gateway core status count", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.gateway_identity;
|
||||
const response = await status.getGatewayCoreCount(identity_key);
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.count).toBe("number");
|
||||
});
|
||||
|
||||
it("Get a gateway status report", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.gateway_identity;
|
||||
const response = await status.getGatewayStatusReport(identity_key);
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
expect(typeof response.most_recent).toBe("number");
|
||||
expect(typeof response.last_hour).toBe("number");
|
||||
expect(typeof response.last_day).toBe("number");
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,120 @@
|
||||
import Status from "../../src/endpoints/Status";
|
||||
import ConfigHandler from "../../src/config/configHandler";
|
||||
|
||||
let status: Status;
|
||||
let config: ConfigHandler;
|
||||
|
||||
describe("Get mixnode data", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
status = new Status();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get a mixnode report", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeStatusReport(identity_key);
|
||||
|
||||
expect(typeof response.last_day).toBe("number");
|
||||
expect(typeof response.owner).toBe("string");
|
||||
});
|
||||
|
||||
it("Get a mixnode stake saturation", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeStakeSaturation(identity_key);
|
||||
|
||||
expect(typeof response.as_at).toBe("number");
|
||||
expect(typeof response.saturation).toBe("string");
|
||||
expect(typeof response.uncapped_saturation).toBe("string");
|
||||
});
|
||||
|
||||
it("Get a mixnode average uptime", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeAverageUptime(identity_key);
|
||||
|
||||
expect(identity_key).toStrictEqual(response.mix_id);
|
||||
expect(typeof response.avg_uptime).toBe("number");
|
||||
});
|
||||
|
||||
it("Get a mixnode history", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeHistory(identity_key);
|
||||
|
||||
response.history.forEach((x) => {
|
||||
console.log(x.date);
|
||||
console.log(x.uptime);
|
||||
})
|
||||
|
||||
expect(identity_key).toStrictEqual(response.mix_id);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
});
|
||||
|
||||
it("Get a mixnode core count", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeCoreCount(identity_key);
|
||||
|
||||
expect(identity_key).toStrictEqual(response.mix_id);
|
||||
expect(typeof response.count).toBe("number");
|
||||
});
|
||||
|
||||
it("Get a mixnode status", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeStatus(identity_key);
|
||||
|
||||
expect(response.status).toStrictEqual("active");
|
||||
});
|
||||
|
||||
it("Get a mixnode reward estimation", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeRewardComputation(identity_key);
|
||||
|
||||
expect(response.reward_params.interval.sybil_resistance).toStrictEqual("0.3");
|
||||
expect(response.reward_params.active_set_size).toStrictEqual(240);
|
||||
expect(typeof response.reward_params.interval.reward_pool).toBe("string");
|
||||
});
|
||||
|
||||
it("Get a mixnode inclusion probability", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mix_id;
|
||||
const response = await status.getMixnodeInclusionProbability(identity_key);
|
||||
|
||||
expect(typeof response.in_active).toBe("string");
|
||||
});
|
||||
|
||||
it("Get all mixnodes inclusion probability", async (): Promise<void> => {
|
||||
const response = await status.getAllMixnodeInclusionProbability();
|
||||
|
||||
expect(response.inclusion_probabilities).toBeTruthy();
|
||||
});
|
||||
|
||||
it("Get all mixnodes", async (): Promise<void> => {
|
||||
const response = await status.getDetailedMixnodes();
|
||||
|
||||
expect(typeof response.stake_saturation).toBe("string");
|
||||
});
|
||||
|
||||
it("Get all rewarded mixnodes", async (): Promise<void> => {
|
||||
const response = await status.getDetailedRewardedMixnodes();
|
||||
|
||||
expect(typeof response.mixnode_details.rewarding_details.last_rewarded_epoch).toBe("number");
|
||||
});
|
||||
|
||||
it("Get all active mixnodes", async (): Promise<void> => {
|
||||
const response = await status.getDetailedActiveMixnodes();
|
||||
|
||||
expect(typeof response.mixnode_details.bond_information.layer).toBe("number");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("Compute mixnode reward estimation", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
status = new Status();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
it("with correct data", async (): Promise<void> => {
|
||||
const response = await status.sendMixnodeRewardEstimatedComputation(8);
|
||||
const body =
|
||||
|
||||
expect(typeof response.estimation.total_node_reward).toBe("string");
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,123 +0,0 @@
|
||||
import Status from "../../../src/endpoints/Status";
|
||||
import ConfigHandler from "../../../src/config/configHandler";
|
||||
|
||||
let status: Status;
|
||||
let config: ConfigHandler;
|
||||
|
||||
describe("Get mixnode data", (): void => {
|
||||
beforeAll(async (): Promise<void> => {
|
||||
status = new Status();
|
||||
config = ConfigHandler.getInstance();
|
||||
});
|
||||
|
||||
it("Get a mixnode stake saturation", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mixnode_identity;
|
||||
const response = await status.getMixnodeStakeSaturation(identity_key);
|
||||
|
||||
console.log(response.as_at);
|
||||
console.log(response.saturation);
|
||||
|
||||
expect(typeof response.as_at).toBe("number");
|
||||
expect(typeof response.saturation).toBe("number");
|
||||
});
|
||||
|
||||
it("Get a mixnode average uptime", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mixnode_identity;
|
||||
const response = await status.getMixnodeAverageUptime(identity_key);
|
||||
|
||||
console.log(response.avg_uptime);
|
||||
console.log(response.identity);
|
||||
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.avg_uptime).toBe("number");
|
||||
});
|
||||
|
||||
it("Get a mixnode history", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mixnode_identity;
|
||||
const response = await status.getMixnodeHistory(identity_key);
|
||||
|
||||
response.history.forEach((x) => {
|
||||
console.log(x.date);
|
||||
console.log(x.uptime);
|
||||
});
|
||||
console.log(response.identity);
|
||||
console.log(response.owner);
|
||||
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
});
|
||||
|
||||
it("Get a gateway history", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.gateway_identity;
|
||||
const response = await status.getGatewayHistory(identity_key);
|
||||
|
||||
response.history.forEach((x) => {
|
||||
console.log(x.date);
|
||||
console.log(x.uptime);
|
||||
});
|
||||
console.log(response.identity);
|
||||
console.log(response.owner);
|
||||
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.owner).toBe("string");
|
||||
});
|
||||
|
||||
it("Get a gateway history", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.gateway_identity;
|
||||
const response = await status.getGatewayCoreCount(identity_key);
|
||||
|
||||
console.log(response.count);
|
||||
console.log(response.identity);
|
||||
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.count).toBe("number");
|
||||
});
|
||||
|
||||
it("Get a gateway history", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mixnode_identity;
|
||||
const response = await status.getMixnodeCoreCount(identity_key);
|
||||
|
||||
console.log(response.count);
|
||||
console.log(response.identity);
|
||||
|
||||
expect(identity_key).toStrictEqual(response.identity);
|
||||
expect(typeof response.count).toBe("number");
|
||||
});
|
||||
|
||||
it("Get a mixnode status", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mixnode_identity;
|
||||
const response = await status.getMixnodeStatus(identity_key);
|
||||
|
||||
console.log(response.status);
|
||||
|
||||
expect(response.status).toStrictEqual("active");
|
||||
});
|
||||
|
||||
it("Get a mixnode reward estimation", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mixnode_identity;
|
||||
const response = await status.getMixnodeRewardComputation(identity_key);
|
||||
|
||||
console.log(response.estimated_delegators_reward);
|
||||
console.log(response.estimated_node_profit);
|
||||
console.log(response.estimated_operator_cost);
|
||||
console.log(response.estimated_operator_reward);
|
||||
console.log(response.estimated_total_node_reward);
|
||||
console.log(response.reward_params);
|
||||
console.log(response.as_at);
|
||||
console.log(response);
|
||||
|
||||
//assertions to come
|
||||
//expect(response).toStrictEqual('something');
|
||||
});
|
||||
|
||||
it("Get a mixnode inclusion probability", async (): Promise<void> => {
|
||||
const identity_key = config.environmnetConfig.mixnode_identity;
|
||||
const response = await status.getMixnodeInclusionProbability(identity_key);
|
||||
|
||||
console.log(response.in_active);
|
||||
console.log(response.in_reserve);
|
||||
|
||||
//assertions to come
|
||||
//expect(response).toStrictEqual('something');
|
||||
});
|
||||
});
|
||||
Generated
+8401
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,8 @@
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest --forceExit --detectOpenHandles --passWithNoTests",
|
||||
"test:qa": "TEST_ENV=qa jest --forceExit --detectOpenHandles --passWithNoTests",
|
||||
"test:prod": "TEST_ENV=prod jest --forceExit --detectOpenHandles --passWithNoTests",
|
||||
"build": "tsc",
|
||||
"lint": "eslint --ext .js,.ts,.tsx .",
|
||||
"lint:fix": "eslint --fix",
|
||||
@@ -33,6 +34,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "28.1.6",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.12.1",
|
||||
"@typescript-eslint/parser": "^5.33.0",
|
||||
"axios-mock-adapter": "^1.20.0",
|
||||
|
||||
@@ -3,13 +3,14 @@ common:
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
qa:
|
||||
api_base_url: https://qa-validator-api.nymtech.net/api/v1
|
||||
mixnode_identity: DLdMKLPywEy1vnu3yPrtXvzY7fw1puiiHpA9n9UQatiQ
|
||||
gateway_identity: CgQrYP8etksSBf4nALNqp93SHPpgFwEUyTsjBNNLj5WM
|
||||
log_level: debug
|
||||
api_base_url: https://qwerty-validator-api.qa.nymte.ch/api/v1
|
||||
mix_id: 7
|
||||
identity_key: 4Yr4qmEHd9sgsuQ83191FR2hD88RfsbMmB4tzhhZWriz
|
||||
gateway_identity: 336yuXAeGEgedRfqTJZsG2YV7P13QH1bHv1SjCZYarc9
|
||||
log_level: error
|
||||
prod:
|
||||
api_base_url: https://qa-validator-api.nymtech.net/api/v1
|
||||
api_base_url: https://validator.nymtech.net/api/v1
|
||||
mixnode_identity: DLdMKLPywEy1vnu3yPrtXvzY7fw1puiiHpA9n9UQatiQ
|
||||
gateway_identity: CgQrYP8etksSBf4nALNqp93SHPpgFwEUyTsjBNNLj5WM
|
||||
log_level: debug
|
||||
log_level: error
|
||||
time_zone: utc
|
||||
|
||||
@@ -16,13 +16,14 @@ class ConfigHandler {
|
||||
log_level: TLogLevelName;
|
||||
time_zone: string;
|
||||
api_base_url: string;
|
||||
mixnode_identity: string;
|
||||
mix_id: number;
|
||||
identity_key: string;
|
||||
gateway_identity: string;
|
||||
};
|
||||
|
||||
private constructor() {
|
||||
this.setCommonConfig();
|
||||
this.setEnvironmentConfig(process.env.TEST_ENV || "prod");
|
||||
this.setEnvironmentConfig(process.env.TEST_ENV || "qa" || "prod" );
|
||||
}
|
||||
|
||||
public static getInstance(): ConfigHandler {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
Detailed
|
||||
} from "../types/CirculatingSupplyTypes";
|
||||
import { APIClient } from "./abstracts/APIClient";
|
||||
|
||||
export default class ContractCache extends APIClient {
|
||||
constructor() {
|
||||
super("/");
|
||||
}
|
||||
|
||||
public async getCirculatingSupply(): Promise<Detailed> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `circulating-supply`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import {
|
||||
MixnodesDetailed,
|
||||
AllGateways,
|
||||
AllMixnodes,
|
||||
EpochRewardParams,
|
||||
BlacklistedGateways,
|
||||
BlacklistedMixnodes,
|
||||
CurrentEpoch,
|
||||
Mixnode
|
||||
} from "../types/ContractCacheTypes";
|
||||
import { APIClient } from "./abstracts/APIClient";
|
||||
|
||||
export default class ContractCache extends APIClient {
|
||||
constructor() {
|
||||
super("/");
|
||||
}
|
||||
|
||||
public async getMixnodes(): Promise<AllMixnodes[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `mixnodes`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodesDetailed(): Promise<MixnodesDetailed[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `mixnodes/detailed`,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getGateways(): Promise<AllGateways[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `gateways`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getActiveMixnodes(): Promise<AllMixnodes[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `mixnodes/active`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getActiveMixnodesDetailed(): Promise<MixnodesDetailed[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `mixnodes/active/detailed`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getRewardedMixnodes(): Promise<AllMixnodes[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `mixnodes/rewarded`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getRewardedMixnodesDetailed(): Promise<MixnodesDetailed[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `mixnodes/rewarded/detailed`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getBlacklistedMixnodes(): Promise<BlacklistedMixnodes[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `mixnodes/blacklisted`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getBlacklistedGateways(): Promise<BlacklistedGateways[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `gateways/blacklisted`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getEpochRewardParams(): Promise<EpochRewardParams> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `epoch/reward_params`
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getCurrentEpoch(): Promise<CurrentEpoch> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `epoch/current`
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,13 +2,17 @@ import { AxiosResponse } from "axios";
|
||||
import {
|
||||
ActiveStatus,
|
||||
AvgUptime,
|
||||
ComputeRewardEstimation,
|
||||
CoreCount,
|
||||
EstimatedReward,
|
||||
DetailedGateway,
|
||||
DetailedMixnodes,
|
||||
InclusionProbabilities,
|
||||
InclusionProbability,
|
||||
NodeHistory,
|
||||
Report,
|
||||
RewardEstimation,
|
||||
StakeSaturation,
|
||||
} from "../../src/interfaces/StatusInterfaces";
|
||||
} from "../types/StatusInterfaces";
|
||||
import { APIClient } from "./abstracts/APIClient";
|
||||
|
||||
export default class Status extends APIClient {
|
||||
@@ -16,18 +20,14 @@ export default class Status extends APIClient {
|
||||
super("/status");
|
||||
}
|
||||
|
||||
public async getMixnodeStatusReport(identity_key: string): Promise<Report> {
|
||||
// GATEWAYS
|
||||
|
||||
public async getDetailedGateways(): Promise<DetailedGateway[]> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${identity_key}/report`,
|
||||
route: `/gateways/detailed`,
|
||||
});
|
||||
|
||||
return <Report>{
|
||||
identity: response.data.identity,
|
||||
owner: response.data.owner,
|
||||
most_recent: response.data.most_recent,
|
||||
last_hour: response.data.last_hour,
|
||||
last_day: response.data.last_day,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getGatewayStatusReport(identity_key: string): Promise<Report> {
|
||||
@@ -35,13 +35,7 @@ export default class Status extends APIClient {
|
||||
route: `/gateway/${identity_key}/report`,
|
||||
});
|
||||
|
||||
return <Report>{
|
||||
identity: response.data.identity,
|
||||
owner: response.data.owner,
|
||||
most_recent: response.data.most_recent,
|
||||
last_hour: response.data.last_hour,
|
||||
last_day: response.data.last_day,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getGatewayHistory(identity_key: string): Promise<NodeHistory> {
|
||||
@@ -49,35 +43,7 @@ export default class Status extends APIClient {
|
||||
route: `/gateway/${identity_key}/history`,
|
||||
});
|
||||
|
||||
return <NodeHistory>{
|
||||
identity: response.data.identity,
|
||||
owner: response.data.owner,
|
||||
history: response.data.history,
|
||||
};
|
||||
}
|
||||
|
||||
public async getMixnodeStakeSaturation(
|
||||
identity_key: string
|
||||
): Promise<StakeSaturation> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${identity_key}/stake-saturation`,
|
||||
});
|
||||
|
||||
return <StakeSaturation>{
|
||||
as_at: response.data.as_at,
|
||||
saturation: response.data.saturation,
|
||||
};
|
||||
}
|
||||
|
||||
public async getMixnodeCoreCount(identity_key: string): Promise<CoreCount> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${identity_key}/core-status-count`,
|
||||
});
|
||||
|
||||
return <CoreCount>{
|
||||
identity: response.data.identity,
|
||||
count: response.data.count,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getGatewayCoreCount(identity_key: string): Promise<CoreCount> {
|
||||
@@ -85,93 +51,134 @@ export default class Status extends APIClient {
|
||||
route: `/gateway/${identity_key}/core-status-count`,
|
||||
});
|
||||
|
||||
return <CoreCount>{
|
||||
identity: response.data.identity,
|
||||
count: response.data.count,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
||||
// MIXNODES
|
||||
|
||||
public async getMixnodeStatusReport(mix_id: number): Promise<Report> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${mix_id}/report`,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodeStakeSaturation(
|
||||
mix_id: number
|
||||
): Promise<StakeSaturation> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${mix_id}/stake-saturation`,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodeCoreCount(mix_id: number): Promise<CoreCount> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${mix_id}/core-status-count`,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodeRewardComputation(
|
||||
identity_key: string
|
||||
): Promise<EstimatedReward> {
|
||||
mix_id: number
|
||||
): Promise<RewardEstimation> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${identity_key}/reward-estimation`,
|
||||
route: `/mixnode/${mix_id}/reward-estimation`,
|
||||
});
|
||||
|
||||
return <EstimatedReward>{
|
||||
estimated_total_node_reward: response.data.estimated_total_node_reward,
|
||||
estimated_operator_reward: response.data.estimated_operator_reward,
|
||||
estimated_delegators_reward: response.data.estimated_delegators_reward,
|
||||
estimated_node_profit: response.data.estimated_node_profit,
|
||||
estimated_operator_cost: response.data.estimated_operator_cost,
|
||||
reward_params: response.data.reward_params,
|
||||
as_at: response.data.as_at,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodeRewardEstimatedComputation(
|
||||
identity_key: string
|
||||
): Promise<EstimatedReward> {
|
||||
public async sendMixnodeRewardEstimatedComputation(
|
||||
mix_id: number
|
||||
): Promise<RewardEstimation> {
|
||||
const response = await this.restClient.sendPost({
|
||||
route: `/mixnode/${identity_key}/compute-reward-estimation`,
|
||||
route: `/mixnode/${mix_id}/compute-reward-estimation`,
|
||||
data: {
|
||||
// performance: "10",
|
||||
active_in_rewarded_set: true,
|
||||
// pledge_amount: 10,
|
||||
// total_delegation: 2000,
|
||||
// interval_operating_cost: {
|
||||
// denom: "unym",
|
||||
// amount: "250000000"
|
||||
// },
|
||||
// profit_margin_percent: 10
|
||||
}
|
||||
});
|
||||
|
||||
return <EstimatedReward>{
|
||||
estimated_total_node_reward: response.data.estimated_total_node_reward,
|
||||
estimated_operator_reward: response.data.estimated_operator_reward,
|
||||
estimated_delegators_reward: response.data.estimated_delegators_reward,
|
||||
estimated_node_profit: response.data.estimated_node_profit,
|
||||
estimated_operator_cost: response.data.estimated_operator_cost,
|
||||
reward_params: response.data.reward_params,
|
||||
as_at: response.data.as_at,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodeHistory(identity_key: string): Promise<NodeHistory> {
|
||||
public async getMixnodeHistory(mix_id: number): Promise<NodeHistory> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${identity_key}/history`,
|
||||
route: `/mixnode/${mix_id}/history`,
|
||||
});
|
||||
|
||||
return <NodeHistory>{
|
||||
identity: response.data.identity,
|
||||
owner: response.data.owner,
|
||||
history: response.data.history,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodeAverageUptime(
|
||||
identity_key: string
|
||||
mix_id: number
|
||||
): Promise<AvgUptime> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${identity_key}/avg_uptime`,
|
||||
route: `/mixnode/${mix_id}/avg_uptime`,
|
||||
});
|
||||
|
||||
return <AvgUptime>{
|
||||
identity: response.data.identity,
|
||||
avg_uptime: response.data.avg_uptime,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodeInclusionProbability(
|
||||
identity_key: string
|
||||
mix_id: number
|
||||
): Promise<InclusionProbability> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${identity_key}/inclusion-probability`,
|
||||
route: `/mixnode/${mix_id}/inclusion-probability`,
|
||||
});
|
||||
|
||||
return <InclusionProbability>{
|
||||
in_active: response.data.in_active,
|
||||
in_reserve: response.data.in_reserve,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getMixnodeStatus(identity_key: string): Promise<ActiveStatus> {
|
||||
public async getMixnodeStatus(mix_id: number): Promise<ActiveStatus> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnode/${identity_key}/status`,
|
||||
route: `/mixnode/${mix_id}/status`,
|
||||
});
|
||||
|
||||
return <ActiveStatus>{
|
||||
status: response.data.status,
|
||||
};
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getAllMixnodeInclusionProbability(): Promise<InclusionProbabilities> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnodes/inclusion-probability`,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getDetailedMixnodes(): Promise<DetailedMixnodes> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnodes/detailed`,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getDetailedRewardedMixnodes(): Promise<DetailedMixnodes> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnodes/rewarded/detailed`,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getDetailedActiveMixnodes(): Promise<DetailedMixnodes> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnodes/active/detailed`,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
export type Epoch = {
|
||||
epoch_reward_pool: string;
|
||||
rewarded_set_size: string;
|
||||
active_set_size: string;
|
||||
staking_supply: string;
|
||||
sybil_resistance_percent: number;
|
||||
active_set_work_factor: number;
|
||||
};
|
||||
|
||||
export type Node = {
|
||||
reward_blockstamp: number;
|
||||
uptime: string;
|
||||
in_active_set: boolean;
|
||||
};
|
||||
|
||||
export type RewardParams = {
|
||||
epoch: Epoch;
|
||||
node: Node;
|
||||
};
|
||||
|
||||
export type EstimatedReward = {
|
||||
estimated_total_node_reward: number;
|
||||
estimated_operator_reward: number;
|
||||
estimated_delegators_reward: number;
|
||||
estimated_node_profit: number;
|
||||
estimated_operator_cost: number;
|
||||
reward_params: RewardParams;
|
||||
as_at: number;
|
||||
};
|
||||
|
||||
export type StakeSaturation = {
|
||||
saturation: number;
|
||||
as_at: number;
|
||||
};
|
||||
|
||||
export type AvgUptime = {
|
||||
identity: string;
|
||||
avg_uptime: number;
|
||||
};
|
||||
|
||||
export type InclusionProbability = {
|
||||
in_active: string;
|
||||
in_reserve: string;
|
||||
};
|
||||
|
||||
export type Report = {
|
||||
identity: string;
|
||||
owner: string;
|
||||
most_recent: number;
|
||||
last_hour: number;
|
||||
last_day: number;
|
||||
};
|
||||
|
||||
export type History = {
|
||||
date: string;
|
||||
uptime: number;
|
||||
};
|
||||
|
||||
export type NodeHistory = {
|
||||
identity: string;
|
||||
owner: string;
|
||||
history: History[];
|
||||
};
|
||||
|
||||
export type CoreCount = {
|
||||
identity: string;
|
||||
count: number;
|
||||
};
|
||||
|
||||
export type ActiveStatus = {
|
||||
status: string;
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
export type Detailed = {
|
||||
initial_supply: InitialSupply;
|
||||
mixmining_reserve: MixminingReserve;
|
||||
vesting_tokens: VestingTokens;
|
||||
circulating_supply: CirculatingSupply;
|
||||
};
|
||||
|
||||
export type InitialSupply = {
|
||||
demon: "unym";
|
||||
amount: string;
|
||||
};
|
||||
|
||||
export type MixminingReserve = {
|
||||
demon: "unym";
|
||||
amount: string;
|
||||
};
|
||||
|
||||
export type VestingTokens = {
|
||||
demon: "unym";
|
||||
amount: string;
|
||||
};
|
||||
|
||||
export type CirculatingSupply = {
|
||||
demon: "unym";
|
||||
amount: string;
|
||||
};
|
||||
@@ -0,0 +1,132 @@
|
||||
export type AllMixnodes = {
|
||||
bond_information: BondInformation;
|
||||
rewarding_details: RewardingDetails;
|
||||
};
|
||||
|
||||
export type BondInformation = {
|
||||
mix_id: number;
|
||||
owner: string;
|
||||
original_pledge: OriginalPledge;
|
||||
layer: number;
|
||||
mix_node: Mixnode;
|
||||
proxy: string;
|
||||
bonding_height: number;
|
||||
is_unbonding: boolean;
|
||||
}
|
||||
|
||||
export type RewardingDetails = {
|
||||
cost_params: CostParams;
|
||||
operator: string;
|
||||
delegates: string;
|
||||
total_unit_reward: string;
|
||||
unit_delegation: string;
|
||||
last_rewarded_epoch: number;
|
||||
unique_delegations: number;
|
||||
}
|
||||
|
||||
export type CostParams = {
|
||||
profit_margin_percent: string;
|
||||
interval_operating_cost: IntervalOperatingCost;
|
||||
}
|
||||
|
||||
export type IntervalOperatingCost = {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
export type OriginalPledge = {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
export type TotalDelegation = {
|
||||
denom: string;
|
||||
amount: string;
|
||||
};
|
||||
|
||||
export type Mixnode = {
|
||||
host: string;
|
||||
mix_port: number;
|
||||
verloc_port: number;
|
||||
http_api_port: number;
|
||||
sphinx_key: string;
|
||||
identity_key: string;
|
||||
version: string;
|
||||
};
|
||||
|
||||
export type MixnodeBond = {
|
||||
pledge_amount: OriginalPledge;
|
||||
total_delegation: TotalDelegation;
|
||||
owner: string;
|
||||
layer: string;
|
||||
block_height: string;
|
||||
mix_node: Mixnode;
|
||||
proxy: string;
|
||||
accumulated_rewards: string;
|
||||
}
|
||||
|
||||
export type MixnodesDetailed = {
|
||||
mixnode_details: AllMixnodes;
|
||||
stake_saturation: string;
|
||||
uncapped_stake_saturation: string;
|
||||
performance: string;
|
||||
estimated_operator_apy: string
|
||||
estimated_delegators_apy: string;
|
||||
family: string
|
||||
};
|
||||
|
||||
export type BlacklistedMixnodes = {
|
||||
};
|
||||
|
||||
export type BlacklistedGateways = {
|
||||
};
|
||||
|
||||
export interface Gateway {
|
||||
host: string;
|
||||
mix_port: number;
|
||||
clients_port: number;
|
||||
location: string;
|
||||
sphinx_key: string;
|
||||
identity_key: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface AllGateways {
|
||||
pledge_amount: OriginalPledge;
|
||||
owner: string;
|
||||
block_height: number;
|
||||
gateway: Gateway;
|
||||
proxy: string;
|
||||
}
|
||||
|
||||
export type EpochRewardParams = {
|
||||
interval: Interval;
|
||||
rewarded_set_size: number;
|
||||
active_set_size: number;
|
||||
};
|
||||
|
||||
export type Interval = {
|
||||
reward_pool: string;
|
||||
staking_supply: string;
|
||||
staking_supply_scale_factor: string;
|
||||
epoch_reward_budget: string;
|
||||
stake_saturation_point: string;
|
||||
sybil_resistance: string;
|
||||
active_set_work_factor: string;
|
||||
interval_pool_emission: string;
|
||||
}
|
||||
|
||||
export type CurrentEpoch = {
|
||||
id: number;
|
||||
epochs_in_interval: number;
|
||||
current_epoch_start: string;
|
||||
current_epoch_id: number;
|
||||
epoch_length: EpochLength;
|
||||
total_elapsed_epochs: number;
|
||||
};
|
||||
|
||||
export type EpochLength = {
|
||||
secs: number;
|
||||
nanos: number;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
export interface CurrentEpoch {
|
||||
epoch_reward_pool: string;
|
||||
rewarded_set_size: string;
|
||||
active_set_size: string;
|
||||
staking_supply: string;
|
||||
sybil_resistance_percent: number;
|
||||
active_set_work_factor: number;
|
||||
}
|
||||
|
||||
|
||||
export interface Epoch {
|
||||
id: number;
|
||||
epochs_in_interval: number;
|
||||
current_epoch_start: string;
|
||||
current_epoch_id: number;
|
||||
epoch_length: EpochLength;
|
||||
total_elapsed_epochs: number;
|
||||
}
|
||||
|
||||
export interface EpochLength {
|
||||
secs: number;
|
||||
nanos: number;
|
||||
}
|
||||
|
||||
export interface Node {
|
||||
reward_blockstamp: number;
|
||||
uptime: string;
|
||||
in_active_set: boolean;
|
||||
}
|
||||
|
||||
export interface RewardEstimation {
|
||||
estimation: Estimation;
|
||||
reward_params: RewardParams;
|
||||
epoch: Epoch;
|
||||
as_at: number;
|
||||
}
|
||||
|
||||
export interface Estimation {
|
||||
total_node_reward: string;
|
||||
operator: string;
|
||||
delegates: string;
|
||||
operating_cost: string;
|
||||
}
|
||||
|
||||
export interface RewardParams {
|
||||
interval: Interval;
|
||||
rewarded_set_size: number;
|
||||
active_set_size: number;
|
||||
}
|
||||
|
||||
export interface ComputeRewardEstimation {
|
||||
performance: string,
|
||||
active_in_rewarded_set: boolean,
|
||||
pledge_amount: number,
|
||||
total_delegation: number,
|
||||
interval_operating_cost: IntervalOperatingCost;
|
||||
profit_margin_percent: string
|
||||
}
|
||||
|
||||
export interface IntervalOperatingCost {
|
||||
denom: string,
|
||||
amount: string
|
||||
}
|
||||
|
||||
export interface Interval {
|
||||
reward_pool: string;
|
||||
staking_supply: string;
|
||||
staking_supply_scale_factor: string;
|
||||
epoch_reward_budget: string;
|
||||
stake_saturation_point: string;
|
||||
sybil_resistance: string;
|
||||
active_set_work_factor: string;
|
||||
interval_pool_emission: string;
|
||||
}
|
||||
|
||||
export interface StakeSaturation {
|
||||
saturation: string;
|
||||
uncapped_saturation: string;
|
||||
as_at: number;
|
||||
}
|
||||
|
||||
export interface AvgUptime {
|
||||
mix_id: number;
|
||||
avg_uptime: number;
|
||||
}
|
||||
|
||||
export interface SingleInclusionProbability {
|
||||
in_active: number;
|
||||
in_reserve: number;
|
||||
}
|
||||
|
||||
export interface InclusionProbability {
|
||||
mix_id: number;
|
||||
in_active: string;
|
||||
in_reserve: string;
|
||||
}
|
||||
|
||||
export interface InclusionProbabilities {
|
||||
inclusion_probabilities: InclusionProbability[];
|
||||
samples: number;
|
||||
elapsed: Elapsed;
|
||||
delta_max: number;
|
||||
delta_l2: number;
|
||||
as_at: number;
|
||||
}
|
||||
|
||||
export interface Elapsed {
|
||||
secs: number;
|
||||
nanos: number;
|
||||
}
|
||||
|
||||
export interface Report {
|
||||
mix_id: number;
|
||||
identity: string;
|
||||
owner: string;
|
||||
most_recent: number;
|
||||
last_hour: number;
|
||||
last_day: number;
|
||||
}
|
||||
|
||||
export interface History {
|
||||
date: string;
|
||||
uptime: number;
|
||||
}
|
||||
|
||||
export interface NodeHistory {
|
||||
mix_id: number,
|
||||
identity: string;
|
||||
owner: string;
|
||||
history: History[];
|
||||
}
|
||||
|
||||
export interface CoreCount {
|
||||
mix_id: number,
|
||||
identity: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface ActiveStatus {
|
||||
status: string;
|
||||
}
|
||||
|
||||
|
||||
export interface PledgeAmount {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
export interface Gateway {
|
||||
host: string;
|
||||
mix_port: number;
|
||||
clients_port: number;
|
||||
location: string;
|
||||
sphinx_key: string;
|
||||
identity_key: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface GatewayBond {
|
||||
pledge_amount: PledgeAmount;
|
||||
owner: string;
|
||||
block_height: number;
|
||||
gateway: Gateway;
|
||||
proxy?: any;
|
||||
}
|
||||
|
||||
export interface DetailedGateway {
|
||||
gateway_bond: GatewayBond;
|
||||
performance: string;
|
||||
}
|
||||
|
||||
export interface OriginalPledge {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
export interface MixNode {
|
||||
host: string;
|
||||
mix_port: number;
|
||||
verloc_port: number;
|
||||
http_api_port: number;
|
||||
sphinx_key: string;
|
||||
identity_key: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface BondInformation {
|
||||
mix_id: number;
|
||||
owner: string;
|
||||
original_pledge: OriginalPledge;
|
||||
layer: string;
|
||||
mix_node: MixNode;
|
||||
proxy: string;
|
||||
bonding_height: number;
|
||||
is_unbonding: boolean;
|
||||
}
|
||||
|
||||
export interface IntervalOperatingCost {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
export interface CostParams {
|
||||
profit_margin_percent: string;
|
||||
interval_operating_cost: IntervalOperatingCost;
|
||||
}
|
||||
|
||||
export interface RewardingDetails {
|
||||
cost_params: CostParams;
|
||||
operator: string;
|
||||
delegates: string;
|
||||
total_unit_reward: string;
|
||||
unit_delegation: string;
|
||||
last_rewarded_epoch: number;
|
||||
unique_delegations: number;
|
||||
}
|
||||
|
||||
export interface MixnodeDetails {
|
||||
bond_information: BondInformation;
|
||||
rewarding_details: RewardingDetails;
|
||||
}
|
||||
|
||||
export interface DetailedMixnodes {
|
||||
mixnode_details: MixnodeDetails;
|
||||
stake_saturation: string;
|
||||
uncapped_stake_saturation: string;
|
||||
performance: string;
|
||||
estimated_operator_apy: string;
|
||||
estimated_delegators_apy: string;
|
||||
family: string;
|
||||
}
|
||||
@@ -20,6 +20,6 @@
|
||||
"typeRoots": ["node_modules/@types"],
|
||||
"alwaysStrict": true
|
||||
},
|
||||
"include": ["src/**/*", "functional_test/**/*"],
|
||||
"include": ["src/**/*", "tests/functional_test/*/*"],
|
||||
"exclude": ["unit_test/**/*"]
|
||||
}
|
||||
|
||||
+2043
-2020
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user