Skip to content

Conversation

@rodrigooler
Copy link
Collaborator

@rodrigooler rodrigooler commented Sep 26, 2025

Summary by CodeRabbit

  • New Features

    • Simple Bridge: guided two‑direction flow with dual‑wallet connector, fraction quick‑select, multi‑step transfer dialog, lifecycle steps, orchestrated transfer, and transaction step items.
    • APR/price UI: APR bar client/wrapper, Torus price hook and reward‑interval support.
    • Read‑only input component.
  • Improvements

    • Safer form inputs (default empty strings), responsive sidebar with active state, multi‑chain balance display, prioritized “Simple Bridge (Recommended)” card, updated menu label and asset path updates.
  • Changes

    • YAML→JSON config migration; wallet‑conflict overlay removed; improved chain‑switch retry/polling and friendlier error messages; lint/config tweaks.

- Introduced the Simple Bridge feature, allowing users to transfer TORUS tokens between Base and Native chains in a streamlined process.
- Added components for wallet connection, transaction progress, and user interface enhancements.
- Implemented hooks for managing dual wallet connections and orchestrated transfers, ensuring a smooth user experience during token transfers.

This update enhances the functionality of the Torus Bridge application, providing users with a more efficient way to manage their TORUS tokens.
- Disable the "react-hooks/preserve-manual-memoization" rule to allow for more flexibility in hook usage.
- This change aims to streamline the linting process and reduce unnecessary warnings related to manual memoization in React components.
- Removed unused components (GuideDialog and SelectActionDialog) from the Simple Bridge page to streamline the UI.
- Updated the SEO description formatting for better readability.
- This change enhances the overall clarity and performance of the Simple Bridge application.
- Introduced new SVG icons for Base and Native balance displays in the Torus Bridge application.
- Updated the WalletBalance component to utilize the new icons and improved the layout for better user experience.
- Added FractionButtons component to streamline the selection of transfer fractions in the Simple Bridge form.
- Enhanced the Simple Bridge form to display wallet addresses and improved overall styling for clarity.

This update enhances the visual representation and functionality of the Torus Bridge application, providing users with a more intuitive interface for managing their balances and transfers.
- Introduced new SVG icons for Base, EVM, and Native balances in the Torus Bridge application.
- Updated the WalletBalance component to utilize the new icons, enhancing the visual representation of user balances.
- Modified the Simple Bridge form to incorporate new icon paths for improved clarity.
- Adjusted the logo URI in the chains configuration to point to the new logo asset.

This update enhances the user interface of the Torus Bridge application, providing a more intuitive experience for managing balances and transfers.
- Reformatted SVG icon files in the Torus Bridge application for better code clarity and consistency.
- Adjusted path elements to enhance visual structure and maintainability.

This update improves the overall quality of the SVG assets used in the application.
…eading

- Integrated token formatting using `formatToken` for improved balance display in the Simple Bridge form.
- Replaced the balance fetching method with `useReadContract` to read ERC20 token balances directly from the contract.
- Updated balance calculations to ensure accurate representation of available funds for transfers.

This update improves the user experience by providing clearer balance information and ensuring accurate token management in the Torus Bridge application.
- Deleted the ProgressStepper component from the Simple Bridge application to streamline the codebase.
- Updated exports in the SimpleBridge index file to reflect the removal of the ProgressStepper.

This change simplifies the Simple Bridge component structure and improves maintainability.
- Refactored the Sidebar component to improve code organization and readability.
- Introduced a new SidebarOption component for better encapsulation of sidebar link logic.
- Utilized useMemo and useCallback hooks to optimize performance and manage active link states.
- Updated the rendering logic to dynamically generate sidebar options based on the current path.

This update streamlines the Sidebar component, enhancing maintainability and user experience in the Torus Bridge application.
- Deleted the TransferDetails component from the Simple Bridge page to streamline the UI.
- This change enhances the overall clarity and performance of the Simple Bridge application.
- Introduced a new state, STEP_2_SWITCHING, to the SimpleBridgeStep enum to enhance the transaction workflow.
- Updated the SimpleBridgeTransaction interface to include a more detailed status field, allowing for better tracking of transaction states.

This update improves the clarity and functionality of the Simple Bridge application, providing users with a more comprehensive view of transaction progress.
- Added a TransactionLifecycleDialog to the SimpleBridgeForm for improved user feedback during transfers.
- Implemented state management for showing the dialog based on transfer progress and errors.
- Refactored address and balance formatting functions for better readability and maintainability.
- Updated button text and placeholder logic to enhance user experience.

This update provides users with clearer transaction status and improves the overall functionality of the Simple Bridge application.
…back

- Added a new TransactionLifecycleDialog component to the Simple Bridge application to provide users with real-time updates on transaction progress.
- Integrated lifecycle steps for both Base to Native and Native to Base transfers, improving user experience during the bridging process.
- Enhanced state management to handle various transaction statuses, including error handling and retry options.

This update significantly improves user feedback and clarity during token transfers in the Simple Bridge application.
@linear
Copy link

linear bot commented Sep 26, 2025

WEB-353 Fast Bridge UI

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 26, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a Simple Bridge feature (UI, hooks, orchestrated multi-step flows, polling, types), replaces YAML configs with JSON and removes yaml-loader, refactors APR UI into prop-driven client/server pieces, updates icons/paths, removes WalletConflictGuard, adjusts sidebar/balance components, and tweaks linting and input handling. (50 words)

Changes

