Append to a file
Constructor
Description
new FileAppendTransaction()Methods
Method
Type
Description
Requirement
//Create the transaction
FileAppendTransaction transaction = new FileAppendTransaction()
.setFileId(newFileId)
.setContents("The appended contents");
//Change the default max transaction fee to 2 hbars
FileCreateTransaction modifyMaxTransactionFee = transaction.setMaxTransactionFee(new Hbar(2));
//Prepare transaction for signing, sign with the key on the file, sign with the client operator key and submit to a Hedera network
TransactionResponse txResponse = modifyMaxTransactionFee.freezeWith(client).sign(key).execute(client);
//Request the receipt
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//v2.0.0//Create the transaction
const transaction = await new FileAppendTransaction()
.setFileId(newFileId)
.setContents("The appended contents")
.setMaxTransactionFee(new Hbar(2))
.freezeWith(client);
//Sign with the file private key
const signTx = await transaction.sign(fileKey);
//Sign with the client operator key and submit to a Hedera network
const txResponse = await signTx.execute(client);
//Request the receipt
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);
//v2.0.5Get transaction values
Method
Type
Description
Requirement
Last updated