Skip to content

Add account tools (createAccount + accountMerge) #29

Description

@MJ-RWA

Complexity: High — 200 pts

Summary

Stellar has two powerful account lifecycle operations not exposed by Freighter or any other wallet UI: createAccount (fund a brand-new Stellar address with the minimum reserve) and accountMerge (close an account, moving all XLM to another address). This issue adds both as utility tools.

Files to Create/Modify

  • Create: src/pages/AccountToolsPage.tsx
  • Modify: src/lib/stellar.ts — add buildCreateAccountTx and buildAccountMergeTx
  • Modify: src/App.tsx — add /account-tools route
  • Modify: src/pages/DashboardPage.tsx — add Account Tools link in footer area

Implementation Notes

stellar.ts

export async function buildCreateAccountTx(sourceAddress, newAccountAddress, startingBalance): Promise<string>
export async function buildAccountMergeTx(sourceAddress, mergeDestination): Promise<string>

Use Operation.createAccount({ destination, startingBalance }) and Operation.accountMerge({ destination }) respectively.

AccountToolsPage — two cards

Fund New Account: address input + starting balance input (minimum 1 XLM), warn if the destination account already exists, "Create Account" button → build/sign/submit, success shows the new account on Stellar Expert.

Merge Account: destination address input, a prominent red warning box explaining the account will be permanently closed and access lost, require the user to type MERGE in a confirmation field before the "Merge Account" button enables, then build/sign/submit. After success, disconnect the wallet since the account no longer exists.

Acceptance Criteria

  • Fund New Account creates a valid Stellar account with exactly the entered starting balance
  • Fund New Account shows error if destination already has an account
  • Account Merge requires typing "MERGE" in a text field to enable the button
  • Merge warning is prominently displayed before confirmation
  • After successful merge, wallet is disconnected (account no longer exists)
  • Both operations work on Stellar mainnet

Screen Recording Requirements

  1. Open Account Tools page
  2. Fund New Account: generate a fresh keypair (shown in Stellar Lab), enter address, set 2 XLM → account created and visible on Stellar Expert
  3. Account Merge: enter destination, type "MERGE" → button enables → sign → account merged, balance transferred → disconnect

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions