mirror of
				https://github.com/Instadapp/trustwallet-assets.git
				synced 2024-07-29 22:37:31 +00:00 
			
		
		
		
	 ec1fe7f6ee
			
		
	
	
		ec1fe7f6ee
		
			
		
	
	
	
	
		
			
			* Make non-mandatory action interface elements optional. * Remove one unused import * Scripts main renamed to entrypoint. * Script common rename to generic * Move generic scripts from action to generic. * Move chain-specific scripts to blockchain. Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { Kava } from "../generic/blockchains";
 | |
| import { getChainValidatorsAssets } from "../generic/repo-structure";
 | |
| import { ActionInterface, CheckStepInterface } from "../generic/interface";
 | |
| import { isLowerCase } from "../generic/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 () => {
 | |
|                     const 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, []];
 | |
|                 }
 | |
|             },
 | |
|         ];
 | |
|     }
 | |
| }
 |