Skip to content

Conversation

@findolor
Copy link
Collaborator

@findolor findolor commented Dec 25, 2025

Dependent PRs

Motivation

See issues:

Token selection in the UI currently shows only text-based information. Adding logo support improves the visual experience and makes it easier for users to identify tokens at a glance.

Solution

Added optional logo_uri field throughout the token configuration pipeline:

SDK:

  • Added logo_uri: Option<Url> to TokenCfg struct with YAML parsing support (logo-uri field)
  • Added logo_uri to remote Token struct, parsing logoURI from Uniswap-format token lists
  • Exposed logoUri (camelCase) in TokenInfo for JavaScript/TypeScript consumption

UI:

  • Updated TokenSelectionModal to display token logos when available
  • Implemented fallback to symbol initials (first 2 characters) when no logo is provided
  • Added error handling to gracefully fall back to initials when an image fails to load (404, etc.)

Testing:

  • Added tests for YAML logo-uri parsing and validation
  • Added tests verifying logoURI is correctly fetched from remote token lists
  • Added UI component tests for logo display, fallback behavior, and image error handling
Screenshot 2025-12-25 at 11 11 06

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

fix #2107

Summary by CodeRabbit

  • New Features
    • Token logos can now be displayed in selection interfaces when available. The UI automatically falls back to symbol initials if a logo is unavailable or fails to load.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 25, 2025

Walkthrough

Adds logoUri support across the token information pipeline. Introduces optional logo_uri field to TokenCfg, Token, and TokenInfo structures. Propagates logo_uri from remote token definitions and YAML configuration through GUI token assembly. Updates UI component to render logos with fallback to symbol initials on load failure.

Changes

Cohort / File(s) Summary
Token Configuration & Parsing
crates/settings/src/token.rs
Added logo_uri: Option<Url> field with URL parsing during YAML deserialization; includes error handling for invalid URLs, equality comparison, default initialization, and tsify bindings.
Token Configuration & Parsing
crates/common/src/add_order.rs, crates/settings/src/test.rs, crates/settings/src/yaml/cache.rs, crates/settings/src/yaml/context.rs
Updated test helpers and TokenCfg initializations to populate logo_uri: None.
Remote Token Definitions
crates/settings/src/remote/tokens.rs
Added logo_uri: Option<Url> field to Token struct with serde rename to "logoURI" and default; propagated logo_uri into TokenCfg during token conversion.
Remote Token Definitions
crates/settings/src/remote_tokens.rs
Added support for parsing optional logoURI from remote token JSON into logo_uri: Option<Url> field.
GUI & API Token Information
crates/js_api/src/gui/mod.rs
Extended TokenInfo struct with logo_uri: Option<Url> field; added Url import; populated logo_uri from token data in both direct and fallback token-info retrieval paths.
GUI & API Token Information
crates/js_api/src/gui/select_tokens.rs
Propagated logo_uri from token configuration to TokenInfo in both direct and asynchronously-fetched token assembly paths.
UI Component
packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
Introduced failedImages state to track logo load failures; conditionally render logo image or fallback placeholder with symbol initials based on logoUri availability and load status.
UI Component
packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
Added logoUri property to mock token data; introduced test cases for logo display, image load error handling, and fallback behavior.
Test Data & Fixtures
packages/orderbook/test/js_api/gui.test.ts
Updated remote tokens fixture with logoURI entries for test tokens; revised deployment keys and test assertions to verify logoUri presence and absence in token data.
Test Data & Fixtures
crates/js_api/src/gui/state_management.rs
Updated SERIALIZED_STATE constant to reflect new token structure with logo_uri field.

Sequence Diagram