Cohort / File(s) Change Summary
Simple Bridge UI & Page
apps/torus-bridge/src/app/simple/_components/*, apps/torus-bridge/src/app/simple/page.tsx
Adds SimpleBridge, SimpleBridgeForm, DualWalletConnector, FractionButtons, TransactionLifecycleDialog, TransactionStepItem, and page wiring.
Bridge Hooks & Flows
apps/torus-bridge/src/app/simple/hooks/*
Adds useDualWallet, useOrchestratedTransfer, useSimpleBridgeSharedState, useTransactionLifecycleSteps, chain-switch-with-retry, polling utilities, and full base↔native & native↔base step implementations.
Polling & Helpers
.../simple-bridge-polling.ts, .../simple-bridge-helpers.ts, .../simple-bridge-chain-switch.ts
Implements balance polling, timeouts, POLLING/GAS/TIMEOUT constants, UserRejectedError, error formatting, explorer URL helper, and switch-with-retry logic.
Types & Shared State
apps/torus-bridge/src/app/simple/_components/simple-bridge-types.ts, .../use-simple-bridge-shared-state.ts
Adds SimpleBridge types, step/state enums, transaction shapes, wallet connection state, and shared state hook (update/add/reset).
APR UI Refactor & Integration
packages/ui/src/components/apr/*, packages/ui/src/components/apr-bar/*, packages/ui/tailwind.config.ts, packages/ui/package.json, packages/query-provider/src/hooks.ts, apps/*/components/apr-bar-wrapper.tsx
Converts APRBar to props-driven + APRBarClient, exposes useAPR(api) and useGetTorusPrice, adds Torus→USD helper, animation utilities, wrapper components, and export map changes.
Config: YAML → JSON & Build
apps/torus-bridge/src/consts/*.json, removed .../*.yaml, .../chain-metadata.ts, .../warp-core-config.ts, apps/torus-bridge/next.config.mjs, apps/torus-bridge/package.json
Replaces YAML files with JSON, updates parsing/validation, removes yaml-loader and custom turbopack/webpack YAML rules.
Balances & Assets
apps/torus-bridge/src/app/_components/shared/wallet-balance.tsx, apps/torus-bridge/src/app/_components/transfer-evm.tsx, apps/torus-bridge/src/consts/chains.ts, apps/torus-bridge/src/config.ts
Introduces BalanceIcon, multi-chain balance fetching, updates icon/logo asset paths to /assets/icons, and adds contractAddresses config.
Navigation & Select UI
apps/torus-bridge/src/app/_components/shared/sidebar-links.tsx, apps/torus-bridge/src/app/_components/select-action-dialog.tsx
Reworks SidebarLinks to data-driven responsive component with active-state logic; adds priority?: boolean to SelectCard props, updates icon asset paths and trigger label text.
Token Transfer API & Hooks
apps/torus-bridge/src/hooks/use-token-transfer.ts
Adds throwOnError option, makes executeTransfer/triggerTransactions async and return last tx hash, and conditionally rethrows signing-stage errors.
Input Component
packages/ui/src/components/input.tsx
Adds InputReadonly component, exports InputProps as interface, and exposes both Input and InputReadonly.
Linting & Minor Cleanups
tooling/eslint/react.js, token-list-modal, transfer-token-form
Disables react-hooks/preserve-manual-memoization in ESLint config and removes inline eslint-disable comments.
Wallet Conflict Removal & Layout
apps/torus-bridge/src/app/_components/wallet-conflict-guard.tsx (removed), apps/torus-bridge/src/app/layout.tsx, apps/torus-wallet/src/app/layout.tsx
Deletes WalletConflictGuard and its usage; layouts now render APRBarWrapper directly.
Form Value Safety Fixes
apps/torus-portal/src/app/(pages)/permissions/**
Normalizes form field values to non-undefined strings and guards duplicate checks to avoid undefined values.
Tooling & Packaging
package.json, packages/torus-sdk-ts/package.json, packages/ui/package.json, justfile, CLAUDE.md, pnpm-workspace.yaml, packages/query-provider/package.json
Adds pnpm override for @wagmi/core, updates dependency ranges, workspace export tweaks, install flags, and docs guidance.
Misc UI/Assets
apps/torus-bridge/src/app/_components/select-action-dialog.tsx, apps/torus-bridge/src/app/_components/transfer-evm.tsx
Icon path updates to absolute /assets/icons, adds a recommended/prioritized SelectCard entry, and changes trigger label to "Bridge options menu."

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Form as SimpleBridgeForm
  participant Wallet as useDualWallet / DualWalletConnector
  participant Orch as useOrchestratedTransfer
  participant StepExec as Step Executor
  participant Poll as pollBalanceUntilTarget
  participant Dialog as TransactionLifecycleDialog

  User->>Form: set direction & amount
  Form->>Wallet: areWalletsReady(direction)?
  Wallet-->>Form: ready / not ready

  alt wallets ready
    User->>Form: submit
    Form->>Dialog: open (lifecycle)
    Form->>Orch: executeTransfer(direction, amount)
    Orch->>StepExec: run step 1 (switch → sign → send)
    StepExec->>Poll: poll balances/confirm
    Poll-->>StepExec: success / timeout / error
    Orch->>StepExec: run step 2 if required
    StepExec->>Poll: poll balances/confirm
    Poll-->>Orch: final result
    Orch-->>Dialog: update steps, tx hashes, errors
    Dialog-->>User: COMPLETE or ERROR
  else wallets not ready
    Form->>Wallet: render DualWalletConnector prompts
  end
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested reviewers

  • steinerkelvin
  • EdSDR

Poem

"I hop through JSON fields with glee,
swapped YAML burrows for bright pastry.
Two wallets ready, APR bells chime,
steps march forward — hop, sign, and time. 🐇"

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely summarizes the primary change—adding a Simple Bridge UI with accompanying hooks and configuration adjustments—providing clear context for reviewers without including extraneous details.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rodrigooler rodrigooler changed the title Fix/web 353 change: Bridge - Enhance UX (web-353) Sep 26, 2025
@rodrigooler rodrigooler changed the title change: Bridge - Enhance UX (web-353) wip: change: Bridge - Enhance UX (web-353) Sep 29, 2025
- Refactored the DualWalletConnector component for improved readability and structure, including better state management for wallet connection statuses.
- Updated the SimpleBridgeForm to use a more descriptive reset function name.
- Enhanced transaction lifecycle handling in the TransactionLifecycleDialog, ensuring clearer status updates and error handling during transfers.
- Improved type definitions in SimpleBridgeTransaction to include metadata for better transaction tracking.

This update enhances user experience by providing clearer feedback during wallet connections and transaction processes in the Torus Bridge application.
- Removed unnecessary comments and streamlined the connection logic within the useDualWallet hook.
- Enhanced the connection state management by simplifying condition checks and reducing redundant code.
- Improved overall readability and maintainability of the hook, ensuring clearer logic flow for wallet connections.

This update enhances the clarity and efficiency of the useDualWallet hook in the Torus Bridge application.
…y and status management

- Simplified connection logic by removing redundant checks and enhancing condition handling.
- Introduced helper functions for status indicators and connection messages to improve clarity.
- Streamlined the rendering of wallet connection statuses, ensuring a more maintainable code structure.

This update enhances the user experience by providing clearer feedback on wallet connections in the Torus Bridge application.
…ty and maintainability

- Introduced a new interface for props in the FractionButton and FractionButtons components to enhance type safety and clarity.
- Simplified the rendering of fraction buttons by mapping over an array of fractions, reducing repetitive code.
- Improved state management for button selection and disabled states, ensuring a more efficient user experience.

This update enhances the clarity and maintainability of the FractionButtons component in the Torus Bridge application.
- Introduced the SimpleBridge component to encapsulate the SimpleBridgeForm, improving the structure of the Simple Bridge application.
- Added new components including SimpleBridgeForm, DualWalletConnector, FractionButtons, and TransactionLifecycleDialog to facilitate user interactions during token transfers.
- Enhanced state management and user feedback mechanisms throughout the bridging process, ensuring clearer transaction status updates and error handling.
- Implemented type definitions for better clarity and maintainability in the Simple Bridge workflow.

This update significantly improves the user experience by providing a more organized and interactive interface for token transfers in the Simple Bridge application.
- Removed redundant import statement for TransactionLifecycleDialog in the SimpleBridgeForm component, ensuring cleaner code structure.
- Added a newline at the end of the FractionButtons component file to adhere to coding standards.

This update improves code clarity and maintains consistency across the Simple Bridge application components.
…gement

- Introduced a new StepStatus type to standardize transaction step statuses across the TransactionLifecycleDialog component.
- Refactored lifecycle step creation into dedicated functions for Base to Native and Native to Base transfers, improving code organization and readability.
- Enhanced status management logic to provide clearer feedback on transaction progress, including error handling and waiting states.
- Updated the rendering logic for status icons and colors to align with the new status management approach.

This update significantly improves the clarity and maintainability of the TransactionLifecycleDialog, enhancing user feedback during token transfers in the Simple Bridge application.
… readability

- Adjusted the formatting of the transaction status retrieval logic in the TransactionLifecycleDialog component for enhanced clarity.
- Ensured consistent code style by adding a newline at the end of the file.

This update improves the maintainability of the TransactionLifecycleDialog, contributing to a cleaner codebase in the Torus Bridge application.
…d error handling and configuration management

- Introduced constants for gas, polling, and confirmation configurations to streamline the code and improve maintainability.
- Refactored user rejection error handling into a dedicated function for better clarity and reusability.
- Simplified chain switching logic and error handling, ensuring consistent behavior across different transaction states.
- Improved polling mechanism for balance confirmation with configurable parameters, enhancing user feedback during transfers.

This update enhances the clarity and maintainability of the use-simple-bridge-orchestrated-transfer hook in the Torus Bridge application, providing a more robust user experience during token transfers.
@rodrigooler rodrigooler marked this pull request as ready for review September 29, 2025 20:52
@rodrigooler rodrigooler requested a review from a team as a code owner September 29, 2025 20:52
Copilot AI review requested due to automatic review settings September 29, 2025 20:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a simplified bridge interface for easier token transfers between Base and Native Torus chains, consolidating the two-step process into a single seamless flow. It introduces new UI components, improves asset organization, and updates ESLint configuration.

  • Adds a Simple Bridge page with orchestrated two-step transfers (Base ↔ Native Torus)
  • Introduces comprehensive transaction lifecycle tracking with progress dialogs and retry mechanisms
  • Reorganizes asset structure and updates icon paths throughout the application

Reviewed Changes

Copilot reviewed 17 out of 30 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tooling/eslint/react.js Disables preserve-manual-memoization rule
apps/torus-bridge/src/consts/chains.ts Updates logo path to new asset structure
apps/torus-bridge/src/app/simple/page.tsx Creates Simple Bridge page with metadata
apps/torus-bridge/src/app/simple/hooks/use-simple-bridge-orchestrated-transfer.ts Implements orchestrated transfer logic with comprehensive error handling
apps/torus-bridge/src/app/simple/hooks/use-simple-bridge-dual-wallet.ts Manages dual wallet connections for bridge operations
apps/torus-bridge/src/app/simple/_components/ Various Simple Bridge UI components
apps/torus-bridge/src/app/_components/ Updates existing components with new asset paths and improved functionality
Comments suppressed due to low confidence (2)

apps/torus-bridge/src/app/simple/hooks/use-simple-bridge-orchestrated-transfer.ts:1

  • This onClick handler contains only a placeholder comment and no actual implementation. Either implement the functionality to open explorer links or remove the non-functional button.
"use client";

apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-lifecycle-dialog.tsx:1

  • The hardcoded zero address should be defined as a named constant to improve maintainability and make the intent clearer.
"use client";

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts (1)

476-478: Critical: Fix baseline calculation and precision loss (regressions).

This code has two critical issues that were marked as addressed in previous commits but have regressed:

  1. Line 476-477: The refetchBaseBalance() result is discarded, and the code reads the stale baseBalance parameter instead. This was marked as addressed in commit fe5095e.

  2. Line 478: parseFloat(amount) causes precision loss on decimal token amounts. This was marked as addressed in commit afe4109.

Apply this diff to fix both issues:

-  await refetchBaseBalance();
-  const baseBaselineBalance = baseBalance?.value ?? 0n;
-  const baseExpectedIncrease = toNano(parseFloat(amount));
+  const baseRefreshResult = await refetchBaseBalance();
+  const baseBaselineBalance = (baseRefreshResult as { data?: { value: bigint } }).data?.value ?? 0n;
+  const baseExpectedIncrease = toNano(amount.trim());

Note: Once the interface at line 320 is updated to return the proper type, the cast can be removed:

+  const baseRefreshResult = await refetchBaseBalance();
+  const baseBaselineBalance = baseRefreshResult.data?.value ?? 0n;
+  const baseExpectedIncrease = toNano(amount.trim());
🧹 Nitpick comments (15)
packages/ui/src/components/apr/use-reward-interval.ts (2)

3-5: Simplify redundant type union.

The union Api | ApiPromise | Nullish on line 18 is redundant because Api is already defined as ApiDecoration<"promise"> | ApiPromise (from @torus-network/sdk/chain), which means ApiPromise is already included in Api.

Apply this diff to simplify the type:

-import type { ApiPromise } from "@polkadot/api";
 import type { Api } from "@torus-network/sdk/chain";
 import type { Nullish } from "@torus-network/torus-utils/typing";
@@
-export function useRewardIntervalProgress(api: Api | ApiPromise | Nullish) {
+export function useRewardIntervalProgress(api: Api | Nullish) {

Also applies to: 18-18


13-17: Enhance JSDoc return value documentation.

The JSDoc @returns description could be more specific about the return object structure.

Apply this diff:

 /**
  * Hook that calculates and tracks the progress of the current reward interval.
  * @param api - The Polkadot.js API instance for blockchain interaction
- * @returns Object containing the time remaining in the current reward interval formatted as minutes:seconds
+ * @returns Object with `minutes` (string), `seconds` (string), and `full` (string in "MM:SS" format) representing time until next reward
  */
