Skip to content

fix(withdraw): revert temporary IBC channel field type workaround#2938

Merged
CharlVS merged 3 commits intodevfrom
bugfix/ibc-channel-input
Jul 16, 2025
Merged

fix(withdraw): revert temporary IBC channel field type workaround#2938
CharlVS merged 3 commits intodevfrom
bugfix/ibc-channel-input

Conversation

@takenagain
Copy link
Copy Markdown
Contributor

@takenagain takenagain commented Jul 16, 2025

Reverts the temporary workaround in 80d2bc5

Changes the ibc_source_channel type from String to int and removes string-based validation

Summary by CodeRabbit

  • New Features

    • The IBC channel input field now only accepts numeric values and displays a simplified hint ("141").
  • Bug Fixes

    • Validation for the IBC channel has been simplified to only require non-empty input; format validation has been removed.
  • Refactor

    • The IBC channel input field has been streamlined for improved performance and reliability.
  • Style

    • Labels, hints, and error messages for the IBC channel input are now shown in English and are no longer localized.

@takenagain takenagain self-assigned this Jul 16, 2025
@takenagain takenagain added the bug Something isn't working label Jul 16, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 16, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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.

Walkthrough

The changes simplify the IBC channel input handling by removing format validation and only requiring the field to be non-empty. The translation file is updated accordingly, the input widget is refactored for simplicity, and the IBC channel is now parsed as an integer rather than a string.

Changes

File(s) Change Summary
assets/translations/en.json Removed IBC channel format and required validation messages; hint changed from "channel-141" to "141".
lib/bloc/withdraw_form/withdraw_form_bloc.dart Removed regex validation for IBC channel; now only checks for non-empty input.
lib/bloc/withdraw_form/withdraw_form_state.dart Changed IBC channel assignment from trimmed string to parsed integer (or null) in withdraw parameters.
lib/views/wallet/coin_details/withdraw_form/widgets/fill_form/fields/... Refactored IBC channel field: now a stateless widget, input restricted to digits, hardcoded labels/messages, simpler validation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant IbcChannelField
    participant WithdrawFormBloc
    participant WithdrawFormState

    User->>IbcChannelField: Enter IBC channel (digits only)
    IbcChannelField->>WithdrawFormBloc: onIbcChannelChanged(channel)
    WithdrawFormBloc->>WithdrawFormBloc: Check if channel is empty
    alt Channel is empty
        WithdrawFormBloc->>WithdrawFormState: Emit error "IBC channel is required"
    else Channel is not empty
        WithdrawFormBloc->>WithdrawFormState: Emit channel, clear error
    end
    WithdrawFormState->>WithdrawFormState: Parse channel as integer for parameters
Loading

Suggested labels

QA

Suggested reviewers

  • smk762

Poem

A channel once called "channel-141",
Now simply "141"—the work is done!
No more regex, just digits, neat—
Simpler code, a rabbit treat.
Fields refactored, errors few,
Hop along, the code feels new! 🐇✨


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@takenagain
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 16, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 16, 2025

Visit the preview URL for this PR (updated for commit 7dded73):

https://walletrc--pull-2938-merge-njib9hxn.web.app

