Skip to content

Commit 5e9282b

Browse files
committed
fix: pr comments
1 parent 187846a commit 5e9282b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'Use Sub Accounts'
3-
description: 'Learn how to create and manage Sub Accounts using Base Account SDK'
3+
description: 'Learn how to create and use Sub Accounts using Base Account SDK'
44
---
55

66
import { GithubRepoCard } from "/snippets/GithubRepoCard.mdx"
@@ -66,6 +66,12 @@ const sdk = createBaseAccountSDK({
6666

6767
This will automatically create a Sub Account for the user when they connect their Base Account and transactions will automatically be sent from the Sub Account unless you specify the `from` parameter in your transaction request to be the universal account address. Spend Permissions will also be automatically requested for the Sub Account as your app needs them.
6868

69+
This is what the user will see when they connect their Base Account and automatic Sub Accounts are enabled:
70+
71+
<div style={{ display: 'flex', justifyContent: 'center'}}>
72+
<img src="/images/base-account/SubAccountCreationConnect.png" alt="Sub Account Creation Flow" style={{ width: '300px', height: 'auto' }} />
73+
</div>
74+
6975
<Tip>
7076
We recommend using a [Paymaster](/base-account/improve-ux/sponsor-gas/paymasters) to sponsor gas to ensure the best user experience when integrating Sub Accounts. You can set a paymaster to be used for all transactions by configuring the `paymasterUrls` parameter in the SDK configuration. See the [createBaseAccount](/base-account/reference/core/createBaseAccount#param-paymaster-urls) reference for more information.
7177
</Tip>
@@ -235,7 +241,7 @@ We recommend using `wallet_sendCalls` in conjunction with a paymaster to ensure
235241

236242
### Import an existing account
237243

238-
If you already have a deployed Smart Contract Account, you can import it as a Sub Account using the provider RPC method:
244+
If you already have a deployed Smart Contract Account and would like to turn it into a Sub Account of the connected Base Account, you can import it as a Sub Account using the provider RPC method:
239245

240246
```tsx
241247
const subAccount = await provider.request({
@@ -260,6 +266,8 @@ Before the Sub Account is imported, you will need to add the Base Account addres
260266
by calling the [`addOwnerAddress`](https://github.com/coinbase/smart-wallet/blob/a8c6456f3a6d5d2dea08d6336b3be13395cacd42/src/MultiOwnable.sol#L101) or [`addOwnerPublicKey`](https://github.com/coinbase/smart-wallet/blob/a8c6456f3a6d5d2dea08d6336b3be13395cacd42/src/MultiOwnable.sol#L109) functions on the Smart Contract of the Sub Account that was imported and setting the Base Account address as the owner.
261267

262268
Additionally, only Coinbase Smart Wallet contracts are currently supported for importing as a Sub Account into your Base Account.
269+
270+
The Coinbase Smart Wallet contract ABI can be found on [GitHub](https://github.com/base/account-sdk/blob/master/packages/account-sdk/src/sign/base-account/utils/constants.ts#L8).
263271
</Note>
264272

265273

@@ -279,6 +287,12 @@ console.log('Owner added to Sub Account');
279287

280288
This generates a transaction to call the `addOwnerAddress` or `addOwnerPublicKey` functions on the Sub Account's smart contract to add the owner.
281289

290+
<Note>
291+
Ownership changes are expected if the user signs in to your app on a new device or browser.
292+
293+
Ensure you do not lose your app's Sub Account signer keys when using the SDK on the server (e.g. Node.js) as updating the owner requires a signature from the user, which cannot be requested from server contexts.
294+
</Note>
295+
282296
## Auto Spend Permissions
283297

284298
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.
125 KB
Loading

0 commit comments

Comments
 (0)