Use this file to discover all available pages before exploring further.
The Viem library has first-class support for Abstract by providing a set of
extensions to interact with paymasters,
smart contract wallets, and more.
This page will walk through how to configure Viem to utilize Abstract’s features.
Prerequisites
Ensure you have the following installed on your machine:
Viem has native support for Abstract paymasters.Provide the paymaster and paymasterInput fields when sending a transaction.View Viem documentation.
const hash = await walletClient.sendTransaction({ to: "0x8e729E23CDc8bC21c37a73DA4bA9ebdddA3C8B6d", paymaster: "0x5407B5040dec3D339A9247f3654E59EEccbb6391", // Your paymaster contract address paymasterInput: "0x", // Any additional data to be sent to the paymaster});
Viem also has native support for using smart contract wallets.
This means you can submit transactions from a smart contract wallet by providing
a smart wallet account as the account field to the client.View Viem documentation.
import { toSmartAccount, eip712WalletActions } from "viem/zksync";import { createWalletClient, http } from "viem";import { abstractTestnet } from "viem/chains";const account = toSmartAccount({ address: CONTRACT_ADDRESS, async sign({ hash }) { // ... signing logic here for your smart contract account },});// Create a client from a smart contract walletconst walletClient = createWalletClient({ chain: abstractTestnet, transport: http(), account: account, // <-- Provide the smart contract wallet account}).extend(eip712WalletActions());// ... Continue using the wallet client as usual (will send transactions from the smart contract wallet)