Skip to content

Add Embedded Wallet Support to Dynamic SDK Configuration #195

@premiumjibles

Description

@premiumjibles

Objective

Enable embedded wallet creation in the Dynamic SDK integration, allowing users to create self-custodial MPC wallets within the chat app alongside existing BYO wallet support.

Background

The app currently only supports BYO (bring-your-own) wallets like MetaMask and WalletConnect. To enable smart wallet features and automation, users need the option to create Dynamic's MPC embedded wallets. This ticket adds that capability while maintaining backward compatibility with existing BYO wallet users.

Acceptance Criteria

  • Update DynamicContextProvider configuration to enable embedded wallets
  • Set createOnSignIn to 'off' to make embedded wallet creation opt-in (users can still use BYO wallets)
  • Configure embedded wallet settings (chain support, authentication methods)
  • Ensure existing BYO wallet flows continue to work unchanged
  • Update wallet connection hook to detect embedded vs. external wallets
  • Add environment variable for toggling embedded wallet feature if needed
  • Test that both BYO and embedded wallets can be created and connected
  • Verify wallet switching between multiple connected wallets works correctly

Technical Context

Current Implementation:

// apps/agentic-chat/src/app/app.tsx
<DynamicContextProvider
  settings={{
    environmentId: VITE_DYNAMIC_ENVIRONMENT_ID,
    initialAuthenticationMode: 'connect-only',
    walletConnectors: [
      EthereumWalletConnectors,
      SolanaWalletConnectors,
    ],
  }}
>

Expected Changes:
Add embedded wallet configuration to settings object. Reference the Dynamic embedded wallet docs for the exact API.

Files to Modify:

  • /apps/agentic-chat/src/app/app.tsx - Main Dynamic provider configuration
  • /apps/agentic-chat/src/hooks/useWalletConnection.ts - May need updates to detect embedded wallets
  • /apps/agentic-chat/src/lib/walletUtils.ts - May need helper functions for wallet type detection

Wallet Type Detection:
Need to distinguish between:

  • External wallets (MetaMask, WalletConnect, Phantom)
  • Embedded wallets (Dynamic MPC)

This can typically be done via wallet?.connector?.name === 'embedded' or similar Dynamic SDK API.

Testing Checklist

  • Can create new embedded wallet via email/social login
  • Can still connect BYO wallet (MetaMask, WalletConnect)
  • Can switch between embedded and BYO wallet if both connected
  • Wallet state persists across page refreshes
  • Both wallet types can execute transactions
  • Network switching works for both wallet types

Reference Documentation

Non-Goals

  • Smart wallet features (ERC-4337) - handled in separate ticket
  • Session keys - handled in separate ticket
  • Migration flows - handled in separate ticket

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions