Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@
"smart-wallet/guides/sub-accounts",
"smart-wallet/guides/sub-accounts/setup",
"smart-wallet/guides/sub-accounts/using-sub-accounts",
"smart-wallet/guides/sub-accounts/sub-accounts-with-privy"
"smart-wallet/guides/sub-accounts/sub-accounts-with-privy",
"smart-wallet/guides/sub-accounts/add-sub-accounts-to-onchainkit-minikit"
]
},
"smart-wallet/guides/spend-permissions"
Expand Down Expand Up @@ -639,7 +640,8 @@
{
"group": "Guides",
"pages": [
"wallet-app/guides/thinking-social"
"wallet-app/guides/thinking-social",
"wallet-app/guides/chat-agents"
]
}
]
Expand Down Expand Up @@ -2011,6 +2013,10 @@
{
"source": "/wallet-app/mini-apps",
"destination": "/wallet-app/introduction/mini-apps"
},
{
"source": "/wallet-app/chat-agents",
"destination": "/wallet-app/guides/chat-agents"
}
],
"integrations": {
Expand Down
28 changes: 16 additions & 12 deletions docs/get-started/base-services-hub.mdx

Large diffs are not rendered by default.

117 changes: 0 additions & 117 deletions docs/index.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions docs/showcase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ mode: "custom"
AI crypto co-pilot with its cutting edge data and execution mechanism.
</Card>
</CardGroup>

<div className="flex flex-col items-center justify-center text-center mt-12 mb-8">
<div className="flex gap-4">
<a
href="https://airtable.com/appuZG4HBdFMDrKPi/shrFLqZKVVUVqUzYy"
className="inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-lg text-white bg-primary hover:bg-primary/90 transition-colors"
>
Get featured
</a>
</div>
</div>
</div>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: "Add Sub Accounts to OnchainKit"
title: "Add Sub Accounts to Onchainkit/Minikit"
---

import {GithubRepoCard} from "/snippets/GithubRepoCard.mdx";
import { GithubRepoCard } from "/snippets/GithubRepoCard.mdx"



This guide will show you how to add Sub Accounts to your existing [OnchainKit](/builderkits/onchainkit/getting-started) or [MiniKit](/builderkits/minikit/quickstart) project.

Expand All @@ -11,18 +13,34 @@ you can read more about it in the [Sub Accounts Intro Page](/identity/smart-wall

Before you start, make sure you have checked the following guides:

- [OnchainKit Quickstart](/onchainkit/getting-started)
- [OnchainKit Custom Providers](/onchainkit/config/supplemental-providers)
- [Sub Accounts Intro Page](/smart-wallet/guides/sub-accounts)
- [OnchainKit Quickstart](/builderkits/onchainkit/getting-started)
- [MiniKit Quickstart](/builderkits/minikit/quickstart)
- [OnchainKit Custom Providers](/builderkits/onchainkit/config/supplemental-providers)
- [Sub Accounts Intro Page](/identity/smart-wallet/guides/sub-accounts)

<Warning>
**Smart Wallet compatibility with Mini Apps**

The Coinbase Wallet team is working on adding Smart Wallet support to Mini Apps.

For now, you can only use Sub Accounts with OnchainKit/MiniKit outside of the social feed.
</Warning>

## Skip ahead

If you want to skip ahead and just get the final code, you can find it here:

<GithubRepoCard title="Sub Account OnchainKit Template Demo" githubUrl="https://github.com/base/demos/tree/master/smart-wallet/sub-accounts-onchainkit" />
<GithubRepoCard title="Sub Account MiniKit Template Demo" githubUrl="https://github.com/base/demos/tree/master/smart-wallet/sub-accounts-minikit" />

<Warning>
**About this codebase**

The codebase uses MiniKit, but the same code can be used for OnchainKit with minimal changes.

The difference is detailed in the [Providers](#setting-up-the-onchainkitminikit-providers-config) section.
</Warning>

## Add Sub Accounts to your OnchainKit project
## Add Sub Accounts to your OnchainKit/MiniKit project

### Override the default Coinbase Wallet SDK version

Expand All @@ -31,7 +49,7 @@ Currently, Sub Accounts are only available in the Smart Wallet development envir
To override the default Coinbase Wallet SDK version, you can run the following command:

```bash
npm pkg set overrides.@coinbase/wallet-sdk=canary
npm @coinbase/wallet-sdk@canary install
```

<Warning>
Expand All @@ -43,7 +61,6 @@ Make sure to delete the `node_modules` folder and `package-lock.json` file befor
rm -rf node_modules package-lock.json
npm install
```

</Warning>

<Check>
Expand All @@ -52,7 +69,6 @@ npm install
This is a temporary solution to get Sub Accounts working.

Once the new version of the Coinbase Wallet SDK is released, you can remove this step.

</Check>

### Setting up the Wagmi config
Expand Down Expand Up @@ -112,7 +128,7 @@ Let's break down the key preference parameters:
- `keysUrl`: Points to the development environment for Smart Wallet testing
- `options: 'smartWalletOnly'`: Ensures only Smart Wallet mode is used
- `enableAutoSubAccounts: true`: When set to true, automatically creates a Sub Account at connection
- `defaultSpendLimits`: Configures Spend Permissions for Sub Account for a network (eg. Base Sepolia `84532`), including:
- `defaultSpendLimits`: Configures Spend Limits for Sub Account for a network (eg. Base Sepolia `84532`), including:

- Token address (In this case, `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` represents the native ETH)
- Allowance WEI amount (in Hex)
Expand All @@ -123,23 +139,62 @@ Let's break down the key preference parameters:

Sub Accounts are currently only available in the Smart Wallet development environment.
To use this environment, you need to set the `keysUrl` to `https://keys-dev.coinbase.com/connect` in your configuration.

</Warning>

### Setting up the OnchainKit/MiniKit providers config

Once the `wagmi.ts` file is updated, you can update your `providers.tsx` file to include the following:

<CodeGroup>
```ts providers.tsx (MiniKit)
"use client";

import { type ReactNode, useState } from "react";
import { baseSepolia } from "wagmi/chains";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { MiniKitProvider } from "@coinbase/onchainkit/minikit";
import { type State, WagmiProvider } from "wagmi";
import { getConfig } from "@/wagmi";

export function Providers(props: {
children: ReactNode;
initialState?: State;
}) {
const [config] = useState(() => getConfig());
const [queryClient] = useState(() => new QueryClient());

return (
<WagmiProvider config={config} initialState={props.initialState}>
<QueryClientProvider client={queryClient}>
<MiniKitProvider
apiKey={process.env.NEXT_PUBLIC_ONCHAINKIT_API_KEY}
chain={baseSepolia}
config={{
appearance: {
mode: "auto",
theme: "mini-app-theme",
name: process.env.NEXT_PUBLIC_ONCHAINKIT_PROJECT_NAME,
logo: process.env.NEXT_PUBLIC_ICON_URL,
},
}}
>
{props.children}
</MiniKitProvider>
</QueryClientProvider>
</WagmiProvider>
);
}
```

```ts providers.tsx (OnchainKit)
"use client";

import { type ReactNode, useState } from "react"
import { baseSepolia } from "wagmi/chains"
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { MiniKitProvider } from "@coinbase/onchainkit/minikit"
import { type State, WagmiProvider } from "wagmi"
import { getConfig } from "@/wagmi"
import { type ReactNode, useState } from "react";
import { baseSepolia } from "wagmi/chains";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { MiniKitProvider } from "@coinbase/onchainkit/minikit";
import { type State, WagmiProvider } from "wagmi";
import { getConfig } from "@/wagmi";

export function Providers(props: {
children: ReactNode;
Expand All @@ -162,19 +217,28 @@ export function Providers(props: {
);
}
```
</CodeGroup>

<Check>
**For OnchainKit**

For OnchainKit, use `OnchainKitProvider` instead of `MiniKitProvider` as it's detailed in the
[OnchainKit Custom Providers page](/builderkits/onchainkit/config/supplemental-providers).
</Check>

## Run your app

After installing the dependencies as described [above](#override-the-default-coinbase-wallet-sdk-version),
make sure your environment variables are up to date as per
the [OnchainKit Quickstart](/builderkits/onchainkit/getting-started)
the [OnchainKit Quickstart](/builderkits/onchainkit/getting-started)or
[MiniKit Quickstart](/builderkits/minikit/quickstart).

Then, you can run the app with the following command:

```bash
npm run dev
```

Congratulations! You've successfully added Sub Accounts to your OnchainKit project.
Congratulations! You've successfully added Sub Accounts to your OnchainKit/MiniKit project.

If you have any questions, join the _#smart-wallet_ channel on [Discord](https://discord.gg/cdp).
5 changes: 4 additions & 1 deletion docs/wallet-app/guides/chat-agents.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Chat Agents in Coinbase Wallet
---
title: "Chat Agents in Coinbase Wallet"
sidebarTitle: "Chat Agents"
---

This guide will cover how you can get started building messaging agents for Coinbase Wallet, using XMTP, a decentralized messaging protocol. Discover a fast, easy way to build and get distribution in Coinbase Wallet.

Expand Down
2 changes: 1 addition & 1 deletion docs/wallet-app/introduction/beta-faq.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Coinbase Wallet Beta FAQ
title: Coinbase Wallet Beta
description: Frequently asked questions about the Coinbase Wallet limited beta
---

Expand Down
Loading