sequenceDiagram
    participant YAML as YAML<br/>Config
    participant TokenCfg as TokenCfg
    participant Remote as Remote<br/>Token Source
    participant GUI as GUI Token<br/>Assembly
    participant TokenInfo as TokenInfo
    participant UI as UI Component

    rect rgb(240, 248, 255)
    note over YAML,TokenCfg: Token Config Path
    YAML->>TokenCfg: Parse logo-uri field<br/>(Url::parse)
    TokenCfg->>TokenCfg: Validate URL or error
    end

    rect rgb(240, 248, 255)
    note over Remote,TokenCfg: Remote Token Path
    Remote->>TokenCfg: Fetch remote token<br/>with logoURI
    TokenCfg->>TokenCfg: Set logo_uri field
    end

    rect rgb(240, 248, 255)
    note over TokenCfg,TokenInfo: GUI Assembly
    TokenCfg->>GUI: Provide token config
    GUI->>TokenInfo: Assemble token info<br/>with logo_uri
    end

    rect rgb(240, 248, 255)
    note over TokenInfo,UI: UI Rendering
    TokenInfo->>UI: Return token with logoUri
    alt logoUri present and valid
        UI->>UI: Render logo image
        UI->>UI: on:error → Add to failedImages
    else logoUri missing or load failed
        UI->>UI: Render fallback<br/>(symbol initials)
    end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

rust, webapp, test

Suggested reviewers

  • 0xgleb
  • hardyjosh

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add token logo URI support' clearly and concisely summarizes the main change—introducing logo URI functionality across the token system.
Linked Issues check ✅ Passed The PR fully implements the requirements from issue #2107 by adding logoUri to TokenInfo, supporting tokenlist logoUri field in token representations, and exposing it in gui.getAllTokens.
Out of Scope Changes check ✅ Passed All changes are directly related to adding logo URI support. Changes include token configuration, YAML parsing, remote token list handling, and UI display—all aligned with the linked issue requirements.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2025-12-25-token-logo-uri

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f716241 and 37373f9.

📒 Files selected for processing (13)
  • crates/common/src/add_order.rs
  • crates/js_api/src/gui/mod.rs
  • crates/js_api/src/gui/select_tokens.rs
  • crates/js_api/src/gui/state_management.rs
  • crates/settings/src/remote/tokens.rs
  • crates/settings/src/remote_tokens.rs
  • crates/settings/src/test.rs
  • crates/settings/src/token.rs
  • crates/settings/src/yaml/cache.rs
  • crates/settings/src/yaml/context.rs
  • packages/orderbook/test/js_api/gui.test.ts
  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
  • packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