packages/ui/src/components/apr/hooks.ts (3)

18-21: Consider extracting magic numbers to a configuration module.

The TODO comment indicates these values should be refactored. These blockchain emission constants could be moved to a shared configuration module for better maintainability.

Would you like me to suggest a configuration structure or open an issue to track this refactor?


38-65: Consider documenting the fallback logic.

Line 60 uses totalFreeBalance as a fallback when totalStake is zero. This appears intentional, but the reasoning isn't immediately clear.

Consider adding a comment explaining why totalFreeBalance is used as the staking amount when total stake is zero:

   // Calculate APR
+  // Fallback to totalFreeBalance when there's no stake yet (bootstrapping phase)
   const stakingAmount = totalStake === 0n ? totalFreeBalance : totalStake;

175-191: Consider removing redundant null coalescing.

Lines 176-179 use defensive null coalescing (?.toString() ?? "0"), but since isDataComplete already guards against null/undefined data at line 173, these operators are redundant.

This is safe as-is, but you could simplify for clarity:

       const totalStake = BigInt(totalStakeQuery.data?.toString() ?? "0");
       const totalFreeBalance = BigInt(
         totalIssuanceQuery.data?.toString() ?? "0",
       );
-      const recyclingRate = Number(recyclingPercentageQuery.data) / 100;
-      const treasuryFee = Number(treasuryEmissionFeeQuery.data) / 100;
-      const incentivesRatio = Number(incentivesRatioQuery.data) / 100;
+      const recyclingRate = Number(recyclingPercentageQuery.data!) / 100;
+      const treasuryFee = Number(treasuryEmissionFeeQuery.data!) / 100;
+      const incentivesRatio = Number(incentivesRatioQuery.data!) / 100;
packages/ui/src/components/input.tsx (1)

8-10: Add JSDoc documentation for the public InputProps interface.

The InputProps interface is part of the public API and should be documented per the coding guidelines. Consider adding a brief JSDoc comment describing the component's props and purpose.

As per coding guidelines.

Apply this diff:

+/**
+ * Props for the Input component.
+ * Extends standard HTML input attributes with optional label support.
+ */
 export interface InputProps
   extends React.InputHTMLAttributes<HTMLInputElement>,
     BaseInputProps {}
apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts (2)

320-320: Tighten refetchBaseBalance return type to match usage.

The function is typed as Promise<unknown> but the call site (lines 481-484) casts it to { status: string; data?: { value: bigint } }. Update the interface to specify the expected return type and eliminate the unsafe cast.

Apply this diff to tighten the return type:

-  /** Function to refetch Base balance */
-  refetchBaseBalance: () => Promise<unknown>;
+  /** Function to refetch Base balance and return status with optional balance data */
+  refetchBaseBalance: () => Promise<{ status: string; data?: { value: bigint } }>;

Then at the call site (lines 481-484), remove the cast:

   const pollingResult = await pollEvmBalance(
-    refetchBaseBalance as () => Promise<{
-      status: string;
-      data?: { value: bigint };
-    }>,
+    refetchBaseBalance,
     baseBaselineBalance,
     baseExpectedIncrease,
     "Base",
   );

481-484: Remove type assertion after fixing interface.

This type assertion is needed because refetchBaseBalance is typed as Promise<unknown> (line 320). Once the interface is updated to return the proper type, this cast should be removed.

