From f29e5d2c9849f24ea28028693c7271c325ec8873 Mon Sep 17 00:00:00 2001 From: Henry Palacios Date: Wed, 15 Nov 2023 15:34:12 -0300 Subject: [PATCH] Executing Dry Running --- .../WriteMethodsForm.tsx | 31 ++++++++++++------- src/view/ContractDetailView/index.tsx | 2 +- .../ContractDetailView/useDryRunExecution.tsx | 1 - 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/view/ContractDetailView/ContractInteractionForm/WriteMethodsForm.tsx b/src/view/ContractDetailView/ContractInteractionForm/WriteMethodsForm.tsx index b649d086..879f547f 100644 --- a/src/view/ContractDetailView/ContractInteractionForm/WriteMethodsForm.tsx +++ b/src/view/ContractDetailView/ContractInteractionForm/WriteMethodsForm.tsx @@ -3,6 +3,8 @@ import { ContractInteractionProps } from '.' import { AbiParam } from '@/services/substrate/types' import { useDryRunExecution } from '../useDryRunExecution' import { MethodDocumentation } from '../MethodDocumentation' +import { ButtonCall } from './styled' +import { CopyBlock, atomOneDark } from 'react-code-blocks' type Props = React.PropsWithChildren< Omit & { @@ -11,13 +13,19 @@ type Props = React.PropsWithChildren< } > -export function WriteMethodsForm({ children, abiParams, abiMessage }: Props) { - // const { outcome, executeDryRun } = useDryRunExecution({ - // contractPromise, - // message: abiMessage, - // params: inputData, - // autoRun: false - // }) +export function WriteMethodsForm({ + children, + abiParams, + abiMessage, + contractPromise, + inputData +}: Props) { + const { outcome, executeDryRun, isSubmitting } = useDryRunExecution({ + contractPromise, + message: abiMessage, + params: inputData, + autoRun: false + }) return ( Outcome - {/* + - {caller.isSubmitting ? ( + {isSubmitting ? ( ) : ( )} - caller.send(inputData)}>Call - */} + executeDryRun(inputData)}>Call + diff --git a/src/view/ContractDetailView/index.tsx b/src/view/ContractDetailView/index.tsx index 9ac81219..9ba42b11 100644 --- a/src/view/ContractDetailView/index.tsx +++ b/src/view/ContractDetailView/index.tsx @@ -249,7 +249,7 @@ export default function ContractDetail({ userContract }: Props): JSX.Element { - Added by + By {''} {truncateAddress(userContract.userAddress, 4)} diff --git a/src/view/ContractDetailView/useDryRunExecution.tsx b/src/view/ContractDetailView/useDryRunExecution.tsx index b7892179..463310da 100644 --- a/src/view/ContractDetailView/useDryRunExecution.tsx +++ b/src/view/ContractDetailView/useDryRunExecution.tsx @@ -28,7 +28,6 @@ export function useDryRunExecution({ const executeDryRun = useCallback(async () => { const result = await dryRun.send(memoizedParams) - console.log('__dryRun', dryRun) if (result?.ok) { setOutcome( `Contract call will be successful executed with ${result.value.partialFee.toString()} fee`