|
|
|
@ -161,136 +161,61 @@ export function UniversalDappUI(props: any) { |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div className="row m-0"> |
|
|
|
|
{containers |
|
|
|
|
? containers.map((id: any) => { |
|
|
|
|
return ( |
|
|
|
|
<div className="col-md" key={id}> |
|
|
|
|
{items[id].map((funcId: any, index: any) => { |
|
|
|
|
const funcABI = contractABI[funcId]; |
|
|
|
|
if (funcABI.type !== 'function') return null; |
|
|
|
|
const isConstant = |
|
|
|
|
{containers.map((id: any) => { |
|
|
|
|
return ( |
|
|
|
|
<div className="col-md" key={id}> |
|
|
|
|
{items[id].map((funcId: any, index: any) => { |
|
|
|
|
const funcABI = contractABI[funcId]; |
|
|
|
|
if (funcABI.type !== 'function') return null; |
|
|
|
|
const isConstant = |
|
|
|
|
funcABI.constant !== undefined ? funcABI.constant : false; |
|
|
|
|
const lookupOnly = |
|
|
|
|
const lookupOnly = |
|
|
|
|
funcABI.stateMutability === 'view' || |
|
|
|
|
funcABI.stateMutability === 'pure' || |
|
|
|
|
isConstant; |
|
|
|
|
const inputs = getFuncABIInputs(funcABI); |
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
|
className="p-2 bg-light mb-2" |
|
|
|
|
data-id={`function${funcId}`} |
|
|
|
|
key={funcId} |
|
|
|
|
> |
|
|
|
|
<div className="w-100 mb-2"> |
|
|
|
|
<div> |
|
|
|
|
{funcABI.title && <h3 data-id={`functionTitle${funcId}`}>{funcABI.title}</h3>} |
|
|
|
|
<ContractGUI |
|
|
|
|
funcABI={funcABI} |
|
|
|
|
clickCallBack={( |
|
|
|
|
valArray: { name: string; type: string }[], |
|
|
|
|
inputsValues: string |
|
|
|
|
) => { |
|
|
|
|
runTransaction( |
|
|
|
|
lookupOnly, |
|
|
|
|
funcABI, |
|
|
|
|
valArray, |
|
|
|
|
inputsValues, |
|
|
|
|
funcId |
|
|
|
|
); |
|
|
|
|
}} |
|
|
|
|
inputs={inputs} |
|
|
|
|
lookupOnly={lookupOnly} |
|
|
|
|
key={funcId} |
|
|
|
|
/> |
|
|
|
|
{funcABI.details && ( |
|
|
|
|
<div className="pt-2 udapp_intro" data-id={`functionInstructions${funcId}`}> |
|
|
|
|
{funcABI.details} |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
{lookupOnly && ( |
|
|
|
|
<div className="udapp_value" data-id="udapp_value"> |
|
|
|
|
<TreeView id="treeView"> |
|
|
|
|
{Object.keys( |
|
|
|
|
instance.decodedResponse || {} |
|
|
|
|
).map((key) => { |
|
|
|
|
const funcIndex = funcId; |
|
|
|
|
const response = |
|
|
|
|
const inputs = getFuncABIInputs(funcABI); |
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
|
className="p-2 bg-light mb-2" |
|
|
|
|
data-id={`function${funcId}`} |
|
|
|
|
key={funcId} |
|
|
|
|
> |
|
|
|
|
<div className="w-100 mb-2"> |
|
|
|
|
<div> |
|
|
|
|
{funcABI.title && <h3 data-id={`functionTitle${funcId}`}>{funcABI.title}</h3>} |
|
|
|
|
<ContractGUI |
|
|
|
|
funcABI={funcABI} |
|
|
|
|
clickCallBack={( |
|
|
|
|
valArray: { name: string; type: string }[], |
|
|
|
|
inputsValues: string |
|
|
|
|
) => { |
|
|
|
|
runTransaction( |
|
|
|
|
lookupOnly, |
|
|
|
|
funcABI, |
|
|
|
|
valArray, |
|
|
|
|
inputsValues, |
|
|
|
|
funcId |
|
|
|
|
); |
|
|
|
|
}} |
|
|
|
|
inputs={inputs} |
|
|
|
|
lookupOnly={lookupOnly} |
|
|
|
|
key={funcId} |
|
|
|
|
/> |
|
|
|
|
{funcABI.details && ( |
|
|
|
|
<div className="pt-2 udapp_intro" data-id={`functionInstructions${funcId}`}> |
|
|
|
|
{funcABI.details} |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
{lookupOnly && ( |
|
|
|
|
<div className="udapp_value" data-id="udapp_value"> |
|
|
|
|
<TreeView id="treeView"> |
|
|
|
|
{Object.keys( |
|
|
|
|
instance.decodedResponse || {} |
|
|
|
|
).map((key) => { |
|
|
|
|
const funcIndex = funcId; |
|
|
|
|
const response = |
|
|
|
|
instance.decodedResponse[key]; |
|
|
|
|
|
|
|
|
|
return key === funcIndex |
|
|
|
|
? Object.keys(response || {}).map( |
|
|
|
|
(innerkey, _index) => { |
|
|
|
|
return renderData( |
|
|
|
|
instance.decodedResponse[key][ |
|
|
|
|
innerkey |
|
|
|
|
], |
|
|
|
|
response, |
|
|
|
|
innerkey, |
|
|
|
|
innerkey |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
: null; |
|
|
|
|
})} |
|
|
|
|
</TreeView> |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
})} |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
}) |
|
|
|
|
: contractABI?.map((funcABI: any, index: any) => { |
|
|
|
|
if (funcABI.type !== 'function') return null; |
|
|
|
|
const isConstant = |
|
|
|
|
funcABI.constant !== undefined ? funcABI.constant : false; |
|
|
|
|
const lookupOnly = |
|
|
|
|
funcABI.stateMutability === 'view' || |
|
|
|
|
funcABI.stateMutability === 'pure' || |
|
|
|
|
isConstant; |
|
|
|
|
const inputs = getFuncABIInputs(funcABI); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
|
key={index} |
|
|
|
|
className={`instance d-block flex-column bg-transparent udapp_run-instance border-dark col-6`} |
|
|
|
|
data-shared="universalDappUiInstance" |
|
|
|
|
> |
|
|
|
|
<div |
|
|
|
|
className="p-2 bg-light mb-2" |
|
|
|
|
data-id="universalDappUiContractActionWrapper" |
|
|
|
|
> |
|
|
|
|
<div className="w-100 mb-2"> |
|
|
|
|
<div> |
|
|
|
|
<ContractGUI |
|
|
|
|
funcABI={funcABI} |
|
|
|
|
clickCallBack={( |
|
|
|
|
valArray: { name: string; type: string }[], |
|
|
|
|
inputsValues: string |
|
|
|
|
) => { |
|
|
|
|
runTransaction( |
|
|
|
|
lookupOnly, |
|
|
|
|
funcABI, |
|
|
|
|
valArray, |
|
|
|
|
inputsValues, |
|
|
|
|
index |
|
|
|
|
); |
|
|
|
|
}} |
|
|
|
|
inputs={inputs} |
|
|
|
|
lookupOnly={lookupOnly} |
|
|
|
|
key={index} |
|
|
|
|
/> |
|
|
|
|
{lookupOnly && ( |
|
|
|
|
<div className="udapp_value" data-id="udapp_value"> |
|
|
|
|
<TreeView id="treeView"> |
|
|
|
|
{Object.keys(instance.decodedResponse || {}).map( |
|
|
|
|
(key) => { |
|
|
|
|
const funcIndex = index.toString(); |
|
|
|
|
const response = instance.decodedResponse[key]; |
|
|
|
|
|
|
|
|
|
return key === funcIndex |
|
|
|
|
? Object.keys(response || {}).map( |
|
|
|
|
(innerkey, _index) => { |
|
|
|
@ -305,17 +230,18 @@ export function UniversalDappUI(props: any) { |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
: null; |
|
|
|
|
} |
|
|
|
|
)} |
|
|
|
|
</TreeView> |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
})} |
|
|
|
|
</TreeView> |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
})} |
|
|
|
|
); |
|
|
|
|
})} |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
})} |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|