Determine gas amount for smart contract call

How do determine what amount of SUI is needed as gas to call an entry smart contact function?

If you are using TS-SDK PTB it will calulate it for you.

What will be the syntax, cause when I use TS SDK to call a smart contract function, I have to set the gas otherwise it would give an error.

It shouldn’t error: Building Programmable Transaction Blocks | Sui Documentation

Sometimes it may error indeed. You can set it to something around 1.000.000.000 (1 Sui), it won’t consume it after all!

OR you can estimate the actual gas cost by running dryRunTransactionBlock