From a3848ebfdb407d7bedb1c1c338fedd1e6a2e5483 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Fri, 13 Oct 2023 11:53:07 +0100 Subject: [PATCH] hotfix followup --- packages/ui/src/components/CallInfo.tsx | 63 ++++++++++++------- .../src/components/EasySetup/FromCallData.tsx | 2 +- 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/packages/ui/src/components/CallInfo.tsx b/packages/ui/src/components/CallInfo.tsx index 031b5f3c..d44a372e 100644 --- a/packages/ui/src/components/CallInfo.tsx +++ b/packages/ui/src/components/CallInfo.tsx @@ -33,6 +33,34 @@ interface CreateTreeParams { typeName?: string } +const handleCallDisplay = ({ + call, + decimals, + unit, + api, + key +}: { + call: any + decimals: number + unit: string + key: string + api: ApiPromise +}) => { + const name = `${call.section}.${call.method}` + return ( + <> +
  • {name}
  • + {createUlTree({ + name: `${call.section}.${call.method}`, + args: call.args, + decimals, + unit, + api + })} + + ) +} + const handleBatchDisplay = ({ value, decimals, @@ -46,21 +74,9 @@ const handleBatchDisplay = ({ key: string api: ApiPromise }) => - value.map((call: any, index: number) => { - const name = `${call.section}.${call.method}` - return ( - <> -
  • {name}
  • - {createUlTree({ - name: `${call.section}.${call.method}`, - args: call.args, - decimals, - unit, - api - })} - - ) - }) + value.map((call: any, index: number) => + handleCallDisplay({ call, decimals, unit, api, key: `${key}-${index}` }) + ) const handleBalanceDisplay = ({ value, @@ -86,10 +102,8 @@ const handleBalanceDisplay = ({ ) } -const getTypeName = (index: number, name: string, value: any, api: ApiPromise) => { - const [palletFromName, methodFromName] = name.split('.') - const pallet = value?.section || palletFromName - const method = value?.method || methodFromName +const getTypeName = (index: number, name: string, api: ApiPromise) => { + const [pallet, method] = name.split('.') const metaArgs = !!pallet && !!method && api.tx[pallet][method].meta.args return ( @@ -101,15 +115,21 @@ const createUlTree = ({ name, args, decimals, unit, api, typeName }: CreateTreeP if (!args) return if (!name) return + // console.log('args', args) return (