request
EIP-1193 compliant request method using the connected account. Executes various Ethereum-related JSON-RPC methods based on the provided 'method' (the Ethereum JSON-RPC method to be executed) and 'params' (optional array of parameters for the rpc method).
Usage
ts
import { smartAccountClient } from "./smartAccountClient";
const result = await smartAccountClient.request({
method: "eth_sendTransaction",
params: [tx],
});
const result = await smartAccountClient.request({
method: "eth_sign",
params: [address, data],
});
const result = await smartAccountClient.request({
method: "eth_signTypedData_v4",
params: [address, dataParams],
});
ts
import { createMultiOwnerModularAccount } from "@alchemy/aa-accounts";
import {
LocalAccountSigner,
SmartAccountSigner,
createSmartAccountClient,
polygonMumbai,
} from "@alchemy/aa-core";
import { http } from "viem";
const chain = polygonMumbai;
const signer: SmartAccountSigner = LocalAccountSigner.mnemonicToAccountSigner(
"YOUR_OWNER_MNEMONIC"
);
const rpcTransport = http("https://polygon-mumbai.g.alchemy.com/v2/demo");
export const smartAccountClient = createSmartAccountClient({
transport: rpcTransport,
chain,
account: await createMultiOwnerModularAccount({
transport: rpcTransport,
chain,
signer,
}),
});
Returns
Promise<any>
A Promise
that resolves to the result of the JSON-RPC call
Parameters
args: { method: string; params?: any[] }
object containing the method and optional params to execute. method
- The Ethereum JSON-RPC method to be executed params
- Optional array of parameters specific to the chosen method