Template & Examples

Smart Wallet SDK Examples

Check out the full example code for implementing the Smart Wallet SDK.
Note: The examples are pre-configured for InkSepolia, but you can easily switch to other supported networks. Check available networks in constants/chainConfig.ts and update the example file accordingly by changing the Network name.

Setup Instructions

1

Clone the Repository

git clone https://github.com/gelatodigital/how-tos-1-smartwallet-sdk-examples.git
cd how-tos-1-smartwallet-sdk-examples
2

Set Up Environment Variables

cp .env.example .env
3

Generate a API Key

Create a API Key using the Gelato App. Paste the key into your .env file. Check out the How-To Guides here.
4

Add Your Private Key (Optional)

You can either include your private key in the .env file, or leave it empty—example files will automatically generate a random private key if none is provided.
PRIVATE_KEY=your_private_key_here
5

Install Dependencies

pnpm install
6

Run Example Use Cases

Sponsored Transactions:
pnpm sponsored
ERC20 Gas Payments: To obtain WETH as the gas token on InkSepolia, run pnpm getWeth—this will wrap 0.1 ETH into 0.1 WETH. Once completed, you can proceed by running the following command as an example.
pnpm erc20
Native Gas Payments:
pnpm native
Estimate Gas:
pnpm estimate
Kernel Smart Account Transactions:
pnpm kernel-sponsored
Safe Smart Account Transactions:
pnpm safe-sponsored
Not using templates? Prefer a step-by-step approach? Up next: How-To Guides for implementing the Smart Wallet SDK use cases step-by-step.

Installation

npm install @gelatonetwork/smartwallet viem

Gelato Smart Wallets SDK

Check out the NPM package for the Gelato Smart Wallets SDK.
Depending on your target use case, choose from the guides below that best match your desired destination or integration flow.