Skip to content

Commit b3d9076

Browse files
[Docs] Update pregenerate wallets API endpoint and request format
1 parent 9a3ebe1 commit b3d9076

File tree

1 file changed

+26
-12
lines changed
  • apps/portal/src/app/wallets/pregenerate-wallets

1 file changed

+26
-12
lines changed

apps/portal/src/app/wallets/pregenerate-wallets/page.mdx

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const metadata = createMetadata({
77
icon: "wallets",
88
},
99
title: "Pregenerate Wallets | thirdweb",
10-
description: "Create wallets before users sign up with thirdwebs wallet pregeneration. Pre-fund with tokens, NFTs, or game assets to enable smooth onboarding and asset claiming.",
10+
description: "Create wallets before users sign up with thirdweb's wallet pregeneration. Pre-fund with tokens, NFTs, or game assets to enable smooth onboarding and asset claiming.",
1111
});
1212

1313
# Pregenerate Wallets
@@ -35,35 +35,48 @@ You can distribute assets to wallets before users claim them, enabling:
3535

3636
To pregenerate an in-app or ecosystem wallet wallet, you can make a `POST` request to the following endpoint:
3737

38-
```
39-
https://in-app-wallet.thirdweb.com/api/v1/pregenerate
38+
```http
39+
POST https://api.thirdweb.com/v1/wallets/user/pregenerate
40+
Content-Type: application/json
41+
x-secret-key: <your-secret-key>
42+
x-ecosystem-id: <your-ecosystem-id> (optional)
43+
x-ecosystem-partner-id: <your-ecosystem-partner-id> (optional)
44+
45+
{
46+
"type": "email",
47+
"email": "[email protected]"
48+
}
4049
```
4150

4251
## Request Body
4352

4453
The request body should be a JSON object with the following parameters:
4554

46-
- `strategy`: The strategy for wallet generation
47-
- `email` or `phone` or `userId`: The user identifier associated with the wallet to be generated
55+
- `type`: The type of wallet identifier to pregenerate a wallet for:
56+
- Email based: `email`, `google`, `facebook`, `discord`
57+
- Phone based: `phone`
58+
- Wallet based: `signer`
59+
- User ID based: `custom_jwt` or `custom_auth_endpoint`
60+
- `email` or `phone` or `userId` or `walletAddress`: The user identifier associated with the wallet to be generated
4861

4962
### Email based wallets
5063

5164
```
52-
{ strategy: "email", email: "[email protected]" }
65+
{ type: "email", email: "[email protected]" }
5366
```
5467

5568
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.
5669

5770
### Phone based wallets
5871

5972
```
60-
{ strategy: "phone", phone: "+1321123321" }
73+
{ type: "phone", phone: "+1321123321" }
6174
```
6275

6376
### Custom user id based wallets
6477

6578
```
66-
{ strategy: "custom_auth_endpoint", userId: "some_user_id" }
79+
{ type: "custom_auth_endpoint", userId: "some_user_id" }
6780
```
6881

6982
{/* TODO: update link when custom auth documentation has been updated */}
@@ -83,13 +96,13 @@ You need to include the following headers:
8396
Here's an example curl command to pregenerate a thirdweb wallet for the user `[email protected]`:
8497

8598
```bash
86-
curl -X POST 'https://in-app-wallet.thirdweb.com/api/v1/pregenerate' \
99+
curl -X POST 'https://api.thirdweb.com/v1/wallets/user/pregenerate' \
87100
-H 'x-ecosystem-id: ecosystem.example-eco-123' \
88101
-H 'x-ecosystem-partner-id: 1415d24e-c7b0-4fce-846e-740841ef2c32' \
89-
-H 'x-secret-key: 9f8e7d6c5b4a3f2e1d0c9b8a7ffge434b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e7' \
102+
-H 'x-secret-key: <your-project-secret-key>' \
90103
-H 'Content-Type: application/json' \
91104
-d '{
92-
"strategy": "email",
105+
"type": "email",
93106
"email": "[email protected]"
94107
}'
95108
```
@@ -107,9 +120,10 @@ A successful API call returns a JSON object in the following format:
107120

108121
```json
109122
{
110-
"wallet": {
123+
"result": {
111124
"address": "string",
112125
"createdAt": "string",
126+
"profile": "object[]"
113127
}
114128
}
115129
```

0 commit comments

Comments
 (0)