🧰 Additional context used
📓 Path-based instructions (11)
crates/**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

crates/**/*.rs: For Rust crates in crates/*, run lints using nix develop -c cargo clippy --workspace --all-targets --all-features -D warnings
For Rust crates in crates/*, run tests using nix develop -c cargo test --workspace or --package <crate>

Files:

  • crates/common/src/add_order.rs
  • crates/settings/src/yaml/cache.rs
  • crates/settings/src/test.rs
  • crates/js_api/src/gui/mod.rs
  • crates/settings/src/remote/tokens.rs
  • crates/js_api/src/gui/select_tokens.rs
  • crates/js_api/src/gui/state_management.rs
  • crates/settings/src/remote_tokens.rs
  • crates/settings/src/token.rs
  • crates/settings/src/yaml/context.rs
**/crates/**

📄 CodeRabbit inference engine (AGENTS.md)

Rust workspace organized as crates/* with subdirectories: cli, common, bindings, js_api, quote, subgraph, settings, math, integration_tests

Files:

  • crates/common/src/add_order.rs
  • crates/settings/src/yaml/cache.rs
  • crates/settings/src/test.rs
  • crates/js_api/src/gui/mod.rs
  • crates/settings/src/remote/tokens.rs
  • crates/js_api/src/gui/select_tokens.rs
  • crates/js_api/src/gui/state_management.rs
  • crates/settings/src/remote_tokens.rs
  • crates/settings/src/token.rs
  • crates/settings/src/yaml/context.rs
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Rust: format code with nix develop -c cargo fmt --all
Rust: lint with nix develop -c rainix-rs-static (preconfigured flags included)
Rust: crates and modules use snake_case; types use PascalCase

Files:

  • crates/common/src/add_order.rs
  • crates/settings/src/yaml/cache.rs
  • crates/settings/src/test.rs
  • crates/js_api/src/gui/mod.rs
  • crates/settings/src/remote/tokens.rs
  • crates/js_api/src/gui/select_tokens.rs
  • crates/js_api/src/gui/state_management.rs
  • crates/settings/src/remote_tokens.rs
  • crates/settings/src/token.rs
  • crates/settings/src/yaml/context.rs
packages/ui-components/**/*.{svelte,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

For UI components (packages/ui-components), run lints and format checks using nix develop -c npm run svelte-lint-format-check -w @rainlanguage/ui-components

Files:

  • packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
packages/{webapp,ui-components}/**/*.{svelte,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

If you modify frontend code or functionality affecting the frontend, you MUST provide a screenshot of the built webapp reflecting your change.

Files:

  • packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
packages/**/*.{js,ts,svelte}

📄 CodeRabbit inference engine (AGENTS.md)

JavaScript/Svelte organized as packages/* including webapp, ui-components, and orderbook (wasm wrapper published to npm)

Files:

  • packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
  • packages/orderbook/test/js_api/gui.test.ts
**/*.{ts,tsx,svelte}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,svelte}: TypeScript/Svelte: format with nix develop -c npm run format
TypeScript/Svelte: lint with nix develop -c npm run lint
TypeScript/Svelte: type-check with nix develop -c npm run check

Files:

  • packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
  • packages/orderbook/test/js_api/gui.test.ts
**/*.svelte

📄 CodeRabbit inference engine (AGENTS.md)

Svelte components should use PascalCase.svelte naming convention; other files use kebab or snake case as appropriate

Files:

  • packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
packages/ui-components/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

For UI components (packages/ui-components), run tests using nix develop -c npm run test -w @rainlanguage/ui-components

Files:

  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
**/*.{test,spec}.ts

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript/Svelte: run tests with nix develop -c npm run test (Vitest). Name test files *.test.ts or *.spec.ts

Files:

  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
  • packages/orderbook/test/js_api/gui.test.ts
packages/orderbook/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

packages/orderbook/**/*.{ts,tsx,js,jsx}: For Orderbook TypeScript (packages/orderbook), run lints using nix develop -c npm run check -w @rainlanguage/orderbook
For Orderbook TypeScript (packages/orderbook), run tests using nix develop -c npm run test -w @rainlanguage/orderbook

Files:

  • packages/orderbook/test/js_api/gui.test.ts
🧠 Learnings (32)
📚 Learning: 2025-07-11T06:40:49.511Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1983
File: crates/js_api/src/gui/mod.rs:964-1199
Timestamp: 2025-07-11T06:40:49.511Z
Learning: In crates/js_api/src/gui/mod.rs tests, findolor prefers to keep large hardcoded YAML strings (like the validation test YAML) inline in the test file rather than extracting them to separate external files for maintainability purposes.

Applied to files:

  • crates/settings/src/yaml/cache.rs
  • crates/js_api/src/gui/state_management.rs
📚 Learning: 2025-07-10T12:52:47.468Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1925
File: packages/ui-components/src/lib/errors/DeploymentStepsError.ts:16-16
Timestamp: 2025-07-10T12:52:47.468Z
Learning: In packages/ui-components/src/lib/errors/DeploymentStepsError.ts, the error codes NO_SELECT_TOKENS ('Error loading tokens') and NO_AVAILABLE_TOKENS ('Error loading available tokens') represent different failure scenarios in the token loading workflow and should remain as separate error codes.

Applied to files:

  • packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-07-29T12:30:44.350Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2045
File: packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte:52-59
Timestamp: 2025-07-29T12:30:44.350Z
Learning: In packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte, the bind:this approach doesn't work for auto-focusing the Flowbite Input component when the modal opens, requiring the use of document.querySelector('.token-search-input') instead as a working solution.

Applied to files:

  • packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
📚 Learning: 2025-06-18T16:44:14.948Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1925
File: packages/ui-components/src/lib/components/deployment/SelectToken.svelte:137-151
Timestamp: 2025-06-18T16:44:14.948Z
Learning: In the SelectToken.svelte component, the SDK validates addresses before making RPC calls, so calling saveTokenSelection on every keystroke in handleInput doesn't result in network calls until there's a full valid address.

Applied to files:

  • packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte
📚 Learning: 2025-05-19T13:40:56.080Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1858
File: crates/subgraph/src/orderbook_client/mod.rs:54-58
Timestamp: 2025-05-19T13:40:56.080Z
Learning: The `wasm_bindgen_utils` crate in the Rain Orderbook project handles conditional compilation for `JsValue` and `JsError` internally, allowing `impl From<Error> for JsValue` to work on non-WASM targets without explicit cfg guards.

Applied to files:

  • crates/js_api/src/gui/mod.rs
  • crates/settings/src/token.rs
📚 Learning: 2025-08-01T09:07:20.383Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2044
File: packages/orderbook/README.md:186-189
Timestamp: 2025-08-01T09:07:20.383Z
Learning: In the rainlanguage/rain.orderbook project, Rust methods on structs like RaindexVaultsList are exported as JavaScript getters in WASM bindings using #[wasm_bindgen(getter)]. This means while the Rust code uses method calls like items(), the JavaScript/WASM API exposes them as property access like .items. The README.md correctly documents the JavaScript API surface, not the Rust implementation details.

Applied to files:

  • crates/js_api/src/gui/mod.rs
📚 Learning: 2025-05-14T05:51:50.277Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1715
File: crates/js_api/src/common/mod.rs:55-59
Timestamp: 2025-05-14T05:51:50.277Z
Learning: In the Rain Orderbook project, the error handling for WASM exported functions uses WasmEncodedError which includes both the original error message and a human-readable version, making direct modification of the JsValue conversion unnecessary.

Applied to files:

  • crates/js_api/src/gui/mod.rs
📚 Learning: 2025-08-01T07:35:13.418Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2036
File: crates/js_api/src/filters/errors.rs:39-46
Timestamp: 2025-08-01T07:35:13.418Z
Learning: In the Rain Orderbook project's PersistentFilterStoreError (crates/js_api/src/filters/errors.rs), the Display implementation already provides user-friendly error messages, so using err.to_string() for both msg and readable_msg in the WasmEncodedError conversion is appropriate and doesn't require separate readable message handling.

Applied to files:

  • crates/js_api/src/gui/mod.rs
📚 Learning: 2025-04-07T09:51:52.614Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1483
File: crates/settings/src/remote_tokens.rs:32-57
Timestamp: 2025-04-07T09:51:52.614Z
Learning: The implementation for remote token fetching in `crates/settings/src/remote_tokens.rs` does not include explicit timeouts/retries, as the team considers the current implementation sufficient for now.

Applied to files:

  • crates/settings/src/remote/tokens.rs
  • crates/settings/src/remote_tokens.rs
📚 Learning: 2025-06-18T19:23:33.747Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1938
File: crates/settings/src/yaml/mod.rs:176-178
Timestamp: 2025-06-18T19:23:33.747Z
Learning: In crates/settings/src/yaml/mod.rs, the YamlError enum has two distinct error variants: `KeyNotFound(String)` for when a specific YAML key is not found in a hash/map, and `NotFound(String)` for when other types of entities (like networks, orderbooks, etc.) are not found in the configuration. These serve different purposes and should not be consolidated.

Applied to files:

  • crates/settings/src/remote/tokens.rs
  • crates/settings/src/token.rs
📚 Learning: 2025-10-27T09:17:38.145Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2270
File: crates/settings/src/local_db_remotes.rs:107-212
Timestamp: 2025-10-27T09:17:38.145Z
Learning: In the rain.orderbook codebase using strict_yaml_rust, all YAML keys are treated as strings, including numeric literals. Numeric keys like `123` are automatically coerced to strings and are valid, so they don't need error-case testing for non-string keys.

Applied to files:

  • crates/settings/src/remote/tokens.rs
📚 Learning: 2025-07-09T14:00:12.206Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1975
File: crates/js_api/src/gui/state_management.rs:412-412
Timestamp: 2025-07-09T14:00:12.206Z
Learning: In crates/js_api/src/gui/state_management.rs tests, findolor prefers to keep hard-coded serialized state constants (like SERIALIZED_STATE) rather than dynamically generating them, even when it may make tests more brittle to maintain.

Applied to files:

  • crates/js_api/src/gui/state_management.rs
  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-09-24T10:59:25.666Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2163
File: crates/js_api/src/gui/state_management.rs:196-203
Timestamp: 2025-09-24T10:59:25.666Z
Learning: In crates/js_api/src/gui/state_management.rs, the RainMetaDocumentV1Item::hash(false) method returns a slice, so wrapping the result with FixedBytes() is necessary to convert it to the expected FixedBytes type for DotrainGuiStateV1.dotrain_hash field.

Applied to files:

  • crates/js_api/src/gui/state_management.rs
📚 Learning: 2025-07-31T19:34:11.716Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2044
File: crates/common/src/raindex_client/vaults_list.rs:363-423
Timestamp: 2025-07-31T19:34:11.716Z
Learning: In the rainlanguage/rain.orderbook project, for WASM-exposed functionality like VaultsList, the team prefers to keep comprehensive tests in the non-WASM environment due to the complexity of recreating objects like RaindexVaults in WASM. WASM tests focus on basic functionality and error cases since the WASM code reuses the already-tested non-WASM implementation.

Applied to files:

  • crates/js_api/src/gui/state_management.rs
📚 Learning: 2025-08-02T03:55:25.215Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2036
File: packages/orderbook/test/js_api/filters.test.ts:19-36
Timestamp: 2025-08-02T03:55:25.215Z
Learning: In the rainlanguage/rain.orderbook project's WASM tests, the pattern of chaining `.value!` calls on WASM result types (like from VaultsFilterBuilder methods) is the established and preferred approach for handling WASM results, and should not be refactored into intermediate variables as it would add unnecessary verbosity without improving the code.

Applied to files:

  • crates/js_api/src/gui/state_management.rs
📚 Learning: 2025-04-30T09:28:36.960Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1715
File: crates/js_api/src/common/mod.rs:111-118
Timestamp: 2025-04-30T09:28:36.960Z
Learning: In the rain.orderbook repository, the WASM tests are already properly configured with conditional compilation using `#[cfg(target_family = "wasm")]` and `#[cfg(not(target_family = "wasm"))]`, and don't require additional `wasm_bindgen_test_configure!(run_in_browser)` directives.

Applied to files:

  • crates/js_api/src/gui/state_management.rs
📚 Learning: 2025-07-09T12:35:45.699Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1974
File: packages/ui-components/src/__tests__/DeploymentSteps.test.ts:123-126
Timestamp: 2025-07-09T12:35:45.699Z
Learning: In packages/ui-components/src/__tests__/DeploymentSteps.test.ts, findolor prefers to keep mock initializations (like setSelectToken) in individual test cases rather than consolidating them into shared beforeEach blocks, even when it results in duplication.

Applied to files:

  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-09-02T08:04:44.814Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2117
File: packages/ui-components/src/__tests__/VaultIdInformation.test.ts:9-13
Timestamp: 2025-09-02T08:04:44.814Z
Learning: In packages/ui-components/src/__tests__/VaultIdInformation.test.ts and similar test files in the rain.orderbook project, the passthrough vi.mock('rainlanguage/orderbook', async (importOriginal) => { return { ...(await importOriginal()) }; }); block is required for tests to run properly, even when not overriding any exports. This is needed due to the specific Vitest configuration or test environment setup in the project.

Applied to files:

  • packages/ui-components/src/__tests__/TokenSelectionModal.test.ts
  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-03-28T10:09:10.696Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1463
File: crates/settings/src/yaml/context.rs:298-304
Timestamp: 2025-03-28T10:09:10.696Z
Learning: In the `resolve_token_path` method of the Context implementation in `crates/settings/src/yaml/context.rs`, when an unknown property is accessed on a token, it returns a `ContextError::InvalidPath` error, not a `ContextError::PropertyNotFound` error.

Applied to files:

  • crates/settings/src/token.rs
  • crates/settings/src/yaml/context.rs
📚 Learning: 2025-05-14T05:13:59.713Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1744
File: crates/subgraph/src/orderbook_client.rs:44-46
Timestamp: 2025-05-14T05:13:59.713Z
Learning: In the rain.orderbook project, WASM dependencies are intentionally made available in non-WASM targets to facilitate testing of WASM-related functionality, so conditional compilation guards like `#[cfg(target_family = "wasm")]` should not be added to imports or implementations that may be needed for tests.

Applied to files:

  • crates/settings/src/token.rs
📚 Learning: 2025-06-04T10:21:01.388Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1907
File: packages/orderbook/test/common/test.test.ts:75-77
Timestamp: 2025-06-04T10:21:01.388Z
Learning: The DotrainOrder.create API in packages/orderbook/test/common/test.test.ts is internal and not used directly in consumer applications, so API changes here don't require external breaking change documentation.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-04-08T12:53:12.526Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1588
File: packages/orderbook/test/js_api/gui.test.ts:2037-2057
Timestamp: 2025-04-08T12:53:12.526Z
Learning: In the remote network test for gui.test.ts, asserting that getCurrentDeployment() succeeds is sufficient validation that remote networks were properly fetched, as this operation would fail if the networks weren't correctly processed.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-08-15T20:56:15.592Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 1978
File: packages/webapp/src/routes/deploy/[orderName]/[deploymentKey]/fullDeployment.test.ts:22-29
Timestamp: 2025-08-15T20:56:15.592Z
Learning: In packages/webapp/src/routes/deploy/[orderName]/[deploymentKey]/fullDeployment.test.ts, brusherru prefers fail-fast testing approaches where type mismatches cause immediate test failures to alert developers about interface changes, rather than using defensive programming with type guards that might mask API evolution.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-06-18T16:42:40.608Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1925
File: packages/ui-components/src/lib/components/deployment/DeploymentSteps.svelte:87-104
Timestamp: 2025-06-18T16:42:40.608Z
Learning: In the orderbook UI components, changing deployments or networks requires page navigation, which automatically remounts components and refreshes data like available tokens. No additional refresh logic is needed for deployment/network changes.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-06-10T12:04:54.107Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1916
File: packages/ui-components/src/lib/__fixtures__/settings-12-11-24.json:182-195
Timestamp: 2025-06-10T12:04:54.107Z
Learning: In test fixture files like `packages/ui-components/src/lib/__fixtures__/settings-12-11-24.json`, network configuration inconsistencies (such as matchain using Polygon's RPC, chainId, and currency while having its own network key) are acceptable since they are used for testing purposes only.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-07-17T10:35:09.329Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1996
File: packages/webapp/src/routes/deploy/[strategyName]/[deploymentKey]/fullDeployment.test.ts:303-303
Timestamp: 2025-07-17T10:35:09.329Z
Learning: In packages/webapp/src/routes/deploy/[strategyName]/[deploymentKey]/fullDeployment.test.ts, findolor is fine with hardcoded 2-second delays using setTimeout in test cases for waiting after token selection, preferring this approach over deterministic waiting patterns.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-07-11T08:46:07.606Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1925
File: packages/ui-components/src/__tests__/DeploymentSteps.test.ts:519-554
Timestamp: 2025-07-11T08:46:07.606Z
Learning: In packages/ui-components/src/__tests__/DeploymentSteps.test.ts, findolor prefers to keep hardcoded timeout values (like 50ms and 100ms) inline in test cases rather than extracting them to named constants, viewing such refactoring as unnecessary for test maintainability.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-06-16T10:49:47.770Z
Learnt from: thedavidmeister
Repo: rainlanguage/rain.orderbook PR: 1926
File: test/concrete/ob/OrderBook.clear.zeroAmount.t.sol:24-32
Timestamp: 2025-06-16T10:49:47.770Z
Learning: LibTestAddOrder.conformConfig() in test/util/lib/LibTestAddOrder.sol automatically constrains OrderConfigV3 to prevent common test failures by ensuring validInputs[0].token != validOutputs[0].token, setting them to address(0) and address(1) respectively if they're equal. This prevents TokenSelfTrade errors in fuzz tests.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-03-31T10:16:53.544Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1469
File: packages/ui-components/src/__tests__/CodeMirrorDotrain.test.ts:75-98
Timestamp: 2025-03-31T10:16:53.544Z
Learning: In the rainlanguage/rain.orderbook project, direct manipulation of Svelte's internal state (component.$$.ctx) in tests is an acceptable approach for testing component behavior, as demonstrated in the CodeMirrorDotrain tests.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-08-14T18:29:32.933Z
Learnt from: brusherru
Repo: rainlanguage/rain.orderbook PR: 2083
File: packages/ui-components/src/__tests__/VaultsListTable.test.ts:16-19
Timestamp: 2025-08-14T18:29:32.933Z
Learning: In the rain.orderbook project's UI components tests, mocking hooks like useToasts is often required as infrastructure even when not directly asserting on their calls, because components internally depend on these hooks. Removing such mocks would break component rendering in tests and require more complex test setup with providers.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-07-17T10:35:53.182Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1996
File: packages/webapp/src/routes/deploy/[strategyName]/[deploymentKey]/fullDeployment.test.ts:172-172
Timestamp: 2025-07-17T10:35:53.182Z
Learning: In packages/webapp/src/routes/deploy/[strategyName]/[deploymentKey]/fullDeployment.test.ts, findolor is comfortable with hardcoded 2-second delays using setTimeout after token selection elements appear, preferring this approach over deterministic waiting patterns with waitFor.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
📚 Learning: 2025-04-29T11:17:46.178Z
Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1687
File: crates/js_api/src/gui/order_operations.rs:470-489
Timestamp: 2025-04-29T11:17:46.178Z
Learning: In the `get_deployment_transaction_args` method of `DotrainOrderGui`, approvals are intentionally only checked against output tokens as per the design requirements.

Applied to files:

  • packages/orderbook/test/js_api/gui.test.ts
⏰ 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). (18)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-artifacts)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-sol-test)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-sol-legal)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-sol-artifacts)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-test)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-wasm-browser-test)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-sol-static)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-rs-static)
  • GitHub Check: standard-tests (ubuntu-latest, test-js-bindings)
  • GitHub Check: standard-tests (ubuntu-latest, rainix-rs-artifacts, true)
  • GitHub Check: standard-tests (ubuntu-latest, ob-rs-test, true)
  • GitHub Check: git-clean
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: Deploy-Docs-Preview
  • GitHub Check: build-tauri (ubuntu-22.04, true)
  • GitHub Check: Deploy-Preview-Push
