import { TransactionBlock } from '@mysten/sui.js/transactions';
import { useSignAndExecuteTransactionBlock } from '@mysten/dapp-kit';
function useMoveCall() {
const { mutate: signAndExecute } = useSignAndExecuteTransactionBlock();
const callFunction = async () => {
const tx = new TransactionBlock();
tx.moveCall({
target: `${PACKAGE_ID}::module::function`,
arguments: [
tx.pure('argument1'),
tx.object('0x...'), // Object ID
],
});
signAndExecute(
{
transactionBlock: tx,
options: {
showEffects: true,
showObjectChanges: true,
},
},
{
onSuccess: (result) => {
console.log('Transaction successful:', result);
},
}
);
};
return { callFunction };
}