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

Principal account creation flow #776

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions frontend/src/Frontend/UI/DeploymentSettings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module Frontend.UI.DeploymentSettings

, transactionInputSection
, transactionHashSection
, contHashSection
, transactionDisplayNetwork
-- * Useful re-exports
, Identity (runIdentity)
Expand Down Expand Up @@ -585,6 +586,11 @@ advancedAccordion m active = do
dialogSectionHeading mempty "Data"
uiJsonDataSetFocus (\_ _ -> pure ()) (\_ _ -> pure ()) (m ^. wallet) (m ^. jsonData)

contHashSection :: MonadWidget t m => Pact.RequestKey -> m ()
contHashSection hsh = void $ do
mkLabeledInput True "Request Key (p2)" (\c -> uiInputElement $ c & initialAttributes %~ Map.insert "disabled" "") $ def
& inputElementConfig_initialValue .~ Pact.requestKeyToB16Text hsh

transactionHashSection :: MonadWidget t m => Pact.Command Text -> m ()
transactionHashSection cmd = void $ do
mkLabeledInput True "Request Key" (\c -> uiInputElement $ c & initialAttributes %~ Map.insert "disabled" "") $ def
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/Frontend/UI/Dialogs/Send.hs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ runUnfinishedCrossChainTransfer
-> Event t Pact.RequestKey
-- ^ The request key to follow up on
-> PublicMeta
-> m (Event t (), Event t Text, Event t ())
-> m (Event t (), Event t Text, Event t (), Event t Pact.RequestKey)
runUnfinishedCrossChainTransfer logL netInfo keys fromChain toChain mtoGasPayer requestKey publicMeta = mdo
let nodeInfos = _sharedNetInfo_nodes netInfo
networkName = _sharedNetInfo_network netInfo
Expand All @@ -536,11 +536,11 @@ runUnfinishedCrossChainTransfer logL netInfo keys fromChain toChain mtoGasPayer
, Status_Done <$ contOk
]

es@(resultOk, resultErr, retry) <- case mtoGasPayer of
es@(resultOk, resultErr, retry, eContReqKey) <- case mtoGasPayer of
Nothing -> do
dialogSectionHeading mempty "Notice: Cannot finish cross-chain transfer"
divClass "group" $ text "No gas payer specified on destination chain"
return (() <$ contResponse, never, never)
return (() <$ contResponse, never, never, never)
Just toGasPayer -> do
-- Get the proof
spvResponse <- getSPVProof logL nodeInfos fromChain toChain contOk
Expand Down Expand Up @@ -592,6 +592,7 @@ runUnfinishedCrossChainTransfer logL netInfo keys fromChain toChain mtoGasPayer
pure ( resultOk
, leftmost [contError, spvError, continueError, resultError]
, retry
, snd <$> continueOk
)
pure es

Expand Down Expand Up @@ -877,7 +878,6 @@ continueCrossChainTransfer logL networkName envs publicMeta keys toChain gasPaye
performEventAsync $ ffor spvOk $ \(pe, proof) cb -> do
let
sender = unAccountName $ fst gasPayer

pm = publicMeta
{ _pmChainId = toChain
, _pmSender = sender
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/Frontend/UI/Form/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,17 @@ amountFormWidget
=> PrimFormWidgetConfig t (Either String Decimal)
-> m (FormWidget t (Either String Decimal))
amountFormWidget cfg = do
parsingFormWidget parseAmount (either (const "") tshow) cfg
parsingFormWidget parseTransferAmount (either (const "") tshow) cfg

-- parseAmount that cant be 0
parseTransferAmount :: Text -> Either String Decimal
parseTransferAmount t = parseAmount t >>= \a ->
case a == 0 of
True -> Left "Cant transfer amount of 0"
False -> pure a

parseAmount :: Text -> Either String Decimal
parseAmount t =
parseAmount t =
let tNoLeadingDecimal = if "." `T.isPrefixOf` t then "0" <> t else t in
case D.normalizeDecimal <$> readMaybe (T.unpack tNoLeadingDecimal) of
Nothing -> Left "Not a valid number"
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/Frontend/UI/ModuleExplorer/ModuleList.hs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ uiDeployedModuleList m mList = mdo
& setValue .~ onNetworkName

d <- uiDropdown Nothing opts filterCfg
onNewSearch <- debounce 0.2 $ _inputElement_input ti
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was in the other PR but should resolve easily in the merge.

let
onNewSearch :: Event t Text
onNewSearch = _inputElement_input ti

onChainIdL :: Event t (Maybe ChainId)
onChainIdL = _dropdown_change d

Expand Down
Loading