🔇 Additional comments (18)
crates/settings/src/yaml/cache.rs (1)

82-82: LGTM! Test helper properly updated.

The logo_uri field initialization in the test helper correctly defaults to None, consistent with other optional fields in TokenCfg.

crates/js_api/src/gui/state_management.rs (1)

416-416: LGTM! Test fixture updated for new structure.

The serialized state constant has been regenerated to reflect the TokenCfg structure changes (logo_uri field addition). The test data update is appropriate.

Based on learnings, the team prefers to keep hardcoded serialized state constants rather than dynamically generating them.

crates/settings/src/test.rs (1)

59-59: LGTM! Mock helper properly updated.

The logo_uri field correctly defaults to None in the test helper, maintaining consistency with the test fixture pattern.

crates/settings/src/yaml/context.rs (1)

321-321: LGTM! Test data updated correctly.

The TokenCfg initialization in the test properly includes the new logo_uri field set to None.

crates/settings/src/remote_tokens.rs (3)

235-237: LGTM! Remote token parsing includes logo URI.

The test correctly includes logoURI in the JSON fixture, following the Uniswap token list format. The field is optional, allowing tokens without logos.


299-302: Excellent test coverage for logo URI presence.

The assertion correctly verifies that logoURI from the remote token list is parsed and propagated to TokenCfg.logo_uri as a URL type.


