trustwallet-assets/script/action/waves.ts
Adam R 68e0cc6d90
[internal] Set up Linting (#4040)
* Add ESLint infrastructure.

* Lint auto fixes.

* Lint fixes.

* Lint fixes.

* Add Lint to CI builds.

Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
2020-09-18 16:39:31 +02:00

42 lines
1.3 KiB
TypeScript

import { Waves } from "../common/blockchains";
import { getChainValidatorsAssets } from "../common/repo-structure";
import { ActionInterface, CheckStepInterface } from "./interface";
import { isLowerCase, isUpperCase } from "../common/types";
export function isWavesAddress(address: string): boolean {
return address.length == 35 &&
address.startsWith("3P") &&
isLowerCase(address) == false &&
isUpperCase(address) == false;
}
export class WavesAction implements ActionInterface {
getName(): string { return "Waves chain"; }
getSanityChecks(): CheckStepInterface[] {
return [
{
getName: () => { return "Waves validator assets must have correct format"},
check: async () => {
const errors: string[] = [];
const assets = getChainValidatorsAssets(Waves);
assets.forEach(addr => {
if (!(isWavesAddress(addr))) {
errors.push(`Address ${addr} should be a Waves address'`);
}
});
return [errors, []];
}
},
];
}
getConsistencyChecks = null;
sanityFix = null;
consistencyFix = null;
update = null;
}