Skip to content

Commit

Permalink
fix: return txHash from sendTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
akanoce committed Jan 21, 2024
1 parent 1e4309a commit 41cf1c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions apps/web/src/hooks/useAccountAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useAccountAdapter = () => {
txs
}: {
txs: EthereumTransactionTypeExtended[];
}) => {
}): Promise<`0x${string}`> => {
if (smartAccountWallet && address)
throw new Error('Cannot have EOA and SCA both connected');

Expand All @@ -59,11 +59,13 @@ export const useAccountAdapter = () => {
});

console.log('sendTxResult', sendTxResult);
//TODO: we don't need this as the receipt is already awaited in the function above
return sendTxResult[0];
} else {
if (isSponsoredTx) {
await sendSponsoredERC20AaveBatchTransactions({ txs });
return await sendSponsoredERC20AaveBatchTransactions({ txs });
} else {
await sendAaveBatchTransactions({ txs });
return await sendAaveBatchTransactions({ txs });
}
}
};
Expand Down
5 changes: 4 additions & 1 deletion packages/lfgho-sdk/src/hooks/useTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ export const useTransactions = () => {
});
const txHash = receipt.receipt.transactionHash;
console.log(`Transaction hash: ${txHash}`);
return txHash;
};

const sendAaveBatchTransactions = async ({
Expand Down Expand Up @@ -490,6 +491,7 @@ export const useTransactions = () => {
});
const txHash = receipt.receipt.transactionHash;
console.log(`Transaction hash: ${txHash}`);
return txHash;
};

const sendSponsoredERC20AaveBatchTransactions = async ({
Expand Down Expand Up @@ -524,7 +526,7 @@ export const useTransactions = () => {
initCode: '0x',
callData,
bundlerClient: pimlicoBundler,
publicClient: viemPublicClient,
publicClient: viemPublicClient
})) as UserOperation;

console.log('Built userOperation:', userOperation);
Expand Down Expand Up @@ -569,6 +571,7 @@ export const useTransactions = () => {
});
const txHash = receipt.receipt.transactionHash;
console.log(`Transaction hash: ${txHash}`);
return txHash;
};

return {
Expand Down

0 comments on commit 41cf1c6

Please sign in to comment.