transferAmount property

int get transferAmount

Get the transfer amount of the transaction.

Implementation

int get transferAmount => () {
      int totalAmount = 0;
      int sameCount = 0;
      for (int i = 0; i < unsignedTransaction!.outputs.length; i++) {
        String outputAddress = unsignedTransaction!.outputs[i].getAddress();
        if (!inputAddresses.contains(outputAddress)) {
          totalAmount += unsignedTransaction!.outputs[i].amount;
        } else {
          sameCount++;
        }
      }
      if (sameCount > 0 && sameCount == unsignedTransaction!.outputs.length) {
        return unsignedTransaction!.outputs[0].amount;
      }

      return totalAmount;
    }();