Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Feature) Copy contract ABI from menu #233

Merged
merged 10 commits into from
Dec 26, 2018
14 changes: 14 additions & 0 deletions old-ui/app/components/account-dropdowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,19 @@ class AccountDropdowns extends Component {
},
'Copy address to clipboard',
),
ifContractAcc(keyring) ? h(
DropdownMenuItem,
{
closeMenu: () => {},
onClick: async () => {
const { selected } = this.props
const contractProps = await this.props.actions.getContract(selected)
const abi = contractProps && contractProps.abi
copyToClipboard(JSON.stringify(abi))
},
},
'Copy ABI to clipboard',
) : null,
(!this.ifHardwareAcc(selected) && !(ifContractAcc(keyring))) ? h(
DropdownMenuItem,
{
Expand Down Expand Up @@ -390,6 +403,7 @@ const mapDispatchToProps = (dispatch) => {
showConnectHWWalletPage: () => dispatch(actions.showConnectHWWalletPage()),
showQrView: (selected, identity) => dispatch(actions.showQrView(selected, identity)),
showDeleteImportedAccount: (identity) => dispatch(actions.showDeleteImportedAccount(identity)),
getContract: (addr) => dispatch(actions.getContract(addr)),
},
}
}
Expand Down