2020-08-06 19:17:38 +00:00
|
|
|
import * as eztz from "eztz-lib";
|
2021-02-05 05:19:50 +00:00
|
|
|
import { getChainValidatorsAssets } from "../generic/repo-structure";
|
2020-09-23 13:47:24 +00:00
|
|
|
import { Tezos } from "../generic/blockchains";
|
|
|
|
import { ActionInterface, CheckStepInterface } from "../generic/interface";
|
2020-07-29 13:42:51 +00:00
|
|
|
|
2020-08-06 19:17:38 +00:00
|
|
|
export class TezosAction implements ActionInterface {
|
|
|
|
getName(): string { return "Tezos"; }
|
|
|
|
|
2020-08-10 08:56:41 +00:00
|
|
|
getSanityChecks(): CheckStepInterface[] {
|
2020-08-06 19:17:38 +00:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
getName: () => { return "Tezos 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(Tezos);
|
|
|
|
assets.forEach(addr => {
|
|
|
|
if (!(eztz.crypto.checkAddress(addr))) {
|
2020-09-16 12:52:10 +00:00
|
|
|
errors.push(`Address ${addr} must be valid Tezos address'`);
|
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-07-29 13:42:51 +00:00
|
|
|
}
|