public Builder(sdkxdr.SetOptionsOp op)
 {
     if (op.InflationDest != null)
     {
         inflationDestination = KeyPair.FromXdrPublicKey(
             op.InflationDest.InnerValue);
     }
     if (op.ClearFlags != null)
     {
         clearFlags = op.ClearFlags.InnerValue;
     }
     if (op.SetFlags != null)
     {
         setFlags = op.SetFlags.InnerValue;
     }
     if (op.MasterWeight != null)
     {
         masterKeyWeight = op.MasterWeight.InnerValue;
     }
     if (op.LowThreshold != null)
     {
         lowThreshold = op.LowThreshold.InnerValue;
     }
     if (op.MedThreshold != null)
     {
         mediumThreshold = op.MedThreshold.InnerValue;
     }
     if (op.HighThreshold != null)
     {
         highThreshold = op.HighThreshold.InnerValue;
     }
     if (op.HomeDomain != null)
     {
         homeDomain = op.HomeDomain.InnerValue;
     }
     if (op.Signer != null)
     {
         signer       = op.Signer.Key;
         signerWeight = op.Signer.Weight.InnerValue & 0xFF;
     }
 }
        public override sdkxdr.Operation.OperationBody ToOperationBody()
        {
            var op = new sdkxdr.SetOptionsOp();

            if (InflationDestination != null)
            {
                var inflationDestination = new sdkxdr.AccountID();
                inflationDestination.InnerValue = InflationDestination.XdrPublicKey;
                op.InflationDest = inflationDestination;
            }
            if (ClearFlags != null)
            {
                var clearFlags = new sdkxdr.Uint32();
                clearFlags.InnerValue = ClearFlags.Value;
                op.ClearFlags         = clearFlags;
            }
            if (SetFlags != null)
            {
                var setFlags = new sdkxdr.Uint32();
                setFlags.InnerValue = SetFlags.Value;
                op.SetFlags         = setFlags;
            }
            if (MasterKeyWeight != null)
            {
                var uint32 = new sdkxdr.Uint32();
                uint32.InnerValue = MasterKeyWeight.Value;
                op.MasterWeight   = uint32;
            }
            if (LowThreshold != null)
            {
                var uint32 = new sdkxdr.Uint32();
                uint32.InnerValue = LowThreshold.Value;
                op.LowThreshold   = uint32;
            }
            if (MediumThreshold != null)
            {
                var uint32 = new sdkxdr.Uint32();
                uint32.InnerValue = MediumThreshold.Value;
                op.MedThreshold   = uint32;
            }
            if (HighThreshold != null)
            {
                var uint32 = new sdkxdr.Uint32();
                uint32.InnerValue = HighThreshold.Value;
                op.HighThreshold  = uint32;
            }
            if (HomeDomain != null)
            {
                var homeDomain = new sdkxdr.String32();
                homeDomain.InnerValue = HomeDomain;
                op.HomeDomain         = homeDomain;
            }
            if (Signer != null)
            {
                var signer = new sdkxdr.Signer();
                var weight = new sdkxdr.Uint32();
                weight.InnerValue = SignerWeight.Value & 0xFF;
                signer.Key        = Signer;
                signer.Weight     = weight;
                op.Signer         = signer;
            }

            var body = new sdkxdr.Operation.OperationBody();

            body.Discriminant = sdkxdr.OperationType.Create(sdkxdr.OperationType.OperationTypeEnum.SET_OPTIONS);
            body.SetOptionsOp = op;
            return(body);
        }