pull/5298/head
yann300 2 months ago committed by Aniket
parent f89f6f4dbe
commit f7bd13b9f8
  1. 4
      apps/remix-ide/src/blockchain/providers/vm.ts
  2. 16
      libs/remix-ui/run-tab/src/lib/components/account.tsx
  3. 6
      libs/remix-ui/workspace/src/lib/actions/index.tsx
  4. 6
      libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx

@ -39,8 +39,8 @@ export class VMProvider {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.worker.addEventListener('message', (msg) => { this.worker.addEventListener('message', (msg) => {
if (msg.data.cmd === 'sendAsyncResult' && stamps[msg.data.stamp]) { if (msg.data.cmd === 'sendAsyncResult' && stamps[msg.data.stamp]) {
let result = msg.data.result const result = msg.data.result
if (stamps[msg.data.stamp].request && msg.data.result) result = msg.data.result.result // if (stamps[msg.data.stamp].request && msg.data.result) result = msg.data.result.result
if (stamps[msg.data.stamp].callback) { if (stamps[msg.data.stamp].callback) {
stamps[msg.data.stamp].callback(msg.data.error, result) stamps[msg.data.stamp].callback(msg.data.error, result)

@ -178,19 +178,19 @@ export function AccountUI(props: AccountProps) {
<div className='mt-2'> <div className='mt-2'>
<span>otherwise</span><button className='ml-2 modal-ok btn btn-sm border-primary' data-id="sign-eip-712" onClick={() => { <span>otherwise</span><button className='ml-2 modal-ok btn btn-sm border-primary' data-id="sign-eip-712" onClick={() => {
props.modal( props.modal(
'Message signing with EIP-712', 'Message signing with EIP-712',
<div> <div>
<div>{intl.formatMessage({ id: 'udapp.EIP712-2' }, { <div>{intl.formatMessage({ id: 'udapp.EIP712-2' }, {
a: (chunks) => ( a: (chunks) => (
<a href='https://eips.ethereum.org/EIPS/eip-712' target="_blank" rel="noreferrer"> <a href='https://eips.ethereum.org/EIPS/eip-712' target="_blank" rel="noreferrer">
{chunks} {chunks}
</a> </a>
) )
})}</div> })}</div>
<div>{intl.formatMessage({ id: 'udapp.EIP712-3' })}</div></div>, <div>{intl.formatMessage({ id: 'udapp.EIP712-3' })}</div></div>,
intl.formatMessage({ id: 'udapp.EIP712-create-template' }), intl.formatMessage({ id: 'udapp.EIP712-create-template' }),
() => { props.addFile('EIP-712-data.json', JSON.stringify(EIP712_Example, null, '\t')) }, () => { props.addFile('EIP-712-data.json', JSON.stringify(EIP712_Example, null, '\t')) },
intl.formatMessage({ id: 'udapp.EIP712-close' }), intl.formatMessage({ id: 'udapp.EIP712-close' }),
() => {}) () => {})
}}>Sign with EIP 712</button> }}>Sign with EIP 712</button>
</div> </div>

@ -512,21 +512,21 @@ export const runScript = async (path: string) => {
export const signTypedData = async (path: string) => { export const signTypedData = async (path: string) => {
const typedData = await plugin.call('fileManager', 'readFile', path) const typedData = await plugin.call('fileManager', 'readFile', path)
const web3 = await plugin.call('blockchain', 'web3') const web3 = await plugin.call('blockchain', 'web3')
const settings = await plugin.call('udapp', 'getSettings') const settings = await plugin.call('udapp', 'getSettings')
let parsed let parsed
try { try {
parsed = JSON.parse(typedData) parsed = JSON.parse(typedData)
} catch (err) { } catch (err) {
dispatch(displayPopUp(`${path} isn't a valid JSON.`)) dispatch(displayPopUp(`${path} isn't a valid JSON.`))
return return
} }
try { try {
const result = await web3.currentProvider.request({ const result = await web3.currentProvider.request({
method: 'eth_signTypedData', method: 'eth_signTypedData',
params: [settings.selectedAccount, parsed] params: [settings.selectedAccount, parsed]
}) })
plugin.call('terminal', 'log', { type: 'log', value: `${path} signature using ${settings.selectedAccount} : ${result}` }) plugin.call('terminal', 'log', { type: 'log', value: `${path} signature using ${settings.selectedAccount} : ${result}` })
} catch (e) { } catch (e) {
console.error(e) console.error(e)

@ -234,11 +234,11 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
case 'Publish Workspace to Gist': case 'Publish Workspace to Gist':
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'publishWorkspace']) _paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'publishWorkspace'])
publishFolderToGist(path) publishFolderToGist(path)
break break
case 'Sign Typed Data': case 'Sign Typed Data':
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'signTypedData']) _paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'signTypedData'])
signTypedData(path) signTypedData(path)
break break
default: default:
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', `${item.id}/${item.name}`]) _paq.push(['trackEvent', 'fileExplorer', 'contextMenu', `${item.id}/${item.name}`])
emit && emit({ ...item, path: [path]} as customAction) emit && emit({ ...item, path: [path]} as customAction)

Loading…
Cancel
Save