sign method

void sign(
  1. List<Signer> signers
)

Signs this Transaction with the specified signers. Multiple signatures may be applied to a Transaction. The first signature is considered "primary" and is used to identify and confirm transactions.

Implementation

void sign(final List<Signer> signers) {
  final Uint8List serializedMessage = message.serialize().asUint8List();
  final int numRequiredSignatures = message.header.numRequiredSignatures;
  final List<Pubkey> signerPubkeys =
      message.accountKeys.sublist(0, numRequiredSignatures);
  for (final Signer signer in signers) {
    final int signerIndex = signerPubkeys.indexOf(signer.pubkey);
    check(signerIndex >= 0, 'Unknown transaction signer.');
    signatures[signerIndex] =
        nacl.sign.detached.sync(serializedMessage, signer.seckey);
  }
}