|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
import { shortenAddress } from "@remix-ui/helper" |
|
|
|
|
import { RunTab } from "../types/run-tab" |
|
|
|
|
import { clearInstances, setAccount, setExecEnv } from "./actions" |
|
|
|
|
import { displayNotification, displayPopUp, fetchAccountsListFailed, fetchAccountsListRequest, fetchAccountsListSuccess, setMatchPassphrase, setPassphrase } from "./payload" |
|
|
|
|
import { displayNotification, fetchAccountsListFailed, fetchAccountsListRequest, fetchAccountsListSuccess, setMatchPassphrase, setPassphrase } from "./payload" |
|
|
|
|
import { toChecksumAddress } from '@ethereumjs/util' |
|
|
|
|
|
|
|
|
|
export const updateAccountBalances = async (plugin: RunTab, dispatch: React.Dispatch<any>) => { |
|
|
|
@ -39,7 +39,7 @@ export const fillAccountsList = async (plugin: RunTab, dispatch: React.Dispatch< |
|
|
|
|
dispatch(fetchAccountsListFailed(e.message)) |
|
|
|
|
} |
|
|
|
|
} catch (e) { |
|
|
|
|
dispatch(displayPopUp(`Cannot get account list: ${e}`)) |
|
|
|
|
plugin.call('notification', 'toast', `Cannot get account list: ${e}`) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -78,9 +78,9 @@ export const createNewBlockchainAccount = async (plugin: RunTab, dispatch: React |
|
|
|
|
}, |
|
|
|
|
async (error, address) => { |
|
|
|
|
if (error) { |
|
|
|
|
return dispatch(displayPopUp('Cannot create an account: ' + error)) |
|
|
|
|
return plugin.call('notification', 'toast', 'Cannot create an account: ' + error) |
|
|
|
|
} |
|
|
|
|
dispatch(displayPopUp(`account ${address} created`)) |
|
|
|
|
plugin.call('notification', 'toast', `account ${address} created`) |
|
|
|
|
await fillAccountsList(plugin, dispatch) |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
@ -89,7 +89,7 @@ export const createNewBlockchainAccount = async (plugin: RunTab, dispatch: React |
|
|
|
|
export const signMessageWithAddress = (plugin: RunTab, dispatch: React.Dispatch<any>, 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) |
|
|
|
|
return plugin.call('notification', 'toast', err) |
|
|
|
|
} |
|
|
|
|
dispatch(displayNotification('Signed Message', modalContent(msgHash, signedData), 'OK', null, () => {}, null)) |
|
|
|
|
}) |
|
|
|
|