Skip to content

feat(sub-accounts): transfer perp USDC between master and sub-account #81

@vipineth

Description

@vipineth

Parent PRD

#75

What to build

Add a "Transfer" action to each sub-account row in the management view. Clicking it opens a transfer modal scoped to that sub-account. The modal contains a direction toggle (Master → Sub-Account / Sub-Account → Master), an amount input (decimal USD string, e.g. "50.00"), and a display of the available perp USDC balance for both the source and destination accounts. Submitting calls exchange.subAccountTransfer({ subAccountUser, isDeposit, usd }) where usd is the dollar amount × 1,000,000 as an integer.

Note: isDeposit: true = master is sending to sub-account; isDeposit: false = sub-account is sending back to master.

Acceptance criteria

  • "Transfer" button appears on each sub-account row in the management view
  • Transfer modal opens pre-scoped to the selected sub-account
  • Direction toggle switches between Master→Sub and Sub→Master
  • Available perp USDC balance is shown for the source account and updates when direction changes
  • Amount input accepts decimals; the USD value is converted to integer × 1e6 before submission
  • Submitting with 0 or an amount exceeding available balance shows a validation error
  • Submitting shows a loading state; on success the modal closes and balance values refresh
  • On error the modal stays open and shows the error message

Blocked by

User stories addressed

  • User story 5 (transfer USDC from master to sub)
  • User story 6 (transfer USDC from sub to master)
  • User story 9 (modal shows available balance for both accounts)
  • User story 22 (loading/success/error feedback on transfer)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions