Compare commits
1 Commits
fix/delete
...
fix/script
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d459b2ee92 |
@@ -32,7 +32,6 @@ import { SetHookDialog } from "./SetHookDialog";
|
|||||||
import { addFunds } from "../state/actions/addFaucetAccount";
|
import { addFunds } from "../state/actions/addFaucetAccount";
|
||||||
import { deleteHook } from "../state/actions/deployHook";
|
import { deleteHook } from "../state/actions/deployHook";
|
||||||
import { capitalize } from "../utils/helpers";
|
import { capitalize } from "../utils/helpers";
|
||||||
import { deleteAccount } from '../state/actions/deleteAccount';
|
|
||||||
|
|
||||||
export const AccountDialog = ({
|
export const AccountDialog = ({
|
||||||
activeAccountAddress,
|
activeAccountAddress,
|
||||||
@@ -100,7 +99,10 @@ export const AccountDialog = ({
|
|||||||
css={{ ml: "auto", mr: "$9" }}
|
css={{ ml: "auto", mr: "$9" }}
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
deleteAccount(activeAccount?.address);
|
const index = state.accounts.findIndex(
|
||||||
|
acc => acc.address === activeAccount?.address
|
||||||
|
);
|
||||||
|
state.accounts.splice(index, 1);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Delete Account <Trash size="15px" />
|
Delete Account <Trash size="15px" />
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export const Log: FC<ILog> = ({
|
|||||||
|
|
||||||
const enrichAccounts = useCallback(
|
const enrichAccounts = useCallback(
|
||||||
(str?: string): ReactNode => {
|
(str?: string): ReactNode => {
|
||||||
if (!str || !accounts.length) return str;
|
if (!str || !accounts.length) return null;
|
||||||
|
|
||||||
const pattern = `(${accounts.map(acc => acc.address).join("|")})`;
|
const pattern = `(${accounts.map(acc => acc.address).join("|")})`;
|
||||||
const res = regexifyString({
|
const res = regexifyString({
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ const RunScript: React.FC<{ file: IFile }> = ({ file: { content, name } }) => {
|
|||||||
setIframeCode(template);
|
setIframeCode(template);
|
||||||
|
|
||||||
state.scriptLogs = [
|
state.scriptLogs = [
|
||||||
...snap.scriptLogs,
|
|
||||||
{ type: "success", message: "Started running..." },
|
{ type: "success", message: "Started running..." },
|
||||||
];
|
];
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
import state, { transactionsState } from '..';
|
|
||||||
|
|
||||||
export const deleteAccount = (addr?: string) => {
|
|
||||||
if (!addr) return;
|
|
||||||
const index = state.accounts.findIndex(acc => acc.address === addr);
|
|
||||||
if (index === -1) return;
|
|
||||||
state.accounts.splice(index, 1);
|
|
||||||
|
|
||||||
// update selected accounts
|
|
||||||
transactionsState.transactions
|
|
||||||
.filter(t => t.state.selectedAccount?.value === addr)
|
|
||||||
.forEach(t => {
|
|
||||||
const acc = t.state.selectedAccount;
|
|
||||||
if (!acc) return;
|
|
||||||
acc.label = acc.value;
|
|
||||||
});
|
|
||||||
transactionsState.transactions
|
|
||||||
.filter(t => t.state.selectedDestAccount?.value === addr)
|
|
||||||
.forEach(t => {
|
|
||||||
const acc = t.state.selectedDestAccount;
|
|
||||||
if (!acc) return;
|
|
||||||
acc.label = acc.value;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user