From 9f4f50199c1b3df1315c0595139fc5aa62f0ec72 Mon Sep 17 00:00:00 2001 From: HenryNguyen5 Date: Tue, 19 Jun 2018 13:14:36 -0400 Subject: [PATCH] Support undefined input names (#1964) --- .../components/InteractExplorer/index.tsx | 23 ++++++++++++------- common/libs/contracts/ABIFunction.ts | 11 +++++---- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx b/common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx index 8c9a4d14..084ba5ed 100644 --- a/common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx +++ b/common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx @@ -124,13 +124,20 @@ class InteractExplorerClass extends Component { {selectedFunction && (
{/* TODO: Use reusable components with validation */} - {selectedFunction.contract.inputs.map(input => { + {selectedFunction.contract.inputs.map((input, index) => { const { type, name } = input; - const inputState = this.state.inputs[name]; + // if name is not supplied to arg, use the index instead + // since that's what the contract ABI function factory subsitutes for the name + // if it is undefined + const parsedName = name === '' ? index : name; + + const inputState = this.state.inputs[parsedName]; return ( -
+