Skip to content

Link resolved swaps to dashboard URL in view.py#31

Merged
LandynDev merged 1 commit into
entrius:testfrom
eureka0928:feat/cli-view-swap-indexer
Apr 17, 2026
Merged

Link resolved swaps to dashboard URL in view.py#31
LandynDev merged 1 commit into
entrius:testfrom
eureka0928:feat/cli-view-swap-indexer

Conversation

@eureka0928
Copy link
Copy Markdown
Contributor

@eureka0928 eureka0928 commented Apr 10, 2026

Closes #66

Summary

When a swap completes or times out, the contract removes it from on-chain storage. alw view swap <id> previously dead-ended on a generic "Swap resolved" message.

Per your feedback — keeping allways/ as the chain-state-direct layer with no HTTP calls to deployed services — this PR drops the earlier API-client approach and replaces it with a minimal dashboard URL hint that routes users to the module (allways-ui) that owns resolved swap history.

Changes

  • allways/cli/swap_commands/view.py — when get_swap() returns None and the swap ID is below next_swap_id, append the dashboard URL (/swap/{id}) to the existing message
  • DEFAULT_DASHBOARD_URL module constant (https://test.all-ways.io) overridable via ALLWAYS_DASHBOARD_URL env var
  • No new modules, no new dependencies, no HTTP calls from the CLI

Reverted from previous revision: das_api.py, test_das_api.py, and all indexer-fetch logic.

Example

Before:

$ alw view swap 1
Swap 1 has been resolved (completed or timed out).
Resolved swaps are removed from on-chain storage.

After:

$ alw view swap 1
Swap 1 has been resolved (completed or timed out).
Resolved swaps are removed from on-chain storage. View history at: https://test.all-ways.io/swap/1

Test plan

  • Manual: alw view swap <resolved_id> prints the dashboard URL
  • Manual: alw view swap <active_id> still shows full on-chain details
  • Manual: ALLWAYS_DASHBOARD_URL=https://my.host alw view swap <resolved_id> uses the override

@eureka0928
Copy link
Copy Markdown
Contributor Author

Hi @LandynDev I put the new PR based on your comments from closed one
Thank you for your time
Let me know if there is any feedback

@eureka0928 eureka0928 force-pushed the feat/cli-view-swap-indexer branch 6 times, most recently from d208503 to f886495 Compare April 17, 2026 03:42
@LandynDev
Copy link
Copy Markdown
Collaborator

hey, the gap you're solving is real bc view.py still dead-ends on resolved swaps. We can't access the chain efficiently for this data and I'm not sure if I want to introduce the api as a dependency to the CLI just for this. At least not yet, just want to keep things simple right this moment

I thought about this more and here's what I think:
As I mentioned above, the allways/ repo is deliberately the chain-state-direct layer, no module here HTTP-calls a deployed service, and the repo split (das-allways + allways-ui) exists so resolved-swap history has an owner that isn't the CLI.

If you want to close this UX gap in a shape we can land, the smaller move is a ~5-line tweak to view.py that points users at the dashboard URL for the swap id they asked about. Just for V1, for now. They still get the details, we just route them to the module that owns the data instead of proxying it.

I led you wrong direction here in the last PR saying API good route, can we do this instead?

@eureka0928 eureka0928 force-pushed the feat/cli-view-swap-indexer branch 2 times, most recently from 838c361 to c0707d0 Compare April 17, 2026 21:18
@eureka0928 eureka0928 changed the title Resolve off-chain swaps via Allways DAS indexer Link resolved swaps to dashboard URL in view.py Apr 17, 2026
@eureka0928
Copy link
Copy Markdown
Contributor Author

Thanks for the clear direction — makes sense. Reverted the API-client approach entirely and replaced it with the ~5-line dashboard URL hint as suggested. No HTTP calls from the CLI, no new modules. ALLWAYS_DASHBOARD_URL env var for override. Ready for another look.

When a swap is no longer in contract storage (completed or timed out),
alw view swap <id> now prints the dashboard URL where resolved swap
history is owned and displayed, instead of dead-ending on a 'resolved'
message.

- Dashboard URL configurable via ALLWAYS_DASHBOARD_URL env var
  (default: https://test.all-ways.io)
- Keeps allways/ CLI as the chain-state-direct layer — no HTTP calls
  from this repo, no new dependency, no proxying of off-chain data
- ~5-line change to view.py, no new modules
@LandynDev LandynDev merged commit e6e093e into entrius:test Apr 17, 2026
2 checks passed
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.

alw view swap <id> dead-ends on resolved swaps

2 participants