public static Signer Decode(XdrDataInputStream stream) { Signer decodedSigner = new Signer(); decodedSigner.Key = SignerKey.Decode(stream); decodedSigner.Weight = Uint32.Decode(stream); return(decodedSigner); }
/// <summary> /// Add, update, or remove a signer from the account. Signer is deleted if the weight = 0; /// </summary> /// <param name="signer">The signer key. Use <see cref="stellar_dotnet_sdk.Signer" /> helper to create this object.</param> /// <param name="weight">The weight to attach to the signer (0-255).</param> /// <returns>Builder object so you can chain methods.</returns> public Builder SetSigner(sdkxdr.SignerKey signer, int?weight) { this.signer = signer ?? throw new ArgumentNullException(nameof(signer), "signer cannot be null"); if (weight == null) { throw new ArgumentNullException(nameof(weight), "weight cannot be null"); } signerWeight = weight.Value & 0xFF; return(this); }
private SetOptionsOperation(KeyPair inflationDestination, int?clearFlags, int?setFlags, int?masterKeyWeight, int?lowThreshold, int?mediumThreshold, int?highThreshold, string homeDomain, sdkxdr.SignerKey signer, int?signerWeight) { InflationDestination = inflationDestination; ClearFlags = clearFlags; SetFlags = setFlags; MasterKeyWeight = masterKeyWeight; LowThreshold = lowThreshold; MediumThreshold = mediumThreshold; HighThreshold = highThreshold; HomeDomain = homeDomain; Signer = signer; SignerWeight = signerWeight; }
/// <summary> /// Create <code>preAuthTx</code> <see cref="sdkxdr.SignerKey" /> from /// a transaction hash. /// </summary> /// <param name="hash"></param> /// <returns>sdkxdr.SignerKey</returns> public static sdkxdr.SignerKey PreAuthTx(byte[] hash) { if (hash == null) { throw new ArgumentNullException(nameof(hash), "hash cannot be null"); } var signerKey = new sdkxdr.SignerKey(); var value = CreateUint256(hash); signerKey.Discriminant = sdkxdr.SignerKeyType.Create(sdkxdr.SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX); signerKey.PreAuthTx = value; return(signerKey); }
/// <summary> /// Create <code>preAuthTx</code> <see cref="sdkxdr.SignerKey" /> from /// a <see cref="sdkxdr.Transaction" /> hash. /// </summary> /// <param name="tx"></param> /// <returns>sdkxdr.SignerKey</returns> public static sdkxdr.SignerKey PreAuthTx(Transaction tx) { if (tx == null) { throw new ArgumentNullException(nameof(tx), "tx cannot be null"); } var signerKey = new sdkxdr.SignerKey(); var value = CreateUint256(tx.Hash()); signerKey.Discriminant = sdkxdr.SignerKeyType.Create(sdkxdr.SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX); signerKey.PreAuthTx = value; return(signerKey); }
public static void Encode(XdrDataOutputStream stream, SignerKey encodedSignerKey) { stream.WriteInt((int)encodedSignerKey.Discriminant.InnerValue); switch (encodedSignerKey.Discriminant.InnerValue) { case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: Uint256.Encode(stream, encodedSignerKey.Ed25519); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: Uint256.Encode(stream, encodedSignerKey.PreAuthTx); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: Uint256.Encode(stream, encodedSignerKey.HashX); break; } }
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 static SignerKey Decode(XdrDataInputStream stream) { SignerKey decodedSignerKey = new SignerKey(); SignerKeyType discriminant = SignerKeyType.Decode(stream); decodedSignerKey.Discriminant = discriminant; switch (decodedSignerKey.Discriminant.InnerValue) { case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_ED25519: decodedSignerKey.Ed25519 = Uint256.Decode(stream); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_PRE_AUTH_TX: decodedSignerKey.PreAuthTx = Uint256.Decode(stream); break; case SignerKeyType.SignerKeyTypeEnum.SIGNER_KEY_TYPE_HASH_X: decodedSignerKey.HashX = Uint256.Decode(stream); break; } return(decodedSignerKey); }
/// <summary> /// Create a new builder with the given sponsoredId. /// </summary> /// <param name="accountId"></param> /// <param name="signerKey"></param> public Builder(KeyPair accountId, xdr.SignerKey signerKey) { _accountId = accountId ?? throw new ArgumentNullException(nameof(accountId)); _signerKey = signerKey ?? throw new ArgumentNullException(nameof(signerKey)); }
/// <summary> /// Construct a new BeginSponsoringFutureReserves builder from a BeginSponsoringFutureReservesOp XDR. /// </summary> /// <param name="op"></param> public Builder(xdr.RevokeSponsorshipOp.RevokeSponsorshipOpSigner op) { _accountId = KeyPair.FromXdrPublicKey(op.AccountID.InnerValue); _signerKey = op.SignerKey; }
public RevokeSignerSponsorshipOperation(KeyPair accountId, xdr.SignerKey signerKey) { AccountId = accountId; SignerKey = signerKey; }
public static void Encode(XdrDataOutputStream stream, Signer encodedSigner) { SignerKey.Encode(stream, encodedSigner.Key); Uint32.Encode(stream, encodedSigner.Weight); }