2020-08-06 19:17:38 +00:00
|
|
|
import { Kava } from "../common/blockchains";
|
|
|
|
import { getChainValidatorsAssets } from "../common/repo-structure";
|
|
|
|
import { ActionInterface, CheckStepInterface } from "./interface";
|
|
|
|
import { isLowerCase } from "../common/types";
|
|
|
|
|
|
|
|
export class KavaAction implements ActionInterface {
|
|
|
|
getName(): string { return "Kava chain"; }
|
|
|
|
|
2020-08-10 08:56:41 +00:00
|
|
|
getSanityChecks(): CheckStepInterface[] {
|
2020-08-06 19:17:38 +00:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
getName: () => { return "Kava validator assets must have correct format"},
|
|
|
|
check: async () => {
|
2020-09-18 14:39:31 +00:00
|
|
|
const errors: string[] = [];
|
2020-08-06 19:17:38 +00:00
|
|
|
const assets = getChainValidatorsAssets(Kava);
|
|
|
|
const prefix = "kavavaloper1";
|
|
|
|
const expLength = 50;
|
|
|
|
assets.forEach(addr => {
|
|
|
|
if (!(addr.startsWith(prefix))) {
|
2020-09-16 12:52:10 +00:00
|
|
|
errors.push(`Address ${addr} should start with '${prefix}'`);
|
2020-08-06 19:17:38 +00:00
|
|
|
}
|
|
|
|
if (addr.length != expLength) {
|
2020-09-16 12:52:10 +00:00
|
|
|
errors.push(`Address ${addr} should have length ${expLength}`);
|
2020-08-06 19:17:38 +00:00
|
|
|
}
|
|
|
|
if (!isLowerCase(addr)) {
|
2020-09-16 12:52:10 +00:00
|
|
|
errors.push(`Address ${addr} should be in lowercase`);
|
2020-08-06 19:17:38 +00:00
|
|
|
}
|
|
|
|
});
|
2020-09-16 12:52:10 +00:00
|
|
|
return [errors, []];
|
2020-08-06 19:17:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2020-08-10 08:56:41 +00:00
|
|
|
getConsistencyChecks = null;
|
|
|
|
|
|
|
|
sanityFix = null;
|
|
|
|
|
|
|
|
consistencyFix = null;
|
2020-08-06 19:17:38 +00:00
|
|
|
|
|
|
|
update = null;
|
|
|
|
}
|