diff --git a/packages/react-components/src/Output.tsx b/packages/react-components/src/Output.tsx index dc800d22f5..b49029f3f2 100644 --- a/packages/react-components/src/Output.tsx +++ b/packages/react-components/src/Output.tsx @@ -11,6 +11,7 @@ interface Props { children?: React.ReactNode; className?: string; help?: React.ReactNode; + isDisabled?: boolean; isError?: boolean; isFull?: boolean; isHidden?: boolean; @@ -24,7 +25,7 @@ interface Props { withLabel?: boolean; } -function Output ({ children, className = '', help, isError, isFull, isHidden, isMonospace, isSmall, isTrimmed, label, labelExtra, value, withCopy = false, withLabel }: Props): React.ReactElement { +function Output ({ children, className = '', help, isDisabled, isError, isFull, isHidden, isMonospace, isSmall, isTrimmed, label, labelExtra, value, withCopy = false, withLabel }: Props): React.ReactElement { return ( -
+
{isTrimmed && value && (value.length > 256) ? `${value.substr(0, 96)}…${value.substr(-96)}` : value diff --git a/packages/react-signer/src/TxSigned.tsx b/packages/react-signer/src/TxSigned.tsx index e7e68e7439..69c595c685 100644 --- a/packages/react-signer/src/TxSigned.tsx +++ b/packages/react-signer/src/TxSigned.tsx @@ -36,8 +36,15 @@ interface Props { requestAddress: string; } +interface InnerTx { + innerHash: string | null; + innerTx: string | null; +} + const NOOP = () => undefined; +const EMPTY_INNER: InnerTx = { innerHash: null, innerTx: null }; + let qrId = 0; function unlockAccount ({ isUnlockCached, signAddress, signPassword }: AddressProxy): string | null { @@ -183,7 +190,7 @@ function TxSigned ({ className, currentItem, requestAddress }: Props): React.Rea const [senderInfo, setSenderInfo] = useState({ isMultiCall: false, isUnlockCached: false, multiRoot: null, proxyRoot: null, signAddress: requestAddress, signPassword: '' }); const [signedOptions, setSignedOptions] = useState>({}); const [signedTx, setSignedTx] = useState(null); - const [multiCall, setMultiCall] = useState(null); + const [{ innerHash, innerTx }, setCallInfo] = useState(EMPTY_INNER); const [tip, setTip] = useState(BN_ZERO); useEffect((): void => { @@ -193,14 +200,21 @@ function TxSigned ({ className, currentItem, requestAddress }: Props): React.Rea // when we are sending the hash only, get the wrapped call for display (proxies if required) useEffect((): void => { - setMultiCall( - currentItem.extrinsic && senderInfo.multiRoot - ? ( - senderInfo.proxyRoot - ? api.tx.proxy.proxy(senderInfo.proxyRoot, null, currentItem.extrinsic) - : currentItem.extrinsic - ).method.toHex() - : null + const method = currentItem.extrinsic && ( + senderInfo.proxyRoot + ? api.tx.proxy.proxy(senderInfo.proxyRoot, null, currentItem.extrinsic) + : currentItem.extrinsic + ).method; + + setCallInfo( + method + ? { + innerHash: method.hash.toHex(), + innerTx: senderInfo.multiRoot + ? method.toHex() + : null + } + : EMPTY_INNER ); }, [api, currentItem, senderInfo]); @@ -367,13 +381,24 @@ function TxSigned ({ className, currentItem, requestAddress }: Props): React.Rea signedTx={signedTx} /> )} - {isSubmit && !senderInfo.isMultiCall && multiCall && ( - + {isSubmit && !senderInfo.isMultiCall && innerTx && ( + ('multisig call data')} - value={multiCall} + value={innerTx} + withCopy + /> + + )} + {isSubmit && innerHash && ( + + ('call hash')} + value={innerHash} withCopy />