trustwallet-assets/script/action/kava.ts

43 lines
1.5 KiB
TypeScript
Raw Normal View History

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 errors: string[] = [];
const assets = getChainValidatorsAssets(Kava);
const prefix = "kavavaloper1";
const expLength = 50;
assets.forEach(addr => {
if (!(addr.startsWith(prefix))) {
errors.push(`Address ${addr} should start with '${prefix}'`);
}
if (addr.length != expLength) {
errors.push(`Address ${addr} should have length ${expLength}`);
}
if (!isLowerCase(addr)) {
errors.push(`Address ${addr} should be in lowercase`);
}
});
return [errors, []];
}
},
];
}
getConsistencyChecks = null;
sanityFix = null;
consistencyFix = null;
update = null;
}