|
|
@ -16,14 +16,14 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
content: string |
|
|
|
content: string |
|
|
|
}>({ |
|
|
|
}>({ |
|
|
|
display: '', |
|
|
|
display: '', |
|
|
|
content: '' |
|
|
|
content: '', |
|
|
|
}) |
|
|
|
}) |
|
|
|
const [atAddressOptions, setAtAddressOptions] = useState<{ |
|
|
|
const [atAddressOptions, setAtAddressOptions] = useState<{ |
|
|
|
title: string | JSX.Element |
|
|
|
title: string | JSX.Element |
|
|
|
disabled: boolean |
|
|
|
disabled: boolean |
|
|
|
}>({ |
|
|
|
}>({ |
|
|
|
title: <FormattedMessage id="udapp.atAddressOptionsTitle1" />, |
|
|
|
title: <FormattedMessage id="udapp.atAddressOptionsTitle1" />, |
|
|
|
disabled: true |
|
|
|
disabled: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
const [loadedAddress, setLoadedAddress] = useState<string>('') |
|
|
|
const [loadedAddress, setLoadedAddress] = useState<string>('') |
|
|
|
const [contractOptions, setContractOptions] = useState<{ |
|
|
|
const [contractOptions, setContractOptions] = useState<{ |
|
|
@ -31,7 +31,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
disabled: boolean |
|
|
|
disabled: boolean |
|
|
|
}>({ |
|
|
|
}>({ |
|
|
|
title: <FormattedMessage id="udapp.contractOptionsTitle1" />, |
|
|
|
title: <FormattedMessage id="udapp.contractOptionsTitle1" />, |
|
|
|
disabled: true |
|
|
|
disabled: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
const [loadedContractData, setLoadedContractData] = useState<ContractData>(null) |
|
|
|
const [loadedContractData, setLoadedContractData] = useState<ContractData>(null) |
|
|
|
const [constructorInterface, setConstructorInterface] = useState<FuncABI>(null) |
|
|
|
const [constructorInterface, setConstructorInterface] = useState<FuncABI>(null) |
|
|
@ -50,7 +50,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
enableAtAddress(false) |
|
|
|
enableAtAddress(false) |
|
|
|
setAbiLabel({ |
|
|
|
setAbiLabel({ |
|
|
|
display: 'none', |
|
|
|
display: 'none', |
|
|
|
content: 'ABI file selected' |
|
|
|
content: 'ABI file selected', |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, []) |
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
@ -71,19 +71,19 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
if (/.(.abi)$/.exec(currentFile) && '' !== atAddressValue.current.value) { |
|
|
|
if (/.(.abi)$/.exec(currentFile) && '' !== atAddressValue.current.value) { |
|
|
|
setAbiLabel({ |
|
|
|
setAbiLabel({ |
|
|
|
display: 'block', |
|
|
|
display: 'block', |
|
|
|
content: currentFile |
|
|
|
content: currentFile, |
|
|
|
}) |
|
|
|
}) |
|
|
|
enableAtAddress(true) |
|
|
|
enableAtAddress(true) |
|
|
|
} else if (isContractFile(currentFile)) { |
|
|
|
} else if (isContractFile(currentFile)) { |
|
|
|
setAbiLabel({ |
|
|
|
setAbiLabel({ |
|
|
|
display: 'none', |
|
|
|
display: 'none', |
|
|
|
content: '' |
|
|
|
content: '', |
|
|
|
}) |
|
|
|
}) |
|
|
|
if (!currentContract) enableAtAddress(false) |
|
|
|
if (!currentContract) enableAtAddress(false) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setAbiLabel({ |
|
|
|
setAbiLabel({ |
|
|
|
display: 'none', |
|
|
|
display: 'none', |
|
|
|
content: '' |
|
|
|
content: '', |
|
|
|
}) |
|
|
|
}) |
|
|
|
if (!currentContract) enableAtAddress(false) |
|
|
|
if (!currentContract) enableAtAddress(false) |
|
|
|
} |
|
|
|
} |
|
|
@ -150,7 +150,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
<span className="text-start"> |
|
|
|
<span className="text-start"> |
|
|
|
<FormattedMessage id="udapp.atAddressOptionsTitle2" values={{ br: <br /> }} /> |
|
|
|
<FormattedMessage id="udapp.atAddressOptionsTitle2" values={{ br: <br /> }} /> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
) |
|
|
|
), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setAtAddressOptions({ |
|
|
|
setAtAddressOptions({ |
|
|
@ -161,7 +161,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
<span className="text-start"> |
|
|
|
<span className="text-start"> |
|
|
|
<FormattedMessage id="udapp.atAddressOptionsTitle4" values={{ br: <br /> }} /> |
|
|
|
<FormattedMessage id="udapp.atAddressOptionsTitle4" values={{ br: <br /> }} /> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
) |
|
|
|
), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -170,7 +170,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
if (enable) { |
|
|
|
if (enable) { |
|
|
|
setContractOptions({ |
|
|
|
setContractOptions({ |
|
|
|
disabled: false, |
|
|
|
disabled: false, |
|
|
|
title: <FormattedMessage id="udapp.contractOptionsTitle2" /> |
|
|
|
title: <FormattedMessage id="udapp.contractOptionsTitle2" />, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setContractOptions({ |
|
|
|
setContractOptions({ |
|
|
@ -182,7 +182,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
<span className="text-start"> |
|
|
|
<span className="text-start"> |
|
|
|
<FormattedMessage id="udapp.contractOptionsTitle4" values={{ br: <br /> }} /> |
|
|
|
<FormattedMessage id="udapp.contractOptionsTitle4" values={{ br: <br /> }} /> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
) |
|
|
|
), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -289,7 +289,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
setCompilerName(contract.compilerName) |
|
|
|
setCompilerName(contract.compilerName) |
|
|
|
setContractOptions({ |
|
|
|
setContractOptions({ |
|
|
|
disabled: false, |
|
|
|
disabled: false, |
|
|
|
title: <FormattedMessage id="udapp.contractOptionsTitle2" /> |
|
|
|
title: <FormattedMessage id="udapp.contractOptionsTitle2" />, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
@ -297,7 +297,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
setCompilerName('') |
|
|
|
setCompilerName('') |
|
|
|
setContractOptions({ |
|
|
|
setContractOptions({ |
|
|
|
title: <FormattedMessage id="udapp.contractOptionsTitle1" />, |
|
|
|
title: <FormattedMessage id="udapp.contractOptionsTitle1" />, |
|
|
|
disabled: true |
|
|
|
disabled: true, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -323,7 +323,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
<a href="https://eips.ethereum.org/EIPS/eip-55" target="_blank" rel="noreferrer"> |
|
|
|
<a href="https://eips.ethereum.org/EIPS/eip-55" target="_blank" rel="noreferrer"> |
|
|
|
EIP-55 |
|
|
|
EIP-55 |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
) |
|
|
|
), |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</span> |
|
|
|
</span> |
|
|
@ -343,7 +343,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
<a href="https://eips.ethereum.org/EIPS/eip-170" target="_blank" rel="noreferrer"> |
|
|
|
<a href="https://eips.ethereum.org/EIPS/eip-170" target="_blank" rel="noreferrer"> |
|
|
|
eip-170 |
|
|
|
eip-170 |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
) |
|
|
|
), |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -358,7 +358,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
<a href="https://eips.ethereum.org/EIPS/eip-3860" target="_blank" rel="noreferrer"> |
|
|
|
<a href="https://eips.ethereum.org/EIPS/eip-3860" target="_blank" rel="noreferrer"> |
|
|
|
eip-3860 |
|
|
|
eip-3860 |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
) |
|
|
|
), |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -383,7 +383,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
<FormattedMessage |
|
|
|
<FormattedMessage |
|
|
|
id="udapp.compiledBy" |
|
|
|
id="udapp.compiledBy" |
|
|
|
values={{ |
|
|
|
values={{ |
|
|
|
compilerName: <span className="text-capitalize">{compilerName}</span> |
|
|
|
compilerName: <span className="text-capitalize">{compilerName}</span>, |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</label> |
|
|
|
</label> |
|
|
@ -423,7 +423,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
disabled={contractOptions.disabled} |
|
|
|
disabled={contractOptions.disabled} |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
display: loadType === 'abi' && !isContractFile(currentFile) ? 'none' : 'block', |
|
|
|
display: loadType === 'abi' && !isContractFile(currentFile) ? 'none' : 'block', |
|
|
|
pointerEvents: contractOptions.disabled ? 'none' : 'auto' |
|
|
|
pointerEvents: contractOptions.disabled ? 'none' : 'auto', |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
<option value="" disabled hidden> |
|
|
|
<option value="" disabled hidden> |
|
|
@ -509,7 +509,12 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
<div className="pt-2 d-flex flex-column sudapp_button udapp_atAddressSect"> |
|
|
|
<div className="pt-2 d-flex flex-column sudapp_button udapp_atAddressSect"> |
|
|
|
<div className="d-flex flex-row"> |
|
|
|
<div className="d-flex flex-row"> |
|
|
|
<CustomTooltip placement={'top-end'} tooltipClasses="text-wrap text-left" tooltipId="runAndDeployAddresstooltip" tooltipText={atAddressOptions.title}> |
|
|
|
<CustomTooltip placement={'top-end'} tooltipClasses="text-wrap text-left" tooltipId="runAndDeployAddresstooltip" tooltipText={atAddressOptions.title}> |
|
|
|
<div id="runAndDeployAtAdressButtonContainer" onClick={loadFromAddress} data-title={atAddressOptions.title}> |
|
|
|
<div |
|
|
|
|
|
|
|
style={!atAddressOptions.disabled ? { cursor: 'pointer' } : { cursor: 'default' }} |
|
|
|
|
|
|
|
id="runAndDeployAtAdressButtonContainer" |
|
|
|
|
|
|
|
onClick={loadFromAddress} |
|
|
|
|
|
|
|
data-title={atAddressOptions.title} |
|
|
|
|
|
|
|
> |
|
|
|
<button |
|
|
|
<button |
|
|
|
className="udapp_atAddress btn-sm py-2 btn-primary" |
|
|
|
className="udapp_atAddress btn-sm py-2 btn-primary" |
|
|
|
id="runAndDeployAtAdressButton" |
|
|
|
id="runAndDeployAtAdressButton" |
|
|
@ -532,7 +537,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { |
|
|
|
ref={atAddressValue} |
|
|
|
ref={atAddressValue} |
|
|
|
className={(!addressIsValid ? 'border border-danger' : 'border-0') + ' h-100 udapp_input udapp_ataddressinput ataddressinput form-control'} |
|
|
|
className={(!addressIsValid ? 'border border-danger' : 'border-0') + ' h-100 udapp_input udapp_ataddressinput ataddressinput form-control'} |
|
|
|
placeholder={intl.formatMessage({ |
|
|
|
placeholder={intl.formatMessage({ |
|
|
|
id: 'udapp.loadContractFromAddress' |
|
|
|
id: 'udapp.loadContractFromAddress', |
|
|
|
})} |
|
|
|
})} |
|
|
|
onChange={atAddressChanged} |
|
|
|
onChange={atAddressChanged} |
|
|
|
/> |
|
|
|
/> |
|
|
|