A Modern Account Abstraction SDK for building and interacting with smart wallets.
Note
This library is currently in Developer Preview. It may include breaking changes in non-major versions.
- Node.js >= 23
- pnpm >= 10.8.1
- Gelato API Key for sponsored transactions via 1Balance (Get your key here
- @gelatonetwork/smartwallet: All you need to build with Gelato SmartWallets APIs and Contracts.
- @gelatonetwork/smartwallet-react-sdk: A unified React SDK for Gelato SmartWallet APIs and Contracts that supports multiple WaaS providers: Dynamic and Privy.
- @gelatonetwork/smartwallet-react-wagmi: Use Gelato SmartWallet APIs and Contracts with WAGMI applications, without any complexity.
import {
createGelatoSmartWalletClient,
sponsored
} from "@gelatonetwork/smartwallet";
import { http, createWalletClient } from "viem";
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
import { baseSepolia } from "viem/chains";
const privateKey = generatePrivateKey();
const account = privateKeyToAccount(privateKey);
const client = createWalletClient({
account,
chain: baseSepolia,
transport: http()
});
const swc = await createGelatoSmartWalletClient(client, { apiKey });
const response = await swc.execute({
payment: sponsored(),
calls: [
{
to: "0xEEeBe2F778AA186e88dCf2FEb8f8231565769C27",
data: "0xd09de08a",
value: 0n
}
]
});
response.on("submitted", (status) => {
console.log(`Transaction submitted: ${status.transactionHash}`);
});
response.on("success", async (status) => {
console.log(`Transaction successful: ${status.transactionHash}`);
});
response.on("error", (error) => {
console.error(`Transaction failed: ${error.message}`);
});
- Install package
pnpm i @gelatonetwork/smartwallet
- Clone the repository:
git clone --recurse-submodules https://github.com/gelatodigital/smartwallet.git
cd smartwallet
- Install dependencies:
pnpm install
- Build the project:
pnpm build
The project includes several examples in the examples
directory. To run an example:
- Navigate to the example directory:
cd examples/erc20 # or any other example directory
- Install dependencies:
pnpm install
- Run the example:
pnpm dev
src/
- Gelato SmartWallet SDKplugins/
- Plugins built on top of Gelato SmartWallet SDKexamples/
- Example implementations
- Format code:
pnpm format
- Lint code:
pnpm lint
- Run tests:
pnpm test
- Create a changeset for your changes:
pnpm changeset
- Build and test your changes:
pnpm build
pnpm test
- Submit a pull request
This project is licensed under the terms of the MIT license.