sendL2Transaction function
Sends a L2 transaction to the Coordinator
@param {Object} transaction - Transaction object prepared by TxUtils.generateL2Transaction @param {String} bJJ - The compressed BabyJubJub in hexadecimal format of the transaction sender.
@return {Object} - Object with the response status, transaction id and the transaction nonce
Implementation
dynamic sendL2Transaction(Map<String, dynamic> transaction, String? bJJ) async {
Response result =
await (postPoolTransaction(transaction) as FutureOr<Response>);
if (result.statusCode == 200) {
addPoolTransaction(json.encode(transaction), bJJ);
}
return {
"status": result.statusCode,
"id": result.body,
"nonce": transaction['nonce'],
};
}