313-313: Good verification of optional logo URI.

The test correctly verifies that tokens without logoURI result in None for logo_uri, demonstrating proper handling of the optional field.

crates/settings/src/remote/tokens.rs (2)

29-30: LGTM! Proper field definition with correct serde attributes.

The logo_uri field is correctly defined as optional with:

  • #[serde(default)] to handle missing fields gracefully
  • #[serde(rename = "logoURI")] to match Uniswap token list camelCase format

70-70: LGTM! Logo URI properly propagated.

The logo_uri is correctly passed through from the Token struct to TokenCfg during conversion, completing the data flow from remote token lists to the internal configuration.

packages/ui-components/src/lib/components/deployment/TokenSelectionModal.svelte (3)

15-15: LGTM! Good use of Set for tracking failed images.

The failedImages Set efficiently tracks tokens whose logos failed to load, enabling fallback to initials on subsequent renders.


49-51: LGTM! Proper error handling for image loads.

The handleImageError function correctly creates a new Set to trigger Svelte reactivity, ensuring the UI updates to show the fallback when an image fails to load.


116-131: Excellent implementation with graceful fallback!

The conditional rendering properly handles multiple scenarios:

  1. Displays logo when logoUri exists and hasn't failed
  2. Falls back to symbol initials on load failure or when no logo is provided
  3. Includes proper alt text for accessibility
  4. Error handler automatically switches to fallback on 404 or other load failures

