Skip to content

Commit

Permalink
docs: updates react native docs to use createModularAccountV2Client (#…
Browse files Browse the repository at this point in the history
…1360)

* docs: updates react native docs to use createModularAccountV2Client

* fix: fixes dead link
  • Loading branch information
linnall authored Feb 25, 2025
1 parent 024d735 commit 7df49c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import Snippet from "../../../shared/infra/drop-and-replace-description.mdx";
import React, { useState, useEffect } from "react";
import { Alert, View, Button } from "react-native";
import {
createLightAccountClient,
LightAccount,
createModularAccountV2Client,
ModularAccountV2,
} from "@account-kit/smart-contracts";
import { sepolia, alchemy } from "@account-kit/infra";
import { User } from "@account-kit/signer";
Expand All @@ -37,7 +37,7 @@ export default function MyComponent() {
useEffect(() => {
if (user) {
// Create a smart account client for the authenticated user
createLightAccountClient({
createModularAccountV2Client({
signer,
chain: sepolia,
transport: alchemy({ apiKey: "API_KEY" }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ description: Learn how to send user operations using Account Kit in a React Nati

Once your users have been [authenticated](/react-native/signer/authenticating-users/authenticating-with-otp), you can start sending user operations! Account Kit makes it really easy to send user operations using React hooks.

To send user operations, you need to first create a `SmartAccountClient` using the [`createLightAccountClient`](/reference/account-kit/smart-contracts/functions/createLightAccountClient) function.
To send user operations, you need to first create a `SmartAccountClient` using the [`createModularAccountV2Client`](/reference/account-kit/smart-contracts/functions/createModularAccountV2Client) function.
Once you have a `SmartAccountClient`, you can use the [`sendUserOperation`](/reference/aa-sdk/core/functions/sendUserOperation#senduseroperation) function to send user operations.

If you want to sponsor the gas for a user, see our [guide](/react-native/using-smart-accounts/sponsor-gas).

## Single user operation

:::tip
In the below example, we use `LightAccount` as the underlying Smart Contract type. You can also use `MultiOwnerModularAccount` if you want to provide your users with an ERC-6900 compliant modular account,
or you can use `MultiOwnerLightAccount` if you want to support an account with multiple owners.
In the below example, we use `ModularAccountV2` as the underlying Smart Contract type. You can also use a different account type (see other options [here](/smart-contracts/other-accounts/modular-account)).
:::

:::code-group
Expand All @@ -26,8 +25,8 @@ import React, { useState, useEffect } from "react";
import { Alert, View, Button } from "react-native";
import { User } from "@account-kit/signer";
import {
createLightAccountClient,
LightAccount,
createModularAccountV2Client,
ModularAccountV2,
} from "@account-kit/smart-contracts";
import { sepolia, alchemy } from "@account-kit/infra";
import { SmartAccountClient } from "@aa-sdk/core";
Expand All @@ -48,7 +47,7 @@ export default function MyOpSenderComponent() {
useEffect(() => {
if (user) {
// Create a light account client for the authenticated user
createLightAccountClient({
createModularAccountV2Client({
signer,
chain: sepolia,
transport: alchemy({ apiKey: "YOUR_API_KEY" }),
Expand Down Expand Up @@ -109,8 +108,8 @@ import React, { useState, useEffect } from "react";
import { Alert, View, Button } from "react-native";
import { User } from "@account-kit/signer";
import {
createLightAccountClient,
LightAccount,
createModularAccountV2Client,
ModularAccountV2,
} from "@account-kit/smart-contracts";
import { sepolia, alchemy } from "@account-kit/infra";
import { SmartAccountClient } from "@aa-sdk/core";
Expand All @@ -131,7 +130,7 @@ export default function MyOpSenderComponent() {
useEffect(() => {
if (user) {
// Create a light account client for the authenticated user
createLightAccountClient({
createModularAccountV2Client({
signer,
chain: sepolia,
transport: alchemy({ apiKey: "YOUR_API_KEY" }),
Expand Down
6 changes: 3 additions & 3 deletions site/pages/react-native/using-smart-accounts/sponsor-gas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Now you can send a sponsored User Operation with the Policy ID.
import React, { useState, useEffect } from "react";
import { View, Button } from "react-native";
import {
createLightAccountClient,
LightAccount,
createModularAccountV2Client,
ModularAccountV2,
} from "@account-kit/smart-contracts";
import { sepolia, alchemy } from "@account-kit/infra";
import { User } from "@account-kit/signer";
Expand All @@ -49,7 +49,7 @@ export default function MyComponent() {
useEffect(() => {
if (user) {
// Create a smart account client for the authenticated user with the policy ID
createLightAccountClient({
createModularAccountV2Client({
signer,
chain: sepolia,
policyId: "YOUR_GAS_POLICY_ID", // [!code ++]
Expand Down

0 comments on commit 7df49c8

Please sign in to comment.