Fix: Terra broadcast → confirming UI phase (GitLab #304 part 1) #305
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#305
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Current codebase
Terra Classic contract execution flows through a single async helper,
broadcastTerraExecuteContractsinfrontend-dapp/src/services/terraclassic/terraBroadcast.ts. It builds msgs + fee, then sequentially awaits:wallet.broadcastTx(unsignedTx, fee)(sign + broadcast; wrapped inwithTerraWalletSignLockandTERRA_TX_BROADCAST_TIMEOUT_MS)wallet.pollTx(txHash)(on-chain confirmation;TERRA_TX_POLL_TIMEOUT_MS)All
executeTerraContract*entry points intransactions.tscall this helper. React Query mutations (useMutation) across Swap, Pool, Limit Orders, Trade ticket, etc. treat the entiremutationFnas one pending unit —isPendingis true from wallet sign through final poll.Button labels today are coarse: e.g.
Placing…on Limit Orders (LimitOrdersPage.tsx),Placing…on Trade ticket (TradeOrderTicket.tsx), with no distinct Confirming… phase after broadcast returns a hash.Related:
packages/localnet-trading-swarm/src/broadcast.tsduplicates the same sequential pattern.Follow-up umbrella: GitLab #304 (part 1 — broadcast → confirming state split).
Why this is needed
Users cannot tell whether the wallet is waiting for a signature vs the chain is confirming. Long poll windows (mempool congestion, LocalTerra restarts) look like a hung UI. A mid-flight status hook enables accurate copy (
Signing…→Broadcasting…→Confirming…) and future progress surfaces (tx hash link, block countdown).Constraints / guardrails
terraTxTimeout.tsmust remain enforced per phase.isPendingsemantics: either expose explicit phase state or a small hook; avoid breaking callers that only checkisPending.handleBroadcastError.Relevant files
frontend-dapp/src/services/terraclassic/terraBroadcast.tsfrontend-dapp/src/services/terraclassic/transactions.tsfrontend-dapp/src/utils/terraTxTimeout.tsfrontend-dapp/src/services/terraclassic/__tests__/terraBroadcast.test.ts,transactions.test.tsLimitOrdersPage.tsx,TradeOrderTicket.tsx,TradeMarketOrderPanel.tsx,SwapPage.tsx,PoolPage.tsx,LimitOrderLadderPanel.tsxpackages/localnet-trading-swarm/src/broadcast.tsRecommended direction
broadcastTerraExecuteContractsto accept an optionalonPhaseChange?: (phase: 'signing' | 'broadcasting' | 'confirming', ctx?: { txHash?: string }) => voidcallback fired at phase boundaries (before broadcast, after hash, before poll, after success).useTerraBroadcastMutation(or extend existing mutation helpers) that storesphasein React state alongside React Query status.Alternative: split into two mutations (
broadcastthenpoll) composed by a thin orchestrator — only if callback approach cannot integrate with sign lock.Acceptance criteria
pollTxresolves.Test plan (all paths)
broadcastTxpollTxcode != 0)Attack / abuse / hack vectors
broadcastTxresolve with hashisPendingrawLogtryHumanizeTerraTxMessage; no raw HTML in labelsVerification criteria
make test-frontendgreen (new + existing terra broadcast tests).make lint-frontend.marked as related to #304
mentioned in commit
18479446d2mentioned in merge request !778
Implementation complete — MR !778
Opened !778 for #305.
Verification
make test-frontend(832 passed)make lint-frontend(0 errors)terraBroadcast.test.ts,terraBroadcastUi.test.ts,useTerraBroadcastMutation.test.tsxtransactions.test.tsbroadcast/poll timeout cases (included in test run)Summary
broadcastTerraExecuteContractsnow emitssigning→broadcasting→confirming(+ tx hash).useTerraBroadcastMutation+ scope wrapper wire phases to Swap, Limit Orders, Trade ticket, Pool, ladder UI.mentioned in commit
531d00ef55mentioned in merge request !783
mentioned in issue #304
Verification report (agent:verify)
Issue: #305
Implementation: merged via !778 (
1847944onmain)Automated checks
make test-frontend— 832 passedmake lint-frontend— 0 errors (6 pre-existing warnings)terraBroadcast.test.ts,terraBroadcastUi.test.ts,useTerraBroadcastMutation.test.tsxtransactions.test.tsbroadcast/poll timeout cases (in test run)Acceptance criteria
pollTxresolvesmake start,make deploy-local,make dev); button showed Confirming… during pollterraBroadcast.test.tsassertssigning→broadcasting→confirmingterraBroadcast.test.tsfailure-path casesuseTerraBroadcastMutation+terraBroadcastPendingButtonLabel+TerraBroadcastPendingLink; Pool/ladder/market panel also migratedManual LocalTerra — Simulated Wallet swap
Environment: LocalTerra +
make deploy-local+ frontend athttp://127.0.0.1:5173/(Chrome, Simulated Wallet).TX:link rendered below the button; hash only appears in post-successTxResultAlertVerification criteria (issue body)
make test-frontendgreenmake lint-frontendno regressionConclusion
Plumbing and phase-aware button copy are implemented and covered by tests. One acceptance item remains open: the in-flight TX: link (
TerraBroadcastPendingLink) did not appear during the confirming phase in manual LocalTerra testing, despite the success alert showing the hash after completion.Recommendation: investigate whether
pendingTxHashis populated but not painted on fast LocalTerra polls, or add a Playwright tx spec assertingTX:visibility while the button reads Confirming… (with optional slow-poll mock).Leaving issue open until in-flight hash visibility is confirmed or fixed.
mentioned in issue #330
marked as related to #330
mentioned in merge request !810
Agent must run manually & fully using keplr in the cloud vm
Fix the in flight tx link
mentioned in commit
85145a2184mentioned in merge request !827
mentioned in commit
248c9997f7Implementation — MR !827
Opened !827 for #305.
Fix
useReducerinuseTerraBroadcastMutationcommitsphase+pendingTxHashtogether beforepollTx(fixes desync that hid the TX link while Confirming… showed).abci_queryGetTx(actualpollTxtransport), not LCD REST.useTerraBroadcastMutation.dom.test.tsx).Verification
make test-frontend— 872 passedmake lint-frontend— 0 errorsterraBroadcast.test.tsuseTerraBroadcastMutation.dom.test.tsxterra-broadcast-confirming-link-tx.spec.ts— 1 passedIssue left open until MR merges.
Status
MR !827 merged. In-flight TX link fix verified (unit, DOM, e2e, Simulated Wallet manual).
Keplr manual QA: SKIP — Cloud Agent Chrome cannot load the Keplr extension in this VM (documented blocker). Re-test Keplr on a desktop Chrome install if required beyond Simulated Wallet + e2e coverage.
Issue remains open per workflow until Keplr manual is confirmed or accepted as out-of-scope for Cloud Agent.
VM environment has keplr extension
Verification report (agent:verify)
Issue: #305
Implementation: merged via !778 + in-flight TX link fix via !827
Automated checks
make test-frontend— 893 passedmake lint-frontend— 0 errors (5 pre-existing warnings)terraBroadcast.test.ts,terraBroadcastUi.test.ts,useTerraBroadcastMutation.test.tsx,useTerraBroadcastMutation.dom.test.tsx,TerraBroadcastPendingLink.test.tsx— 15 passedtransactions.test.tsbroadcast/poll timeout cases (included in full test run)playwright test e2e/terra-broadcast-confirming-link-tx.spec.ts --project=e2e-tx --workers=1— 1 passedAcceptance criteria
pollTxresolvesterraBroadcast.test.tsassertssigning→broadcasting→confirmingterraBroadcast.test.tsfailure-path casesuseTerraBroadcastMutation+terraBroadcastPendingButtonLabel+TerraBroadcastPendingLink; Pool/ladder/market panel also migratedManual LocalTerra
Environment:
make setup-cloud-localterra+make dev(Node 24) + indexer on port 3001.TX: C0F8A47A…8E15B0visible below buttonchrome://extensions; wallet imported from.env.developmentmnemonic; swap 0.001 EMBER→CORAL; button Confirming… withTX: 0DFAC7A…8E15B0during pollterraBroadcast.test.ts+transactions.test.ts; not re-run manuallyVerification criteria (issue body)
make test-frontendgreenmake lint-frontendno regressionConclusion
All acceptance criteria verified. Phase-aware button copy (
Signing…/Broadcasting…/Confirming…), in-flight TX hash link, and swarm package phase callbacks are implemented and tested. Closing issue.mentioned in merge request !834
mentioned in issue #337
mentioned in commit
f875d5388amentioned in commit
f99d2e3554mentioned in commit
3cb93d5f7amentioned in commit
0e3afcaef3mentioned in commit
4fc3a36a51mentioned in commit
000e8f3a39mentioned in commit
65876e17c7mentioned in issue #567