(expires Wed, 23 Jul 2025 13:26:22 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

Copy link
Copy Markdown
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: 2

🧹 Nitpick comments (1)
lib/bloc/withdraw_form/withdraw_form_bloc.dart (1)

372-388: Consider adding basic numeric validation for better error handling.

The simplified validation only checks for empty input, but since the state layer uses int.tryParse(), invalid numeric input could result in a null value being passed to the API. Consider adding a basic numeric validation check to provide better user feedback.

 void _onIbcChannelChanged(
   WithdrawFormIbcChannelChanged event,
   Emitter<WithdrawFormState> emit,
 ) {
   if (event.channel.isEmpty) {
     emit(
       state.copyWith(
         ibcChannel: () => event.channel,
         ibcChannelError: () => TextError(error: 'Channel ID is required'),
       ),
     );
     return;
   }
+
+  // Validate that the input is numeric
+  if (int.tryParse(event.channel) == null) {
+    emit(
+      state.copyWith(
+        ibcChannel: () => event.channel,
+        ibcChannelError: () => TextError(error: 'Channel ID must be a number'),
+      ),
+    );
+    return;
+  }

   emit(
     state.copyWith(
       ibcChannel: () => event.channel,
       ibcChannelError: () => null,
     ),
   );
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95dc8d9 and 6a1ad0b.

⛔ Files ignored due to path filters (3)
  • lib/generated/codegen_loader.g.dart is excluded by !**/generated/**
  • packages/komodo_ui_kit/pubspec.lock is excluded by !**/*.lock
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • assets/translations/en.json (1 hunks)
  • lib/bloc/withdraw_form/withdraw_form_bloc.dart (1 hunks)
  • lib/bloc/withdraw_form/withdraw_form_state.dart (1 hunks)
  • lib/views/wallet/coin_details/withdraw_form/widgets/fill_form/fields/fields.dart (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
lib/views/wallet/coin_details/withdraw_form/widgets/fill_form/fields/fields.dart (3)
Learnt from: takenagain
PR: KomodoPlatform/komodo-wallet#2566
File: lib/bloc/coins_bloc/coins_bloc.dart:10-10
Timestamp: 2025-04-01T15:51:37.060Z
Learning: In the Komodo Wallet project, part files share imports with their parent files. The import for `app_config.dart` in `coins_bloc.dart` is necessary because the part file `coins_state.dart` uses `excludedAssetList` from that package.
Learnt from: takenagain
PR: KomodoPlatform/komodo-wallet#2566
File: lib/bloc/coins_bloc/coins_bloc.dart:10-10
Timestamp: 2025-04-01T15:51:37.060Z
Learning: The `excludedAssetList` from `app_config.dart` is used in the `_filterExcludedAssets` method in `coins_state.dart`. Since `coins_state.dart` is a part file of `coins_bloc.dart`, the import needs to be in the parent file even though it's not directly used there. In Dart, part files share the namespace and imports of their parent files.
Learnt from: takenagain
PR: KomodoPlatform/komodo-wallet#2608
File: lib/bloc/fiat/fiat_onramp_form/fiat_form_bloc.dart:2-3
Timestamp: 2025-05-01T21:00:36.970Z
Learning: It's acceptable to use unconditional `dart:io` imports in the Komodo wallet codebase when the usage is guarded by `!kIsWeb` conditional checks that prevent the platform-specific code from being executed in web environments.
⏰ 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). (11)
  • GitHub Check: Build Desktop (linux)
  • GitHub Check: unit_tests
  • GitHub Check: Build Desktop (macos)
  • GitHub Check: Build Desktop (windows)
  • GitHub Check: validate_code_guidelines
  • GitHub Check: Test web-app-linux-profile
  • GitHub Check: Build Mobile (iOS)
  • GitHub Check: Test web-app-macos
  • GitHub Check: Build Mobile (Android)
  • GitHub Check: build_and_preview
  • GitHub Check: build-android-docker
🔇 Additional comments (4)
assets/translations/en.json (1)

687-687: LGTM: Hint text updated to match numeric-only input format.

The change from "channel-141" to "141" aligns with the simplified IBC channel input that now accepts only digits, removing the need for the "channel-" prefix.

lib/bloc/withdraw_form/withdraw_form_state.dart (1)

189-189: LGTM: Correctly implements the revert to integer type for IBC channel.

The change from a trimmed string to int.tryParse(ibcChannel!.trim()) properly converts the input to an integer while handling parsing failures gracefully by returning null.

lib/views/wallet/coin_details/withdraw_form/widgets/fill_form/fields/fields.dart (2)

6-6: LGTM: Appropriate import added for input filtering.

The import for FilteringTextInputFormatter is correctly added to support the digits-only input restriction.


583-588: LGTM: Widget simplification improves performance.

The refactor from StatefulWidget to StatelessWidget with BlocBuilder is a good architectural improvement that reduces complexity and improves performance.

@takenagain takenagain marked this pull request as ready for review July 16, 2025 13:28
@takenagain takenagain requested review from CharlVS and smk762 July 16, 2025 13:28
@takenagain takenagain added the QA Ready for QA Testing label Jul 16, 2025
Copy link
Copy Markdown
Collaborator

@smk762 smk762 left a comment

Choose a reason for hiding this comment

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

Successful IBC transfer confirmed sent from ATOM -> ATOM-OSMO_IBC (we need to add this to the coins file!)

@CharlVS CharlVS merged commit 2c2b59d into dev Jul 16, 2025
9 of 14 checks passed
@takenagain takenagain deleted the bugfix/ibc-channel-input branch September 11, 2025 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working QA Ready for QA Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants