From b8c47f32ed383a6362f6f60e496235831437369b Mon Sep 17 00:00:00 2001 From: Joe Pegler Date: Thu, 19 Sep 2024 12:29:01 +0100 Subject: [PATCH] chore: tsdoc - sendTransaction --- .../smartAccount/sendTransaction.ts | 51 +++++-------------- 1 file changed, 12 insertions(+), 39 deletions(-) diff --git a/src/sdk/clients/decorators/smartAccount/sendTransaction.ts b/src/sdk/clients/decorators/smartAccount/sendTransaction.ts index 931e0944..c282896d 100644 --- a/src/sdk/clients/decorators/smartAccount/sendTransaction.ts +++ b/src/sdk/clients/decorators/smartAccount/sendTransaction.ts @@ -15,50 +15,23 @@ import { getAction, parseAccount } from "viem/utils" import { AccountNotFoundError } from "../../../account/utils/AccountNotFound" /** - * Creates, signs, and sends a new transaction to the network. - * This function also allows you to sponsor this transaction if sender is a smartAccount + * Creates, signs, and sends a new transaction to the network using a smart account. + * This function also allows you to sponsor this transaction if the sender is a smart account. * - * - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html - * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions - * - JSON-RPC Methods: - * - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction) - * - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction) - * - * @param client - Client to use - * @param parameters - {@link SendTransactionParameters} - * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. + * @param client - The client instance. + * @param args - Parameters for sending the transaction or user operation. + * @returns The transaction hash as a hexadecimal string. + * @throws {AccountNotFoundError} If the account is not found. * * @example - * import { createWalletClient, custom } from 'viem' - * import { mainnet } from 'viem/chains' - * import { sendTransaction } from 'viem/wallet' - * - * const client = createWalletClient({ - * chain: mainnet, - * transport: custom(window.ethereum), - * }) - * const hash = await sendTransaction(client, { - * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', - * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', - * value: 1000000000000000000n, - * }) + * import { sendTransaction } from '@biconomy/sdk' * - * @example - * // Account Hoisting - * import { createWalletClient, http } from 'viem' - * import { privateKeyToAccount } from 'viem/accounts' - * import { mainnet } from 'viem/chains' - * import { sendTransaction } from 'viem/wallet' - * - * const client = createWalletClient({ - * account: privateKeyToAccount('0x…'), - * chain: mainnet, - * transport: http(), - * }) - * const hash = await sendTransaction(client, { - * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', - * value: 1000000000000000000n, + * const hash = await sendTransaction(nexusClient, { + * to: '0x...', + * value: parseEther('0.1'), + * data: '0x...' * }) + * console.log(hash) // '0x...' */ export async function sendTransaction< account extends SmartAccount | undefined,