setPreviousSignatureAndPreviousPublicKey method

Transaction setPreviousSignatureAndPreviousPublicKey(
  1. dynamic prevSign,
  2. dynamic prevPubKey
)

Set the transaction builder with Previous Publickey and Previous Signature @param {String | Uint8List} to Previous Signature (hexadecimal) @param {String | Uint8List} to Previous PublicKey (hexadecimal)

Implementation

Transaction setPreviousSignatureAndPreviousPublicKey(
  dynamic prevSign,
  dynamic prevPubKey,
) {
  if (prevSign is! Uint8List && prevSign is! String) {
    throw "'prevSign' must be a string or Uint8List";
  }

  if (prevPubKey is! Uint8List && prevPubKey is! String) {
    throw "'prevSign' must be a string or Uint8List";
  }

  if (prevSign is String) {
    if (!isHex(prevSign)) {
      throw "'prevSign' must be an hexadecimal string";
    }
  } else {
    prevSign = uint8ListToHex(prevSign);
  }

  if (prevPubKey is String) {
    if (!isHex(prevPubKey)) {
      throw "'prevPubKey' must be an hexadecimal string";
    }
  } else {
    prevPubKey = uint8ListToHex(prevPubKey);
  }

  previousSignature = prevSign;
  previousPublicKey = prevPubKey;
  return this;
}