diff --git a/src/main/anchor.ts b/src/main/anchor.ts index abefe4d6..f34d9168 100644 --- a/src/main/anchor.ts +++ b/src/main/anchor.ts @@ -1,5 +1,6 @@ import { FetchAnchorIDLRequest } from '../types/types'; import { execAsync, RESOURCES_PATH } from './const'; +import { logger } from './logger'; const fetchAnchorIdl = async (msg: FetchAnchorIDLRequest) => { // Anchor doesn't seem to accept a flag for where Anchor.toml is (???) @@ -11,7 +12,7 @@ const fetchAnchorIdl = async (msg: FetchAnchorIDLRequest) => { process.chdir(cwd); return JSON.parse(stdout); } catch (error) { - console.log(error); + logger.error(error); return { error, }; diff --git a/src/main/main.ts b/src/main/main.ts index dd7b871c..c78a0242 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -56,7 +56,7 @@ ipcMain.on( break; case 'fetch-anchor-idl': res = await fetchAnchorIdl(msg); - console.log(`fetchIDL(${msg}: (${res})`); + logger.debug(`fetchIDL(${msg}: (${res})`); break; // case 'update-account-name': // await updateAccountName(msg); diff --git a/src/renderer/components/AccountView.tsx b/src/renderer/components/AccountView.tsx index 137ab784..facd5cd1 100644 --- a/src/renderer/components/AccountView.tsx +++ b/src/renderer/components/AccountView.tsx @@ -61,10 +61,9 @@ function AccountView(props: { pubKey: string | undefined }) { } }, 666); - if (!account) { - return <>No account selected; - } - const humanName = getHumanName(account); + const humanName = account + ? getHumanName(account) + : 'No on-chain account selected'; return ( @@ -94,7 +93,7 @@ function AccountView(props: { pubKey: string | undefined }) { - + {pubKey ? : 'None selected'} @@ -103,7 +102,9 @@ function AccountView(props: { pubKey: string | undefined }) { SOL - {truncateLamportAmount(account)} + + {account ? truncateLamportAmount(account) : 0} + @@ -111,7 +112,7 @@ function AccountView(props: { pubKey: string | undefined }) { Executable - {account.accountInfo.executable ? ( + {account?.accountInfo.executable ? (
- - analytics('clickExplorerLink', { net }) - } - href={explorerURL(net, account.accountId.toString())} - target="_blank" - className="sol-link" - rel="noreferrer" - > - Link - + {account ? ( + + analytics('clickExplorerLink', { net }) + } + href={explorerURL( + net, + account.accountId.toString() + )} + target="_blank" + className="sol-link" + rel="noreferrer" + > + Link + + ) : ( + 'No onchain account' + )}