This provides a robust user experience with appropriate degradation.

crates/common/src/add_order.rs (1)

472-472: LGTM! All test TokenCfg initializations properly updated.

All TokenCfg instances in tests have been systematically updated with logo_uri: None, maintaining consistency across the test suite and accommodating the new field structure.

Also applies to: 482-482, 492-492, 589-589, 599-599, 609-609, 747-747, 757-757, 767-767, 1083-1083, 1093-1093, 1103-1103

packages/ui-components/src/__tests__/TokenSelectionModal.test.ts (1)

17-18: Logo rendering and fallback tests are coherent and aligned with the spec

  • Adding logoUri to the first mock token and the new tests around image rendering, absence, fallback initials, and error handling all line up correctly with the intended behavior.
  • waitFor usage and DOM queries look robust enough for the async loading patterns here.

Also applies to: 261-355

crates/js_api/src/gui/select_tokens.rs (1)

317-331: TokenInfo now correctly propagates logo_uri in all get_all_tokens paths

Wiring logo_uri: token.logo_uri.clone() into both the cached and ERC20-fetched branches cleanly extends TokenInfo without changing existing behavior.

Please re-run Rust checks for the js_api crate to confirm everything compiles and tests still pass, e.g.:

  • nix develop -c cargo fmt --all
  • nix develop -c cargo clippy --workspace --all-targets --all-features -D warnings
  • nix develop -c cargo test --workspace
