commitTransaction method

  1. @override
Future<void> commitTransaction({
  1. required TransactionHeaders headers,
  2. required Transaction transaction,
})
override

Commits a transaction.

  • headers are the headers to be sent with the request.
  • transaction is the transaction to be committed.

Implementation

@override
Future<void> commitTransaction({
  required TransactionHeaders headers,
  required Transaction transaction,
}) async {
  await start();

  final response = await fetch(
    _endpoint.resolve('/transaction/${transaction.id}/commit'),
    method: 'POST',
    headers: headers,
  );
  final result = await response.json();

  return switch (result) {
    {'errors': final Iterable errors} => throwErrors(errors),
    _ => null,
  };
}