|
|
@ -4,59 +4,59 @@ import { extractData } from '../../utils/solidityTypeFormatter' |
|
|
|
import { ExtractData } from '../../types' |
|
|
|
import { ExtractData } from '../../types' |
|
|
|
|
|
|
|
|
|
|
|
export const SolidityLocals = ({ data, message, registerEvent, triggerEvent }) => { |
|
|
|
export const SolidityLocals = ({ data, message, registerEvent, triggerEvent }) => { |
|
|
|
const [calldata, setCalldata] = useState(null) |
|
|
|
const [calldata, setCalldata] = useState(null) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
data && setCalldata(data) |
|
|
|
data && setCalldata(data) |
|
|
|
}, [data]) |
|
|
|
}, [data]) |
|
|
|
|
|
|
|
|
|
|
|
const formatSelf = (key: string, data: ExtractData) => { |
|
|
|
const formatSelf = (key: string, data: ExtractData) => { |
|
|
|
let color = 'var(--primary)' |
|
|
|
let color = 'var(--primary)' |
|
|
|
if (data.isArray || data.isStruct || data.isMapping) { |
|
|
|
if (data.isArray || data.isStruct || data.isMapping) { |
|
|
|
color = 'var(--info)' |
|
|
|
color = 'var(--info)' |
|
|
|
} else if ( |
|
|
|
} else if ( |
|
|
|
data.type.indexOf('uint') === 0 || |
|
|
|
data.type.indexOf('uint') === 0 || |
|
|
|
data.type.indexOf('int') === 0 || |
|
|
|
data.type.indexOf('int') === 0 || |
|
|
|
data.type.indexOf('bool') === 0 || |
|
|
|
data.type.indexOf('bool') === 0 || |
|
|
|
data.type.indexOf('enum') === 0 |
|
|
|
data.type.indexOf('enum') === 0 |
|
|
|
) { |
|
|
|
) { |
|
|
|
color = 'var(--green)' |
|
|
|
color = 'var(--green)' |
|
|
|
} else if (data.type === 'string') { |
|
|
|
} else if (data.type === 'string') { |
|
|
|
color = 'var(--teal)' |
|
|
|
color = 'var(--teal)' |
|
|
|
} else if (data.self == 0x0) { // eslint-disable-line
|
|
|
|
} else if (data.self == 0x0) { // eslint-disable-line
|
|
|
|
color = 'var(--gray)' |
|
|
|
color = 'var(--gray)' |
|
|
|
} |
|
|
|
} |
|
|
|
if (data.type === 'string') { |
|
|
|
if (data.type === 'string') { |
|
|
|
data.self = JSON.stringify(data.self) |
|
|
|
data.self = JSON.stringify(data.self) |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
<label className='mb-0' style={{ color: data.isProperty ? 'var(--info)' : '', whiteSpace: 'pre-wrap' }}> |
|
|
|
|
|
|
|
{' ' + key}: |
|
|
|
|
|
|
|
<label className='mb-0' style={{ color }}> |
|
|
|
|
|
|
|
{' ' + data.self} |
|
|
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
<label style={{ fontStyle: 'italic' }}> |
|
|
|
|
|
|
|
{data.isProperty || !data.type ? '' : ' ' + data.type} |
|
|
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
</label> |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div id='soliditylocals' data-id="solidityLocals"> |
|
|
|
<label className='mb-0' style={{ color: data.isProperty ? 'var(--info)' : '', whiteSpace: 'pre-wrap' }}> |
|
|
|
<DropdownPanel
|
|
|
|
{' ' + key}: |
|
|
|
dropdownName='Solidity Locals' |
|
|
|
<label className='mb-0' style={{ color }}> |
|
|
|
dropdownMessage={message} |
|
|
|
{' ' + data.self} |
|
|
|
calldata={calldata || {}} |
|
|
|
</label> |
|
|
|
extractFunc={extractData} |
|
|
|
<label style={{ fontStyle: 'italic' }}> |
|
|
|
formatSelfFunc={formatSelf} |
|
|
|
{data.isProperty || !data.type ? '' : ' ' + data.type} |
|
|
|
registerEvent={registerEvent} |
|
|
|
</label> |
|
|
|
triggerEvent={triggerEvent} |
|
|
|
</label> |
|
|
|
loadMoreEvent='solidityLocalsLoadMore' |
|
|
|
|
|
|
|
loadMoreCompletedEvent='solidityLocalsLoadMoreCompleted' |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
|
|
|
<div id='soliditylocals' data-id="solidityLocals"> |
|
|
|
|
|
|
|
<DropdownPanel
|
|
|
|
|
|
|
|
dropdownName='Solidity Locals' |
|
|
|
|
|
|
|
dropdownMessage={message} |
|
|
|
|
|
|
|
calldata={calldata || {}} |
|
|
|
|
|
|
|
extractFunc={extractData} |
|
|
|
|
|
|
|
formatSelfFunc={formatSelf} |
|
|
|
|
|
|
|
registerEvent={registerEvent} |
|
|
|
|
|
|
|
triggerEvent={triggerEvent} |
|
|
|
|
|
|
|
loadMoreEvent='solidityLocalsLoadMore' |
|
|
|
|
|
|
|
loadMoreCompletedEvent='solidityLocalsLoadMoreCompleted' |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default SolidityLocals |
|
|
|
export default SolidityLocals |