Create User

Register a new user sub-account under your builder and get their API key.

Usage

import { BuilderClient } from '@opinion-labs/opinion-clob-sdk';

const builder = new BuilderClient({
  host: 'https://openapi.opinion.trade/openapi',
  builderApiKey: 'YOUR_BUILDER_KEY',
  chainId: 56,
});

const result = await builder.createUser('0xUserWalletAddress...');

console.log(result.walletAddress);    // User's login wallet address
console.log(result.multiSigWallet);   // User's Gnosis Safe wallet address
console.log(result.apikey);           // User's API key - SAVE THIS!
console.log(result.builderName);      // Builder name
console.log(result.enableTrading);    // Whether trading is enabled

Parameters

Parameter
Type
Required
Description

walletAddress

string

Yes

User's EOA wallet address (0x-prefixed)

Response

Notes

  • The API key is returned only once during creation. Store it securely in your database.

  • If the API key is lost, use regenerateUserApiKey() to generate a new one (currently disabled on backend -- contact support).

  • The Gnosis Safe wallet is created asynchronously (1-10 minutes). Poll getUser() until multiSigWallet is non-empty.

  • If the user already exists, the API will return an error. Use getUser() to retrieve existing user info.

Polling for Safe Wallet