toXdr method Null safety

XdrContractAuth toXdr()

Creates an XdrContractAuth from this.

Implementation

XdrContractAuth toXdr() {
  XdrAddressWithNonce? addressWithNonce;
  if (address != null && nonce != null) {
    addressWithNonce =
        XdrAddressWithNonce(address!.toXdr(), XdrUint64(nonce!));
  }

  // See: https://discord.com/channels/897514728459468821/1076723574884282398/1078095366890729595
  List<XdrSCVal> sigArgs = List<XdrSCVal>.empty(growable: true);
  if (signatureArgs.length > 0) {
    sigArgs.add(XdrSCVal.forVec(signatureArgs));
  }
  return new XdrContractAuth(
      addressWithNonce, rootInvocation.toXdr(), sigArgs);
}