Hi guys,
I’am trying to send a transaction in TestNet using Algorand dart
Address recipient = Address.fromAlgorandAddress(receiverTestNetAddress);
Address sender = Address.fromAlgorandAddress(
testNetAddress);
TransactionParams transactionParams = TransactionParams(
consensusVersion: params['consensus-version'],
fee: fee,
genesisId: params['genesis-id'],
genesisHash: genesisHashBytes,
lastRound: BigInt.from(params['last-round']),
minFee: BigInt.from(params['min-fee']));
final transaction = await (PaymentTransactionBuilder()
..sender = sender
..noteText = 'Hello world'
..amount = amount
..receiver = null
..suggestedParams = transactionParams)
.build();
final encodedTransaction = transaction.getEncodedTransaction();
final signature = await Ed25519().sign(
encodedTransaction,
keyPair: keyPair,
);
// Create the signed transaction with signature
final signedTransaction = ref.SignedTransaction(
signature: Uint8List.fromList(signature.bytes),
transaction: transaction,
);
signedTransaction.authAddress = address ;
final encodedTxBytes =
encode.Encoder.encodeMessagePack(signedTransaction.toMessagePack());
final responseSendTxn = await http.post(
Uri.parse('$algodAddress/v2/transactions'),
headers: {'Content-Type': 'application/x-binary'},
body: encodedTxBytes,
);
if (responseSendTxn.statusCode != 200) {
throw Exception('Failed to send transaction');
}
when i add the sender i get this error message :
** At least one signature didn’t pass verification**
when i remove it ( just for testing) i get this :
invalid : transaction cannot close account to its sender