Fix up look sharp
- added missing .git files - fixed paths - run the linter
This commit is contained in:
@@ -1,53 +1,57 @@
|
||||
import { AxiosResponse } from "axios";
|
||||
import { MixnodesDetailed, AllGateways, AllMixnodes } from "../../src/interfaces/ContractInterfaces";
|
||||
import {
|
||||
MixnodesDetailed,
|
||||
AllGateways,
|
||||
AllMixnodes,
|
||||
} 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`,
|
||||
});
|
||||
public async getMixnodes(): Promise<AllMixnodes> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `mixnodes`,
|
||||
});
|
||||
|
||||
return <AllMixnodes>{
|
||||
pledge_amount: response.data.pledge_amount,
|
||||
total_delegation: response.data.total_delegation,
|
||||
owner: response.data.owner,
|
||||
layer: response.data.layer,
|
||||
block_height: response.data.block_height,
|
||||
mix_node: response.data.mix_node,
|
||||
proxy: response.data.proxy,
|
||||
accumulated_rewards: response.data.accumulated_rewards
|
||||
};
|
||||
}
|
||||
return <AllMixnodes>{
|
||||
pledge_amount: response.data.pledge_amount,
|
||||
total_delegation: response.data.total_delegation,
|
||||
owner: response.data.owner,
|
||||
layer: response.data.layer,
|
||||
block_height: response.data.block_height,
|
||||
mix_node: response.data.mix_node,
|
||||
proxy: response.data.proxy,
|
||||
accumulated_rewards: response.data.accumulated_rewards,
|
||||
};
|
||||
}
|
||||
|
||||
public async getMixnodesDetailed(): Promise<MixnodesDetailed> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/mixnodes/detailed`,
|
||||
});
|
||||
public async getMixnodesDetailed(): Promise<MixnodesDetailed> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `mixnodes/detailed`,
|
||||
});
|
||||
|
||||
return <MixnodesDetailed>{
|
||||
mixnode_bond: response.data.mixnode_bond,
|
||||
stake_saturation: response.data.stake_saturation,
|
||||
uptime: response.data.uptime,
|
||||
estimated_operator_apy: response.data.estimated_operator_apy,
|
||||
estimated_delegators_apy: response.data.estimated_delegators_apy
|
||||
};
|
||||
}
|
||||
|
||||
public async getGateways(): Promise<AllGateways> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `/gateways`,
|
||||
});
|
||||
|
||||
return <AllGateways>{
|
||||
pledge_amount: response.data.pledge_amount,
|
||||
owner: response.data.owner,
|
||||
block_height: response.data.block_height,
|
||||
gateway: response.data.gateway,
|
||||
proxy: response.data.proxy
|
||||
};
|
||||
}
|
||||
return <MixnodesDetailed>{
|
||||
mixnode_bond: response.data.mixnode_bond,
|
||||
stake_saturation: response.data.stake_saturation,
|
||||
uptime: response.data.uptime,
|
||||
estimated_operator_apy: response.data.estimated_operator_apy,
|
||||
estimated_delegators_apy: response.data.estimated_delegators_apy,
|
||||
};
|
||||
}
|
||||
|
||||
public async getGateways(): Promise<AllGateways> {
|
||||
const response = await this.restClient.sendGet({
|
||||
route: `gateways`,
|
||||
});
|
||||
|
||||
return <AllGateways>{
|
||||
pledge_amount: response.data.pledge_amount,
|
||||
owner: response.data.owner,
|
||||
block_height: response.data.block_height,
|
||||
gateway: response.data.gateway,
|
||||
proxy: response.data.proxy,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { AxiosResponse } from "axios";
|
||||
import {
|
||||
ActiveStatus,
|
||||
AvgUptime,
|
||||
@@ -8,7 +7,7 @@ import {
|
||||
NodeHistory,
|
||||
Report,
|
||||
StakeSaturation,
|
||||
} from "../../src/interfaces/StatusInterfaces";
|
||||
} from "../types/StatusTypes";
|
||||
import { APIClient } from "./abstracts/APIClient";
|
||||
|
||||
export default class Status extends APIClient {
|
||||
@@ -139,8 +138,6 @@ export default class Status extends APIClient {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async getMixnodeAverageUptime(
|
||||
identity_key: string
|
||||
): Promise<AvgUptime> {
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
export type AllMixnodes = {
|
||||
pledge_amount: PledgeAmount;
|
||||
total_delegation: TotalDelegation;
|
||||
owner: string;
|
||||
layer: string;
|
||||
block_height: number;
|
||||
mix_node: Mixnode;
|
||||
proxy: string;
|
||||
accumulated_rewards: string;
|
||||
}
|
||||
|
||||
export type PledgeAmount = {
|
||||
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;
|
||||
profit_margin_percent: number;
|
||||
}
|
||||
|
||||
export type MixnodesDetailed = {
|
||||
mixnode_bond: AllMixnodes;
|
||||
stake_saturation: number;
|
||||
uptime: number;
|
||||
estimated_operator_apy: number;
|
||||
estimated_delegators_apy: number;
|
||||
}
|
||||
|
||||
export type AllGateways = {
|
||||
pledge_amount: PledgeAmount;
|
||||
owner: string;
|
||||
block_height: number;
|
||||
gateway: Gateway;
|
||||
proxy: string;
|
||||
}
|
||||
|
||||
export type Gateway = {
|
||||
host: string;
|
||||
mix_port: number;
|
||||
clients_port: number;
|
||||
location: string;
|
||||
sphinx_key: string;
|
||||
identity_key: string;
|
||||
version: string;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
export type AllMixnodes = {
|
||||
pledge_amount: PledgeAmount;
|
||||
total_delegation: TotalDelegation;
|
||||
owner: string;
|
||||
layer: string;
|
||||
block_height: number;
|
||||
mix_node: Mixnode;
|
||||
proxy: string;
|
||||
accumulated_rewards: string;
|
||||
};
|
||||
|
||||
export type PledgeAmount = {
|
||||
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;
|
||||
profit_margin_percent: number;
|
||||
};
|
||||
|
||||
export type MixnodesDetailed = {
|
||||
mixnode_bond: AllMixnodes;
|
||||
stake_saturation: number;
|
||||
uptime: number;
|
||||
estimated_operator_apy: number;
|
||||
estimated_delegators_apy: number;
|
||||
};
|
||||
|
||||
export type AllGateways = {
|
||||
pledge_amount: PledgeAmount;
|
||||
owner: string;
|
||||
block_height: number;
|
||||
gateway: Gateway;
|
||||
proxy: string;
|
||||
};
|
||||
|
||||
export type Gateway = {
|
||||
host: string;
|
||||
mix_port: number;
|
||||
clients_port: number;
|
||||
location: string;
|
||||
sphinx_key: string;
|
||||
identity_key: string;
|
||||
version: string;
|
||||
};
|
||||
+1
-1
@@ -69,4 +69,4 @@ export type CoreCount = {
|
||||
|
||||
export type ActiveStatus = {
|
||||
status: string;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user