if (provider === "Lute") {
if (!encodedTransaction) {
return false; // Lute requires an encoded transaction
}
try {
// Decode the transaction
const packTransaction = Buffer.from(encodedTransaction, "base64");
const decodedTransaction = algosdk.decodeSignedTransaction(packTransaction);
// Verify the signed transaction
const transactionResult = verifySignedTransaction(decodedTransaction);
if (!transactionResult) {
return false;
}
const { isValid: isTransactionValid, signature: txnSignature } = transactionResult;
// Check if the transaction signature matches the provided signature
const isSignatureValid = txnSignature === signature;
// The final result is true only if both the transaction is valid and the signatures match
return isTransactionValid && isSignatureValid;
} catch (error) {
return false; // Return false if any error occurs during verification
}
}