How can I call splitcoin and call a smart contract function call on the same transaction with @mysten/dapp-kit
library?
Here is how I am trying:
const coinsToPay = (await suiClient.getAllCoins({ owner: account?.address + '' }))?.data as any;
CoinObj = coinsToPay.coinObjectId;
const trx = new TransactionBlock();
const [coins] = trx.splitCoins(trx.gas, [trx.pure(convertSUItoMIST(gasFee))]);
trx.transferObjects([coins], trx.pure(account?.address));
trx.moveCall({
target: `${PACKAGE_ADDRESS}::protocol::mint`,
arguments: [
trx.pure("NFT"),
trx.object(CoinObj),
],
});
signAndExecuteTransactionBlock(
{
transactionBlock: trx,
},
{
onSuccess: (trx_response) => {
},
}
);
Getting error with Error: No valid gas coins found for the transaction.
There is one sui coin object with a value of 20 in the associated address.