signAndBuildTransactionAsync method

Future<ADATransaction> signAndBuildTransactionAsync(
  1. ONSignADAAsync onSignADA
)

Implementation

Future<ADATransaction> signAndBuildTransactionAsync(
    ONSignADAAsync onSignADA) async {
  _validateAmounts();
  final aux = auxiliaryData;
  final trBody = buildTxBody(auxHash: aux?.toHash());
  final bodyHash = List<int>.unmodifiable(trBody.toHash().data);
  final List<ADABaseTransactionWitness> witnesses = [];
  final transactionSigners = signers;

  for (final i in transactionSigners) {
    final witness = await onSignADA(address: i, digest: bodyHash);
    witnesses.add(witness);
  }
  final vkeys = witnesses.whereType<Vkeywitness>().toList();
  final bootstraps = witnesses.whereType<BootstrapWitness>().toList();
  return ADATransaction(
      body: trBody,
      data: aux,
      witnessSet: TransactionWitnessSet(
          vKeys: vkeys,
          nativeScripts: transactionNativeScripts,
          bootstraps: bootstraps));
}