/// <summary> /// Creates the <see cref="Transaction{T}"/> object and builds the set account attribute transaction. /// </summary> /// <param name="options">The options for this transaction.</param> /// <returns>A <see cref="Transaction{T}"/> object.</returns> public Transaction <AccountSetTxResponse> BuildAccountSetTx(AccountSetTxOptions options) { var tx = new InnerTransaction <AccountSetTxData, AccountSetTxResponse>(this); switch (options.Type) { case AccountSetType.Property: return(BuildAccountSet(options, tx)); case AccountSetType.Delegate: return(BuildDelegateKeySet(options, tx)); case AccountSetType.Signer: return(BuildSignerSet(options, tx)); } tx.TxJson.Exception = new Exception("Build account set should not go here."); return(tx); }
private InnerTransaction <AccountSetTxData, V> BuildDelegateKeySet <V>(AccountSetTxOptions options, InnerTransaction <AccountSetTxData, V> tx) where V : GeneralTxResponse { if (!Utils.IsValidAddress(options.Account)) { tx.TxJson.Exception = new Exception("Invalid source address."); return(tx); } if (!Utils.IsValidAddress(options.DelegateKey)) { tx.TxJson.Exception = new Exception("Invalid regular key address."); return(tx); } tx.TransactionType = TransactionType.SetRegularKey; tx.TxJson.Account = options.Account; tx.TxJson.RegularKey = options.DelegateKey; return(tx); }
private InnerTransaction <AccountSetTxData, V> BuildAccountSet <V>(AccountSetTxOptions options, InnerTransaction <AccountSetTxData, V> tx) where V : GeneralTxResponse { if (!Utils.IsValidAddress(options.Account)) { tx.TxJson.Exception = new Exception("Invalid source address."); return(tx); } tx.TransactionType = TransactionType.AccountSet; tx.TxJson.Account = options.Account; if (options.SetFlag != null) { tx.TxJson.SetFlag = (UInt32)options.SetFlag.Value; } if (options.ClearFlag != null) { tx.TxJson.ClearFlag = (UInt32)options.ClearFlag.Value; } return(tx); }
private InnerTransaction <AccountSetTxData, V> BuildSignerSet <V>(AccountSetTxOptions options, InnerTransaction <AccountSetTxData, V> tx) where V : GeneralTxResponse { tx.TxJson.Exception = new Exception("Not implemented."); return(tx); }