Skip to content

Implement deposit lock assets flow#61

Open
Sparexonzy95 wants to merge 1 commit into
SmartDropLabs:mainfrom
Sparexonzy95:fix/deposit-lock-assets-flow
Open

Implement deposit lock assets flow#61
Sparexonzy95 wants to merge 1 commit into
SmartDropLabs:mainfrom
Sparexonzy95:fix/deposit-lock-assets-flow

Conversation

@Sparexonzy95

@Sparexonzy95 Sparexonzy95 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Closes #19

Overview

This PR implements the full deposit / lock-assets flow for farm pools.

Previously, users could view farm pool rows, but there was no complete production path for depositing or locking assets into a pool. The existing deposit interaction did not complete the required Soroban lock_assets transaction flow.

This update adds the full end-to-end path: amount entry, balance validation, fee simulation, Freighter signing, transaction submission, confirmation polling, and UI refresh after success.

What changed

Farm deposit UI

  • Added a connected-wallet-only + Deposit action to farm pool rows.
  • Added a deposit modal for the selected pool.
  • Added amount input with validation before submission.
  • Added native Stellar balance validation using Horizon.
  • Added minimum lock-period visibility so users understand when deposited assets can be unlocked.
  • Added Soroban fee preview before signing.
  • Added disabled input and loading states while the transaction is in-flight.
  • Added transaction hash display with a Stellar Expert link while confirmation is pending.

Soroban lock-assets flow

Implemented the lock_assets(user: Address, amount: i128) flow using:

  • TransactionBuilder
  • rpcServer.simulateTransaction
  • simulation authorization validation
  • rpc.assembleTransaction
  • Freighter walletApi.signTransaction
  • rpcServer.sendTransaction
  • rpcServer.getTransaction polling until final success or failure

The deposit amount is converted from display units into Stellar’s 7-decimal smallest unit before being encoded as i128.

React Query refresh

After a successful deposit, the relevant React Query caches are invalidated so the UI refreshes automatically, including:

  • farm pools
  • user position for the affected pool
  • all user positions
  • user credits
  • platform stats
  • Horizon balance query

E2E coverage and CI fixes

Updated the E2E setup so the deposit flow can be tested reliably in CI.

This includes:

  • fixing the Playwright workflow commands so the Playwright binary is called correctly
  • fixing E2E test discovery from e2e/playwright.config.ts
  • updating farm E2E selectors to support the current wallet connect UI
  • adding/mocking the required E2E wallet, Horizon balance, Soroban simulation, and confirmation paths
  • preserving strict pnpm install --frozen-lockfile behavior in CI

Tests

Added/updated test coverage for:

  • lock transaction construction
  • correct pool contract address usage
  • lock_assets function name
  • user address encoding
  • i128 amount encoding
  • display amount conversion, for example 1.25 to 12500000
  • farm E2E deposit and unlock flow

Supporting cleanup

A few build and test blockers in the upstream-synced branch were cleaned up so the deposit flow could compile and pass CI. This included farm page cleanup, type fixes, Next route compatibility, E2E configuration fixes, and small component/test updates.

The functional scope remains focused on implementing and validating the farm deposit / lock_assets flow.

Verification

  • pnpm install --frozen-lockfile

    • lockfile validation passed
  • pnpm run test

    • 12 test files passed
    • 60 tests passed
  • pnpm run build

    • production build completed successfully
    • linting and type checking passed
  • pnpm run playwright

    • 5 E2E tests discovered and executed
    • farm wallet, deposit, countdown, unlock availability, and unlock flow covered
  • GitHub Actions

    • latest E2E Tests / e2e check passed

@Sparexonzy95 Sparexonzy95 force-pushed the fix/deposit-lock-assets-flow branch from a7550cc to 176650a Compare June 28, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement deposit (lock assets) flow with Freighter signing and simulation

1 participant