#When to call coverAppCallInnerTransactionFees

17 messages · Page 1 of 1 (latest)

crimson bane
#

Hello frens,

I’m using the Algokit client to build a transaction group, but I’m not using it to send the group. I’m having trouble calculating the correct transaction fees since the group includes both budgeting costs and inner transactions.

Can I use coverAppCallInnerTransactionFees without actually sending the transaction group?

What I’ve tried so far:

  • I simulate the transaction group to calculate the opcode budget and base fee.
  • I include those values in the outer transaction fee.
  • However, the group still fails with a fee too small error.

Setup:

  • Algokit client - "^9.0.0"
  • Language: TypeScript
  • Network: TestNet
dull musk
#

A combination of maxFee with coverAppCallInnerTransactionFees flag set to true and bob’s your uncle.

#

No point in having one without the other, you could use extraFee but it’s not as dynamic.

Sometimes you will need to use a combination of maxFee and extraFee, but it’s rare and you shouldn’t worry about that for now. If you’re using maxFee and the coverInners flag you should be good.

#

maxFee will use as much algo for transaction fees as needed

dull musk
#

Just rereading this— if you never plan to send the transaction and will only ever be simulating it if this is moreso a readonly call, you can adjust the extraFee parameter sufficiently such that it goes through. There’s no need to make sure you’re simulating with an exact fee amount— otherwise what I stated before this message should help.

#

If you have opups there’s also an “extraOpcodeBudget” field when simulating.

crimson bane
dull musk
#

Unless you’re OCD and for some reason must have it hard-coded, maxFee will only use as much that is needed for the transaction group to be successful for each app call.

#

If you simulate it, crawl the response and get the exact fee needed and hard code that fee… maxFee accomplishes the same thing without this manual work

#

If you use maxFee: 1 Algo, and the app call only requires 0.057 Algo for example, it will only use 0.057 Algo

#

Simulate responses can be pretty verbose, I’m confident that if you really wanted to manually get this exact fee, you could find it somewhere in there. But if you only are doing the simulation to calculate the exact fee before actually submitting the group, this is a wasted effort, as maxFee does this for you already.

#

Toggle ‘coverAppCallInnerTransactions” to True, and set maxFee to something like 0.1 Algo, or whatever amount of Algo is certainly above what it will need to be (obviously don’t set it to 10 Algo or something because you never know)

#

You’ll see that only the necessary fees will be used

dull musk
#

You won’t have issues on testnet or localnet, but certainly on mainnet the network fees can fluctuate. Inner transaction fees are flat and fixed at 1000 microalgo though (just a note for the future)

teal minnow
#

Don't hardcode the fees assuming 1000 microalgos, calculate in multiplies of the global "minFee" where possible, especially in smart contracts (future fee increase will make any contracts using static fee < minFee will cease to work)