Skip to content

Commit fc3957e

Browse files
committed
chore: tsdoc - writeContract
1 parent 20d27b5 commit fc3957e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/sdk/clients/decorators/smartAccount/writeContract.ts

+23
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,29 @@ import type { SmartAccount } from "viem/account-abstraction"
1515
import { getAction } from "viem/utils"
1616
import { sendTransaction } from "./sendTransaction"
1717

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+
*/
1841
export async function writeContract<
1942
TChain extends Chain | undefined,
2043
TAccount extends SmartAccount | undefined,

0 commit comments

Comments
 (0)