refactor trx validation