Created
January 13, 2024 17:35
-
-
Save Rahat-ch/e62dcf53cab1c5502f678c16ef43079e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const handleDeposit = async (e: React.FormEvent<HTMLFormElement>) => { | |
| e.preventDefault(); | |
| if (smartAccount === null) return | |
| const approvalTrx = tokenContract.populateTransaction.approve( | |
| allowanceContract.address, | |
| 10 | |
| ); | |
| const depositTrx = allowanceContract.populateTransaction.deposit(10); | |
| const userOp = await smartAccount.buildUserOp([approvalTrx, depositTrx]); | |
| try { | |
| const userOpResponse = await smartAccount.sendUserOp(userOp); | |
| console.log("userOpHash", userOpResponse); | |
| const { receipt } = await userOpResponse.wait(); | |
| console.log("txHash", receipt.transactionHash); | |
| } catch (error) { | |
| console.error(error); | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment