Commit fc3957e 1 parent 20d27b5 commit fc3957e Copy full SHA for fc3957e
File tree 1 file changed +23
-0
lines changed
src/sdk/clients/decorators/smartAccount
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,29 @@ import type { SmartAccount } from "viem/account-abstraction"
15
15
import { getAction } from "viem/utils"
16
16
import { sendTransaction } from "./sendTransaction"
17
17
18
+ /**
19
+ * Executes a write operation on a smart contract using a smart account.
20
+ *
21
+ * @param client - The client instance.
22
+ * @param parameters - Parameters for the contract write operation.
23
+ * @returns The transaction hash as a hexadecimal string.
24
+ * @throws {Error } If the 'to' address is missing in the request.
25
+ *
26
+ * @example
27
+ * import { writeContract } from '@biconomy/sdk'
28
+ * import { encodeFunctionData } from 'viem'
29
+ *
30
+ * const encodedCall = encodeFunctionData({
31
+ * abi: CounterAbi,
32
+ * functionName: "incrementNumber"
33
+ * })
34
+ * const call = {
35
+ * to: '0x61f70428b61864B38D9B45b7B032c700B960acCD',
36
+ * data: encodedCall
37
+ * }
38
+ * const hash = await writeContract(nexusClient, call)
39
+ * console.log(hash) // '0x...'
40
+ */
18
41
export async function writeContract <
19
42
TChain extends Chain | undefined ,
20
43
TAccount extends SmartAccount | undefined ,
You can’t perform that action at this time.
0 commit comments