useTransactor
Use this hook to interact with the chain and give UI feedback on the transaction status.

Any error will instead show a popup with nice error message.

const { writeTransaction, transactionReceiptInstance, sendTransactionInstance } = useTransactor();
const calls = [
{
contractAddress: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
entrypoint: "transfer",
calldata: ["0x123...", "1000000000000000000", "0"],
},
];
await writeTransaction(calls);
This example tries to send a transfer transaction, prompting the connected wallet for a signature. In the case of a successful transaction, it will show a popup in the UI with the message: "๐ Transaction completed successfully!".
You can pass in a list of valid Call โ Type is from starknet.
Refer to this recipe for a more detailed example.
Configurationโ
useTransactorโ
useTransactor() takes no arguments. It internally uses useSendTransaction from @starknet-start/react.
writeTransactionโ
| Parameter | Type | Description |
|---|---|---|
| calls | Call[] | A list of valid Call โ Type is from starknet. |
Return Valuesโ
writeTransactionโ
- The function that is used to initialize the UI feedback flow. Takes a
Call[]array directly.
transactionReceiptInstanceโ
- An instance of useTransactionReceipt for tracking receipt details.
sendTransactionInstanceโ
- An instance of useSendTransaction for tracking transaction status.