Skip to content

Commit

Permalink
enhancement: present smart contract inputs as name: value
Browse files Browse the repository at this point in the history
  • Loading branch information
nicole-obrien committed May 16, 2024
1 parent cfc16f9 commit c8ebf67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
let baseCoinTransfer: TokenTransferData | undefined
let isSmartContractCall = false
let methodName: string | undefined = undefined
let inputs: IParsedInput[] | undefined = undefined
let inputs: Record<string, unknown> | undefined = undefined
let busy = false
setTransactionInformation()
Expand All @@ -76,7 +76,10 @@
)
methodName = parsedData?.parsedMethod?.name
inputs = parsedData?.parsedMethod?.inputs
inputs = parsedData?.parsedMethod?.inputs.reduce((acc, input: IParsedInput) => {
acc[input.name] = input.value
return acc
}, {})
switch (parsedData?.type) {
case ParsedSmartContractType.CoinTransfer: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
const url = getExplorerUrl(activity.destinationNetworkId, ExplorerEndpoint.Address, address)
openUrlInBrowser(url)
}
// change inputs from object with index as key to object with name as key
$: inputs = activity.inputs?.reduce((acc, input) => {
acc[input.name] = input.value
return acc
}, {})
</script>

<Table
Expand Down Expand Up @@ -41,7 +47,7 @@
},
{
key: localize('general.inputs'),
value: activity.inputs,
value: inputs,
},
{
key: localize('general.data'),
Expand Down

0 comments on commit c8ebf67

Please sign in to comment.