Transactions & Fees
getFeeForMessage
Get the fee the network will charge for a particular message
Parameters
Base-64 encoded Message
The commitment level to use for the fee calculation
Response
Code Examples
Basic Request
Using web3.js
Using Python
Notes
- Returns the fee the network will charge for a particular message
- Useful for calculating transaction fees more accurately
- Preferred over older fee calculation methods
- Different commitment levels can be specified
- Returns null if the message is invalid or can’t be processed
Best Practices
- Use this method for accurate fee prediction before sending transactions
- Provide a valid base64-encoded message to avoid null responses
- Handle null responses appropriately in your application
- Handle network errors and retry when appropriate
- Use this method when precise fee calculation is needed