GitHub
Signing Transactions

There are a few ways you can make contract call transactions, and they mostly depend on your personal preference and the type of web development environment you're using.

To learn more about making contract calls, check out the @stacks/connect docs.

import { openContractCall } from '@stacks/connect';
import { nftContract } from './clarigen-contracts';
 
export const TransferTx = () => {
  const { openContractCall } = useOpenContractCall();
  const id = 1;
  const sender = 'SP...';
  const recipient = 'SP...';
 
  const handleOpenContractCall = async () => {
    await openContractCall({
      // You can use the 'object params' syntax:
      ...nftContract.transfer({
        id,
        sender,
        recipient,
      }),
      // or the vanilla 'arguments' syntax:
      // ...nftContract.transfer(1, sender, recipient),
      onFinish: async data => {
        console.log('Finished!', data);
      },
    });
  };
 
  return <button onClick={() => handleOpenContractCall()}>Transfer</button>;
};