Class FileAppendTransaction

A transaction specifically to append data to a file on the network.

If a file has multiple keys, all keys must sign to modify its contents.

Hierarchy

Constructors

Properties

_defaultMaxTransactionFee: Hbar
_operator: null | ClientOperator
_operatorAccountId: undefined | null | AccountId
_signOnDemand: boolean
_transactionIds: default<TransactionId>

Accessors

  • get grpcDeadline(): null | number
  • Get the grpc deadline

    Returns null | number

  • get maxAttempts(): number
  • Get the max attempts on the request

    Returns number

  • get maxBackoff(): number
  • Get the max backoff

    Returns number

  • get maxRetries(): number
  • Returns number

    Deprecated

  • get minBackoff(): null | number
  • Get the min backoff

    Returns null | number

  • get nodeAccountIds(): null | AccountId[]
  • Get the list of node account IDs on the request. If no nodes are set, then null is returned. The reasoning for this is simply "legacy behavior".

    Returns null | AccountId[]

  • get regenerateTransactionId(): null | boolean
  • Is transaction ID regeneration enabled

    Returns null | boolean

  • get transactionValidDuration(): number
  • Get the transaction valid duration

    Returns number

Methods

  • Set the given byte array as the file's contents.

    This may be omitted to append an empty file.

    Note that total size for a given transaction is limited to 6KiB (as of March 2020) by the network; if you exceed this you may receive a HederaPreCheckStatusException with Status#TransactionOversize.

    In this case, you will need to break the data into chunks of less than ~6KiB and execute this transaction with the first chunk and then use FileAppendTransaction with FileAppendTransaction#setContents(Uint8Array) for the remaining chunks.

    Parameters

    • contents: string | Uint8Array

    Returns FileAppendTransaction

  • Set the keys which must sign any transactions modifying this file. Required.

    All keys must sign to modify the file's contents or keys. No key is required to sign for extending the expiration time (except the one for the operator account paying for the transaction). Only one key must sign to delete the file, however.

    To require more than one key to sign to delete a file, add them to a KeyList and pass that here.

    The network currently requires a file to have at least one key (or key list or threshold key) but this requirement may be lifted in the future.

    Parameters

    Returns FileAppendTransaction

  • Set the ID for this transaction.

    The transaction ID includes the operator's account ( the account paying the transaction fee). If two transactions have the same transaction ID, they won't both have an effect. One will complete normally and the other will fail with a duplicate transaction status.

    Normally, you should not use this method. Just before a transaction is executed, a transaction ID will be generated from the operator on the client.

    Parameters

    Returns FileAppendTransaction

  • Sign the transaction with the public key and signer function

    If sign on demand is enabled no signing will be done immediately, instead the private key signing function and public key are saved to be used when a user calls an exit condition method (not sure what a better name for this is) such as toBytes[Async](), getTransactionHash[PerNode]() or execute().

    Parameters

    • publicKey: PublicKey
    • transactionSigner: ((message) => Promise<Uint8Array>)
        • (message): Promise<Uint8Array>
        • Parameters

          • message: Uint8Array

          Returns Promise<Uint8Array>

    Returns Promise<FileAppendTransaction>

  • Serialize the request into bytes. This will encode all the transactions into a proto.TransactionList and return the encoded protobuf.

    NOTE: Does not support sign on demand

    Returns Uint8Array

  • This method is called by each *Transaction._fromProtobuf() method. It does all the finalization before the user gets hold of a complete Transaction

    Type Parameters

    Parameters

    • transaction: TransactionT
    • transactions: ITransaction[]
    • signedTransactions: ISignedTransaction[]
    • transactionIds: TransactionId[]
    • nodeIds: AccountId[]
    • bodies: ITransactionBody[]

    Returns TransactionT

Generated using TypeDoc