How can I send Sui when calling an entry smart contract function using SUI SDK not as gas amount (ofc I am assuming I would send gas separately)? What would the entry smart contract would look like, that expect SUI?
2 Likes
The function in your package/module (smart contract) would have argument like in_coin:Coin<SUI>
Assuming TS-SDK it would be tx.object("0x.....")
where ‘0x…’ is replaced with the coin ID
2 Likes
If I split a coin like this:
const txb = new TransactionBlock();
const [coin] = txb.splitCoins(txb.gas, [txb.pure(100000)]);
Should I pass only the coin
variable
2 Likes
Yes, the result(s) of a splitCoins can be used in any subsequent command that takes either a coin or object.
3 Likes
Should I need to set the gas amount before splitting the coin?
2 Likes
If you mean setting the transaction gas budget, not necessary for split coin. But there are a number of variables to consider.
This question was from months ago so I presume you’ve worked it out.