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>
		
			
				
	
	
		
			34 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { Waves } from "../generic/blockchains";
 | |
| import { getChainValidatorsAssets } from "../generic/repo-structure";
 | |
| import { ActionInterface, CheckStepInterface } from "../generic/interface";
 | |
| import { isLowerCase, isUpperCase } from "../generic/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, []];
 | |
|                 }
 | |
|             },
 | |
|         ];
 | |
|     }
 | |
| }
 |