toV0Xdr method

XdrTransactionV0 toV0Xdr()

Generates a V0 Transaction XDR object for this transaction.

Implementation

XdrTransactionV0 toV0Xdr() {
  // fee
  XdrUint32 fee = XdrUint32(_mFee);
  // sequenceNumber
  XdrInt64 sequenceNumberUint = XdrInt64(_mSequenceNumber);

  XdrPublicKey sourcePublickKey =
      KeyPair.fromAccountId(_mSourceAccount.ed25519AccountId).xdrPublicKey;

  // operations
  List<XdrOperation> operations = List<XdrOperation>.empty(growable: true);
  for (int i = 0; i < _mOperations.length; i++) {
    operations.add(_mOperations[i].toXdr());
  }

  TimeBounds? tb = _mPreconditions?.timeBounds;
  XdrTimeBounds? xdrTimeBounds = (tb == null ? null : tb.toXdr());
  XdrMemo xdrMemo =
      _mMemo == null ? XdrMemo(XdrMemoType.MEMO_NONE) : _mMemo!.toXdr();

  return XdrTransactionV0(
      sourcePublickKey.getEd25519()!,
      fee,
      XdrSequenceNumber(sequenceNumberUint),
      xdrTimeBounds,
      xdrMemo,
      operations,
      XdrTransactionV0Ext(0));
}