deploySafe
Deploy a Safe smart wallet for a user using ERC-4337 account abstraction. Automatically checks if already deployed and updates user profile.
Signature
deploySafe(
userAddress: string,
chainId: SupportedChainId,
strategy?: Strategy
): Promise<DeploySafeResponse>
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userAddress | string | ✅ | User's EOA address |
chainId | SupportedChainId | ✅ | Target chain (8453, 42161, or 9745) |
strategy | Strategy | ❌ | Strategy selection: "conservative" (default) or "aggressive" |
Strategy Options:
"conservative"(default): Low-risk, stable yield strategy"aggressive": High-risk, high-reward strategy
For changing the strategy after the wallet is deployed, see Updating Strategy After Deployment.
Returns
Deployment response with Safe address and transaction hash
Return Type
interface DeploySafeResponse {
success: boolean;
safeAddress: Address;
txHash: string;
status: "deployed" | "failed";
}
Examples
Deploy with Default Conservative Strategy
// Deploy with default conservative strategy
const result = await sdk.deploySafe("0xUser...", 42161);
if (result.success) {
console.log("Safe deployed at:", result.safeAddress);
console.log("Transaction:", result.txHash);
}
Deploy with Aggressive Strategy
// Deploy with aggressive strategy
const result = await sdk.deploySafe("0xUser...", 42161, "aggressive");
if (result.success) {
console.log("Safe deployed at:", result.safeAddress);
console.log("Transaction:", result.txHash);
}