diff --git a/libs/remix-ui/run-tab/src/lib/actions/index.ts b/libs/remix-ui/run-tab/src/lib/actions/index.ts index e3f6cd91ed..2d1feaba6d 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/index.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/index.ts @@ -219,8 +219,10 @@ export const createNewBlockchainAccount = async (cbMessage: JSX.Element) => { if (plugin.REACT_API.passphrase === plugin.REACT_API.matchPassphrase) { cb(plugin.REACT_API.passphrase) } else { - return dispatch(displayNotification('Error', 'Passphase does not match', 'OK', null)) + dispatch(displayNotification('Error', 'Passphase does not match', 'OK', null)) } + setPassphrase('') + setMatchPassphrase('') }, () => {})) }, async (error, address) => { @@ -240,3 +242,13 @@ export const setPassphrasePrompt = (passphrase: string) => { export const setMatchPassphrasePrompt = (passphrase: string) => { dispatch(setMatchPassphrase(passphrase)) } + +// eslint-disable-next-line no-undef +export const signMessageWithAddress = (account: string, message: string, modalContent: (hash: string, data: string) => JSX.Element, passphrase?: string) => { + plugin.blockchain.signMessage(message, account, passphrase, (err, msgHash, signedData) => { + if (err) { + return displayPopUp(err) + } + dispatch(displayNotification('Signed Message', modalContent(msgHash, signedData), 'OK', null, () => {}, null)) + }) +} diff --git a/libs/remix-ui/run-tab/src/lib/components/account.tsx b/libs/remix-ui/run-tab/src/lib/components/account.tsx index f164dd20ba..a03ec87aaf 100644 --- a/libs/remix-ui/run-tab/src/lib/components/account.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/account.tsx @@ -10,6 +10,8 @@ export function AccountUI (props: AccountProps) { classList: '', title: '' }) + const [message, setMessage] = useState('') + const [signPassphrase, setSignPassphrase] = useState('') useEffect(() => { if (!selectedAccount && accounts.length > 0) props.setAccount(accounts[0]) @@ -24,7 +26,14 @@ export function AccountUI (props: AccountProps) { }) break - case 'vm': + case 'vm-london': + setPlusOpt({ + classList: '', + title: 'Create a new account' + }) + break + + case 'vm-berlin': setPlusOpt({ classList: '', title: 'Create a new account' @@ -55,54 +64,25 @@ export function AccountUI (props: AccountProps) { }, [props.selectExEnv, props.personalMode]) const newAccount = () => { - props.createNewBlockchainAccount(passphrasePrompt()) + props.createNewBlockchainAccount(passphraseCreationPrompt()) } const signMessage = () => { - // dispatch signMessageWithBlockchainAccounts - // this.blockchain.getAccounts((err, accounts) => { - // if (err) { - // return addTooltip(`Cannot get account list: ${err}`) - // } - - // var signMessageDialog = { title: 'Sign a message', text: 'Enter a message to sign', inputvalue: 'Message to sign' } - // var $txOrigin = this.el.querySelector('#txorigin') - // if (!$txOrigin.selectedOptions[0] && (this.blockchain.isInjectedWeb3() || this.blockchain.isWeb3Provider())) { - // return addTooltip('Account list is empty, please make sure the current provider is properly connected to remix') - // } - - // var account = $txOrigin.selectedOptions[0].value - - // var promptCb = (passphrase) => { - // const modal = modalDialogCustom.promptMulti(signMessageDialog, (message) => { - // this.blockchain.signMessage(message, account, passphrase, (err, msgHash, signedData) => { - // if (err) { - // return addTooltip(err) - // } - // modal.hide() - // modalDialogCustom.alert(yo` - //