Experience the power of Gelato Smart Wallet with different account types and transaction methods. Create accounts, view balances, and execute gasless transactions with ease.
Create Gelato, Kernel, or Safe smart accounts
Execute gasless transactions with Gelato paymaster
Execute transactions with ERC20 tokens
Estimate gas for transactions
npm install @gelatonetwork/smartwallet-react-sdk
import { createGelatoSmartWalletClient } from "@gelatonetwork/smartwallet";
import { http, type Hex, createWalletClient, createPublicClient } from "viem";
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
import { gelato } from "@gelatonetwork/smartwallet/accounts";
import { baseSepolia } from "viem/chains";
const privateKey = (process.env.PRIVATE_KEY ?? generatePrivateKey()) as Hex;
const owner = privateKeyToAccount(privateKey);
const publicClient = createPublicClient({
chain: baseSepolia,
transport: http(),
});
const account = await gelato({
owner,
client: publicClient,
});
const client = createWalletClient({
account,
chain: baseSepolia,
transport: http(),
});
const smartWalletClient = await createGelatoSmartWalletClient(client);
import { type GelatoSmartWalletClient, sponsored } from "@gelatonetwork/smartwallet";
export async function sponsoredTxn(
smartWalletClient: GelatoSmartWalletClient
) {
console.log("Executing transaction...");
const response = await smartWalletClient.execute({
payment: sponsored(sponsorApiKey),
calls: [
{
to: zeroAddress,
data: "0x",
value: BigInt(0),
},
],
});
console.log(`Your Gelato id is: ${response.id}`);
console.log(
`Check the status of your request here: https://api.gelato.digital/tasks/status/${response.id}`
);
const txHash = await response.wait();
return { userOpHash: response.id, txHash };
}
You need to create a smart account before executing sponsored transactions.
import { type GelatoSmartWalletClient, erc20 } from "@gelatonetwork/smartwallet";
export async function erc20GasTxn(
smartWalletClient: GelatoSmartWalletClient,
tokenAddress: `0x${string}`
) {
console.log("Executing transaction...");
const response = await smartWalletClient.execute({
payment: erc20(tokenAddress),
calls: [
{
to: zeroAddress,
data: "0x",
value: BigInt(0),
},
],
});
console.log(`Your Gelato id is: ${response.id}`);
console.log(
`Check the status of your request here: https://api.gelato.digital/tasks/status/${response.id}`
);
const txHash = await response.wait();
return { userOpHash: response.id, txHash };
}
You need to create a smart account before executing ERC20 transactions.
Selected: USD Coin (0x036CbD53842c5426634e7929541eC2318f3dCF7e)
import { type GelatoSmartWalletClient, native } from "@gelatonetwork/smartwallet";
export async function nativeGasTxn(
smartWalletClient: GelatoSmartWalletClient
) {
console.log("Executing transaction...");
const response = await smartWalletClient.execute({
payment: native(),
calls: [
{
to: zeroAddress,
data: "0x",
value: BigInt(0),
},
],
});
console.log(`Your Gelato id is: ${response.id}`);
console.log(
`Check the status of your request here: https://api.gelato.digital/tasks/status/${response.id}`
);
const txHash = await response.wait();
return { userOpHash: response.id, txHash };
}
You need to create a smart account before executing native transactions.
import { type GelatoSmartWalletClient, native, sponsored, erc20 } from "@gelatonetwork/smartwallet";
import { type Call } from "viem";
export async function estimateGas(
smartWalletClient: GelatoSmartWalletClient,
method: string,
tokenAddress?: `0x${string}`,
calls?: Call[]
) {
const gasResults = await smartWalletClient.estimate({
payment: method === "native" ? native() : method === "erc20" ? erc20(tokenAddress) : sponsored(sponsorApiKey),
calls: calls ?? [],
});
return gasResults;
}
You need to create a smart account before estimating gas.
© 2025 Gelato Network. Smart wallet demo for educational purposes.