Solana getFeeForMessage
method
The Solana getFeeForMessage
method returns the fee in lamports that the cluster will charge to process the given message.
This method provides the cost of processing a message based on the current fee schedule. It is useful for estimating the cost of a transaction before it is submitted to the network.
Get you own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
message
— the message to calculate the fee for.
Response
value
— the fee in lamports that the cluster will charge to process the message.
Use case
A practical use case forgetFeeForMessage
is to estimate the cost of a transaction before it is submitted to the network. This can be useful for wallets or other applications that need to display or make use of this information.
Here’s a script to generate the message data for the 1 SOL transfer:
Body
application/json