示例#1
0
 protected async Task HandleValidSubmit()
 {
     _output = null;
     await _network.ExecuteAsync(_input.Gateway, _input.Payer, async client =>
     {
         var updateParams = new UpdateTopicParams
         {
             Topic = _input.Topic
         };
         if (_input.UpdateDescription)
         {
             updateParams.Memo = _input.Description?.Trim();
         }
         if (_input.UpdateAdministrator)
         {
             updateParams.Administrator = _input.Administrator ?? Endorsement.None;
         }
         if (_input.UpdateParticipant)
         {
             updateParams.Participant = _input.Participant ?? Endorsement.None;
         }
         if (_input.UpdateRenewAccount)
         {
             updateParams.RenewAccount = _input.RenewAccount ?? Address.None;
         }
         _output = await client.UpdateTopicAsync(updateParams, ctx => ctx.Memo = _input.Memo?.Trim());
     });
 }
 internal static UpdateTopicParams UpdateParameters(UpdateTopicParams updateParameters)
 {
     if (updateParameters is null)
     {
         throw new ArgumentNullException(nameof(updateParameters), "Topic Update Parameters argument is missing. Please check that it is not null.");
     }
     if (updateParameters.Topic is null)
     {
         throw new ArgumentNullException(nameof(updateParameters.Topic), "Topic address is missing. Please check that it is not null.");
     }
     if (updateParameters.Memo is null &&
         updateParameters.Administrator is null &&
         updateParameters.Participant is null &&
         updateParameters.RenewPeriod is null &&
         updateParameters.RenewAccount is null)
     {
         throw new ArgumentException("The Topic Updates contain no update properties, it is blank.", nameof(updateParameters));
     }
     return(updateParameters);
 }
示例#3
0
 internal ConsensusUpdateTopicTransactionBody(UpdateTopicParams updateParameters) : this()
 {
     TopicID = new TopicID(updateParameters.Topic); if (updateParameters is null)
     {
         throw new ArgumentNullException(nameof(updateParameters), "Topic Update Parameters argument is missing. Please check that it is not null.");
     }
     if (updateParameters.Topic is null)
     {
         throw new ArgumentNullException(nameof(updateParameters.Topic), "Topic address is missing. Please check that it is not null.");
     }
     if (updateParameters.Memo is null &&
         updateParameters.Administrator is null &&
         updateParameters.Participant is null &&
         updateParameters.RenewPeriod is null &&
         updateParameters.RenewAccount is null)
     {
         throw new ArgumentException("The Topic Updates contain no update properties, it is blank.", nameof(updateParameters));
     }
     if (updateParameters.Memo != null)
     {
         Memo = updateParameters.Memo;
     }
     if (!(updateParameters.Administrator is null))
     {
         AdminKey = new Key(updateParameters.Administrator);
     }
     if (!(updateParameters.Participant is null))
     {
         SubmitKey = new Key(updateParameters.Participant);
     }
     if (updateParameters.RenewPeriod.HasValue)
     {
         AutoRenewPeriod = new Duration(updateParameters.RenewPeriod.Value);
     }
     if (!(updateParameters.RenewAccount is null))
     {
         AutoRenewAccount = new AccountID(updateParameters.RenewAccount);
     }
 }
示例#4
0
 /// <summary>
 /// Updates the changeable properties of a hedera network Topic.
 /// </summary>
 /// <param name="updateParameters">
 /// The Topic update parameters, includes a required
 /// <see cref="Address"/> reference to the Topic to update plus
 /// a number of changeable properties of the Topic.
 /// </param>
 /// <param name="configure">
 /// Optional callback method providing an opportunity to modify
 /// the execution configuration for just this method call.
 /// It is executed prior to submitting the request to the network.
 /// </param>
 /// <returns>
 /// A transaction record containing the details of the results.
 /// of the request.
 /// </returns>
 /// <exception cref="ArgumentOutOfRangeException">If required arguments are missing.</exception>
 /// <exception cref="InvalidOperationException">If required context configuration is missing.</exception>
 /// <exception cref="PrecheckException">If the gateway node create rejected the request upon submission.</exception>
 /// <exception cref="ConsensusException">If the network was unable to come to consensus before the duration of the transaction expired.</exception>
 /// <exception cref="TransactionException">If the network rejected the create request as invalid or had missing data.</exception>
 public async Task <TransactionRecord> UpdateTopicWithRecordAsync(UpdateTopicParams updateParameters, Action <IContext>?configure = null)
 {
     return(new TransactionRecord(await ExecuteTransactionAsync(new ConsensusUpdateTopicTransactionBody(updateParameters), configure, true, updateParameters.Signatory).ConfigureAwait(false)));
 }