// Copyright 2017-2021 @polkadot/react-signer authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { QueueTx } from '@polkadot/react-components/Status/types'; import type { ThemeProps } from '@polkadot/react-components/types'; import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; import { Call, Expander, Modal } from '@polkadot/react-components'; import PaymentInfo from './PaymentInfo'; import { useTranslation } from './translate'; interface Props { className?: string; currentItem: QueueTx; isSendable: boolean; onError: () => void; tip?: BN; } function Transaction ({ className, currentItem: { accountId, extrinsic, isUnsigned, payload }, isSendable, onError, tip }: Props): React.ReactElement | null { const { t } = useTranslation(); if (!extrinsic) { return null; } const { meta, method, section } = extrinsic.registry.findMetaCall(extrinsic.callIndex); const args = meta?.args.map(({ name }) => name).join(', ') || ''; return ( {t('Sending transaction')} {section}.{method}({args})} summaryMeta={meta} > {!isUnsigned && !payload && ( )}

{t('The details of the transaction including the type, the description (as available from the chain metadata) as well as any parameters and fee estimations (as available) for the specific type of call.')}

); } export default React.memo(styled(Transaction)(({ theme }: ThemeProps) => ` .tx-details { .ui--Expander-summary { font-size: 1.1rem; margin: 0 0 0.5rem; } .highlight { font-weight: ${theme.fontWeightNormal}; } .meta { margin-bottom: 0.5rem; margin-left: 2rem; } .meta, .mute { opacity: 0.6; } } `));