Viem Integration
Integrate Para with Viem’s lightweight interface for seamless Ethereum interactions using either v1 or v2.
Viem is a TypeScript interface for Ethereum. This guide shows how to integrate Para’s secure signing with both v2 (recommended) and v1 versions.
Prerequisites
To use Para, you need an API key. This key authenticates your requests to Para services and is essential for integration. Before integrating Para with your application, ensure you have:
- Completed Para authentication setup in your application (see one of our Setup Guides)
- A valid Para API key
- An RPC endpoint for your desired network
Need an API key? Visit the Developer Portal to create API keys, manage billing, teams, and more.
Installation
Choose your package manager to install the Para Viem integration along with Viem:
Basic Setup
If you’re currently using Viem v1, we recommend migrating to v2 for improved features and ongoing support.
Usage Examples
Once you’ve set up the Para Viem integration, you can leverage Viem’s API with Para’s secure signing. Para handles the secure signing process without changing how you construct transactions.
Sending ETH
Interacting with Smart Contracts
Raw Transaction Signing
In some cases, you might want to sign a transaction without sending it immediately:
Para Viem Client Methods
The Para Viem client provides methods that allow you to leverage Para’s secure signing capabilities:
Para handles only the signing process. It does not modify your transaction in any way. All transaction construction, including gas estimations and parameter settings, is your responsibility through the Viem API.
Important Considerations
When working with the Para Viem integration, keep in mind:
-
Authentication requirement: The Para client must have an authenticated account before attempting any signing operations.
-
Wallet availability: Ensure Para has wallets available for the EVM wallet type. If you encounter errors about missing wallets, check your developer portal settings to confirm your API key is configured for EVM wallet types.
-
Transaction construction: Para only signs the raw bytes of the transaction you provide. Any issues related to transaction parameters (gas price, gas limit, etc.) or RPC interactions are not related to Para’s signing functionality.
-
Viem version compatibility: Ensure you’re using the correct Para integration package that matches your Viem version (v1 or v2).
Server-Side Signing
Para’s signers can also be used on the server-side using pregen wallets or an active client side session. To learn more about using para on the server, check out these guides:
Examples
If you’d like to learn more about how to use the Para Viem WalletClient for different transaction types, check out this example in our Examples Hub:
Troubleshooting
Next Steps
Now that you’ve completed integrating Para with Viem, explore more advanced features and use cases.