Skip to content

Commit

Permalink
revert write outcome improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
alongoni committed Nov 16, 2023
1 parent f5528fe commit fab4959
Showing 1 changed file with 16 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Box, Stack, Typography } from '@mui/material'
import { Box, CircularProgress, Stack, Typography } from '@mui/material'
import { ContractInteractionProps } from '.'
import { AbiParam } from '@/services/substrate/types'
import { useDryRunExecution } from '../useDryRunExecution'
import { MethodDocumentation } from '../MethodDocumentation'

import { ButtonCall } from './styled'
import { CopyToClipboardButton, StyledTextField } from '@/view/components'
import { CopyBlock, atomOneDark } from 'react-code-blocks'

type Props = React.PropsWithChildren<
Omit<ContractInteractionProps, 'type'> & {
Expand All @@ -21,7 +20,7 @@ export function WriteMethodsForm({
contractPromise,
inputData
}: Props) {
const { outcome, executeDryRun } = useDryRunExecution({
const { outcome, executeDryRun, isSubmitting } = useDryRunExecution({
contractPromise,
message: abiMessage,
params: inputData,
Expand All @@ -41,7 +40,7 @@ export function WriteMethodsForm({
)}
{children}
</>
<Box mt={2}>
<Box display="block">
<Typography variant="overline">Outcome</Typography>
</Box>

Expand All @@ -54,38 +53,19 @@ export function WriteMethodsForm({
justifyContent: 'center'
}}
>
<Box
sx={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: '1rem'
}}
>
<Box
sx={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center'
}}
>
<StyledTextField placeholder="0" value={outcome} />
<CopyToClipboardButton
id="copy-contract-address"
sx={{ marginLeft: '0.5rem' }}
data={outcome}
/>
</Box>
<ButtonCall isLoading={false} onClick={executeDryRun}>
Recall
</ButtonCall>
</Box>
{/* {error && (
<FormHelperText error id={`error-${abiMessage.method}`}>
{error}
</FormHelperText>
)} */}
{isSubmitting ? (
<CircularProgress color="primary" />
) : (
<CopyBlock
text={outcome}
language="text"
theme={atomOneDark}
showLineNumbers={false}
wrapLongLines={true}
/>
)}
</Box>
<ButtonCall onClick={executeDryRun}>Call</ButtonCall>
</Stack>
</Box>
<Box sx={{ maxWidth: '45%', minWidth: '40%' }}>
Expand Down

0 comments on commit fab4959

Please sign in to comment.