After updating the interface at line 320, update this call site:

   const pollingResult = await pollEvmBalance(
-    refetchBaseBalance as () => Promise<{
-      status: string;
-      data?: { value: bigint };
-    }>,
+    refetchBaseBalance,
     baseBaselineBalance,
     baseExpectedIncrease,
     "Base",
   );
apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-step-item.tsx (3)

98-98: Remove internal key; set keys on the list item in the parent.

The key on an internal div is not used by React’s reconciliation for the list; the parent should pass key to .

-    <div key={id} className="flex gap-4">
+    <div className="flex gap-4">

18-18: Avoid duplicating StepStatus across files.

StepStatus is re-declared here and in the hook file. Extract to a shared types module (e.g., simple-bridge-types.ts) and import in both places to prevent drift.


35-53: Mark decorative icons as aria-hidden for accessibility.

Icons are purely visual; add aria-hidden to prevent noise for screen readers.

-    return <CheckCircle className="h-5 w-5 text-green-500" />;
+    return <CheckCircle aria-hidden="true" className="h-5 w-5 text-green-500" />;
-    return <Loader2 className="h-5 w-5 animate-spin text-blue-500" />;
+    return <Loader2 aria-hidden="true" className="h-5 w-5 animate-spin text-blue-500" />;
-    return <Clock className="h-5 w-5 text-yellow-500" />;
+    return <Clock aria-hidden="true" className="h-5 w-5 text-yellow-500" />;
-    return <AlertCircle className="h-5 w-5 text-red-500" />;
+    return <AlertCircle aria-hidden="true" className="h-5 w-5 text-red-500" />;
-    <Wallet className="h-4 w-4" />
+    <Wallet aria-hidden="true" className="h-4 w-4" />
-    <Clock className="h-4 w-4" />
+    <Clock aria-hidden="true" className="h-4 w-4" />
-            <AlertTriangle className="mt-0.5 h-4 w-4 flex-shrink-0 text-amber-600" />
+            <AlertTriangle aria-hidden="true" className="mt-0.5 h-4 w-4 flex-shrink-0 text-amber-600" />
-                <ExternalLink className="mr-1 h-3 w-3" />
+                <ExternalLink aria-hidden="true" className="mr-1 h-3 w-3" />
-                  <ExternalLink className="mr-1 h-3 w-3" />
+                  <ExternalLink aria-hidden="true" className="mr-1 h-3 w-3" />

Also applies to: 91-95, 132-133, 151-152, 180-181

apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts (4)

8-8: Centralize StepStatus to a shared type.

StepStatus is defined here and in the component file. Move it to simple-bridge-types.ts (or a new shared types module) and import in both to avoid divergence.


23-28: Add JSDoc for the exported hook.

Per repository coding guidelines, document TS/TSX exports with JSDoc.

As per coding guidelines

/**
 * Derives UI lifecycle steps (titles, statuses, metadata) for the Simple Bridge flow.
 *
 * @param direction Bridge direction ("base-to-native" | "native-to-base").
 * @param currentStep Current lifecycle phase (SimpleBridgeStep).
 * @param transactions Per-step tx metadata and status.
 * @param amount Display amount (e.g., "12.34").
 * @returns Ordered step descriptors powering the Transaction lifecycle UI.
 */
export function useTransactionLifecycleSteps(/* ... */) { /* ... */ }

10-21: Optionally propagate amount in steps to simplify consumers.

TransactionStepItem shows the amount in completed rows; ensure the step objects include it so mapping via {...step} provides the value.

 interface LifecycleStep {
   id: string;
   title: string;
   description: string;
   icon: React.ReactNode;
   status: StepStatus;
   estimatedTime?: string;
   txHash?: string;
   explorerUrl?: string;
   isSignatureRequired?: boolean;
   errorDetails?: string;
+  amount?: string;
 }
           {
             id: "step1-confirm",
             title: "Base Transaction Confirming",
             description: "Waiting for Base network confirmation",
             icon: null,
             status: getStepStatus("step1-confirm"),
             estimatedTime: "~1-2 minutes",
             txHash: step1Transaction?.txHash,
             explorerUrl: step1Transaction?.explorerUrl,
+            amount,
           },
           {
             id: "step2-confirm",
             title: "Withdrawal Confirming",
             description: "Waiting for Native Torus confirmation",
             icon: null,
             status: getStepStatus("step2-confirm"),
             estimatedTime: "~30-60 seconds",
             txHash: step2Transaction?.txHash,
             explorerUrl: step2Transaction?.explorerUrl,
+            amount,
           },
           {
             id: "step1-confirm",
             title: "Native Transaction Confirming",
             description: "Waiting for Native Torus confirmation",
             icon: null,
             status: getStepStatus("step1-confirm"),
             estimatedTime: "~30-60 seconds",
             txHash: step1Transaction?.txHash,
             explorerUrl: step1Transaction?.explorerUrl,
+            amount,
           },
           {
             id: "step2-confirm",
             title: "Base Transaction Confirming",
             description: "Waiting for Base network confirmation",
             icon: null,
             status: getStepStatus("step2-confirm"),
             estimatedTime: "~1-2 minutes",
             txHash: step2Transaction?.txHash,
             explorerUrl: step2Transaction?.explorerUrl,
+            amount,
           },

Also applies to: 196-199, 216-219, 236-240, 256-259


10-16: Icon field appears unused; trim if not needed.

If no consumer reads LifecycleStep.icon, drop it from the type and step definitions to reduce noise.

Also applies to: 178-221, 222-260

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 24e18f2 and d1484eb.

📒 Files selected for processing (8)
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx (1 hunks)
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-step-item.tsx (1 hunks)
  • apps/torus-bridge/src/app/simple/hooks/simple-bridge-chain-switch.ts (1 hunks)
  • apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts (1 hunks)
  • apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts (1 hunks)
  • packages/ui/src/components/apr/hooks.ts (2 hunks)
  • packages/ui/src/components/apr/use-reward-interval.ts (1 hunks)
  • packages/ui/src/components/input.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/torus-bridge/src/app/simple/hooks/simple-bridge-chain-switch.ts
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow docs/DOCUMENTATION_STYLE.md JSDoc conventions for all code documentation
Avoid top-level stateful singletons; use lazy initialization instead
For rustie enums, represent values as {VariantName: contents} and use rustie utilities (match, if_let) instead of switch/casts
Handle Result<T,E> from @torus-network/torus-utils/result via the [error, data] tuple pattern; do not use isOk/.success or try/catch for flow

Files:

  • packages/ui/src/components/apr/use-reward-interval.ts
  • packages/ui/src/components/input.tsx
  • apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-step-item.tsx
  • apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts
  • packages/ui/src/components/apr/hooks.ts
**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Access Drizzle entities via camelCase properties (e.g., permission.grantorKey), not snake_case

Files:

  • packages/ui/src/components/apr/use-reward-interval.ts
  • packages/ui/src/components/input.tsx
  • apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-step-item.tsx
  • apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts
  • packages/ui/src/components/apr/hooks.ts
🧠 Learnings (2)
📚 Learning: 2025-09-05T12:17:21.863Z
Learnt from: CR
PR: renlabs-dev/torus-ts#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T12:17:21.863Z
Learning: Applies to **/*.{ts,tsx} : Follow docs/DOCUMENTATION_STYLE.md JSDoc conventions for all code documentation

Applied to files:

  • apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts
📚 Learning: 2025-07-27T01:55:40.478Z
Learnt from: CR
PR: renlabs-dev/torus-ts#0
File: packages/torus-sdk-ts/src/chain/CLAUDE.md:0-0
Timestamp: 2025-07-27T01:55:40.478Z
Learning: Applies to packages/torus-sdk-ts/src/chain/**/*.{ts,tsx} : Document all exports with JSDoc comments.

