POST
/
generateWallets
Generate User Wallets
curl --request POST \
  --url http://localhost:2400/generateWallets \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "type": "sol",
  "quantity": 2
}'
{
  "success": true,
  "message": "Wallets generated successfully",
  "addresses": [
    "SoLAddress1...",
    "SoLAddress2..."
  ]
}

Endpoint

POST /generateWallets

Description

Generates a specified number of new wallets for the authenticated user on a given blockchain network (e.g., ETH, BASE, SOL). The generated wallet addresses and their corresponding private keys are saved to the user’s profile.

Authentication

Requires a valid JWT token passed via cookies.

Request Body

ParameterTypeRequiredDescriptionExample
typestringYesThe network type for the wallets (‘eth’, ‘base’, ‘sol’, etc.).eth
quantityintegerYesThe number of wallets to generate (must be >= 1).1
Example
{
  "type": "sol",
  "quantity": 2
}

Success Response (200 OK)

Returns a success message and an array of the newly generated wallet addresses.
Example
{
  "success": true,
  "message": "Wallets generated successfully",
  "addresses": [
    "SoLAddress1...",
    "SoLAddress2..."
  ]
}

Error Response (400 Bad Request)

Indicates invalid input, such as missing parameters, invalid quantity, or unsupported wallet type.
Example
{
  "success": false,
  "message": "Wallet type not implemented yet" // or "Quantity must be at least 1"
}

Error Response (401 Unauthorized)

Indicates that no valid JWT token was provided or the token is expired.
Example
{
  "success": false, 
  "error": "No access token provided"
}

Error Response (403 Forbidden)

Indicates that the user has reached their maximum allowed wallet limit.
Example
{
  "success": false,
  "message": "Maximum wallet limit reached"
}

Error Response (500 Internal Server Error)

Indicates a server-side error occurred during wallet generation or saving.
Example
{
  "success": false, 
  "message": "Server error while generating wallets"
}

Notes

  • This endpoint is handled by the User server (Port 5000).
  • Calls internal functions (generateEvmWallets, generateSolWallets) to create key pairs.
  • Saves the new wallet details (address, encrypted private key, network) to the GeneralWalletData collection.
  • Checks against a user-specific wallet limit (checkWalletLimit function) before generation.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Response

200
application/json

Success response indicating wallets were generated.

The response is of type object.