mirror of
				https://github.com/Instadapp/trustwallet-assets.git
				synced 2024-07-29 22:37:31 +00:00 
			
		
		
		
	 294d8bcb5d
			
		
	
	
		294d8bcb5d
		
			
		
	
	
	
	
		
			
			* rename to sanityFix * Infra for consistency checks and Fixes. * Whitelist check moved to consistency check only. Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { Terra } from "../common/blockchains";
 | |
| import { getChainValidatorsAssets } from "../common/repo-structure";
 | |
| import { ActionInterface, CheckStepInterface } from "./interface";
 | |
| import { isLowerCase } from "../common/types";
 | |
| 
 | |
| export class TerraAction implements ActionInterface {
 | |
|     getName(): string { return "Terra chain"; }
 | |
| 
 | |
|     getSanityChecks(): CheckStepInterface[] {
 | |
|         return [
 | |
|             {
 | |
|                 getName: () => { return "Terra validator assets must have correct format"},
 | |
|                 check: async () => {
 | |
|                     var error: string = "";
 | |
|                     const assets = getChainValidatorsAssets(Terra);
 | |
|                     const prefix = "terravaloper1";
 | |
|                     const expLength = 51;
 | |
|                     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;
 | |
| }
 |