submit method

Future<List<String>> submit(
  1. Algorand algorand, {
  2. bool waitForConfirmation = false,
})

Send the transaction group to the network, but don't wait for it to be committed to a block. An error will be thrown if submission fails.

The composer's status must be SUBMITTED or lower before calling this method. If submission is successful, this composer's status will update to SUBMITTED.

Note: a group can only be submitted again if it fails.

@return If the submission is successful, resolves to a list of TxIDs of the submitted transactions.

Implementation

Future<List<String>> submit(
  Algorand algorand, {
  bool waitForConfirmation = false,
}) async {
  final compareTo = status.index - AtcStatus.SUBMITTED.index;
  if (compareTo > 0) {
    throw ArgumentError(
        'Atomic Transaction Composer cannot submit commited transaction.');
  }

  // Gather the signatures
  final signedTxns = await gatherSignatures();

  await algorand.sendTransactions(
    signedTxns,
    waitForConfirmation: waitForConfirmation,
  );

  _status = AtcStatus.SUBMITTED;
  return getTransactionIds();
}