Skip to content

Commit

Permalink
Add type to tx on useTransactor
Browse files Browse the repository at this point in the history
  • Loading branch information
damianmarti committed Nov 23, 2023
1 parent 1df3ed1 commit 108c715
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/nextjs/hooks/scaffold-eth/useTransactor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getParsedError } from "~~/components/scaffold-eth";
import { getBlockExplorerTxLink, notification } from "~~/utils/scaffold-eth";

type TransactionFunc = (
tx: (() => Promise<WriteContractResult>) | SendTransactionParameters,
tx: (() => Promise<WriteContractResult>) | (() => Promise<`0x${string}`>) | SendTransactionParameters,
options?: {
onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void;
blockConfirmations?: number;
Expand Down
8 changes: 4 additions & 4 deletions packages/nextjs/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ const Home: NextPage = () => {
setRolling(true);
setRollDisabled(true);

const makeWriteWithParams = () => diceGameContract?.write.rollTheDice([rlpEncodedValues]);
if (makeWriteWithParams !== undefined) {
// @ts-ignore TODO: fix this
await writeTx(makeWriteWithParams, {
if (diceGameContract !== undefined) {
const makeWrite = () => diceGameContract.write.rollTheDice([rlpEncodedValues]);

await writeTx(makeWrite, {
onBlockConfirmation: txnReceipt => {
console.log("Transaction blockHash", txnReceipt.blockHash);
setRolled(true);
Expand Down

0 comments on commit 108c715

Please sign in to comment.