feat(algo): add verify transaction function #7277
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request enhances Algorand transaction verification by introducing a comprehensive validation flow and a full suite of unit tests. The main change is the implementation of strict checks for transaction parameters and structure, ensuring that only valid transactions are accepted and errors are handled gracefully.
Transaction Verification Logic
verifyTransactionmethod inalgo.tsthat validates required parameters (txParams,txPrebuild, andtxHex) and performs type-specific transaction validation for payment, asset transfer, and key registration transactions.validateBasicTransaction,validatePayTransaction,validateAssetTransferTransaction,validateKeyRegTransaction) to check transaction fields such as sender, recipient, amount, fee, and key registration parameters.Unit Test Coverage
verifyTransaction.tsto check for missing parameters, mismatched amounts or addresses, multiple recipients, malformed transaction hex, and edge cases (such as zero-amount and close remainder transactions).These changes collectively make transaction validation more robust and reliable for Algorand, reducing the risk of accepting malformed or incorrect transactions.WIN-7595