Viem
Learn how to use the Viem library to build applications on Abstract.
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.
1. Installation
Install the viem
package.
2. Client Configuration
Configure your Viem client using abstractTestnet
as the chain and extend it with
eip712WalletActions.
Learn more on the official viem documentation.
Reading Blockchain Data
Use a public client to fetch data from the blockchain via an RPC.
Sending Transactions
Use a wallet client to send transactions to the blockchain.
Paymasters
Viem has native support for Abstract paymasters.
Provide the paymaster
and paymasterInput
fields when sending a transaction.
Smart Contract Wallets
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.