Example #1
0
 public Builder(Generated.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;
     }
 }
Example #2
0
        //public override OperationThreshold Threshold
        //{
        //    get => OperationThreshold.High;
        //}

        public override Generated.Operation.OperationBody ToOperationBody()
        {
            var op = new Generated.SetOptionsOp();

            //if (InflationDestination != null)
            //{
            //    var inflationDestination = new Generated.AccountID();
            //    //inflationDestination.InnerValue = InflationDestination.XdrPublicKey;
            //    op.InflationDest = inflationDestination;
            //}

            //if (ClearFlags != 0)
            //{
            //    var clearFlags = new Generated.Uint32();
            //    clearFlags.InnerValue = ClearFlags;
            //    op.ClearFlags = clearFlags;
            //}

            //if (SetFlags != 0)
            //{
            //    var setFlags = new Generated.Uint32();
            //    setFlags.InnerValue = SetFlags;
            //    op.SetFlags = setFlags;
            //}

            if (MasterKeyWeight != 0)
            {
                var uint32 = new Generated.Uint32();
                uint32.InnerValue = MasterKeyWeight;
                op.MasterWeight   = uint32;
            }

            if (LowThreshold != 0)
            {
                var uint32 = new Generated.Uint32();
                uint32.InnerValue = LowThreshold;
                op.LowThreshold   = uint32;
            }

            if (MediumThreshold != 0)
            {
                var uint32 = new Generated.Uint32();
                uint32.InnerValue = MediumThreshold;
                op.MedThreshold   = uint32;
            }

            if (HighThreshold != 0)
            {
                var uint32 = new Generated.Uint32();
                uint32.InnerValue = HighThreshold;
                op.HighThreshold  = uint32;
            }

            //if (HomeDomain != null)
            //{
            //    var homeDomain = new Generated.String32();
            //    homeDomain.InnerValue = HomeDomain;
            //    op.HomeDomain = homeDomain;
            //}

            if (Signer != null)
            {
                var signer = new Generated.Signer();
                var weight = new Generated.Uint32();
                weight.InnerValue = SignerWeight & 0xFF;
                signer.Key        = Signer;
                signer.Weight     = weight;
                op.Signer         = signer;
            }

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

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