Applied to files:

  • apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts
🧬 Code graph analysis (6)
packages/ui/src/components/apr/use-reward-interval.ts (3)
packages/torus-sdk-ts/src/chain/common/types.ts (1)
  • Api (8-8)
packages/torus-utils/src/typing.ts (1)
  • Nullish (8-8)
packages/query-provider/src/hooks.ts (2)
  • useLastBlock (106-116)
  • useRewardInterval (275-283)
packages/ui/src/components/input.tsx (1)
packages/ui/src/lib/utils.ts (1)
  • cn (5-7)
apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts (1)
apps/torus-bridge/src/app/simple/_components/simple-bridge-types.ts (2)
  • SimpleBridgeDirection (3-3)
  • SimpleBridgeTransaction (59-69)
apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-step-item.tsx (2)
packages/ui/src/components/accordion.tsx (4)
  • Accordion (57-57)
  • AccordionItem (57-57)
  • AccordionTrigger (57-57)
  • AccordionContent (57-57)
packages/ui/src/components/button.tsx (1)
  • Button (57-57)
apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts (8)
packages/torus-sdk-ts/src/types/address.ts (1)
  • SS58Address (37-37)
packages/torus-sdk-ts/src/chain/balances.ts (1)
  • transferAllowDeath (78-84)
apps/torus-bridge/src/app/simple/_components/simple-bridge-types.ts (1)
  • SimpleBridgeTransaction (59-69)
apps/torus-bridge/src/app/simple/hooks/simple-bridge-polling.ts (1)
  • pollEvmBalance (146-159)
packages/torus-utils/src/try-catch.ts (1)
  • tryAsync (97-101)
apps/torus-bridge/src/app/simple/hooks/simple-bridge-helpers.ts (5)
  • withTimeout (82-93)
  • TIMEOUT_CONFIG (66-69)
  • isUserRejectionError (100-117)
  • formatErrorForUser (149-241)
  • UserRejectedError (53-58)
packages/torus-sdk-ts/src/evm.ts (1)
  • convertH160ToSS58 (22-42)
apps/torus-bridge/src/app/simple/hooks/simple-bridge-chain-switch.ts (2)
  • switchChainWithRetry (48-144)
  • throwOnChainSwitchFailure (153-163)
packages/ui/src/components/apr/hooks.ts (3)
packages/torus-sdk-ts/src/chain/common/types.ts (1)
  • Api (8-8)
packages/torus-utils/src/typing.ts (1)
  • Nullish (8-8)
packages/query-provider/src/hooks.ts (5)
  • useTotalStake (265-273)
  • useTotalIssuance (120-128)
  • useRecyclingPercentage (301-309)
  • useTreasuryEmissionFee (155-163)
  • useIncentivesRatio (311-319)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (40)
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
🔇 Additional comments (10)
packages/ui/src/components/apr/use-reward-interval.ts (1)

19-74: LGTM!

The hook implementation correctly:

  • Uses API-driven hooks (useLastBlock, useRewardInterval) with proper null handling
  • Calculates time remaining based on block number and reward interval
  • Updates state with a countdown timer and proper cleanup
  • Formats and returns the time values as expected
packages/ui/src/components/apr/hooks.ts (4)

1-14: LGTM! Clean imports and proper client directive.

The "use client" directive is correctly placed for a React hook file, and all imports are well-organized with proper typing from the monorepo packages.


25-31: LGTM! Well-defined public interface.

The APRResult interface is properly typed and exported, providing a clear contract for consumers of the useAPR hook.


156-170: LGTM! BigInt zero handling correctly addressed.

The != null checks properly handle BigInt 0n values, ensuring valid zero values are not incorrectly marked as missing data.

✅ Previous review comment has been correctly addressed.


117-215: LGTM! Hook implementation is solid.

The hook correctly:

  • Accepts Api | Nullish parameter following the new architecture
  • Uses proper memoization with complete dependency arrays
  • Follows coding guidelines by using trySync for Result tuple pattern error handling
  • Returns a well-typed APRResult interface
packages/ui/src/components/input.tsx (1)

12-20: Well done addressing the previous review feedback!

The interface now properly extends React.HTMLAttributes<HTMLDivElement> and includes comprehensive JSDoc documentation. The implementation is clean and follows best practices.

apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts (3)

22-64: LGTM! Well-documented interface.

The interface has comprehensive JSDoc documentation that clearly describes its purpose and all parameters, following the coding guidelines.


66-203: LGTM! Robust transaction tracking with proper cleanup.

The function correctly uses AbortController to prevent late callbacks, properly removes event listeners on all exit paths, and delegates balance polling to the shared helper. The timeout handling and error paths are well-structured.


205-290: LGTM! Correct baseline calculation and precision handling.

The function properly captures and uses the refetch result for the baseline balance (lines 277-278) and avoids precision loss by passing the string amount directly to toNano (lines 228, 279).

apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts (1)

43-50: Good fix: keep sign substep completed when confirm fails.

The confirm-phase error now marks confirm as error and keeps sign completed. LGTM.

Also applies to: 60-67

…ling

- Replaced hardcoded gas fee values in `SimpleBridgeForm` with constants for better maintainability.
- Enhanced conditional rendering of amount display in `TransactionStepItem` to prevent rendering issues when amount is not available.
- Updated type handling for the `icon` property in `useTransactionLifecycleSteps` to use `ReactNode`.
- Added detailed JSDoc comments for the `Input` component and its read-only variant to improve documentation clarity.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (2)
apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx (2)

116-131: Improve low-balance fraction UX (clear input instead of “0”).

