Esempio n. 1
0
            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;
                }
            }
Esempio n. 2
0
        public override sdkxdr.Operation.OperationBody ToOperationBody()
        {
            sdkxdr.SetOptionsOp op = new sdkxdr.SetOptionsOp();

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

            if (ClearFlags != null)
            {
                sdkxdr.Uint32 clearFlags = new sdkxdr.Uint32();
                clearFlags.InnerValue = ClearFlags.Value;
                op.ClearFlags         = clearFlags;
            }

            if (SetFlags != null)
            {
                sdkxdr.Uint32 setFlags = new sdkxdr.Uint32();
                setFlags.InnerValue = SetFlags.Value;
                op.SetFlags         = setFlags;
            }

            if (MasterKeyWeight != null)
            {
                sdkxdr.Uint32 uint32 = new sdkxdr.Uint32();
                uint32.InnerValue = MasterKeyWeight.Value;
                op.MasterWeight   = uint32;
            }

            if (LowThreshold != null)
            {
                sdkxdr.Uint32 uint32 = new sdkxdr.Uint32();
                uint32.InnerValue = LowThreshold.Value;
                op.LowThreshold   = uint32;
            }

            if (MediumThreshold != null)
            {
                sdkxdr.Uint32 uint32 = new sdkxdr.Uint32();
                uint32.InnerValue = MediumThreshold.Value;
                op.MedThreshold   = uint32;
            }

            if (HighThreshold != null)
            {
                sdkxdr.Uint32 uint32 = new sdkxdr.Uint32();
                uint32.InnerValue = HighThreshold.Value;
                op.HighThreshold  = uint32;
            }

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

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

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