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; } }
//public Builder SetHomeDomain(string homeDomain) //{ // if (homeDomain.Length > 32) // throw new ArgumentException("Home domain must be <= 32 characters"); // this.homeDomain = homeDomain; // return this; //} public Builder SetSigner(Generated.SignerKey signer, uint weight) { this.signer = CheckNotNull(signer, "signer cannot be null"); if (weight == 0) { throw new ArgumentNullException(nameof(weight), "weight cannot be null"); } signerWeight = weight & 0xFF; return(this); }
//private SetOptionsOperation(KeyPair inflationDestination, uint clearFlags, uint setFlags, // uint masterKeyWeight, uint lowThreshold, uint mediumThreshold, // uint highThreshold, string homeDomain, Generated.SignerKey signer, uint signerWeight) private SetOptionsOperation(uint masterKeyWeight, uint lowThreshold, uint mediumThreshold, uint highThreshold, Generated.SignerKey signer, uint signerWeight) { MasterKeyWeight = masterKeyWeight; LowThreshold = lowThreshold; MediumThreshold = mediumThreshold; HighThreshold = highThreshold; //InflationDestination = inflationDestination; //ClearFlags = clearFlags; //SetFlags = setFlags; //HomeDomain = homeDomain; Signer = signer; SignerWeight = signerWeight; }
//public static Generated.SignerKey PreAuthTx(Transaction tx) //{ // return PreAuthTx(tx, Network.Current); //} //public static Generated.SignerKey PreAuthTx(Transaction tx, Network network) //{ // if (tx == null) // throw new ArgumentNullException(nameof(tx), "tx cannot be null"); // return PreAuthTx(tx.Hash(network)); //} public static Generated.SignerKey PreAuthTx(byte[] hash) { if (hash == null) { throw new ArgumentNullException(nameof(hash), "hash cannot be null"); } var signerKey = new Generated.SignerKey(); var value = CreateUint256(hash); signerKey.Discriminant = Generated.SignerKeyType.Create(Generated.SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX); signerKey.PreAuthTx = value; return(signerKey); }