import { Injectable } from "@angular/core" ; import { FormControl } from "@angular/forms" ; import { NetworkProvider } from "@/services/network/network" ; @ Injectable ( ) export class AddressValidator { public constructor ( private networkProvider ) { } public isValid ( control ) { if ( ! control . value ) { return null ; } if ( ! this . networkProvider . isValidAddress ( control . value ) ) { return { invalidAddress : true } ; } return null ; } }