When balance ≤ reserve, clear the field and return. Avoid setting “0”.

   const handleFractionClick = useCallback(
     (fraction: number) => {
       if (direction === "base-to-native" && baseBalance) {
-        const maxAmount =
-          baseBalance > BASE_GAS_RESERVE ? baseBalance - BASE_GAS_RESERVE : 0n;
+        if (baseBalance <= BASE_GAS_RESERVE) {
+          setAmountFrom("");
+          return;
+        }
+        const maxAmount = baseBalance - BASE_GAS_RESERVE;
         const fractionNumerator = BigInt(Math.floor(fraction * 1_000_000));
         const fractionAmount = (maxAmount * fractionNumerator) / 1_000_000n;
         setAmountFrom(formatWeiToDecimalString(fractionAmount));
       } else if (direction === "native-to-base" && nativeBalance.data) {
-        const maxAmount =
-          nativeBalance.data > NATIVE_GAS_RESERVE
-            ? nativeBalance.data - NATIVE_GAS_RESERVE
-            : 0n;
+        if (nativeBalance.data <= NATIVE_GAS_RESERVE) {
+          setAmountFrom("");
+          return;
+        }
+        const maxAmount = nativeBalance.data - NATIVE_GAS_RESERVE;
         const fractionNumerator = BigInt(Math.floor(fraction * 1_000_000));
         const fractionAmount = (maxAmount * fractionNumerator) / 1_000_000n;
         setAmountFrom(formatWeiToDecimalString(fractionAmount));
       }
     },

389-395: Allow decimal input.

Add step="any" so browsers accept fractional amounts cleanly.

               <Input
                 type="number"
+                step="any"
                 value={amountFrom}
                 onChange={(e) => setAmountFrom(e.target.value)}
                 placeholder="0.00"
                 disabled={isTransferInProgress}
                 className="w-full"
🧹 Nitpick comments (6)
packages/ui/src/components/input.tsx (1)

84-85: Consider preventing tabIndex override when disabled.

The current implementation allows {...props} to override the tabIndex={disabled ? -1 : 0} default (line 84). This means a caller can pass tabIndex={0} and make a disabled component focusable, which may not be the intended behavior from an accessibility standpoint.

If stricter disabled behavior is desired, extract tabIndex from props and apply the disabled check:

-  ({ className, label, value, disabled, ...props }, ref) => {
+  ({ className, label, value, disabled, tabIndex, ...props }, ref) => {
     return (
       <div className="relative w-full">
         <div
           className={cn(
             "rounded-radius flex h-9 w-full items-center border border-border bg-field-background px-3 py-1 text-sm shadow-sm transition-colors",
             disabled && "cursor-not-allowed opacity-50",
             className,
           )}
           ref={ref}
           role="textbox"
           aria-readonly="true"
           aria-disabled={disabled}
-          tabIndex={disabled ? -1 : 0}
+          tabIndex={disabled ? -1 : (tabIndex ?? 0)}
           {...props}
         >

However, the current pattern (allowing overrides) is common in React component libraries and provides flexibility for edge cases, so this is optional.

apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts (2)

9-9: Remove unused "waiting" status.

The "waiting" variant isn’t produced anywhere; trim the union to tighten types.

-type StepStatus = "pending" | "active" | "completed" | "error" | "waiting";
+type StepStatus = "pending" | "active" | "completed" | "error";

24-29: Add JSDoc to the exported hook.

Document params/returns for consumers. As per coding guidelines.

+/**
+ * Derives UI lifecycle steps (sign/confirm per leg + success) with status mapping.
+ * @param direction Bridge direction.
+ * @param currentStep Orchestrator step enum.
+ * @param transactions Per-step tx info (status, hashes, errors).
+ * @param amount Human-readable amount string.
+ * @returns Lifecycle steps for rendering.
+ */
 export function useTransactionLifecycleSteps(

As per coding guidelines

apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx (3)

203-206: Use BigInt positivity checks (avoid parseFloat).

Avoid float parsing for correctness and consistency with BigInt flows.

-    if (!amountFrom) return false;
-    if (parseFloat(amountFrom) <= 0) return false;
+    if (!amountFrom) return false;
+    if (parseDecimalToBigInt(amountFrom) <= 0n) return false;
@@
-    if (!amountFrom) return "Enter Amount";
-    if (parseFloat(amountFrom) <= 0) return "Invalid Amount";
+    if (!amountFrom) return "Enter Amount";
+    if (parseDecimalToBigInt(amountFrom) <= 0n) return "Invalid Amount";
@@
-    if (!amountFrom || parseFloat(amountFrom) <= 0) return false;
+    if (!amountFrom || parseDecimalToBigInt(amountFrom) <= 0n) return false;

Also applies to: 224-226, 249-251


69-75: Remove unused resetTransfer destructure.

it’s never used; drop it.

   const {
     bridgeState,
     transactions,
     executeTransfer,
-    resetTransfer: _resetTransfer,
     retryFromFailedStep,
     isTransferInProgress,
   } = useOrchestratedTransfer();

312-324: Precision risk in TorusToUSD (Number(BigInt)).

The component converts BigInt to Number, risking precision loss for large balances; you now pass BigInt here. Consider updating TorusToUSD to format BigInt safely (string math) to keep USD display accurate.

Would you like me to open a PR to update packages/ui/components/apr/torus-to-usd.tsx to a BigInt-safe formatter?

Also applies to: 360-372

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d1484eb and 99f32f3.

📒 Files selected for processing (4)
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx (1 hunks)
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-step-item.tsx (1 hunks)
  • apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts (1 hunks)
  • packages/ui/src/components/input.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-step-item.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow docs/DOCUMENTATION_STYLE.md JSDoc conventions for all code documentation
Avoid top-level stateful singletons; use lazy initialization instead
For rustie enums, represent values as {VariantName: contents} and use rustie utilities (match, if_let) instead of switch/casts
Handle Result<T,E> from @torus-network/torus-utils/result via the [error, data] tuple pattern; do not use isOk/.success or try/catch for flow

Files:

  • apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx
  • packages/ui/src/components/input.tsx
**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Access Drizzle entities via camelCase properties (e.g., permission.grantorKey), not snake_case

Files:

  • apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx
  • packages/ui/src/components/input.tsx
🧬 Code graph analysis (3)
apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts (1)
apps/torus-bridge/src/app/simple/_components/simple-bridge-types.ts (2)
  • SimpleBridgeDirection (3-3)
  • SimpleBridgeTransaction (59-69)
apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx (10)
apps/torus-bridge/src/app/simple/_components/simple-bridge-types.ts (1)
  • SimpleBridgeDirection (3-3)
apps/torus-bridge/src/app/simple/hooks/use-simple-bridge-dual-wallet.ts (1)
  • useDualWallet (14-143)
apps/torus-bridge/src/app/simple/hooks/use-simple-bridge-orchestrated-transfer.ts (1)
  • useOrchestratedTransfer (35-534)
packages/query-provider/src/hooks.ts (2)
  • useFreeBalance (132-143)
  • useGetTorusPrice (464-505)
packages/torus-sdk-ts/src/types/address.ts (1)
  • SS58Address (37-37)
apps/torus-bridge/src/config.ts (1)
  • contractAddresses (39-48)
apps/torus-bridge/src/app/simple/_components/simple-bridge-dual-wallet-connector.tsx (1)
  • DualWalletConnector (18-155)
packages/ui/src/components/apr/torus-to-usd.tsx (1)
  • TorusToUSD (13-44)
apps/torus-bridge/src/app/simple/_components/simple-bridge-fraction-buttons.tsx (1)
  • FractionButtons (41-83)
apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-lifecycle-dialog.tsx (1)
  • TransactionLifecycleDialog (71-207)
packages/ui/src/components/input.tsx (1)
packages/ui/src/lib/utils.ts (1)
  • cn (5-7)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (100)
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: lint
🔇 Additional comments (4)
packages/ui/src/components/input.tsx (3)

4-11: LGTM!

The JSDoc documentation is complete and follows the coding guidelines, including the @internal tag and property documentation.


13-20: LGTM!

The JSDoc documentation clearly describes the interface purpose and extension pattern.


22-30: LGTM!

The interface correctly extends React.HTMLAttributes<HTMLDivElement> and BaseInputProps as recommended in previous reviews. The prop spreading on line 85 is now functional.

apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts (1)

44-56: Error-phase mapping fix looks good.

When errorPhase === "confirm", keeping the "-sign" substep as "completed" and marking "-confirm" as "error" is correct. Same for step1 and step2.

Also applies to: 62-74

- Updated `useTransactionLifecycleSteps` to include error details for each transaction step, improving error handling and user feedback.
- Corrected balance calculations in `SimpleBridgeForm` to ensure accurate display of amounts based on transaction direction.
- Added `aria-label` to the read-only input component for better accessibility compliance.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/ui/src/components/input.tsx (1)

32-54: Add JSDoc documentation for the Input component.

The Input component lacks JSDoc documentation, while InputReadonly has comprehensive documentation (lines 56-69). Per coding guidelines, all exported components must follow JSDoc conventions.

As per coding guidelines.

Apply this diff to add JSDoc:

+/**
+ * A customizable input field component with optional label support.
+ * Extends standard HTML input attributes with internal label display.
+ * 
+ * @param props - Props extending React.InputHTMLAttributes<HTMLInputElement> with optional label
+ * @param ref - Forwarded ref to the underlying input element
+ * @returns A styled input element with optional floating label
+ * 
+ * @example
+ * ```tsx
+ * <Input
+ *   type="text"
+ *   placeholder="Enter amount"
+ *   label="TORUS"
+ *   onChange={(e) => console.log(e.target.value)}
+ * />
+ * ```
+ */
 const Input = React.forwardRef<HTMLInputElement, InputProps>(
♻️ Duplicate comments (1)
apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx (1)

388-395: Add step="any" to allow decimal input.

Without the step attribute, some browsers reject fractional amounts or show native validation errors. Add step="any" to accept any decimal value cleanly.

Apply this diff:

               <Input
                 type="number"
+                step="any"
                 value={amountFrom}
                 onChange={(e) => setAmountFrom(e.target.value)}
                 placeholder="0.00"
                 disabled={isTransferInProgress}
                 className="w-full"
               />
🧹 Nitpick comments (3)
packages/ui/src/components/input.tsx (1)

22-30: Enhance JSDoc for consistency with InputProps.

The JSDoc for InputReadonlyProps is minimal compared to InputProps (lines 13-17). For consistency, document:

  • What the interface extends (React.HTMLAttributes<HTMLDivElement> and BaseInputProps)
  • Key properties (value, disabled)
  • Typical use cases

Apply this diff to improve documentation consistency:

 /**
- * Props for the InputReadonly component, which renders a read-only input-like display.
+ * Props for the InputReadonly component.
+ * Extends React.HTMLAttributes<HTMLDivElement> and BaseInputProps to provide
+ * a read-only input-like display with optional label support.
+ * Supports standard div properties (aria-*, data-*, etc.) plus value and disabled state.
  */
 export interface InputReadonlyProps
apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx (2)

33-59: Add JSDoc comments to helper functions.

Per the coding guidelines, all code should follow JSDoc conventions. Add documentation for formatWeiToDecimalString and parseDecimalToBigInt describing their parameters, return values, and edge case handling.

Example:

/**
 * Converts a BigInt wei amount to a human-readable decimal string.
 * @param amount - The amount in wei (smallest unit, 18 decimals)
 * @param decimals - Number of decimal places (default: 18)
 * @returns Decimal string representation without trailing zeros
 * @example formatWeiToDecimalString(1500000000000000000n) // "1.5"
 */
function formatWeiToDecimalString(amount: bigint, decimals = 18): string {
  // ... existing implementation
}

/**
 * Converts a decimal string to BigInt with 18 decimals precision.
 * @param amountStr - Decimal string (e.g., "1.5" or "0.000000000000000001")
 * @returns BigInt representation with 18 decimals, or 0n for invalid input
 * @example parseDecimalToBigInt("1.5") // 1500000000000000000n
 */
function parseDecimalToBigInt(amountStr: string): bigint {
  // ... existing implementation
}

Based on coding guidelines.


72-72: Remove unused resetTransfer destructuring.

The resetTransfer is aliased as _resetTransfer but never used in this component. Remove it to reduce unused variable noise.

Apply this diff:

   const {
     bridgeState,
     transactions,
     executeTransfer,
-    resetTransfer: _resetTransfer,
     retryFromFailedStep,
     isTransferInProgress,
   } = useOrchestratedTransfer();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 99f32f3 and 3040007.

📒 Files selected for processing (3)
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx (1 hunks)
  • apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts (1 hunks)
  • packages/ui/src/components/input.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Follow docs/DOCUMENTATION_STYLE.md JSDoc conventions for all code documentation
Avoid top-level stateful singletons; use lazy initialization instead
For rustie enums, represent values as {VariantName: contents} and use rustie utilities (match, if_let) instead of switch/casts
Handle Result<T,E> from @torus-network/torus-utils/result via the [error, data] tuple pattern; do not use isOk/.success or try/catch for flow

Files:

  • packages/ui/src/components/input.tsx
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx
**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Access Drizzle entities via camelCase properties (e.g., permission.grantorKey), not snake_case

Files:

  • packages/ui/src/components/input.tsx
  • apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx
🧬 Code graph analysis (2)
packages/ui/src/components/input.tsx (1)
packages/ui/src/lib/utils.ts (1)
  • cn (5-7)
apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx (7)
apps/torus-bridge/src/app/simple/_components/simple-bridge-types.ts (1)
  • SimpleBridgeDirection (3-3)
apps/torus-bridge/src/app/simple/hooks/use-simple-bridge-dual-wallet.ts (1)
  • useDualWallet (14-143)
packages/torus-provider/src/torus-provider.tsx (1)
  • useTorus (266-272)
packages/query-provider/src/hooks.ts (2)
  • useFreeBalance (132-143)
  • useGetTorusPrice (464-505)
packages/torus-sdk-ts/src/types/address.ts (1)
  • SS58Address (37-37)
apps/torus-bridge/src/config.ts (1)
  • contractAddresses (39-48)
apps/torus-bridge/src/app/simple/_components/simple-bridge-fraction-buttons.tsx (1)
  • FractionButtons (41-83)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (137)
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / clean-stale
  • GitHub Check: torus-wallet-pr-activate / clean-stale
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: typecheck
  • GitHub Check: lint
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / clean-stale
  • GitHub Check: torus-wallet-pr-activate / clean-stale
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: typecheck
  • GitHub Check: lint
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / clean-stale
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: typecheck
  • GitHub Check: lint
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: typecheck
  • GitHub Check: lint
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: typecheck
  • GitHub Check: lint
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: typecheck
  • GitHub Check: lint
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: typecheck
  • GitHub Check: lint
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: typecheck
  • GitHub Check: lint
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: lint
  • GitHub Check: torus-bridge-pr-activate / docker-build
  • GitHub Check: torus-allocator-pr-activate / docker-build
  • GitHub Check: torus-governance-pr-activate / docker-build
  • GitHub Check: torus-cache-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / clean-stale
  • GitHub Check: torus-page-pr-activate / docker-build
  • GitHub Check: prediction-swarm-dash-pr-activate / docker-build
  • GitHub Check: torus-portal-pr-activate / docker-build
  • GitHub Check: torus-wallet-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / docker-build
  • GitHub Check: torus-prophet-finder-pr-activate / clean-stale
  • GitHub Check: lint
🔇 Additional comments (1)
packages/ui/src/components/input.tsx (1)

85-86: Verify that user-provided tabIndex should override the disabled focus behavior.

The tabIndex is set before {...props}, allowing user-provided tabIndex values to override the disabled logic. This means when disabled={true}, a user could still pass tabIndex={0} to make the element focusable, potentially violating accessibility expectations that disabled elements should not be keyboard-accessible.

If this override behavior is unintentional, apply this diff to enforce the disabled state:

+        const computedTabIndex = disabled ? -1 : (props.tabIndex ?? 0);
+        const { tabIndex: _, ...restProps } = props;
+
         <div
           className={cn(
             "rounded-radius flex h-9 w-full items-center border border-border bg-field-background px-3 py-1 text-sm shadow-sm transition-colors",
             disabled && "cursor-not-allowed opacity-50",
             className,
           )}
           ref={ref}
           role="textbox"
           aria-readonly="true"
           aria-disabled={disabled}
           aria-label={label}
-          tabIndex={disabled ? -1 : 0}
-          {...props}
+          tabIndex={computedTabIndex}
+          {...restProps}
         >

Alternatively, if the override is intentional for flexibility, consider adding a JSDoc comment documenting this behavior.

@rodrigooler rodrigooler changed the title wip: change: Bridge - Enhance UX (web-353) add Simple Bridge UI with related hooks and configuration updates (web-353) Oct 13, 2025
@rodrigooler
Copy link
Collaborator Author

@coderabbitai generate docstrings

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

✅ Actions performed

Initiated docstring generation; will generate only if new commits exist.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #376

coderabbitai bot added a commit that referenced this pull request Oct 13, 2025
Docstrings generation was requested by @rodrigooler.

* #369 (comment)

The following files were modified:

* `apps/torus-bridge/src/app/_components/chains/chain-metadata.ts`
* `apps/torus-bridge/src/app/_components/select-action-dialog.tsx`
* `apps/torus-bridge/src/app/_components/shared/sidebar-links.tsx`
* `apps/torus-bridge/src/app/_components/shared/wallet-balance.tsx`
* `apps/torus-bridge/src/app/_components/tokens/token-list-modal.tsx`
* `apps/torus-bridge/src/app/_components/transfer-evm.tsx`
* `apps/torus-bridge/src/app/_components/transfer-token/_components/transfer-token-form.tsx`
* `apps/torus-bridge/src/app/_components/warp-core-config.ts`
* `apps/torus-bridge/src/app/layout.tsx`
* `apps/torus-bridge/src/app/simple/_components/simple-bridge-dual-wallet-connector.tsx`
* `apps/torus-bridge/src/app/simple/_components/simple-bridge-form.tsx`
* `apps/torus-bridge/src/app/simple/_components/simple-bridge-fraction-buttons.tsx`
* `apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-lifecycle-dialog.tsx`
* `apps/torus-bridge/src/app/simple/_components/simple-bridge-transaction-step-item.tsx`
* `apps/torus-bridge/src/app/simple/_components/simple-bridge.tsx`
* `apps/torus-bridge/src/app/simple/hooks/simple-bridge-base-to-native-flow.ts`
* `apps/torus-bridge/src/app/simple/hooks/simple-bridge-chain-switch.ts`
* `apps/torus-bridge/src/app/simple/hooks/simple-bridge-helpers.ts`
* `apps/torus-bridge/src/app/simple/hooks/simple-bridge-native-to-base-flow.ts`
* `apps/torus-bridge/src/app/simple/hooks/simple-bridge-polling.ts`
* `apps/torus-bridge/src/app/simple/hooks/use-simple-bridge-dual-wallet.ts`
* `apps/torus-bridge/src/app/simple/hooks/use-simple-bridge-orchestrated-transfer.ts`
* `apps/torus-bridge/src/app/simple/hooks/use-simple-bridge-shared-state.ts`
* `apps/torus-bridge/src/app/simple/hooks/use-transaction-lifecycle-steps.ts`
* `apps/torus-bridge/src/app/simple/page.tsx`
* `apps/torus-bridge/src/components/apr-bar-wrapper.tsx`
* `apps/torus-bridge/src/hooks/use-token-transfer.ts`
* `apps/torus-portal/src/app/(pages)/permissions/manage-permission/_components/edit-permission-fields/recipients-field.tsx`
* `apps/torus-portal/src/app/(pages)/permissions/manage-permission/_components/edit-permission-fields/streams-field.tsx`
* `apps/torus-portal/src/app/(pages)/permissions/manage-permission/_components/execute-wallet-fields/transfer-fields.tsx`
* `apps/torus-portal/src/app/(pages)/permissions/manage-permission/_components/execute-wallet-fields/unstake-fields.tsx`
* `apps/torus-wallet/src/app/layout.tsx`
* `apps/torus-wallet/src/app/staking/_components/staking-calculator/staking-calculator.tsx`
* `apps/torus-wallet/src/components/apr-bar-wrapper.tsx`
* `packages/query-provider/src/hooks.ts`
* `packages/ui/src/components/apr-bar/apr-bar-base.tsx`
* `packages/ui/src/components/apr-bar/apr-bar.tsx`
* `packages/ui/src/components/apr/apr-bar-client.tsx`
* `packages/ui/src/components/apr/hooks.ts`
* `packages/ui/src/components/apr/torus-to-usd.tsx`
* `packages/ui/src/components/apr/use-reward-interval.ts`
- Added `refetchBaseBalance` and `refetchNativeBalance` functions to improve balance accuracy during transfers in the Simple Bridge flows.
- Updated transaction lifecycle steps to capture baseline balances before sending transactions, ensuring accurate tracking of expected increases.
- Enhanced polling logic to accommodate unpredictable fees by introducing an `anyChange` option for balance checks.
- Refactored balance fetching logic in `useOrchestratedTransfer` to streamline data retrieval and improve readability.
- Added a new command `install-no-lockfile` to the justfile for installing dependencies without updating the lockfile.
- Updated various package versions in `pnpm-lock.yaml` to their latest compatible versions, including improvements to `@tanstack/react-query`, `@trpc/client`, and others for better performance and stability.
…e and portal components

- Updated various components to use optional chaining for better null safety, preventing potential runtime errors when accessing properties of possibly undefined objects.
- Changes made in `dao-applications-tab.tsx`, `agent-application-vote-card.tsx`, `page.tsx`, `2d-hypergraph/page.tsx`, `force-graph-2d.tsx`, and `graph-sheet-details-permission.tsx` to enhance code robustness.
…ion graph components

- Refactored conditional checks in `page.tsx`, `2d-hypergraph/page.tsx`, `force-graph-2d.tsx`, and `graph-sheet-details-permission.tsx` to enhance code clarity and maintainability.
- Updated optional chaining usage to eliminate unnecessary parentheses, improving overall code style.
- Updated the `install` command to conditionally check for the existence of `pnpm-lock.yaml`, allowing for installation without a lockfile if it does not exist.
- Improved the clarity of the installation process by ensuring that the appropriate flags are applied based on the presence of the lockfile.
EdSDR
EdSDR previously approved these changes Oct 22, 2025
- Corrected the indentation in the `install` command to ensure consistent formatting and improve readability.
- This change enhances the clarity of the script and aligns with standard coding practices.
- Updated the messages in `simple-bridge-transaction-lifecycle-dialog.tsx` and `use-transaction-lifecycle-steps.ts` to remove emojis, enhancing uniformity in the user interface.
- This change improves the clarity of the messages displayed during the transaction lifecycle steps.
- Introduced a new Fast Bridge page to streamline token transfers between Base and Native chains.
- Updated existing components and routes to support the new fast transfer option, enhancing user experience.
- Modified sidebar links and action dialogs to reflect the new Fast Bridge feature, ensuring consistency across the application.
- Added necessary hooks and state management for orchestrated transfers, improving the overall functionality of the bridge.
…dge app

- Replaced the existing Simple Bridge component with a new Fast Bridge component to enhance token transfer efficiency between Base and Native chains.
- Introduced new components including FastBridgeForm, DualWalletConnector, and TransactionLifecycleDialog to support the fast transfer process.
- Added hooks for orchestrated transfers and improved state management for transaction lifecycle steps.
- Updated routing and metadata generation to accommodate the new Fast Bridge feature, ensuring a seamless user experience.
- Added a redirect in `next.config.mjs` to automatically route users from the root path to the Fast Bridge page.
- Removed the manual redirect logic from the `HomePage` component, simplifying the code and improving maintainability.
- Removed the automatic redirection logic from `next.config.mjs`, streamlining the configuration.
- Updated the `HomePage` component to directly render the `FastBridgePage`, enhancing code clarity and maintainability.
- Changed routing paths in `select-action-dialog.tsx`, `transfer-evm.tsx`, `wallet-actions.tsx`, and `swap-chain-button.tsx` to use the `/standard` prefix instead of the root path.
- This update ensures consistent navigation behavior across the application, aligning with the new routing structure for the bridge functionality.
- Modified the `transfer-token-form.tsx` to utilize `usePathname` for constructing the routing path, ensuring the correct path is used when replacing the URL.
- This change enhances the navigation behavior by maintaining the current pathname while updating query parameters, improving user experience during token transfers.
@rodrigooler rodrigooler merged commit 9e59cbb into dev Oct 26, 2025
191 of 194 checks passed
@EdSDR EdSDR deleted the fix/web-353 branch November 12, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants