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
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.
68
68
69
+
This is what the user will see when they connect their Base Account and automatic Sub Accounts are enabled:
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.
71
77
</Tip>
@@ -235,7 +241,7 @@ We recommend using `wallet_sendCalls` in conjunction with a paymaster to ensure
235
241
236
242
### Import an existing account
237
243
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:
239
245
240
246
```tsx
241
247
const subAccount =awaitprovider.request({
@@ -260,6 +266,8 @@ Before the Sub Account is imported, you will need to add the Base Account addres
260
266
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.
261
267
262
268
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).
263
271
</Note>
264
272
265
273
@@ -279,6 +287,12 @@ console.log('Owner added to Sub Account');
279
287
280
288
This generates a transaction to call the `addOwnerAddress` or `addOwnerPublicKey` functions on the Sub Account's smart contract to add the owner.
281
289
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
+
282
296
## Auto Spend Permissions
283
297
284
298
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.
0 commit comments