Show / Hide Table of Contents

Class UpdateFileExtensions

Extension methods for updating network file properties and content.

Inheritance
object
UpdateFileExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class UpdateFileExtensions

Methods

| Edit this page View Source

UpdateFileAsync(ConsensusClient, UpdateFileParams, Action<IConsensusContext>?)

Updates the properties or contents of an existing file stored in the network.

Declaration
public static Task<TransactionReceipt> UpdateFileAsync(this ConsensusClient client, UpdateFileParams updateParameters, Action<IConsensusContext>? configure = null)
Parameters
Type Name Description
ConsensusClient client

The Consensus Node Client executing the file update.

UpdateFileParams updateParameters

Update parameters indicating the file to update and what properties such as the access key or content that should be updated.

Action<IConsensusContext> 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.

Returns
Type Description
Task<TransactionReceipt>

A transaction receipt indicating the operation was successful.

Examples

Replace file contents (the 4KB cap applies — chunk larger writes):

// Overwrite the file's contents. The update transaction has a 4KB
// payload limit — for larger replacements, truncate and append via
// AppendFileAsync in chunks.
var receipt = await client.UpdateFileAsync(new UpdateFileParams
{
    File = file,
    Contents = newContents
});
Console.WriteLine($"Update status: {receipt.Status}");
Exceptions
Type Condition
ArgumentOutOfRangeException

If required arguments are missing.

InvalidOperationException

If required context configuration is missing.

PrecheckException

If the gateway node rejected the request upon submission.

ConsensusException

If the network was unable to come to consensus before the duration of the transaction expired.

TransactionException

If the network rejected the update request as invalid or had missing data.

  • Edit this page
  • View Source
In this article
Back to top .NET Client Library for Hiero Network and Hedera Hashgraph