Skip to main content

updateUserProfile

Update the authenticated user's profile settings including strategy, protocols, chains, and advanced customization options. Requires SIWE authentication.

Signature

updateUserProfile(params: UpdateUserProfileRequest): Promise<UpdateUserProfileResponse>

Parameters

interface UpdateUserProfileRequest {
/** Investment strategy: "conservative" for safer yields, "aggressive" for higher risk/reward */
strategy?: "conservative" | "aggressive";

/** Array of protocol IDs to use for yield optimization */
protocols?: string[];

/** Enable omni-account feature for cross-chain operations */
omniAccount?: boolean;

/** Enable automatic compounding of earned yields (default: true) */
autocompounding?: boolean;

/** Custom name for your agent */
agentName?: string;

/** Enable cross-chain strategy execution */
crosschainStrategy?: boolean;

/** Enable position splitting across multiple protocols */
splitting?: boolean;

/** Minimum number of splits when position splitting is enabled (1-4) */
minSplits?: number;
}

Note:

  • Smart wallet address and chains can only be configured through backend initialization and cannot be updated via this method.
  • executorProxy is always true and cannot be updated.
  • For granular protocol/pool configuration, use the customizeBatch method instead of the customization field.

Returns

interface UpdateUserProfileResponse {
success: boolean;
userId: string;
smartWallet?: string;
chains?: number[];
strategy?: string;
protocols?: string[];
omniAccount?: boolean;
autocompounding?: boolean;
agentName?: string;
crosschainStrategy?: boolean;
executorProxy?: boolean;
splitting?: boolean;
minSplits?: number;
}

Examples

Basic Strategy Update

await sdk.connectAccount(privateKey, chainId);

// Update strategy from conservative to aggressive
await sdk.updateUserProfile({
strategy: "aggressive",
});

console.log("Strategy updated to aggressive");

Configure Protocols

// Get available protocols for a chain
const protocolsResponse = await sdk.getProtocols(8453);
const selectedProtocols = protocolsResponse.protocols
.filter(p => ["Aave", "Compound", "Moonwell"].includes(p.name))
.map(p => p.id);

// Update user profile with specific protocols
await sdk.updateUserProfile({
protocols: selectedProtocols,
});

console.log("Protocols configured");

Enable Advanced Features

// Enable position splitting and cross-chain strategies
await sdk.updateUserProfile({
splitting: true,
minSplits: 3, // Split positions across 3+ protocols
crosschainStrategy: true, // Allow cross-chain rebalancing
omniAccount: true, // Enable omni-account features
autocompounding: true, // Auto-compound yields
});

console.log("Advanced features enabled");

Complete Profile Configuration

await sdk.connectAccount(privateKey, 8453);

// Get available protocols
const protocolsResponse = await sdk.getProtocols(8453);
const protocolIds = protocolsResponse.protocols.map(p => p.id);

// Configure complete user profile
await sdk.updateUserProfile({
strategy: "aggressive",
protocols: protocolIds,
splitting: true,
minSplits: 2,
crosschainStrategy: true,
omniAccount: true,
autocompounding: true,
agentName: "My DeFi Agent",
});

// Verify the changes
const userDetails = await sdk.getUserDetails();
console.log("Profile updated:", {
strategy: userDetails.user.strategy,
chains: userDetails.user.chains, // Chains set during initialization
protocolCount: userDetails.user.protocols.length,
splitting: userDetails.user.splitting,
minSplits: userDetails.user.minSplits,
crosschainStrategy: userDetails.user.crosschainStrategy,
});

Custom Protocol/Pool Configuration

For granular control over which pools to use for each protocol on each chain, use the dedicated customizeBatch method:

// Use customizeBatch for pool-level configuration
await sdk.customizeBatch([
{
protocolId: "protocol-uuid-1",
pools: ["USDC Pool", "WETH Pool"],
chainId: 8453, // Base
autoselect: false
},
{
protocolId: "protocol-uuid-1",
pools: ["USDC Vault"],
chainId: 42161, // Arbitrum
autoselect: false
}
]);

console.log("Custom protocol/pool configuration saved");

See the customizeBatch documentation for more details.

Use Cases

Risk Management

// Start conservative, monitor performance
await sdk.updateUserProfile({ strategy: "conservative" });

// After gaining confidence, switch to aggressive
await sdk.updateUserProfile({ strategy: "aggressive" });

Multi-Chain Operations

// Enable cross-chain yield optimization features
// Note: Chains are configured during initial setup via backend
// This updates the cross-chain strategy settings
await sdk.updateUserProfile({
crosschainStrategy: true,
omniAccount: true,
});

// Now your funds can be rebalanced across your configured chains
const userDetails = await sdk.getUserDetails();
console.log("Operating on chains:", userDetails.user.chains);

Protocol Selection

// Manual protocol selection
const protocols = ["aave-v3-uuid", "compound-uuid", "moonwell-uuid"];
await sdk.updateUserProfile({
protocols,
});

Position Splitting

// Distribute funds across multiple protocols to reduce risk
await sdk.updateUserProfile({
splitting: true,
minSplits: 3, // Require at least 3 different positions
});

// The rebalance engine will now split your deposits across
// at least 3 different protocols/pools when possible

Notes

Strategy Changes

  • When you deploy a Safe with deploySafe, the strategy parameter sets the initial risk profile
  • You can change the strategy at any time after deployment
  • After the strategy is updated, subsequent rebalancing uses the new active strategy
  • Data methods such as getUserDetails, getPositions, and getHistory return data for the current active strategy

Chain Configuration

  • Chains are configured during initial user setup via the backend and cannot be updated through this method
  • To view configured chains, use getUserDetails() which returns the chains array
  • Supported chains: Base (8453), Arbitrum (42161), Plasma (9745)
  • When crosschainStrategy is enabled, the rebalance engine can move funds between your configured chains
  • Each chain must have sufficient gas tokens (ETH) for operations
  • Contact support or use backend APIs to modify chain configuration

Position Splitting

  • splitting enables distributing funds across multiple protocols/pools, only when profitable if minSplits is set to 1.
  • minSplits sets the minimum number of positions (1-4), if above 1, it will force split the funds across the minimum number of positions.
  • Higher minSplits values increase diversification but may increase gas costs
  • The rebalance engine respects minimum position sizes when splitting

Customization Field

  • The customization field allows granular control over protocol/pool selection per chain
  • Structure: { "protocolId": { "chainId": ["pool1", "pool2"] } }
  • This overrides automatic pool selection for specified protocols
  • Useful for advanced users who want to target specific pools

Auto-compounding

  • When autocompounding is true (default), yields are automatically reinvested
  • When false, yields accumulate but are not reinvested
  • Most users should keep this enabled for maximum compound growth