toBlob method

String toBlob({
  1. bool forSigning = true,
})

Implementation

String toBlob({bool forSigning = true}) {
  if (forSigning) {
    if (signingPubKey.isEmpty && multiSigSigners.isEmpty) {
      throw ArgumentError(
          "Invalid public key. Set the signing public key (signingPubKey) or provide multi-signature signers (multiSigSigners) for multi-signature transactions.");
    }
    if (ticketSequance != null && sequence != 0) {
      throw ArgumentError(
          "Set the sequence to 0 when using the ticketSequence");
    }
    if (fee == null) {
      throw ArgumentError("invalid transaction fee");
    }
  }
  final result = STObject.fromValue(toXrpl(), forSigning).toBytes();
  if (forSigning) {
    return BytesUtils.toHexString([
      ...BytesUtils.fromHexString(
          _TransactionUtils._transactionSignaturePrefix),
      ...result
    ], lowerCase: false);
  }
  return BytesUtils.toHexString(result, lowerCase: false);
}