Use CallExpander in explorer (#8585)
* Use CallExpander in explorer * Adjust w/ Extrinsic allowance
This commit is contained in:
parent
45aaccf699
commit
a8d9d81f46
@ -8,7 +8,7 @@ import type { ICompact, INumber } from '@polkadot/types/types';
|
||||
import React, { useMemo } from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { AddressMini, Call, Expander, LinkExternal } from '@polkadot/react-components';
|
||||
import { AddressMini, CallExpander, LinkExternal } from '@polkadot/react-components';
|
||||
import { convertWeight } from '@polkadot/react-hooks/useWeight';
|
||||
import { BN, formatNumber } from '@polkadot/util';
|
||||
|
||||
@ -75,7 +75,7 @@ function ExtrinsicDisplay ({ blockNumber, className = '', events, index, maxBloc
|
||||
[value, withLink]
|
||||
);
|
||||
|
||||
const { meta, method, section } = useMemo(
|
||||
const { method, section } = useMemo(
|
||||
() => value.registry.findMetaCall(value.callIndex),
|
||||
[value]
|
||||
);
|
||||
@ -112,8 +112,6 @@ function ExtrinsicDisplay ({ blockNumber, className = '', events, index, maxBloc
|
||||
[index, events, maxBlockWeight]
|
||||
);
|
||||
|
||||
const callName = `${section}.${method}`;
|
||||
|
||||
return (
|
||||
<tr
|
||||
className={className}
|
||||
@ -123,20 +121,14 @@ function ExtrinsicDisplay ({ blockNumber, className = '', events, index, maxBloc
|
||||
className='top'
|
||||
colSpan={2}
|
||||
>
|
||||
<Expander
|
||||
summary={callName}
|
||||
summaryMeta={meta}
|
||||
>
|
||||
<Call
|
||||
callName={callName}
|
||||
className='details'
|
||||
mortality={mortality}
|
||||
tip={value.tip?.toBn()}
|
||||
value={value}
|
||||
withHash
|
||||
withSignature
|
||||
/>
|
||||
</Expander>
|
||||
<CallExpander
|
||||
className='details'
|
||||
mortality={mortality}
|
||||
tip={value.tip?.toBn()}
|
||||
value={value}
|
||||
withHash
|
||||
withSignature
|
||||
/>
|
||||
{link && (
|
||||
<a
|
||||
className='isDecoded'
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
// Copyright 2017-2022 @polkadot/react-components authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Call } from '@polkadot/types/interfaces';
|
||||
import type { Call, Extrinsic } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
@ -12,11 +13,16 @@ interface Props {
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
labelHash?: React.ReactNode;
|
||||
value?: Call | null;
|
||||
labelSignature?: React.ReactNode;
|
||||
mortality?: string;
|
||||
tip?: BN;
|
||||
value?: Call | Extrinsic | null;
|
||||
withBorder?: boolean;
|
||||
withHash?: boolean;
|
||||
withSignature?: boolean;
|
||||
}
|
||||
|
||||
function CallExpander ({ children, className = '', labelHash, value, withHash }: Props): React.ReactElement<Props> | null {
|
||||
function CallExpander ({ children, className = '', labelHash, labelSignature, mortality, tip, value, withBorder, withHash, withSignature }: Props): React.ReactElement<Props> | null {
|
||||
const call = useMemo(
|
||||
() => value && value.callIndex
|
||||
? value.registry.findMetaCall(value.callIndex)
|
||||
@ -40,8 +46,13 @@ function CallExpander ({ children, className = '', labelHash, value, withHash }:
|
||||
<CallDisplay
|
||||
callName={callName}
|
||||
labelHash={labelHash}
|
||||
labelSignature={labelSignature}
|
||||
mortality={mortality}
|
||||
tip={tip}
|
||||
value={value}
|
||||
withBorder={withBorder}
|
||||
withHash={withHash}
|
||||
withSignature={withSignature}
|
||||
/>
|
||||
{children}
|
||||
</Expander>
|
||||
|
||||
@ -103,6 +103,10 @@ export default React.memo(styled(Labelled)`
|
||||
}
|
||||
}
|
||||
|
||||
&.isOuter {
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
|
||||
.labelExtra {
|
||||
color: rgba(78, 78, 78, .85);
|
||||
font-weight: var(--font-weight-normal);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user