From 11f5bb7536da7f34f236e031a6e4227cfe7041ac Mon Sep 17 00:00:00 2001 From: 0x4tl4nt Date: Wed, 25 Mar 2026 15:26:44 +0100 Subject: [PATCH] Improve agw-client README examples and paymaster usage Description Updated examples in packages/agw-client/README.md to improve correctness, consistency, and usability. Removed unused and potentially incorrect ChainEIP712 import from viem Aligned type usage with the rest of the package (viem/zksync) Replaced placeholder paymasterInput: '0x' with a working example using getGeneralPaymasterInput Clarified paymaster usage in sendTransaction (fields instead of a single object) Improved example readability and structure (headings, links, formatting) These changes make the examples consistent with the actual implementation and ensure they can be copied and used with minimal adjustments. --- packages/agw-client/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/agw-client/README.md b/packages/agw-client/README.md index 39f682c..6dfe152 100644 --- a/packages/agw-client/README.md +++ b/packages/agw-client/README.md @@ -27,7 +27,7 @@ import { createAbstractClient } from '@abstract-foundation/agw-client' ```tsx import { createAbstractClient } from '@abstract-foundation/agw-client'; -import { ChainEIP712, http } from 'viem'; +import { http } from 'viem'; import { Account } from 'viem/accounts'; import { abstractTestnet } from 'viem/chains'; @@ -100,8 +100,9 @@ import { createAbstractClient } from '@abstract-foundation/agw-client'; ```tsx import { createAbstractClient } from '@abstract-foundation/agw-client'; -import { ChainEIP712, http } from 'viem'; +import { http } from 'viem'; import { Account } from 'viem/accounts'; +import { getGeneralPaymasterInput } from 'viem/zksync'; (async () => { // Create a signer account and chain configuration @@ -123,7 +124,7 @@ import { Account } from 'viem/accounts'; to: '0xRecipientAddress', value: 1000000000000000000n, // 1 ETH in wei paymaster: '0xPaymasterAddress', - paymasterInput: '0x', + paymasterInput: getGeneralPaymasterInput({ innerInput: '0x' }), }); console.log('Sponsored Transaction Hash:', txHash); @@ -136,7 +137,7 @@ import { Account } from 'viem/accounts'; ### Explanation of Paymaster Usage: -- **Paymaster**: The `paymaster` object is specified in the `sendTransaction` method, allowing the Paymaster contract to cover the gas fees for the transaction. +- **Paymaster**: The `paymaster` and `paymasterInput` fields are specified in the `sendTransaction` parameters, allowing the Paymaster contract to cover the gas fees for the transaction. - **Sponsored Transaction**: The transaction fee is covered by the Paymaster, so the user’s balance is unaffected by gas costs. ## Documentation