Skip to content

Commit 9545574

Browse files
committed
docs: fix topic message custom fee limit method
Signed-off-by: Ziliang-H <2270669192@qq.com>
1 parent 953a328 commit 9545574

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

native/consensus/submit-message.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ The **max chunk size** refers to the maximum size (in bytes) of each individual
1616

1717
## **Custom Fee Payment**
1818

19-
If a topic has custom fees enabled, users submitting messages must pay the required fee in **HBAR or HTS fungible tokens**. If `setCustomFees` is not specified in the transaction, the user would need to pay any fee associated with that topic ID. The transaction will only fail if the user does not have sufficient assets to cover the fee.
19+
If a topic has custom fees enabled, users submitting messages must pay the required fee in **HBAR or HTS fungible tokens**. If `setCustomFeeLimits` is not specified in the transaction, the user would need to pay any fee associated with that topic ID. The transaction will only fail if the user does not have sufficient assets to cover the fee.
2020

21-
**Recommendation:** To avoid unexpected fees, it is strongly recommended to use `setCustomFees` when submitting a message. This ensures that only the intended fee structure is applied, providing a safeguard against unintended charges.
21+
**Recommendation:** To avoid unexpected fees, it is strongly recommended to use `setCustomFeeLimits` or `addCustomFeeLimit` when submitting a message. This ensures that only the intended fee structure is applied, providing a safeguard against unintended charges.
2222

2323
```java
2424
TopicMessageSubmitTransaction()
2525
.setTopicId(<TOPIC_ID>)
2626
.setMessage(<MESSAGE>)
27-
.setCustomFees(<MAX_CUSTOM_FEES>) // Ensure this covers the required amount
27+
.setCustomFeeLimits(<CUSTOM_FEE_LIMITS>) // Ensure this covers the required amount
2828
.execute(client);
2929
```
3030

@@ -38,7 +38,7 @@ TopicMessageSubmitTransaction()
3838
- Each transaction incurs a standard Hedera network fee based on network resource usage.
3939
- If a custom fee is set for a topic, users submitting messages must pay this fee in HBAR or HTS tokens.
4040
- The Fee Schedule Key allows authorized users to update fee structures. If set, it must sign transactions modifying fees.
41-
- If the topic has custom fees, the sender must have sufficient balance to cover the fees unless they are exempt via the Fee Exempt Key List. It is recommended to use `setCustomFees` on the `TopicMessageSubmitTransaction` to ensure the expected fee structure is applied and avoid unexpected transaction failures due to insufficient funds.
41+
- If the topic has custom fees, the sender must have sufficient balance to cover the fees unless they are exempt via the Fee Exempt Key List. It is recommended to use `setCustomFeeLimits` or `addCustomFeeLimit` on the `TopicMessageSubmitTransaction` to ensure the expected fee structure is applied and avoid unexpected transaction failures due to insufficient funds.
4242
- If you submit a message to a topic with a custom fee, the cost changes from the baseline $0.0001 USD to roughly $0.05 USD per `TopicMessageSubmitTransaction`.
4343
- Use the [query fees table](/learn/networks/mainnet/fees#consensus-service) for the base transaction fee and the [Hedera Fee Estimator](https://hedera.com/fees) to estimate standard network fees.
4444

@@ -133,7 +133,7 @@ TopicMessageSubmitTransaction()
133133
TopicMessageSubmitTransaction transaction = new TopicMessageSubmitTransaction()
134134
.setTopicId(newTopicId)
135135
.setMessage("hello, HCS! ")
136-
.setMaxCustomFees(maxCustomFees); // Set max custom fees if applicable
136+
.setCustomFeeLimits(customFeeLimits); // Set custom fee limits if applicable
137137

138138
//Sign with the client operator key and submit transaction to a Hedera network, get transaction ID
139139
TransactionResponse txResponse = transaction.execute(client);
@@ -155,7 +155,7 @@ System.out.println("The transaction consensus status is " +transactionStatus);
155155
const transaction = await new TopicMessageSubmitTransaction()
156156
.setTopicId(newTopicId)
157157
.setMessage("Hello, HCS!")
158-
.setMaxCustomFees(maxCustomFees); // Set max custom fees if applicable
158+
.setCustomFeeLimits(customFeeLimits); // Set custom fee limits if applicable
159159

160160
// Execute transaction
161161
const txResponse = await transaction.execute(client);

0 commit comments

Comments
 (0)