|
|
@ -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) |
|
|
|