import {
GelatoSmartWalletContextProvider,
useGelatoSmartWalletProviderContext,
GelatoSmartWalletConnectButton,
dynamic,
privy,
wagmi,
} from "@gelatonetwork/smartwallet-react-sdk";
import { sponsored, native, erc20 } from "@gelatonetwork/smartwallet";
import { baseSepolia } from "viem/chains";
import { http } from "wagmi";
2. Setting up Smart Wallet Context Provider for different Wallet Providers
To create a Sponsor API Key, visit the Gelato App and navigate to the Relay section. Create a new app, select the required networks, and copy the generated Sponsor API Key.
You can customize the appearance of your connect button here. This button triggers the wallet connectors widget configured for the UI.
const children = (
<div classname="mt-2 text-white">Get Started!</div>
) as React.ReactElement;
export const Login = () => (
<GelatoSmartWalletConnectButton>{children}</GelatoSmartWalletConnectButton>
);
4. Fetching Smart Wallet Client from Smart Wallet Context
Use this client directly to execute transactions with different gas payment methods. Additionally, a logout option is available to disconnect your connected wallet.
You can send transactions using different gas payment methods as shown below.
Additionally, you can add multiple transactions to the calls array to batch them and send them on-chain in a single request.