Skip to content

Commit 495121a

Browse files
committed
docs: update pregeneration docs
1 parent 0b46ceb commit 495121a

File tree

2 files changed

+91
-30
lines changed

2 files changed

+91
-30
lines changed

apps/portal/src/app/connect/sidebar.tsx

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export const sidebar: SideBar = {
170170
},
171171
{
172172
name: "Pregenerate Wallets",
173-
href: `${ecosystemSlug}/pregenerate-wallets`,
173+
href: `${walletSlug}/pregenerate-wallets`,
174174
},
175175
{
176176
name: "User Management",
@@ -201,10 +201,10 @@ export const sidebar: SideBar = {
201201
name: "Prebuilt UI",
202202
href: `${connectSlug}/customization`,
203203
},
204-
{
205-
name: "Emails and SMS",
206-
href: `${connectSlug}/customization#compact-modal`,
207-
},
204+
// {
205+
// name: "Emails and SMS",
206+
// href: `${connectSlug}/customization#compact-modal`,
207+
// },
208208
],
209209
},
210210
{
@@ -238,27 +238,6 @@ export const sidebar: SideBar = {
238238
name: "Sign-In",
239239
icon: <WalletsConnectIcon />,
240240
links: [
241-
{
242-
name: "Sign-In Methods",
243-
links: [
244-
{
245-
name: "Email & Phone",
246-
href: `${connectSlug}/methods/email-and-phone`,
247-
},
248-
{
249-
name: "Social Login",
250-
href: `${connectSlug}/methods/social-logins`,
251-
},
252-
{
253-
name: "External Wallets",
254-
href: `${connectSlug}/methods/external-wallets`,
255-
},
256-
{
257-
name: "Guest Mode",
258-
href: `${connectSlug}/methods/guest-mode`,
259-
},
260-
],
261-
},
262241
{
263242
name: "Customization",
264243
links: [
@@ -354,10 +333,6 @@ export const sidebar: SideBar = {
354333
name: "Integrating with Partners",
355334
href: `${ecosystemSlug}/integrating-partners`,
356335
},
357-
{
358-
name: "Pregenerate Wallets",
359-
href: `${ecosystemSlug}/pregenerate-wallets`,
360-
},
361336
{
362337
name: "Ecosystem Wallet Explorer Page",
363338
href: `${ecosystemSlug}/wallet-explorer`,
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { Callout} from "@doc";
2+
3+
# Pregenerate User Wallets
4+
5+
To pregenerate an in-app or ecosystem wallet wallet, you can make a `POST` request to the following endpoint:
6+
7+
```
8+
https://in-app-wallet.thirdweb.com/api/v1/pregenerate
9+
```
10+
11+
This allows you to safely create wallet addresses for your users before they login to your app.
12+
13+
## Request Body
14+
15+
The request body should be a JSON object with the following parameters:
16+
17+
- `strategy`: The strategy for wallet generation
18+
- `email` or `phone` or `userId`: The user identifier associated with the wallet to be generated
19+
20+
### Email based wallets
21+
22+
```
23+
{ strategy: "email", email: "[email protected]" }
24+
```
25+
26+
When the user logs in with any method associated with that email (including google, facebook, discord auth), they will get access to the same pregenerated wallet.
27+
28+
### Phone based wallets
29+
30+
```
31+
{ strategy: "phone", phone: "+1321123321" }
32+
```
33+
34+
### Custom user id based wallets
35+
36+
```
37+
{ strategy: "custom_auth_endpoint", userId: "some_user_id" }
38+
```
39+
40+
{/* TODO: update link when custom auth documentation has been updated */}
41+
Use this when [bringing your own authentication method](/connect/in-app-wallet/custom-auth/configuration). When the user logs in, if the user ids you provide from the auth endpoint match, they will get access to the same pregenerated wallet.
42+
43+
## Headers
44+
45+
You need to include the following headers:
46+
47+
- `Content-Type`: Must be set to `application/json`
48+
- `x-secret-key`: Your secret key for authentication
49+
- `x-ecosystem-id` (optional): Your ecosystem ID
50+
- `x-ecosystem-partner-id` (optional): Your ecosystem partner ID
51+
52+
## Example curl Command
53+
54+
Here's an example curl command to pregenerate a thirdweb wallet for the user `[email protected]`:
55+
56+
```bash
57+
curl -X POST 'https://embedded-wallet.thirdweb.com/api/v1/pregenerate' \
58+
-H 'x-ecosystem-id: ecosystem.example-eco-123' \
59+
-H 'x-ecosystem-partner-id: 1415d24e-c7b0-4fce-846e-740841ef2c32' \
60+
-H 'x-secret-key: 9f8e7d6c5b4a3f2e1d0c9b8a7ffge434b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7' \
61+
-H 'Content-Type: application/json' \
62+
-d '{
63+
"strategy": "email",
64+
"email": "[email protected]"
65+
}'
66+
```
67+
68+
Replace the header values with your actual client ID, ecosystem ID, and secret key.
69+
70+
<Callout variant='info' title='Pregeneration for ecosystems'>
71+
For ecosystem wallets, the secret key have to be from the same account as the ecosystem owner. If this is an issue, please reach out to us.
72+
</Callout>
73+
74+
75+
## Response Format
76+
77+
A successful API call returns a JSON object in the following format:
78+
79+
```json
80+
{
81+
"wallet": {
82+
"address": "string",
83+
"createdAt": "string",
84+
}
85+
}
86+
```

0 commit comments

Comments
 (0)