diff --git a/src/background/controller/provider/controller.ts b/src/background/controller/provider/controller.ts
index 0859b5b3..65697818 100644
--- a/src/background/controller/provider/controller.ts
+++ b/src/background/controller/provider/controller.ts
@@ -225,7 +225,7 @@ class ProviderController extends BaseController {
const networkType = wallet.getNetworkType()
const psbtNetwork = toPsbtNetwork(networkType)
const psbt = bitcoin.Psbt.fromHex(psbtHex, { network: psbtNetwork })
- const autoFinalized = (options && options.autoFinalized == false) ? false : true;
+ const autoFinalized = !(options && options.autoFinalized == false);
const toSignInputs = await wallet.formatOptionsToSignInputs(psbtHex, options);
await wallet.signPsbt(psbt, toSignInputs, autoFinalized);
return psbt.toHex();
@@ -243,7 +243,7 @@ class ProviderController extends BaseController {
const result: string[] = [];
for (let i = 0; i < psbtHexs.length; i++) {
const psbt = bitcoin.Psbt.fromHex(psbtHexs[i], { network: psbtNetwork });
- const autoFinalized = (options && options[i] && options[i].autoFinalized == false) ? false : true;
+ const autoFinalized = !(options && options[i] && !options[i].autoFinalized);
const toSignInputs = await wallet.formatOptionsToSignInputs(psbtHexs[i], options[i]);
await wallet.signPsbt(psbt, toSignInputs, autoFinalized);
result.push(psbt.toHex())
diff --git a/src/background/controller/wallet.ts b/src/background/controller/wallet.ts
index 77c5b447..eedb67c1 100644
--- a/src/background/controller/wallet.ts
+++ b/src/background/controller/wallet.ts
@@ -105,11 +105,7 @@ export class WalletController extends BaseController {
};
isReady = () => {
- if (contactBookService.store) {
- return true;
- } else {
- return false;
- }
+ return !!contactBookService.store;
};
unlock = async (password: string) => {
diff --git a/src/background/service/keyring/index.ts b/src/background/service/keyring/index.ts
index 3f3367d6..49b3e688 100644
--- a/src/background/service/keyring/index.ts
+++ b/src/background/service/keyring/index.ts
@@ -194,7 +194,8 @@ class KeyringService extends EventEmitter {
* Import Keychain using Private key
*
* @emits KeyringController#unlock
- * @param privateKey - The privateKey to generate address
+ * @param privateKey - The privateKey to generate address
+ * @param addressType - The type of address
* @returns A Promise that resolves to the state.
*/
importPrivateKey = async (privateKey: string, addressType: AddressType) => {
diff --git a/src/content-script/index.ts b/src/content-script/index.ts
index 0f66a966..57a53441 100644
--- a/src/content-script/index.ts
+++ b/src/content-script/index.ts
@@ -8,7 +8,6 @@ const channelName = nanoid();
/**
* Injects a script tag into the current document
*
- * @param {string} content - Code to be executed in the current document
*/
function injectScript() {
try {
@@ -106,12 +105,7 @@ function blockedDomainCheck() {
}
function iframeCheck() {
- const isInIframe = self != top;
- if (isInIframe) {
- return true;
- } else {
- return false;
- }
+ return self != top;
}
/**
diff --git a/src/ui/components/AtomicalsNFTPreview/index.tsx b/src/ui/components/AtomicalsNFTPreview/index.tsx
index 67cd9cf7..136a036c 100644
--- a/src/ui/components/AtomicalsNFTPreview/index.tsx
+++ b/src/ui/components/AtomicalsNFTPreview/index.tsx
@@ -5,7 +5,7 @@ import { Atomical } from '@/shared/types';
import { colors } from '@/ui/theme/colors';
import { fontSizes } from '@/ui/theme/font';
-import { formatDate } from '../../utils';
+import { formatDate } from '@/ui/utils';
import { Column } from '../Column';
import Iframe from '../Iframe';
import { Row } from '../Row';
@@ -130,7 +130,7 @@ export default function AtomicalsNFTPreview({ data, onClick, preset }: Atomicals
- {isUnconfirmed == false && }
+ {!isUnconfirmed && }
);
diff --git a/src/ui/components/BRC20CardStack/index.less b/src/ui/components/BRC20CardStack/index.less
index d8db1935..81a34a6f 100644
--- a/src/ui/components/BRC20CardStack/index.less
+++ b/src/ui/components/BRC20CardStack/index.less
@@ -10,13 +10,13 @@
height: 198px;
width: 156px;
background-color: #17141d;
- border-radius: 0px;
+ border-radius: 0;
box-shadow: -1rem 0 3rem #000;
/* margin-left: -50px; */
transition: 0.4s ease-out;
position: relative;
- left: 0px;
- padding: 0px;
+ left: 0;
+ padding: 0;
}
.card:not(:first-child) {
diff --git a/src/ui/components/InscriptionPreview/index.tsx b/src/ui/components/InscriptionPreview/index.tsx
index 6b727e36..6a186353 100644
--- a/src/ui/components/InscriptionPreview/index.tsx
+++ b/src/ui/components/InscriptionPreview/index.tsx
@@ -6,7 +6,7 @@ import { useOrdinalsWebsite } from '@/ui/state/settings/hooks';
import { colors } from '@/ui/theme/colors';
import { fontSizes } from '@/ui/theme/font';
-import { formatDate } from '../../utils';
+import { formatDate } from '@/ui/utils';
import { Column } from '../Column';
import Iframe from '../Iframe';
import { Row } from '../Row';
@@ -142,7 +142,7 @@ export default function InscriptionPreview({ data, onClick, preset, asLogo }: In
) : null}
- {isUnconfirmed == false && data.timestamp && (
+ {!isUnconfirmed && data.timestamp && (
)}
diff --git a/src/ui/components/SignPsbtWithRisksPopover/SendingOutAssets.tsx b/src/ui/components/SignPsbtWithRisksPopover/SendingOutAssets.tsx
index 86c35c44..0c8c14ae 100644
--- a/src/ui/components/SignPsbtWithRisksPopover/SendingOutAssets.tsx
+++ b/src/ui/components/SignPsbtWithRisksPopover/SendingOutAssets.tsx
@@ -97,11 +97,7 @@ export const SendingOutAssets = ({ decodedPsbt, onClose }: { decodedPsbt: Decode
return inscriptionMap[id];
})
.filter((v) => {
- if (v.from === currentAccount.address && v.to !== currentAccount.address) {
- return true;
- } else {
- return false;
- }
+ return v.from === currentAccount.address && v.to !== currentAccount.address;
});
const arc20BalanceChanged: { [key: string]: number } = {};
diff --git a/src/ui/index.tsx b/src/ui/index.tsx
index c25ef29c..924484d3 100644
--- a/src/ui/index.tsx
+++ b/src/ui/index.tsx
@@ -97,7 +97,6 @@ const wallet: Record = new Proxy(
}
}
);
- break;
default:
return function (...params: any) {
return portMessageChannel.request({
diff --git a/src/ui/pages/Approval/components/MultiSignPsbt/index.tsx b/src/ui/pages/Approval/components/MultiSignPsbt/index.tsx
index 9141c799..7e8bd549 100644
--- a/src/ui/pages/Approval/components/MultiSignPsbt/index.tsx
+++ b/src/ui/pages/Approval/components/MultiSignPsbt/index.tsx
@@ -269,10 +269,8 @@ export default function MultiSignPsbt({
}, [decodedPsbt]);
const isValidData = useMemo(() => {
- if (psbtHex === '') {
- return false;
- }
- return true;
+ return psbtHex !== '';
+
}, [psbtHex]);
const isValid = useMemo(() => {
diff --git a/src/ui/pages/Approval/components/SignPsbt/index.tsx b/src/ui/pages/Approval/components/SignPsbt/index.tsx
index 484a5598..35293cb3 100644
--- a/src/ui/pages/Approval/components/SignPsbt/index.tsx
+++ b/src/ui/pages/Approval/components/SignPsbt/index.tsx
@@ -132,11 +132,7 @@ function SignTxDetails({
}, [txInfo.decodedPsbt]);
const isCurrentToPayFee = useMemo(() => {
- if (type === TxType.SIGN_TX) {
- return false;
- } else {
- return true;
- }
+ return type !== TxType.SIGN_TX;
}, [type]);
const spendSatoshis = useMemo(() => {
@@ -753,10 +749,8 @@ export default function SignPsbt({
}, [txInfo, brc20PriceMap, runesPriceMap]);
const isValidData = useMemo(() => {
- if (txInfo.psbtHex === '') {
- return false;
- }
- return true;
+ return txInfo.psbtHex !== '';
+
}, [txInfo.psbtHex]);
const isValid = useMemo(() => {
@@ -904,7 +898,7 @@ export default function SignPsbt({
{txInfo.decodedPsbt.inputInfos.map((v, index) => {
- const isToSign = txInfo.toSignInputs.find((v) => v.index === index) ? true : false;
+ const isToSign = !!txInfo.toSignInputs.find((v) => v.index === index);
const inscriptions = v.inscriptions;
const atomicals_nft = v.atomicals.filter((v) => v.type === 'NFT');
const atomicals_ft = v.atomicals.filter((v) => v.type === 'FT');
diff --git a/src/ui/pages/Main/BoostScreen.tsx b/src/ui/pages/Main/BoostScreen.tsx
index 77714dea..c65f7991 100644
--- a/src/ui/pages/Main/BoostScreen.tsx
+++ b/src/ui/pages/Main/BoostScreen.tsx
@@ -52,12 +52,8 @@ export default function BoostScreen() {
if (!currentAccount) {
navigate('WelcomeScreen');
- return;
- } else if (approval) {
- navigate('ApprovalScreen');
} else {
- navigate('MainScreen');
- return;
+ navigate(approval ? 'ApprovalScreen' : 'MainScreen');
}
};
diff --git a/src/ui/pages/Settings/EditAccountNameScreen.tsx b/src/ui/pages/Settings/EditAccountNameScreen.tsx
index c6bdfa92..c2cb1876 100644
--- a/src/ui/pages/Settings/EditAccountNameScreen.tsx
+++ b/src/ui/pages/Settings/EditAccountNameScreen.tsx
@@ -34,10 +34,8 @@ export default function EditAccountNameScreen() {
};
const validName = useMemo(() => {
- if (alianName.length == 0) {
- return false;
- }
- return true;
+ return alianName.length != 0;
+
}, [alianName]);
return (
diff --git a/src/ui/pages/Settings/EditWalletNameScreen.tsx b/src/ui/pages/Settings/EditWalletNameScreen.tsx
index d3859afa..e59ef490 100644
--- a/src/ui/pages/Settings/EditWalletNameScreen.tsx
+++ b/src/ui/pages/Settings/EditWalletNameScreen.tsx
@@ -29,10 +29,8 @@ export default function EditWalletNameScreen() {
};
const isValidName = useMemo(() => {
- if (alianName.length == 0) {
- return false;
- }
- return true;
+ return alianName.length != 0;
+
}, [alianName]);
return (
diff --git a/src/ui/pages/Wallet/KeystoneSignScreen.tsx b/src/ui/pages/Wallet/KeystoneSignScreen.tsx
index 01a364a5..0a6ff177 100644
--- a/src/ui/pages/Wallet/KeystoneSignScreen.tsx
+++ b/src/ui/pages/Wallet/KeystoneSignScreen.tsx
@@ -55,7 +55,7 @@ function Step2(props: Props) {
const onSucceed = async ({ type, cbor }) => {
if (props.type === 'psbt') {
- const res = await wallet.parseSignPsbtUr(type, cbor, props.isFinalize === false ? false : true);
+ const res = await wallet.parseSignPsbtUr(type, cbor, !!props.isFinalize);
if (props.onSuccess) {
props.onSuccess(res);
} else {
diff --git a/src/ui/pages/Wallet/ReceiveScreen/index.less b/src/ui/pages/Wallet/ReceiveScreen/index.less
index d8fcce4a..10c44aa6 100644
--- a/src/ui/pages/Wallet/ReceiveScreen/index.less
+++ b/src/ui/pages/Wallet/ReceiveScreen/index.less
@@ -10,7 +10,7 @@
flex-direction: row;
justify-content: center;
align-items: center;
- padding: 0.625rem 0px;
+ padding: 0.625rem 0;
gap: 0.625rem;
width: 25rem;
@@ -23,7 +23,7 @@
flex-direction: column;
justify-content: center;
align-items: center;
- padding: 0px;
+ padding: 0;
width: 0.98rem;
height: 1.37rem;
@@ -56,7 +56,7 @@
flex-direction: column;
justify-content: center;
align-items: center;
- padding: 0px;
+ padding: 0;
gap: 0.625rem;
width: 31.25rem;
height: 1.18rem;
diff --git a/src/ui/styles/global.less b/src/ui/styles/global.less
index 7acd0ce3..4efc814a 100644
--- a/src/ui/styles/global.less
+++ b/src/ui/styles/global.less
@@ -13,7 +13,7 @@
iframe {
overflow-clip-margin: content-box !important;
- border-width: 0px;
+ border-width: 0;
border-style: inset;
border-color: initial;
border-image: initial;
@@ -50,7 +50,7 @@ iframe {
}
div {
- border: 0px solid;
+ border: 0 solid;
}
// For scrollbar
diff --git a/src/ui/utils/index.ts b/src/ui/utils/index.ts
index 0c433620..6253a738 100644
--- a/src/ui/utils/index.ts
+++ b/src/ui/utils/index.ts
@@ -113,8 +113,7 @@ export async function sleep(timeSec: number) {
}
export function isValidAddress(address: string) {
- if (!address) return false;
- return true;
+ return !!address;
}
export const copyToClipboard = (textToCopy: string | number) => {