import * as yup from 'yup' ; import { validateAddressChain , validateStacksAddress } from '@app/common/stacks-utils' ; import { isString } from '@app/common/utils' ; import { Network } from '@shared/constants' ; export function stxAddressNetworkValidatorFactory ( currentNetwork ) { return ( value ) => { if ( ! isString ( value ) ) return false ; return validateAddressChain ( value , currentNetwork ) ; } ; } export function stxNotCurrentAddressValidatorFactory ( currentAddress ) { return ( value ) => value !== currentAddress ; } export function stxAddressSchema ( errorMsg ) { return yup . string ( ) . test ( { message : errorMsg , test ( value ) { if ( ! isString ( value ) ) return false ; return validateStacksAddress ( value ) ; } , } ) ; }