@@ -99,6 +99,24 @@ export {
9999
100100export type { DelegatedCall } from './erc7710RedeemDelegationAction' ;
101101
102+ /**
103+ * Extends a viem client with ERC-7715 provider actions.
104+ *
105+ * @example
106+ * ```typescript
107+ * const providerClient = createClient({
108+ * chain: sepolia,
109+ * transport: custom(window.ethereum),
110+ * }).extend(erc7715ProviderActions());
111+ *
112+ * await providerClient.requestExecutionPermissions({
113+ * requests: [permissionRequest],
114+ * });
115+ *
116+ * const supported = await providerClient.getSupportedExecutionPermissions();
117+ * const granted = await providerClient.getGrantedExecutionPermissions();
118+ * ```
119+ */
102120export const erc7715ProviderActions = ( ) => ( client : Client ) => ( {
103121 requestExecutionPermissions : async (
104122 parameters : RequestExecutionPermissionsParameters ,
@@ -121,15 +139,15 @@ export const erc7715ProviderActions = () => (client: Client) => ({
121139} ) ;
122140
123141/**
124- * Type for a viem Client extended with ERC-7710 provider actions.
125- * Use this to type variables that will be assigned an extended client later .
142+ * Type for a viem Client extended with ERC-7715 provider actions.
143+ * Use this to type variables for deferred initialization .
126144 *
127145 * @example
128146 * ```typescript
129147 * let client: Erc7715Client | null = null;
130148 *
131149 * function setupClient() {
132- * client = createWalletClient ({
150+ * client = createClient ({
133151 * chain: sepolia,
134152 * transport: custom(window.ethereum),
135153 * }).extend(erc7715ProviderActions());
@@ -139,6 +157,56 @@ export const erc7715ProviderActions = () => (client: Client) => ({
139157export type Erc7715Client = Client &
140158 ReturnType < ReturnType < typeof erc7715ProviderActions > > ;
141159
160+ /**
161+ * Type for a viem WalletClient extended with ERC-7710 wallet actions.
162+ * Use this to type variables for deferred initialization.
163+ *
164+ * @example
165+ * ```typescript
166+ * let walletClient: Erc7710WalletClient | null = null;
167+ *
168+ * function setupClient() {
169+ * walletClient = createWalletClient({
170+ * account,
171+ * chain: sepolia,
172+ * transport: custom(window.ethereum),
173+ * }).extend(erc7710WalletActions());
174+ * }
175+ * ```
176+ */
177+ export type Erc7710WalletClient = WalletClient &
178+ ReturnType < ReturnType < typeof erc7710WalletActions > > ;
179+
180+ /**
181+ * Extends a viem wallet client with ERC-7710 wallet actions.
182+ *
183+ * @example
184+ * ```typescript
185+ * const walletClient = createWalletClient({
186+ * account,
187+ * chain: sepolia,
188+ * transport: custom(window.ethereum),
189+ * }).extend(erc7710WalletActions());
190+ *
191+ * await walletClient.sendTransactionWithDelegation({
192+ * account,
193+ * chain: sepolia,
194+ * to: recipient,
195+ * value: 0n,
196+ * data: callData,
197+ * permissionContext,
198+ * delegationManager: environment.DelegationManager,
199+ * });
200+ *
201+ * await walletClient.redelegatePermissionContext({
202+ * environment,
203+ * permissionContext,
204+ * to: anotherDelegate,
205+ * // optional when client.chain is configured
206+ * chainId: sepolia.id,
207+ * });
208+ * ```
209+ */
142210export const erc7710WalletActions = ( ) => ( client : WalletClient ) => ( {
143211 sendTransactionWithDelegation : async (
144212 args : SendTransactionWithDelegationParameters ,
@@ -151,6 +219,31 @@ export const erc7710WalletActions = () => (client: WalletClient) => ({
151219 ) => redelegatePermissionContextOpenAction ( client , parameters ) ,
152220} ) ;
153221
222+ /**
223+ * Extends a viem bundler client with ERC-7710 bundler actions.
224+ *
225+ * @example
226+ * ```typescript
227+ * const bundlerClient = createBundlerClient({
228+ * account: smartAccount,
229+ * chain: sepolia,
230+ * transport: http(bundlerUrl),
231+ * }).extend(erc7710BundlerActions());
232+ *
233+ * const userOpHash = await bundlerClient.sendUserOperationWithDelegation({
234+ * publicClient,
235+ * calls: [
236+ * {
237+ * to: recipient,
238+ * data: callData,
239+ * value: 0n,
240+ * permissionContext,
241+ * delegationManager: environment.DelegationManager,
242+ * },
243+ * ],
244+ * });
245+ * ```
246+ */
154247export const erc7710BundlerActions = ( ) => ( client : Client ) => ( {
155248 sendUserOperationWithDelegation : async (
156249 args : SendUserOperationWithDelegationParameters ,
0 commit comments