packages/orderbook/test/js_api/gui.test.ts (1)

2271-2302: Remote tokens test nicely validates logoUri propagation

The updated remote tokens fixture and assertions on tokenWithLogo.logoUri / tokenWithoutLogo.logoUri exercise the new logo field through the full remote-tokens path without impacting existing behavior.

Since this touches the published JS API surface, please run the orderbook JS tests to confirm everything passes:

  • nix develop -c npm run check -w @rainlanguage/orderbook
  • nix develop -c npm run test -w @rainlanguage/orderbook
crates/js_api/src/gui/mod.rs (1)

33-54: TokenInfo logo URI field and camelCase serialization look correct

  • Adding logo_uri: Option<Url> with #[serde(rename_all = "camelCase")] and #[tsify(optional, type = "string")] gives JS callers the expected logoUri?: string field without changing existing keys.
  • get_token_info now consistently copies token.logo_uri into TokenInfo in both cached and on-chain paths, so UIs can rely on it when present.

Please re-run Rust formatting and tests for the js_api crate to validate the new Url usage in WASM bindings:

  • nix develop -c cargo fmt --all
  • nix develop -c cargo clippy --workspace --all-targets --all-features -D warnings
  • nix develop -c cargo test --workspace

Also applies to: 295-328

crates/settings/src/token.rs (1)

14-15: TokenCfg logo URI support and YAML parsing are well integrated

  • Adding logo_uri: Option<Url> to TokenCfg with wasm tsify(optional, type = "string") plus default None and inclusion in PartialEq keeps the config model coherent.
  • parse_all_from_yaml correctly reads logo-uri, parses it as a URL, and surfaces invalid values via YamlError::Field { InvalidValue, location: "token '...'" }, matching existing patterns for address/decimals.
  • Tests for multi-file parsing and invalid logo-uri values accurately exercise both success and failure paths.

To be safe, please run the Rust formatting, linting, and tests for the settings crate (or whole workspace), e.g.:

  • nix develop -c cargo fmt --all
  • nix develop -c cargo clippy --workspace --all-targets --all-features -D warnings
  • nix develop -c cargo test --workspace

Also applies to: 35-37, 287-307, 341-364, 608-663, 665-690


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

@findolor findolor requested review from 0xgleb and hardyjosh December 25, 2025 08:43
@findolor findolor self-assigned this Dec 25, 2025
@findolor findolor added this to the v5 final prs milestone Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add logoUri to TokenInfo

3 participants