Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Link to block explorer via reqkey #690

Draft
wants to merge 1 commit into
base: bip-unification-refactor
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions frontend/src/Frontend/UI/Dialogs/DeployConfirmation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ submitTransactionWithFeedback model cmd sender chain nodeInfos = do

reload <- transactionStatusSection sendStatus listenStatus
let reloadKey = tagMaybe (current requestKey) reload
transactionResultSection message
transactionResultSection message requestKey
pure $ TransactionSubmitFeedback sendStatus listenStatus message

pollForRequestKey
Expand Down Expand Up @@ -277,13 +277,29 @@ transactionStatusSection sendStatus listenStatus = do
canReload <- delay 2 reload
throttle 2 reload

transactionResultSection :: MonadWidget t m => Dynamic t (Maybe (Either NetworkError PactValue)) -> m ()
transactionResultSection message = do
transactionResultSection
:: MonadWidget t m
=> Dynamic t (Maybe (Either NetworkError PactValue))
-> Dynamic t (Maybe Pact.RequestKey)
-> m ()
transactionResultSection message reqId = do
dialogSectionHeading mempty "Transaction Result"
divClass "group" $ do
-- TODO: merge md and reqId dynamics to hit dyn in same case
maybeDyn message >>= \md -> dyn_ $ ffor md $ \case
Nothing -> text "Waiting for response..."
Just a -> dynText $ prettyPrintNetworkErrorResult . either (This . pure . (Nothing,)) (That . (Nothing,)) <$> a
Just a -> do
el "div" $
dynText $ fmap (prettyPrintNetworkErrorResult . either (This . pure . (Nothing,)) (That . (Nothing,))) a
el "div" $ do
dyn_ $ ffor reqId $ \case
Nothing -> text "error: Your request key has not been retrieved"
Just reqId -> makeBlockExplorerLink reqId
where
makeBlockExplorerLink reqKey =
elAttr "a" ("target" =: "_blank" <>
"href" =: ("https://explorer.chainweb.com/testnet/tx/" <> Pact.requestKeyToB16Text reqKey)) $
text "View on the block explorer"

deploySubmit
:: forall key t m a model modelCfg.
Expand Down