Skip to content

fix(core): resolve compilation errors and field mismatches from wave 1 contributions#146

Closed
Tinna23 wants to merge 1 commit intomainfrom
feat/frontend-demo-wave1
Closed

fix(core): resolve compilation errors and field mismatches from wave 1 contributions#146
Tinna23 wants to merge 1 commit intomainfrom
feat/frontend-demo-wave1

Conversation

@Tinna23
Copy link
Contributor

@Tinna23 Tinna23 commented Mar 4, 2026

Summary

This PR cleans up cascading issues introduced during wave 1 open-source contributions. All fixes are backend-only — no new features, no behaviour changes. The goal is to merge a known-good backend to main before wave 2 begins.

What was broken

routes/tx.rs

  • Removed get_tx_raw handler that referenced fetch_transaction_raw — a method that was never implemented on HorizonClient
  • Removed the dangling #[utoipa::path] attribute block left behind after the handler was deleted
  • Removed unused imports (body::Body, response::Response, http::StatusCode, http::header) that came in with the raw handler
  • Removed stale get_tx_raw entry from the OpenApi paths() macro in routes/mod.rs

routes/account.rs

  • Replaced serde_json::Value return type with a typed AccountExplanationResponse struct — serde_json was not in Cargo.toml and the untyped response was causing compile failures

services/horizon.rs

  • Added fetch_account() method — it existed in the route handler but was never implemented on HorizonClient, causing every account lookup to fail
  • Introduced HorizonAccount intermediary struct matching Horizon's actual /accounts/:id response shape: signers as Vec<HorizonSigner>, flags as a nested HorizonAccountFlags object, home_domain as a plain String (Horizon sends "" not null)
  • Added #[serde(default)] to all optional fields so unknown or absent fields do not cause deserialization failures
  • Fixed into_domain() converting home_domain: String to Option<String> correctly

models/operation.rs

  • Fixed From<HorizonOperation> impl: op.type_iop.operation_type (field was renamed in HorizonOperation but the consumer was not updated)
  • Fixed op.master_weightop.master_key_weight
  • Fixed op.clear_flags / op.set_flags: Horizon returns Vec<u32> but domain model expects u32 — now folded into a bitmask with .reduce(|a, b| a | b)
  • Fixed op.offer_id: Horizon returns String, domain model expects u64 — now parsed with .and_then(|s| s.parse::<u64>().ok()).unwrap_or(0)
  • Removed op.path reference — field does not exist on HorizonOperation

Cargo.toml

  • Added serde_json = "1" to [dependencies] — was missing, causing compile failures in account route

Verified against mainnet

  • Transaction lookup tested with real hashes including successful, failed, and multi-operation transactions
  • Account lookup tested with real addresses — XLM balance, asset count, signer count all correct
  • Timeline enrichment (ledger number + confirmed timestamp) rendering correctly

Files changed

  • packages/core/src/routes/tx.rs
  • packages/core/src/routes/account.rs
  • packages/core/src/routes/mod.rs
  • packages/core/src/services/horizon.rs
  • packages/core/src/models/operation.rs
  • packages/core/Cargo.toml

@Tinna23 Tinna23 closed this Mar 4, 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.

1 participant