trustwallet-assets/script/action/kava.ts
Adam R b5384bb9e6
[internal] Infra for errors and warnings. (#3590)
* Infra for errors and warnings.

* Most allowlist/denylist consistency errors are warnings only.

* Adapt danger to errors+wranings.

Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
2020-08-24 17:06:21 +02:00

43 lines
1.5 KiB
TypeScript

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"; }
getSanityChecks(): CheckStepInterface[] {
return [
{
getName: () => { return "Kava validator assets must have correct format"},
check: async () => {
var error: string = "";
const assets = getChainValidatorsAssets(Kava);
const prefix = "kavavaloper1";
const expLength = 50;
assets.forEach(addr => {
if (!(addr.startsWith(prefix))) {
error += `Address ${addr} should start with '${prefix}'\n`;
}
if (addr.length != expLength) {
error += `Address ${addr} should have length ${expLength}\n`;
}
if (!isLowerCase(addr)) {
error += `Address ${addr} should be in lowercase\n`;
}
});
return [error, ""];
}
},
];
}
getConsistencyChecks = null;
sanityFix = null;
consistencyFix = null;
update = null;
}