addTransaction method

void addTransaction(
  1. TransactionWithSigner signer
)

Add a transaction to this atomic group.

An error will be thrown if the composer's status is not BUILDING, or if adding this transaction causes the current group to exceed MAX_GROUP_SIZE.

Implementation

void addTransaction(TransactionWithSigner signer) {
  if (signer.transaction.group != null) {
    throw ArgumentError(
        'Atomic Transaction Composer group field must be zero');
  }
  if (status != AtcStatus.BUILDING) {
    throw ArgumentError(
        'Atomic Transaction Composer only add transaction in BUILDING stage');
  }

  if (transactions.length >= MAX_GROUP_SIZE) {
    throw ArgumentError(
        'Atomic Transaction Composer cannot exceed MAX_GROUP_SIZE == 16 transactions');
  }

  transactions.add(signer);
}