fix signature

pull/2046/head
yann300 3 years ago
parent de96b524ea
commit a799e27e27
  1. 12
      libs/remix-ui/run-tab/src/lib/components/account.tsx

@ -1,5 +1,5 @@
// eslint-disable-next-line no-use-before-define
import React, { useEffect, useState } from 'react'
import React, { useEffect, useState, useRef } from 'react'
import { CopyToClipboard } from '@remix-ui/clipboard'
import { AccountProps } from '../types'
import { PassphrasePrompt } from './passphrase'
@ -11,7 +11,7 @@ export function AccountUI (props: AccountProps) {
classList: '',
title: ''
})
const [message, setMessage] = useState('')
const messageRef = useRef('')
useEffect(() => {
if (!selectedAccount && accounts.length > 0) props.setAccount(accounts[0])
@ -79,7 +79,7 @@ export function AccountUI (props: AccountProps) {
setPassphrase={props.setPassphrase}
/>, 'OK', () => {
props.modal('Sign a message', signMessagePrompt(), 'OK', () => {
props.signMessageWithAddress(selectedAccount, message, signedMessagePrompt, props.passphrase)
props.signMessageWithAddress(selectedAccount, messageRef.current, signedMessagePrompt, props.passphrase)
props.setPassphrase('')
}, 'Cancel', null)
}, 'Cancel', () => {
@ -88,7 +88,7 @@ export function AccountUI (props: AccountProps) {
}
props.modal('Sign a message', signMessagePrompt(), 'OK', () => {
props.signMessageWithAddress(selectedAccount, message, signedMessagePrompt)
props.signMessageWithAddress(selectedAccount, messageRef.current, signedMessagePrompt)
}, 'Cancel', null)
}
@ -101,7 +101,7 @@ export function AccountUI (props: AccountProps) {
}
const handleMessageInput = (e) => {
setMessage(e.target.value)
messageRef.current = e.target.value
}
const passphraseCreationPrompt = () => {
@ -128,7 +128,7 @@ export function AccountUI (props: AccountProps) {
rows={4}
cols={50}
onInput={handleMessageInput}
defaultValue={message}
defaultValue={messageRef.current}
></textarea>
</div>
</div>

Loading…
Cancel
Save