You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/base-account/improve-ux/spend-permissions.mdx
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,10 @@ Read more about the Spend Permission Manager contract and supported chains on [G
15
15
Spend Permissions for Base App Mini Apps are coming soon and will be supported in a future update.
16
16
</Callout>
17
17
18
+
<Note>
19
+
If you're using Sub Accounts, learn how Base Account can automatically fund Sub Accounts and optionally skip approval prompts using [Auto Spend Permissions](/base-account/improve-ux/sub-accounts#auto-spend-permissions).
Auto Spend Permissions allows Sub Accounts to access funds from their parent Base Account when transaction balances are insufficient. This feature can also establish ongoing spend permissions, enabling future transactions to execute without user approval prompts, reducing friction in your app's transaction flow.
266
+
267
+
### Configuration
268
+
269
+
Auto Spend Permissions is only available in SDK version `2.0.2-canary.20250822164845` or later. This feature is **enabled by default** when using Sub Accounts.
270
+
271
+
To disable Auto Spend Permissions when using Sub Accounts, set `unstable_enableAutoSpendPermissions` to `false` in your SDK configuration:
272
+
273
+
```tsx
274
+
const sdk =createBaseAccountSDK({
275
+
appName: 'Base Account SDK Demo',
276
+
appLogoUrl: 'https://base.org/logo.png',
277
+
appChainIds: [base.id],
278
+
subAccounts: {
279
+
unstable_enableAutoSpendPermissions: false, // Disable auto spend permissions
280
+
}
281
+
});
282
+
```
283
+
284
+
### How it works
285
+
286
+
**First-time transaction flow:**
287
+
When a Sub Account attempts its first transaction, Base Account displays a popup for user approval. During this approval process, Base Account:
288
+
289
+
- Automatically detects any missing tokens (native or ERC-20) needed for the transaction
290
+
- Requests a transfer of the required funds from the parent Base Account to the Sub Account to fulfill the current transaction
291
+
- Allows the user to optionally grant ongoing spend permissions for future transactions in that token
292
+
293
+
**Subsequent transactions:**
294
+
If the user granted spend permissions, future transactions follow this priority:
295
+
296
+
1. First, attempt using existing Sub Account balances and granted spend permissions
297
+
2. If insufficient, prompt the user to authorize additional transfers and/or spend permissions from their Base Account
298
+
299
+
<Warning>
300
+
Spend permission requests are limited to the first token when multiple transfers are needed for a single transaction. Additional tokens require separate approvals.
301
+
</Warning>
302
+
303
+
304
+
305
+
263
306
## Complete Integration Example
264
307
265
308
Here's a full React component that demonstrates Sub Account creation and usage:
When <code>true</code> (default), enables Auto Spend Permissions for sub-accounts. This allows automatic transfers from the user's Base Account to the sub-account when funds are missing and attempts background transactions using existing spend permissions. Set to <code>false</code> to disable this behavior. Learn more in [Auto Spend Permissions](/base-account/improve-ux/sub-accounts#auto-spend-permissions).
0 commit comments