@@ -99,6 +99,26 @@ export {
9999
100100export type { DelegatedCall } from './erc7710RedeemDelegationAction' ;
101101
102+ /**
103+ * Extends a viem client with ERC-7715 provider actions.
104+ *
105+ * @returns A function that decorates a client with ERC-7715 provider actions.
106+ *
107+ * @example
108+ * ```typescript
109+ * const providerClient = createClient({
110+ * chain: sepolia,
111+ * transport: custom(window.ethereum),
112+ * }).extend(erc7715ProviderActions());
113+ *
114+ * await providerClient.requestExecutionPermissions({
115+ * requests: [permissionRequest],
116+ * });
117+ *
118+ * const supported = await providerClient.getSupportedExecutionPermissions();
119+ * const granted = await providerClient.getGrantedExecutionPermissions();
120+ * ```
121+ */
102122export const erc7715ProviderActions = ( ) => ( client : Client ) => ( {
103123 requestExecutionPermissions : async (
104124 parameters : RequestExecutionPermissionsParameters ,
@@ -121,15 +141,15 @@ export const erc7715ProviderActions = () => (client: Client) => ({
121141} ) ;
122142
123143/**
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 .
144+ * Type for a viem Client extended with ERC-7715 provider actions.
145+ * Use this to type variables for deferred initialization .
126146 *
127147 * @example
128148 * ```typescript
129149 * let client: Erc7715Client | null = null;
130150 *
131151 * function setupClient() {
132- * client = createWalletClient ({
152+ * client = createClient ({
133153 * chain: sepolia,
134154 * transport: custom(window.ethereum),
135155 * }).extend(erc7715ProviderActions());
@@ -139,6 +159,58 @@ export const erc7715ProviderActions = () => (client: Client) => ({
139159export type Erc7715Client = Client &
140160 ReturnType < ReturnType < typeof erc7715ProviderActions > > ;
141161
162+ /**
163+ * Type for a viem WalletClient extended with ERC-7710 wallet actions.
164+ * Use this to type variables for deferred initialization.
165+ *
166+ * @example
167+ * ```typescript
168+ * let walletClient: Erc7710WalletClient | null = null;
169+ *
170+ * function setupClient() {
171+ * walletClient = createWalletClient({
172+ * account,
173+ * chain: sepolia,
174+ * transport: custom(window.ethereum),
175+ * }).extend(erc7710WalletActions());
176+ * }
177+ * ```
178+ */
179+ export type Erc7710WalletClient = WalletClient &
180+ ReturnType < ReturnType < typeof erc7710WalletActions > > ;
181+
182+ /**
183+ * Extends a viem wallet client with ERC-7710 wallet actions.
184+ *
185+ * @returns A function that decorates a wallet client with ERC-7710 wallet actions.
186+ *
187+ * @example
188+ * ```typescript
189+ * const walletClient = createWalletClient({
190+ * account,
191+ * chain: sepolia,
192+ * transport: custom(window.ethereum),
193+ * }).extend(erc7710WalletActions());
194+ *
195+ * await walletClient.sendTransactionWithDelegation({
196+ * account,
197+ * chain: sepolia,
198+ * to: recipient,
199+ * value: 0n,
200+ * data: callData,
201+ * permissionContext,
202+ * delegationManager: environment.DelegationManager,
203+ * });
204+ *
205+ * await walletClient.redelegatePermissionContext({
206+ * environment,
207+ * permissionContext,
208+ * to: anotherDelegate,
209+ * // optional when client.chain is configured
210+ * chainId: sepolia.id,
211+ * });
212+ * ```
213+ */
142214export const erc7710WalletActions = ( ) => ( client : WalletClient ) => ( {
143215 sendTransactionWithDelegation : async (
144216 args : SendTransactionWithDelegationParameters ,
@@ -151,6 +223,33 @@ export const erc7710WalletActions = () => (client: WalletClient) => ({
151223 ) => redelegatePermissionContextOpenAction ( client , parameters ) ,
152224} ) ;
153225
226+ /**
227+ * Extends a viem bundler client with ERC-7710 bundler actions.
228+ *
229+ * @returns A function that decorates a bundler client with ERC-7710 bundler actions.
230+ *
231+ * @example
232+ * ```typescript
233+ * const bundlerClient = createBundlerClient({
234+ * account: smartAccount,
235+ * chain: sepolia,
236+ * transport: http(bundlerUrl),
237+ * }).extend(erc7710BundlerActions());
238+ *
239+ * const userOpHash = await bundlerClient.sendUserOperationWithDelegation({
240+ * publicClient,
241+ * calls: [
242+ * {
243+ * to: recipient,
244+ * data: callData,
245+ * value: 0n,
246+ * permissionContext,
247+ * delegationManager: environment.DelegationManager,
248+ * },
249+ * ],
250+ * });
251+ * ```
252+ */
154253export const erc7710BundlerActions = ( ) => ( client : Client ) => ( {
155254 sendUserOperationWithDelegation : async (
156255 args : SendUserOperationWithDelegationParameters ,
0 commit comments