Skip to content

Commit 78443a1

Browse files
committed
feat: spend permissions docs
1 parent 9862730 commit 78443a1

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

docs/base-account/improve-ux/spend-permissions.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Read more about the Spend Permission Manager contract and supported chains on [G
1515
Spend Permissions for Base App Mini Apps are coming soon and will be supported in a future update.
1616
</Callout>
1717

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).
20+
</Note>
21+
1822
## Usage
1923

2024
### Request a Spend Permission

docs/base-account/improve-ux/sub-accounts.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,23 @@ const ownerAccount = await sdk.subAccount.addOwner({
260260
console.log('Owner added to Sub Account');
261261
```
262262

263+
## Auto Spend Permissions
264+
265+
To help improve your app's transaction success rate, Base Account provides a feature called Auto Spend Permissions to allow the Sub Account to use funds from the user's Base Account to complete transactions and optionally grant a spend permission to skip approvals for future transactions, allowing for a more seamless transaction experience.
266+
267+
### How it works
268+
269+
When you create a Sub Account for a Base Account user, the Sub Account will always trigger a Base Account popup if the app has never been granted a spend permission. This popup will allow the user to review the transaction and confirm whether they would like to proceed. Base Account automatically detects missing native and ERC-20 tokens required to complete the transaction and transfers them to the user's Sub Account from their Base Account in order to complete the transaction.
270+
271+
If the user decides to grant a spend permission for the required tokens, future requests will first be attempted in the background using spend permissions and if the request is unable to be fulfilled using existing balances and spend permissions it will prompt the user to proceed with the transaction using their Base Account.
272+
273+
<Warning>
274+
Currently only a single spend permission can be granted at a time.
275+
</Warning>
276+
277+
278+
279+
263280
## Complete Integration Example
264281

265282
Here's a full React component that demonstrates Sub Account creation and usage:

docs/base-account/reference/core/createBaseAccount.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ Where `OwnerAccount` is a union type of:
7272
- `WebAuthnAccount` (from viem) - A WebAuthn-based account for passkey authentication
7373
</Expandable>
7474
</ParamField>
75+
<ParamField body="unstable_enableAutoSpendPermissions" type="boolean">
76+
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).
77+
</ParamField>
7578
</Expandable>
7679
</ParamField>
7780

0 commit comments

Comments
 (0)